PHP Classes
Icontem

File: example.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of sk89q  >  Intelligent Censor  >  example.php  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: Intelligent Censor
Replace rude words by acceptable alternatives
 

Contents

Class file image Download
<?php
require_once "IntelligentCensor.php";

// * are not expanded
// % are expanded, and but they will only work when placed at either the
// beginning or ending of the word
$censors = array(
    
'*damn%' => 'darn',
    
'whore%' => 'people',
    
'bastard*' => 'happyperson',
    
'*ho' => 'person',
);
// Be careful about creating censors with wildcards, as they match more
// words than you may want.

// Can use * wildcards
$censors_exclusion = array(
    
'echo*',
);

$icensor = new IntelligentCensor($censors$censors_exclusion);

echo 
$icensor->censor("you're all DIETYDAMNING bastardly wHOres! you echo ho!");
// Result: you're all DARNING happyperson pEOples! you echo person! 

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products