balanceTags()

最后更新于:2021-11-25 19:53:46

balanceTags( string$text, bool$force=false)

Balances tags if forced to, or if the ‘use_balanceTags’ option is set to true.

参数

$text

(string) (Required) Text to be balanced

$force

(bool) (Optional) If true, forces balancing, ignoring the value of the option.

Default value: false

响应

(string) Balanced text

源文件

文件: gc-includes/formatting.php

function balanceTags( $text, $force = false ) {  // phpcs:ignore GeChiUI.NamingConventions.ValidFunctionName.FunctionNameInvalid
	if ( $force || (int) get_option( 'use_balanceTags' ) === 1 ) {
		return force_balance_tags( $text );
	} else {
		return $text;
	}
}