capital_p_dangit

函式
capital_p_dangit ( $text )
引數
  • (string) $text The text to be modified.
    Required:
返回值
  • (string) The modified text.
定義位置
相關方法
privacy_ping_filteruser_can_edit_post_datewp_install_defaultsget_all_page_idsuninstall_plugin
引入
3.0.0
棄用
-

capital_p_dangit: 這個函式用來用”WordPress”替換任何”Wordpress”的例項。它接受一個引數,即要檢查和替換的文字。它返回修改後的文字。

永遠從地球上消除"Wordpress"(或者至少是我們能影響的那一點)。

違反了我們的編碼標準,是一個好的函式名稱。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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
);
}
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 ); }
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
	);
}

常見問題

FAQs
檢視更多 >