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);
  28.         }
  29.         
  30.         // create links from URIs
  31.         $str eregi_replace("(http://[^ )\r\n]+)""<a href=\"\\1\" target=\"_blank\">\\1</a>"$str);
  32.  
  33.         // Bad Word Filter
  34.         if (file_exists("./bad_words.txt")){
  35.  
  36.             $inhalt_des_bad_word_files file("./bad_words.txt");
  37.  
  38.             foreach($inhalt_des_bad_word_files as $bad_word_array){
  39.  
  40.                 list($bad_word$good_wordexplode(">"$bad_word_array);
  41.                 $bad_word chop(trim($bad_word));
  42.                 $good_word chop(trim($good_word));
  43.                 $str eregi_replace($bad_word$good_word $str);
  44.             }
  45.         }        
  46.         return $str;
  47.     }
  48. }

Documentation generated on Thu, 13 Aug 2009 08:22:02 +0200 by phpDocumentor 1.4.1