Completed
Push — master ( 2d4977...3189d6 )
by Michael
10:50
created
class/smarthighlighter.php 1 patch
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * This file contains the keyhighlighter class that highlight the chosen keyword in the current output buffer.
4
- *
5
- * @package keyhighlighter
6
- */
3
+	 * This file contains the keyhighlighter class that highlight the chosen keyword in the current output buffer.
4
+	 *
5
+	 * @package keyhighlighter
6
+	 */
7 7
 
8 8
 /**
9 9
  * keyhighlighter class
@@ -19,96 +19,96 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class SmartHighlighter
21 21
 {
22
-    /**
23
-     * @access private
24
-     */
25
-    public $preg_keywords = '';
26
-    /**
27
-     * @access private
28
-     */
29
-    public $keywords = '';
30
-    /**
31
-     * @access private
32
-     */
33
-    public $singlewords = false;
34
-    /**
35
-     * @access private
36
-     */
37
-    public $replace_callback = null;
22
+	/**
23
+	 * @access private
24
+	 */
25
+	public $preg_keywords = '';
26
+	/**
27
+	 * @access private
28
+	 */
29
+	public $keywords = '';
30
+	/**
31
+	 * @access private
32
+	 */
33
+	public $singlewords = false;
34
+	/**
35
+	 * @access private
36
+	 */
37
+	public $replace_callback = null;
38 38
 
39
-    public $content;
39
+	public $content;
40 40
 
41
-    /**
42
-     * Main constructor
43
-     *
44
-     * This is the main constructor of keyhighlighter class. <br />
45
-     * It's the only public method of the class.
46
-     * @param string   $keywords         the keywords you want to highlight
47
-     * @param boolean  $singlewords      specify if it has to highlight also the single words.
48
-     * @param callback $replace_callback a custom callback for keyword highlight.
49
-     *                                   <code>
50
-     *                                   <?php
51
-     *                                   require ('keyhighlighter.class.php');
52
-     *
53
-     * function my_highlighter ($matches) {
54
-     *  return '<span style="font-weight: bolder; color: #FF0000;">' . $matches[0] . '</span>';
55
-     * }
56
-     *
57
-     * new keyhighlighter ('W3C', false, 'my_highlighter');
58
-     * readfile ('http://www.w3c.org/');
59
-     * ?>
60
-     * </code>
61
-     */
62
-    // public function __construct ()
63
-    public function __construct($keywords, $singlewords = false, $replace_callback = null)
64
-    {
65
-        $this->keywords         = $keywords;
66
-        $this->singlewords      = $singlewords;
67
-        $this->replace_callback = $replace_callback;
68
-    }
41
+	/**
42
+	 * Main constructor
43
+	 *
44
+	 * This is the main constructor of keyhighlighter class. <br />
45
+	 * It's the only public method of the class.
46
+	 * @param string   $keywords         the keywords you want to highlight
47
+	 * @param boolean  $singlewords      specify if it has to highlight also the single words.
48
+	 * @param callback $replace_callback a custom callback for keyword highlight.
49
+	 *                                   <code>
50
+	 *                                   <?php
51
+	 *                                   require ('keyhighlighter.class.php');
52
+	 *
53
+	 * function my_highlighter ($matches) {
54
+	 *  return '<span style="font-weight: bolder; color: #FF0000;">' . $matches[0] . '</span>';
55
+	 * }
56
+	 *
57
+	 * new keyhighlighter ('W3C', false, 'my_highlighter');
58
+	 * readfile ('http://www.w3c.org/');
59
+	 * ?>
60
+	 * </code>
61
+	 */
62
+	// public function __construct ()
63
+	public function __construct($keywords, $singlewords = false, $replace_callback = null)
64
+	{
65
+		$this->keywords         = $keywords;
66
+		$this->singlewords      = $singlewords;
67
+		$this->replace_callback = $replace_callback;
68
+	}
69 69
 
70
-    /**
71
-     * @access private
72
-     * @param $replace_matches
73
-     * @return mixed
74
-     */
75
-    public function replace($replace_matches)
76
-    {
77
-        $patterns = array();
78
-        if ($this->singlewords) {
79
-            $keywords = explode(' ', $this->preg_keywords);
80
-            foreach ($keywords as $keyword) {
81
-                $patterns[] = '/(?' . '>' . $keyword . '+)/si';
82
-            }
83
-        } else {
84
-            $patterns[] = '/(?' . '>' . $this->preg_keywords . '+)/si';
85
-        }
70
+	/**
71
+	 * @access private
72
+	 * @param $replace_matches
73
+	 * @return mixed
74
+	 */
75
+	public function replace($replace_matches)
76
+	{
77
+		$patterns = array();
78
+		if ($this->singlewords) {
79
+			$keywords = explode(' ', $this->preg_keywords);
80
+			foreach ($keywords as $keyword) {
81
+				$patterns[] = '/(?' . '>' . $keyword . '+)/si';
82
+			}
83
+		} else {
84
+			$patterns[] = '/(?' . '>' . $this->preg_keywords . '+)/si';
85
+		}
86 86
 
87
-        $result = $replace_matches[0];
87
+		$result = $replace_matches[0];
88 88
 
89
-        foreach ($patterns as $pattern) {
90
-            if (null !== ($this->replace_callback)) {
91
-                $result = preg_replace_callback($pattern, $this->replace_callback, $result);
92
-            } else {
93
-                $result = preg_replace($pattern, '<span class="highlightedkey">\\0</span>', $result);
94
-            }
95
-        }
89
+		foreach ($patterns as $pattern) {
90
+			if (null !== ($this->replace_callback)) {
91
+				$result = preg_replace_callback($pattern, $this->replace_callback, $result);
92
+			} else {
93
+				$result = preg_replace($pattern, '<span class="highlightedkey">\\0</span>', $result);
94
+			}
95
+		}
96 96
 
97
-        return $result;
98
-    }
97
+		return $result;
98
+	}
99 99
 
100
-    /**
101
-     * @access private
102
-     * @param $buffer
103
-     * @return mixed|string
104
-     */
105
-    public function highlight($buffer)
106
-    {
107
-        $buffer              = '>' . $buffer . '<';
108
-        $this->preg_keywords = preg_replace('/[^\w ]/si', '', $this->keywords);
109
-        $buffer              = preg_replace_callback("/(\>(((?" . ">[^><]+)|(?R))*)\<)/is", array(&$this, 'replace'), $buffer);
110
-        $buffer              = substr($buffer, 1, -1);
100
+	/**
101
+	 * @access private
102
+	 * @param $buffer
103
+	 * @return mixed|string
104
+	 */
105
+	public function highlight($buffer)
106
+	{
107
+		$buffer              = '>' . $buffer . '<';
108
+		$this->preg_keywords = preg_replace('/[^\w ]/si', '', $this->keywords);
109
+		$buffer              = preg_replace_callback("/(\>(((?" . ">[^><]+)|(?R))*)\<)/is", array(&$this, 'replace'), $buffer);
110
+		$buffer              = substr($buffer, 1, -1);
111 111
 
112
-        return $buffer;
113
-    }
112
+		return $buffer;
113
+	}
114 114
 }
Please login to merge, or discard this patch.
class/smartobjecttag.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
  */
36 36
 class SmartobjectTag extends SmartMlObject
37 37
 {
38
-    /**
39
-     * SmartobjectTag constructor.
40
-     */
41
-    public function __construct()
42
-    {
43
-        $this->initVar('tagid', XOBJ_DTYPE_INT, '', true);
44
-        $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', true, 255, '', false, _CO_SOBJECT_TAG_TAGID_CAPTION, _CO_SOBJECT_TAG_TAGID_DSC, true);
45
-        $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', true, null, '', false, _CO_SOBJECT_TAG_DESCRIPTION_CAPTION, _CO_SOBJECT_TAG_DESCRIPTION_DSC);
46
-        $this->initVar('value', XOBJ_DTYPE_TXTAREA, '', true, null, '', true, _CO_SOBJECT_TAG_VALUE_CAPTION, _CO_SOBJECT_TAG_VALUE_DSC);
38
+	/**
39
+	 * SmartobjectTag constructor.
40
+	 */
41
+	public function __construct()
42
+	{
43
+		$this->initVar('tagid', XOBJ_DTYPE_INT, '', true);
44
+		$this->initVar('name', XOBJ_DTYPE_TXTBOX, '', true, 255, '', false, _CO_SOBJECT_TAG_TAGID_CAPTION, _CO_SOBJECT_TAG_TAGID_DSC, true);
45
+		$this->initVar('description', XOBJ_DTYPE_TXTAREA, '', true, null, '', false, _CO_SOBJECT_TAG_DESCRIPTION_CAPTION, _CO_SOBJECT_TAG_DESCRIPTION_DSC);
46
+		$this->initVar('value', XOBJ_DTYPE_TXTAREA, '', true, null, '', true, _CO_SOBJECT_TAG_VALUE_CAPTION, _CO_SOBJECT_TAG_VALUE_DSC);
47 47
 
48
-        // call parent constructor to get Multilanguage field initiated
49
-        $this->SmartMlObject();
50
-    }
48
+		// call parent constructor to get Multilanguage field initiated
49
+		$this->SmartMlObject();
50
+	}
51 51
 }
52 52
 
53 53
 /**
@@ -55,27 +55,27 @@  discard block
 block discarded – undo
55 55
  */
56 56
 class SmartobjectTagHandler extends SmartPersistableMlObjectHandler
57 57
 {
58
-    /**
59
-     * SmartobjectTagHandler constructor.
60
-     * @param object|XoopsDatabase $db
61
-     */
62
-    public function __construct($db)
63
-    {
64
-        parent::__construct($db, 'tag', 'tagid', 'name', 'description', 'smartobject');
65
-    }
58
+	/**
59
+	 * SmartobjectTagHandler constructor.
60
+	 * @param object|XoopsDatabase $db
61
+	 */
62
+	public function __construct($db)
63
+	{
64
+		parent::__construct($db, 'tag', 'tagid', 'name', 'description', 'smartobject');
65
+	}
66 66
 
67
-    /**
68
-     * @return mixed
69
-     */
70
-    public function getLanguages()
71
-    {
72
-        include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
73
-        $aLanguages     = XoopsLists::getLangList();
74
-        $ret['default'] = _CO_SOBJECT_ALL;
75
-        foreach ($aLanguages as $lang) {
76
-            $ret[$lang] = $lang;
77
-        }
67
+	/**
68
+	 * @return mixed
69
+	 */
70
+	public function getLanguages()
71
+	{
72
+		include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
73
+		$aLanguages     = XoopsLists::getLangList();
74
+		$ret['default'] = _CO_SOBJECT_ALL;
75
+		foreach ($aLanguages as $lang) {
76
+			$ret[$lang] = $lang;
77
+		}
78 78
 
79
-        return $ret;
80
-    }
79
+		return $ret;
80
+	}
81 81
 }
Please login to merge, or discard this patch.
class/adsense.php 1 patch
Indentation   +253 added lines, -253 removed lines patch added patch discarded remove patch
@@ -36,87 +36,87 @@  discard block
 block discarded – undo
36 36
  */
37 37
 class SmartobjectAdsense extends SmartObject
38 38
 {
39
-    /**
40
-     * SmartobjectAdsense constructor.
41
-     */
42
-    public function __construct()
43
-    {
44
-        $this->quickInitVar('adsenseid', XOBJ_DTYPE_INT, true);
45
-        $this->quickInitVar('description', XOBJ_DTYPE_TXTAREA, true, _CO_SOBJECT_ADSENSE_DESCRIPTION, _CO_SOBJECT_ADSENSE_DESCRIPTION_DSC);
46
-        $this->quickInitVar('client_id', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_CLIENT_ID, _CO_SOBJECT_ADSENSE_CLIENT_ID_DSC);
47
-        $this->quickInitVar('tag', XOBJ_DTYPE_TXTBOX, false, _CO_SOBJECT_ADSENSE_TAG, _CO_SOBJECT_ADSENSE_TAG_DSC);
48
-        $this->quickInitVar('format', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_FORMAT, _CO_SOBJECT_ADSENSE_FORMAT_DSC);
49
-        $this->quickInitVar('border_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_BORDER_COLOR, _CO_SOBJECT_ADSENSE_BORDER_COLOR_DSC);
50
-        $this->quickInitVar('background_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_BACKGROUND_COLOR, _CO_SOBJECT_ADSENSE_BORDER_COLOR_DSC);
51
-        $this->quickInitVar('link_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_LINK_COLOR, _CO_SOBJECT_ADSENSE_LINK_COLOR_DSC);
52
-        $this->quickInitVar('url_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_URL_COLOR, _CO_SOBJECT_ADSENSE_URL_COLOR_DSC);
53
-        $this->quickInitVar('text_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_TEXT_COLOR, _CO_SOBJECT_ADSENSE_TEXT_COLOR_DSC);
54
-        $this->quickInitVar('style', XOBJ_DTYPE_TXTAREA, false, _CO_SOBJECT_ADSENSE_STYLE, _CO_SOBJECT_ADSENSE_STYLE_DSC);
55
-
56
-        $this->setControl('format', array(
57
-            'handler' => 'adsense',
58
-            'method'  => 'getFormats'
59
-        ));
60
-
61
-        $this->setControl('border_color', array(
62
-            'name'      => 'text',
63
-            'size'      => 6,
64
-            'maxlength' => 6
65
-        ));
66
-
67
-        $this->setControl('background_color', array(
68
-            'name'      => 'text',
69
-            'size'      => 6,
70
-            'maxlength' => 6
71
-        ));
72
-
73
-        $this->setControl('link_color', array(
74
-            'name'      => 'text',
75
-            'size'      => 6,
76
-            'maxlength' => 6
77
-        ));
78
-
79
-        $this->setControl('url_color', array(
80
-            'name'      => 'text',
81
-            'size'      => 6,
82
-            'maxlength' => 6
83
-        ));
84
-
85
-        $this->setControl('text_color', array(
86
-            'name'      => 'text',
87
-            'size'      => 6,
88
-            'maxlength' => 6
89
-        ));
90
-    }
91
-
92
-    /**
93
-     * @param  string $key
94
-     * @param  string $format
95
-     * @return mixed
96
-     */
97
-    public function getVar($key, $format = 's')
98
-    {
99
-        if ($format === 's' && in_array($key, array())) {
100
-            //            return call_user_func(array($this, $key));
101
-            return $this->{$key}();
102
-        }
103
-
104
-        return parent::getVar($key, $format);
105
-    }
106
-
107
-    /**
108
-     * @return string
109
-     */
110
-    public function render()
111
-    {
112
-        global $smartobjectAdsenseHandler;
113
-        if ($this->getVar('style', 'n') != '') {
114
-            $ret = '<div style="' . $this->getVar('style', 'n') . '">';
115
-        } else {
116
-            $ret = '<div>';
117
-        }
118
-
119
-        $ret .= '<script type="text/javascript"><!--
39
+	/**
40
+	 * SmartobjectAdsense constructor.
41
+	 */
42
+	public function __construct()
43
+	{
44
+		$this->quickInitVar('adsenseid', XOBJ_DTYPE_INT, true);
45
+		$this->quickInitVar('description', XOBJ_DTYPE_TXTAREA, true, _CO_SOBJECT_ADSENSE_DESCRIPTION, _CO_SOBJECT_ADSENSE_DESCRIPTION_DSC);
46
+		$this->quickInitVar('client_id', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_CLIENT_ID, _CO_SOBJECT_ADSENSE_CLIENT_ID_DSC);
47
+		$this->quickInitVar('tag', XOBJ_DTYPE_TXTBOX, false, _CO_SOBJECT_ADSENSE_TAG, _CO_SOBJECT_ADSENSE_TAG_DSC);
48
+		$this->quickInitVar('format', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_FORMAT, _CO_SOBJECT_ADSENSE_FORMAT_DSC);
49
+		$this->quickInitVar('border_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_BORDER_COLOR, _CO_SOBJECT_ADSENSE_BORDER_COLOR_DSC);
50
+		$this->quickInitVar('background_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_BACKGROUND_COLOR, _CO_SOBJECT_ADSENSE_BORDER_COLOR_DSC);
51
+		$this->quickInitVar('link_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_LINK_COLOR, _CO_SOBJECT_ADSENSE_LINK_COLOR_DSC);
52
+		$this->quickInitVar('url_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_URL_COLOR, _CO_SOBJECT_ADSENSE_URL_COLOR_DSC);
53
+		$this->quickInitVar('text_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_TEXT_COLOR, _CO_SOBJECT_ADSENSE_TEXT_COLOR_DSC);
54
+		$this->quickInitVar('style', XOBJ_DTYPE_TXTAREA, false, _CO_SOBJECT_ADSENSE_STYLE, _CO_SOBJECT_ADSENSE_STYLE_DSC);
55
+
56
+		$this->setControl('format', array(
57
+			'handler' => 'adsense',
58
+			'method'  => 'getFormats'
59
+		));
60
+
61
+		$this->setControl('border_color', array(
62
+			'name'      => 'text',
63
+			'size'      => 6,
64
+			'maxlength' => 6
65
+		));
66
+
67
+		$this->setControl('background_color', array(
68
+			'name'      => 'text',
69
+			'size'      => 6,
70
+			'maxlength' => 6
71
+		));
72
+
73
+		$this->setControl('link_color', array(
74
+			'name'      => 'text',
75
+			'size'      => 6,
76
+			'maxlength' => 6
77
+		));
78
+
79
+		$this->setControl('url_color', array(
80
+			'name'      => 'text',
81
+			'size'      => 6,
82
+			'maxlength' => 6
83
+		));
84
+
85
+		$this->setControl('text_color', array(
86
+			'name'      => 'text',
87
+			'size'      => 6,
88
+			'maxlength' => 6
89
+		));
90
+	}
91
+
92
+	/**
93
+	 * @param  string $key
94
+	 * @param  string $format
95
+	 * @return mixed
96
+	 */
97
+	public function getVar($key, $format = 's')
98
+	{
99
+		if ($format === 's' && in_array($key, array())) {
100
+			//            return call_user_func(array($this, $key));
101
+			return $this->{$key}();
102
+		}
103
+
104
+		return parent::getVar($key, $format);
105
+	}
106
+
107
+	/**
108
+	 * @return string
109
+	 */
110
+	public function render()
111
+	{
112
+		global $smartobjectAdsenseHandler;
113
+		if ($this->getVar('style', 'n') != '') {
114
+			$ret = '<div style="' . $this->getVar('style', 'n') . '">';
115
+		} else {
116
+			$ret = '<div>';
117
+		}
118
+
119
+		$ret .= '<script type="text/javascript"><!--
120 120
 google_ad_client = "' . $this->getVar('client_id', 'n') . '";
121 121
 google_ad_width = ' . $smartobjectAdsenseHandler->adFormats[$this->getVar('format', 'n')]['width'] . ';
122 122
 google_ad_height = ' . $smartobjectAdsenseHandler->adFormats[$this->getVar('format', 'n')]['height'] . ';
@@ -134,66 +134,66 @@  discard block
 block discarded – undo
134 134
 </script>
135 135
 </div>';
136 136
 
137
-        return $ret;
138
-    }
139
-
140
-    /**
141
-     * @return string
142
-     */
143
-    public function getXoopsCode()
144
-    {
145
-        $ret = '[adsense]' . $this->getVar('tag', 'n') . '[/adsense]';
146
-
147
-        return $ret;
148
-    }
149
-
150
-    /**
151
-     * @param $var
152
-     * @return bool
153
-     */
154
-    public function emptyString($var)
155
-    {
156
-        return (strlen($var) > 0);
157
-    }
158
-
159
-    /**
160
-     * @return mixed|string
161
-     */
162
-    public function generateTag()
163
-    {
164
-        $title = rawurlencode(strtolower($this->getVar('description', 'e')));
165
-        $title = xoops_substr($title, 0, 10, '');
166
-        // Transformation des ponctuations
167
-        //                 Tab     Space      !        "        #        %        &        '        (        )        ,        /       :        ;        <        =        >        ?        @        [        \        ]        ^        {        |        }        ~       .
168
-        $pattern = array('/%09/', '/%20/', '/%21/', '/%22/', '/%23/', '/%25/', '/%26/', '/%27/', '/%28/', '/%29/', '/%2C/', '/%2F/', '/%3A/', '/%3B/', '/%3C/', '/%3D/', '/%3E/', '/%3F/', '/%40/', '/%5B/', '/%5C/', '/%5D/', '/%5E/', '/%7B/', '/%7C/', '/%7D/', '/%7E/', "/\./");
169
-        $rep_pat = array('-', '-', '-', '-', '-', '-100', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-at-', '-', '-', '-', '-', '-', '-', '-', '-', '-');
170
-        $title   = preg_replace($pattern, $rep_pat, $title);
171
-
172
-        // Transformation des caract�res accentu�s
173
-        //                  °        è        é        ê        ë        ç        à        â        ä        î        ï        ù        ü        û        ô        ö
174
-        $pattern = array('/%B0/', '/%E8/', '/%E9/', '/%EA/', '/%EB/', '/%E7/', '/%E0/', '/%E2/', '/%E4/', '/%EE/', '/%EF/', '/%F9/', '/%FC/', '/%FB/', '/%F4/', '/%F6/');
175
-        $rep_pat = array('-', 'e', 'e', 'e', 'e', 'c', 'a', 'a', 'a', 'i', 'i', 'u', 'u', 'u', 'o', 'o');
176
-        $title   = preg_replace($pattern, $rep_pat, $title);
177
-
178
-        $tableau = explode('-', $title); // Transforme la chaine de caract�res en tableau
179
-        $tableau = array_filter($tableau, array($this, 'emptyString')); // Supprime les chaines vides du tableau
180
-        $title   = implode('-', $tableau); // Transforme un tableau en chaine de caract�res s�par� par un tiret
181
-
182
-        $title = $title . time();
183
-        $title = md5($title);
184
-
185
-        return $title;
186
-    }
187
-
188
-    /**
189
-     * @return string
190
-     */
191
-    public function getCloneLink()
192
-    {
193
-        $ret = '<a href="' . SMARTOBJECT_URL . 'admin/adsense.php?op=clone&adsenseid=' . $this->getVar('adsenseid') . '"><img src="' . SMARTOBJECT_IMAGES_ACTIONS_URL . 'editcopy.png" alt="' . _CO_SOBJECT_ADSENSE_CLONE . '" title="' . _CO_SOBJECT_ADSENSE_CLONE . '" /></a>';
194
-
195
-        return $ret;
196
-    }
137
+		return $ret;
138
+	}
139
+
140
+	/**
141
+	 * @return string
142
+	 */
143
+	public function getXoopsCode()
144
+	{
145
+		$ret = '[adsense]' . $this->getVar('tag', 'n') . '[/adsense]';
146
+
147
+		return $ret;
148
+	}
149
+
150
+	/**
151
+	 * @param $var
152
+	 * @return bool
153
+	 */
154
+	public function emptyString($var)
155
+	{
156
+		return (strlen($var) > 0);
157
+	}
158
+
159
+	/**
160
+	 * @return mixed|string
161
+	 */
162
+	public function generateTag()
163
+	{
164
+		$title = rawurlencode(strtolower($this->getVar('description', 'e')));
165
+		$title = xoops_substr($title, 0, 10, '');
166
+		// Transformation des ponctuations
167
+		//                 Tab     Space      !        "        #        %        &        '        (        )        ,        /       :        ;        <        =        >        ?        @        [        \        ]        ^        {        |        }        ~       .
168
+		$pattern = array('/%09/', '/%20/', '/%21/', '/%22/', '/%23/', '/%25/', '/%26/', '/%27/', '/%28/', '/%29/', '/%2C/', '/%2F/', '/%3A/', '/%3B/', '/%3C/', '/%3D/', '/%3E/', '/%3F/', '/%40/', '/%5B/', '/%5C/', '/%5D/', '/%5E/', '/%7B/', '/%7C/', '/%7D/', '/%7E/', "/\./");
169
+		$rep_pat = array('-', '-', '-', '-', '-', '-100', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-at-', '-', '-', '-', '-', '-', '-', '-', '-', '-');
170
+		$title   = preg_replace($pattern, $rep_pat, $title);
171
+
172
+		// Transformation des caract�res accentu�s
173
+		//                  °        è        é        ê        ë        ç        à        â        ä        î        ï        ù        ü        û        ô        ö
174
+		$pattern = array('/%B0/', '/%E8/', '/%E9/', '/%EA/', '/%EB/', '/%E7/', '/%E0/', '/%E2/', '/%E4/', '/%EE/', '/%EF/', '/%F9/', '/%FC/', '/%FB/', '/%F4/', '/%F6/');
175
+		$rep_pat = array('-', 'e', 'e', 'e', 'e', 'c', 'a', 'a', 'a', 'i', 'i', 'u', 'u', 'u', 'o', 'o');
176
+		$title   = preg_replace($pattern, $rep_pat, $title);
177
+
178
+		$tableau = explode('-', $title); // Transforme la chaine de caract�res en tableau
179
+		$tableau = array_filter($tableau, array($this, 'emptyString')); // Supprime les chaines vides du tableau
180
+		$title   = implode('-', $tableau); // Transforme un tableau en chaine de caract�res s�par� par un tiret
181
+
182
+		$title = $title . time();
183
+		$title = md5($title);
184
+
185
+		return $title;
186
+	}
187
+
188
+	/**
189
+	 * @return string
190
+	 */
191
+	public function getCloneLink()
192
+	{
193
+		$ret = '<a href="' . SMARTOBJECT_URL . 'admin/adsense.php?op=clone&adsenseid=' . $this->getVar('adsenseid') . '"><img src="' . SMARTOBJECT_IMAGES_ACTIONS_URL . 'editcopy.png" alt="' . _CO_SOBJECT_ADSENSE_CLONE . '" title="' . _CO_SOBJECT_ADSENSE_CLONE . '" /></a>';
194
+
195
+		return $ret;
196
+	}
197 197
 }
198 198
 
199 199
 /**
@@ -201,116 +201,116 @@  discard block
 block discarded – undo
201 201
  */
202 202
 class SmartobjectAdsenseHandler extends SmartPersistableObjectHandler
203 203
 {
204
-    public $adFormats;
205
-    public $adFormatsList;
206
-    public $objects = false;
207
-
208
-    /**
209
-     * SmartobjectAdsenseHandler constructor.
210
-     * @param object|XoopsDatabase $db
211
-     */
212
-    public function __construct($db)
213
-    {
214
-        parent::__construct($db, 'adsense', 'adsenseid', 'description', '', 'smartobject');
215
-        $this->adFormats     = array();
216
-        $this->adFormatsList = array();
217
-
218
-        $this->adFormats['728x90_as']['caption'] = '728 X 90 Leaderboard';
219
-        $this->adFormats['728x90_as']['width']   = 728;
220
-        $this->adFormats['728x90_as']['height']  = 90;
221
-        $this->adFormatsList['728x90_as']        = $this->adFormats['728x90_as']['caption'];
222
-
223
-        $this->adFormats['468x60_as']['caption'] = '468 X 60 Banner';
224
-        $this->adFormats['468x60_as']['width']   = 468;
225
-        $this->adFormats['468x60_as']['height']  = 60;
226
-        $this->adFormatsList['468x60_as']        = $this->adFormats['468x60_as']['caption'];
227
-
228
-        $this->adFormats['234x60_as']['caption'] = '234 X 60 Half Banner';
229
-        $this->adFormats['234x60_as']['width']   = 234;
230
-        $this->adFormats['234x60_as']['height']  = 60;
231
-        $this->adFormatsList['234x60_as']        = $this->adFormats['234x60_as']['caption'];
232
-
233
-        $this->adFormats['120x600_as']['caption'] = '120 X 600 Skyscraper';
234
-        $this->adFormats['120x600_as']['width']   = 120;
235
-        $this->adFormats['120x600_as']['height']  = 600;
236
-        $this->adFormatsList['120x600_as']        = $this->adFormats['120x600_as']['caption'];
237
-
238
-        $this->adFormats['160x600_as']['caption'] = '160 X 600 Wide Skyscraper';
239
-        $this->adFormats['160x600_as']['width']   = 160;
240
-        $this->adFormats['160x600_as']['height']  = 600;
241
-        $this->adFormatsList['160x600_as']        = $this->adFormats['160x600_as']['caption'];
242
-
243
-        $this->adFormats['120x240_as']['caption'] = '120 X 240 Vertical Banner';
244
-        $this->adFormats['120x240_as']['width']   = 120;
245
-        $this->adFormats['120x240_as']['height']  = 240;
246
-        $this->adFormatsList['120x240_as']        = $this->adFormats['120x240_as']['caption'];
247
-
248
-        $this->adFormats['336x280_as']['caption'] = '336 X 280 Large Rectangle';
249
-        $this->adFormats['336x280_as']['width']   = 136;
250
-        $this->adFormats['336x280_as']['height']  = 280;
251
-        $this->adFormatsList['336x280_as']        = $this->adFormats['336x280_as']['caption'];
252
-
253
-        $this->adFormats['300x250_as']['caption'] = '300 X 250 Medium Rectangle';
254
-        $this->adFormats['300x250_as']['width']   = 300;
255
-        $this->adFormats['300x250_as']['height']  = 250;
256
-        $this->adFormatsList['300x250_as']        = $this->adFormats['300x250_as']['caption'];
257
-
258
-        $this->adFormats['250x250_as']['caption'] = '250 X 250 Square';
259
-        $this->adFormats['250x250_as']['width']   = 250;
260
-        $this->adFormats['250x250_as']['height']  = 250;
261
-        $this->adFormatsList['250x250_as']        = $this->adFormats['250x250_as']['caption'];
262
-
263
-        $this->adFormats['200x200_as']['caption'] = '200 X 200 Small Square';
264
-        $this->adFormats['200x200_as']['width']   = 200;
265
-        $this->adFormats['200x200_as']['height']  = 200;
266
-        $this->adFormatsList['200x200_as']        = $this->adFormats['200x200_as']['caption'];
267
-
268
-        $this->adFormats['180x150_as']['caption'] = '180 X 150 Small Rectangle';
269
-        $this->adFormats['180x150_as']['width']   = 180;
270
-        $this->adFormats['180x150_as']['height']  = 150;
271
-        $this->adFormatsList['180x150_as']        = $this->adFormats['180x150_as']['caption'];
272
-
273
-        $this->adFormats['125x125_as']['caption'] = '125 X 125 Button';
274
-        $this->adFormats['125x125_as']['width']   = 125;
275
-        $this->adFormats['125x125_as']['height']  = 125;
276
-        $this->adFormatsList['125x125_as']        = $this->adFormats['125x125_as']['caption'];
277
-    }
278
-
279
-    /**
280
-     * @return array
281
-     */
282
-    public function getFormats()
283
-    {
284
-        return $this->adFormatsList;
285
-    }
286
-
287
-    /**
288
-     * @param $obj
289
-     * @return bool
290
-     */
291
-    public function beforeSave(&$obj)
292
-    {
293
-        if ($obj->getVar('tag') == '') {
294
-            $obj->setVar('tag', $title = $obj->generateTag());
295
-        }
296
-
297
-        return true;
298
-    }
299
-
300
-    /**
301
-     * @return array|bool
302
-     */
303
-    public function getAdsensesByTag()
304
-    {
305
-        if (!$this->objects) {
306
-            $adsensesObj = $this->getObjects(null, true);
307
-            $ret         = array();
308
-            foreach ($adsensesObj as $adsenseObj) {
309
-                $ret[$adsenseObj->getVar('tag')] = $adsenseObj;
310
-            }
311
-            $this->objects = $ret;
312
-        }
313
-
314
-        return $this->objects;
315
-    }
204
+	public $adFormats;
205
+	public $adFormatsList;
206
+	public $objects = false;
207
+
208
+	/**
209
+	 * SmartobjectAdsenseHandler constructor.
210
+	 * @param object|XoopsDatabase $db
211
+	 */
212
+	public function __construct($db)
213
+	{
214
+		parent::__construct($db, 'adsense', 'adsenseid', 'description', '', 'smartobject');
215
+		$this->adFormats     = array();
216
+		$this->adFormatsList = array();
217
+
218
+		$this->adFormats['728x90_as']['caption'] = '728 X 90 Leaderboard';
219
+		$this->adFormats['728x90_as']['width']   = 728;
220
+		$this->adFormats['728x90_as']['height']  = 90;
221
+		$this->adFormatsList['728x90_as']        = $this->adFormats['728x90_as']['caption'];
222
+
223
+		$this->adFormats['468x60_as']['caption'] = '468 X 60 Banner';
224
+		$this->adFormats['468x60_as']['width']   = 468;
225
+		$this->adFormats['468x60_as']['height']  = 60;
226
+		$this->adFormatsList['468x60_as']        = $this->adFormats['468x60_as']['caption'];
227
+
228
+		$this->adFormats['234x60_as']['caption'] = '234 X 60 Half Banner';
229
+		$this->adFormats['234x60_as']['width']   = 234;
230
+		$this->adFormats['234x60_as']['height']  = 60;
231
+		$this->adFormatsList['234x60_as']        = $this->adFormats['234x60_as']['caption'];
232
+
233
+		$this->adFormats['120x600_as']['caption'] = '120 X 600 Skyscraper';
234
+		$this->adFormats['120x600_as']['width']   = 120;
235
+		$this->adFormats['120x600_as']['height']  = 600;
236
+		$this->adFormatsList['120x600_as']        = $this->adFormats['120x600_as']['caption'];
237
+
238
+		$this->adFormats['160x600_as']['caption'] = '160 X 600 Wide Skyscraper';
239
+		$this->adFormats['160x600_as']['width']   = 160;
240
+		$this->adFormats['160x600_as']['height']  = 600;
241
+		$this->adFormatsList['160x600_as']        = $this->adFormats['160x600_as']['caption'];
242
+
243
+		$this->adFormats['120x240_as']['caption'] = '120 X 240 Vertical Banner';
244
+		$this->adFormats['120x240_as']['width']   = 120;
245
+		$this->adFormats['120x240_as']['height']  = 240;
246
+		$this->adFormatsList['120x240_as']        = $this->adFormats['120x240_as']['caption'];
247
+
248
+		$this->adFormats['336x280_as']['caption'] = '336 X 280 Large Rectangle';
249
+		$this->adFormats['336x280_as']['width']   = 136;
250
+		$this->adFormats['336x280_as']['height']  = 280;
251
+		$this->adFormatsList['336x280_as']        = $this->adFormats['336x280_as']['caption'];
252
+
253
+		$this->adFormats['300x250_as']['caption'] = '300 X 250 Medium Rectangle';
254
+		$this->adFormats['300x250_as']['width']   = 300;
255
+		$this->adFormats['300x250_as']['height']  = 250;
256
+		$this->adFormatsList['300x250_as']        = $this->adFormats['300x250_as']['caption'];
257
+
258
+		$this->adFormats['250x250_as']['caption'] = '250 X 250 Square';
259
+		$this->adFormats['250x250_as']['width']   = 250;
260
+		$this->adFormats['250x250_as']['height']  = 250;
261
+		$this->adFormatsList['250x250_as']        = $this->adFormats['250x250_as']['caption'];
262
+
263
+		$this->adFormats['200x200_as']['caption'] = '200 X 200 Small Square';
264
+		$this->adFormats['200x200_as']['width']   = 200;
265
+		$this->adFormats['200x200_as']['height']  = 200;
266
+		$this->adFormatsList['200x200_as']        = $this->adFormats['200x200_as']['caption'];
267
+
268
+		$this->adFormats['180x150_as']['caption'] = '180 X 150 Small Rectangle';
269
+		$this->adFormats['180x150_as']['width']   = 180;
270
+		$this->adFormats['180x150_as']['height']  = 150;
271
+		$this->adFormatsList['180x150_as']        = $this->adFormats['180x150_as']['caption'];
272
+
273
+		$this->adFormats['125x125_as']['caption'] = '125 X 125 Button';
274
+		$this->adFormats['125x125_as']['width']   = 125;
275
+		$this->adFormats['125x125_as']['height']  = 125;
276
+		$this->adFormatsList['125x125_as']        = $this->adFormats['125x125_as']['caption'];
277
+	}
278
+
279
+	/**
280
+	 * @return array
281
+	 */
282
+	public function getFormats()
283
+	{
284
+		return $this->adFormatsList;
285
+	}
286
+
287
+	/**
288
+	 * @param $obj
289
+	 * @return bool
290
+	 */
291
+	public function beforeSave(&$obj)
292
+	{
293
+		if ($obj->getVar('tag') == '') {
294
+			$obj->setVar('tag', $title = $obj->generateTag());
295
+		}
296
+
297
+		return true;
298
+	}
299
+
300
+	/**
301
+	 * @return array|bool
302
+	 */
303
+	public function getAdsensesByTag()
304
+	{
305
+		if (!$this->objects) {
306
+			$adsensesObj = $this->getObjects(null, true);
307
+			$ret         = array();
308
+			foreach ($adsensesObj as $adsenseObj) {
309
+				$ret[$adsenseObj->getVar('tag')] = $adsenseObj;
310
+			}
311
+			$this->objects = $ret;
312
+		}
313
+
314
+		return $this->objects;
315
+	}
316 316
 }
Please login to merge, or discard this patch.
class/member.php 1 patch
Indentation   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -46,227 +46,227 @@
 block discarded – undo
46 46
  */
47 47
 class SmartobjectMemberHandler extends XoopsMemberHandler
48 48
 {
49
-    /**
50
-     * constructor
51
-     * @param XoopsDatabase $db
52
-     */
53
-    public function __construct(XoopsDatabase $db)
54
-    {
55
-        parent::__construct($db);
56
-        $this->_uHandler = xoops_getModuleHandler('user', 'smartobject');
57
-    }
49
+	/**
50
+	 * constructor
51
+	 * @param XoopsDatabase $db
52
+	 */
53
+	public function __construct(XoopsDatabase $db)
54
+	{
55
+		parent::__construct($db);
56
+		$this->_uHandler = xoops_getModuleHandler('user', 'smartobject');
57
+	}
58 58
 
59
-    /**
60
-     * @param       $userObj
61
-     * @param  bool $groups
62
-     * @param  bool $notifyUser
63
-     * @param  bool $password
64
-     * @return bool
65
-     */
66
-    public function addAndActivateUser(&$userObj, $groups = false, $notifyUser = true, &$password = false)
67
-    {
68
-        $email = $userObj->getVar('email');
69
-        if (!$userObj->getVar('email') || $email == '') {
70
-            $userObj->setErrors(_CO_SOBJECT_USER_NEED_EMAIL);
59
+	/**
60
+	 * @param       $userObj
61
+	 * @param  bool $groups
62
+	 * @param  bool $notifyUser
63
+	 * @param  bool $password
64
+	 * @return bool
65
+	 */
66
+	public function addAndActivateUser(&$userObj, $groups = false, $notifyUser = true, &$password = false)
67
+	{
68
+		$email = $userObj->getVar('email');
69
+		if (!$userObj->getVar('email') || $email == '') {
70
+			$userObj->setErrors(_CO_SOBJECT_USER_NEED_EMAIL);
71 71
 
72
-            return false;
73
-        }
72
+			return false;
73
+		}
74 74
 
75
-        $password = $userObj->getVar('pass');
76
-        // randomly generating the password if not already set
77
-        if ('' === $password) {
78
-            $password = substr(md5(uniqid(mt_rand(), 1)), 0, 6);
79
-        }
80
-        $userObj->setVar('pass', md5($password));
75
+		$password = $userObj->getVar('pass');
76
+		// randomly generating the password if not already set
77
+		if ('' === $password) {
78
+			$password = substr(md5(uniqid(mt_rand(), 1)), 0, 6);
79
+		}
80
+		$userObj->setVar('pass', md5($password));
81 81
 
82
-        // if no username is set, let's generate one
83
-        $unamecount = 20;
84
-        $uname      = $userObj->getVar('uname');
85
-        if (!$uname || $uname == '') {
86
-            $usernames = $this->genUserNames($email, $unamecount);
87
-            $newuser   = false;
88
-            $i         = 0;
89
-            while ($newuser == false) {
90
-                $crit  = new Criteria('uname', $usernames[$i]);
91
-                $count = $this->getUserCount($crit);
92
-                if ($count == 0) {
93
-                    $newuser = true;
94
-                } else {
95
-                    //Move to next username
96
-                    ++$i;
97
-                    if ($i == $unamecount) {
98
-                        //Get next batch of usernames to try, reset counter
99
-                        $usernames = $this->genUserNames($email, $unamecount);
100
-                        $i         = 0;
101
-                    }
102
-                }
103
-            }
104
-        }
82
+		// if no username is set, let's generate one
83
+		$unamecount = 20;
84
+		$uname      = $userObj->getVar('uname');
85
+		if (!$uname || $uname == '') {
86
+			$usernames = $this->genUserNames($email, $unamecount);
87
+			$newuser   = false;
88
+			$i         = 0;
89
+			while ($newuser == false) {
90
+				$crit  = new Criteria('uname', $usernames[$i]);
91
+				$count = $this->getUserCount($crit);
92
+				if ($count == 0) {
93
+					$newuser = true;
94
+				} else {
95
+					//Move to next username
96
+					++$i;
97
+					if ($i == $unamecount) {
98
+						//Get next batch of usernames to try, reset counter
99
+						$usernames = $this->genUserNames($email, $unamecount);
100
+						$i         = 0;
101
+					}
102
+				}
103
+			}
104
+		}
105 105
 
106
-        global $xoopsConfig;
106
+		global $xoopsConfig;
107 107
 
108
-        $configHandler  = xoops_getHandler('config');
109
-        $xoopsConfigUser = $configHandler->getConfigsByCat(XOOPS_CONF_USER);
110
-        switch ($xoopsConfigUser['activation_type']) {
111
-            case 0:
112
-                $level           = 0;
113
-                $mailtemplate    = 'smartmail_activate_user.tpl';
114
-                $aInfoMessages[] = sprintf(_NL_MA_NEW_USER_NEED_ACT, $user_email);
115
-                break;
116
-            case 1:
117
-                $level           = 1;
118
-                $mailtemplate    = 'smartmail_auto_activate_user.tpl';
119
-                $aInfoMessages[] = sprintf(_NL_MA_NEW_USER_AUTO_ACT, $user_email);
120
-                break;
121
-            case 2:
122
-            default:
123
-                $level           = 0;
124
-                $mailtemplate    = 'smartmail_admin_activate_user.tpl';
125
-                $aInfoMessages[] = sprintf(_NL_MA_NEW_USER_ADMIN_ACT, $user_email);
126
-        }
108
+		$configHandler  = xoops_getHandler('config');
109
+		$xoopsConfigUser = $configHandler->getConfigsByCat(XOOPS_CONF_USER);
110
+		switch ($xoopsConfigUser['activation_type']) {
111
+			case 0:
112
+				$level           = 0;
113
+				$mailtemplate    = 'smartmail_activate_user.tpl';
114
+				$aInfoMessages[] = sprintf(_NL_MA_NEW_USER_NEED_ACT, $user_email);
115
+				break;
116
+			case 1:
117
+				$level           = 1;
118
+				$mailtemplate    = 'smartmail_auto_activate_user.tpl';
119
+				$aInfoMessages[] = sprintf(_NL_MA_NEW_USER_AUTO_ACT, $user_email);
120
+				break;
121
+			case 2:
122
+			default:
123
+				$level           = 0;
124
+				$mailtemplate    = 'smartmail_admin_activate_user.tpl';
125
+				$aInfoMessages[] = sprintf(_NL_MA_NEW_USER_ADMIN_ACT, $user_email);
126
+		}
127 127
 
128
-        $userObj->setVar('uname', $usernames[$i]);
129
-        $userObj->setVar('user_avatar', 'blank.gif');
130
-        $userObj->setVar('user_regdate', time());
131
-        $userObj->setVar('timezone_offset', $xoopsConfig['default_TZ']);
132
-        $actkey = substr(md5(uniqid(mt_rand(), 1)), 0, 8);
133
-        $userObj->setVar('actkey', $actkey);
134
-        $userObj->setVar('email', $email);
135
-        $userObj->setVar('notify_method', 2);
136
-        $userObj->setVar('level', $userObj);
128
+		$userObj->setVar('uname', $usernames[$i]);
129
+		$userObj->setVar('user_avatar', 'blank.gif');
130
+		$userObj->setVar('user_regdate', time());
131
+		$userObj->setVar('timezone_offset', $xoopsConfig['default_TZ']);
132
+		$actkey = substr(md5(uniqid(mt_rand(), 1)), 0, 8);
133
+		$userObj->setVar('actkey', $actkey);
134
+		$userObj->setVar('email', $email);
135
+		$userObj->setVar('notify_method', 2);
136
+		$userObj->setVar('level', $userObj);
137 137
 
138
-        if ($this->insertUser($userObj)) {
138
+		if ($this->insertUser($userObj)) {
139 139
 
140
-            // if $groups=false, Add the user to Registered Users group
141
-            if (!$groups) {
142
-                $this->addUserToGroup(XOOPS_GROUP_USERS, $userObj->getVar('uid'));
143
-            } else {
144
-                foreach ($groups as $groupid) {
145
-                    $this->addUserToGroup($groupid, $userObj->getVar('uid'));
146
-                }
147
-            }
148
-        } else {
149
-            return false;
150
-        }
140
+			// if $groups=false, Add the user to Registered Users group
141
+			if (!$groups) {
142
+				$this->addUserToGroup(XOOPS_GROUP_USERS, $userObj->getVar('uid'));
143
+			} else {
144
+				foreach ($groups as $groupid) {
145
+					$this->addUserToGroup($groupid, $userObj->getVar('uid'));
146
+				}
147
+			}
148
+		} else {
149
+			return false;
150
+		}
151 151
 
152
-        if ($notifyUser) {
153
-            // send some notifications
154
-            $xoopsMailer =& getMailer();
155
-            $xoopsMailer->useMail();
156
-            $xoopsMailer->setTemplateDir(SMARTOBJECT_ROOT_PATH . 'language/' . $xoopsConfig['language'] . '/mail_template');
157
-            $xoopsMailer->setTemplate('smartobject_notify_user_added_by_admin.tpl');
158
-            $xoopsMailer->assign('XOOPS_USER_PASSWORD', $password);
159
-            $xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']);
160
-            $xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
161
-            $xoopsMailer->assign('SITEURL', XOOPS_URL . '/');
162
-            $xoopsMailer->assign('NAME', $userObj->getVar('name'));
163
-            $xoopsMailer->assign('UNAME', $userObj->getVar('uname'));
164
-            $xoopsMailer->setToUsers($userObj);
165
-            $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
166
-            $xoopsMailer->setFromName($xoopsConfig['sitename']);
167
-            $xoopsMailer->setSubject(sprintf(_CO_SOBJECT_NEW_USER_NOTIFICATION_SUBJECT, $xoopsConfig['sitename']));
152
+		if ($notifyUser) {
153
+			// send some notifications
154
+			$xoopsMailer =& getMailer();
155
+			$xoopsMailer->useMail();
156
+			$xoopsMailer->setTemplateDir(SMARTOBJECT_ROOT_PATH . 'language/' . $xoopsConfig['language'] . '/mail_template');
157
+			$xoopsMailer->setTemplate('smartobject_notify_user_added_by_admin.tpl');
158
+			$xoopsMailer->assign('XOOPS_USER_PASSWORD', $password);
159
+			$xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']);
160
+			$xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
161
+			$xoopsMailer->assign('SITEURL', XOOPS_URL . '/');
162
+			$xoopsMailer->assign('NAME', $userObj->getVar('name'));
163
+			$xoopsMailer->assign('UNAME', $userObj->getVar('uname'));
164
+			$xoopsMailer->setToUsers($userObj);
165
+			$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
166
+			$xoopsMailer->setFromName($xoopsConfig['sitename']);
167
+			$xoopsMailer->setSubject(sprintf(_CO_SOBJECT_NEW_USER_NOTIFICATION_SUBJECT, $xoopsConfig['sitename']));
168 168
 
169
-            if (!$xoopsMailer->send(true)) {
170
-                /**
171
-                 * @todo trap error if email was not sent
172
-                 */
173
-                $xoopsMailer->getErrors(true);
174
-            }
175
-        }
169
+			if (!$xoopsMailer->send(true)) {
170
+				/**
171
+				 * @todo trap error if email was not sent
172
+				 */
173
+				$xoopsMailer->getErrors(true);
174
+			}
175
+		}
176 176
 
177
-        return true;
178
-    }
177
+		return true;
178
+	}
179 179
 
180
-    /**
181
-     * Generates an array of usernames
182
-     *
183
-     * @param  string $email email of user
184
-     * @param  int    $count number of names to generate
185
-     * @return array  $names
186
-     * @internal param string $name name of user
187
-     * @author   xHelp Team
188
-     *
189
-     * @access   public
190
-     */
191
-    public function genUserNames($email, $count = 20)
192
-    {
193
-        $name = substr($email, 0, strpos($email, '@')); //Take the email adress without domain as username
180
+	/**
181
+	 * Generates an array of usernames
182
+	 *
183
+	 * @param  string $email email of user
184
+	 * @param  int    $count number of names to generate
185
+	 * @return array  $names
186
+	 * @internal param string $name name of user
187
+	 * @author   xHelp Team
188
+	 *
189
+	 * @access   public
190
+	 */
191
+	public function genUserNames($email, $count = 20)
192
+	{
193
+		$name = substr($email, 0, strpos($email, '@')); //Take the email adress without domain as username
194 194
 
195
-        $names  = array();
196
-        $userid = explode('@', $email);
195
+		$names  = array();
196
+		$userid = explode('@', $email);
197 197
 
198
-        $basename    = '';
199
-        $hasbasename = false;
200
-        $emailname   = $userid[0];
198
+		$basename    = '';
199
+		$hasbasename = false;
200
+		$emailname   = $userid[0];
201 201
 
202
-        $names[] = $emailname;
202
+		$names[] = $emailname;
203 203
 
204
-        if (strlen($name) > 0) {
205
-            $name = explode(' ', trim($name));
206
-            if (count($name) > 1) {
207
-                $basename = strtolower(substr($name[0], 0, 1) . $name[count($name) - 1]);
208
-            } else {
209
-                $basename = strtolower($name[0]);
210
-            }
211
-            $basename = xoops_substr($basename, 0, 60, '');
212
-            //Prevent Duplication of Email Username and Name
213
-            if (!in_array($basename, $names)) {
214
-                $names[]     = $basename;
215
-                $hasbasename = true;
216
-            }
217
-        }
204
+		if (strlen($name) > 0) {
205
+			$name = explode(' ', trim($name));
206
+			if (count($name) > 1) {
207
+				$basename = strtolower(substr($name[0], 0, 1) . $name[count($name) - 1]);
208
+			} else {
209
+				$basename = strtolower($name[0]);
210
+			}
211
+			$basename = xoops_substr($basename, 0, 60, '');
212
+			//Prevent Duplication of Email Username and Name
213
+			if (!in_array($basename, $names)) {
214
+				$names[]     = $basename;
215
+				$hasbasename = true;
216
+			}
217
+		}
218 218
 
219
-        $i          = count($names);
220
-        $onbasename = 1;
221
-        while ($i < $count) {
222
-            $num = $this->genRandNumber();
223
-            if ($onbasename < 0 && $hasbasename) {
224
-                $names[] = xoops_substr($basename, 0, 58, '') . $num;
225
-            } else {
226
-                $names[] = xoops_substr($emailname, 0, 58, '') . $num;
227
-            }
228
-            $i          = count($names);
229
-            $onbasename = ~$onbasename;
230
-            $num        = '';
231
-        }
219
+		$i          = count($names);
220
+		$onbasename = 1;
221
+		while ($i < $count) {
222
+			$num = $this->genRandNumber();
223
+			if ($onbasename < 0 && $hasbasename) {
224
+				$names[] = xoops_substr($basename, 0, 58, '') . $num;
225
+			} else {
226
+				$names[] = xoops_substr($emailname, 0, 58, '') . $num;
227
+			}
228
+			$i          = count($names);
229
+			$onbasename = ~$onbasename;
230
+			$num        = '';
231
+		}
232 232
 
233
-        return $names;
234
-    }
233
+		return $names;
234
+	}
235 235
 
236
-    /**
237
-     * Creates a random number with a specified number of $digits
238
-     *
239
-     * @param  int $digits number of digits
240
-     * @return return int random number
241
-     * @author xHelp Team
242
-     *
243
-     * @access public
244
-     */
245
-    public function genRandNumber($digits = 2)
246
-    {
247
-        $this->initRand();
248
-        $tmp = array();
236
+	/**
237
+	 * Creates a random number with a specified number of $digits
238
+	 *
239
+	 * @param  int $digits number of digits
240
+	 * @return return int random number
241
+	 * @author xHelp Team
242
+	 *
243
+	 * @access public
244
+	 */
245
+	public function genRandNumber($digits = 2)
246
+	{
247
+		$this->initRand();
248
+		$tmp = array();
249 249
 
250
-        for ($i = 0; $i < $digits; ++$i) {
251
-            $tmp[$i] = (mt_rand() % 9);
252
-        }
250
+		for ($i = 0; $i < $digits; ++$i) {
251
+			$tmp[$i] = (mt_rand() % 9);
252
+		}
253 253
 
254
-        return implode('', $tmp);
255
-    }
254
+		return implode('', $tmp);
255
+	}
256 256
 
257
-    /**
258
-     * Gives the random number generator a seed to start from
259
-     *
260
-     * @return void
261
-     *
262
-     * @access public
263
-     */
264
-    public function initRand()
265
-    {
266
-        static $randCalled = false;
267
-        if (!$randCalled) {
268
-            mt_srand((double)microtime() * 1000000);
269
-            $randCalled = true;
270
-        }
271
-    }
257
+	/**
258
+	 * Gives the random number generator a seed to start from
259
+	 *
260
+	 * @return void
261
+	 *
262
+	 * @access public
263
+	 */
264
+	public function initRand()
265
+	{
266
+		static $randCalled = false;
267
+		if (!$randCalled) {
268
+			mt_srand((double)microtime() * 1000000);
269
+			$randCalled = true;
270
+		}
271
+	}
272 272
 }
Please login to merge, or discard this patch.
class/smartseoobject.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -24,44 +24,44 @@
 block discarded – undo
24 24
  */
25 25
 class SmartSeoObject extends SmartObject
26 26
 {
27
-    /**
28
-     * SmartSeoObject constructor.
29
-     */
30
-    public function __construct()
31
-    {
32
-        $this->initCommonVar('meta_keywords');
33
-        $this->initCommonVar('meta_description');
34
-        $this->initCommonVar('short_url');
35
-        $this->seoEnabled = true;
36
-    }
27
+	/**
28
+	 * SmartSeoObject constructor.
29
+	 */
30
+	public function __construct()
31
+	{
32
+		$this->initCommonVar('meta_keywords');
33
+		$this->initCommonVar('meta_description');
34
+		$this->initCommonVar('short_url');
35
+		$this->seoEnabled = true;
36
+	}
37 37
 
38
-    /**
39
-     * Return the value of the short_url field of this object
40
-     *
41
-     * @return string
42
-     */
43
-    public function short_url()
44
-    {
45
-        return $this->getVar('short_url');
46
-    }
38
+	/**
39
+	 * Return the value of the short_url field of this object
40
+	 *
41
+	 * @return string
42
+	 */
43
+	public function short_url()
44
+	{
45
+		return $this->getVar('short_url');
46
+	}
47 47
 
48
-    /**
49
-     * Return the value of the meta_keywords field of this object
50
-     *
51
-     * @return string
52
-     */
53
-    public function meta_keywords()
54
-    {
55
-        return $this->getVar('meta_keywords');
56
-    }
48
+	/**
49
+	 * Return the value of the meta_keywords field of this object
50
+	 *
51
+	 * @return string
52
+	 */
53
+	public function meta_keywords()
54
+	{
55
+		return $this->getVar('meta_keywords');
56
+	}
57 57
 
58
-    /**
59
-     * Return the value of the meta_description field of this object
60
-     *
61
-     * @return string
62
-     */
63
-    public function meta_description()
64
-    {
65
-        return $this->getVar('meta_description');
66
-    }
58
+	/**
59
+	 * Return the value of the meta_description field of this object
60
+	 *
61
+	 * @return string
62
+	 */
63
+	public function meta_description()
64
+	{
65
+		return $this->getVar('meta_description');
66
+	}
67 67
 }
Please login to merge, or discard this patch.
class/smartjax.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@
 block discarded – undo
36 36
  */
37 37
 class SmartJax extends Projax
38 38
 {
39
-    public function initiateFromUserside()
40
-    {
41
-        global $xoTheme;
42
-        $xoTheme->addScript(SMARTOBJECT_URL . 'include/projax/js/prototype.js');
43
-        $xoTheme->addScript(SMARTOBJECT_URL . 'include/projax/js/scriptaculous.js');
44
-    }
39
+	public function initiateFromUserside()
40
+	{
41
+		global $xoTheme;
42
+		$xoTheme->addScript(SMARTOBJECT_URL . 'include/projax/js/prototype.js');
43
+		$xoTheme->addScript(SMARTOBJECT_URL . 'include/projax/js/scriptaculous.js');
44
+	}
45 45
 }
Please login to merge, or discard this patch.
class/smartmlobject.php 1 patch
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -24,82 +24,82 @@  discard block
 block discarded – undo
24 24
  */
25 25
 class SmartMlObject extends SmartObject
26 26
 {
27
-    /**
28
-     * SmartMlObject constructor.
29
-     */
30
-    public function __construct()
31
-    {
32
-        $this->initVar('language', XOBJ_DTYPE_TXTBOX, 'english', false, null, '', true, _CO_SOBJECT_LANGUAGE_CAPTION, _CO_SOBJECT_LANGUAGE_DSC, true, true);
33
-        $this->setControl('language', 'language');
34
-    }
35
-
36
-    /**
37
-     * If object is not new, change the control of the not-multilanguage fields
38
-     *
39
-     * We need to intercept this function from SmartObject because if the object is not new...
40
-     */
41
-    // function getForm() {
42
-
43
-    //}
44
-
45
-    /**
46
-     * Strip Multilanguage Fields
47
-     *
48
-     * Get rid of all the multilanguage fields to have an object with only global fields.
49
-     * This will be usefull when creating the ML object for the first time. Then we will be able
50
-     * to create translations.
51
-     */
52
-    public function stripMultilanguageFields()
53
-    {
54
-        $objectVars    =& $this->getVars();
55
-        $newObjectVars = array();
56
-        foreach ($objectVars as $key => $var) {
57
-            if (!$var['multilingual']) {
58
-                $newObjectVars[$key] = $var;
59
-            }
60
-        }
61
-        $this->vars = $newObjectVars;
62
-    }
63
-
64
-    public function stripNonMultilanguageFields()
65
-    {
66
-        $objectVars    =& $this->getVars();
67
-        $newObjectVars = array();
68
-        foreach ($objectVars as $key => $var) {
69
-            if ($var['multilingual'] || $key == $this->handler->keyName) {
70
-                $newObjectVars[$key] = $var;
71
-            }
72
-        }
73
-        $this->vars = $newObjectVars;
74
-    }
75
-
76
-    /**
77
-     * Make non multilanguage fields read only
78
-     *
79
-     * This is used when we are creating/editing a translation.
80
-     * We only want to edit the multilanguag fields, not the global one.
81
-     */
82
-    public function makeNonMLFieldReadOnly()
83
-    {
84
-        foreach ($this->getVars() as $key => $var) {
85
-            //if (($key == 'language') || (!$var['multilingual'] && $key <> $this->handler->keyName)) {
86
-            if (!$var['multilingual'] && $key <> $this->handler->keyName) {
87
-                $this->setControl($key, 'label');
88
-            }
89
-        }
90
-    }
91
-
92
-    /**
93
-     * @param  bool $onlyUrl
94
-     * @param  bool $withimage
95
-     * @return string
96
-     */
97
-    public function getEditLanguageLink($onlyUrl = false, $withimage = true)
98
-    {
99
-        $controller = new SmartObjectController($this->handler);
100
-
101
-        return $controller->getEditLanguageLink($this, $onlyUrl, $withimage);
102
-    }
27
+	/**
28
+	 * SmartMlObject constructor.
29
+	 */
30
+	public function __construct()
31
+	{
32
+		$this->initVar('language', XOBJ_DTYPE_TXTBOX, 'english', false, null, '', true, _CO_SOBJECT_LANGUAGE_CAPTION, _CO_SOBJECT_LANGUAGE_DSC, true, true);
33
+		$this->setControl('language', 'language');
34
+	}
35
+
36
+	/**
37
+	 * If object is not new, change the control of the not-multilanguage fields
38
+	 *
39
+	 * We need to intercept this function from SmartObject because if the object is not new...
40
+	 */
41
+	// function getForm() {
42
+
43
+	//}
44
+
45
+	/**
46
+	 * Strip Multilanguage Fields
47
+	 *
48
+	 * Get rid of all the multilanguage fields to have an object with only global fields.
49
+	 * This will be usefull when creating the ML object for the first time. Then we will be able
50
+	 * to create translations.
51
+	 */
52
+	public function stripMultilanguageFields()
53
+	{
54
+		$objectVars    =& $this->getVars();
55
+		$newObjectVars = array();
56
+		foreach ($objectVars as $key => $var) {
57
+			if (!$var['multilingual']) {
58
+				$newObjectVars[$key] = $var;
59
+			}
60
+		}
61
+		$this->vars = $newObjectVars;
62
+	}
63
+
64
+	public function stripNonMultilanguageFields()
65
+	{
66
+		$objectVars    =& $this->getVars();
67
+		$newObjectVars = array();
68
+		foreach ($objectVars as $key => $var) {
69
+			if ($var['multilingual'] || $key == $this->handler->keyName) {
70
+				$newObjectVars[$key] = $var;
71
+			}
72
+		}
73
+		$this->vars = $newObjectVars;
74
+	}
75
+
76
+	/**
77
+	 * Make non multilanguage fields read only
78
+	 *
79
+	 * This is used when we are creating/editing a translation.
80
+	 * We only want to edit the multilanguag fields, not the global one.
81
+	 */
82
+	public function makeNonMLFieldReadOnly()
83
+	{
84
+		foreach ($this->getVars() as $key => $var) {
85
+			//if (($key == 'language') || (!$var['multilingual'] && $key <> $this->handler->keyName)) {
86
+			if (!$var['multilingual'] && $key <> $this->handler->keyName) {
87
+				$this->setControl($key, 'label');
88
+			}
89
+		}
90
+	}
91
+
92
+	/**
93
+	 * @param  bool $onlyUrl
94
+	 * @param  bool $withimage
95
+	 * @return string
96
+	 */
97
+	public function getEditLanguageLink($onlyUrl = false, $withimage = true)
98
+	{
99
+		$controller = new SmartObjectController($this->handler);
100
+
101
+		return $controller->getEditLanguageLink($this, $onlyUrl, $withimage);
102
+	}
103 103
 }
104 104
 
105 105
 /**
@@ -107,55 +107,55 @@  discard block
 block discarded – undo
107 107
  */
108 108
 class SmartPersistableMlObjectHandler extends SmartPersistableObjectHandler
109 109
 {
110
-    /**
111
-     * @param  null $criteria
112
-     * @param  bool $id_as_key
113
-     * @param  bool $as_object
114
-     * @param  bool $debug
115
-     * @param  bool $language
116
-     * @return array
117
-     */
118
-    public function getObjects($criteria = null, $id_as_key = false, $as_object = true, $debug = false, $language = false)
119
-    {
120
-        // Create the first part of the SQL query to join the "_text" table
121
-        $sql = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname . ' INNER JOIN ' . $this->table . '_text AS ' . $this->_itemname . '_text ON ' . $this->_itemname . '.' . $this->keyName . '=' . $this->_itemname . '_text.' . $this->keyName;
122
-
123
-        if ($language) {
124
-            // If a language was specified, then let's create a WHERE clause to only return the objects associated with this language
125
-
126
-            // if no criteria was previously created, let's create it
127
-            if (!$criteria) {
128
-                $criteria = new CriteriaCompo();
129
-            }
130
-            $criteria->add(new Criteria('language', $language));
131
-
132
-            return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql);
133
-        }
134
-
135
-        return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql);
136
-    }
137
-
138
-    /**
139
-     * @param  mixed $id
140
-     * @param  bool  $language
141
-     * @param  bool  $as_object
142
-     * @param  bool  $debug
143
-     * @return mixed
144
-     */
145
-    public function &get($id, $language = false, $as_object = true, $debug = false)
146
-    {
147
-        if (!$language) {
148
-            return parent::get($id, $as_object, $debug);
149
-        } else {
150
-            $criteria = new CriteriaCompo();
151
-            $criteria->add(new Criteria('language', $language));
152
-
153
-            return parent::get($id, $as_object, $debug, $criteria);
154
-        }
155
-    }
156
-
157
-    public function changeTableNameForML()
158
-    {
159
-        $this->table = $this->db->prefix($this->_moduleName . '_' . $this->_itemname . '_text');
160
-    }
110
+	/**
111
+	 * @param  null $criteria
112
+	 * @param  bool $id_as_key
113
+	 * @param  bool $as_object
114
+	 * @param  bool $debug
115
+	 * @param  bool $language
116
+	 * @return array
117
+	 */
118
+	public function getObjects($criteria = null, $id_as_key = false, $as_object = true, $debug = false, $language = false)
119
+	{
120
+		// Create the first part of the SQL query to join the "_text" table
121
+		$sql = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname . ' INNER JOIN ' . $this->table . '_text AS ' . $this->_itemname . '_text ON ' . $this->_itemname . '.' . $this->keyName . '=' . $this->_itemname . '_text.' . $this->keyName;
122
+
123
+		if ($language) {
124
+			// If a language was specified, then let's create a WHERE clause to only return the objects associated with this language
125
+
126
+			// if no criteria was previously created, let's create it
127
+			if (!$criteria) {
128
+				$criteria = new CriteriaCompo();
129
+			}
130
+			$criteria->add(new Criteria('language', $language));
131
+
132
+			return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql);
133
+		}
134
+
135
+		return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql);
136
+	}
137
+
138
+	/**
139
+	 * @param  mixed $id
140
+	 * @param  bool  $language
141
+	 * @param  bool  $as_object
142
+	 * @param  bool  $debug
143
+	 * @return mixed
144
+	 */
145
+	public function &get($id, $language = false, $as_object = true, $debug = false)
146
+	{
147
+		if (!$language) {
148
+			return parent::get($id, $as_object, $debug);
149
+		} else {
150
+			$criteria = new CriteriaCompo();
151
+			$criteria->add(new Criteria('language', $language));
152
+
153
+			return parent::get($id, $as_object, $debug, $criteria);
154
+		}
155
+	}
156
+
157
+	public function changeTableNameForML()
158
+	{
159
+		$this->table = $this->db->prefix($this->_moduleName . '_' . $this->_itemname . '_text');
160
+	}
161 161
 }
Please login to merge, or discard this patch.
class/form/elements/smartformurllinkelement.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,31 +11,31 @@
 block discarded – undo
11 11
  */
12 12
 class SmartFormUrlLinkElement extends XoopsFormElementTray
13 13
 {
14
-    /**
15
-     * SmartFormUrlLinkElement 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;');
14
+	/**
15
+	 * SmartFormUrlLinkElement 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 23
 
24
-        $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_URLLINK_URL));
25
-        $this->addElement(new SmartFormTextElement($object, 'url_' . $key));
24
+		$this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_URLLINK_URL));
25
+		$this->addElement(new SmartFormTextElement($object, 'url_' . $key));
26 26
 
27
-        $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_CAPTION));
28
-        $this->addElement(new SmartFormTextElement($object, 'caption_' . $key));
27
+		$this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_CAPTION));
28
+		$this->addElement(new SmartFormTextElement($object, 'caption_' . $key));
29 29
 
30
-        $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_DESC . '<br/>'));
31
-        $this->addElement(new XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description')));
30
+		$this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_DESC . '<br/>'));
31
+		$this->addElement(new XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description')));
32 32
 
33
-        $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_URLLINK_TARGET));
34
-        $targ_val    = $object->getVar('target');
35
-        $targetRadio = new XoopsFormRadio('', 'target_' . $key, $targ_val != '' ? $targ_val : '_blank');
36
-        $control     = $object->getControl('target');
37
-        $targetRadio->addOptionArray($control['options']);
33
+		$this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_URLLINK_TARGET));
34
+		$targ_val    = $object->getVar('target');
35
+		$targetRadio = new XoopsFormRadio('', 'target_' . $key, $targ_val != '' ? $targ_val : '_blank');
36
+		$control     = $object->getControl('target');
37
+		$targetRadio->addOptionArray($control['options']);
38 38
 
39
-        $this->addElement($targetRadio);
40
-    }
39
+		$this->addElement($targetRadio);
40
+	}
41 41
 }
Please login to merge, or discard this patch.
class/form/elements/smartformtextelement.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -11,24 +11,24 @@
 block discarded – undo
11 11
  */
12 12
 class SmartFormTextElement extends XoopsFormText
13 13
 {
14
-    /**
15
-     * SmartFormTextElement constructor.
16
-     * @param string $object
17
-     * @param string $key
18
-     */
19
-    public function __construct($object, $key)
20
-    {
21
-        $var = $object->vars[$key];
14
+	/**
15
+	 * SmartFormTextElement constructor.
16
+	 * @param string $object
17
+	 * @param string $key
18
+	 */
19
+	public function __construct($object, $key)
20
+	{
21
+		$var = $object->vars[$key];
22 22
 
23
-        if (isset($object->controls[$key])) {
24
-            $control        = $object->controls[$key];
25
-            $form_maxlength = isset($control['maxlength']) ? $control['maxlength'] : (isset($var['maxlength']) ? $var['maxlength'] : 255);
26
-            $form_size      = isset($control['size']) ? $control['size'] : 50;
27
-        } else {
28
-            $form_maxlength = 255;
29
-            $form_size      = 50;
30
-        }
23
+		if (isset($object->controls[$key])) {
24
+			$control        = $object->controls[$key];
25
+			$form_maxlength = isset($control['maxlength']) ? $control['maxlength'] : (isset($var['maxlength']) ? $var['maxlength'] : 255);
26
+			$form_size      = isset($control['size']) ? $control['size'] : 50;
27
+		} else {
28
+			$form_maxlength = 255;
29
+			$form_size      = 50;
30
+		}
31 31
 
32
-        parent::__construct($var['form_caption'], $key, $form_size, $form_maxlength, $object->getVar($key, 'e'));
33
-    }
32
+		parent::__construct($var['form_caption'], $key, $form_size, $form_maxlength, $object->getVar($key, 'e'));
33
+	}
34 34
 }
Please login to merge, or discard this patch.