Completed
Push — master ( c5aa4f...a09810 )
by Michael
02:13
created
class/basedurl.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -36,29 +36,29 @@
 block discarded – undo
36 36
  */
37 37
 class SmartobjectBasedUrl extends SmartObject
38 38
 {
39
-    /**
40
-     * SmartobjectBasedUrl constructor.
41
-     */
42
-    public function __construct()
43
-    {
44
-        $this->quickInitVar('caption', XOBJ_DTYPE_TXTBOX, false);
45
-        $this->quickInitVar('description', XOBJ_DTYPE_TXTBOX, false);
46
-        $this->quickInitVar('url', XOBJ_DTYPE_TXTBOX, false);
47
-    }
39
+	/**
40
+	 * SmartobjectBasedUrl constructor.
41
+	 */
42
+	public function __construct()
43
+	{
44
+		$this->quickInitVar('caption', XOBJ_DTYPE_TXTBOX, false);
45
+		$this->quickInitVar('description', XOBJ_DTYPE_TXTBOX, false);
46
+		$this->quickInitVar('url', XOBJ_DTYPE_TXTBOX, false);
47
+	}
48 48
 
49
-    /**
50
-     * @param  string $key
51
-     * @param  string $format
52
-     * @return mixed
53
-     */
54
-    public function getVar($key, $format = 'e')
55
-    {
56
-        if (0 === strpos($key, 'url_')) {
57
-            return parent::getVar('url', $format);
58
-        } elseif (0 === strpos($key, 'caption_')) {
59
-            return parent::getVar('caption', $format);
60
-        } else {
61
-            return parent::getVar($key, $format);
62
-        }
63
-    }
49
+	/**
50
+	 * @param  string $key
51
+	 * @param  string $format
52
+	 * @return mixed
53
+	 */
54
+	public function getVar($key, $format = 'e')
55
+	{
56
+		if (0 === strpos($key, 'url_')) {
57
+			return parent::getVar('url', $format);
58
+		} elseif (0 === strpos($key, 'caption_')) {
59
+			return parent::getVar('caption', $format);
60
+		} else {
61
+			return parent::getVar($key, $format);
62
+		}
63
+	}
64 64
 }
Please login to merge, or discard this patch.
class/file.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@  discard block
 block discarded – undo
8 8
  */
9 9
 class SmartobjectFile extends SmartobjectBasedUrl
10 10
 {
11
-    /**
12
-     * SmartobjectFile constructor.
13
-     */
14
-    public function __construct()
15
-    {
16
-        parent::__construct();
17
-        $this->quickInitVar('fileid', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_RATING_DIRNAME);
18
-    }
11
+	/**
12
+	 * SmartobjectFile constructor.
13
+	 */
14
+	public function __construct()
15
+	{
16
+		parent::__construct();
17
+		$this->quickInitVar('fileid', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_RATING_DIRNAME);
18
+	}
19 19
 }
20 20
 
21 21
 /**
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
  */
24 24
 class SmartobjectFileHandler extends SmartPersistableObjectHandler
25 25
 {
26
-    /**
27
-     * SmartobjectFileHandler constructor.
28
-     * @param XoopsDatabase $db
29
-     */
30
-    public function __construct(XoopsDatabase $db)
31
-    {
32
-        parent::__construct($db, 'file', 'fileid', 'caption', 'desc', 'smartobject');
33
-    }
26
+	/**
27
+	 * SmartobjectFileHandler constructor.
28
+	 * @param XoopsDatabase $db
29
+	 */
30
+	public function __construct(XoopsDatabase $db)
31
+	{
32
+		parent::__construct($db, 'file', 'fileid', 'caption', 'desc', 'smartobject');
33
+	}
34 34
 }
Please login to merge, or discard this patch.
class/rating.php 1 patch
Indentation   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -37,125 +37,125 @@  discard block
 block discarded – undo
37 37
  */
38 38
 class SmartobjectRating extends SmartObject
39 39
 {
40
-    public $_modulePlugin = false;
41
-
42
-    /**
43
-     * SmartobjectRating constructor.
44
-     */
45
-    public function __construct()
46
-    {
47
-        $this->quickInitVar('ratingid', XOBJ_DTYPE_INT, true);
48
-        $this->quickInitVar('dirname', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_RATING_DIRNAME);
49
-        $this->quickInitVar('item', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_RATING_ITEM);
50
-        $this->quickInitVar('itemid', XOBJ_DTYPE_INT, true, _CO_SOBJECT_RATING_ITEMID);
51
-        $this->quickInitVar('uid', XOBJ_DTYPE_INT, true, _CO_SOBJECT_RATING_UID);
52
-        $this->quickInitVar('date', XOBJ_DTYPE_LTIME, true, _CO_SOBJECT_RATING_DATE);
53
-        $this->quickInitVar('rate', XOBJ_DTYPE_INT, true, _CO_SOBJECT_RATING_RATE);
54
-
55
-        $this->initNonPersistableVar('name', XOBJ_DTYPE_TXTBOX, 'user', _CO_SOBJECT_RATING_NAME);
56
-
57
-        $this->setControl('dirname', array(
58
-            'handler'  => 'rating',
59
-            'method'   => 'getModuleList',
60
-            'onSelect' => 'submit'
61
-        ));
62
-
63
-        $this->setControl('item', array(
64
-            'object' => &$this,
65
-            'method' => 'getItemList'
66
-        ));
67
-
68
-        $this->setControl('uid', 'user');
69
-
70
-        $this->setControl('rate', array(
71
-            'handler' => 'rating',
72
-            'method'  => 'getRateList'
73
-        ));
74
-    }
75
-
76
-    /**
77
-     * @param  string $key
78
-     * @param  string $format
79
-     * @return mixed
80
-     */
81
-    public function getVar($key, $format = 's')
82
-    {
83
-        if ($format === 's' && in_array($key, array('name', 'dirname'))) {
84
-            //            return call_user_func(array($this, $key));
85
-            return $this->{$key}();
86
-        }
87
-
88
-        return parent::getVar($key, $format);
89
-    }
90
-
91
-    /**
92
-     * @return string
93
-     */
94
-    public function name()
95
-    {
96
-        $ret = smart_getLinkedUnameFromId($this->getVar('uid', 'e'), true, array());
97
-
98
-        return $ret;
99
-    }
100
-
101
-    /**
102
-     * @return mixed
103
-     */
104
-    public function dirname()
105
-    {
106
-        global $smartobjectRatingHandler;
107
-        $moduleArray = $smartobjectRatingHandler->getModuleList();
108
-
109
-        return $moduleArray[$this->getVar('dirname', 'n')];
110
-    }
111
-
112
-    /**
113
-     * @return mixed
114
-     */
115
-    public function getItemList()
116
-    {
117
-        $plugin = $this->getModulePlugin();
118
-
119
-        return $plugin->getItemList();
120
-    }
121
-
122
-    /**
123
-     * @return string
124
-     */
125
-    public function getItemValue()
126
-    {
127
-        $moduleUrl      = XOOPS_URL . '/modules/' . $this->getVar('dirname', 'n') . '/';
128
-        $plugin         = $this->getModulePlugin();
129
-        $pluginItemInfo = $plugin->getItemInfo($this->getVar('item'));
130
-        if (!$pluginItemInfo) {
131
-            return '';
132
-        }
133
-        $itemPath = sprintf($pluginItemInfo['url'], $this->getVar('itemid'));
134
-        $ret      = '<a href="' . $moduleUrl . $itemPath . '">' . $pluginItemInfo['caption'] . '</a>';
135
-
136
-        return $ret;
137
-    }
138
-
139
-    /**
140
-     * @return mixed
141
-     */
142
-    public function getRateValue()
143
-    {
144
-        return $this->getVar('rate');
145
-    }
146
-
147
-    /**
148
-     * @return bool
149
-     */
150
-    public function getModulePlugin()
151
-    {
152
-        if (!$this->_modulePlugin) {
153
-            global $smartobjectRatingHandler;
154
-            $this->_modulePlugin = $smartobjectRatingHandler->pluginsObject->getPlugin($this->getVar('dirname', 'n'));
155
-        }
156
-
157
-        return $this->_modulePlugin;
158
-    }
40
+	public $_modulePlugin = false;
41
+
42
+	/**
43
+	 * SmartobjectRating constructor.
44
+	 */
45
+	public function __construct()
46
+	{
47
+		$this->quickInitVar('ratingid', XOBJ_DTYPE_INT, true);
48
+		$this->quickInitVar('dirname', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_RATING_DIRNAME);
49
+		$this->quickInitVar('item', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_RATING_ITEM);
50
+		$this->quickInitVar('itemid', XOBJ_DTYPE_INT, true, _CO_SOBJECT_RATING_ITEMID);
51
+		$this->quickInitVar('uid', XOBJ_DTYPE_INT, true, _CO_SOBJECT_RATING_UID);
52
+		$this->quickInitVar('date', XOBJ_DTYPE_LTIME, true, _CO_SOBJECT_RATING_DATE);
53
+		$this->quickInitVar('rate', XOBJ_DTYPE_INT, true, _CO_SOBJECT_RATING_RATE);
54
+
55
+		$this->initNonPersistableVar('name', XOBJ_DTYPE_TXTBOX, 'user', _CO_SOBJECT_RATING_NAME);
56
+
57
+		$this->setControl('dirname', array(
58
+			'handler'  => 'rating',
59
+			'method'   => 'getModuleList',
60
+			'onSelect' => 'submit'
61
+		));
62
+
63
+		$this->setControl('item', array(
64
+			'object' => &$this,
65
+			'method' => 'getItemList'
66
+		));
67
+
68
+		$this->setControl('uid', 'user');
69
+
70
+		$this->setControl('rate', array(
71
+			'handler' => 'rating',
72
+			'method'  => 'getRateList'
73
+		));
74
+	}
75
+
76
+	/**
77
+	 * @param  string $key
78
+	 * @param  string $format
79
+	 * @return mixed
80
+	 */
81
+	public function getVar($key, $format = 's')
82
+	{
83
+		if ($format === 's' && in_array($key, array('name', 'dirname'))) {
84
+			//            return call_user_func(array($this, $key));
85
+			return $this->{$key}();
86
+		}
87
+
88
+		return parent::getVar($key, $format);
89
+	}
90
+
91
+	/**
92
+	 * @return string
93
+	 */
94
+	public function name()
95
+	{
96
+		$ret = smart_getLinkedUnameFromId($this->getVar('uid', 'e'), true, array());
97
+
98
+		return $ret;
99
+	}
100
+
101
+	/**
102
+	 * @return mixed
103
+	 */
104
+	public function dirname()
105
+	{
106
+		global $smartobjectRatingHandler;
107
+		$moduleArray = $smartobjectRatingHandler->getModuleList();
108
+
109
+		return $moduleArray[$this->getVar('dirname', 'n')];
110
+	}
111
+
112
+	/**
113
+	 * @return mixed
114
+	 */
115
+	public function getItemList()
116
+	{
117
+		$plugin = $this->getModulePlugin();
118
+
119
+		return $plugin->getItemList();
120
+	}
121
+
122
+	/**
123
+	 * @return string
124
+	 */
125
+	public function getItemValue()
126
+	{
127
+		$moduleUrl      = XOOPS_URL . '/modules/' . $this->getVar('dirname', 'n') . '/';
128
+		$plugin         = $this->getModulePlugin();
129
+		$pluginItemInfo = $plugin->getItemInfo($this->getVar('item'));
130
+		if (!$pluginItemInfo) {
131
+			return '';
132
+		}
133
+		$itemPath = sprintf($pluginItemInfo['url'], $this->getVar('itemid'));
134
+		$ret      = '<a href="' . $moduleUrl . $itemPath . '">' . $pluginItemInfo['caption'] . '</a>';
135
+
136
+		return $ret;
137
+	}
138
+
139
+	/**
140
+	 * @return mixed
141
+	 */
142
+	public function getRateValue()
143
+	{
144
+		return $this->getVar('rate');
145
+	}
146
+
147
+	/**
148
+	 * @return bool
149
+	 */
150
+	public function getModulePlugin()
151
+	{
152
+		if (!$this->_modulePlugin) {
153
+			global $smartobjectRatingHandler;
154
+			$this->_modulePlugin = $smartobjectRatingHandler->pluginsObject->getPlugin($this->getVar('dirname', 'n'));
155
+		}
156
+
157
+		return $this->_modulePlugin;
158
+	}
159 159
 }
160 160
 
161 161
 /**
@@ -163,93 +163,93 @@  discard block
 block discarded – undo
163 163
  */
164 164
 class SmartobjectRatingHandler extends SmartPersistableObjectHandler
165 165
 {
166
-    public $_rateOptions = array();
167
-    public $_moduleList  = false;
168
-    public $pluginsObject;
169
-
170
-    /**
171
-     * SmartobjectRatingHandler constructor.
172
-     * @param XoopsDatabase $db
173
-     */
174
-    public function __construct(XoopsDatabase $db)
175
-    {
176
-        parent::__construct($db, 'rating', 'ratingid', 'rate', '', 'smartobject');
177
-        $this->generalSQL = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname . ' INNER JOIN ' . $this->db->prefix('users') . ' AS user ON ' . $this->_itemname . '.uid=user.uid';
178
-
179
-        $this->_rateOptions[1] = 1;
180
-        $this->_rateOptions[2] = 2;
181
-        $this->_rateOptions[3] = 3;
182
-        $this->_rateOptions[4] = 4;
183
-        $this->_rateOptions[5] = 5;
184
-
185
-        $this->pluginsObject = new SmartPluginHandler();
186
-    }
187
-
188
-    /**
189
-     * @return bool
190
-     */
191
-    public function getModuleList()
192
-    {
193
-        if (!$this->_moduleList) {
194
-            $moduleArray          = $this->pluginsObject->getPluginsArray();
195
-            $this->_moduleList[0] = _CO_SOBJECT_MAKE_SELECTION;
196
-            foreach ($moduleArray as $k => $v) {
197
-                $this->_moduleList[$k] = $v;
198
-            }
199
-        }
200
-
201
-        return $this->_moduleList;
202
-    }
203
-
204
-    /**
205
-     * @return array
206
-     */
207
-    public function getRateList()
208
-    {
209
-        return $this->_rateOptions;
210
-    }
211
-
212
-    /**
213
-     * @param $itemid
214
-     * @param $dirname
215
-     * @param $item
216
-     * @return int
217
-     */
218
-    public function getRatingAverageByItemId($itemid, $dirname, $item)
219
-    {
220
-        $sql    = 'SELECT AVG(rate), COUNT(ratingid) FROM ' . $this->table . " WHERE itemid=$itemid AND dirname='$dirname' AND item='$item' GROUP BY itemid";
221
-        $result = $this->db->query($sql);
222
-        if (!$result) {
223
-            return 0;
224
-        }
225
-        list($average, $sum) = $this->db->fetchRow($result);
226
-        $ret['average'] = isset($average) ? $average : 0;
227
-        $ret['sum']     = isset($sum) ? $sum : 0;
228
-
229
-        return $ret;
230
-    }
231
-
232
-    /**
233
-     * @param $item
234
-     * @param $itemid
235
-     * @param $dirname
236
-     * @param $uid
237
-     * @return bool
238
-     */
239
-    public function already_rated($item, $itemid, $dirname, $uid)
240
-    {
241
-        $criteria = new CriteriaCompo();
242
-        $criteria->add(new Criteria('item', $item));
243
-        $criteria->add(new Criteria('itemid', $itemid));
244
-        $criteria->add(new Criteria('dirname', $dirname));
245
-        $criteria->add(new Criteria('user.uid', $uid));
246
-
247
-        $ret = $this->getObjects($criteria);
248
-
249
-        if (!$ret) {
250
-            return false;
251
-        } else {
252
-            return $ret[0];
253
-        }
254
-    }
166
+	public $_rateOptions = array();
167
+	public $_moduleList  = false;
168
+	public $pluginsObject;
169
+
170
+	/**
171
+	 * SmartobjectRatingHandler constructor.
172
+	 * @param XoopsDatabase $db
173
+	 */
174
+	public function __construct(XoopsDatabase $db)
175
+	{
176
+		parent::__construct($db, 'rating', 'ratingid', 'rate', '', 'smartobject');
177
+		$this->generalSQL = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname . ' INNER JOIN ' . $this->db->prefix('users') . ' AS user ON ' . $this->_itemname . '.uid=user.uid';
178
+
179
+		$this->_rateOptions[1] = 1;
180
+		$this->_rateOptions[2] = 2;
181
+		$this->_rateOptions[3] = 3;
182
+		$this->_rateOptions[4] = 4;
183
+		$this->_rateOptions[5] = 5;
184
+
185
+		$this->pluginsObject = new SmartPluginHandler();
186
+	}
187
+
188
+	/**
189
+	 * @return bool
190
+	 */
191
+	public function getModuleList()
192
+	{
193
+		if (!$this->_moduleList) {
194
+			$moduleArray          = $this->pluginsObject->getPluginsArray();
195
+			$this->_moduleList[0] = _CO_SOBJECT_MAKE_SELECTION;
196
+			foreach ($moduleArray as $k => $v) {
197
+				$this->_moduleList[$k] = $v;
198
+			}
199
+		}
200
+
201
+		return $this->_moduleList;
202
+	}
203
+
204
+	/**
205
+	 * @return array
206
+	 */
207
+	public function getRateList()
208
+	{
209
+		return $this->_rateOptions;
210
+	}
211
+
212
+	/**
213
+	 * @param $itemid
214
+	 * @param $dirname
215
+	 * @param $item
216
+	 * @return int
217
+	 */
218
+	public function getRatingAverageByItemId($itemid, $dirname, $item)
219
+	{
220
+		$sql    = 'SELECT AVG(rate), COUNT(ratingid) FROM ' . $this->table . " WHERE itemid=$itemid AND dirname='$dirname' AND item='$item' GROUP BY itemid";
221
+		$result = $this->db->query($sql);
222
+		if (!$result) {
223
+			return 0;
224
+		}
225
+		list($average, $sum) = $this->db->fetchRow($result);
226
+		$ret['average'] = isset($average) ? $average : 0;
227
+		$ret['sum']     = isset($sum) ? $sum : 0;
228
+
229
+		return $ret;
230
+	}
231
+
232
+	/**
233
+	 * @param $item
234
+	 * @param $itemid
235
+	 * @param $dirname
236
+	 * @param $uid
237
+	 * @return bool
238
+	 */
239
+	public function already_rated($item, $itemid, $dirname, $uid)
240
+	{
241
+		$criteria = new CriteriaCompo();
242
+		$criteria->add(new Criteria('item', $item));
243
+		$criteria->add(new Criteria('itemid', $itemid));
244
+		$criteria->add(new Criteria('dirname', $dirname));
245
+		$criteria->add(new Criteria('user.uid', $uid));
246
+
247
+		$ret = $this->getObjects($criteria);
248
+
249
+		if (!$ret) {
250
+			return false;
251
+		} else {
252
+			return $ret[0];
253
+		}
254
+	}
255 255
 }
Please login to merge, or discard this patch.
class/urllink.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -8,22 +8,22 @@  discard block
 block discarded – undo
8 8
  */
9 9
 class SmartobjectUrlLink extends SmartobjectBasedUrl
10 10
 {
11
-    /**
12
-     * SmartobjectUrlLink constructor.
13
-     */
14
-    public function __construct()
15
-    {
16
-        parent::__construct();
17
-        $this->quickInitVar('urllinkid', XOBJ_DTYPE_TXTBOX, true);
18
-        $this->quickInitVar('target', XOBJ_DTYPE_TXTBOX, true);
11
+	/**
12
+	 * SmartobjectUrlLink constructor.
13
+	 */
14
+	public function __construct()
15
+	{
16
+		parent::__construct();
17
+		$this->quickInitVar('urllinkid', XOBJ_DTYPE_TXTBOX, true);
18
+		$this->quickInitVar('target', XOBJ_DTYPE_TXTBOX, true);
19 19
 
20
-        $this->setControl('target', array(
21
-            'options' => array(
22
-                '_self'  => _CO_SOBJECT_URLLINK_SELF,
23
-                '_blank' => _CO_SOBJECT_URLLINK_BLANK
24
-            )
25
-        ));
26
-    }
20
+		$this->setControl('target', array(
21
+			'options' => array(
22
+				'_self'  => _CO_SOBJECT_URLLINK_SELF,
23
+				'_blank' => _CO_SOBJECT_URLLINK_BLANK
24
+			)
25
+		));
26
+	}
27 27
 }
28 28
 
29 29
 /**
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
  */
32 32
 class SmartobjectUrlLinkHandler extends SmartPersistableObjectHandler
33 33
 {
34
-    /**
35
-     * SmartobjectUrlLinkHandler constructor.
36
-     * @param XoopsDatabase $db
37
-     */
38
-    public function __construct(XoopsDatabase $db)
39
-    {
40
-        parent::__construct($db, 'urllink', 'urllinkid', 'caption', 'desc', 'smartobject');
41
-    }
34
+	/**
35
+	 * SmartobjectUrlLinkHandler constructor.
36
+	 * @param XoopsDatabase $db
37
+	 */
38
+	public function __construct(XoopsDatabase $db)
39
+	{
40
+		parent::__construct($db, 'urllink', 'urllinkid', 'caption', 'desc', 'smartobject');
41
+	}
42 42
 }
Please login to merge, or discard this patch.
class/smarthighlighter.php 1 patch
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -19,96 +19,96 @@
 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/smartuploader.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -89,51 +89,51 @@
 block discarded – undo
89 89
  */
90 90
 class SmartUploader extends XoopsMediaUploader
91 91
 {
92
-    public $ext;
93
-    public $dimension;
92
+	public $ext;
93
+	public $dimension;
94 94
 
95
-    /**
96
-     * No admin check for uploads
97
-     */
98
-    public $noAdminSizeCheck;
95
+	/**
96
+	 * No admin check for uploads
97
+	 */
98
+	public $noAdminSizeCheck;
99 99
 
100
-    /**
101
-     * Constructor
102
-     *
103
-     * @param string    $uploadDir
104
-     * @param array|int $allowedMimeTypes
105
-     * @param int       $maxFileSize
106
-     * @param int       $maxWidth
107
-     * @param int       $maxHeight
108
-     * @internal param int $cmodvalue
109
-     */
110
-    public function __construct($uploadDir, $allowedMimeTypes = 0, $maxFileSize, $maxWidth = 0, $maxHeight = 0)
111
-    {
112
-        parent::__construct($uploadDir, $allowedMimeTypes, $maxFileSize, $maxWidth, $maxHeight);
113
-    }
100
+	/**
101
+	 * Constructor
102
+	 *
103
+	 * @param string    $uploadDir
104
+	 * @param array|int $allowedMimeTypes
105
+	 * @param int       $maxFileSize
106
+	 * @param int       $maxWidth
107
+	 * @param int       $maxHeight
108
+	 * @internal param int $cmodvalue
109
+	 */
110
+	public function __construct($uploadDir, $allowedMimeTypes = 0, $maxFileSize, $maxWidth = 0, $maxHeight = 0)
111
+	{
112
+		parent::__construct($uploadDir, $allowedMimeTypes, $maxFileSize, $maxWidth, $maxHeight);
113
+	}
114 114
 
115
-    /**
116
-     * @param $value
117
-     */
118
-    public function noAdminSizeCheck($value)
119
-    {
120
-        $this->noAdminSizeCheck = $value;
121
-    }
115
+	/**
116
+	 * @param $value
117
+	 */
118
+	public function noAdminSizeCheck($value)
119
+	{
120
+		$this->noAdminSizeCheck = $value;
121
+	}
122 122
 
123
-    /**
124
-     * Is the file the right size?
125
-     *
126
-     * @return bool
127
-     */
128
-    public function checkMaxFileSize()
129
-    {
130
-        if ($this->noAdminSizeCheck) {
131
-            return true;
132
-        }
133
-        if ($this->mediaSize > $this->maxFileSize) {
134
-            return false;
135
-        }
123
+	/**
124
+	 * Is the file the right size?
125
+	 *
126
+	 * @return bool
127
+	 */
128
+	public function checkMaxFileSize()
129
+	{
130
+		if ($this->noAdminSizeCheck) {
131
+			return true;
132
+		}
133
+		if ($this->mediaSize > $this->maxFileSize) {
134
+			return false;
135
+		}
136 136
 
137
-        return true;
138
-    }
137
+		return true;
138
+	}
139 139
 }
Please login to merge, or discard this patch.
class/form/elements/smartformuser_sigelement.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -12,23 +12,23 @@
 block discarded – undo
12 12
 
13 13
 class SmartFormUser_sigElement extends XoopsFormElementTray
14 14
 {
15
-    /**
16
-     * SmartFormUser_sigElement constructor.
17
-     * @param string $object
18
-     * @param string $key
19
-     */
20
-    public function __construct($object, $key)
21
-    {
22
-        $var     = $object->vars[$key];
23
-        $control = $object->controls[$key];
15
+	/**
16
+	 * SmartFormUser_sigElement constructor.
17
+	 * @param string $object
18
+	 * @param string $key
19
+	 */
20
+	public function __construct($object, $key)
21
+	{
22
+		$var     = $object->vars[$key];
23
+		$control = $object->controls[$key];
24 24
 
25
-        parent::__construct($var['form_caption'], '<br><br>', $key . '_signature_tray');
25
+		parent::__construct($var['form_caption'], '<br><br>', $key . '_signature_tray');
26 26
 
27
-        $signature_textarea = new XoopsFormDhtmlTextArea('', $key, $object->getVar($key, 'e'));
28
-        $this->addElement($signature_textarea);
27
+		$signature_textarea = new XoopsFormDhtmlTextArea('', $key, $object->getVar($key, 'e'));
28
+		$this->addElement($signature_textarea);
29 29
 
30
-        $attach_checkbox = new XoopsFormCheckBox('', 'attachsig', $object->getVar('attachsig', 'e'));
31
-        $attach_checkbox->addOption(1, _US_SHOWSIG);
32
-        $this->addElement($attach_checkbox);
33
-    }
30
+		$attach_checkbox = new XoopsFormCheckBox('', 'attachsig', $object->getVar('attachsig', 'e'));
31
+		$attach_checkbox->addOption(1, _US_SHOWSIG);
32
+		$this->addElement($attach_checkbox);
33
+	}
34 34
 }
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/smartformtimeelement.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -11,23 +11,23 @@
 block discarded – undo
11 11
  */
12 12
 class SmartFormTimeElement extends XoopsFormSelect
13 13
 {
14
-    /**
15
-     * SmartFormTimeElement constructor.
16
-     * @param string $object
17
-     * @param string $key
18
-     */
19
-    public function __construct($object, $key)
20
-    {
21
-        $var       = $object->vars[$key];
22
-        $timearray = array();
23
-        for ($i = 0; $i < 24; ++$i) {
24
-            for ($j = 0; $j < 60; $j += 10) {
25
-                $key_t             = ($i * 3600) + ($j * 60);
26
-                $timearray[$key_t] = ($j != 0) ? $i . ':' . $j : $i . ':0' . $j;
27
-            }
28
-        }
29
-        ksort($timearray);
30
-        parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e'));
31
-        $this->addOptionArray($timearray);
32
-    }
14
+	/**
15
+	 * SmartFormTimeElement constructor.
16
+	 * @param string $object
17
+	 * @param string $key
18
+	 */
19
+	public function __construct($object, $key)
20
+	{
21
+		$var       = $object->vars[$key];
22
+		$timearray = array();
23
+		for ($i = 0; $i < 24; ++$i) {
24
+			for ($j = 0; $j < 60; $j += 10) {
25
+				$key_t             = ($i * 3600) + ($j * 60);
26
+				$timearray[$key_t] = ($j != 0) ? $i . ':' . $j : $i . ':0' . $j;
27
+			}
28
+		}
29
+		ksort($timearray);
30
+		parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e'));
31
+		$this->addOptionArray($timearray);
32
+	}
33 33
 }
Please login to merge, or discard this patch.