当前位置: 首页>>代码示例>>PHP>>正文


PHP WPSEO_Utils::translate_score方法代码示例

本文整理汇总了PHP中WPSEO_Utils::translate_score方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Utils::translate_score方法的具体用法?PHP WPSEO_Utils::translate_score怎么用?PHP WPSEO_Utils::translate_score使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WPSEO_Utils的用法示例。


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

示例1: addPostMeta

 /**
  * Post Meta
  */
 public function addPostMeta($post)
 {
     // Hidden in Nested Pages?
     $np_status = get_post_meta($post->ID, 'nested_pages_status', true);
     $this->post_data->np_status = $np_status == 'hide' ? 'hide' : 'show';
     // Yoast Score
     if (function_exists('wpseo_auto_load')) {
         $yoast_score = get_post_meta($post->ID, '_yoast_wpseo_meta-robots-noindex', true);
         if (!$yoast_score) {
             $yoast_score = get_post_meta($post->ID, '_yoast_wpseo_linkdex', true);
             $this->post_data->score = \WPSEO_Utils::translate_score($yoast_score);
         } else {
             $this->post_data->score = 'noindex';
         }
     }
 }
开发者ID:scrapbird,项目名称:wp-nested-pages,代码行数:19,代码来源:PostDataFactory.php

示例2: addPostMeta

 /**
  * Post Meta
  */
 public function addPostMeta($post)
 {
     $meta = get_metadata('post', $post->ID);
     $this->post_data->nav_title = isset($meta['np_nav_title'][0]) ? $meta['np_nav_title'][0] : null;
     $this->post_data->link_target = isset($meta['np_link_target'][0]) ? $meta['np_link_target'][0] : null;
     $this->post_data->nav_title_attr = isset($meta['np_title_attribute'][0]) ? $meta['np_title_attribute'][0] : null;
     $this->post_data->nav_css = isset($meta['np_nav_css_classes'][0]) ? $meta['np_nav_css_classes'][0] : null;
     $this->post_data->nav_object = isset($meta['np_nav_menu_item_object'][0]) ? $meta['np_nav_menu_item_object'][0] : null;
     $this->post_data->nav_object_id = isset($meta['np_nav_menu_item_object_id'][0]) ? $meta['np_nav_menu_item_object_id'][0] : null;
     $this->post_data->nav_type = isset($meta['np_nav_menu_item_type'][0]) ? $meta['np_nav_menu_item_type'][0] : null;
     $this->post_data->nav_status = isset($meta['np_nav_status'][0]) && $meta['np_nav_status'][0] == 'hide' ? 'hide' : 'show';
     $this->post_data->np_status = isset($meta['nested_pages_status'][0]) && $meta['nested_pages_status'][0] == 'hide' ? 'hide' : 'show';
     $this->post_data->template = isset($meta['_wp_page_template'][0]) ? $meta['_wp_page_template'][0] : false;
     // Yoast Score
     if (function_exists('wpseo_auto_load')) {
         $yoast_score = get_post_meta($post->ID, '_yoast_wpseo_meta-robots-noindex', true);
         if (!$yoast_score) {
             $yoast_score = get_post_meta($post->ID, '_yoast_wpseo_linkdex', true);
             $this->post_data->score = \WPSEO_Utils::translate_score($yoast_score);
         } else {
             $this->post_data->score = 'noindex';
         }
     }
 }
开发者ID:dtwist,项目名称:wp-nested-pages,代码行数:27,代码来源:PostDataFactory.php

示例3: wpseo_translate_score

/**
 * Translates a decimal analysis score into a textual one.
 *
 * @deprecated 1.5.6.1
 * @deprecated use WPSEO_Utils::translate_score()
 * @see        WPSEO_Utils::translate_score()
 *
 * @param int  $val       The decimal score to translate.
 * @param bool $css_value Whether to return the i18n translated score or the CSS class value.
 *
 * @return string
 */
function wpseo_translate_score($val, $css_value = true)
{
    _deprecated_function(__FUNCTION__, 'WPSEO 1.5.6.1', 'WPSEO_Utils::translate_score()');
    return WPSEO_Utils::translate_score();
}
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:17,代码来源:wpseo-non-ajax-functions.php

示例4: publish_box

    /**
     * Outputs the page analysis score in the Publish Box.
     */
    public function publish_box()
    {
        if ($this->is_metabox_hidden() === true) {
            return;
        }
        $post = $this->get_metabox_post();
        if (self::get_value('meta-robots-noindex', $post->ID) === '1') {
            $score_label = 'noindex';
            $title = __('Post is set to noindex.', 'wordpress-seo');
            $score_title = $title;
        } else {
            $score = self::get_value('linkdex', $post->ID);
            if ($score === '') {
                $score_label = 'na';
                $title = __('No focus keyword set.', 'wordpress-seo');
            } else {
                $score_label = WPSEO_Utils::translate_score($score);
            }
            $score_title = WPSEO_Utils::translate_score($score, false);
            if (!isset($title)) {
                $title = $score_title;
            }
        }
        printf('
		<div title="%s" id="wpseo-score">
			' . $this->traffic_light_svg() . '
		</div>', __('SEO score', 'wordpress-seo'), esc_attr('wpseo-score-icon ' . $score_label), __('SEO:', 'wordpress-seo'), $score_title, __('Check', 'wordpress-seo'));
    }
开发者ID:domalexxx,项目名称:nashvancouver,代码行数:31,代码来源:class-metabox.php

示例5: 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_Utils::translate_score($result['val']);
                 $output .= '<tr><td class="score"><div class="' . esc_attr('wpseo-score-icon ' . $score) . '"></div></td><td>' . $result['msg'] . '</td></tr>';
             }
         }
         unset($result, $score);
         $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:Nisha318,项目名称:p3edtech,代码行数:36,代码来源:class-metabox.php

示例6: publish_box

 /**
  * Outputs the page analysis score in the Publish Box.
  */
 public function publish_box()
 {
     if ($this->is_metabox_hidden() === true) {
         return;
     }
     $post = $this->get_metabox_post();
     if (self::get_value('meta-robots-noindex', $post->ID) === '1') {
         $score_label = 'noindex';
         $title = __('Post is set to noindex.', 'wordpress-seo');
         $score_title = $title;
     } else {
         $score = self::get_value('linkdex', $post->ID);
         if ($score === '') {
             $score_label = 'na';
             $title = __('No focus keyword set.', 'wordpress-seo');
         } else {
             $score_label = WPSEO_Utils::translate_score($score);
         }
         $score_title = WPSEO_Utils::translate_score($score, false);
         if (!isset($title)) {
             $title = $score_title;
         }
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:27,代码来源:class-metabox.php

示例7: 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


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