Completed
Push — master ( bf34f3...88111b )
by Michael
03:08
created
class/SmartobjectTag.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -28,17 +28,17 @@
 block discarded – undo
28 28
  */
29 29
 class SmartobjectTag extends SmartMlObject
30 30
 {
31
-    /**
32
-     * SmartobjectTag constructor.
33
-     */
34
-    public function __construct()
35
-    {
36
-        $this->initVar('tagid', XOBJ_DTYPE_INT, '', true);
37
-        $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', true, 255, '', false, _CO_SOBJECT_TAG_TAGID_CAPTION, _CO_SOBJECT_TAG_TAGID_DSC, true);
38
-        $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', true, null, '', false, _CO_SOBJECT_TAG_DESCRIPTION_CAPTION, _CO_SOBJECT_TAG_DESCRIPTION_DSC);
39
-        $this->initVar('value', XOBJ_DTYPE_TXTAREA, '', true, null, '', true, _CO_SOBJECT_TAG_VALUE_CAPTION, _CO_SOBJECT_TAG_VALUE_DSC);
31
+	/**
32
+	 * SmartobjectTag constructor.
33
+	 */
34
+	public function __construct()
35
+	{
36
+		$this->initVar('tagid', XOBJ_DTYPE_INT, '', true);
37
+		$this->initVar('name', XOBJ_DTYPE_TXTBOX, '', true, 255, '', false, _CO_SOBJECT_TAG_TAGID_CAPTION, _CO_SOBJECT_TAG_TAGID_DSC, true);
38
+		$this->initVar('description', XOBJ_DTYPE_TXTAREA, '', true, null, '', false, _CO_SOBJECT_TAG_DESCRIPTION_CAPTION, _CO_SOBJECT_TAG_DESCRIPTION_DSC);
39
+		$this->initVar('value', XOBJ_DTYPE_TXTAREA, '', true, null, '', true, _CO_SOBJECT_TAG_VALUE_CAPTION, _CO_SOBJECT_TAG_VALUE_DSC);
40 40
 
41
-        // call parent constructor to get Multilanguage field initiated
42
-        $this->SmartMlObject();
43
-    }
41
+		// call parent constructor to get Multilanguage field initiated
42
+		$this->SmartMlObject();
43
+	}
44 44
 }
Please login to merge, or discard this patch.
class/SmartObjectRow.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -22,37 +22,37 @@
 block discarded – undo
22 22
  */
23 23
 class SmartObjectRow
24 24
 {
25
-    public $_keyname;
26
-    public $_align;
27
-    public $_customMethodForValue;
28
-    public $_header;
29
-    public $_class;
25
+	public $_keyname;
26
+	public $_align;
27
+	public $_customMethodForValue;
28
+	public $_header;
29
+	public $_class;
30 30
 
31
-    /**
32
-     * SmartObjectRow constructor.
33
-     * @param      $keyname
34
-     * @param bool $customMethodForValue
35
-     * @param bool $header
36
-     * @param bool $class
37
-     */
38
-    public function __construct($keyname, $customMethodForValue = false, $header = false, $class = false)
39
-    {
40
-        $this->_keyname              = $keyname;
41
-        $this->_customMethodForValue = $customMethodForValue;
42
-        $this->_header               = $header;
43
-        $this->_class                = $class;
44
-    }
31
+	/**
32
+	 * SmartObjectRow constructor.
33
+	 * @param      $keyname
34
+	 * @param bool $customMethodForValue
35
+	 * @param bool $header
36
+	 * @param bool $class
37
+	 */
38
+	public function __construct($keyname, $customMethodForValue = false, $header = false, $class = false)
39
+	{
40
+		$this->_keyname              = $keyname;
41
+		$this->_customMethodForValue = $customMethodForValue;
42
+		$this->_header               = $header;
43
+		$this->_class                = $class;
44
+	}
45 45
 
46
-    public function getKeyName()
47
-    {
48
-        return $this->_keyname;
49
-    }
46
+	public function getKeyName()
47
+	{
48
+		return $this->_keyname;
49
+	}
50 50
 
51
-    /**
52
-     * @return bool
53
-     */
54
-    public function isHeader()
55
-    {
56
-        return $this->_header;
57
-    }
51
+	/**
52
+	 * @return bool
53
+	 */
54
+	public function isHeader()
55
+	{
56
+		return $this->_header;
57
+	}
58 58
 }
Please login to merge, or discard this patch.
class/SmartobjectTagHandler.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -29,27 +29,27 @@
 block discarded – undo
29 29
  */
30 30
 class SmartobjectTagHandler extends Smartobject\SmartPersistableMlObjectHandler
31 31
 {
32
-    /**
33
-     * SmartobjectTagHandler constructor.
34
-     * @param \XoopsDatabase $db
35
-     */
36
-    public function __construct(\XoopsDatabase $db)
37
-    {
38
-        parent::__construct($db, 'tag', 'tagid', 'name', 'description', 'smartobject');
39
-    }
32
+	/**
33
+	 * SmartobjectTagHandler constructor.
34
+	 * @param \XoopsDatabase $db
35
+	 */
36
+	public function __construct(\XoopsDatabase $db)
37
+	{
38
+		parent::__construct($db, 'tag', 'tagid', 'name', 'description', 'smartobject');
39
+	}
40 40
 
41
-    /**
42
-     * @return mixed
43
-     */
44
-    public function getLanguages()
45
-    {
46
-        require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
47
-        $aLanguages     = XoopsLists::getLangList();
48
-        $ret['default'] = _CO_SOBJECT_ALL;
49
-        foreach ($aLanguages as $lang) {
50
-            $ret[$lang] = $lang;
51
-        }
41
+	/**
42
+	 * @return mixed
43
+	 */
44
+	public function getLanguages()
45
+	{
46
+		require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
47
+		$aLanguages     = XoopsLists::getLangList();
48
+		$ret['default'] = _CO_SOBJECT_ALL;
49
+		foreach ($aLanguages as $lang) {
50
+			$ret[$lang] = $lang;
51
+		}
52 52
 
53
-        return $ret;
54
-    }
53
+		return $ret;
54
+	}
55 55
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
      */
44 44
     public function getLanguages()
45 45
     {
46
-        require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
46
+        require_once XOOPS_ROOT_PATH.'/class/xoopslists.php';
47 47
         $aLanguages     = XoopsLists::getLangList();
48 48
         $ret['default'] = _CO_SOBJECT_ALL;
49 49
         foreach ($aLanguages as $lang) {
Please login to merge, or discard this patch.
class/SmartObjectsRegistry.php 1 patch
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -34,169 +34,169 @@
 block discarded – undo
34 34
  */
35 35
 class SmartObjectsRegistry
36 36
 {
37
-    public $_registryArray;
38
-
39
-    /**
40
-     * Access the only instance of this class
41
-     *
42
-     * @return \XoopsModules\Smartobject\SmartObjectsRegistry
43
-     *
44
-     * @static
45
-     * @staticvar   object
46
-     */
47
-    public static function getInstance()
48
-    {
49
-        static $instance;
50
-        if (null === $instance) {
51
-            $instance = new static();
52
-        }
53
-
54
-        return $instance;
55
-    }
56
-
57
-    /**
58
-     * Adding objects to the registry
59
-     *
60
-     * @param  SmartPersistableObjectHandler $handler  of the objects to add
61
-     * @param  bool|CriteriaCompo            $criteria to pass to the getObjects method of the handler (with id_as_key)
62
-     * @return FALSE                         if an error occured
63
-     */
64
-    public function addObjectsFromHandler(&$handler, $criteria = false)
65
-    {
66
-        if (method_exists($handler, 'getObjects')) {
67
-            $objects                                                                     = $handler->getObjects($criteria, true);
68
-            $this->_registryArray['objects'][$handler->_moduleName][$handler->_itemname] = $objects;
69
-
70
-            return $objects;
71
-        } else {
72
-            return false;
73
-        }
74
-    }
75
-
76
-    /**
77
-     * Adding objects to the registry from an item name
78
-     * This method will fetch the handler of the item / module and call the addObjectsFromHandler
79
-     *
80
-     * @param  string             $item       name of the item
81
-     * @param  bool|string        $modulename name of the module
82
-     * @param  bool|CriteriaCompo $criteria   to pass to the getObjects method of the handler (with id_as_key)
83
-     * @return FALSE              if an error occured
84
-     */
85
-    public function addObjectsFromItemName($item, $modulename = false, $criteria = false)
86
-    {
87
-        if (!$modulename) {
88
-            global $xoopsModule;
89
-            if (!is_object($xoopsModule)) {
90
-                return false;
91
-            } else {
92
-                $modulename = $xoopsModule->dirname();
93
-            }
94
-        }
95
-        $objectHandler = xoops_getModuleHandler($item, $modulename);
96
-
97
-        if (method_exists($objectHandler, 'getObjects')) {
98
-            $objects                                                                                 = $objectHandler->getObjects($criteria, true);
99
-            $this->_registryArray['objects'][$objectHandler->_moduleName][$objectHandler->_itemname] = $objects;
100
-
101
-            return $objects;
102
-        } else {
103
-            return false;
104
-        }
105
-    }
106
-
107
-    /**
108
-     * Fetching objects from the registry
109
-     *
110
-     * @param string $itemname
111
-     * @param string $modulename
112
-     *
113
-     * @return false|array the requested objects or FALSE if they don't exists in the registry
114
-     */
115
-    public function getObjects($itemname, $modulename)
116
-    {
117
-        if (!$modulename) {
118
-            global $xoopsModule;
119
-            if (!is_object($xoopsModule)) {
120
-                return false;
121
-            } else {
122
-                $modulename = $xoopsModule->dirname();
123
-            }
124
-        }
125
-        if (isset($this->_registryArray['objects'][$modulename][$itemname])) {
126
-            return $this->_registryArray['objects'][$modulename][$itemname];
127
-        } else {
128
-            // if they were not in registry, let's fetch them and add them to the reigistry
129
-            $moduleHandler = xoops_getModuleHandler($itemname, $modulename);
130
-            if (method_exists($moduleHandler, 'getObjects')) {
131
-                $objects = $moduleHandler->getObjects();
132
-            }
133
-            $this->_registryArray['objects'][$modulename][$itemname] = $objects;
134
-
135
-            return $objects;
136
-        }
137
-    }
138
-
139
-    /**
140
-     * Fetching objects from the registry, as a list: objectid => identifier
141
-     *
142
-     * @param string $itemname
143
-     * @param string $modulename
144
-     *
145
-     * @return false|array the requested objects or FALSE if they don't exists in the registry
146
-     */
147
-    public function getList($itemname, $modulename)
148
-    {
149
-        if (!$modulename) {
150
-            global $xoopsModule;
151
-            if (!is_object($xoopsModule)) {
152
-                return false;
153
-            } else {
154
-                $modulename = $xoopsModule->dirname();
155
-            }
156
-        }
157
-        if (isset($this->_registryArray['list'][$modulename][$itemname])) {
158
-            return $this->_registryArray['list'][$modulename][$itemname];
159
-        } else {
160
-            // if they were not in registry, let's fetch them and add them to the reigistry
161
-            $moduleHandler = xoops_getModuleHandler($itemname, $modulename);
162
-            if (method_exists($moduleHandler, 'getList')) {
163
-                $objects = $moduleHandler->getList();
164
-            }
165
-            $this->_registryArray['list'][$modulename][$itemname] = $objects;
166
-
167
-            return $objects;
168
-        }
169
-    }
170
-
171
-    /**
172
-     * Retreive a single object
173
-     *
174
-     * @param string $itemname
175
-     * @param string $key
176
-     *
177
-     * @param  bool  $modulename
178
-     * @return false|\XoopsObject the  requestd object or FALSE if they don't exists in the registry
179
-     */
180
-    public function getSingleObject($itemname, $key, $modulename = false)
181
-    {
182
-        if (!$modulename) {
183
-            global $xoopsModule;
184
-            if (!is_object($xoopsModule)) {
185
-                return false;
186
-            } else {
187
-                $modulename = $xoopsModule->dirname();
188
-            }
189
-        }
190
-        if (isset($this->_registryArray['objects'][$modulename][$itemname][$key])) {
191
-            return $this->_registryArray['objects'][$modulename][$itemname][$key];
192
-        } else {
193
-            $objectHandler = xoops_getModuleHandler($itemname, $modulename);
194
-            $object        = $objectHandler->get($key);
195
-            if (!$object->isNew()) {
196
-                return $object;
197
-            } else {
198
-                return false;
199
-            }
200
-        }
201
-    }
37
+	public $_registryArray;
38
+
39
+	/**
40
+	 * Access the only instance of this class
41
+	 *
42
+	 * @return \XoopsModules\Smartobject\SmartObjectsRegistry
43
+	 *
44
+	 * @static
45
+	 * @staticvar   object
46
+	 */
47
+	public static function getInstance()
48
+	{
49
+		static $instance;
50
+		if (null === $instance) {
51
+			$instance = new static();
52
+		}
53
+
54
+		return $instance;
55
+	}
56
+
57
+	/**
58
+	 * Adding objects to the registry
59
+	 *
60
+	 * @param  SmartPersistableObjectHandler $handler  of the objects to add
61
+	 * @param  bool|CriteriaCompo            $criteria to pass to the getObjects method of the handler (with id_as_key)
62
+	 * @return FALSE                         if an error occured
63
+	 */
64
+	public function addObjectsFromHandler(&$handler, $criteria = false)
65
+	{
66
+		if (method_exists($handler, 'getObjects')) {
67
+			$objects                                                                     = $handler->getObjects($criteria, true);
68
+			$this->_registryArray['objects'][$handler->_moduleName][$handler->_itemname] = $objects;
69
+
70
+			return $objects;
71
+		} else {
72
+			return false;
73
+		}
74
+	}
75
+
76
+	/**
77
+	 * Adding objects to the registry from an item name
78
+	 * This method will fetch the handler of the item / module and call the addObjectsFromHandler
79
+	 *
80
+	 * @param  string             $item       name of the item
81
+	 * @param  bool|string        $modulename name of the module
82
+	 * @param  bool|CriteriaCompo $criteria   to pass to the getObjects method of the handler (with id_as_key)
83
+	 * @return FALSE              if an error occured
84
+	 */
85
+	public function addObjectsFromItemName($item, $modulename = false, $criteria = false)
86
+	{
87
+		if (!$modulename) {
88
+			global $xoopsModule;
89
+			if (!is_object($xoopsModule)) {
90
+				return false;
91
+			} else {
92
+				$modulename = $xoopsModule->dirname();
93
+			}
94
+		}
95
+		$objectHandler = xoops_getModuleHandler($item, $modulename);
96
+
97
+		if (method_exists($objectHandler, 'getObjects')) {
98
+			$objects                                                                                 = $objectHandler->getObjects($criteria, true);
99
+			$this->_registryArray['objects'][$objectHandler->_moduleName][$objectHandler->_itemname] = $objects;
100
+
101
+			return $objects;
102
+		} else {
103
+			return false;
104
+		}
105
+	}
106
+
107
+	/**
108
+	 * Fetching objects from the registry
109
+	 *
110
+	 * @param string $itemname
111
+	 * @param string $modulename
112
+	 *
113
+	 * @return false|array the requested objects or FALSE if they don't exists in the registry
114
+	 */
115
+	public function getObjects($itemname, $modulename)
116
+	{
117
+		if (!$modulename) {
118
+			global $xoopsModule;
119
+			if (!is_object($xoopsModule)) {
120
+				return false;
121
+			} else {
122
+				$modulename = $xoopsModule->dirname();
123
+			}
124
+		}
125
+		if (isset($this->_registryArray['objects'][$modulename][$itemname])) {
126
+			return $this->_registryArray['objects'][$modulename][$itemname];
127
+		} else {
128
+			// if they were not in registry, let's fetch them and add them to the reigistry
129
+			$moduleHandler = xoops_getModuleHandler($itemname, $modulename);
130
+			if (method_exists($moduleHandler, 'getObjects')) {
131
+				$objects = $moduleHandler->getObjects();
132
+			}
133
+			$this->_registryArray['objects'][$modulename][$itemname] = $objects;
134
+
135
+			return $objects;
136
+		}
137
+	}
138
+
139
+	/**
140
+	 * Fetching objects from the registry, as a list: objectid => identifier
141
+	 *
142
+	 * @param string $itemname
143
+	 * @param string $modulename
144
+	 *
145
+	 * @return false|array the requested objects or FALSE if they don't exists in the registry
146
+	 */
147
+	public function getList($itemname, $modulename)
148
+	{
149
+		if (!$modulename) {
150
+			global $xoopsModule;
151
+			if (!is_object($xoopsModule)) {
152
+				return false;
153
+			} else {
154
+				$modulename = $xoopsModule->dirname();
155
+			}
156
+		}
157
+		if (isset($this->_registryArray['list'][$modulename][$itemname])) {
158
+			return $this->_registryArray['list'][$modulename][$itemname];
159
+		} else {
160
+			// if they were not in registry, let's fetch them and add them to the reigistry
161
+			$moduleHandler = xoops_getModuleHandler($itemname, $modulename);
162
+			if (method_exists($moduleHandler, 'getList')) {
163
+				$objects = $moduleHandler->getList();
164
+			}
165
+			$this->_registryArray['list'][$modulename][$itemname] = $objects;
166
+
167
+			return $objects;
168
+		}
169
+	}
170
+
171
+	/**
172
+	 * Retreive a single object
173
+	 *
174
+	 * @param string $itemname
175
+	 * @param string $key
176
+	 *
177
+	 * @param  bool  $modulename
178
+	 * @return false|\XoopsObject the  requestd object or FALSE if they don't exists in the registry
179
+	 */
180
+	public function getSingleObject($itemname, $key, $modulename = false)
181
+	{
182
+		if (!$modulename) {
183
+			global $xoopsModule;
184
+			if (!is_object($xoopsModule)) {
185
+				return false;
186
+			} else {
187
+				$modulename = $xoopsModule->dirname();
188
+			}
189
+		}
190
+		if (isset($this->_registryArray['objects'][$modulename][$itemname][$key])) {
191
+			return $this->_registryArray['objects'][$modulename][$itemname][$key];
192
+		} else {
193
+			$objectHandler = xoops_getModuleHandler($itemname, $modulename);
194
+			$object        = $objectHandler->get($key);
195
+			if (!$object->isNew()) {
196
+				return $object;
197
+			} else {
198
+				return false;
199
+			}
200
+		}
201
+	}
202 202
 }
Please login to merge, or discard this patch.
class/SmartobjectUrlLinkHandler.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@
 block discarded – undo
30 30
  */
31 31
 class SmartobjectUrlLinkHandler extends Smartobject\SmartPersistableObjectHandler
32 32
 {
33
-    /**
34
-     * SmartobjectUrlLinkHandler constructor.
35
-     * @param \XoopsDatabase $db
36
-     */
37
-    public function __construct(\XoopsDatabase $db)
38
-    {
39
-        parent::__construct($db, 'urllink', 'urllinkid', 'caption', 'desc', 'smartobject');
40
-    }
33
+	/**
34
+	 * SmartobjectUrlLinkHandler constructor.
35
+	 * @param \XoopsDatabase $db
36
+	 */
37
+	public function __construct(\XoopsDatabase $db)
38
+	{
39
+		parent::__construct($db, 'urllink', 'urllinkid', 'caption', 'desc', 'smartobject');
40
+	}
41 41
 }
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
@@ -28,44 +28,44 @@
 block discarded – undo
28 28
  */
29 29
 class SmartSeoObject extends Smartobject\BaseSmartObject
30 30
 {
31
-    /**
32
-     * SmartSeoObject constructor.
33
-     */
34
-    public function __construct()
35
-    {
36
-        $this->initCommonVar('meta_keywords');
37
-        $this->initCommonVar('meta_description');
38
-        $this->initCommonVar('short_url');
39
-        $this->seoEnabled = true;
40
-    }
31
+	/**
32
+	 * SmartSeoObject constructor.
33
+	 */
34
+	public function __construct()
35
+	{
36
+		$this->initCommonVar('meta_keywords');
37
+		$this->initCommonVar('meta_description');
38
+		$this->initCommonVar('short_url');
39
+		$this->seoEnabled = true;
40
+	}
41 41
 
42
-    /**
43
-     * Return the value of the short_url field of this object
44
-     *
45
-     * @return string
46
-     */
47
-    public function short_url()
48
-    {
49
-        return $this->getVar('short_url');
50
-    }
42
+	/**
43
+	 * Return the value of the short_url field of this object
44
+	 *
45
+	 * @return string
46
+	 */
47
+	public function short_url()
48
+	{
49
+		return $this->getVar('short_url');
50
+	}
51 51
 
52
-    /**
53
-     * Return the value of the meta_keywords field of this object
54
-     *
55
-     * @return string
56
-     */
57
-    public function meta_keywords()
58
-    {
59
-        return $this->getVar('meta_keywords');
60
-    }
52
+	/**
53
+	 * Return the value of the meta_keywords field of this object
54
+	 *
55
+	 * @return string
56
+	 */
57
+	public function meta_keywords()
58
+	{
59
+		return $this->getVar('meta_keywords');
60
+	}
61 61
 
62
-    /**
63
-     * Return the value of the meta_description field of this object
64
-     *
65
-     * @return string
66
-     */
67
-    public function meta_description()
68
-    {
69
-        return $this->getVar('meta_description');
70
-    }
62
+	/**
63
+	 * Return the value of the meta_description field of this object
64
+	 *
65
+	 * @return string
66
+	 */
67
+	public function meta_description()
68
+	{
69
+		return $this->getVar('meta_description');
70
+	}
71 71
 }
Please login to merge, or discard this patch.
class/SmartobjectAdsense.php 2 patches
Indentation   +194 added lines, -194 removed lines patch added patch discarded remove patch
@@ -29,87 +29,87 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class SmartobjectAdsense extends Smartobject\BaseSmartObject
31 31
 {
32
-    /**
33
-     * SmartobjectAdsense constructor.
34
-     */
35
-    public function __construct()
36
-    {
37
-        $this->quickInitVar('adsenseid', XOBJ_DTYPE_INT, true);
38
-        $this->quickInitVar('description', XOBJ_DTYPE_TXTAREA, true, _CO_SOBJECT_ADSENSE_DESCRIPTION, _CO_SOBJECT_ADSENSE_DESCRIPTION_DSC);
39
-        $this->quickInitVar('client_id', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_CLIENT_ID, _CO_SOBJECT_ADSENSE_CLIENT_ID_DSC);
40
-        $this->quickInitVar('tag', XOBJ_DTYPE_TXTBOX, false, _CO_SOBJECT_ADSENSE_TAG, _CO_SOBJECT_ADSENSE_TAG_DSC);
41
-        $this->quickInitVar('format', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_FORMAT, _CO_SOBJECT_ADSENSE_FORMAT_DSC);
42
-        $this->quickInitVar('border_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_BORDER_COLOR, _CO_SOBJECT_ADSENSE_BORDER_COLOR_DSC);
43
-        $this->quickInitVar('background_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_BACKGROUND_COLOR, _CO_SOBJECT_ADSENSE_BORDER_COLOR_DSC);
44
-        $this->quickInitVar('link_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_LINK_COLOR, _CO_SOBJECT_ADSENSE_LINK_COLOR_DSC);
45
-        $this->quickInitVar('url_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_URL_COLOR, _CO_SOBJECT_ADSENSE_URL_COLOR_DSC);
46
-        $this->quickInitVar('text_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_TEXT_COLOR, _CO_SOBJECT_ADSENSE_TEXT_COLOR_DSC);
47
-        $this->quickInitVar('style', XOBJ_DTYPE_TXTAREA, false, _CO_SOBJECT_ADSENSE_STYLE, _CO_SOBJECT_ADSENSE_STYLE_DSC);
32
+	/**
33
+	 * SmartobjectAdsense constructor.
34
+	 */
35
+	public function __construct()
36
+	{
37
+		$this->quickInitVar('adsenseid', XOBJ_DTYPE_INT, true);
38
+		$this->quickInitVar('description', XOBJ_DTYPE_TXTAREA, true, _CO_SOBJECT_ADSENSE_DESCRIPTION, _CO_SOBJECT_ADSENSE_DESCRIPTION_DSC);
39
+		$this->quickInitVar('client_id', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_CLIENT_ID, _CO_SOBJECT_ADSENSE_CLIENT_ID_DSC);
40
+		$this->quickInitVar('tag', XOBJ_DTYPE_TXTBOX, false, _CO_SOBJECT_ADSENSE_TAG, _CO_SOBJECT_ADSENSE_TAG_DSC);
41
+		$this->quickInitVar('format', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_FORMAT, _CO_SOBJECT_ADSENSE_FORMAT_DSC);
42
+		$this->quickInitVar('border_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_BORDER_COLOR, _CO_SOBJECT_ADSENSE_BORDER_COLOR_DSC);
43
+		$this->quickInitVar('background_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_BACKGROUND_COLOR, _CO_SOBJECT_ADSENSE_BORDER_COLOR_DSC);
44
+		$this->quickInitVar('link_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_LINK_COLOR, _CO_SOBJECT_ADSENSE_LINK_COLOR_DSC);
45
+		$this->quickInitVar('url_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_URL_COLOR, _CO_SOBJECT_ADSENSE_URL_COLOR_DSC);
46
+		$this->quickInitVar('text_color', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_ADSENSE_TEXT_COLOR, _CO_SOBJECT_ADSENSE_TEXT_COLOR_DSC);
47
+		$this->quickInitVar('style', XOBJ_DTYPE_TXTAREA, false, _CO_SOBJECT_ADSENSE_STYLE, _CO_SOBJECT_ADSENSE_STYLE_DSC);
48 48
 
49
-        $this->setControl('format', [
50
-            'handler' => 'adsense',
51
-            'method'  => 'getFormats'
52
-        ]);
49
+		$this->setControl('format', [
50
+			'handler' => 'adsense',
51
+			'method'  => 'getFormats'
52
+		]);
53 53
 
54
-        $this->setControl('border_color', [
55
-            'name'      => 'text',
56
-            'size'      => 6,
57
-            'maxlength' => 6
58
-        ]);
54
+		$this->setControl('border_color', [
55
+			'name'      => 'text',
56
+			'size'      => 6,
57
+			'maxlength' => 6
58
+		]);
59 59
 
60
-        $this->setControl('background_color', [
61
-            'name'      => 'text',
62
-            'size'      => 6,
63
-            'maxlength' => 6
64
-        ]);
60
+		$this->setControl('background_color', [
61
+			'name'      => 'text',
62
+			'size'      => 6,
63
+			'maxlength' => 6
64
+		]);
65 65
 
66
-        $this->setControl('link_color', [
67
-            'name'      => 'text',
68
-            'size'      => 6,
69
-            'maxlength' => 6
70
-        ]);
66
+		$this->setControl('link_color', [
67
+			'name'      => 'text',
68
+			'size'      => 6,
69
+			'maxlength' => 6
70
+		]);
71 71
 
72
-        $this->setControl('url_color', [
73
-            'name'      => 'text',
74
-            'size'      => 6,
75
-            'maxlength' => 6
76
-        ]);
72
+		$this->setControl('url_color', [
73
+			'name'      => 'text',
74
+			'size'      => 6,
75
+			'maxlength' => 6
76
+		]);
77 77
 
78
-        $this->setControl('text_color', [
79
-            'name'      => 'text',
80
-            'size'      => 6,
81
-            'maxlength' => 6
82
-        ]);
83
-    }
78
+		$this->setControl('text_color', [
79
+			'name'      => 'text',
80
+			'size'      => 6,
81
+			'maxlength' => 6
82
+		]);
83
+	}
84 84
 
85
-    /**
86
-     * @param  string $key
87
-     * @param  string $format
88
-     * @return mixed
89
-     */
90
-    public function getVar($key, $format = 's')
91
-    {
92
-        if ('s' === $format && in_array($key, [])) {
93
-            //            return call_user_func(array($this, $key));
94
-            return $this->{$key}();
95
-        }
85
+	/**
86
+	 * @param  string $key
87
+	 * @param  string $format
88
+	 * @return mixed
89
+	 */
90
+	public function getVar($key, $format = 's')
91
+	{
92
+		if ('s' === $format && in_array($key, [])) {
93
+			//            return call_user_func(array($this, $key));
94
+			return $this->{$key}();
95
+		}
96 96
 
97
-        return parent::getVar($key, $format);
98
-    }
97
+		return parent::getVar($key, $format);
98
+	}
99 99
 
100
-    /**
101
-     * @return string
102
-     */
103
-    public function render()
104
-    {
105
-        global $smartobjectAdsenseHandler;
106
-        if ('' !== $this->getVar('style', 'n')) {
107
-            $ret = '<div style="' . $this->getVar('style', 'n') . '">';
108
-        } else {
109
-            $ret = '<div>';
110
-        }
100
+	/**
101
+	 * @return string
102
+	 */
103
+	public function render()
104
+	{
105
+		global $smartobjectAdsenseHandler;
106
+		if ('' !== $this->getVar('style', 'n')) {
107
+			$ret = '<div style="' . $this->getVar('style', 'n') . '">';
108
+		} else {
109
+			$ret = '<div>';
110
+		}
111 111
 
112
-        $ret .= '<script type="text/javascript"><!--
112
+		$ret .= '<script type="text/javascript"><!--
113 113
 google_ad_client = "' . $this->getVar('client_id', 'n') . '";
114 114
 google_ad_width = ' . $smartobjectAdsenseHandler->adFormats[$this->getVar('format', 'n')]['width'] . ';
115 115
 google_ad_height = ' . $smartobjectAdsenseHandler->adFormats[$this->getVar('format', 'n')]['height'] . ';
@@ -127,137 +127,137 @@  discard block
 block discarded – undo
127 127
 </script>
128 128
 </div>';
129 129
 
130
-        return $ret;
131
-    }
130
+		return $ret;
131
+	}
132 132
 
133
-    /**
134
-     * @return string
135
-     */
136
-    public function getXoopsCode()
137
-    {
138
-        $ret = '[adsense]' . $this->getVar('tag', 'n') . '[/adsense]';
133
+	/**
134
+	 * @return string
135
+	 */
136
+	public function getXoopsCode()
137
+	{
138
+		$ret = '[adsense]' . $this->getVar('tag', 'n') . '[/adsense]';
139 139
 
140
-        return $ret;
141
-    }
140
+		return $ret;
141
+	}
142 142
 
143
-    /**
144
-     * @param $var
145
-     * @return bool
146
-     */
147
-    public function emptyString($var)
148
-    {
149
-        return (strlen($var) > 0);
150
-    }
143
+	/**
144
+	 * @param $var
145
+	 * @return bool
146
+	 */
147
+	public function emptyString($var)
148
+	{
149
+		return (strlen($var) > 0);
150
+	}
151 151
 
152
-    /**
153
-     * @return mixed|string
154
-     */
155
-    public function generateTag()
156
-    {
157
-        $title = rawurlencode(strtolower($this->getVar('description', 'e')));
158
-        $title = xoops_substr($title, 0, 10, '');
159
-        // Transformation des ponctuations
160
-        $pattern = [
161
-            '/%09/', // Tab
162
-            '/%20/', // Space
163
-            '/%21/', // !
164
-            '/%22/', // "
165
-            '/%23/', // #
166
-            '/%25/', // %
167
-            '/%26/', // &
168
-            '/%27/', // '
169
-            '/%28/', // (
170
-            '/%29/', // )
171
-            '/%2C/', // ,
172
-            '/%2F/', // /
173
-            '/%3A/', // :
174
-            '/%3B/', // ;
175
-            '/%3C/', // <
176
-            '/%3D/', // =
177
-            '/%3E/', // >
178
-            '/%3F/', // ?
179
-            '/%40/', // @
180
-            '/%5B/', // [
181
-            '/%5C/', // \
182
-            '/%5D/', // ]
183
-            '/%5E/', // ^
184
-            '/%7B/', // {
185
-            '/%7C/', // |
186
-            '/%7D/', // }
187
-            '/%7E/', // ~
188
-            "/\./" // .
189
-        ];
190
-        $rep_pat = [
191
-            '-',
192
-            '-',
193
-            '-',
194
-            '-',
195
-            '-',
196
-            '-100',
197
-            '-',
198
-            '-',
199
-            '-',
200
-            '-',
201
-            '-',
202
-            '-',
203
-            '-',
204
-            '-',
205
-            '-',
206
-            '-',
207
-            '-',
208
-            '-',
209
-            '-at-',
210
-            '-',
211
-            '-',
212
-            '-',
213
-            '-',
214
-            '-',
215
-            '-',
216
-            '-',
217
-            '-',
218
-            '-'
219
-        ];
220
-        $title   = preg_replace($pattern, $rep_pat, $title);
152
+	/**
153
+	 * @return mixed|string
154
+	 */
155
+	public function generateTag()
156
+	{
157
+		$title = rawurlencode(strtolower($this->getVar('description', 'e')));
158
+		$title = xoops_substr($title, 0, 10, '');
159
+		// Transformation des ponctuations
160
+		$pattern = [
161
+			'/%09/', // Tab
162
+			'/%20/', // Space
163
+			'/%21/', // !
164
+			'/%22/', // "
165
+			'/%23/', // #
166
+			'/%25/', // %
167
+			'/%26/', // &
168
+			'/%27/', // '
169
+			'/%28/', // (
170
+			'/%29/', // )
171
+			'/%2C/', // ,
172
+			'/%2F/', // /
173
+			'/%3A/', // :
174
+			'/%3B/', // ;
175
+			'/%3C/', // <
176
+			'/%3D/', // =
177
+			'/%3E/', // >
178
+			'/%3F/', // ?
179
+			'/%40/', // @
180
+			'/%5B/', // [
181
+			'/%5C/', // \
182
+			'/%5D/', // ]
183
+			'/%5E/', // ^
184
+			'/%7B/', // {
185
+			'/%7C/', // |
186
+			'/%7D/', // }
187
+			'/%7E/', // ~
188
+			"/\./" // .
189
+		];
190
+		$rep_pat = [
191
+			'-',
192
+			'-',
193
+			'-',
194
+			'-',
195
+			'-',
196
+			'-100',
197
+			'-',
198
+			'-',
199
+			'-',
200
+			'-',
201
+			'-',
202
+			'-',
203
+			'-',
204
+			'-',
205
+			'-',
206
+			'-',
207
+			'-',
208
+			'-',
209
+			'-at-',
210
+			'-',
211
+			'-',
212
+			'-',
213
+			'-',
214
+			'-',
215
+			'-',
216
+			'-',
217
+			'-',
218
+			'-'
219
+		];
220
+		$title   = preg_replace($pattern, $rep_pat, $title);
221 221
 
222
-        // Transformation des caractères accentués
223
-        $pattern = [
224
-            '/%B0/', // °
225
-            '/%E8/', // è
226
-            '/%E9/', // é
227
-            '/%EA/', // ê
228
-            '/%EB/', // ë
229
-            '/%E7/', // ç
230
-            '/%E0/', // à
231
-            '/%E2/', // â
232
-            '/%E4/', // ä
233
-            '/%EE/', // î
234
-            '/%EF/', // ï
235
-            '/%F9/', // ù
236
-            '/%FC/', // ü
237
-            '/%FB/', // û
238
-            '/%F4/', // ô
239
-            '/%F6/', // ö
240
-        ];
241
-        $rep_pat = ['-', 'e', 'e', 'e', 'e', 'c', 'a', 'a', 'a', 'i', 'i', 'u', 'u', 'u', 'o', 'o'];
242
-        $title   = preg_replace($pattern, $rep_pat, $title);
222
+		// Transformation des caractères accentués
223
+		$pattern = [
224
+			'/%B0/', // °
225
+			'/%E8/', // è
226
+			'/%E9/', // é
227
+			'/%EA/', // ê
228
+			'/%EB/', // ë
229
+			'/%E7/', // ç
230
+			'/%E0/', // à
231
+			'/%E2/', // â
232
+			'/%E4/', // ä
233
+			'/%EE/', // î
234
+			'/%EF/', // ï
235
+			'/%F9/', // ù
236
+			'/%FC/', // ü
237
+			'/%FB/', // û
238
+			'/%F4/', // ô
239
+			'/%F6/', // ö
240
+		];
241
+		$rep_pat = ['-', 'e', 'e', 'e', 'e', 'c', 'a', 'a', 'a', 'i', 'i', 'u', 'u', 'u', 'o', 'o'];
242
+		$title   = preg_replace($pattern, $rep_pat, $title);
243 243
 
244
-        $tableau = explode('-', $title); // Transforme la chaine de caract�res en tableau
245
-        $tableau = array_filter($tableau, [$this, 'emptyString']); // Supprime les chaines vides du tableau
246
-        $title   = implode('-', $tableau); // Transforme un tableau en chaine de caract�res s�par� par un tiret
244
+		$tableau = explode('-', $title); // Transforme la chaine de caract�res en tableau
245
+		$tableau = array_filter($tableau, [$this, 'emptyString']); // Supprime les chaines vides du tableau
246
+		$title   = implode('-', $tableau); // Transforme un tableau en chaine de caract�res s�par� par un tiret
247 247
 
248
-        $title .= time();
249
-        $title = md5($title);
248
+		$title .= time();
249
+		$title = md5($title);
250 250
 
251
-        return $title;
252
-    }
251
+		return $title;
252
+	}
253 253
 
254
-    /**
255
-     * @return string
256
-     */
257
-    public function getCloneLink()
258
-    {
259
-        $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>';
254
+	/**
255
+	 * @return string
256
+	 */
257
+	public function getCloneLink()
258
+	{
259
+		$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>';
260 260
 
261
-        return $ret;
262
-    }
261
+		return $ret;
262
+	}
263 263
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -104,23 +104,23 @@  discard block
 block discarded – undo
104 104
     {
105 105
         global $smartobjectAdsenseHandler;
106 106
         if ('' !== $this->getVar('style', 'n')) {
107
-            $ret = '<div style="' . $this->getVar('style', 'n') . '">';
107
+            $ret = '<div style="'.$this->getVar('style', 'n').'">';
108 108
         } else {
109 109
             $ret = '<div>';
110 110
         }
111 111
 
112 112
         $ret .= '<script type="text/javascript"><!--
113
-google_ad_client = "' . $this->getVar('client_id', 'n') . '";
114
-google_ad_width = ' . $smartobjectAdsenseHandler->adFormats[$this->getVar('format', 'n')]['width'] . ';
115
-google_ad_height = ' . $smartobjectAdsenseHandler->adFormats[$this->getVar('format', 'n')]['height'] . ';
116
-google_ad_format = "' . $this->getVar('format', 'n') . '";
113
+google_ad_client = "' . $this->getVar('client_id', 'n').'";
114
+google_ad_width = ' . $smartobjectAdsenseHandler->adFormats[$this->getVar('format', 'n')]['width'].';
115
+google_ad_height = ' . $smartobjectAdsenseHandler->adFormats[$this->getVar('format', 'n')]['height'].';
116
+google_ad_format = "' . $this->getVar('format', 'n').'";
117 117
 google_ad_type = "text";
118 118
 google_ad_channel ="";
119
-google_color_border = "' . $this->getVar('border_color', 'n') . '";
120
-google_color_bg = "' . $this->getVar('background_color', 'n') . '";
121
-google_color_link = "' . $this->getVar('link_color', 'n') . '";
122
-google_color_url = "' . $this->getVar('url_color', 'n') . '";
123
-google_color_text = "' . $this->getVar('text_color', 'n') . '";
119
+google_color_border = "' . $this->getVar('border_color', 'n').'";
120
+google_color_bg = "' . $this->getVar('background_color', 'n').'";
121
+google_color_link = "' . $this->getVar('link_color', 'n').'";
122
+google_color_url = "' . $this->getVar('url_color', 'n').'";
123
+google_color_text = "' . $this->getVar('text_color', 'n').'";
124 124
 //--></script>
125 125
 <script type="text/javascript"
126 126
   src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public function getXoopsCode()
137 137
     {
138
-        $ret = '[adsense]' . $this->getVar('tag', 'n') . '[/adsense]';
138
+        $ret = '[adsense]'.$this->getVar('tag', 'n').'[/adsense]';
139 139
 
140 140
         return $ret;
141 141
     }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      */
257 257
     public function getCloneLink()
258 258
     {
259
-        $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>';
259
+        $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>';
260 260
 
261 261
         return $ret;
262 262
     }
Please login to merge, or discard this patch.
class/SmartobjectLinkHandler.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@
 block discarded – undo
30 30
  */
31 31
 class SmartobjectLinkHandler extends Smartobject\SmartPersistableObjectHandler
32 32
 {
33
-    /**
34
-     * SmartobjectLinkHandler constructor.
35
-     * @param \XoopsDatabase $db
36
-     */
37
-    public function __construct(\XoopsDatabase $db)
38
-    {
39
-        parent::__construct($db, 'link', 'linkid', 'subject', 'body', 'smartobject');
40
-    }
33
+	/**
34
+	 * SmartobjectLinkHandler constructor.
35
+	 * @param \XoopsDatabase $db
36
+	 */
37
+	public function __construct(\XoopsDatabase $db)
38
+	{
39
+		parent::__construct($db, 'link', 'linkid', 'subject', 'body', 'smartobject');
40
+	}
41 41
 }
Please login to merge, or discard this patch.
class/SmartHighlighter.php 2 patches
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -24,96 +24,96 @@
 block discarded – undo
24 24
 
25 25
 class SmartHighlighter
26 26
 {
27
-    /**
28
-     * @access private
29
-     */
30
-    public $preg_keywords = '';
31
-    /**
32
-     * @access private
33
-     */
34
-    public $keywords = '';
35
-    /**
36
-     * @access private
37
-     */
38
-    public $singlewords = false;
39
-    /**
40
-     * @access private
41
-     */
42
-    public $replace_callback = null;
27
+	/**
28
+	 * @access private
29
+	 */
30
+	public $preg_keywords = '';
31
+	/**
32
+	 * @access private
33
+	 */
34
+	public $keywords = '';
35
+	/**
36
+	 * @access private
37
+	 */
38
+	public $singlewords = false;
39
+	/**
40
+	 * @access private
41
+	 */
42
+	public $replace_callback = null;
43 43
 
44
-    public $content;
44
+	public $content;
45 45
 
46
-    /**
47
-     * Main constructor
48
-     *
49
-     * This is the main constructor of keyhighlighter class. <br>
50
-     * It's the only public method of the class.
51
-     * @param string   $keywords         the keywords you want to highlight
52
-     * @param boolean  $singlewords      specify if it has to highlight also the single words.
53
-     * @param callback $replace_callback a custom callback for keyword highlight.
54
-     *                                   <code>
55
-     *                                   <?php
56
-     *                                   require ('keyhighlighter.class.php');
57
-     *
58
-     * function my_highlighter ($matches) {
59
-     *  return '<span style="font-weight: bolder; color: #FF0000;">' . $matches[0] . '</span>';
60
-     * }
61
-     *
62
-     * new keyhighlighter ('W3C', false, 'my_highlighter');
63
-     * readfile ('http://www.w3c.org/');
64
-     * ?>
65
-     * </code>
66
-     */
67
-    // public function __construct ()
68
-    public function __construct($keywords, $singlewords = false, $replace_callback = null)
69
-    {
70
-        $this->keywords         = $keywords;
71
-        $this->singlewords      = $singlewords;
72
-        $this->replace_callback = $replace_callback;
73
-    }
46
+	/**
47
+	 * Main constructor
48
+	 *
49
+	 * This is the main constructor of keyhighlighter class. <br>
50
+	 * It's the only public method of the class.
51
+	 * @param string   $keywords         the keywords you want to highlight
52
+	 * @param boolean  $singlewords      specify if it has to highlight also the single words.
53
+	 * @param callback $replace_callback a custom callback for keyword highlight.
54
+	 *                                   <code>
55
+	 *                                   <?php
56
+	 *                                   require ('keyhighlighter.class.php');
57
+	 *
58
+	 * function my_highlighter ($matches) {
59
+	 *  return '<span style="font-weight: bolder; color: #FF0000;">' . $matches[0] . '</span>';
60
+	 * }
61
+	 *
62
+	 * new keyhighlighter ('W3C', false, 'my_highlighter');
63
+	 * readfile ('http://www.w3c.org/');
64
+	 * ?>
65
+	 * </code>
66
+	 */
67
+	// public function __construct ()
68
+	public function __construct($keywords, $singlewords = false, $replace_callback = null)
69
+	{
70
+		$this->keywords         = $keywords;
71
+		$this->singlewords      = $singlewords;
72
+		$this->replace_callback = $replace_callback;
73
+	}
74 74
 
75
-    /**
76
-     * @access private
77
-     * @param $replace_matches
78
-     * @return mixed
79
-     */
80
-    public function replace($replace_matches)
81
-    {
82
-        $patterns = [];
83
-        if ($this->singlewords) {
84
-            $keywords = explode(' ', $this->preg_keywords);
85
-            foreach ($keywords as $keyword) {
86
-                $patterns[] = '/(?' . '>' . $keyword . '+)/si';
87
-            }
88
-        } else {
89
-            $patterns[] = '/(?' . '>' . $this->preg_keywords . '+)/si';
90
-        }
75
+	/**
76
+	 * @access private
77
+	 * @param $replace_matches
78
+	 * @return mixed
79
+	 */
80
+	public function replace($replace_matches)
81
+	{
82
+		$patterns = [];
83
+		if ($this->singlewords) {
84
+			$keywords = explode(' ', $this->preg_keywords);
85
+			foreach ($keywords as $keyword) {
86
+				$patterns[] = '/(?' . '>' . $keyword . '+)/si';
87
+			}
88
+		} else {
89
+			$patterns[] = '/(?' . '>' . $this->preg_keywords . '+)/si';
90
+		}
91 91
 
92
-        $result = $replace_matches[0];
92
+		$result = $replace_matches[0];
93 93
 
94
-        foreach ($patterns as $pattern) {
95
-            if (null !== $this->replace_callback) {
96
-                $result = preg_replace_callback($pattern, $this->replace_callback, $result);
97
-            } else {
98
-                $result = preg_replace($pattern, '<span class="highlightedkey">\\0</span>', $result);
99
-            }
100
-        }
94
+		foreach ($patterns as $pattern) {
95
+			if (null !== $this->replace_callback) {
96
+				$result = preg_replace_callback($pattern, $this->replace_callback, $result);
97
+			} else {
98
+				$result = preg_replace($pattern, '<span class="highlightedkey">\\0</span>', $result);
99
+			}
100
+		}
101 101
 
102
-        return $result;
103
-    }
102
+		return $result;
103
+	}
104 104
 
105
-    /**
106
-     * @access private
107
-     * @param $buffer
108
-     * @return mixed|string
109
-     */
110
-    public function highlight($buffer)
111
-    {
112
-        $buffer              = '>' . $buffer . '<';
113
-        $this->preg_keywords = preg_replace('/[^\w ]/si', '', $this->keywords);
114
-        $buffer              = preg_replace_callback("/(\>(((?" . ">[^><]+)|(?R))*)\<)/is", [&$this, 'replace'], $buffer);
115
-        $buffer              = substr($buffer, 1, -1);
105
+	/**
106
+	 * @access private
107
+	 * @param $buffer
108
+	 * @return mixed|string
109
+	 */
110
+	public function highlight($buffer)
111
+	{
112
+		$buffer              = '>' . $buffer . '<';
113
+		$this->preg_keywords = preg_replace('/[^\w ]/si', '', $this->keywords);
114
+		$buffer              = preg_replace_callback("/(\>(((?" . ">[^><]+)|(?R))*)\<)/is", [&$this, 'replace'], $buffer);
115
+		$buffer              = substr($buffer, 1, -1);
116 116
 
117
-        return $buffer;
118
-    }
117
+		return $buffer;
118
+	}
119 119
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
         if ($this->singlewords) {
79 79
             $keywords = explode(' ', $this->preg_keywords);
80 80
             foreach ($keywords as $keyword) {
81
-                $patterns[] = '/(?' . '>' . $keyword . '+)/si';
81
+                $patterns[] = '/(?'.'>'.$keyword.'+)/si';
82 82
             }
83 83
         } else {
84
-            $patterns[] = '/(?' . '>' . $this->preg_keywords . '+)/si';
84
+            $patterns[] = '/(?'.'>'.$this->preg_keywords.'+)/si';
85 85
         }
86 86
 
87 87
         $result = $replace_matches[0];
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public function highlight($buffer)
106 106
     {
107
-        $buffer              = '>' . $buffer . '<';
107
+        $buffer              = '>'.$buffer.'<';
108 108
         $this->preg_keywords = preg_replace('/[^\w ]/si', '', $this->keywords);
109
-        $buffer              = preg_replace_callback("/(\>(((?" . ">[^><]+)|(?R))*)\<)/is", [&$this, 'replace'], $buffer);
109
+        $buffer              = preg_replace_callback("/(\>(((?".">[^><]+)|(?R))*)\<)/is", [&$this, 'replace'], $buffer);
110 110
         $buffer              = substr($buffer, 1, -1);
111 111
 
112 112
         return $buffer;
Please login to merge, or discard this patch.