Exemplo n.º 1
0
 public function __construct($name, $value, $expire = 0)
 {
     parent::__construct();
     $this->name = $name;
     $this->value = $value;
     $this->expire = $expire;
 }
Exemplo n.º 2
0
 public function __construct($attributes)
 {
     parent::__construct($attributes);
     if (!isset($this->attributes['inputvalue'])) {
         $this->attributes['inputvalue'] = 1;
     }
 }
Exemplo n.º 3
0
 public function __construct($key, $title, array $fields = array())
 {
     parent::__construct($key, $title);
     foreach ($fields as $field) {
         $this->addField($field);
     }
 }
Exemplo n.º 4
0
 public function __construct($attributes)
 {
     parent::__construct($attributes);
     if (!isset($attributes['textarea_name'])) {
         $this->attributes['textarea_name'] = '';
     }
     if (!isset($attributes['media_buttons'])) {
         $this->attributes['media_buttons'] = true;
     }
     if (!isset($attributes['wpautop'])) {
         $this->attributes['wpautop'] = true;
     }
     if (!isset($attributes['rows'])) {
         $this->attributes['rows'] = 15;
     }
     if (!isset($attributes['editor_class'])) {
         $this->attributes['editor_class'] = '';
     }
     if (!isset($attributes['teeny'])) {
         $this->attributes['teeny'] = false;
     }
     if (!isset($attributes['dfw'])) {
         $this->attributes['dfw'] = false;
     }
     if (!isset($attributes['tinymce'])) {
         $this->attributes['tinymce'] = true;
     }
     if (!isset($attributes['quicktags'])) {
         $this->attributes['quicktags'] = true;
     }
 }
Exemplo n.º 5
0
 /**
  * @param string $label
  * @param string $content
  */
 public function __construct(string $label, string $content = null)
 {
     parent::__construct('<div>', null, $label);
     if ($content) {
         $this->setContent($content);
     }
 }
Exemplo n.º 6
0
 /**
  * @param mixed $value
  */
 public function __construct($value = null)
 {
     parent::__construct($value);
     $this->defaultValue = self::EUR;
     $keys = serialize(array_keys(self::getAvailableValues()));
     $this->validationRules = ['required', "in_array({$keys})"];
 }
Exemplo n.º 7
0
 /**
  * {@inheritdoc}
  */
 public function setValue($value)
 {
     if ($this->multiselect) {
         $value = is_array($value) ? $value : array($value);
         return parent::setValue($value);
     }
     return parent::setValue($value);
 }
Exemplo n.º 8
0
 /**
  * @param string $name
  * @param string $value
  */
 public function __construct(string $name, string $value = null)
 {
     parent::__construct('<input />', $name);
     $this->getField()->addAttribute('type', 'hidden');
     if (!is_null($value)) {
         $this->setValue($value);
     }
 }
Exemplo n.º 9
0
 public function __construct($props)
 {
     parent::__construct($props);
     session_start();
     if (!isset($_POST[$this->name])) {
         $this->captcha = $this->generate_captcha();
     }
 }
Exemplo n.º 10
0
 public function __construct($itemId, $config)
 {
     if (array_key_exists('tag', $config)) {
         $this->tag = $config['tag'];
         unset($config['tag']);
     }
     parent::__construct($itemId, $config);
 }
Exemplo n.º 11
0
 /**
  * @param string $name
  * @param string $label
  * @param string $submitValue
  */
 public function __construct(string $name, string $label, string $submitValue = null)
 {
     parent::__construct('<input />', $name, $label);
     $this->getField()->addAttribute('type', 'radio');
     if ($name) {
         $this->setName($name);
     }
     $this->setSubmitValue($submitValue);
 }
Exemplo n.º 12
0
 protected function validate()
 {
     parent::validate();
     if ($this->getIsValid() && !$this->getIsEmpty() && $this->getFormat() == 'US') {
         if (!preg_match('\\d{3}-\\d{3}-\\d{4}', $this->getValue())) {
             $this->errors[] = 'error.invalidPhone';
         }
     }
 }
Exemplo n.º 13
0
 public function __construct($attributes)
 {
     parent::__construct($attributes);
     // if(!empty($this->attributes['specifyoptions']))
     // {
     //   $this->factory = new FieldFactory();
     //   foreach($this->attributes['specifyoptions'] as $val => $field)
     //   {
     //     $this->attributes['extrafields'][$val] = $this->factory->create($field);
     //   }
     // }
 }
Exemplo n.º 14
0
 public function init()
 {
     parent::init();
     add_action('admin_enqueue_scripts', array($this, 'initScripts'), 20);
     add_action('admin_enqueue_scripts', array($this, 'setupScripts'), 1000);
     $this->attributes['container'] = 'medialib-ui-' . $this->attributes['id'];
     $this->attributes['input'] = 'medialib-input-' . $this->attributes['id'];
     $this->attributes['AttachIdInput'] = 'medialib-inputattach-' . $this->attributes['id'];
     $this->attributes['AttachIdName'] = $this->attributes['name'] . 'AttachmentId';
     $this->attributes['mediabutton'] = __('Select', 'wpforms');
     $this->attributes['mediatype'] = 'image';
     $this->attributes['preview_thumb_id'] = 'preview-thumb-' . $this->attributes['id'];
 }
Exemplo n.º 15
0
 public function __construct($itemId, $config)
 {
     parent::__construct($itemId, $config);
     if (array_key_exists('options', $config)) {
         $this->options = $config['options'];
     }
     if (array_key_exists('option-keys', $config)) {
         $this->optionKeys = $config['option-keys'];
     }
     if (is_string($this->value)) {
         $this->value = [$this->value];
     }
 }
Exemplo n.º 16
0
 public function init()
 {
     parent::init();
     add_action('admin_enqueue_scripts', array($this, 'initScripts'), 20);
     add_action('admin_enqueue_scripts', array($this, 'setupScripts'), 1000);
     $this->attributes['container'] = 'plupload-upload-ui-' . $this->attributes['id'];
     $this->attributes['browse_button'] = 'plupload-browse-button-' . $this->attributes['id'];
     $this->attributes['drop_element'] = 'drag-drop-area-' . $this->attributes['id'];
     $this->attributes['file_data_name'] = 'async-upload-' . $this->attributes['id'];
     $this->attributes['extensions'] = array('jpg', 'jpeg', 'gif', 'png');
     $this->attributes['preview_thumb_id'] = 'preview-thumb-' . $this->attributes['id'];
     $this->attributes['ajax_action'] = 'upload-image' . $this->attributes['id'];
     add_action('wp_ajax_' . $this->attributes['ajax_action'], array($this, 'ajax'));
 }
Exemplo n.º 17
0
 /**
  * {@inheritdoc}
  */
 public function matches(\DateTime $date)
 {
     if ('?' === $this->value) {
         return true;
     }
     $found = parent::matches($date);
     if (!$found) {
         $values = $this->getValueArray();
         foreach ($values as $value) {
             if ($found) {
                 break;
             }
             if ('L' === $value) {
                 $found = $date->format('t') == $date->format('d');
             } elseif (strpos($value, 'W') !== false) {
                 $found = $this->matchesNearestWeekday($value, $date);
             }
         }
     }
     return $found;
 }
Exemplo n.º 18
0
 /**
  * {@inheritdoc}
  */
 public function matches(\DateTime $date)
 {
     if ('?' === $this->value) {
         return true;
     }
     $found = parent::matches($date);
     if (!$found) {
         $values = $this->getValueArray();
         foreach ($values as $value) {
             if ($found) {
                 break;
             }
             if (strpos($value, '#') !== false) {
                 $found = $this->matchesHash($value, $date);
             } elseif (strpos($value, 'L') !== false) {
                 $found = $this->matchesLastDay($value, $date);
             }
         }
     }
     return $found;
 }
Exemplo n.º 19
0
 /**
  * Sets the value of the field.
  *
  * @param int $value
  *
  * @throws \InvalidArgumentException if the value is not an integer
  */
 public function setValue($value)
 {
     parent::setValue($value);
 }
Exemplo n.º 20
0
 /**
  * @param mixed $value
  */
 public function __construct($value = null)
 {
     parent::__construct($value);
     $this->validationRules = ['numeric', 'exact_length(5)'];
 }
Exemplo n.º 21
0
 /**
  * @param mixed $value
  */
 public function __construct($value = null)
 {
     parent::__construct($value);
     $this->validationRules = ['url', 'max_length(250)'];
 }
Exemplo n.º 22
0
 /**
  * @param array $jsonData
  * @return $this
  */
 public function fillFromJsonData(array $jsonData)
 {
     parent::fillFromJsonData($jsonData);
     $this->setOptions($jsonData['options']);
     return $this;
 }
Exemplo n.º 23
0
 /**
  * @param mixed $value
  */
 public function __construct($value = null)
 {
     parent::__construct($value);
     $this->validationRules = ['required'];
 }
Exemplo n.º 24
0
 /**
  * {@inheritdoc}
  */
 public function setValue($value)
 {
     return parent::setValue((bool) $value);
 }
Exemplo n.º 25
0
 /**
  * Constructor
  *
  * @param string $type        Field type
  * @param string $fieldName   Field name
  * @param string $exposedName Exposed name
  * @param bool   $readOnly    Read only
  * @param bool   $required    Is required
  */
 public function __construct($type, $fieldName, $exposedName, $readOnly, $required)
 {
     $this->type = $type;
     parent::__construct($fieldName, $exposedName, $readOnly, $required);
 }
Exemplo n.º 26
0
 /**
  * Set field value
  *
  * @param mixed $value field value
  */
 public function set_value($value)
 {
     parent::set_value($value);
     $this->set_attribute('checked', $this->_value ? $this->_value : null);
 }
Exemplo n.º 27
0
 /**
  * @param mixed $value
  */
 public function __construct($value = null)
 {
     parent::__construct($value);
     $this->defaultValue = '1';
     $this->validationRules = ['numeric', 'max_length(3)'];
 }
Exemplo n.º 28
0
 /**
  * Public constructor
  *
  * @param string $label Label
  */
 public function __construct($label)
 {
     parent::__construct('', $label);
 }
Exemplo n.º 29
0
 /**
  * Constructor.
  *
  * Initializes required field data to null.
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct(array('key' => null, 'name' => null));
 }
Exemplo n.º 30
0
 /**
  * @param string $content
  * @param string $label
  */
 public function __construct(string $content, string $label = null)
 {
     parent::__construct('<button>', null, $label);
     $this->getField()->setContent($content);
     $this->getField()->addAttribute('type', self::TYPE_SUBMIT);
 }