wptexturize()将纯文本字符转换成格式化的HTML实体

目录

描述

将纯文本字符转换成格式化的 HTML 实体。<pre><code><kbd><style><script><tt>中的文本被忽略。

wptexturize() 描述

用法

 <?php wptexturize$text ); ?> 

wptexturize() 用法

参数

$text

(string) (必填) 将被格式化的文本

默认值: None

wptexturize() 参数

返回值

(string) 

被替换成HTML数字实体字符的文 

wptexturize() 返回值

注意

 启和关闭 号将  WordPress 翻译文   义,下面是 wptexturize 做的转 

原始文本 转换之后的文本 符号名称
"---" "—" em-dash | 破折号
" -- " "—" em-dash | 破折号
"--" "–" en-dash | 破折号
" - " "–" en-dash | 破折号
"..." "…" ellipsis | 省略号
`` opening quote | 开启引号
"hello “hello opening quote | 开启引号
'hello ‘hello opening quote | 开启引号
'' closing quote | 关闭引号
world." world.” closing quote | 关闭引号
world.' world.’ closing quote | 关闭引号
" (tm)" " ™" trademark symbol | 注册商标符号
1234" 1234″ double prime symbol | 双撇号
1234' 1234′ prime symbol | 撇号
'99 ’99 apostrophe before abbreviated year | 年号之前的撇号
Webster's Webster’s apostrophe in a word | 单词撇号
1234x1234 1234×1234 multiplication symbol | 乘法符号

There is a small "cockney" list of transformations, as well. They can be replaced if the variable $wp_cockneyreplace is defined and contains an associative array with the keys containing the source strings and the values containing the transformed strings. By default the following strings will be transformed:

  • 'tain't
  • 'twere
  • 'twas
  • 'tis
  • 'twill
  • 'til
  • 'bout
  • 'nuff
  • 'round
  • 'cause
  • wptexturize() 注意

    历史

    添加于 版本: 0.71

    In 4.0: wptexturize() and _wptexturize_pushpop_element() were significantly revised to improve performance and to resolve many bugs. This version also added the run_wptexturize filter to allow a theme or plugin to permanently disable this feature.

    wptexturize() 历史

    源文件

    wptexturize() 函数的代码位于 wp-includes/formatting.php.

    wptexturize() 源文件

    相关