Просмотр файла blackgbs/smileandtegs.php

Размер файла: 2.06Kb
<?php
function smile($text)
{
if (is_dir("./smiles") && $handle=opendir("./smiles"))
{
while (false !==($file=readdir($handle)))
{
if ($file!="." and $file!=".." and $file!="index.php")
{
$mas[]=$file;
}
}
}
sort($mas);
$count=count($mas);
for($i=0;$i<$count;$i++)
{
$file=$mas[$i];
$ex=explode(".",$file);
$smile=$ex[0];
$trans1=array("TS","ts","JO","ZH","CH","SH","SCH","YE","JU","JA","jo","zh","ch","sh","sch","ye","ju","ja","A","B","V","G","D","E","Z","I","J","K","L","M","N","O","P","R","S","T","U","F","H","Y","a","b","v","g","d","e","z","i","j","k","l","m","n","o","p","r","s","t","u","f","h","'","y","X","x","1","2","3","4","5","6","7");
$trans2=array("Ц","ц","Ё","Ж","Ч","Ш","Щ","Э","Ю","Я","ё","ж","ч","ш","щ","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ь","ы","КС","кс",":-)",":-(",":-|",":-0",";-)","8-)",":-D");
$pokaz=str_replace($trans1,$trans2,$smile); 
if ($smile==1 || $smile==2 || $smile==3 || $smile==4 || $smile==5 || $smile==6 || $smile==7)
{
$text=str_replace($pokaz,'<img src="./smiles/'.$file.'" alt="'.$pokaz.'"/>',$text);
}
else
{
$text=str_replace(':'.$pokaz.':','<img src="./smiles/'.$file.'" alt=":'.$pokaz.':"/>',$text);
}
}
return $text;
}
function tegs($text)
{
$text=str_replace("\r\n
","<br/>", $text);
$text=str_replace('[b]','<b>', $text);
$text=str_replace('[/b]','</b>', $text);
$text=str_replace('[u]','<u>', $text);
$text=str_replace("[/u]","</u>", $text);
$text=str_replace("[i]","<i>", $text);
$text=str_replace("[/i]","</i>", $text);
$text=str_replace("[big]","<big>", $text);
$text=str_replace("[/big]","</big>", $text);
$text=str_replace("[color=red]","<font color=\"red\">", $text);
$text=str_replace("[color=yellow]","<font color=\"yellow\">", $text);
$text=str_replace("[color=green]","<font color=\"green\">", $text);
$text=str_replace("[color=blue]","<font color=\"blue\">", $text);
$text=str_replace("[/color]","</font>",$text);
return $text;
}
?>