| [ Index ] |
|
Code source de e107 0.7.8 |
1 <?php 2 /* 3 + ----------------------------------------------------------------------------+ 4 | e107 website system 5 | 6 | ©Steve Dunstan 2001-2002 7 | http://e107.org 8 | jalist@e107.org 9 | 10 | Released under the terms and conditions of the 11 | GNU General Public License (http://gnu.org). 12 | 13 | $Source: /cvsroot/e107/e107_0.7/e107_handlers/profanity_filter.php,v $ 14 | $Revision: 1.8 $ 15 | $Date: 2006/10/16 22:51:09 $ 16 | $Author: e107coders $ 17 +----------------------------------------------------------------------------+ 18 */ 19 20 if (!defined('e107_INIT')) { exit; } 21 22 class e_profanityFilter { 23 var $profanityList; 24 25 function e_profanityFilter() { 26 global $pref; 27 28 $words = explode(",", $pref['profanity_words']); 29 $word_array = array(); 30 foreach($words as $word) { 31 $word = trim($word); 32 if($word != "") 33 { 34 $word_array[] = $word; 35 } 36 } 37 if(count($word_array)) 38 { 39 $this->profanityList = implode("\b|\b", $word_array); 40 } 41 unset($words); 42 return TRUE; 43 } 44 45 function filterProfanities($text) { 46 global $pref; 47 if (!$this->profanityList) { 48 return $text; 49 } 50 if ($pref['profanity_replace']) { 51 return preg_replace("#\b".$this->profanityList."\b#is", $pref['profanity_replace'], $text); 52 } else { 53 return preg_replace_callback("#\b".$this->profanityList."\b#is", array($this, 'replaceProfanities'), $text); 54 } 55 } 56 57 function replaceProfanities($matches) { 58 /*! 59 @function replaceProfanities callback 60 @abstract replaces vowels in profanity words with stars 61 @param text string - text string to be filtered 62 @result filtered text 63 */ 64 65 return preg_replace("#a|e|i|o|u#i", "*" , $matches[0]); 66 } 67 } 68 69 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |