函数
do_shortcodes_in_html_tags ( $content, $ignore_html, $tagnames )
- 参数
-
-
(string)
$content
Content to search for shortcodes.- Required: 是
-
(bool)
$ignore_html
When true, all square braces inside elements will be encoded.- Required: 是
-
(array)
$tagnames
List of shortcodes to find.- Required: 是
-
(string)
- 返回值
-
- (string) Content with shortcodes filtered out.
- 定义位置
-
-
wp-includes/shortcodes.php
, line 385
-
wp-includes/shortcodes.php
- 引入
- 4.2.3
- 弃用
- –
只在HTML元素内部搜索简码并处理它们。
任何留在元素内的[或]字符都将被HTML编码,以防止干扰元素外的简码。假设$content已经被KSES处理。如果在标签中嵌套了角括号,具有unfiltered_html功能的用户可能会得到意想不到的输出。
function do_shortcodes_in_html_tags( $content, $ignore_html, $tagnames ) { // Normalize entities in unfiltered HTML before adding placeholders. $trans = array( '[' => '[', ']' => ']', ); $content = strtr( $content, $trans ); $trans = array( '[' => '[', ']' => ']', ); $pattern = get_shortcode_regex( $tagnames ); $textarr = wp_html_split( $content ); foreach ( $textarr as &$element ) { if ( '' === $element || '. if ( 1 === preg_match( '%^0 ) { // Sanitize the shortcode output using KSES. $new_attr = wp_kses_one_attr( $new_attr, $elname ); if ( '' !== trim( $new_attr ) ) { // The shortcode is safe to use now. $attr = $new_attr; } } } } $element = $front . implode( '', $attributes ) . $back; // Now encode any remaining '[' or ']' chars. $element = strtr( $element, $trans ); } $content = implode( '', $textarr ); return $content; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。