convert_smilies
函数
convert_smilies ( $text )
- 参数
-
-
(string)
$text
Content to convert smilies from text.- Required: 是
-
(string)
- 返回值
-
- (string) Converted content with text smilies replaced with images.
- 定义位置
-
-
wp-includes/formatting.php
, line 3417
-
wp-includes/formatting.php
- 引入
- 0.71
- 弃用
- –
Converts text equivalent of smilies to images.
Will only convert smilies if the option ‘use_smilies’ is true and the global
used in the function isn’t empty.
function convert_smilies( $text ) {
global $wp_smiliessearch;
$output = '';
if ( get_option( 'use_smilies' ) && ! empty( $wp_smiliessearch ) ) {
// HTML loop taken from texturize function, could possible be consolidated.
$textarr = preg_split( '/(<.>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // Capture the tags as well as in between.
$stop = count( $textarr ); // Loop stuff.
// Ignore proessing of specific tags.
$tags_to_ignore = 'code|pre|style|script|textarea';
$ignore_block_element = '';
for ( $i = 0; $i ]*>/', $content, $matches ) ) {
$ignore_block_element = $matches[1];
}
// If it's not a tag and not in ignore block.
if ( '' === $ignore_block_element && strlen( $content ) > 0 && '' === $content ) {
$ignore_block_element = '';
}
$output .= $content;
}
} else {
// Return default text.
$output = $text;
}
return $output;
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。