Example #1
2
 /**
  * Method to attach a JForm object to the field.
  *  Catch upload files when form setup.
  *
  * @param   object  &$element  The JXmlElement object representing the <field /> tag for the form field object.
  * @param   mixed   $value     The form field value to validate.
  * @param   string  $group     The field name group control value. This acts as as an array container for the field.
  *                              For example if the field has name="foo" and the group value is set to "bar" then the
  *                              full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     parent::setup($element, $value, $group);
     if (JRequest::getVar($this->element['name'] . '_delete') == 1) {
         $this->value = '';
     } else {
         // Upload Image
         // ===============================================
         if (isset($_FILES['jform']['name']['profile'])) {
             foreach ($_FILES['jform']['name']['profile'] as $key => $var) {
                 if (!$var) {
                     continue;
                 }
                 // Get Field Attr
                 $width = $this->element['save_width'] ? $this->element['save_width'] : 800;
                 $height = $this->element['save_height'] ? $this->element['save_height'] : 800;
                 // Build File name
                 $src = $_FILES['jform']['tmp_name']['profile'][$key];
                 $var = explode('.', $var);
                 $date = JFactory::getDate('now', JFactory::getConfig()->get('offset'));
                 $name = md5((string) $date . $width . $height . $src) . '.' . array_pop($var);
                 $url = "images/cck/{$date->year}/{$date->month}/{$date->day}/" . $name;
                 // A Event for extend.
                 JFactory::getApplication()->triggerEvent('onCCKEngineUploadImage', array(&$url, &$this, &$this->element));
                 $dest = JPATH_ROOT . '/' . $url;
                 // Upload First
                 JFile::upload($src, $dest);
                 // Resize image
                 $img = new JImage();
                 $img->loadFile(JPATH_ROOT . '/' . $url);
                 $img = $img->resize($width, $height);
                 switch (array_pop($var)) {
                     case 'gif':
                         $type = IMAGETYPE_GIF;
                         break;
                     case 'png':
                         $type = IMAGETYPE_PNG;
                         break;
                     default:
                         $type = IMAGETYPE_JPEG;
                         break;
                 }
                 // save
                 $img->toFile($dest, $type, array('quality' => 85));
                 // Set in Value
                 $this->value = $url;
             }
         }
     }
     return true;
 }
Example #2
0
 /**
  * Method to attach a JForm object to the field.
  *  Catch upload files when form setup.
  *
  * @param   SimpleXMLElement $element  The JXmlElement object representing the <field /> tag for the form field object.
  * @param   mixed            $value    The form field value to validate.
  * @param   string           $group    The field name group control value. This acts as as an array container for the field.
  *                                     For example if the field has name="foo" and the group value is set to "bar" then the
  *                                     full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     parent::setup($element, $value, $group);
     $container = \Windwalker\DI\Container::getInstance();
     $input = $container->get('input');
     $delete = isset($_REQUEST['jform']['profile'][$this->element['name'] . '_delete']) ? $_REQUEST['jform']['profile'][$this->element['name'] . '_delete'] : 0;
     if ($delete == 1) {
         $this->value = '';
     } else {
         // Upload Image
         // ===============================================
         if (isset($_FILES['jform']['name']['profile'])) {
             foreach ($_FILES['jform']['name']['profile'] as $key => $var) {
                 if (!$var) {
                     continue;
                 }
                 // Get Field Attr
                 $width = $this->element['save_width'] ? $this->element['save_width'] : 800;
                 $height = $this->element['save_height'] ? $this->element['save_height'] : 800;
                 // Build File name
                 $src = $_FILES['jform']['tmp_name']['profile'][$key];
                 $var = explode('.', $var);
                 $date = DateHelper::getDate();
                 $name = md5((string) $date . $width . $height . $src) . '.' . array_pop($var);
                 $url = "images/cck/{$date->year}/{$date->month}/{$date->day}/" . $name;
                 // A Event for extend.
                 $container->get('event.dispatcher')->trigger('onCCKEngineUploadImage', array(&$url, &$this, &$this->element));
                 $dest = JPATH_ROOT . '/' . $url;
                 // Upload First
                 JFile::upload($src, $dest);
                 // Resize image
                 $img = new JImage();
                 $img->loadFile(JPATH_ROOT . '/' . $url);
                 $img = $img->resize($width, $height);
                 switch (array_pop($var)) {
                     case 'gif':
                         $type = IMAGETYPE_GIF;
                         break;
                     case 'png':
                         $type = IMAGETYPE_PNG;
                         break;
                     default:
                         $type = IMAGETYPE_JPEG;
                         break;
                 }
                 // Save
                 $img->toFile($dest, $type, array('quality' => 85));
                 // Set in Value
                 $this->value = $url;
                 // Clean cache
                 $thumb = $this->getThumbPath();
                 if (is_file(JPATH_ROOT . '/' . $thumb)) {
                     \JFile::delete(JPATH_ROOT . '/' . $thumb);
                 }
             }
         }
     }
     return true;
 }
Example #3
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $result = parent::setup($element, $value, $group);
     if ($result == true) {
         $this->contentType = (string) $this->element['content_type'];
     }
     return $result;
 }
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $this->countertype = (string) $this->element['countertype'];
     }
     return $return;
 }
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.6.3
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $this->linked = isset($this->element['linked']) ? (int) $this->element['linked'] : 'position';
     }
     return $return;
 }
Example #6
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   object  &$element  The JXmlElement object representing the <field /> tag for the form field object.
  * @param   mixed   $value     The form field value to validate.
  * @param   string  $group     The field name group control value. This acts as as an array container for the field.
  *                             For example if the field has name="foo" and the group value is set to "bar" then the
  *                             full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @since   2.5
  */
 public function setup(&$element, $value, $group = null)
 {
     $result = parent::setup($element, $value, $group);
     // Force field to be required. There's no reason to have a captcha if it is not required.
     // Obs: Don't put required="required" in the xml file, you just need to have validate="captcha"
     $this->required = true;
     $class = $this->element['class'];
     if (strpos($class, 'required') === false) {
         $this->element['class'] = $class . ' required';
     }
     return $result;
 }
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $this->max = isset($this->element['max']) ? $this->element['max'] : null;
         $this->min = isset($this->element['min']) ? $this->element['min'] : null;
         $this->unit = isset($this->element['unit']) ? $this->element['unit'] : null;
         $this->help = isset($this->element['help']) ? $this->element['help'] : null;
         $this->icon = isset($this->element['icon']) ? $this->element['icon'] : null;
         $this->maxLength = isset($this->element['maxlength']) ? $this->element['maxlength'] : '';
     }
     return $return;
 }
 public function setup(&$element, $value, $group = null)
 {
     $success = parent::setup($element, $value, $group);
     if (!$success) {
         return false;
     }
     //echo var_export($this->form);die();
     return true;
     // load any custom fields
     $dispatcher =& JDispatcher::getInstance();
     JPluginHelper::importPlugin("jevents");
     $id = intval(str_replace("extras", "", $this->name));
     $res = $dispatcher->trigger('onEditMenuItem', array(&$this->data, &$this->value, $this->type, $this->name, $this->id, $this->form));
     return true;
 }
	public function setup(SimpleXMLElement $element, $value, $group = null) {
            $return = parent::setup($element, $value, $group);
            if($return) {
                if(version_compare(JVERSION,3.2,'>=')) {
                    $td = ($this->getAttribute('translate_default') == 'true')?true:false;
                    $default = ($this->value == $this->default)?$this->default:false;
                } else {
                    $td = ($element->attributes()->translate_default == 'true')?true:false;
                    $default = ($this->value == $element->attributes()->default)?$element->attributes()->default:false;                
                }
                if($td && $default) {
                    $this->value = JText::_($default);   
                }
            }
            return $return;
        }
Example #10
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @since   2.5
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $result = parent::setup($element, $value, $group);
     $plugin = $this->element['plugin'] ? (string) $this->element['plugin'] : JFactory::getApplication()->getParams()->get('captcha', JFactory::getConfig()->get('captcha'));
     if ($plugin === 0 || $plugin === '0' || $plugin === '' || $plugin === null) {
         $this->hidden = true;
     } else {
         // Force field to be required. There's no reason to have a captcha if it is not required.
         // Obs: Don't put required="required" in the xml file, you just need to have validate="captcha"
         $this->required = true;
         $class = $this->element['class'];
         if (strpos($class, 'required') === false) {
             $this->element['class'] = $class . ' required';
         }
     }
     return $result;
 }
Example #11
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @since   2.5
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $result = parent::setup($element, $value, $group);
     $app = JFactory::getApplication();
     $default = $app->get('captcha');
     if ($app->isSite()) {
         $default = $app->getParams()->get('captcha', $default);
     }
     $plugin = $this->element['plugin'] ? (string) $this->element['plugin'] : $default;
     $this->plugin = $plugin;
     if ($plugin === 0 || $plugin === '0' || $plugin === '' || $plugin === null) {
         $this->hidden = true;
     } else {
         // Force field to be required. There's no reason to have a captcha if it is not required.
         // Obs: Don't put required="required" in the xml file, you just need to have validate="captcha"
         $this->required = true;
         if (strpos($this->class, 'required') === false) {
             $this->class = $this->class . ' required';
         }
     }
     $this->namespace = $this->element['namespace'] ? (string) $this->element['namespace'] : $this->form->getName();
     return $result;
 }
Example #12
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     // Handle the default attribute
     $default = (string) $element['default'];
     if ($default) {
         $test = $this->form->getValue((string) $element['name'], $group);
         $value = $test == $default ? $default : null;
     }
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $checked = (string) $this->element['checked'];
         $this->checked = $checked == 'true' || $checked == 'checked' || $checked == '1';
         empty($this->value) || $this->checked ? null : ($this->checked = true);
     }
     return $return;
 }
Example #13
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $result = parent::setup($element, $value, $group);
     if ($result == true) {
         $inputmode = (string) $this->element['inputmode'];
         $dirname = (string) $this->element['dirname'];
         $this->inputmode = '';
         $inputmode = preg_replace('/\\s+/', ' ', trim($inputmode));
         $inputmode = explode(' ', $inputmode);
         if (!empty($inputmode)) {
             $defaultInputmode = in_array('default', $inputmode) ? JText::_("JLIB_FORM_INPUTMODE") . ' ' : '';
             foreach (array_keys($inputmode, 'default') as $key) {
                 unset($inputmode[$key]);
             }
             $this->inputmode = $defaultInputmode . implode(" ", $inputmode);
         }
         // Set the dirname.
         $dirname = (string) $dirname == 'dirname' || $dirname == 'true' || $dirname == '1';
         $this->dirname = $dirname ? $this->getName($this->fieldname . '_dir') : false;
         $this->maxLength = (int) $this->element['maxlength'];
     }
     return $result;
 }
Example #14
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see 	JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $result = parent::setup($element, $value, $group);
     if ($result == true) {
         $assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id';
         $this->authorField = $this->element['created_by_field'] ? (string) $this->element['created_by_field'] : 'created_by';
         $this->asset = $this->form->getValue($assetField) ? $this->form->getValue($assetField) : (string) $this->element['asset_id'];
         $this->link = (string) $this->element['link'];
         $this->preview = (string) $this->element['preview'];
         $this->directory = (string) $this->element['directory'];
         $this->previewWidth = isset($this->element['preview_width']) ? (int) $this->element['preview_width'] : 200;
         $this->previewHeight = isset($this->element['preview_height']) ? (int) $this->element['preview_height'] : 200;
     }
     return $result;
 }
Example #15
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $this->section = $this->element['section'] ? (string) $this->element['section'] : '';
         $this->component = $this->element['component'] ? (string) $this->element['component'] : '';
         $this->assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id';
     }
     return $return;
 }
Example #16
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $this->control = isset($this->element['control']) ? (string) $this->element['control'] : 'hue';
         $this->format = isset($this->element['format']) ? (string) $this->element['format'] : 'hex';
         $this->keywords = isset($this->element['keywords']) ? (string) $this->element['keywords'] : '';
         $this->position = isset($this->element['position']) ? (string) $this->element['position'] : 'default';
         $this->colors = (string) $this->element['colors'];
         $this->split = isset($this->element['split']) ? (int) $this->element['split'] : 3;
     }
     return $return;
 }
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement $element   The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed            $value     The form field value to validate.
  * @param   string           $group     The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $componentParams = JComponentHelper::getParams('com_crowdfunding');
         $format = $componentParams->get('date_format_calendar', 'Y-m-d');
         $this->maxlength = (int) $this->element['maxlength'] ?: 45;
         $this->format = (string) $this->element['format'] ?: $format;
         $this->filter = (string) $this->element['filter'] ?: 'USER_UTC';
     }
     return $return;
 }
Example #18
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $input = \Windwalker\DI\Container::getInstance()->get('input');
     $this->container = \Windwalker\DI\Container::getInstance($input->get('option'));
     return parent::setup($element, $value, $group);
 }
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value.
  *
  * @return  boolean  True on success.
  *
  * @since   3.6
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     if (!parent::setup($element, $value, $group)) {
         return false;
     }
     foreach (array('formsource', 'min', 'max', 'layout', 'groupByFieldset', 'buttons') as $attributeName) {
         $this->__set($attributeName, $element[$attributeName]);
     }
     if ($this->value && is_string($this->value)) {
         // Guess here is the JSON string from 'default' attribute
         $this->value = json_decode($this->value, true);
     }
     return true;
 }
Example #20
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         // It is better not to force any default limits if none is specified
         $this->max = isset($this->element['max']) ? (double) $this->element['max'] : null;
         $this->min = isset($this->element['min']) ? (double) $this->element['min'] : null;
         $this->step = isset($this->element['step']) ? (double) $this->element['step'] : 1;
     }
     return $return;
 }
Example #21
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $this->max = isset($this->element['max']) ? (double) $this->element['max'] : 100;
         $this->min = isset($this->element['min']) ? (double) $this->element['min'] : 0;
         $this->step = isset($this->element['step']) ? (double) $this->element['step'] : 1;
     }
     return $return;
 }
Example #22
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $this->maxlength = (int) $this->element['maxlength'] ? (int) $this->element['maxlength'] : 45;
         $this->format = (string) $this->element['format'] ? (string) $this->element['format'] : '%Y-%m-%d';
         $this->filter = (string) $this->element['filter'] ? (string) $this->element['filter'] : 'USER_UTC';
     }
     return $return;
 }
Example #23
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $this->rows = isset($this->element['rows']) ? (int) $this->element['rows'] : false;
         $this->columns = isset($this->element['cols']) ? (int) $this->element['cols'] : false;
     }
     return $return;
 }
Example #24
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $this->accept = (string) $this->element['accept'];
     }
     return $return;
 }
Example #25
0
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $this->icon = isset($this->element['icon']) ? $this->element['icon'] : null;
         $this->help = isset($this->element['help']) ? $this->element['help'] : null;
     }
     return $return;
 }
Example #26
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.0.0
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $firstdayofweek = JFactory::getLanguage()->getFirstDay();
         if (!in_array($firstdayofweek, array(0, 1))) {
             $firstdayofweek = 0;
         }
         $this->firstdayofweek = (int) $this->element['firstdayofweek'] ? (int) $this->element['firstdayofweek'] : $firstdayofweek;
         $this->format = (string) $this->element['format'] ? (string) $this->element['format'] : '%Y-%m-%d';
         $this->language = (string) $this->element['language'] ? (string) $this->element['language'] : 'en';
     }
     return $return;
 }
Example #27
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $this->maxLength = $this->element['maxlength'] ? (int) $this->element['maxlength'] : 99;
         $this->threshold = $this->element['threshold'] ? (int) $this->element['threshold'] : 66;
         $meter = (string) $this->element['strengthmeter'];
         $this->meter = $meter == 'true' || $meter == 'on' || $meter == '1';
     }
     return $return;
 }
 /**
  * 
  * setup overwrite
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $response = parent::setup($element, $value, $group);
     $this->disabled = $this->element["disabled"] == 'true' ? true : false;
     return $response;
 }
Example #29
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $checked = (string) $this->element['checked'];
         $this->checked = $checked == 'true' || $checked == 'checked' || $checked == '1';
         empty($this->value) || $this->checked ? null : ($this->checked = true);
     }
     return $return;
 }
Example #30
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
  * @param   mixed             $value    The form field value to validate.
  * @param   string            $group    The field name group control value. This acts as as an array container for the field.
  *                                      For example if the field has name="foo" and the group value is set to "bar" then the
  *                                      full field name would end up being "bar[foo]".
  *
  * @return  boolean  True on success.
  *
  * @see     JFormField::setup()
  * @since   3.2
  */
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $this->checkedOptions = (string) $this->element['checked'];
     }
     return $return;
 }