Source for file StaticMethods.class.php

Documentation is available at StaticMethods.class.php

  1. <?php
  2. /**
  3.  * Class StaticMethods, contans only the simple methond for static use
  4.  *
  5.  * LICENSE: CREATIVE COMMONS PUBLIC LICENSE  "Namensnennung — Nicht-kommerziell 2.0"
  6.  *
  7.  * @copyright  2009 <SEDesign />
  8.  * @license    http://creativecommons.org/licenses/by-nc/2.0/de/
  9.  * @version    $3.0.6$
  10.  * @link       http://www.sedesign.de/de_produkte_chat-v3.html
  11.  * @since      File available since Alpha 1.0
  12.  */
  13.  
  14.  
  15.     /**
  16.     * Message filter, replaces smileys with images and "bad words"
  17.     *
  18.     * @param string $str, message text
  19.     * @param Array  $sml, Smileys dataset
  20.     * @return String 
  21.     */
  22.     static function filtering($str$sml){
  23.         
  24.         //replace smileys
  25.         for ($a=0$a<count($sml)$a++){
  26.                  $img getimagesize("./".$sml[$a][1]);
  27.                  $str str_replace($sml[$a][0]"<img src=\"".$sml[$a][1]."\" ".$img[3].">"$str$count);
  28.                  if ($count>0$count_all+=$count;
  29.         }
  30.         
  31.         if ($count_all > 8$str strip_tags($str);
  32.         
  33.         // create links from URIs
  34.         if (!eregi(']http://'$str)) 
  35.             $str eregi_replace("(http://[^ )\r\n]+)""<a href=\"\\1\" target=\"_blank\">\\1</a>"$str);
  36.         else 
  37.             $str str_replace("http://www.youtube.com/watch?v="""$str);
  38.  
  39.         // Bad Word Filter
  40.         
  41.         if (file_exists("./bad_words.txt")){
  42.  
  43.             $inhalt_des_bad_word_files file("./bad_words.txt");
  44.  
  45.             foreach($inhalt_des_bad_word_files as $bad_word_array){
  46.  
  47.                 list($bad_word$good_wordexplode(">"$bad_word_array);
  48.                 $bad_word chop(trim($bad_word));
  49.                 $good_word chop(trim($good_word));
  50.                 $str eregi_replace($bad_word$good_word $str);
  51.             }
  52.         }    
  53.         
  54.         $video '<object width="425" height="344"><param name="wmode" value="transparent" name="movie" value="http://www.youtube.com/v/$1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed wmode="transparent" src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="344"></embed></object>';
  55.         
  56.         if (eregi('\[img\]'$str&& eregi('\[/img\]'$str)){
  57.             $image_path preg_replace('/\[img\](.*?)\[\/img\]/''$1'$str)
  58.                 if (!empty($image_path))
  59.                     $str="<img src=\"$image_path\" style=\"max-width:500px;max-height:300px;\">";
  60.         }
  61.         $str preg_replace('/\[video\](.*?)\[\/video\]/'$video$str);  
  62.         
  63.         return $str;
  64.     }
  65. }

Documentation generated on Tue, 22 Dec 2009 09:42:52 +0100 by phpDocumentor 1.4.1