//
//
// Big array containing smileys and stuff
//
// (I'll add the duck shall I... AndyPoole)
// Just add new entries as you see fit
// the list is checked in order, so e.g. putting :phlamethrower: below :p will result in a :p smiley then 'hlamethrower:', instead of a flamethrower smiley!
// For swear filter and URL entries, see the funky_replace function
$funky_replace_array = array(
// ** people ** (Do they really need the width & height settings there? YES THEY DO PLEASE!!!)
":flyingpig:", "
",
":hertzsprung:", "
",
":ghost:", "
",
":flame:", "
",
":flamethrower:", "
",
":phlamethrower:", "
",
":moss:", "
",
":kinetic:", "
",
":mentat:", "
",
":andypoole:", "
",
":duck:", "
",
":richg:", "
",
// ** regular smileys **
":piggy:", "
",
":worldcup:", "
",
":albino:", "
",
":)", "
",
":-)", "
",
":(", "
",
":-(", "
",
":P", "
",
":-P", "
",
":p", "
",
":-p", "
",
";-)", "
",
";)", "
",
":E", "
",
":-E", "
",
"8)", "
",
"8-)", "
",
":frown:", "
",
":|", "
",
":o", "
",
":O", "
",
":-|", "
",
":-o", "
",
":-O", "
",
":lol:", "
",
":laugh:", "
",
":naughty:", "
",
":D", "
",
":-D", "
",
":uk:", "
",
// ** silly smileys **
":monkey:", "
",
":acorn:", "
",
":arc:", "
",
":cog:", "
",
":heart:", "
",
":ro4:", "
",
":rpc:", "
",
":basilbrush:", "
",
":handbag:", "
",
"\n", "
",
// ** BB code **
"[b][/b]","", //Fix empty tags
"[u][/u]","", // ditto
"[i][/i]","", // ditto
"[b]","","[/b]","",
"[u]","","[/u]","",
"[i]","","[/i]","",
// ** end **
"[block]","");
//
//
// FUNCTIONS
//
//
function fix_mentat($text,$start,$end)
{
// Fix mentat's dodgy tag behaviour
// Make sure there are equal numbers of $start and $end in $text...
$cnt = 0;
$pos = strpos($text,$start);
while (is_integer($pos))
{
$cnt++;
$pos = strpos($text,$start,$pos+1);
}
$pos = strpos($text,$end);
while (is_integer($pos))
{
$cnt--;
$pos = strpos($text,$end,$pos+1);
}
while ($cnt > 0)
{
$text = $text . $end;
$cnt--;
}
return $text;
}
function funky_parse($text)
{
$text=htmlspecialchars($text);
global $funky_replace_array;
// $text should be a HTMLspecialchar'd text string (i.e. ready for output) which wants to be:
// * swear filtered
// * smiley parsed
// * BB-coded
// * link-ified
// ** URLs ** ([block] compatable to stop smileys creeping in)
$text = preg_replace("#(?\\0",$text);
$text = preg_replace("#(?\\0",$text);
$text = preg_replace("#(?\\0",$text);
$text = preg_replace("#(?\\0",$text);
// Fix mentat's dodgy behaviour...
$text = fix_mentat($text,"[b]","[/b]");
$text = fix_mentat($text,"[u]","[/u]");
$text = fix_mentat($text,"[i]","[/i]");
// Generic thingies
for ($num=0;$num",$table_format);
printf("Typing this... | ...gives this | Typing this... | ...gives this |
",$cell_format,$cell_format,$cell_format,$cell_format);
for ($num=0;$num%s | %s | ",$cell_format,$funky_replace_array[$num],$cell_format,$funky_replace_array[$num+1]);
else
printf("%s | %s | ",$cell_format,$funky_replace_array[$num],$cell_format,$funky_replace_array[$num+1]);
}
}
printf("");
}
?>