More judicious Wordpress-to-WordPress correction, to avoid bungling reasonable URLs. fixes #13971
git-svn-id: http://svn.automattic.com/wordpress/trunk@15377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
77b0788dc8
commit
57deb5ec03
|
@ -88,7 +88,7 @@ foreach ( array( 'comment_author', 'term_name', 'link_name', 'link_description',
|
|||
|
||||
// Format WordPress
|
||||
foreach ( array( 'the_content', 'the_title', 'comment_text' ) as $filter )
|
||||
add_filter( $filter, 'capital_P_dangit' );
|
||||
add_filter( $filter, 'capital_P_dangit', 11 );
|
||||
|
||||
// Format titles
|
||||
foreach ( array( 'single_post_title', 'single_cat_title', 'single_tag_title', 'single_month_title', 'nav_menu_attr_title', 'nav_menu_description' ) as $filter ) {
|
||||
|
|
|
@ -2825,8 +2825,20 @@ function sanitize_text_field($str) {
|
|||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
|
||||
function capital_P_dangit( $text ) {
|
||||
return str_replace( 'Wordpress', 'WordPress', $text );
|
||||
// Simple replacement for titles
|
||||
if ( 'the_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 quote');
|
||||
return str_replace(
|
||||
array( ' Wordpress', '‘Wordpress', $dblq . 'Wordpress', '>Wordpress', '(Wordpress' ),
|
||||
array( ' WordPress', '‘WordPress', $dblq . 'WordPress', '>WordPress', '(WordPress' ),
|
||||
$text );
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue