Ejemplo n.º 1
0
 /**
  *
  * @param string $path
  * @param string $name
  * @return string
  */
 protected function _getNewFileName($path, $name)
 {
     $fileName = $path . $name;
     $info = pathinfo($fileName);
     $friendName = ucfirst(App_General_String::friendName($info['filename']));
     $name = $friendName;
     $fullPath = $path . $friendName . '.' . $info['extension'];
     $count = 0;
     while (file_exists($fullPath)) {
         $friendName = $name . '_' . ++$count;
         $fullPath = $path . $friendName . '.' . $info['extension'];
     }
     return $friendName . '.' . $info['extension'];
 }
Ejemplo n.º 2
0
 /**
  * 
  * @access 	protected
  * @param 	string $field
  * @param 	string $value
  * @return 	string
  */
 protected function urlAmigavel($field, $value)
 {
     $url = App_General_String::friendName($value);
     $count = 0;
     do {
         $select = $this->_dbTable->select()->where($field . ' = ?', $url);
         $data = $this->_dbTable->fetchRow($select);
         if (!empty($data)) {
             $url = $url . '-' . ++$count;
         } else {
             break;
         }
     } while (true);
     return $url;
 }
Ejemplo n.º 3
0
 /**
  * 
  * @param array $options
  */
 public function __construct($options = null)
 {
     $name = App_General_String::friendName(get_class($this));
     $options['name'] = $name;
     parent::__construct($options);
 }