• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wpseo_translate_score函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wpseo_translate_score函数的典型用法代码示例。如果您正苦于以下问题:PHP wpseo_translate_score函数的具体用法?PHP wpseo_translate_score怎么用?PHP wpseo_translate_score使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wpseo_translate_score函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: linkdex_output

 /**
  * 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;
 }
开发者ID:michalvittek,项目名称:wordpress-seo,代码行数:35,代码来源:class-metabox.php


示例2: wpseo_admin_bar_menu

/**
 * 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')));
    }
}
开发者ID:robjcordes,项目名称:nexnewwp,代码行数:71,代码来源:wpseo-non-ajax-functions.php


示例3: linkdex_output

 /**
  * 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;
 }
开发者ID:macosxvn,项目名称:techheroes,代码行数:27,代码来源:class-metabox.php


示例4: wpseo_admin_bar_menu

/**
 * 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 &amp; 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' ), ) );	
	}
}
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:98,代码来源:wpseo-non-ajax-functions.php


示例5: wpseo_translate_score

 /**
  * 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);
 }
开发者ID:Infernosaint,项目名称:WPSetupTest2,代码行数:14,代码来源:class-ga-frontend-custom-dimensions.php


示例6: linkdex_output

 /**
  * 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;
 }
开发者ID:batruji,项目名称:metareading,代码行数:29,代码来源:class-metabox.php


示例7: wpseo_admin_bar_menu

/**
 * 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 &amp; 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')));
    }
}
开发者ID:johnreytepacia,项目名称:etarticles,代码行数:81,代码来源:wpseo-non-ajax-functions.php


示例8: setPostData

 /**
  * 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');
 }
开发者ID:erkmen,项目名称:wpstartersetup,代码行数:36,代码来源:class-np-pagelisting.php



注:本文中的wpseo_translate_score函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wpseo_xml_sitemaps_base_url函数代码示例发布时间:2022-05-23
下一篇:
PHP wpseo_title_test函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap