Notice: require(): Read of 9790 bytes failed with errno=12 Cannot allocate memory in /home3/freedo70/public_html/wp-settings.php on line 440
Notice: include(): Read of 21344 bytes failed with errno=12 Cannot allocate memory in /home3/freedo70/public_html/wp-content/plugins/wordpress-seo/vendor/composer/ClassLoader.php on line 576
Notice: include(): Read of 21344 bytes failed with errno=12 Cannot allocate memory in /home3/freedo70/public_html/wp-content/plugins/wordpress-seo/vendor/composer/ClassLoader.php on line 576
$this->add_academy_link( $wp_admin_bar );
$this->add_premium_link( $wp_admin_bar );
$this->add_brand_insights_link( $wp_admin_bar );
}
/**
* Enqueues admin bar assets.
*
* @return void
*/
public function enqueue_assets() {
if ( ! is_admin_bar_showing() ) {
return;
}
// If the current user can't write posts, this is all of no use, so let's not output an admin menu.
if ( ! current_user_can( 'edit_posts' ) ) {
return;
}
$this->asset_manager->register_assets();
$this->asset_manager->enqueue_style( 'adminbar' );
}
/**
* Registers the hooks.
*
* @return void
*/
public function register_hooks() {
if ( ! $this->meets_requirements() ) {
return;
}
add_action( 'admin_bar_menu', [ $this, 'add_menu' ], 95 );
add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_assets' ] );
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
}
/**
* Checks whether the requirements to use this class are met.
*
* @return bool True if requirements are met, false otherwise.
*/
public function meets_requirements() {
if ( is_network_admin() ) {
return WPSEO_Utils::is_plugin_network_active();
}
if ( WPSEO_Options::get( 'enable_admin_bar_menu' ) !== true ) {
return false;
}
return ! is_admin() || is_blog_admin();
}
/**
* Adds the admin bar root menu.
*
* @param WP_Admin_Bar $wp_admin_bar Admin bar instance to add the menu to.
*
* @return void
*/
protected function add_root_menu( WP_Admin_Bar $wp_admin_bar ) {
$title = $this->get_title();
$score = '';
$settings_url = '';
$counter = '';
$notification_popup = '';
$notification_count = 0;
$post = $this->get_singular_post();
if ( $post ) {
$score = $this->get_post_score( $post );
}
$term = $this->get_singular_term();
if ( $term ) {
$score = $this->get_term_score( $term );
}
$can_manage_options = $this->can_manage_options();
if ( $can_manage_options ) {
$settings_url = $this->get_settings_page_url();
}
if ( empty( $score ) && ! is_network_admin() && $can_manage_options ) {
$notification_center = Yoast_Notification_Center::get();
$notification_count = $notification_center->get_notification_count();
$counter = $this->get_notification_counter( $notification_count );
$notification_popup = $this->get_notification_popup();
}
$admin_bar_menu_args = [
'id' => self::MENU_IDENTIFIER,
'title' => $title . $score . $counter . $notification_popup,
'href' => $settings_url,
'meta' => [ 'tabindex' => ! empty( $settings_url ) ? false : '0' ],
];
$wp_admin_bar->add_menu( $admin_bar_menu_args );
if ( $notification_count > 0 ) {
$admin_bar_menu_args = [
'parent' => self::MENU_IDENTIFIER,
'id' => 'wpseo-notifications',
'title' => __( 'Notifications', 'wordpress-seo' ) . $counter,
'href' => empty( $settings_url ) ? '' : $settings_url . '#/alert-center',
'meta' => [ 'tabindex' => ! empty( $settings_url ) ? false : '0' ],
];
$wp_admin_bar->add_menu( $admin_bar_menu_args );
}
}
/**
* Adds the admin bar analysis submenu.
*
* @param WP_Admin_Bar $wp_admin_bar Admin bar instance to add the menu to.
*
* @return void
*/
protected function add_analysis_submenu( WP_Admin_Bar $wp_admin_bar ) {
try {
$url = YoastSEO()->meta->for_current_page()->canonical;
} catch ( Exception $e ) {
// This is not the type of error we can handle here.
return;
}
if ( ! $url ) {
return;
}
$menu_args = [
'parent' => self::MENU_IDENTIFIER,
'id' => self::ANALYSIS_SUBMENU_IDENTIFIER,
'title' => __( 'Analyze this page', 'wordpress-seo' ),
'meta' => [ 'tabindex' => '0' ],
];
$wp_admin_bar->add_menu( $menu_args );
$encoded_url = rawurlencode( $url );
$submenu_items = [
[
'id' => 'wpseo-inlinks',
'title' => __( 'Check links to this URL', 'wordpress-seo' ),
'href' => 'https://search.google.com/search-console/links/drilldown?resource_id=' . rawurlencode( get_option( 'siteurl' ) ) . '&type=EXTERNAL&target=' . $encoded_url . '&domain=',
],
[
'id' => 'wpseo-structureddata',
'title' => __( 'Google Rich Results Test', 'wordpress-seo' ),
'href' => 'https://search.google.com/test/rich-results?url=' . $encoded_url,
],
[
'id' => 'wpseo-facebookdebug',
'title' => __( 'Facebook Debugger', 'wordpress-seo' ),
'href' => '//developers.facebook.com/tools/debug/?q=' . $encoded_url,
],
[
'id' => 'wpseo-pagespeed',
'title' => __( 'Google Page Speed Test', 'wordpress-seo' ),
'href' => '//developers.google.com/speed/pagespeed/insights/?url=' . $encoded_url,
],
];
$this->add_submenu_items( $submenu_items, $wp_admin_bar, self::ANALYSIS_SUBMENU_IDENTIFIER );
}
/**
* Adds the admin bar tools submenu.
*
* @param WP_Admin_Bar $wp_admin_bar Admin bar instance to add the menu to.
*
* @return void
*/
protected function add_seo_tools_submenu( WP_Admin_Bar $wp_admin_bar ) {
$menu_args = [
'parent' => self::MENU_IDENTIFIER,
'id' => 'wpseo-sub-tools',
'title' => __( 'SEO Tools', 'wordpress-seo' ),
'meta' => [ 'tabindex' => '0' ],
];
$wp_admin_bar->add_menu( $menu_args );
$submenu_items = [
[
'id' => 'wpseo-semrush',
'title' => 'Semrush',
'href' => $this->shortlinker->build_shortlink( 'https://yoa.st/admin-bar-semrush' ),
],
[
'id' => 'wpseo-wincher',
'title' => 'Wincher',
'href' => $this->shortlinker->build_shortlink( 'https://yoa.st/admin-bar-wincher' ),
],
[
'id' => 'wpseo-google-trends',
'title' => 'Google trends',
'href' => $this->shortlinker->build_shortlink( 'https://yoa.st/admin-bar-gtrends' ),
],
];
$this->add_submenu_items( $submenu_items, $wp_admin_bar, 'wpseo-sub-tools' );
}
/**
* Adds the admin bar How To submenu.
*
* @param WP_Admin_Bar $wp_admin_bar Admin bar instance to add the menu to.
*
* @return void
*/
protected function add_how_to_submenu( WP_Admin_Bar $wp_admin_bar ) {
$menu_args = [
'parent' => self::MENU_IDENTIFIER,
'id' => 'wpseo-sub-howto',
'title' => __( 'How to', 'wordpress-seo' ),
'meta' => [ 'tabindex' => '0' ],
];
$wp_admin_bar->add_menu( $menu_args );
$submenu_items = [
[
'id' => 'wpseo-learn-seo',
'title' => __( 'Learn more SEO', 'wordpress-seo' ),
'href' => $this->shortlinker->build_shortlink( 'https://yoa.st/admin-bar-learn-more-seo' ),
],
[
'id' => 'wpseo-improve-blogpost',
'title' => __( 'Improve your blog post', 'wordpress-seo' ),
'href' => $this->shortlinker->build_shortlink( 'https://yoa.st/admin-bar-improve-blog-post' ),
],
[
'id' => 'wpseo-write-better-content',
'title' => __( 'Write better content', 'wordpress-seo' ),
'href' => $this->shortlinker->build_shortlink( 'https://yoa.st/admin-bar-write-better' ),
],
];
$this->add_submenu_items( $submenu_items, $wp_admin_bar, 'wpseo-sub-howto' );
}
/**
* Adds the admin bar How To submenu.
*
* @param WP_Admin_Bar $wp_admin_bar Admin bar instance to add the menu to.
*
* @return void
*/
protected function add_get_help_submenu( WP_Admin_Bar $wp_admin_bar ) {
$menu_args = [
'parent' => self::MENU_IDENTIFIER,
'id' => 'wpseo-sub-get-help',
'title' => __( 'Help', 'wordpress-seo' ),
'meta' => [ 'tabindex' => '0' ],
];
if ( current_user_can( Support_Integration::CAPABILITY ) ) {
$menu_args['href'] = admin_url( 'admin.php?page=' . Support_Integration::PAGE );
$wp_admin_bar->add_menu( $menu_args );
return;
}
$wp_admin_bar->add_menu( $menu_args );
$submenu_items = [
[
'id' => 'wpseo-yoast-help',
'title' => __( 'Yoast.com help section', 'wordpress-seo' ),
'href' => $this->shortlinker->build_shortlink( 'https://yoa.st/admin-bar-yoast-help' ),
],
[
'id' => 'wpseo-premium-support',
'title' => __( 'Yoast Premium support', 'wordpress-seo' ),
'href' => $this->shortlinker->build_shortlink( 'https://yoa.st/admin-bar-premium-support' ),
],
[
'id' => 'wpseo-wp-support-forums',
'title' => __( 'WordPress.org support forums', 'wordpress-seo' ),
'href' => $this->shortlinker->build_shortlink( 'https://yoa.st/admin-bar-wp-support-forums' ),
],
[
'id' => 'wpseo-learn-seo-2',
'title' => __( 'Learn more SEO', 'wordpress-seo' ),
'href' => $this->shortlinker->build_shortlink( 'https://yoa.st/admin-bar-learn-more-seo-help' ),
],
];
$this->add_submenu_items( $submenu_items, $wp_admin_bar, 'wpseo-sub-get-help' );
}
/**
* Adds the Academy link to the admin bar.
*
* @param WP_Admin_Bar $wp_admin_bar Admin bar instance to add the menu to.
*
* @return void
*/
protected function add_academy_link( WP_Admin_Bar $wp_admin_bar ) {
$wp_admin_bar->add_menu(
[
'parent' => self::MENU_IDENTIFIER,
'id' => 'wpseo-academy',
'title' => __( 'Academy', 'wordpress-seo' ),
'href' => admin_url( 'admin.php?page=wpseo_page_academy' ),
'meta' => [
'tabindex' => '0',
],
],
);
}
/**
* Adds the Upgrade link to the admin bar.
*
* @param WP_Admin_Bar $wp_admin_bar Admin bar instance to add the menu to.
*
* @return void
*/
protected function add_premium_link( WP_Admin_Bar $wp_admin_bar ) {
// Don't show the Upgrade button if Yoast SEO WooCommerce addon is active.
$addon_manager = new WPSEO_Addon_Manager();
if ( $addon_manager->is_installed( WPSEO_Addon_Manager::WOOCOMMERCE_SLUG ) ) {
return;
}
$has_woocommerce = ( new Woocommerce_Conditional() )->is_met();
// Don't show the Upgrade button if Premium is active without the WooCommerce plugin.
if ( $this->product_helper->is_premium() && ! $has_woocommerce ) {
return;
}
$link = $this->shortlinker->build_shortlink( 'https://yoa.st/admin-bar-get-premium' );
if ( $has_woocommerce ) {
$link = $this->shortlinker->build_shortlink( 'https://yoa.st/admin-bar-get-premium-woocommerce' );
}
$button_label = esc_html__( 'Upgrade', 'wordpress-seo' );
if ( YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-promotion' ) ) {
$button_label = esc_html__( '30% off - BF Sale', 'wordpress-seo' );
}
$wp_admin_bar->add_menu(
[
'parent' => self::MENU_IDENTIFIER,
'id' => 'wpseo-get-premium',
// Circumvent an issue in the WP admin bar API in order to pass `data` attributes. See https://core.trac.wordpress.org/ticket/38636.
'title' => sprintf(
'%2$s',
esc_url( $link ),
$button_label,
),
'meta' => [
'tabindex' => '0',
],
],
);
}
/**
* Adds the Brand Insights link to the admin bar.
*
* @param WP_Admin_Bar $wp_admin_bar Admin bar instance to add the menu to.
*
* @return void
*/
protected function add_brand_insights_link( WP_Admin_Bar $wp_admin_bar ) {
$page = $this->product_helper->is_premium() ? 'wpseo_brand_insights_premium' : 'wpseo_brand_insights';
$button_content = 'AI Brand Insights';
$menu_title = ''
. ''
. $button_content
. Brand_Insights_Page::EXTERNAL_LINK_ICON
. '';
$wp_admin_bar->add_menu(
[
'parent' => self::MENU_IDENTIFIER,
'id' => $page,
'title' => $menu_title,
'href' => admin_url( 'admin.php?page=' . $page ),
'meta' => [
'tabindex' => '0',
'target' => '_blank',
],
],
);
}
/**
* Adds the admin bar settings submenu.
*
* @param WP_Admin_Bar $wp_admin_bar Admin bar instance to add the menu to.
*
* @return void
*/
protected function add_settings_submenu( WP_Admin_Bar $wp_admin_bar ) {
if ( ! $this->can_manage_options() ) {
return;
}
$admin_menu = new WPSEO_Admin_Menu( new WPSEO_Menu() );
$submenu_pages = $admin_menu->get_submenu_pages();
$menu_args = [
'parent' => self::MENU_IDENTIFIER,
'id' => self::SETTINGS_SUBMENU_IDENTIFIER,
'title' => __( 'SEO Settings', 'wordpress-seo' ),
'meta' => [ 'tabindex' => '0' ],
];
$wp_admin_bar->add_menu( $menu_args );
foreach ( $submenu_pages as $submenu_page ) {
if ( ! current_user_can( $submenu_page[3] ) ) {
continue;
}
// Don't add the Google Search Console menu item.
if ( $submenu_page[4] === 'wpseo_search_console' ) {
continue;
}
// Don't add the Academy menu item (it's now in the main menu).
if ( $submenu_page[4] === 'wpseo_page_academy' ) {
continue;
}
// Don't add the Brand Insights menu items (they're now in the main menu).
if ( $submenu_page[4] === 'wpseo_brand_insights' || $submenu_page[4] === 'wpseo_brand_insights_premium' ) {
continue;
}
$id = 'wpseo-' . str_replace( '_', '-', str_replace( 'wpseo_', '', $submenu_page[4] ) );
if ( $id === 'wpseo-dashboard' ) {
$id = 'wpseo-general';
}
$menu_args = [
'parent' => self::SETTINGS_SUBMENU_IDENTIFIER,
'id' => $id,
'title' => $submenu_page[2],
'href' => admin_url( 'admin.php?page=' . rawurlencode( $submenu_page[4] ) ),
];
$wp_admin_bar->add_menu( $menu_args );
}
}
/**
* Adds the admin bar network settings submenu.
*
* @param WP_Admin_Bar $wp_admin_bar Admin bar instance to add the menu to.
*
* @return void
*/
protected function add_network_settings_submenu( WP_Admin_Bar $wp_admin_bar ) {
if ( ! $this->can_manage_options() ) {
return;
}
$network_admin_menu = new WPSEO_Network_Admin_Menu( new WPSEO_Menu() );
$submenu_pages = $network_admin_menu->get_submenu_pages();
$menu_args = [
'parent' => self::MENU_IDENTIFIER,
'id' => self::NETWORK_SETTINGS_SUBMENU_IDENTIFIER,
'title' => __( 'SEO Settings', 'wordpress-seo' ),
'meta' => [ 'tabindex' => '0' ],
];
$wp_admin_bar->add_menu( $menu_args );
foreach ( $submenu_pages as $submenu_page ) {
if ( ! current_user_can( $submenu_page[3] ) ) {
continue;
}
$id = 'wpseo-' . str_replace( '_', '-', str_replace( 'wpseo_', '', $submenu_page[4] ) );
if ( $id === 'wpseo-dashboard' ) {
$id = 'wpseo-general';
}
$menu_args = [
'parent' => self::NETWORK_SETTINGS_SUBMENU_IDENTIFIER,
'id' => $id,
'title' => $submenu_page[2],
'href' => network_admin_url( 'admin.php?page=' . rawurlencode( $submenu_page[4] ) ),
];
$wp_admin_bar->add_menu( $menu_args );
}
}
/**
* Gets the menu title markup.
*
* @return string Admin bar title markup.
*/
protected function get_title() {
return '' . __( 'SEO', 'wordpress-seo' ) . '
';
}
/**
* Gets the current post if in a singular post context.
*
* @global string $pagenow Current page identifier.
* @global WP_Post|null $post Current post object, or null if none available.
*
* @return WP_Post|null Post object, or null if not in singular context.
*/
protected function get_singular_post() {
global $pagenow, $post;
if ( ! is_singular() && ( ! is_blog_admin() || ! WPSEO_Metabox::is_post_edit( $pagenow ) ) ) {
return null;
}
if ( ! isset( $post ) || ! is_object( $post ) || ! $post instanceof WP_Post ) {
return null;
}
return $post;
}
/**
* Gets the focus keyword for a given post.
*
* @param WP_Post $post Post object to get its focus keyword.
*
* @return string Focus keyword, or empty string if none available.
*/
protected function get_post_focus_keyword( $post ) {
if ( ! is_object( $post ) || ! property_exists( $post, 'ID' ) ) {
return '';
}
/**
* Filter: 'wpseo_use_page_analysis' Determines if the analysis should be enabled.
*
* @param bool $enabled Determines if the analysis should be enabled.
*/
if ( apply_filters( 'wpseo_use_page_analysis', true ) !== true ) {
return '';
}
return WPSEO_Meta::get_value( 'focuskw', $post->ID );
}
/**
* Gets the score for a given post.
*
* @param WP_Post $post Post object to get its score.
*
* @return string Score markup, or empty string if none available.
*/
protected function get_post_score( $post ) {
if ( ! is_object( $post ) || ! property_exists( $post, 'ID' ) ) {
return '';
}
if ( apply_filters( 'wpseo_use_page_analysis', true ) !== true ) {
return '';
}
return $this->get_score_icon();
}
/**
* Gets the current term if in a singular term context.
*
* @global string $pagenow Current page identifier.
* @global WP_Query $wp_query Current query object.
* @global WP_Term|null $tag Current term object, or null if none available.
*
* @return WP_Term|null Term object, or null if not in singular context.
*/
protected function get_singular_term() {
global $pagenow, $wp_query, $tag;
if ( is_category() || is_tag() || is_tax() ) {
return $wp_query->get_queried_object();
}
if ( WPSEO_Taxonomy::is_term_edit( $pagenow ) && ! WPSEO_Taxonomy::is_term_overview( $pagenow ) && isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag ) ) {
return get_term( $tag->term_id );
}
return null;
}
/**
* Gets the score for a given term.
*
* @param WP_Term $term Term object to get its score.
*
* @return string Score markup, or empty string if none available.
*/
protected function get_term_score( $term ) {
if ( ! is_object( $term ) || ! property_exists( $term, 'term_id' ) || ! property_exists( $term, 'taxonomy' ) ) {
return '';
}
return $this->get_score_icon();
}
/**
* Create the score icon.
*
* @return string The score icon, or empty string.
*/
protected function get_score_icon() {
$is_seo_enabled = $this->get_is_seo_enabled();
$is_readability_enabled = $this->get_is_readability_enabled();
$indexable = $this->get_current_indexable();
if ( $is_seo_enabled ) {
return $this->score_icon_helper->for_seo( $indexable, 'adminbar-seo-score' )->present();
}
if ( $is_readability_enabled ) {
return $this->score_icon_helper->for_readability( $indexable->readability_score, 'adminbar-seo-score' )
->present();
}
return '';
}
/**
* Gets the URL to the main admin settings page.
*
* @return string Admin settings page URL.
*/
protected function get_settings_page_url() {
return self_admin_url( 'admin.php?page=' . WPSEO_Admin::PAGE_IDENTIFIER );
}
/**
* Gets the notification counter if in a valid context.
*
* @param int $notification_count Number of notifications.
*
* @return string Notification counter markup, or empty string if not available.
*/
protected function get_notification_counter( $notification_count ) {
/* translators: Hidden accessibility text; %s: number of notifications. */
$counter_screen_reader_text = sprintf( _n( '%s notification', '%s notifications', $notification_count, 'wordpress-seo' ), number_format_i18n( $notification_count ) );
return sprintf(
' %d%s
',
( $notification_count ) ? '' : ' wpseo-no-adminbar-notifications',
$notification_count,
$counter_screen_reader_text,
);
}
/**
* Gets the notification popup if in a valid context.
*
* @return string Notification popup markup, or empty string if not available.
*/
protected function get_notification_popup() {
$notification_center = Yoast_Notification_Center::get();
$new_notifications = $notification_center->get_new_notifications();
$new_notifications_count = count( $new_notifications );
if ( ! $new_notifications_count ) {
return '';
}
$notification = sprintf(
_n(
'There is a new notification.',
'There are new notifications.',
$new_notifications_count,
'wordpress-seo',
),
$new_notifications_count,
);
return '' . $notification . '
';
}
/**
* Checks whether the current user can manage options in the current context.
*
* @return bool True if capabilities are sufficient, false otherwise.
*/
protected function can_manage_options() {
return ( is_network_admin() && current_user_can( 'wpseo_manage_network_options' ) )
|| ( ! is_network_admin() && WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ) );
}
/**
* Add submenu items to a menu item.
*
* @param array $submenu_items Submenu items array.
* @param WP_Admin_Bar $wp_admin_bar Admin bar object.
* @param string $parent_id Parent menu item ID.
*
* @return void
*/
protected function add_submenu_items( array $submenu_items, WP_Admin_Bar $wp_admin_bar, $parent_id ) {
foreach ( $submenu_items as $menu_item ) {
$menu_args = [
'parent' => $parent_id,
'id' => $menu_item['id'],
'title' => $menu_item['title'],
'href' => $menu_item['href'],
'meta' => [ 'target' => '_blank' ],
];
$wp_admin_bar->add_menu( $menu_args );
}
}
}
Fatal error: Uncaught Error: Class "WPSEO_Admin_Bar_Menu" not found in /home3/freedo70/public_html/wp-content/plugins/wordpress-seo/inc/wpseo-non-ajax-functions.php:20
Stack trace:
#0 /home3/freedo70/public_html/wp-includes/class-wp-hook.php(341): wpseo_initialize_admin_bar('')
#1 /home3/freedo70/public_html/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array)
#2 /home3/freedo70/public_html/wp-includes/plugin.php(522): WP_Hook->do_action(Array)
#3 /home3/freedo70/public_html/wp-settings.php(793): do_action('wp_loaded')
#4 /home3/freedo70/public_html/wp-config.php(89): require_once('/home3/freedo70...')
#5 /home3/freedo70/public_html/wp-load.php(50): require_once('/home3/freedo70...')
#6 /home3/freedo70/public_html/wp-blog-header.php(13): require_once('/home3/freedo70...')
#7 /home3/freedo70/public_html/index.php(17): require('/home3/freedo70...')
#8 {main}
thrown in /home3/freedo70/public_html/wp-content/plugins/wordpress-seo/inc/wpseo-non-ajax-functions.php on line 20