コード例 #1
0
ファイル: FileManager.php プロジェクト: lciolecki/php-library
 /**
  * Generate directory
  *
  * @param $directory
  * @param int $length
  * @return string
  */
 public static function generateDir($directory, $length = 8)
 {
     do {
         $name = \Extlib\Generator::generate($length);
         $filepath = rtrim($directory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name;
     } while (is_dir($filepath));
     return $name;
 }
コード例 #2
0
ファイル: File.php プロジェクト: lciolecki/webshot
 /** 
  * @ORM\PrePersist 
  */
 public function preInsert()
 {
     if ($this->fileExists()) {
         $this->setSize(filesize($this->getFullFilePath()));
         $this->setFileMd5(md5_file($this->getFullFilePath()));
         $this->setMimeType(finfo_file(finfo_open(FILEINFO_MIME_TYPE), $this->getFullFilePath()));
     }
     $this->dateCreate = new \Zend_Date();
     $this->hash = \Extlib\Generator::generateDoctrine2($this->getEm(), get_class($this), 'hash', self::HASH_LEN);
 }
コード例 #3
0
ファイル: User.php プロジェクト: lciolecki/webshot
 /**
  * Set password
  *
  * @param string $password
  * @return User
  */
 public function setPassword($password)
 {
     $this->salt = \Extlib\Generator::generateDoctrine2($this->getEm(), get_class($this), 'salt', self::SALT_LEN);
     $this->password = \hash(self::PASSWORD_HASH_ALGORITHM, $password . $this->salt);
     return $this;
 }
コード例 #4
0
ファイル: Webshot.php プロジェクト: lciolecki/webshot
 /** 
  * @ORM\PrePersist 
  */
 public function preInsert()
 {
     $this->dateCreate = new \Zend_Date();
     $this->hash = \Extlib\Generator::generateDoctrine2($this->getEm(), get_class($this), 'hash', self::HASH_LEN);
 }