balanceTags()
balanceTags( string $text, bool $force = false )
如果强制,或者如果“使用平衡标记”选项设置为true,则平衡标记。
Balances tags if forced to, or if the ‘use_balanceTags’ option is set to true.
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$text | (string) | 必需 | 要平衡的文本 |
$force | (bool) | 可选 | 如果为true,则强制平衡,忽略选项的值。 |
返回(Return)
(string)平衡文本
源码(Source)
/** * Balances tags if forced to, or if the 'use_balanceTags' option is set to true. * * @since 0.71 * * @param string $text Text to be balanced * @param bool $force If true, forces balancing, ignoring the value of the option. Default false. * @return string Balanced text */ function balanceTags( $text, $force = false ) { if ( $force || get_option('use_balanceTags') == 1 ) { return force_balance_tags( $text ); } else { return $text; } }
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
0.71 | wp-includes/formatting.php:2436 | 0 | 2 |
笔记(Notes)
未关闭的LI标记
balanceTags() 为WP2原创文章,链接:https://www.wp2.cn/functions/balancetags/