SP = $sp; return true; } public function __destruct(){ return true; } /** * internal method to capitilize names * @param string $str string to capitalize * * @return string capitalized string */ private function nameCaseWorker($str){ $str = strtolower($str); //Lowercase the lot. $str = preg_replace("/\b(\w)/e", "strtoupper('\\1')", $str); //Uppercase first letter of every word. $str = preg_replace("/(\'\w)\b/e", "strtolower('\\1')", $str); //Lowercase 's. // Name case Mcs and Macs - taken straight from NameParse.pm incl. comments. // Exclude names with 1-2 letters after prefix like Mack, Macky, Mace // Exclude names ending in a,c,i,o, or j are typically Polish or Italian if( preg_match("/\bMac[A-Za-z]{2,}[^aciozj]\b/", $str) or preg_match("/\bMc/", $str)){ $str = preg_replace("/\b(Ma?c)([A-Za-z]+)/e", "$1.ucfirst('\\2')", $str); // Now correct for "Mac" exceptions $str = preg_replace("/\bMacEvicius/", "Macevicius", $str); // Lithuanian $str = preg_replace("/\bMacHado/", "Machado", $str); // Portuguese $str = preg_replace("/\bMacHar/", "Machar", $str); $str = preg_replace("/\bMacHin/", "Machin", $str); $str = preg_replace("/\bMacHlin/", "Machlin", $str); $str = preg_replace("/\bMacIas/", "Macias", $str); $str = preg_replace("/\bMacIulis/", "Maciulis", $str); $str = preg_replace("/\bMacKie/", "Mackie", $str); $str = preg_replace("/\bMacKle/", "Mackle", $str); $str = preg_replace("/\bMacKlin/", "Macklin", $str); $str = preg_replace("/\bMacQuarie/", "Macquarie", $str); } $str = preg_replace("/Macmurdo/", "MacMurdo", $str); // Fixes for "son (daughter) of" etc. in various languages. $str = preg_replace("/\bAl(?=\s+\w)/", "al", $str); // al Arabic or forename Al. $str = preg_replace("/\bAp\b/", "ap", $str); // ap Welsh $str = preg_replace("/\bBen(?=\s+\w)/", "ben", $str); // ben Hebrew or forename Ben. $str = preg_replace("/\bDell([ae])\b/", "dell$1", $str); // della and delle Italian $str = preg_replace("/\bD([aeiu])\b/", "d$1", $str); // da, de, di Italian; du French. $str = preg_replace("/\bDe([lr])\b/", "de$1", $str); // del Italian; der Dutch/Flemish. if(!$this->SP) $str = preg_replace("/\bEl\b/", "el", $str); // el Greek or El Spanish. if(!$this->SP) $str = preg_replace("/\bLa\b/", "la", $str); // la French or La Spanish. $str = preg_replace("/\bL([eo])\b/", "l$1", $str); // lo Italian; le French. $str = preg_replace("/\bVan(?=\s+\w)/", "van", $str); // van German or forename Van. $str = preg_replace("/\bVon\b/", "von", $str); // von Dutch/Flemish // Fixes for roman numeral names, e.g. Henry VIII, up to 89, LXXXIX $str = preg_replace("/\b((?:[Xx]{1,3}|[Xx][Ll]|[Ll][Xx]{0,3})?(?:[Ii]{1,3}|[Ii][VvXx]|[Vv][Ii]{0,3})?)\b/e","strtoupper('\\1')", $str); return $str; } /** * set Spanish trigger to true (default) or false for correct conversion of el/El and la/La * @param boolean $v default true to set Spanish On */ public function setSpanish($v=true){ $this->SP = $v; return true; } /** * get current value of Spanish trigger * @return boolean Spanish flag */ public function isSpanish(){ return $this->SP; } /** * public wrapper. accepts both strings and arrays. * variables with other datatypes are returned w/o changes * * @param mixed $v string or array of strings to be converted * * @return mixed copy of input value with all strings capitalized */ public function capitalize($v){ if(is_array($v)){ // return a copy of array instead changing it in place $retVal = array(); foreach($v as $key=>$val){ // recursive call for multidimansional arrays $retVal[$key] = $this->capitalize($val); } } elseif(is_string($v)) { $retVal = $this->nameCaseWorker($v); } else { // object, numbers etc are not processed $retVal = $v; } return $retVal; } } ?>
Fatal error: Class 'NameCase' not found in /var/www/html/programs/cccr/components/com_jumi/files/profiles/index.php on line 6