@@ -37,125 +37,125 @@ discard block |
||
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 |
||
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 | } |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | |
30 | 30 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
31 | 31 | |
32 | -include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobject.php'; |
|
33 | -include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartplugins.php'; |
|
32 | +include_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartobject.php'; |
|
33 | +include_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartplugins.php'; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Class SmartobjectRating |
@@ -124,14 +124,14 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function getItemValue() |
126 | 126 | { |
127 | - $moduleUrl = XOOPS_URL . '/modules/' . $this->getVar('dirname', 'n') . '/'; |
|
127 | + $moduleUrl = XOOPS_URL.'/modules/'.$this->getVar('dirname', 'n').'/'; |
|
128 | 128 | $plugin = $this->getModulePlugin(); |
129 | 129 | $pluginItemInfo = $plugin->getItemInfo($this->getVar('item')); |
130 | 130 | if (!$pluginItemInfo) { |
131 | 131 | return ''; |
132 | 132 | } |
133 | 133 | $itemPath = sprintf($pluginItemInfo['url'], $this->getVar('itemid')); |
134 | - $ret = '<a href="' . $moduleUrl . $itemPath . '">' . $pluginItemInfo['caption'] . '</a>'; |
|
134 | + $ret = '<a href="'.$moduleUrl.$itemPath.'">'.$pluginItemInfo['caption'].'</a>'; |
|
135 | 135 | |
136 | 136 | return $ret; |
137 | 137 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | public function __construct(XoopsDatabase $db) |
175 | 175 | { |
176 | 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'; |
|
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 | 178 | |
179 | 179 | $this->_rateOptions[1] = 1; |
180 | 180 | $this->_rateOptions[2] = 2; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function getRatingAverageByItemId($itemid, $dirname, $item) |
219 | 219 | { |
220 | - $sql = 'SELECT AVG(rate), COUNT(ratingid) FROM ' . $this->table . " WHERE itemid=$itemid AND dirname='$dirname' AND item='$item' GROUP BY itemid"; |
|
220 | + $sql = 'SELECT AVG(rate), COUNT(ratingid) FROM '.$this->table." WHERE itemid=$itemid AND dirname='$dirname' AND item='$item' GROUP BY itemid"; |
|
221 | 221 | $result = $this->db->query($sql); |
222 | 222 | if (!$result) { |
223 | 223 | return 0; |
@@ -8,22 +8,22 @@ discard block |
||
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 |
||
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 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
3 | 3 | |
4 | -include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/basedurl.php'; |
|
4 | +include_once XOOPS_ROOT_PATH.'/modules/smartobject/class/basedurl.php'; |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Class SmartobjectUrlLink |
@@ -19,96 +19,96 @@ |
||
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 | } |
@@ -78,10 +78,10 @@ discard block |
||
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 |
||
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", array(&$this, 'replace'), $buffer); |
|
109 | + $buffer = preg_replace_callback("/(\>(((?".">[^><]+)|(?R))*)\<)/is", array(&$this, 'replace'), $buffer); |
|
110 | 110 | $buffer = substr($buffer, 1, -1); |
111 | 111 | |
112 | 112 | return $buffer; |
@@ -18,123 +18,123 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class SmartobjectCategory extends SmartSeoObject |
20 | 20 | { |
21 | - public $_categoryPath; |
|
22 | - |
|
23 | - /** |
|
24 | - * SmartobjectCategory constructor. |
|
25 | - */ |
|
26 | - public function __construct() |
|
27 | - { |
|
28 | - $this->initVar('categoryid', XOBJ_DTYPE_INT, '', true); |
|
29 | - $this->initVar('parentid', XOBJ_DTYPE_INT, '', false, null, '', false, _CO_SOBJECT_CATEGORY_PARENTID, _CO_SOBJECT_CATEGORY_PARENTID_DSC); |
|
30 | - $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', false, null, '', false, _CO_SOBJECT_CATEGORY_NAME, _CO_SOBJECT_CATEGORY_NAME_DSC); |
|
31 | - $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', false, null, '', false, _CO_SOBJECT_CATEGORY_DESCRIPTION, _CO_SOBJECT_CATEGORY_DESCRIPTION_DSC); |
|
32 | - $this->initVar('image', XOBJ_DTYPE_TXTBOX, '', false, null, '', false, _CO_SOBJECT_CATEGORY_IMAGE, _CO_SOBJECT_CATEGORY_IMAGE_DSC); |
|
33 | - |
|
34 | - $this->initCommonVar('doxcode'); |
|
35 | - |
|
36 | - $this->setControl('image', array('name' => 'image')); |
|
37 | - $this->setControl('parentid', array('name' => 'parentcategory')); |
|
38 | - $this->setControl('description', array( |
|
39 | - 'name' => 'textarea', |
|
40 | - 'itemHandler' => false, |
|
41 | - 'method' => false, |
|
42 | - 'module' => false, |
|
43 | - 'form_editor' => 'default' |
|
44 | - )); |
|
45 | - |
|
46 | - // call parent constructor to get SEO fields initiated |
|
47 | - parent::__construct(); |
|
48 | - } |
|
49 | - |
|
50 | - /** |
|
51 | - * returns a specific variable for the object in a proper format |
|
52 | - * |
|
53 | - * @access public |
|
54 | - * @param string $key key of the object's variable to be returned |
|
55 | - * @param string $format format to use for the output |
|
56 | - * @return mixed formatted value of the variable |
|
57 | - */ |
|
58 | - public function getVar($key, $format = 's') |
|
59 | - { |
|
60 | - if ($format === 's' && in_array($key, array('description', 'image'))) { |
|
61 | - // return call_user_func(array($this, $key)); |
|
62 | - return $this->{$key}(); |
|
63 | - } |
|
64 | - |
|
65 | - return parent::getVar($key, $format); |
|
66 | - } |
|
67 | - |
|
68 | - /** |
|
69 | - * @return string |
|
70 | - */ |
|
71 | - public function description() |
|
72 | - { |
|
73 | - return $this->getValueFor('description', false); |
|
74 | - } |
|
75 | - |
|
76 | - /** |
|
77 | - * @return bool|mixed |
|
78 | - */ |
|
79 | - public function image() |
|
80 | - { |
|
81 | - $ret = $this->getVar('image', 'e'); |
|
82 | - if ($ret == '-1') { |
|
83 | - return false; |
|
84 | - } else { |
|
85 | - return $ret; |
|
86 | - } |
|
87 | - } |
|
88 | - |
|
89 | - /** |
|
90 | - * @return array |
|
91 | - */ |
|
92 | - public function toArray() |
|
93 | - { |
|
94 | - $this->setVar('doxcode', true); |
|
95 | - global $myts; |
|
96 | - $objectArray = parent::toArray(); |
|
97 | - if ($objectArray['image']) { |
|
98 | - $objectArray['image'] = $this->getImageDir() . $objectArray['image']; |
|
99 | - } |
|
100 | - |
|
101 | - return $objectArray; |
|
102 | - } |
|
103 | - |
|
104 | - /** |
|
105 | - * Create the complete path of a category |
|
106 | - * |
|
107 | - * @todo this could be improved as it uses multiple queries |
|
108 | - * @param bool $withAllLink make all name clickable |
|
109 | - * @param bool $currentCategory |
|
110 | - * @return string complete path (breadcrumb) |
|
111 | - */ |
|
112 | - public function getCategoryPath($withAllLink = true, $currentCategory = false) |
|
113 | - { |
|
114 | - include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
|
115 | - $controller = new SmartObjectController($this->handler); |
|
116 | - |
|
117 | - if (!$this->_categoryPath) { |
|
118 | - if ($withAllLink && !$currentCategory) { |
|
119 | - $ret = $controller->getItemLink($this); |
|
120 | - } else { |
|
121 | - $currentCategory = false; |
|
122 | - $ret = $this->getVar('name'); |
|
123 | - } |
|
124 | - $parentid = $this->getVar('parentid'); |
|
125 | - if ($parentid != 0) { |
|
126 | - $parentObj = $this->handler->get($parentid); |
|
127 | - if ($parentObj->isNew()) { |
|
128 | - exit; |
|
129 | - } |
|
130 | - $parentid = $parentObj->getVar('parentid'); |
|
131 | - $ret = $parentObj->getCategoryPath($withAllLink, $currentCategory) . ' > ' . $ret; |
|
132 | - } |
|
133 | - $this->_categoryPath = $ret; |
|
134 | - } |
|
135 | - |
|
136 | - return $this->_categoryPath; |
|
137 | - } |
|
21 | + public $_categoryPath; |
|
22 | + |
|
23 | + /** |
|
24 | + * SmartobjectCategory constructor. |
|
25 | + */ |
|
26 | + public function __construct() |
|
27 | + { |
|
28 | + $this->initVar('categoryid', XOBJ_DTYPE_INT, '', true); |
|
29 | + $this->initVar('parentid', XOBJ_DTYPE_INT, '', false, null, '', false, _CO_SOBJECT_CATEGORY_PARENTID, _CO_SOBJECT_CATEGORY_PARENTID_DSC); |
|
30 | + $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', false, null, '', false, _CO_SOBJECT_CATEGORY_NAME, _CO_SOBJECT_CATEGORY_NAME_DSC); |
|
31 | + $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', false, null, '', false, _CO_SOBJECT_CATEGORY_DESCRIPTION, _CO_SOBJECT_CATEGORY_DESCRIPTION_DSC); |
|
32 | + $this->initVar('image', XOBJ_DTYPE_TXTBOX, '', false, null, '', false, _CO_SOBJECT_CATEGORY_IMAGE, _CO_SOBJECT_CATEGORY_IMAGE_DSC); |
|
33 | + |
|
34 | + $this->initCommonVar('doxcode'); |
|
35 | + |
|
36 | + $this->setControl('image', array('name' => 'image')); |
|
37 | + $this->setControl('parentid', array('name' => 'parentcategory')); |
|
38 | + $this->setControl('description', array( |
|
39 | + 'name' => 'textarea', |
|
40 | + 'itemHandler' => false, |
|
41 | + 'method' => false, |
|
42 | + 'module' => false, |
|
43 | + 'form_editor' => 'default' |
|
44 | + )); |
|
45 | + |
|
46 | + // call parent constructor to get SEO fields initiated |
|
47 | + parent::__construct(); |
|
48 | + } |
|
49 | + |
|
50 | + /** |
|
51 | + * returns a specific variable for the object in a proper format |
|
52 | + * |
|
53 | + * @access public |
|
54 | + * @param string $key key of the object's variable to be returned |
|
55 | + * @param string $format format to use for the output |
|
56 | + * @return mixed formatted value of the variable |
|
57 | + */ |
|
58 | + public function getVar($key, $format = 's') |
|
59 | + { |
|
60 | + if ($format === 's' && in_array($key, array('description', 'image'))) { |
|
61 | + // return call_user_func(array($this, $key)); |
|
62 | + return $this->{$key}(); |
|
63 | + } |
|
64 | + |
|
65 | + return parent::getVar($key, $format); |
|
66 | + } |
|
67 | + |
|
68 | + /** |
|
69 | + * @return string |
|
70 | + */ |
|
71 | + public function description() |
|
72 | + { |
|
73 | + return $this->getValueFor('description', false); |
|
74 | + } |
|
75 | + |
|
76 | + /** |
|
77 | + * @return bool|mixed |
|
78 | + */ |
|
79 | + public function image() |
|
80 | + { |
|
81 | + $ret = $this->getVar('image', 'e'); |
|
82 | + if ($ret == '-1') { |
|
83 | + return false; |
|
84 | + } else { |
|
85 | + return $ret; |
|
86 | + } |
|
87 | + } |
|
88 | + |
|
89 | + /** |
|
90 | + * @return array |
|
91 | + */ |
|
92 | + public function toArray() |
|
93 | + { |
|
94 | + $this->setVar('doxcode', true); |
|
95 | + global $myts; |
|
96 | + $objectArray = parent::toArray(); |
|
97 | + if ($objectArray['image']) { |
|
98 | + $objectArray['image'] = $this->getImageDir() . $objectArray['image']; |
|
99 | + } |
|
100 | + |
|
101 | + return $objectArray; |
|
102 | + } |
|
103 | + |
|
104 | + /** |
|
105 | + * Create the complete path of a category |
|
106 | + * |
|
107 | + * @todo this could be improved as it uses multiple queries |
|
108 | + * @param bool $withAllLink make all name clickable |
|
109 | + * @param bool $currentCategory |
|
110 | + * @return string complete path (breadcrumb) |
|
111 | + */ |
|
112 | + public function getCategoryPath($withAllLink = true, $currentCategory = false) |
|
113 | + { |
|
114 | + include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
|
115 | + $controller = new SmartObjectController($this->handler); |
|
116 | + |
|
117 | + if (!$this->_categoryPath) { |
|
118 | + if ($withAllLink && !$currentCategory) { |
|
119 | + $ret = $controller->getItemLink($this); |
|
120 | + } else { |
|
121 | + $currentCategory = false; |
|
122 | + $ret = $this->getVar('name'); |
|
123 | + } |
|
124 | + $parentid = $this->getVar('parentid'); |
|
125 | + if ($parentid != 0) { |
|
126 | + $parentObj = $this->handler->get($parentid); |
|
127 | + if ($parentObj->isNew()) { |
|
128 | + exit; |
|
129 | + } |
|
130 | + $parentid = $parentObj->getVar('parentid'); |
|
131 | + $ret = $parentObj->getCategoryPath($withAllLink, $currentCategory) . ' > ' . $ret; |
|
132 | + } |
|
133 | + $this->_categoryPath = $ret; |
|
134 | + } |
|
135 | + |
|
136 | + return $this->_categoryPath; |
|
137 | + } |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -142,91 +142,91 @@ discard block |
||
142 | 142 | */ |
143 | 143 | class SmartobjectCategoryHandler extends SmartPersistableObjectHandler |
144 | 144 | { |
145 | - public $allCategoriesObj = false; |
|
146 | - public $_allCategoriesId = false; |
|
147 | - |
|
148 | - /** |
|
149 | - * SmartobjectCategoryHandler constructor. |
|
150 | - * @param XoopsDatabase $db |
|
151 | - * @param $modulename |
|
152 | - */ |
|
153 | - public function __construct(XoopsDatabase $db, $modulename) |
|
154 | - { |
|
155 | - parent::__construct($db, 'category', 'categoryid', 'name', 'description', $modulename); |
|
156 | - } |
|
157 | - |
|
158 | - /** |
|
159 | - * @param int $parentid |
|
160 | - * @param bool $perm_name |
|
161 | - * @param string $sort |
|
162 | - * @param string $order |
|
163 | - * @return array|bool |
|
164 | - */ |
|
165 | - public function getAllCategoriesArray($parentid = 0, $perm_name = false, $sort = 'parentid', $order = 'ASC') |
|
166 | - { |
|
167 | - if (!$this->allCategoriesObj) { |
|
168 | - $criteria = new CriteriaCompo(); |
|
169 | - $criteria->setSort($sort); |
|
170 | - $criteria->setOrder($order); |
|
171 | - global $xoopsUser; |
|
172 | - $userIsAdmin = is_object($xoopsUser) && $xoopsUser->isAdmin(); |
|
173 | - |
|
174 | - if ($perm_name && !$userIsAdmin) { |
|
175 | - if (!$this->setGrantedObjectsCriteria($criteria, $perm_name)) { |
|
176 | - return false; |
|
177 | - } |
|
178 | - } |
|
179 | - |
|
180 | - $this->allCategoriesObj = $this->getObjects($criteria, 'parentid'); |
|
181 | - } |
|
182 | - |
|
183 | - $ret = array(); |
|
184 | - if (isset($this->allCategoriesObj[$parentid])) { |
|
185 | - foreach ($this->allCategoriesObj[$parentid] as $categoryid => $categoryObj) { |
|
186 | - $ret[$categoryid]['self'] = $categoryObj->toArray(); |
|
187 | - if (isset($this->allCategoriesObj[$categoryid])) { |
|
188 | - $ret[$categoryid]['sub'] = $this->getAllCategoriesArray($categoryid); |
|
189 | - $ret[$categoryid]['subcatscount'] = count($ret[$categoryid]['sub']); |
|
190 | - } |
|
191 | - } |
|
192 | - } |
|
193 | - |
|
194 | - return $ret; |
|
195 | - } |
|
196 | - |
|
197 | - /** |
|
198 | - * @param $parentid |
|
199 | - * @param bool $asString |
|
200 | - * @return array|string |
|
201 | - */ |
|
202 | - public function getParentIds($parentid, $asString = true) |
|
203 | - { |
|
204 | - if (!$this->allCategoriesId) { |
|
205 | - $ret = array(); |
|
206 | - $sql = 'SELECT categoryid, parentid FROM ' . $this->table . ' AS ' . $this->_itemname . ' ORDER BY parentid'; |
|
207 | - |
|
208 | - $result = $this->db->query($sql); |
|
209 | - |
|
210 | - if (!$result) { |
|
211 | - return $ret; |
|
212 | - } |
|
213 | - |
|
214 | - while ($myrow = $this->db->fetchArray($result)) { |
|
215 | - $this->allCategoriesId[$myrow['categoryid']] = $myrow['parentid']; |
|
216 | - } |
|
217 | - } |
|
218 | - |
|
219 | - $retArray = array($parentid); |
|
220 | - while ($parentid != 0) { |
|
221 | - $parentid = $this->allCategoriesId[$parentid]; |
|
222 | - if ($parentid != 0) { |
|
223 | - $retArray[] = $parentid; |
|
224 | - } |
|
225 | - } |
|
226 | - if ($asString) { |
|
227 | - return implode(', ', $retArray); |
|
228 | - } else { |
|
229 | - return $retArray; |
|
230 | - } |
|
231 | - } |
|
145 | + public $allCategoriesObj = false; |
|
146 | + public $_allCategoriesId = false; |
|
147 | + |
|
148 | + /** |
|
149 | + * SmartobjectCategoryHandler constructor. |
|
150 | + * @param XoopsDatabase $db |
|
151 | + * @param $modulename |
|
152 | + */ |
|
153 | + public function __construct(XoopsDatabase $db, $modulename) |
|
154 | + { |
|
155 | + parent::__construct($db, 'category', 'categoryid', 'name', 'description', $modulename); |
|
156 | + } |
|
157 | + |
|
158 | + /** |
|
159 | + * @param int $parentid |
|
160 | + * @param bool $perm_name |
|
161 | + * @param string $sort |
|
162 | + * @param string $order |
|
163 | + * @return array|bool |
|
164 | + */ |
|
165 | + public function getAllCategoriesArray($parentid = 0, $perm_name = false, $sort = 'parentid', $order = 'ASC') |
|
166 | + { |
|
167 | + if (!$this->allCategoriesObj) { |
|
168 | + $criteria = new CriteriaCompo(); |
|
169 | + $criteria->setSort($sort); |
|
170 | + $criteria->setOrder($order); |
|
171 | + global $xoopsUser; |
|
172 | + $userIsAdmin = is_object($xoopsUser) && $xoopsUser->isAdmin(); |
|
173 | + |
|
174 | + if ($perm_name && !$userIsAdmin) { |
|
175 | + if (!$this->setGrantedObjectsCriteria($criteria, $perm_name)) { |
|
176 | + return false; |
|
177 | + } |
|
178 | + } |
|
179 | + |
|
180 | + $this->allCategoriesObj = $this->getObjects($criteria, 'parentid'); |
|
181 | + } |
|
182 | + |
|
183 | + $ret = array(); |
|
184 | + if (isset($this->allCategoriesObj[$parentid])) { |
|
185 | + foreach ($this->allCategoriesObj[$parentid] as $categoryid => $categoryObj) { |
|
186 | + $ret[$categoryid]['self'] = $categoryObj->toArray(); |
|
187 | + if (isset($this->allCategoriesObj[$categoryid])) { |
|
188 | + $ret[$categoryid]['sub'] = $this->getAllCategoriesArray($categoryid); |
|
189 | + $ret[$categoryid]['subcatscount'] = count($ret[$categoryid]['sub']); |
|
190 | + } |
|
191 | + } |
|
192 | + } |
|
193 | + |
|
194 | + return $ret; |
|
195 | + } |
|
196 | + |
|
197 | + /** |
|
198 | + * @param $parentid |
|
199 | + * @param bool $asString |
|
200 | + * @return array|string |
|
201 | + */ |
|
202 | + public function getParentIds($parentid, $asString = true) |
|
203 | + { |
|
204 | + if (!$this->allCategoriesId) { |
|
205 | + $ret = array(); |
|
206 | + $sql = 'SELECT categoryid, parentid FROM ' . $this->table . ' AS ' . $this->_itemname . ' ORDER BY parentid'; |
|
207 | + |
|
208 | + $result = $this->db->query($sql); |
|
209 | + |
|
210 | + if (!$result) { |
|
211 | + return $ret; |
|
212 | + } |
|
213 | + |
|
214 | + while ($myrow = $this->db->fetchArray($result)) { |
|
215 | + $this->allCategoriesId[$myrow['categoryid']] = $myrow['parentid']; |
|
216 | + } |
|
217 | + } |
|
218 | + |
|
219 | + $retArray = array($parentid); |
|
220 | + while ($parentid != 0) { |
|
221 | + $parentid = $this->allCategoriesId[$parentid]; |
|
222 | + if ($parentid != 0) { |
|
223 | + $retArray[] = $parentid; |
|
224 | + } |
|
225 | + } |
|
226 | + if ($asString) { |
|
227 | + return implode(', ', $retArray); |
|
228 | + } else { |
|
229 | + return $retArray; |
|
230 | + } |
|
231 | + } |
|
232 | 232 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
14 | -include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartseoobject.php'; |
|
14 | +include_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartseoobject.php'; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * Class SmartobjectCategory |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | global $myts; |
96 | 96 | $objectArray = parent::toArray(); |
97 | 97 | if ($objectArray['image']) { |
98 | - $objectArray['image'] = $this->getImageDir() . $objectArray['image']; |
|
98 | + $objectArray['image'] = $this->getImageDir().$objectArray['image']; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | return $objectArray; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function getCategoryPath($withAllLink = true, $currentCategory = false) |
113 | 113 | { |
114 | - include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
|
114 | + include_once SMARTOBJECT_ROOT_PATH.'class/smartobjectcontroller.php'; |
|
115 | 115 | $controller = new SmartObjectController($this->handler); |
116 | 116 | |
117 | 117 | if (!$this->_categoryPath) { |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | exit; |
129 | 129 | } |
130 | 130 | $parentid = $parentObj->getVar('parentid'); |
131 | - $ret = $parentObj->getCategoryPath($withAllLink, $currentCategory) . ' > ' . $ret; |
|
131 | + $ret = $parentObj->getCategoryPath($withAllLink, $currentCategory).' > '.$ret; |
|
132 | 132 | } |
133 | 133 | $this->_categoryPath = $ret; |
134 | 134 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | { |
204 | 204 | if (!$this->allCategoriesId) { |
205 | 205 | $ret = array(); |
206 | - $sql = 'SELECT categoryid, parentid FROM ' . $this->table . ' AS ' . $this->_itemname . ' ORDER BY parentid'; |
|
206 | + $sql = 'SELECT categoryid, parentid FROM '.$this->table.' AS '.$this->_itemname.' ORDER BY parentid'; |
|
207 | 207 | |
208 | 208 | $result = $this->db->query($sql); |
209 | 209 |
@@ -89,51 +89,51 @@ |
||
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 | } |
@@ -80,9 +80,9 @@ |
||
80 | 80 | * @link http://smartfactory.ca The SmartFactory |
81 | 81 | * @package SmartObject |
82 | 82 | */ |
83 | -mt_srand((double)microtime() * 1000000); |
|
83 | +mt_srand((double) microtime() * 1000000); |
|
84 | 84 | |
85 | -include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
85 | +include_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Class SmartUploader |
@@ -6,44 +6,44 @@ |
||
6 | 6 | */ |
7 | 7 | class SmartHookHandler |
8 | 8 | { |
9 | - /** |
|
10 | - * SmartHookHandler constructor. |
|
11 | - */ |
|
12 | - public function __construct() |
|
13 | - { |
|
14 | - } |
|
9 | + /** |
|
10 | + * SmartHookHandler constructor. |
|
11 | + */ |
|
12 | + public function __construct() |
|
13 | + { |
|
14 | + } |
|
15 | 15 | |
16 | - /** |
|
17 | - * Access the only instance of this class |
|
18 | - * |
|
19 | - * @return XoopsObject |
|
20 | - * |
|
21 | - * @static |
|
22 | - * @staticvar object |
|
23 | - */ |
|
24 | - public static function getInstance() |
|
25 | - { |
|
26 | - static $instance; |
|
27 | - if (null === $instance) { |
|
28 | - $instance = new static(); |
|
29 | - } |
|
16 | + /** |
|
17 | + * Access the only instance of this class |
|
18 | + * |
|
19 | + * @return XoopsObject |
|
20 | + * |
|
21 | + * @static |
|
22 | + * @staticvar object |
|
23 | + */ |
|
24 | + public static function getInstance() |
|
25 | + { |
|
26 | + static $instance; |
|
27 | + if (null === $instance) { |
|
28 | + $instance = new static(); |
|
29 | + } |
|
30 | 30 | |
31 | - return $instance; |
|
32 | - } |
|
31 | + return $instance; |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * @param $hook_name |
|
36 | - */ |
|
37 | - public function executeHook($hook_name) |
|
38 | - { |
|
39 | - $lower_hook_name = strtolower($hook_name); |
|
40 | - $filename = SMARTOBJECT_ROOT_PATH . 'include/custom_code/' . $lower_hook_name . '.php'; |
|
41 | - if (file_exists($filename)) { |
|
42 | - include_once($filename); |
|
43 | - $function = 'smarthook_' . $lower_hook_name; |
|
44 | - if (function_exists($function)) { |
|
45 | - $function(); |
|
46 | - } |
|
47 | - } |
|
48 | - } |
|
34 | + /** |
|
35 | + * @param $hook_name |
|
36 | + */ |
|
37 | + public function executeHook($hook_name) |
|
38 | + { |
|
39 | + $lower_hook_name = strtolower($hook_name); |
|
40 | + $filename = SMARTOBJECT_ROOT_PATH . 'include/custom_code/' . $lower_hook_name . '.php'; |
|
41 | + if (file_exists($filename)) { |
|
42 | + include_once($filename); |
|
43 | + $function = 'smarthook_' . $lower_hook_name; |
|
44 | + if (function_exists($function)) { |
|
45 | + $function(); |
|
46 | + } |
|
47 | + } |
|
48 | + } |
|
49 | 49 | } |
@@ -37,10 +37,10 @@ |
||
37 | 37 | public function executeHook($hook_name) |
38 | 38 | { |
39 | 39 | $lower_hook_name = strtolower($hook_name); |
40 | - $filename = SMARTOBJECT_ROOT_PATH . 'include/custom_code/' . $lower_hook_name . '.php'; |
|
40 | + $filename = SMARTOBJECT_ROOT_PATH.'include/custom_code/'.$lower_hook_name.'.php'; |
|
41 | 41 | if (file_exists($filename)) { |
42 | 42 | include_once($filename); |
43 | - $function = 'smarthook_' . $lower_hook_name; |
|
43 | + $function = 'smarthook_'.$lower_hook_name; |
|
44 | 44 | if (function_exists($function)) { |
45 | 45 | $function(); |
46 | 46 | } |
@@ -35,19 +35,19 @@ discard block |
||
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 |
||
55 | 55 | */ |
56 | 56 | class SmartobjectTagHandler extends SmartPersistableMlObjectHandler |
57 | 57 | { |
58 | - /** |
|
59 | - * SmartobjectTagHandler constructor. |
|
60 | - * @param XoopsDatabase $db |
|
61 | - */ |
|
62 | - public function __construct(XoopsDatabase $db) |
|
63 | - { |
|
64 | - parent::__construct($db, 'tag', 'tagid', 'name', 'description', 'smartobject'); |
|
65 | - } |
|
58 | + /** |
|
59 | + * SmartobjectTagHandler constructor. |
|
60 | + * @param XoopsDatabase $db |
|
61 | + */ |
|
62 | + public function __construct(XoopsDatabase $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 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | // -------------------------------------------------------------------------// |
29 | 29 | |
30 | 30 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
31 | -include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartmlobject.php'; |
|
31 | +include_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartmlobject.php'; |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Class SmartobjectTag |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function getLanguages() |
71 | 71 | { |
72 | - include_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
72 | + include_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
73 | 73 | $aLanguages = XoopsLists::getLangList(); |
74 | 74 | $ret['default'] = _CO_SOBJECT_ALL; |
75 | 75 | foreach ($aLanguages as $lang) { |
@@ -12,23 +12,23 @@ |
||
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 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | $var = $object->vars[$key]; |
23 | 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 | 27 | $signature_textarea = new XoopsFormDhtmlTextArea('', $key, $object->getVar($key, 'e')); |
28 | 28 | $this->addElement($signature_textarea); |
@@ -11,31 +11,31 @@ |
||
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, ' '); |
|
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, ' '); |
|
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 | } |
@@ -21,18 +21,18 @@ |
||
21 | 21 | { |
22 | 22 | parent::__construct($form_caption, ' '); |
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)); |
|
33 | + $this->addElement(new XoopsFormLabel('', '<br>'._CO_SOBJECT_URLLINK_TARGET)); |
|
34 | 34 | $targ_val = $object->getVar('target'); |
35 | - $targetRadio = new XoopsFormRadio('', 'target_' . $key, $targ_val !== '' ? $targ_val : '_blank'); |
|
35 | + $targetRadio = new XoopsFormRadio('', 'target_'.$key, $targ_val !== '' ? $targ_val : '_blank'); |
|
36 | 36 | $control = $object->getControl('target'); |
37 | 37 | $targetRadio->addOptionArray($control['options']); |
38 | 38 |