當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WPSEO_Utils::trim_nbsp_from_string方法代碼示例

本文整理匯總了PHP中WPSEO_Utils::trim_nbsp_from_string方法的典型用法代碼示例。如果您正苦於以下問題:PHP WPSEO_Utils::trim_nbsp_from_string方法的具體用法?PHP WPSEO_Utils::trim_nbsp_from_string怎麽用?PHP WPSEO_Utils::trim_nbsp_from_string使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WPSEO_Utils的用法示例。


在下文中一共展示了WPSEO_Utils::trim_nbsp_from_string方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: test_wpseo_trim_nbsp_from_string

 /**
  * @covers WPSEO_Utils::trim_nbsp_from_string()
  */
 public function test_wpseo_trim_nbsp_from_string()
 {
     $old_string = ' This is an old string with as spaces. ';
     $expected = 'This is an old string with as spaces.';
     $this->assertEquals($expected, WPSEO_Utils::trim_nbsp_from_string($old_string));
 }
開發者ID:centre-for-effective-altruism,項目名稱:wordpress-seo,代碼行數:9,代碼來源:test-class-wpseo-utils.php

示例2: get_body

 /**
  * Retrieve the body from the post.
  *
  * @param object $post The post object.
  *
  * @return string The post content.
  */
 function get_body($post)
 {
     // This filter allows plugins to add their content to the content to be analyzed.
     $post_content = apply_filters('wpseo_pre_analysis_post_content', $post->post_content, $post);
     // Strip shortcodes, for obvious reasons, if plugins think their content should be in the analysis, they should
     // hook into the above filter.
     $post_content = WPSEO_Utils::trim_nbsp_from_string(WPSEO_Utils::strip_shortcode($post_content));
     if (trim($post_content) == '') {
         return '';
     }
     $htmdata3 = preg_replace('`<(?:\\x20*script|script).*?(?:/>|/script>)`', '', $post_content);
     if ($htmdata3 == null) {
         $htmdata3 = $post_content;
     } else {
         unset($post_content);
     }
     $htmdata4 = preg_replace('`<!--.*?-->`', '', $htmdata3);
     if ($htmdata4 == null) {
         $htmdata4 = $htmdata3;
     } else {
         unset($htmdata3);
     }
     $htmdata5 = preg_replace('`<(?:\\x20*style|style).*?(?:/>|/style>)`', '', $htmdata4);
     if ($htmdata5 == null) {
         $htmdata5 = $htmdata4;
     } else {
         unset($htmdata4);
     }
     return $htmdata5;
 }
開發者ID:Nisha318,項目名稱:p3edtech,代碼行數:37,代碼來源:class-metabox.php


注:本文中的WPSEO_Utils::trim_nbsp_from_string方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。