Here's come code I wrote fro dealing with smilies and html entities that get broken in Chef-speak. My only problem is when I put this into the for loop (~ line 106), the smilies and entities are moved to the front of the Encheferized text. I've only had a couple of minutes to mess with this, so I'm sure someone with more of an idea of what this loop is doing (cheesegrits?) will know how to fix this
PHP Code:
if($char == '&')
{
// check if this is an html entity
$goto = null;
$entity = $char;
for($j=$i+1;$j<$maxLen;$j++)
{
$entity .= $string[$j];
if($string[$j]==';')
{
$goto = $j+1;
$j = $maxLen + 100;
continue;
}
}
// if we're actually dealing with an entity
if($goto != null)
{
$i = $goto;
$newString .= $entity;
continue;
}
}
if($char == ':')
{
// check if this is a smiley
$goto = null;
$smiley = $char;
for($j=$i+1;$j<$maxLen;$j++)
{
$smiley .= $string[$j];
if($string[$j]==' ')
{
$j = $maxLen + 100;
unset($smiley);
continue;
}
elseif($string[$j]==':')
{
$goto = $j+1;
$j = $maxLen + 100;
}
}
// if we're actually dealing with a smiley
if($goto != null)
{
$i = $goto;
$newString .= $smiley;
continue;
}
}
BTW, been laughing my ass off all day. Best April Fools, ever. Thanks.