Created
November 7, 2010 22:56
-
-
Save PeteMall/667095 to your computer and use it in GitHub Desktop.
Replaces you with U in the content.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach ( array( 'the_content', 'the_title', 'comment_text' ) as $filter ) | |
add_filter( $filter, 'you_to_u_dangit', 11 ); | |
function you_to_u_dangit( $content ) { | |
static $dblq = false; | |
$style = '<span style="color: red">'; | |
if ( false === $dblq ) | |
$dblq = _x('“', 'opening curly quote'); | |
return str_ireplace( | |
array( 'you<', ' you,', ' you.', ' you ', '‘you,', '‘you.', '‘you ', $dblq . 'you,', $dblq . 'you.', $dblq . 'you ', '>you,', '>you.', '>you ', '(you,', '(you.', '(you ' ), | |
array( "{$style}U</span><", "{$style}U</span>,", " {$style}U</span>.", " {$style}U</span> ", "‘{$style}U</span>,", "‘{$style}U</span>.", "‘{$style}U</span> ", $dblq . "{$style}U</span>,", $dblq . "{$style}U</span>.", $dblq . "{$style}U</span> ", ">{$style}U</span>,", ">{$style}U</span>.", ">{$style}U</span> ", "({$style}U</span>,", "({$style}U</span>.", "({$style}U</span> " ), | |
$content ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment