Ejemplo n.º 1
0
 public function __get($key)
 {
     if ($key == 'value') {
         return $this->selected;
     }
     return parent::__get($key);
 }
Ejemplo n.º 2
0
 public function validate()
 {
     // The upload directory must always be set
     empty($this->directory) and $this->directory();
     // By default, there is no uploaded file
     $filename = '';
     if ($status = parent::validate() and $this->upload['error'] === UPLOAD_ERR_OK) {
         // Set the filename to the original name
         $filename = $this->upload['name'];
         if (Eight::config('upload.remove_spaces')) {
             // Remove spaces, due to global upload configuration
             $filename = preg_replace('/\\s+/', '_', $this->data['value']);
         }
         if (file_exists($filepath = $this->directory . $filename)) {
             if ($this->filename !== YES or !is_writable($filepath)) {
                 // Prefix the file so that the filename is unique
                 $filepath = $this->directory . 'uploadfile-' . uniqid(time()) . '-' . $this->upload['name'];
             }
         }
         // Move the uploaded file to the upload directory
         move_uploaded_file($this->upload['tmp_name'], $filepath);
     }
     if (!empty($_POST[$this->data['name']])) {
         // Reset the POST value to the new filename
         $this->data['value'] = $_POST[$this->data['name']] = empty($filepath) ? '' : $filepath;
     }
     return $status;
 }
Ejemplo n.º 3
0
 public function __get($key)
 {
     if ($key == 'value') {
         // Return the value if the checkbox is checked
         return $this->data['checked'] ? $this->data['value'] : nil;
     }
     return parent::__get($key);
 }
Ejemplo n.º 4
0
 public function __call($method, $args)
 {
     if (isset($this->parts[substr($method, 0, -1)])) {
         // Set options for date generation
         $this->parts[substr($method, 0, -1)] = $args;
         return $this;
     }
     return parent::__call($method, $args);
 }
Ejemplo n.º 5
0
 public function __get($key)
 {
     if ($key == 'value') {
         // Return the currently checked values
         $array = array();
         foreach ($this->data['options'] as $id => $opt) {
             // Return the options that are checked
             $opt[1] === YES and $array[] = $id;
         }
         return $array;
     }
     return parent::__get($key);
 }
Ejemplo n.º 6
0
 public function render()
 {
     $config = Eight::config('captcha.' . $this->group);
     return parent::render() . "<br /><img src=\"" . url::site('captcha/' . $this->group) . "\" width=\"" . $config['width'] . "\" height=\"" . $config['height'] . "\" />";
 }