Completed
Push — master ( a09810...4911d3 )
by Michael
02:35
created
class/form/elements/smartautocompleteelement.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -11,38 +11,38 @@
 block discarded – undo
11 11
  */
12 12
 class SmartAutocompleteElement extends XoopsFormText
13 13
 {
14
-    public $_include_file;
14
+	public $_include_file;
15 15
 
16
-    /**
17
-     * SmartAutocompleteElement constructor.
18
-     * @param string $caption
19
-     * @param string $name
20
-     * @param int    $include_file
21
-     * @param int    $size
22
-     * @param string $maxlength
23
-     * @param string $value
24
-     */
25
-    public function __construct($caption, $name, $include_file, $size, $maxlength, $value = '')
26
-    {
27
-        $this->_include_file = $include_file;
28
-        parent::__construct($caption, $name, $size, $maxlength, $value);
29
-    }
16
+	/**
17
+	 * SmartAutocompleteElement constructor.
18
+	 * @param string $caption
19
+	 * @param string $name
20
+	 * @param int    $include_file
21
+	 * @param int    $size
22
+	 * @param string $maxlength
23
+	 * @param string $value
24
+	 */
25
+	public function __construct($caption, $name, $include_file, $size, $maxlength, $value = '')
26
+	{
27
+		$this->_include_file = $include_file;
28
+		parent::__construct($caption, $name, $size, $maxlength, $value);
29
+	}
30 30
 
31
-    /**
32
-     * Prepare HTML for output
33
-     *
34
-     * @return string HTML
35
-     */
36
-    public function render()
37
-    {
38
-        $ret = "<input type='text' name='" . $this->getName() . "' id='" . $this->getName() . "' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $this->getValue() . "'" . $this->getExtra() . '>';
31
+	/**
32
+	 * Prepare HTML for output
33
+	 *
34
+	 * @return string HTML
35
+	 */
36
+	public function render()
37
+	{
38
+		$ret = "<input type='text' name='" . $this->getName() . "' id='" . $this->getName() . "' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $this->getValue() . "'" . $this->getExtra() . '>';
39 39
 
40
-        $ret .= '   <div class="smartobject_autocomplete_hint" id="smartobject_autocomplete_hint' . $this->getName() . '"></div>
40
+		$ret .= '   <div class="smartobject_autocomplete_hint" id="smartobject_autocomplete_hint' . $this->getName() . '"></div>
41 41
 
42 42
     <script type="text/javascript">
43 43
         new Ajax.Autocompleter("' . $this->getName() . '","smartobject_autocomplete_hint' . $this->getName() . '","' . $this->_include_file . '?key=' . $this->getName() . '");
44 44
     </script>';
45 45
 
46
-        return $ret;
47
-    }
46
+		return $ret;
47
+	}
48 48
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@
 block discarded – undo
35 35
      */
36 36
     public function render()
37 37
     {
38
-        $ret = "<input type='text' name='" . $this->getName() . "' id='" . $this->getName() . "' size='" . $this->getSize() . "' maxlength='" . $this->getMaxlength() . "' value='" . $this->getValue() . "'" . $this->getExtra() . '>';
38
+        $ret = "<input type='text' name='".$this->getName()."' id='".$this->getName()."' size='".$this->getSize()."' maxlength='".$this->getMaxlength()."' value='".$this->getValue()."'".$this->getExtra().'>';
39 39
 
40
-        $ret .= '   <div class="smartobject_autocomplete_hint" id="smartobject_autocomplete_hint' . $this->getName() . '"></div>
40
+        $ret .= '   <div class="smartobject_autocomplete_hint" id="smartobject_autocomplete_hint'.$this->getName().'"></div>
41 41
 
42 42
     <script type="text/javascript">
43
-        new Ajax.Autocompleter("' . $this->getName() . '","smartobject_autocomplete_hint' . $this->getName() . '","' . $this->_include_file . '?key=' . $this->getName() . '");
43
+        new Ajax.Autocompleter("' . $this->getName().'","smartobject_autocomplete_hint'.$this->getName().'","'.$this->_include_file.'?key='.$this->getName().'");
44 44
     </script>';
45 45
 
46 46
         return $ret;
Please login to merge, or discard this patch.
class/form/elements/smartformrichfileelement.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -11,39 +11,39 @@
 block discarded – undo
11 11
  */
12 12
 class SmartFormRichFileElement extends XoopsFormElementTray
13 13
 {
14
-    /**
15
-     * SmartFormRichFileElement constructor.
16
-     * @param string $form_caption
17
-     * @param string $key
18
-     * @param string $object
19
-     */
20
-    public function __construct($form_caption, $key, $object)
21
-    {
22
-        parent::__construct($form_caption, '&nbsp;');
23
-        if ($object->getVar('url') !== '') {
24
-            $caption = $object->getVar('caption') !== '' ? $object->getVar('caption') : $object->getVar('url');
25
-            $this->addElement(new XoopsFormLabel('', _CO_SOBJECT_CURRENT_FILE . "<a href='" . str_replace('{XOOPS_URL}', XOOPS_URL, $object->getVar('url')) . "' target='_blank' >" . $caption . '</a><br><br>'));
26
-            //$this->addElement( new XoopsFormLabel( '', "<br><a href = '".SMARTOBJECT_URL."admin/file.php?op=del&fileid=".$object->id()."'>"._CO_SOBJECT_DELETE_FILE."</a>"));
27
-        }
14
+	/**
15
+	 * SmartFormRichFileElement constructor.
16
+	 * @param string $form_caption
17
+	 * @param string $key
18
+	 * @param string $object
19
+	 */
20
+	public function __construct($form_caption, $key, $object)
21
+	{
22
+		parent::__construct($form_caption, '&nbsp;');
23
+		if ($object->getVar('url') !== '') {
24
+			$caption = $object->getVar('caption') !== '' ? $object->getVar('caption') : $object->getVar('url');
25
+			$this->addElement(new XoopsFormLabel('', _CO_SOBJECT_CURRENT_FILE . "<a href='" . str_replace('{XOOPS_URL}', XOOPS_URL, $object->getVar('url')) . "' target='_blank' >" . $caption . '</a><br><br>'));
26
+			//$this->addElement( new XoopsFormLabel( '', "<br><a href = '".SMARTOBJECT_URL."admin/file.php?op=del&fileid=".$object->id()."'>"._CO_SOBJECT_DELETE_FILE."</a>"));
27
+		}
28 28
 
29
-        require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformfileuploadelement.php';
30
-        if ($object->isNew()) {
31
-            $this->addElement(new SmartFormFileUploadElement($object, $key));
32
-            $this->addElement(new XoopsFormLabel('', '<br><br><small>' . _CO_SOBJECT_URL_FILE_DSC . '</small>'));
33
-            $this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE));
34
-            $this->addElement(new SmartFormTextElement($object, 'url_' . $key));
35
-        }
36
-        $this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_CAPTION));
37
-        $this->addElement(new SmartFormTextElement($object, 'caption_' . $key));
38
-        $this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_DESC . '<br>'));
39
-        $this->addElement(new XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description')));
29
+		require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformfileuploadelement.php';
30
+		if ($object->isNew()) {
31
+			$this->addElement(new SmartFormFileUploadElement($object, $key));
32
+			$this->addElement(new XoopsFormLabel('', '<br><br><small>' . _CO_SOBJECT_URL_FILE_DSC . '</small>'));
33
+			$this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE));
34
+			$this->addElement(new SmartFormTextElement($object, 'url_' . $key));
35
+		}
36
+		$this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_CAPTION));
37
+		$this->addElement(new SmartFormTextElement($object, 'caption_' . $key));
38
+		$this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_DESC . '<br>'));
39
+		$this->addElement(new XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description')));
40 40
 
41
-        if (!$object->isNew()) {
42
-            $this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_CHANGE_FILE));
43
-            $this->addElement(new SmartFormFileUploadElement($object, $key));
44
-            $this->addElement(new XoopsFormLabel('', '<br><br><small>' . _CO_SOBJECT_URL_FILE_DSC . '</small>'));
45
-            $this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE));
46
-            $this->addElement(new SmartFormTextElement($object, 'url_' . $key));
47
-        }
48
-    }
41
+		if (!$object->isNew()) {
42
+			$this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_CHANGE_FILE));
43
+			$this->addElement(new SmartFormFileUploadElement($object, $key));
44
+			$this->addElement(new XoopsFormLabel('', '<br><br><small>' . _CO_SOBJECT_URL_FILE_DSC . '</small>'));
45
+			$this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE));
46
+			$this->addElement(new SmartFormTextElement($object, 'url_' . $key));
47
+		}
48
+	}
49 49
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -22,28 +22,28 @@
 block discarded – undo
22 22
         parent::__construct($form_caption, '&nbsp;');
23 23
         if ($object->getVar('url') !== '') {
24 24
             $caption = $object->getVar('caption') !== '' ? $object->getVar('caption') : $object->getVar('url');
25
-            $this->addElement(new XoopsFormLabel('', _CO_SOBJECT_CURRENT_FILE . "<a href='" . str_replace('{XOOPS_URL}', XOOPS_URL, $object->getVar('url')) . "' target='_blank' >" . $caption . '</a><br><br>'));
25
+            $this->addElement(new XoopsFormLabel('', _CO_SOBJECT_CURRENT_FILE."<a href='".str_replace('{XOOPS_URL}', XOOPS_URL, $object->getVar('url'))."' target='_blank' >".$caption.'</a><br><br>'));
26 26
             //$this->addElement( new XoopsFormLabel( '', "<br><a href = '".SMARTOBJECT_URL."admin/file.php?op=del&fileid=".$object->id()."'>"._CO_SOBJECT_DELETE_FILE."</a>"));
27 27
         }
28 28
 
29
-        require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformfileuploadelement.php';
29
+        require_once SMARTOBJECT_ROOT_PATH.'class/form/elements/smartformfileuploadelement.php';
30 30
         if ($object->isNew()) {
31 31
             $this->addElement(new SmartFormFileUploadElement($object, $key));
32
-            $this->addElement(new XoopsFormLabel('', '<br><br><small>' . _CO_SOBJECT_URL_FILE_DSC . '</small>'));
33
-            $this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE));
34
-            $this->addElement(new SmartFormTextElement($object, 'url_' . $key));
32
+            $this->addElement(new XoopsFormLabel('', '<br><br><small>'._CO_SOBJECT_URL_FILE_DSC.'</small>'));
33
+            $this->addElement(new XoopsFormLabel('', '<br>'._CO_SOBJECT_URL_FILE));
34
+            $this->addElement(new SmartFormTextElement($object, 'url_'.$key));
35 35
         }
36
-        $this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_CAPTION));
37
-        $this->addElement(new SmartFormTextElement($object, 'caption_' . $key));
38
-        $this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_DESC . '<br>'));
39
-        $this->addElement(new XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description')));
36
+        $this->addElement(new XoopsFormLabel('', '<br>'._CO_SOBJECT_CAPTION));
37
+        $this->addElement(new SmartFormTextElement($object, 'caption_'.$key));
38
+        $this->addElement(new XoopsFormLabel('', '<br>'._CO_SOBJECT_DESC.'<br>'));
39
+        $this->addElement(new XoopsFormTextArea('', 'desc_'.$key, $object->getVar('description')));
40 40
 
41 41
         if (!$object->isNew()) {
42
-            $this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_CHANGE_FILE));
42
+            $this->addElement(new XoopsFormLabel('', '<br>'._CO_SOBJECT_CHANGE_FILE));
43 43
             $this->addElement(new SmartFormFileUploadElement($object, $key));
44
-            $this->addElement(new XoopsFormLabel('', '<br><br><small>' . _CO_SOBJECT_URL_FILE_DSC . '</small>'));
45
-            $this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE));
46
-            $this->addElement(new SmartFormTextElement($object, 'url_' . $key));
44
+            $this->addElement(new XoopsFormLabel('', '<br><br><small>'._CO_SOBJECT_URL_FILE_DSC.'</small>'));
45
+            $this->addElement(new XoopsFormLabel('', '<br>'._CO_SOBJECT_URL_FILE));
46
+            $this->addElement(new SmartFormTextElement($object, 'url_'.$key));
47 47
         }
48 48
     }
49 49
 }
Please login to merge, or discard this patch.
class/form/elements/smartformuserelement.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -11,36 +11,36 @@
 block discarded – undo
11 11
  */
12 12
 class SmartFormUserElement extends XoopsFormSelect
13 13
 {
14
-    public $multiple = false;
14
+	public $multiple = false;
15 15
 
16
-    /**
17
-     * SmartFormUserElement constructor.
18
-     * @param string $object
19
-     * @param string $key
20
-     */
21
-    public function __construct($object, $key)
22
-    {
23
-        $var  = $object->vars[$key];
24
-        $size = isset($var['size']) ? $var['size'] : ($this->multiple ? 5 : 1);
16
+	/**
17
+	 * SmartFormUserElement constructor.
18
+	 * @param string $object
19
+	 * @param string $key
20
+	 */
21
+	public function __construct($object, $key)
22
+	{
23
+		$var  = $object->vars[$key];
24
+		$size = isset($var['size']) ? $var['size'] : ($this->multiple ? 5 : 1);
25 25
 
26
-        parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e'), $size, $this->multiple);
26
+		parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e'), $size, $this->multiple);
27 27
 
28
-        // Adding the options inside this SelectBox
29
-        // If the custom method is not from a module, than it's from the core
30
-        $control = $object->getControl($key);
28
+		// Adding the options inside this SelectBox
29
+		// If the custom method is not from a module, than it's from the core
30
+		$control = $object->getControl($key);
31 31
 
32
-        global $xoopsDB;
33
-        $ret   = array();
34
-        $limit = $start = 0;
35
-        $sql   = 'SELECT uid, uname FROM ' . $xoopsDB->prefix('users');
36
-        $sql   .= ' ORDER BY uname ASC';
32
+		global $xoopsDB;
33
+		$ret   = array();
34
+		$limit = $start = 0;
35
+		$sql   = 'SELECT uid, uname FROM ' . $xoopsDB->prefix('users');
36
+		$sql   .= ' ORDER BY uname ASC';
37 37
 
38
-        $result = $xoopsDB->query($sql);
39
-        if ($result) {
40
-            while ($myrow = $xoopsDB->fetchArray($result)) {
41
-                $uArray[$myrow['uid']] = $myrow['uname'];
42
-            }
43
-        }
44
-        $this->addOptionArray($uArray);
45
-    }
38
+		$result = $xoopsDB->query($sql);
39
+		if ($result) {
40
+			while ($myrow = $xoopsDB->fetchArray($result)) {
41
+				$uArray[$myrow['uid']] = $myrow['uname'];
42
+			}
43
+		}
44
+		$this->addOptionArray($uArray);
45
+	}
46 46
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
         global $xoopsDB;
33 33
         $ret   = array();
34 34
         $limit = $start = 0;
35
-        $sql   = 'SELECT uid, uname FROM ' . $xoopsDB->prefix('users');
35
+        $sql   = 'SELECT uid, uname FROM '.$xoopsDB->prefix('users');
36 36
         $sql   .= ' ORDER BY uname ASC';
37 37
 
38 38
         $result = $xoopsDB->query($sql);
Please login to merge, or discard this patch.
class/form/elements/smartformfileelement.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -5,38 +5,38 @@
 block discarded – undo
5 5
  */
6 6
 class SmartFormFileElement extends XoopsFormFile
7 7
 {
8
-    public $object;
9
-    public $key;
8
+	public $object;
9
+	public $key;
10 10
 
11
-    /**
12
-     * SmartFormFileElement constructor.
13
-     * @param string $object
14
-     * @param string $key
15
-     */
16
-    public function __construct($object, $key)
17
-    {
18
-        $this->object = $object;
19
-        $this->key    = $key;
20
-        parent::__construct($object->vars[$key]['form_caption'], $key, isset($object->vars[$key]['form_maxfilesize']) ? $object->vars[$key]['form_maxfilesize'] : 0);
21
-        $this->setExtra(' size=50');
22
-    }
11
+	/**
12
+	 * SmartFormFileElement constructor.
13
+	 * @param string $object
14
+	 * @param string $key
15
+	 */
16
+	public function __construct($object, $key)
17
+	{
18
+		$this->object = $object;
19
+		$this->key    = $key;
20
+		parent::__construct($object->vars[$key]['form_caption'], $key, isset($object->vars[$key]['form_maxfilesize']) ? $object->vars[$key]['form_maxfilesize'] : 0);
21
+		$this->setExtra(' size=50');
22
+	}
23 23
 
24
-    /**
25
-     * prepare HTML for output
26
-     *
27
-     * @return string HTML
28
-     */
29
-    public function render()
30
-    {
31
-        $ret = '';
32
-        if ($this->object->getVar($this->key) !== '') {
33
-            $ret .= '<div>' . _CO_SOBJECT_CURRENT_FILE . $this->object->getVar($this->key) . '</div>';
34
-        }
24
+	/**
25
+	 * prepare HTML for output
26
+	 *
27
+	 * @return string HTML
28
+	 */
29
+	public function render()
30
+	{
31
+		$ret = '';
32
+		if ($this->object->getVar($this->key) !== '') {
33
+			$ret .= '<div>' . _CO_SOBJECT_CURRENT_FILE . $this->object->getVar($this->key) . '</div>';
34
+		}
35 35
 
36
-        $ret .= "<div><input type='hidden' name='MAX_FILE_SIZE' value='" . $this->getMaxFileSize() . "'>
36
+		$ret .= "<div><input type='hidden' name='MAX_FILE_SIZE' value='" . $this->getMaxFileSize() . "'>
37 37
                 <input type='file' name='" . $this->getName() . "' id='" . $this->getName() . "'" . $this->getExtra() . ">
38 38
                 <input type='hidden' name='smart_upload_file[]' id='smart_upload_file[]' value='" . $this->getName() . "'></div>";
39 39
 
40
-        return $ret;
41
-    }
40
+		return $ret;
41
+	}
42 42
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@
 block discarded – undo
30 30
     {
31 31
         $ret = '';
32 32
         if ($this->object->getVar($this->key) !== '') {
33
-            $ret .= '<div>' . _CO_SOBJECT_CURRENT_FILE . $this->object->getVar($this->key) . '</div>';
33
+            $ret .= '<div>'._CO_SOBJECT_CURRENT_FILE.$this->object->getVar($this->key).'</div>';
34 34
         }
35 35
 
36
-        $ret .= "<div><input type='hidden' name='MAX_FILE_SIZE' value='" . $this->getMaxFileSize() . "'>
37
-                <input type='file' name='" . $this->getName() . "' id='" . $this->getName() . "'" . $this->getExtra() . ">
38
-                <input type='hidden' name='smart_upload_file[]' id='smart_upload_file[]' value='" . $this->getName() . "'></div>";
36
+        $ret .= "<div><input type='hidden' name='MAX_FILE_SIZE' value='".$this->getMaxFileSize()."'>
37
+                <input type='file' name='" . $this->getName()."' id='".$this->getName()."'".$this->getExtra().">
38
+                <input type='hidden' name='smart_upload_file[]' id='smart_upload_file[]' value='" . $this->getName()."'></div>";
39 39
 
40 40
         return $ret;
41 41
     }
Please login to merge, or discard this patch.
class/form/elements/smartformselectelement.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -11,59 +11,59 @@
 block discarded – undo
11 11
  */
12 12
 class SmartFormSelectElement extends XoopsFormSelect
13 13
 {
14
-    public $multiple = false;
14
+	public $multiple = false;
15 15
 
16
-    /**
17
-     * SmartFormSelectElement constructor.
18
-     * @param string $object
19
-     * @param string $key
20
-     */
21
-    public function __construct($object, $key)
22
-    {
23
-        $var  = $object->vars[$key];
24
-        $size = isset($var['size']) ? $var['size'] : ($this->multiple ? 5 : 1);
16
+	/**
17
+	 * SmartFormSelectElement constructor.
18
+	 * @param string $object
19
+	 * @param string $key
20
+	 */
21
+	public function __construct($object, $key)
22
+	{
23
+		$var  = $object->vars[$key];
24
+		$size = isset($var['size']) ? $var['size'] : ($this->multiple ? 5 : 1);
25 25
 
26
-        // Adding the options inside this SelectBox
27
-        // If the custom method is not from a module, than it's from the core
28
-        $control = $object->getControl($key);
26
+		// Adding the options inside this SelectBox
27
+		// If the custom method is not from a module, than it's from the core
28
+		$control = $object->getControl($key);
29 29
 
30
-        $value = isset($control['value']) ? $control['value'] : $object->getVar($key, 'e');
30
+		$value = isset($control['value']) ? $control['value'] : $object->getVar($key, 'e');
31 31
 
32
-        parent::__construct($var['form_caption'], $key, $value, $size, $this->multiple);
32
+		parent::__construct($var['form_caption'], $key, $value, $size, $this->multiple);
33 33
 
34
-        if (isset($control['options'])) {
35
-            $this->addOptionArray($control['options']);
36
-        } else {
37
-            // let's find if the method we need to call comes from an already defined object
38
-            if (isset($control['object'])) {
39
-                if (method_exists($control['object'], $control['method'])) {
40
-                    if ($option_array = $control['object']->{$control['method']}()) {
41
-                        // Adding the options array to the XoopsFormSelect
42
-                        $this->addOptionArray($option_array);
43
-                    }
44
-                }
45
-            } else {
46
-                // finding the itemHandler; if none, let's take the itemHandler of the $object
47
-                if (isset($control['itemHandler'])) {
48
-                    if (!$control['module']) {
49
-                        // Creating the specified core object handler
50
-                        $controlHandler = xoops_getHandler($control['itemHandler']);
51
-                    } else {
52
-                        $controlHandler = xoops_getModuleHandler($control['itemHandler'], $control['module']);
53
-                    }
54
-                } else {
55
-                    $controlHandler = $object->handler;
56
-                }
34
+		if (isset($control['options'])) {
35
+			$this->addOptionArray($control['options']);
36
+		} else {
37
+			// let's find if the method we need to call comes from an already defined object
38
+			if (isset($control['object'])) {
39
+				if (method_exists($control['object'], $control['method'])) {
40
+					if ($option_array = $control['object']->{$control['method']}()) {
41
+						// Adding the options array to the XoopsFormSelect
42
+						$this->addOptionArray($option_array);
43
+					}
44
+				}
45
+			} else {
46
+				// finding the itemHandler; if none, let's take the itemHandler of the $object
47
+				if (isset($control['itemHandler'])) {
48
+					if (!$control['module']) {
49
+						// Creating the specified core object handler
50
+						$controlHandler = xoops_getHandler($control['itemHandler']);
51
+					} else {
52
+						$controlHandler = xoops_getModuleHandler($control['itemHandler'], $control['module']);
53
+					}
54
+				} else {
55
+					$controlHandler = $object->handler;
56
+				}
57 57
 
58
-                // Checking if the specified method exists
59
-                if (method_exists($controlHandler, $control['method'])) {
60
-                    // TODO: How could I pass the parameters in the following call ...
61
-                    if ($option_array = $controlHandler->{$control['method']}()) {
62
-                        // Adding the options array to the XoopsFormSelect
63
-                        $this->addOptionArray($option_array);
64
-                    }
65
-                }
66
-            }
67
-        }
68
-    }
58
+				// Checking if the specified method exists
59
+				if (method_exists($controlHandler, $control['method'])) {
60
+					// TODO: How could I pass the parameters in the following call ...
61
+					if ($option_array = $controlHandler->{$control['method']}()) {
62
+						// Adding the options array to the XoopsFormSelect
63
+						$this->addOptionArray($option_array);
64
+					}
65
+				}
66
+			}
67
+		}
68
+	}
69 69
 }
Please login to merge, or discard this patch.
class/form/elements/smartformimageelement.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -11,39 +11,39 @@
 block discarded – undo
11 11
  */
12 12
 class SmartFormImageElement extends XoopsFormElementTray
13 13
 {
14
-    /**
15
-     * SmartFormImageElement constructor.
16
-     * @param string $object
17
-     * @param string $key
18
-     */
19
-    public function __construct($object, $key)
20
-    {
21
-        $var             = $object->vars[$key];
22
-        $object_imageurl = $object->getImageDir();
23
-        parent::__construct($var['form_caption'], ' ');
14
+	/**
15
+	 * SmartFormImageElement constructor.
16
+	 * @param string $object
17
+	 * @param string $key
18
+	 */
19
+	public function __construct($object, $key)
20
+	{
21
+		$var             = $object->vars[$key];
22
+		$object_imageurl = $object->getImageDir();
23
+		parent::__construct($var['form_caption'], ' ');
24 24
 
25
-        $objectArray['image'] = str_replace('{XOOPS_URL}', XOOPS_URL, $objectArray['image']);
25
+		$objectArray['image'] = str_replace('{XOOPS_URL}', XOOPS_URL, $objectArray['image']);
26 26
 
27
-        if ($object->getVar($key) !== ''
28
-            && (0 === strpos($object->getVar($key), 'http')
29
-                || 0 === strpos($object->getVar($key), '{XOOPS_URL}'))) {
30
-            $this->addElement(new XoopsFormLabel('', "<img src='" . str_replace('{XOOPS_URL}', XOOPS_URL, $object->getVar($key)) . "' alt=''><br><br>"));
31
-        } elseif ($object->getVar($key) !== '') {
32
-            $this->addElement(new XoopsFormLabel('', "<img src='" . $object_imageurl . $object->getVar($key) . "' alt=''><br><br>"));
33
-        }
27
+		if ($object->getVar($key) !== ''
28
+			&& (0 === strpos($object->getVar($key), 'http')
29
+				|| 0 === strpos($object->getVar($key), '{XOOPS_URL}'))) {
30
+			$this->addElement(new XoopsFormLabel('', "<img src='" . str_replace('{XOOPS_URL}', XOOPS_URL, $object->getVar($key)) . "' alt=''><br><br>"));
31
+		} elseif ($object->getVar($key) !== '') {
32
+			$this->addElement(new XoopsFormLabel('', "<img src='" . $object_imageurl . $object->getVar($key) . "' alt=''><br><br>"));
33
+		}
34 34
 
35
-        require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformfileuploadelement.php';
36
-        $this->addElement(new SmartFormFileUploadElement($object, $key));
35
+		require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformfileuploadelement.php';
36
+		$this->addElement(new SmartFormFileUploadElement($object, $key));
37 37
 
38
-        $this->addElement(new XoopsFormLabel('<div style="height: 10px; padding-top: 8px; font-size: 80%;">' . _CO_SOBJECT_URL_FILE_DSC . '</div>', ''));
39
-        require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformtextelement.php';
40
-        require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformcheckelement.php';
38
+		$this->addElement(new XoopsFormLabel('<div style="height: 10px; padding-top: 8px; font-size: 80%;">' . _CO_SOBJECT_URL_FILE_DSC . '</div>', ''));
39
+		require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformtextelement.php';
40
+		require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformcheckelement.php';
41 41
 
42
-        $this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE));
43
-        $this->addElement(new SmartFormTextElement($object, 'url_' . $key));
44
-        $this->addElement(new XoopsFormLabel('', '<br><br>'));
45
-        $delete_check = new SmartFormCheckElement('', 'delete_' . $key);
46
-        $delete_check->addOption(1, '<span style="color:red;">' . _CO_SOBJECT_DELETE . '</span>');
47
-        $this->addElement($delete_check);
48
-    }
42
+		$this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE));
43
+		$this->addElement(new SmartFormTextElement($object, 'url_' . $key));
44
+		$this->addElement(new XoopsFormLabel('', '<br><br>'));
45
+		$delete_check = new SmartFormCheckElement('', 'delete_' . $key);
46
+		$delete_check->addOption(1, '<span style="color:red;">' . _CO_SOBJECT_DELETE . '</span>');
47
+		$this->addElement($delete_check);
48
+	}
49 49
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -27,23 +27,23 @@
 block discarded – undo
27 27
         if ($object->getVar($key) !== ''
28 28
             && (0 === strpos($object->getVar($key), 'http')
29 29
                 || 0 === strpos($object->getVar($key), '{XOOPS_URL}'))) {
30
-            $this->addElement(new XoopsFormLabel('', "<img src='" . str_replace('{XOOPS_URL}', XOOPS_URL, $object->getVar($key)) . "' alt=''><br><br>"));
30
+            $this->addElement(new XoopsFormLabel('', "<img src='".str_replace('{XOOPS_URL}', XOOPS_URL, $object->getVar($key))."' alt=''><br><br>"));
31 31
         } elseif ($object->getVar($key) !== '') {
32
-            $this->addElement(new XoopsFormLabel('', "<img src='" . $object_imageurl . $object->getVar($key) . "' alt=''><br><br>"));
32
+            $this->addElement(new XoopsFormLabel('', "<img src='".$object_imageurl.$object->getVar($key)."' alt=''><br><br>"));
33 33
         }
34 34
 
35
-        require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformfileuploadelement.php';
35
+        require_once SMARTOBJECT_ROOT_PATH.'class/form/elements/smartformfileuploadelement.php';
36 36
         $this->addElement(new SmartFormFileUploadElement($object, $key));
37 37
 
38
-        $this->addElement(new XoopsFormLabel('<div style="height: 10px; padding-top: 8px; font-size: 80%;">' . _CO_SOBJECT_URL_FILE_DSC . '</div>', ''));
39
-        require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformtextelement.php';
40
-        require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformcheckelement.php';
38
+        $this->addElement(new XoopsFormLabel('<div style="height: 10px; padding-top: 8px; font-size: 80%;">'._CO_SOBJECT_URL_FILE_DSC.'</div>', ''));
39
+        require_once SMARTOBJECT_ROOT_PATH.'class/form/elements/smartformtextelement.php';
40
+        require_once SMARTOBJECT_ROOT_PATH.'class/form/elements/smartformcheckelement.php';
41 41
 
42
-        $this->addElement(new XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE));
43
-        $this->addElement(new SmartFormTextElement($object, 'url_' . $key));
42
+        $this->addElement(new XoopsFormLabel('', '<br>'._CO_SOBJECT_URL_FILE));
43
+        $this->addElement(new SmartFormTextElement($object, 'url_'.$key));
44 44
         $this->addElement(new XoopsFormLabel('', '<br><br>'));
45
-        $delete_check = new SmartFormCheckElement('', 'delete_' . $key);
46
-        $delete_check->addOption(1, '<span style="color:red;">' . _CO_SOBJECT_DELETE . '</span>');
45
+        $delete_check = new SmartFormCheckElement('', 'delete_'.$key);
46
+        $delete_check->addOption(1, '<span style="color:red;">'._CO_SOBJECT_DELETE.'</span>');
47 47
         $this->addElement($delete_check);
48 48
     }
49 49
 }
Please login to merge, or discard this patch.
class/form/elements/smartformcheckelement.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -7,41 +7,41 @@  discard block
 block discarded – undo
7 7
  */
8 8
 class SmartFormCheckElement extends XoopsFormCheckBox
9 9
 {
10
-    /**
11
-     *
12
-     * /**
13
-     * prepare HTML for output
14
-     *
15
-     * @return string
16
-     */
17
-    public function render()
18
-    {
19
-        $ret = '';
20
-        if (count($this->getOptions()) > 1 && substr($this->getName(), -2, 2) !== '[]') {
21
-            $newname = $this->getName() . '[]';
22
-            $this->setName($newname);
23
-        }
24
-        foreach ($this->getOptions() as $value => $name) {
25
-            $ret .= "<input type='checkbox' name='" . $this->getName() . "' value='" . $value . "'";
26
-            if (count($this->getValue()) > 0 && in_array($value, $this->getValue())) {
27
-                $ret .= ' checked';
28
-            }
29
-            $ret .= $this->getExtra() . '>' . $name . '<br>';
30
-        }
10
+	/**
11
+	 *
12
+	 * /**
13
+	 * prepare HTML for output
14
+	 *
15
+	 * @return string
16
+	 */
17
+	public function render()
18
+	{
19
+		$ret = '';
20
+		if (count($this->getOptions()) > 1 && substr($this->getName(), -2, 2) !== '[]') {
21
+			$newname = $this->getName() . '[]';
22
+			$this->setName($newname);
23
+		}
24
+		foreach ($this->getOptions() as $value => $name) {
25
+			$ret .= "<input type='checkbox' name='" . $this->getName() . "' value='" . $value . "'";
26
+			if (count($this->getValue()) > 0 && in_array($value, $this->getValue())) {
27
+				$ret .= ' checked';
28
+			}
29
+			$ret .= $this->getExtra() . '>' . $name . '<br>';
30
+		}
31 31
 
32
-        return $ret;
33
-    }
32
+		return $ret;
33
+	}
34 34
 
35
-    /**
36
-     * @return string
37
-     */
38
-    public function renderValidationJS()
39
-    {
40
-        $js .= 'var hasSelections = false;';
41
-        //sometimes, there is an implicit '[]', sometimes not
42
-        $eltname = $this->getName();
43
-        if (strpos($eltname, '[') === false) {
44
-            $js .= "for (var i = 0; i < myform['{$eltname}[]'].length; i++) {
35
+	/**
36
+	 * @return string
37
+	 */
38
+	public function renderValidationJS()
39
+	{
40
+		$js .= 'var hasSelections = false;';
41
+		//sometimes, there is an implicit '[]', sometimes not
42
+		$eltname = $this->getName();
43
+		if (strpos($eltname, '[') === false) {
44
+			$js .= "for (var i = 0; i < myform['{$eltname}[]'].length; i++) {
45 45
                 if (myform['{$eltname}[]'][i].checked) {
46 46
                     hasSelections = true;
47 47
                 }
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
             }
50 50
             if (hasSelections === false) {
51 51
                 window.alert(\"{$eltmsg}\"); myform['{$eltname}[]'][0].focus(); return false; }\n";
52
-        } else {
53
-            $js .= "for (var i = 0; i < myform['" . $eltname . "'].length; i++) {
52
+		} else {
53
+			$js .= "for (var i = 0; i < myform['" . $eltname . "'].length; i++) {
54 54
                 if (myform['{$eltname}'][i].checked) {
55 55
                     hasSelections = true;
56 56
                 }
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
             }
59 59
             if (hasSelections === false) {
60 60
                 window.alert(\"{$eltmsg}\"); myform['{$eltname}'][0].focus(); return false; }\n";
61
-        }
61
+		}
62 62
 
63
-        return $js;
64
-    }
63
+		return $js;
64
+	}
65 65
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,15 +18,15 @@  discard block
 block discarded – undo
18 18
     {
19 19
         $ret = '';
20 20
         if (count($this->getOptions()) > 1 && substr($this->getName(), -2, 2) !== '[]') {
21
-            $newname = $this->getName() . '[]';
21
+            $newname = $this->getName().'[]';
22 22
             $this->setName($newname);
23 23
         }
24 24
         foreach ($this->getOptions() as $value => $name) {
25
-            $ret .= "<input type='checkbox' name='" . $this->getName() . "' value='" . $value . "'";
25
+            $ret .= "<input type='checkbox' name='".$this->getName()."' value='".$value."'";
26 26
             if (count($this->getValue()) > 0 && in_array($value, $this->getValue())) {
27 27
                 $ret .= ' checked';
28 28
             }
29
-            $ret .= $this->getExtra() . '>' . $name . '<br>';
29
+            $ret .= $this->getExtra().'>'.$name.'<br>';
30 30
         }
31 31
 
32 32
         return $ret;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             if (hasSelections === false) {
51 51
                 window.alert(\"{$eltmsg}\"); myform['{$eltname}[]'][0].focus(); return false; }\n";
52 52
         } else {
53
-            $js .= "for (var i = 0; i < myform['" . $eltname . "'].length; i++) {
53
+            $js .= "for (var i = 0; i < myform['".$eltname."'].length; i++) {
54 54
                 if (myform['{$eltname}'][i].checked) {
55 55
                     hasSelections = true;
56 56
                 }
Please login to merge, or discard this patch.
class/form/elements/smartformparentcategoryelement.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -11,59 +11,59 @@
 block discarded – undo
11 11
  */
12 12
 class SmartFormParentCategoryElement extends XoopsFormSelect
13 13
 {
14
-    /**
15
-     * SmartFormParentcategoryElement constructor.
16
-     * @param string $object
17
-     * @param string $key
18
-     */
19
-    public function __construct($object, $key)
20
-    {
21
-        $addNoParent = isset($object->controls[$key]['addNoParent']) ? $object->controls[$key]['addNoParent'] : true;
22
-        $criteria    = new CriteriaCompo();
23
-        $criteria->setSort('weight, name');
24
-        $categoryHandler = xoops_getModuleHandler('category', $object->handler->_moduleName);
25
-        $categories      = $categoryHandler->getObjects($criteria);
14
+	/**
15
+	 * SmartFormParentcategoryElement constructor.
16
+	 * @param string $object
17
+	 * @param string $key
18
+	 */
19
+	public function __construct($object, $key)
20
+	{
21
+		$addNoParent = isset($object->controls[$key]['addNoParent']) ? $object->controls[$key]['addNoParent'] : true;
22
+		$criteria    = new CriteriaCompo();
23
+		$criteria->setSort('weight, name');
24
+		$categoryHandler = xoops_getModuleHandler('category', $object->handler->_moduleName);
25
+		$categories      = $categoryHandler->getObjects($criteria);
26 26
 
27
-        require_once XOOPS_ROOT_PATH . '/class/tree.php';
28
-        $mytree = new XoopsObjectTree($categories, 'categoryid', 'parentid');
29
-        parent::__construct($object->vars[$key]['form_caption'], $key, $object->getVar($key, 'e'));
27
+		require_once XOOPS_ROOT_PATH . '/class/tree.php';
28
+		$mytree = new XoopsObjectTree($categories, 'categoryid', 'parentid');
29
+		parent::__construct($object->vars[$key]['form_caption'], $key, $object->getVar($key, 'e'));
30 30
 
31
-        $ret     = array();
32
-        $options = $this->getOptionArray($mytree, 'name', 0, '', $ret);
33
-        if ($addNoParent) {
34
-            $newOptions = array('0' => '----');
35
-            foreach ($options as $k => $v) {
36
-                $newOptions[$k] = $v;
37
-            }
38
-            $options = $newOptions;
39
-        }
40
-        $this->addOptionArray($options);
41
-    }
31
+		$ret     = array();
32
+		$options = $this->getOptionArray($mytree, 'name', 0, '', $ret);
33
+		if ($addNoParent) {
34
+			$newOptions = array('0' => '----');
35
+			foreach ($options as $k => $v) {
36
+				$newOptions[$k] = $v;
37
+			}
38
+			$options = $newOptions;
39
+		}
40
+		$this->addOptionArray($options);
41
+	}
42 42
 
43
-    /**
44
-     * Get options for a category select with hierarchy (recursive)
45
-     *
46
-     * @param XoopsObjectTree $tree
47
-     * @param string          $fieldName
48
-     * @param int             $key
49
-     * @param string          $prefix_curr
50
-     * @param array           $ret
51
-     *
52
-     * @return array
53
-     */
54
-    public function getOptionArray($tree, $fieldName, $key, $prefix_curr = '', &$ret)
55
-    {
56
-        if ($key > 0) {
57
-            $value       = $tree->tree[$key]['obj']->getVar($tree->_myId);
58
-            $ret[$key]   = $prefix_curr . $tree->tree[$key]['obj']->getVar($fieldName);
59
-            $prefix_curr .= '-';
60
-        }
61
-        if (isset($tree->tree[$key]['child']) && !empty($tree->tree[$key]['child'])) {
62
-            foreach ($tree->tree[$key]['child'] as $childkey) {
63
-                $this->getOptionArray($tree, $fieldName, $childkey, $prefix_curr, $ret);
64
-            }
65
-        }
43
+	/**
44
+	 * Get options for a category select with hierarchy (recursive)
45
+	 *
46
+	 * @param XoopsObjectTree $tree
47
+	 * @param string          $fieldName
48
+	 * @param int             $key
49
+	 * @param string          $prefix_curr
50
+	 * @param array           $ret
51
+	 *
52
+	 * @return array
53
+	 */
54
+	public function getOptionArray($tree, $fieldName, $key, $prefix_curr = '', &$ret)
55
+	{
56
+		if ($key > 0) {
57
+			$value       = $tree->tree[$key]['obj']->getVar($tree->_myId);
58
+			$ret[$key]   = $prefix_curr . $tree->tree[$key]['obj']->getVar($fieldName);
59
+			$prefix_curr .= '-';
60
+		}
61
+		if (isset($tree->tree[$key]['child']) && !empty($tree->tree[$key]['child'])) {
62
+			foreach ($tree->tree[$key]['child'] as $childkey) {
63
+				$this->getOptionArray($tree, $fieldName, $childkey, $prefix_curr, $ret);
64
+			}
65
+		}
66 66
 
67
-        return $ret;
68
-    }
67
+		return $ret;
68
+	}
69 69
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         $categoryHandler = xoops_getModuleHandler('category', $object->handler->_moduleName);
25 25
         $categories      = $categoryHandler->getObjects($criteria);
26 26
 
27
-        require_once XOOPS_ROOT_PATH . '/class/tree.php';
27
+        require_once XOOPS_ROOT_PATH.'/class/tree.php';
28 28
         $mytree = new XoopsObjectTree($categories, 'categoryid', 'parentid');
29 29
         parent::__construct($object->vars[$key]['form_caption'], $key, $object->getVar($key, 'e'));
30 30
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     {
56 56
         if ($key > 0) {
57 57
             $value       = $tree->tree[$key]['obj']->getVar($tree->_myId);
58
-            $ret[$key]   = $prefix_curr . $tree->tree[$key]['obj']->getVar($fieldName);
58
+            $ret[$key]   = $prefix_curr.$tree->tree[$key]['obj']->getVar($fieldName);
59 59
             $prefix_curr .= '-';
60 60
         }
61 61
         if (isset($tree->tree[$key]['child']) && !empty($tree->tree[$key]['child'])) {
Please login to merge, or discard this patch.
class/form/elements/smartformhidden.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -24,20 +24,20 @@
 block discarded – undo
24 24
  */
25 25
 class SmartFormHidden extends XoopsFormHidden
26 26
 {
27
-    /**
28
-     * @return string
29
-     */
30
-    public function render()
31
-    {
32
-        if (is_array($this->getValue())) {
33
-            $ret = '';
34
-            foreach ($this->getValue() as $value) {
35
-                $ret .= "<input type='hidden' name='" . $this->getName() . "[]' id='" . $this->getName() . "' value='" . $value . "'>\n";
36
-            }
37
-        } else {
38
-            $ret = "<input type='hidden' name='" . $this->getName() . "' id='" . $this->getName() . "' value='" . $this->getValue() . "'>";
39
-        }
27
+	/**
28
+	 * @return string
29
+	 */
30
+	public function render()
31
+	{
32
+		if (is_array($this->getValue())) {
33
+			$ret = '';
34
+			foreach ($this->getValue() as $value) {
35
+				$ret .= "<input type='hidden' name='" . $this->getName() . "[]' id='" . $this->getName() . "' value='" . $value . "'>\n";
36
+			}
37
+		} else {
38
+			$ret = "<input type='hidden' name='" . $this->getName() . "' id='" . $this->getName() . "' value='" . $this->getValue() . "'>";
39
+		}
40 40
 
41
-        return $ret;
42
-    }
41
+		return $ret;
42
+	}
43 43
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@
 block discarded – undo
32 32
         if (is_array($this->getValue())) {
33 33
             $ret = '';
34 34
             foreach ($this->getValue() as $value) {
35
-                $ret .= "<input type='hidden' name='" . $this->getName() . "[]' id='" . $this->getName() . "' value='" . $value . "'>\n";
35
+                $ret .= "<input type='hidden' name='".$this->getName()."[]' id='".$this->getName()."' value='".$value."'>\n";
36 36
             }
37 37
         } else {
38
-            $ret = "<input type='hidden' name='" . $this->getName() . "' id='" . $this->getName() . "' value='" . $this->getValue() . "'>";
38
+            $ret = "<input type='hidden' name='".$this->getName()."' id='".$this->getName()."' value='".$this->getValue()."'>";
39 39
         }
40 40
 
41 41
         return $ret;
Please login to merge, or discard this patch.