Example #1
0
 /**
  * Path completo do script do ckeditor
  * @return string
  */
 public static function getPathCkeditorJS($onlyPath = false)
 {
     $path = \PWork\Util\Helper::urlByPath(self::getPathCkeditor()) . DIRECTORY_SEPARATOR . 'ckeditor.js';
     $file = '<script src="' . $path . '"></script>';
     if ($onlyPath) {
         $file = $path;
     }
     return $file;
 }
Example #2
0
 /**
  * Gerando o nome do arquivo
  * @return string
  */
 private function generateName()
 {
     if ($this->customRename && $this->customRename != '') {
         $newName = \PWork\Util\Helper::removeAccents($this->customRename, '-');
         // nome sem acentos
     } else {
         $newName = \PWork\Util\Helper::removeAccents($this->Files['name'], '-');
         // nome sem acentos
     }
     $extension = $this->getExtension();
     // extenção do arquivo
     $nameNoExtension = str_replace('-' . $extension, '', $newName);
     // nome sem a extensao
     $destination = $this->getDestination();
     $reload = true;
     $i = 0;
     do {
         $aditional = $i === 0 ? '' : '-' . $i;
         $nameEnd = $nameNoExtension . $aditional . '.' . $extension;
         $validate = $destination . DIRECTORY_SEPARATOR . $nameEnd;
         if (!file_exists($validate)) {
             $reload = false;
             $i = '';
         }
         $i++;
     } while ($reload);
     $this->newName = $nameEnd;
     return $nameEnd;
 }