toLatin() public static method

Transliterate cyrillic to latin
public static toLatin ( string $string, string $separator = '', boolean $clean = false ) : string
$string string original string
$separator string word separator
$clean boolean to lower & all non understand symbols remove
return string
Beispiel #1
0
 /**
  * Check if upload files are valid
  *
  * @return void
  */
 public function move()
 {
     // do any actions if files exists
     foreach ($this->files as $n => $file) {
         $filename = $file->getName();
         if (isset($this->rules['hash']) === true) {
             if (empty($this->rules['hash']) === true) {
                 $this->rules['hash'] = 'md5';
             }
             if (!is_string($this->rules['hash']) === true) {
                 $filename = call_user_func($this->rules['hash']) . '.' . $file->getExtension();
             } else {
                 $filename = $this->rules['hash']($filename) . '.' . $file->getExtension();
             }
         }
         if (isset($this->rules['sanitize']) === true) {
             $filename = Format::toLatin($filename, '', true);
         }
         if (isset($this->rules['directory'])) {
             $tmp = rtrim($this->rules['directory'], '/') . DIRECTORY_SEPARATOR . $filename;
         } else {
             $tmp = rtrim($this->rules['dynamic'], '/') . DIRECTORY_SEPARATOR . $filename;
         }
         // move file to target directory
         $isUploaded = $file->moveTo($tmp);
         if ($isUploaded === true) {
             $this->info[] = ['path' => $tmp, 'directory' => dirname($tmp), 'filename' => $filename, 'size' => $file->getSize(), 'extension' => $file->getExtension()];
         }
     }
     return $this->getInfo();
 }