WordPress开发者和主题制作者的搜索引擎



wp_kses_normalize_entities2 ›

Since1.0.0
已弃用n/a
wp_kses_normalize_entities2 ( $matches )
访问:
  • private
参数:
  • (array) $matches `preg_replace_callback()` matches array.
    Required: Yes
返回:
  • (string) Correctly encoded entity.
定义在:
文档:

Callback for `wp_kses_normalize_entities()` regular expression.

This function helps wp_kses_normalize_entities() to only accept 16-bit values and nothing more for &#number; entities.



源码

function wp_kses_normalize_entities2( $matches ) {
	if ( empty( $matches[1] ) ) {
		return '';
	}

	$i = $matches[1];
	if ( valid_unicode( $i ) ) {
		$i = str_pad( ltrim( $i, '0' ), 3, '0', STR_PAD_LEFT );
		$i = "&#$i;";
	} else {
		$i = "&#$i;";
	}

	return $i;
}