Ejemplo n.º 1
0
 public function set($value)
 {
     if (is_array($value)) {
         $delimiter = $this->data['delimiter'] ? $this->data['delimiter'] : ',';
         $value = implode($delimiter, $value);
     }
     return parent::set($value);
 }
Ejemplo n.º 2
0
 public function set($value)
 {
     $this->data['multilang'] = true;
     $langs = $this->type->data_langs($this->data);
     if (!$langs) {
         return parent::set($value);
     }
     foreach ($langs as $lang => $ldata) {
         $this->item->{"{$this->name}_{$lang}"} = $value[$lang];
     }
     return $this;
 }
Ejemplo n.º 3
0
 public function remove($file = false)
 {
     $this->type->remove_existed_file($this->item, $this->name, $file);
     return parent::set('');
 }
Ejemplo n.º 4
0
 public function set($value)
 {
     if (IO_FS::exists($value)) {
         $ext = '';
         if ($m = Core_Regexps::match_with_results('{\\.([^\\.]+)$}', $value)) {
             $ext = strtolower(trim($m[1]));
         }
         $filename = $this->type->uploaded_file_name($this->name, $this->data, $this->item, $ext);
         $dir = $this->type->uploaded_file_dir($this->name, $this->data, $this->item);
         if ($dir) {
             if (!IO_FS::exists($dir)) {
                 CMS::mkdirs($dir);
             }
             $_dir = preg_replace('{^\\./}', '', $dir);
             copy($value, "{$dir}/{$filename}");
             IO_FS::rm($uploaded);
             $value = "{$_dir}/{$filename}";
             return parent::set($value);
         }
     }
     return $this;
 }