/** * Output the page analysis results. * * @param object $post Post to output the page analysis results for. * * @return string */ function linkdex_output($post) { $results = $this->calculate_results($post); if (is_wp_error($results)) { $error = $results->get_error_messages(); return '<tr><td><div class="wpseo_msg"><p><strong>' . esc_html($error[0]) . '</strong></p></div></td></tr>'; } $output = ''; if (is_array($results) && $results !== array()) { $output = '<table class="wpseoanalysis">'; $perc_score = absint($results['total']); unset($results['total']); // unset to prevent echoing it. foreach ($results as $result) { if (is_array($result)) { $score = wpseo_translate_score($result['val']); $output .= '<tr><td class="score"><div class="' . esc_attr('wpseo-score-icon ' . $score) . '"></div></td><td>' . $result['msg'] . '</td></tr>'; } } $output .= '</table>'; if (WP_DEBUG === true || defined('WPSEO_DEBUG') && WPSEO_DEBUG === true) { $output .= '<p><small>(' . $perc_score . '%)</small></p>'; } } $output = '<div class="wpseo_msg"><p>' . __('To update this page analysis, save as draft or update and check this tab again', 'wordpress-seo') . '.</p></div>' . $output; unset($results); return $output; }
/** * Adds an SEO admin bar menu with several options. If the current user is an admin he can also go straight to several settings menu's from here. */ function wpseo_admin_bar_menu() { // 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; } global $wp_admin_bar, $wpseo_front, $post; if (is_object($wpseo_front)) { $url = $wpseo_front->canonical(false); } else { $url = ''; } $focuskw = ''; $score = ''; $seo_url = get_admin_url('admin.php?page=wpseo_dashboard'); if (is_singular() && isset($post) && is_object($post) && apply_filters('wpseo_use_page_analysis', true) === true) { $focuskw = wpseo_get_value('focuskw', $post->ID); $perc_score = wpseo_get_value('linkdex', $post->ID); $txtscore = wpseo_translate_score(round($perc_score / 10)); $score = '<div alt="' . ucfirst($txtscore) . '" title="' . ucfirst($txtscore) . '" class="wpseo_score_img ' . $txtscore . ' ' . $perc_score . '"></div>'; $seo_url = get_edit_post_link($post->ID); if ($txtscore != 'na') { $seo_url .= '#wpseo_linkdex'; } } $wp_admin_bar->add_menu(array('id' => 'wpseo-menu', 'title' => __('SEO', 'wordpress-seo') . $score, 'href' => $seo_url)); $wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-kwresearch', 'title' => __('Keyword Research', 'wordpress-seo'), '#')); $wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-adwordsexternal', 'title' => __('AdWords External', 'wordpress-seo'), 'href' => 'https://adwords.google.com/select/KeywordToolExternal', 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-googleinsights', 'title' => __('Google Insights', 'wordpress-seo'), 'href' => 'http://www.google.com/insights/search/#q=' . urlencode($focuskw) . '&cmpt=q', 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-wordtracker', 'title' => __('SEO Book', 'wordpress-seo'), 'href' => 'http://tools.seobook.com/keyword-tools/seobook/?keyword=' . urlencode($focuskw), 'meta' => array('target' => '_blank'))); if (!is_admin()) { $wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-analysis', 'title' => __('Analyze this page', 'wordpress-seo'), '#')); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-inlinks-ose', 'title' => __('Check Inlinks (OSE)', 'wordpress-seo'), 'href' => 'http://www.opensiteexplorer.org/' . str_replace('/', '%252F', preg_replace('/^https?:\\/\\//', '', $url)) . '/a!links', 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-kwdensity', 'title' => __('Check Keyword Density', 'wordpress-seo'), 'href' => 'http://tools.davidnaylor.co.uk/keyworddensity/index.php?url=' . $url . '&keyword=' . urlencode($focuskw), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-cache', 'title' => __('Check Google Cache', 'wordpress-seo'), 'href' => 'http://webcache.googleusercontent.com/search?strip=1&q=cache:' . $url, 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-header', 'title' => __('Check Headers', 'wordpress-seo'), 'href' => 'http://quixapp.com/headers/?r=' . urlencode($url), 'meta' => array('target' => '_blank'))); } $admin_menu = false; if (function_exists('is_multisite') && is_multisite()) { $options = get_site_option('wpseo_ms'); if (is_array($options) && isset($options['access']) && $options['access'] == 'superadmin') { if (is_super_admin()) { $admin_menu = true; } else { $admin_menu = false; } } else { if (current_user_can('manage_options')) { $admin_menu = true; } else { $admin_menu = false; } } } else { if (current_user_can('manage_options')) { $admin_menu = true; } } if ($admin_menu) { $wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-settings', 'title' => __('SEO Settings', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_titles'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-titles', 'title' => __("Titles & Metas", 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_titles'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-social', 'title' => __('Social', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_social'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-xml', 'title' => __('XML Sitemaps', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_xml'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-permalinks', 'title' => __('Permalinks', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_permalinks'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-internal-links', 'title' => __('Internal Links', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_internal-links'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-rss', 'title' => __('RSS', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_rss'))); } }
/** * Output the page analysis results. * * @param object $post Post to output the page analysis results for. * @return string */ function linkdex_output($post) { $results = $this->calculate_results($post); if (is_wp_error($results)) { $error = $results->get_error_messages(); return '<div class="wpseo_msg"><p><strong>' . esc_html($error[0]) . '</strong></p></div>'; } $output = '<table class="wpseoanalysis">'; $perc_score = absint(wpseo_get_value('linkdex')); foreach ($results as $result) { $score = wpseo_translate_score($result['val']); $output .= '<tr><td class="score"><div class="wpseo_score_img ' . esc_attr($score) . '"></div></td><td>' . $result['msg'] . '</td></tr>'; } $output .= '</table>'; if (WP_DEBUG) { $output .= '<p><small>(' . $perc_score . '%)</small></p>'; } $output = '<div class="wpseo_msg"><p>' . __('To update this page analysis, save as draft or update and check this tab again', 'wordpress-seo') . '.</p></div>' . $output; unset($results); return $output; }
/** * Adds an SEO admin bar menu with several options. If the current user is an admin he can also go straight to several settings menu's from here. */ function wpseo_admin_bar_menu() { // 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; } global $wp_admin_bar, $wpseo_front, $post; $url = ''; if ( is_object( $wpseo_front ) ) { $url = $wpseo_front->canonical( false ); } $focuskw = ''; $score = ''; $seo_url = get_admin_url( null, 'admin.php?page=wpseo_dashboard' ); if ( ( is_singular() || ( is_admin() && in_array( $GLOBALS['pagenow'], array( 'post.php', 'post-new.php' ), true ) ) ) && isset( $post ) && is_object( $post ) && apply_filters( 'wpseo_use_page_analysis', true ) === true ) { $focuskw = WPSEO_Meta::get_value( 'focuskw', $post->ID ); $perc_score = WPSEO_Meta::get_value( 'linkdex', $post->ID ); $calc_score = wpseo_calc( $perc_score, '/', 10, true ); $txtscore = wpseo_translate_score( $calc_score ); $title = wpseo_translate_score( $calc_score, false ); $score = '<div title="' . esc_attr( $title ) . '" class="' . esc_attr( 'wpseo_score_img ' . $txtscore . ' ' . $perc_score ) . '"></div>'; $seo_url = get_edit_post_link( $post->ID ); if ( $txtscore !== 'na' ) { $seo_url .= '#wpseo_linkdex'; } } $wp_admin_bar->add_menu( array( 'id' => 'wpseo-menu', 'title' => __( 'SEO', 'wordpress-seo' ) . $score, 'href' => $seo_url, ) ); $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-menu', 'id' => 'wpseo-kwresearch', 'title' => __( 'Keyword Research', 'wordpress-seo' ), '#', ) ); $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-kwresearch', 'id' => 'wpseo-adwordsexternal', 'title' => __( 'AdWords External', 'wordpress-seo' ), 'href' => 'http://adwords.google.com/keywordplanner', 'meta' => array( 'target' => '_blank' ) ) ); $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-kwresearch', 'id' => 'wpseo-googleinsights', 'title' => __( 'Google Insights', 'wordpress-seo' ), 'href' => 'http://www.google.com/insights/search/#q=' . urlencode( $focuskw ) . '&cmpt=q', 'meta' => array( 'target' => '_blank' ) ) ); $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-kwresearch', 'id' => 'wpseo-wordtracker', 'title' => __( 'SEO Book', 'wordpress-seo' ), 'href' => 'http://tools.seobook.com/keyword-tools/seobook/?keyword=' . urlencode( $focuskw ), 'meta' => array( 'target' => '_blank' ) ) ); if ( ! is_admin() ) { $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-menu', 'id' => 'wpseo-analysis', 'title' => __( 'Analyze this page', 'wordpress-seo' ), '#', ) ); if ( is_string( $url ) ) { // @todo [JRF => whomever] check if this url shouldn't be encoded either with urlencode or with esc_url or something $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-analysis', 'id' => 'wpseo-inlinks-ose', 'title' => __( 'Check Inlinks (OSE)', 'wordpress-seo' ), 'href' => 'http://www.opensiteexplorer.org/' . str_replace( '/', '%252F', preg_replace( '`^http[s]?://`', '', $url ) ) . '/a!links', 'meta' => array( 'target' => '_blank' ) ) ); $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-analysis', 'id' => 'wpseo-kwdensity', 'title' => __( 'Check Keyword Density', 'wordpress-seo' ), 'href' => 'http://www.zippy.co.uk/keyworddensity/index.php?url=' . urlencode( $url ) . '&keyword=' . urlencode( $focuskw ), 'meta' => array( 'target' => '_blank' ) ) ); $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-analysis', 'id' => 'wpseo-cache', 'title' => __( 'Check Google Cache', 'wordpress-seo' ), 'href' => 'http://webcache.googleusercontent.com/search?strip=1&q=cache:' . urlencode( $url ), 'meta' => array( 'target' => '_blank' ) ) ); $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-analysis', 'id' => 'wpseo-header', 'title' => __( 'Check Headers', 'wordpress-seo' ), 'href' => 'http://quixapp.com/headers/?r=' . urlencode( $url ), 'meta' => array( 'target' => '_blank' ) ) ); $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-analysis', 'id' => 'wpseo-richsnippets', 'title' => __( 'Check Rich Snippets', 'wordpress-seo' ), 'href' => 'http://www.google.com/webmasters/tools/richsnippets?q=' . urlencode( $url ), 'meta' => array( 'target' => '_blank' ) ) ); $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-analysis', 'id' => 'wpseo-facebookdebug', 'title' => __( 'Facebook Debugger', 'wordpress-seo' ), 'href' => 'https://developers.facebook.com/tools/debug/og/object?q=' . urlencode( $url ), 'meta' => array( 'target' => '_blank' ) ) ); } } $admin_menu = false; if ( function_exists( 'is_multisite' ) && is_multisite() ) { $options = get_site_option( 'wpseo_ms' ); if ( $options['access'] === 'superadmin' ) { if ( is_super_admin() ) { $admin_menu = true; } else { $admin_menu = false; } } else { if ( current_user_can( 'manage_options' ) ) { $admin_menu = true; } else { $admin_menu = false; } } } else { if ( current_user_can( 'manage_options' ) ) { $admin_menu = true; } } // @todo: add links to bulk title and bulk description edit pages if ( $admin_menu ) { $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-menu', 'id' => 'wpseo-settings', 'title' => __( 'SEO Settings', 'wordpress-seo' ), 'href' => admin_url( 'admin.php?page=wpseo_titles' ), ) ); $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-settings', 'id' => 'wpseo-titles', 'title' => __( 'Titles & Metas', 'wordpress-seo' ), 'href' => admin_url( 'admin.php?page=wpseo_titles' ), ) ); $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-settings', 'id' => 'wpseo-social', 'title' => __( 'Social', 'wordpress-seo' ), 'href' => admin_url( 'admin.php?page=wpseo_social' ), ) ); $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-settings', 'id' => 'wpseo-xml', 'title' => __( 'XML Sitemaps', 'wordpress-seo' ), 'href' => admin_url( 'admin.php?page=wpseo_xml' ), ) ); $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-settings', 'id' => 'wpseo-permalinks', 'title' => __( 'Permalinks', 'wordpress-seo' ), 'href' => admin_url( 'admin.php?page=wpseo_permalinks' ), ) ); $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-settings', 'id' => 'wpseo-internal-links', 'title' => __( 'Internal Links', 'wordpress-seo' ), 'href' => admin_url( 'admin.php?page=wpseo_internal-links' ), ) ); $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-settings', 'id' => 'wpseo-rss', 'title' => __( 'RSS', 'wordpress-seo' ), 'href' => admin_url( 'admin.php?page=wpseo_rss' ), ) ); $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-settings', 'id' => 'wpseo-import', 'title' => __( 'Import & Export', 'wordpress-seo' ), 'href' => admin_url( 'admin.php?page=wpseo_import' ), ) ); // Check where to add the edit files page if ( ! ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) && ! ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) ) { $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-settings', 'id' => 'wpseo-files', 'title' => __( 'Edit Files', 'wordpress-seo'), 'href' => admin_url( 'admin.php?page=wpseo_files' ), ) ); } $wp_admin_bar->add_menu( array( 'parent' => 'wpseo-settings', 'id' => 'wpseo-licenses', 'title' => __( 'Extensions', 'wordpress-seo'), 'href' => admin_url( 'admin.php?page=wpseo_licenses' ), ) ); } }
/** * wpseo_translate_score has been deprecated in newer versions of wordpress-seo * * @param int $nr * * @return mixed */ protected function wpseo_translate_score($nr) { if (method_exists('WPSEO_Utils', 'translate_score')) { return WPSEO_Utils::translate_score($nr); } return wpseo_translate_score($nr); }
/** * Output the page analysis results. * * @param object $post Post to output the page analysis results for. * @return string */ function linkdex_output($post) { $results = $this->calculate_results($post); if (is_wp_error($results)) { $error = $results->get_error_messages(); return '<div class="wpseo_msg"><p><strong>' . $error[0] . '</strong></p></div>'; } $output = '<table class="wpseoanalysis">'; $perc_score = wpseo_get_value('linkdex'); foreach ($results as $result) { $score = wpseo_translate_score($result['val']); $output .= '<tr><td class="score"><div class="wpseo_score_img ' . $score . '"></div></td><td>' . $result['msg'] . '</td></tr>'; } $output .= '</table>'; $output .= '<hr/>'; $output .= '<p style="font-size: 13px;"><a href="http://yoast.com/out/linkdex/"><img class="alignleft" style="margin: 0 10px 5px 0;" src="' . WPSEO_URL . 'images/linkdex-logo.png" alt="Linkdex"/></a>' . sprintf(__('This page analysis brought to you by the collaboration of Yoast and %sLinkdex%s. Linkdex is an SEO suite that helps you optimize your site and offers you all the SEO tools you\'ll need. Yoast uses %sLinkdex%s and highly recommends you do too!', 'wordpress-seo'), '<a href="http://yoast.com/out/linkdex/">', '</a>', '<a href="http://yoast.com/out/linkdex/">', '</a>') . '</p>'; if (WP_DEBUG) { $output .= '<p><small>(' . $perc_score . '%)</small></p>'; } $output = '<div class="wpseo_msg"><p>' . __('To update this page analysis, save as draft or update and check this tab again', 'wordpress-seo') . '.</p></div>' . $output; unset($results); return $output; }
/** * Adds an SEO admin bar menu with several options. If the current user is an admin he can also go straight to several settings menu's from here. */ function wpseo_admin_bar_menu() { // 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; } global $wp_admin_bar, $wpseo_front, $post; $url = ''; if (is_object($wpseo_front)) { $url = $wpseo_front->canonical(false); } $focuskw = ''; $score = ''; $seo_url = get_admin_url(null, 'admin.php?page=wpseo_dashboard'); if ((is_singular() || is_admin() && in_array($GLOBALS['pagenow'], array('post.php', 'post-new.php'), true)) && isset($post) && is_object($post) && apply_filters('wpseo_use_page_analysis', true) === true) { $focuskw = WPSEO_Meta::get_value('focuskw', $post->ID); $perc_score = WPSEO_Meta::get_value('linkdex', $post->ID); $calc_score = wpseo_calc($perc_score, '/', 10, true); $txtscore = wpseo_translate_score($calc_score); $title = wpseo_translate_score($calc_score, false); $score = '<div title="' . esc_attr($title) . '" class="' . esc_attr('wpseo-score-icon ' . $txtscore . ' ' . $perc_score) . '"></div>'; $seo_url = get_edit_post_link($post->ID); if ($txtscore !== 'na') { $seo_url .= '#wpseo_linkdex'; } } $wp_admin_bar->add_menu(array('id' => 'wpseo-menu', 'title' => __('SEO', 'wordpress-seo') . $score, 'href' => $seo_url)); $wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-kwresearch', 'title' => __('Keyword Research', 'wordpress-seo'), '#')); $wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-adwordsexternal', 'title' => __('AdWords External', 'wordpress-seo'), 'href' => 'http://adwords.google.com/keywordplanner', 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-googleinsights', 'title' => __('Google Insights', 'wordpress-seo'), 'href' => 'http://www.google.com/insights/search/#q=' . urlencode($focuskw) . '&cmpt=q', 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-kwresearch', 'id' => 'wpseo-wordtracker', 'title' => __('SEO Book', 'wordpress-seo'), 'href' => 'http://tools.seobook.com/keyword-tools/seobook/?keyword=' . urlencode($focuskw), 'meta' => array('target' => '_blank'))); if (!is_admin()) { $wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-analysis', 'title' => __('Analyze this page', 'wordpress-seo'), '#')); if (is_string($url)) { // @todo [JRF => whomever] check if this url shouldn't be encoded either with urlencode or with esc_url or something $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-inlinks-ose', 'title' => __('Check Inlinks (OSE)', 'wordpress-seo'), 'href' => '//moz.com/researchtools/ose/links?site=' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-kwdensity', 'title' => __('Check Keyword Density', 'wordpress-seo'), 'href' => '//www.zippy.co.uk/keyworddensity/index.php?url=' . urlencode($url) . '&keyword=' . urlencode($focuskw), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-cache', 'title' => __('Check Google Cache', 'wordpress-seo'), 'href' => '//webcache.googleusercontent.com/search?strip=1&q=cache:' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-header', 'title' => __('Check Headers', 'wordpress-seo'), 'href' => '//quixapp.com/headers/?r=' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-richsnippets', 'title' => __('Check Rich Snippets', 'wordpress-seo'), 'href' => '//www.google.com/webmasters/tools/richsnippets?q=' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-facebookdebug', 'title' => __('Facebook Debugger', 'wordpress-seo'), 'href' => '//developers.facebook.com/tools/debug/og/object?q=' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-pinterestvalidator', 'title' => __('Pinterest Rich Pins Validator', 'wordpress-seo'), 'href' => '//developers.pinterest.com/rich_pins/validator/?link=' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-htmlvalidation', 'title' => __('HTML Validator', 'wordpress-seo'), 'href' => '//validator.w3.org/check?uri=' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-cssvalidation', 'title' => __('CSS Validator', 'wordpress-seo'), 'href' => '//jigsaw.w3.org/css-validator/validator?uri=' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-pagespeed', 'title' => __('Google Page Speed Test', 'wordpress-seo'), 'href' => '//developers.google.com/speed/pagespeed/insights/?url=' . urlencode($url), 'meta' => array('target' => '_blank'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-analysis', 'id' => 'wpseo-modernie', 'title' => __('Modern IE Site Scan', 'wordpress-seo'), 'href' => '//www.modern.ie/en-us/report#' . urlencode($url), 'meta' => array('target' => '_blank'))); } } $admin_menu = false; if (is_multisite()) { $options = get_site_option('wpseo_ms'); if ($options['access'] === 'superadmin' && is_super_admin()) { $admin_menu = true; } elseif (current_user_can('manage_options')) { $admin_menu = true; } } elseif (current_user_can('manage_options')) { $admin_menu = true; } // @todo: add links to bulk title and bulk description edit pages if ($admin_menu) { $wp_admin_bar->add_menu(array('parent' => 'wpseo-menu', 'id' => 'wpseo-settings', 'title' => __('SEO Settings', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_titles'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-titles', 'title' => __('Titles & Metas', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_titles'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-social', 'title' => __('Social', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_social'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-xml', 'title' => __('XML Sitemaps', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_xml'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-permalinks', 'title' => __('Permalinks', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_permalinks'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-internal-links', 'title' => __('Internal Links', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_internal-links'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-rss', 'title' => __('RSS', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_rss'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-import', 'title' => esc_html__('Import & Export', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_import'))); $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo_bulk-editor', 'title' => __('Bulk Editor', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_bulk-editor'))); // Check where to add the edit files page if (wpseo_allow_system_file_edit() === true) { $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-files', 'title' => __('Edit Files', 'wordpress-seo'), 'href' => network_admin_url('admin.php?page=wpseo_files'))); // will auto-use admin_url if not in multi-site } $wp_admin_bar->add_menu(array('parent' => 'wpseo-settings', 'id' => 'wpseo-licenses', 'title' => __('Extensions', 'wordpress-seo'), 'href' => admin_url('admin.php?page=wpseo_licenses'))); } }
/** * Set Post Data */ private function setPostData($post) { $this->post_data['template'] = get_post_meta($post->ID, '_wp_page_template', true); // Show Hide in generated nav menu $ns = get_post_meta(get_the_id(), 'np_nav_status', true); $this->post_data['nav_status'] = $ns == 'hide' ? 'hide' : 'show'; // Hidden in Nested Pages? $np_status = get_post_meta(get_the_id(), 'nested_pages_status', true); $this->post_data['np_status'] = $np_status == 'hide' ? 'hide' : 'show'; // Menu Title $this->post_data['nav_title'] = get_post_meta(get_the_id(), 'np_nav_title', true); // Redirect Link Target $this->post_data['link_target'] = get_post_meta(get_the_id(), 'np_link_target', true); // Parent ID $this->post_data['parent_id'] = $post->post_parent; // Nav Title Attribute $this->post_data['nav_title_attr'] = get_post_meta(get_the_id(), 'np_title_attribute', true); // Nav CSS Classes $this->post_data['nav_css'] = get_post_meta(get_the_id(), 'np_nav_css_classes', true); // Post Password $this->post_data['password'] = $post->post_password; // Yoast Score if (function_exists('wpseo_translate_score')) { $yoast_score = get_post_meta(get_the_id(), '_yoast_wpseo_linkdex', true); $this->post_data['score'] = wpseo_translate_score($yoast_score); } // Date Vars $this->post_data['d'] = get_the_time('d'); $this->post_data['month'] = get_the_time('m'); $this->post_data['y'] = get_the_time('Y'); $this->post_data['h'] = get_the_time('H'); $this->post_data['m'] = get_the_time('i'); }