Skip to content

Instantly share code, notes, and snippets.

@PeteMall
Created November 7, 2010 22:56
Show Gist options
  • Save PeteMall/667095 to your computer and use it in GitHub Desktop.
Save PeteMall/667095 to your computer and use it in GitHub Desktop.
Replaces you with U in the content.
<?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('&#8220;', 'opening curly quote');
return str_ireplace(
array( 'you<', ' you,', ' you.', ' you ', '&#8216;you,', '&#8216;you.', '&#8216;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> ", "&#8216;{$style}U</span>,", "&#8216;{$style}U</span>.", "&#8216;{$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