Example #1
0
 /**
  * Creates a new select form element.
  * 
  * @param array $attributes The attributes that should be assigned to the select element.
  */
 public function __construct(array $attributes)
 {
     parent::__construct($attributes);
     //if( is_null(fe_select::$shareEmptyValue) ) fe_select::$shareEmptyValue = get::rand_string(8);
     //$this->emptyValue = fe_select::$shareEmptyValue;
     $this->emptyValue = '';
 }
Example #2
0
 /**
  * Creates a new form element.
  * 
  * @param array $attributes The attributes that should be assigned to the input element.
  */
 public function __construct(array $attributes)
 {
     parent::__construct($attributes);
     $this->type = 'button';
 }
Example #3
0
 /**
  * Adds the file array to the form POST/GET array and normalizes
  * it rather then keeping the weird _FILES structure.
  * 
  * Called only once a form has been identified for processing.
  * 
  * @param array $arr
  *   The array to add the file information to, usually a reference to
  *   the _POST or _GET superglobal array.
  * 
  * @return void
  */
 private static function fixFileArray(array &$arr)
 {
     $fileKeys = array('name', 'type', 'tmp_name', 'error', 'size');
     foreach ($_FILES as $basename => $fileArr) {
         $res = array();
         foreach ($fileKeys as $key) {
             if (array_key_exists($key, $fileArr)) {
                 if (is_array($fileArr[$key])) {
                     $subkey = self::flatten_file($fileArr[$key]);
                     foreach ($subkey as $k => $v) {
                         $res[$basename . $k . '[' . $key . ']'] = $key == 'type' ? strtolower($v) : $v;
                         if ($key == 'name' && !array_key_exists($basename . $k . '[ext]', $res)) {
                             $res[$basename . $k . '[ext]'] = get::fullext($v);
                         }
                     }
                 } else {
                     $res[$basename . '[' . $key . ']'] = $key == 'type' ? strtolower($fileArr[$key]) : $fileArr[$key];
                     if ($key == 'name' && !array_key_exists($basename . '[ext]', $res)) {
                         $res[$basename . '[ext]'] = get::fullext($fileArr[$key]);
                     }
                 }
             }
         }
         foreach ($res as $path => $v) {
             $pa = formElement::getFieldPath($path, false, false);
             $ref =& $arr;
             while (count($pa) > 0) {
                 $idx = array_shift($pa);
                 if (!array_key_exists($idx, $ref)) {
                     $ref[$idx] = array();
                 }
                 $ref =& $ref[$idx];
             }
             $ref = $v;
             unset($ref);
         }
     }
 }
Example #4
0
 /**
  * Creates a new textarea form element.
  * 
  * @param array $attributes The attributes that should be assigned to the textarea element.
  */
 public function __construct(array $attributes)
 {
     parent::__construct($attributes);
 }