| webmaster@0 | 1 <?php | 
| webmaster@0 | 2     class TextUtils | 
| webmaster@0 | 3     { | 
| webmaster@0 | 4 	public static function SplitTags($str) | 
| webmaster@0 | 5 	{ | 
| webmaster@0 | 6 	    $str = str_replace("\\\"", "\"", $str); | 
| webmaster@0 | 7 	    $tags = array(); | 
| webmaster@0 | 8 	    preg_match_all('/"([a-zA-Z0-9 ]+)"/', $str, $tests); | 
| webmaster@0 | 9 	    $useful = $tests[1]; | 
| webmaster@0 | 10 	    foreach($useful as $match) | 
| webmaster@0 | 11 	    { | 
| webmaster@0 | 12 		$tags[] = $match; | 
| webmaster@0 | 13 		$str = str_replace("\"{$match}\"", null, $str); | 
| webmaster@0 | 14 	    } | 
| webmaster@0 | 15 	    $str = preg_replace("/( )+/", " ", trim($str)); | 
| webmaster@0 | 16 	    if(strlen($str) > 0) | 
| webmaster@0 | 17 		$tags = array_merge($tags, explode(" ", $str)); | 
| webmaster@0 | 18 	    asort($tags); | 
| webmaster@0 | 19 	    return $tags; | 
| webmaster@0 | 20 	} | 
| webmaster@0 | 21 | 
| webmaster@0 | 22 	public static function DiffTagLine($old, $new, &$ajout, &$suppr) | 
| webmaster@0 | 23 	{ | 
| webmaster@0 | 24 	    $arOld = TextUtils::SplitTags($old); | 
| webmaster@0 | 25 	    $arNew = TextUtils::SplitTags($new); | 
| webmaster@0 | 26 	    $ajout = array_diff($arNew, $arOld); | 
| webmaster@0 | 27 	    $suppr = array_diff($arOld, $arNew); | 
| webmaster@0 | 28 	} | 
| webmaster@10 | 29 | 
| webmaster@10 | 30     public static function StripTitle($Titre) { | 
| webmaster@10 | 31         $Titre_url = str_replace(" ", "_", strip_tags($Titre)); | 
| webmaster@10 | 32 		$Titre_url = str_replace("-", "_", $Titre_url); | 
| webmaster@10 | 33         $Titre_url = str_replace(array("é", "è"), "e", $Titre_url); | 
| webmaster@10 | 34         $Titre_url = str_replace("à", "a", $Titre_url); | 
| webmaster@10 | 35         $Titre_url = str_replace("ù", "u", $Titre_url); | 
| webmaster@10 | 36         $Titre_url = str_replace(array("î", "ï"), "i", $Titre_url); | 
| webmaster@10 | 37         return $Titre_url; | 
| webmaster@0 | 38     } | 
| webmaster@10 | 39 | 
| webmaster@10 | 40     public static function getMonthName($monthNumber) { | 
| webmaster@10 | 41         return ucfirst(strftime('%B', strtotime('2007-' . $monthNumber . '-01'))); | 
| webmaster@10 | 42     } | 
| webmaster@10 | 43     } | 
| webmaster@10 | 44 ?> |