예제 #1
0
 /**
  * This function converts and url segment to an safe one, for example:
  * `test name @132` will be converted to `test-name--123`
  * Basicly it works by replacing every character that isn't an letter or an number to an dash sign
  * It will also return all letters in lowercase
  *
  * @param $slug - The url slug to convert
  *
  * @return mixed|string
  */
 public static function generateSafeSlug($slug)
 {
     // transform url
     $slug = Validations::removeAccents($slug);
     $slug = preg_replace('/[^a-zA-Z0-9]/', '-', $slug);
     $slug = strtolower(trim($slug, '-'));
     //Removing more than one dashes
     $slug = preg_replace('/\\-{2,}/', '-', $slug);
     return $slug;
 }
예제 #2
0
 public static function filterArray($array)
 {
     //HIGIENIZA ARRAY
     foreach ($array as $chave => $valor) {
         if (is_array($valor)) {
             $valor = self::filterArray($valor);
         } else {
             $array[$chave] = Validations::filter($valor, 'string');
         }
     }
     return $array;
 }
예제 #3
0
 public function removeAcentos()
 {
     echo Validations::removeAccents("Fábio Assunção da Silva");
 }