capital_P_dangit()自动修正WordPress大小写

目录

描述

Changes the incorrect capitalization of Wordpress into WordPress.

WordPress uses it to filter the content, the title and comment text.

capital_P_dangit() 描述

用法

 <?php capital_P_dangit$text ); ?> 

capital_P_dangit() 用法

参数

$text

(string) (必填) The text to be formatted.

默认值: None

capital_P_dangit() 参数

注意

If you prefer not to use these 过滤器s, here's how you can remove them:

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */

remove_filter( 'the_title', 'capital_P_dangit', 11 );
remove_filter( 'the_content', 'capital_P_dangit', 11 );
remove_filter( 'comment_text', 'capital_P_dangit', 31 );

capital_P_dangit() 注意

源文件

capital_P_dangit() 函数的代码位于 wp-includes/formatting.php.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Forever eliminate "Wordpress" from the planet (or at least the little bit we can influence).
 *
 * Violating our coding standards for a good function name.
 *
 * @since 3.0.0
 *
 * @staticvar string|false $dblq
 */
function capital_P_dangit( $text ) {
	// Simple replacement for titles
	$current_filter = current_filter();
	if ( 'the_title' === $current_filter || 'wp_title' === $current_filter )
		return str_replace( 'Wordpress', 'WordPress', $text );
	// Still here? Use the more judicious replacement
	static $dblq = false;
	if ( false === $dblq ) {
		$dblq = _x( '“', 'opening curly double quote' );
	}
	return str_replace(
		array( ' Wordpress', '‘Wordpress', $dblq . 'Wordpress', '>Wordpress', '(Wordpress' ),
		array( ' WordPress', '‘WordPress', $dblq . 'WordPress', '>WordPress', '(WordPress' ),
	$text );
}

capital_P_dangit() 源文件