コード例 #1
0
ファイル: Url.php プロジェクト: adrianomarinho/framework
 /**
  * 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
ファイル: View.php プロジェクト: NandoKstroNet/babita
 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
ファイル: Testes.php プロジェクト: ayrtonmonier/babita
 public function removeAcentos()
 {
     echo Validations::removeAccents("Fábio Assunção da Silva");
 }