@@ -18,7 +18,7 @@ |
||
18 | 18 | /** |
19 | 19 | * Access the only instance of this class |
20 | 20 | * |
21 | - * @return XoopsObject |
|
21 | + * @return SmartObjectsRegistry |
|
22 | 22 | * |
23 | 23 | * @static |
24 | 24 | * @staticvar object |
@@ -13,169 +13,169 @@ |
||
13 | 13 | */ |
14 | 14 | class SmartObjectsRegistry |
15 | 15 | { |
16 | - public $_registryArray; |
|
16 | + public $_registryArray; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Access the only instance of this class |
|
20 | - * |
|
21 | - * @return XoopsObject |
|
22 | - * |
|
23 | - * @static |
|
24 | - * @staticvar object |
|
25 | - */ |
|
26 | - public static function getInstance() |
|
27 | - { |
|
28 | - static $instance; |
|
29 | - if (null === $instance) { |
|
30 | - $instance = new static(); |
|
31 | - } |
|
18 | + /** |
|
19 | + * Access the only instance of this class |
|
20 | + * |
|
21 | + * @return XoopsObject |
|
22 | + * |
|
23 | + * @static |
|
24 | + * @staticvar object |
|
25 | + */ |
|
26 | + public static function getInstance() |
|
27 | + { |
|
28 | + static $instance; |
|
29 | + if (null === $instance) { |
|
30 | + $instance = new static(); |
|
31 | + } |
|
32 | 32 | |
33 | - return $instance; |
|
34 | - } |
|
33 | + return $instance; |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * Adding objects to the registry |
|
38 | - * |
|
39 | - * @param SmartPersistableObjectHandler $handler of the objects to add |
|
40 | - * @param bool|CriteriaCompo $criteria to pass to the getObjects method of the handler (with id_as_key) |
|
41 | - * @return FALSE if an error occured |
|
42 | - */ |
|
43 | - public function addObjectsFromHandler(&$handler, $criteria = false) |
|
44 | - { |
|
45 | - if (method_exists($handler, 'getObjects')) { |
|
46 | - $objects = $handler->getObjects($criteria, true); |
|
47 | - $this->_registryArray['objects'][$handler->_moduleName][$handler->_itemname] = $objects; |
|
36 | + /** |
|
37 | + * Adding objects to the registry |
|
38 | + * |
|
39 | + * @param SmartPersistableObjectHandler $handler of the objects to add |
|
40 | + * @param bool|CriteriaCompo $criteria to pass to the getObjects method of the handler (with id_as_key) |
|
41 | + * @return FALSE if an error occured |
|
42 | + */ |
|
43 | + public function addObjectsFromHandler(&$handler, $criteria = false) |
|
44 | + { |
|
45 | + if (method_exists($handler, 'getObjects')) { |
|
46 | + $objects = $handler->getObjects($criteria, true); |
|
47 | + $this->_registryArray['objects'][$handler->_moduleName][$handler->_itemname] = $objects; |
|
48 | 48 | |
49 | - return $objects; |
|
50 | - } else { |
|
51 | - return false; |
|
52 | - } |
|
53 | - } |
|
49 | + return $objects; |
|
50 | + } else { |
|
51 | + return false; |
|
52 | + } |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * Adding objects to the registry from an item name |
|
57 | - * This method will fetch the handler of the item / module and call the addObjectsFromHandler |
|
58 | - * |
|
59 | - * @param string $item name of the item |
|
60 | - * @param bool|string $modulename name of the module |
|
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 addObjectsFromItemName($item, $modulename = false, $criteria = false) |
|
65 | - { |
|
66 | - if (!$modulename) { |
|
67 | - global $xoopsModule; |
|
68 | - if (!is_object($xoopsModule)) { |
|
69 | - return false; |
|
70 | - } else { |
|
71 | - $modulename = $xoopsModule->dirname(); |
|
72 | - } |
|
73 | - } |
|
74 | - $objectHandler = xoops_getModuleHandler($item, $modulename); |
|
55 | + /** |
|
56 | + * Adding objects to the registry from an item name |
|
57 | + * This method will fetch the handler of the item / module and call the addObjectsFromHandler |
|
58 | + * |
|
59 | + * @param string $item name of the item |
|
60 | + * @param bool|string $modulename name of the module |
|
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 addObjectsFromItemName($item, $modulename = false, $criteria = false) |
|
65 | + { |
|
66 | + if (!$modulename) { |
|
67 | + global $xoopsModule; |
|
68 | + if (!is_object($xoopsModule)) { |
|
69 | + return false; |
|
70 | + } else { |
|
71 | + $modulename = $xoopsModule->dirname(); |
|
72 | + } |
|
73 | + } |
|
74 | + $objectHandler = xoops_getModuleHandler($item, $modulename); |
|
75 | 75 | |
76 | - if (method_exists($objectHandler, 'getObjects')) { |
|
77 | - $objects = $objectHandler->getObjects($criteria, true); |
|
78 | - $this->_registryArray['objects'][$objectHandler->_moduleName][$objectHandler->_itemname] = $objects; |
|
76 | + if (method_exists($objectHandler, 'getObjects')) { |
|
77 | + $objects = $objectHandler->getObjects($criteria, true); |
|
78 | + $this->_registryArray['objects'][$objectHandler->_moduleName][$objectHandler->_itemname] = $objects; |
|
79 | 79 | |
80 | - return $objects; |
|
81 | - } else { |
|
82 | - return false; |
|
83 | - } |
|
84 | - } |
|
80 | + return $objects; |
|
81 | + } else { |
|
82 | + return false; |
|
83 | + } |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * Fetching objects from the registry |
|
88 | - * |
|
89 | - * @param string $itemname |
|
90 | - * @param string $modulename |
|
91 | - * |
|
92 | - * @return the requested objects or FALSE if they don't exists in the registry |
|
93 | - */ |
|
94 | - public function getObjects($itemname, $modulename) |
|
95 | - { |
|
96 | - if (!$modulename) { |
|
97 | - global $xoopsModule; |
|
98 | - if (!is_object($xoopsModule)) { |
|
99 | - return false; |
|
100 | - } else { |
|
101 | - $modulename = $xoopsModule->dirname(); |
|
102 | - } |
|
103 | - } |
|
104 | - if (isset($this->_registryArray['objects'][$modulename][$itemname])) { |
|
105 | - return $this->_registryArray['objects'][$modulename][$itemname]; |
|
106 | - } else { |
|
107 | - // if they were not in registry, let's fetch them and add them to the reigistry |
|
108 | - $moduleHandler = xoops_getModuleHandler($itemname, $modulename); |
|
109 | - if (method_exists($moduleHandler, 'getObjects')) { |
|
110 | - $objects = $moduleHandler->getObjects(); |
|
111 | - } |
|
112 | - $this->_registryArray['objects'][$modulename][$itemname] = $objects; |
|
86 | + /** |
|
87 | + * Fetching objects from the registry |
|
88 | + * |
|
89 | + * @param string $itemname |
|
90 | + * @param string $modulename |
|
91 | + * |
|
92 | + * @return the requested objects or FALSE if they don't exists in the registry |
|
93 | + */ |
|
94 | + public function getObjects($itemname, $modulename) |
|
95 | + { |
|
96 | + if (!$modulename) { |
|
97 | + global $xoopsModule; |
|
98 | + if (!is_object($xoopsModule)) { |
|
99 | + return false; |
|
100 | + } else { |
|
101 | + $modulename = $xoopsModule->dirname(); |
|
102 | + } |
|
103 | + } |
|
104 | + if (isset($this->_registryArray['objects'][$modulename][$itemname])) { |
|
105 | + return $this->_registryArray['objects'][$modulename][$itemname]; |
|
106 | + } else { |
|
107 | + // if they were not in registry, let's fetch them and add them to the reigistry |
|
108 | + $moduleHandler = xoops_getModuleHandler($itemname, $modulename); |
|
109 | + if (method_exists($moduleHandler, 'getObjects')) { |
|
110 | + $objects = $moduleHandler->getObjects(); |
|
111 | + } |
|
112 | + $this->_registryArray['objects'][$modulename][$itemname] = $objects; |
|
113 | 113 | |
114 | - return $objects; |
|
115 | - } |
|
116 | - } |
|
114 | + return $objects; |
|
115 | + } |
|
116 | + } |
|
117 | 117 | |
118 | - /** |
|
119 | - * Fetching objects from the registry, as a list: objectid => identifier |
|
120 | - * |
|
121 | - * @param string $itemname |
|
122 | - * @param string $modulename |
|
123 | - * |
|
124 | - * @return the requested objects or FALSE if they don't exists in the registry |
|
125 | - */ |
|
126 | - public function getList($itemname, $modulename) |
|
127 | - { |
|
128 | - if (!$modulename) { |
|
129 | - global $xoopsModule; |
|
130 | - if (!is_object($xoopsModule)) { |
|
131 | - return false; |
|
132 | - } else { |
|
133 | - $modulename = $xoopsModule->dirname(); |
|
134 | - } |
|
135 | - } |
|
136 | - if (isset($this->_registryArray['list'][$modulename][$itemname])) { |
|
137 | - return $this->_registryArray['list'][$modulename][$itemname]; |
|
138 | - } else { |
|
139 | - // if they were not in registry, let's fetch them and add them to the reigistry |
|
140 | - $moduleHandler = xoops_getModuleHandler($itemname, $modulename); |
|
141 | - if (method_exists($moduleHandler, 'getList')) { |
|
142 | - $objects = $moduleHandler->getList(); |
|
143 | - } |
|
144 | - $this->_registryArray['list'][$modulename][$itemname] = $objects; |
|
118 | + /** |
|
119 | + * Fetching objects from the registry, as a list: objectid => identifier |
|
120 | + * |
|
121 | + * @param string $itemname |
|
122 | + * @param string $modulename |
|
123 | + * |
|
124 | + * @return the requested objects or FALSE if they don't exists in the registry |
|
125 | + */ |
|
126 | + public function getList($itemname, $modulename) |
|
127 | + { |
|
128 | + if (!$modulename) { |
|
129 | + global $xoopsModule; |
|
130 | + if (!is_object($xoopsModule)) { |
|
131 | + return false; |
|
132 | + } else { |
|
133 | + $modulename = $xoopsModule->dirname(); |
|
134 | + } |
|
135 | + } |
|
136 | + if (isset($this->_registryArray['list'][$modulename][$itemname])) { |
|
137 | + return $this->_registryArray['list'][$modulename][$itemname]; |
|
138 | + } else { |
|
139 | + // if they were not in registry, let's fetch them and add them to the reigistry |
|
140 | + $moduleHandler = xoops_getModuleHandler($itemname, $modulename); |
|
141 | + if (method_exists($moduleHandler, 'getList')) { |
|
142 | + $objects = $moduleHandler->getList(); |
|
143 | + } |
|
144 | + $this->_registryArray['list'][$modulename][$itemname] = $objects; |
|
145 | 145 | |
146 | - return $objects; |
|
147 | - } |
|
148 | - } |
|
146 | + return $objects; |
|
147 | + } |
|
148 | + } |
|
149 | 149 | |
150 | - /** |
|
151 | - * Retreive a single object |
|
152 | - * |
|
153 | - * @param string $itemname |
|
154 | - * @param string $key |
|
155 | - * |
|
156 | - * @param bool $modulename |
|
157 | - * @return the requestd object or FALSE if they don't exists in the registry |
|
158 | - */ |
|
159 | - public function getSingleObject($itemname, $key, $modulename = false) |
|
160 | - { |
|
161 | - if (!$modulename) { |
|
162 | - global $xoopsModule; |
|
163 | - if (!is_object($xoopsModule)) { |
|
164 | - return false; |
|
165 | - } else { |
|
166 | - $modulename = $xoopsModule->dirname(); |
|
167 | - } |
|
168 | - } |
|
169 | - if (isset($this->_registryArray['objects'][$modulename][$itemname][$key])) { |
|
170 | - return $this->_registryArray['objects'][$modulename][$itemname][$key]; |
|
171 | - } else { |
|
172 | - $objectHandler = xoops_getModuleHandler($itemname, $modulename); |
|
173 | - $object = $objectHandler->get($key); |
|
174 | - if (!$object->isNew()) { |
|
175 | - return $object; |
|
176 | - } else { |
|
177 | - return false; |
|
178 | - } |
|
179 | - } |
|
180 | - } |
|
150 | + /** |
|
151 | + * Retreive a single object |
|
152 | + * |
|
153 | + * @param string $itemname |
|
154 | + * @param string $key |
|
155 | + * |
|
156 | + * @param bool $modulename |
|
157 | + * @return the requestd object or FALSE if they don't exists in the registry |
|
158 | + */ |
|
159 | + public function getSingleObject($itemname, $key, $modulename = false) |
|
160 | + { |
|
161 | + if (!$modulename) { |
|
162 | + global $xoopsModule; |
|
163 | + if (!is_object($xoopsModule)) { |
|
164 | + return false; |
|
165 | + } else { |
|
166 | + $modulename = $xoopsModule->dirname(); |
|
167 | + } |
|
168 | + } |
|
169 | + if (isset($this->_registryArray['objects'][$modulename][$itemname][$key])) { |
|
170 | + return $this->_registryArray['objects'][$modulename][$itemname][$key]; |
|
171 | + } else { |
|
172 | + $objectHandler = xoops_getModuleHandler($itemname, $modulename); |
|
173 | + $object = $objectHandler->get($key); |
|
174 | + if (!$object->isNew()) { |
|
175 | + return $object; |
|
176 | + } else { |
|
177 | + return false; |
|
178 | + } |
|
179 | + } |
|
180 | + } |
|
181 | 181 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
328 | - * @param $key |
|
328 | + * @param string $key |
|
329 | 329 | * @param bool $moduleName |
330 | 330 | * @param string $default |
331 | 331 | * @return null|string |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | |
388 | 388 | /** |
389 | 389 | * Thanks to the NewBB2 Development Team |
390 | - * @param $target |
|
390 | + * @param string $target |
|
391 | 391 | * @return bool |
392 | 392 | */ |
393 | 393 | function smart_admin_mkdir($target) |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | |
541 | 541 | /** |
542 | 542 | * @param $dirname |
543 | - * @return bool |
|
543 | + * @return boolean|null |
|
544 | 544 | */ |
545 | 545 | function smart_deleteFile($dirname) |
546 | 546 | { |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | } |
756 | 756 | |
757 | 757 | /** |
758 | - * @param $name |
|
758 | + * @param string $name |
|
759 | 759 | */ |
760 | 760 | function smart_close_collapsable($name) |
761 | 761 | { |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | } |
766 | 766 | |
767 | 767 | /** |
768 | - * @param $name |
|
768 | + * @param string $name |
|
769 | 769 | * @param $value |
770 | 770 | * @param int $time |
771 | 771 | */ |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | } |
780 | 780 | |
781 | 781 | /** |
782 | - * @param $name |
|
782 | + * @param string $name |
|
783 | 783 | * @param string $default |
784 | 784 | * @return string |
785 | 785 | */ |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | } |
939 | 939 | |
940 | 940 | /** |
941 | - * @param $src |
|
941 | + * @param string $src |
|
942 | 942 | */ |
943 | 943 | function smart_addScript($src) |
944 | 944 | { |
@@ -1115,8 +1115,8 @@ discard block |
||
1115 | 1115 | } |
1116 | 1116 | |
1117 | 1117 | /** |
1118 | - * @param $module |
|
1119 | - * @param $file |
|
1118 | + * @param string $module |
|
1119 | + * @param string $file |
|
1120 | 1120 | */ |
1121 | 1121 | function smart_loadLanguageFile($module, $file) |
1122 | 1122 | { |
@@ -1232,7 +1232,7 @@ discard block |
||
1232 | 1232 | * This function should be able to cover almost all floats that appear in an european environment. |
1233 | 1233 | * @param $str |
1234 | 1234 | * @param bool $set |
1235 | - * @return float|int |
|
1235 | + * @return double |
|
1236 | 1236 | */ |
1237 | 1237 | function smart_getfloat($str, $set = false) |
1238 | 1238 | { |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | /** |
1268 | 1268 | * @param $var |
1269 | 1269 | * @param bool $currencyObj |
1270 | - * @return float|int|mixed|string |
|
1270 | + * @return string |
|
1271 | 1271 | */ |
1272 | 1272 | function smart_currency($var, $currencyObj = false) |
1273 | 1273 | { |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | |
1296 | 1296 | /** |
1297 | 1297 | * @param $var |
1298 | - * @return float|int|mixed|string |
|
1298 | + * @return string |
|
1299 | 1299 | */ |
1300 | 1300 | function smart_float($var) |
1301 | 1301 | { |
@@ -1343,7 +1343,7 @@ discard block |
||
1343 | 1343 | /** |
1344 | 1344 | * @param $moduleName |
1345 | 1345 | * @param $items |
1346 | - * @return array |
|
1346 | + * @return string[] |
|
1347 | 1347 | */ |
1348 | 1348 | function smart_getTablesArray($moduleName, $items) |
1349 | 1349 | { |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | |
12 | 12 | function smart_get_css_link($cssfile) |
13 | 13 | { |
14 | - $ret = '<link rel="stylesheet" type="text/css" href="' . $cssfile . '">'; |
|
14 | + $ret = '<link rel="stylesheet" type="text/css" href="' . $cssfile . '">'; |
|
15 | 15 | |
16 | - return $ret; |
|
16 | + return $ret; |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | function smart_get_page_before_form() |
23 | 23 | { |
24 | - global $smart_previous_page; |
|
24 | + global $smart_previous_page; |
|
25 | 25 | |
26 | - return isset($_POST['smart_page_before_form']) ? $_POST['smart_page_before_form'] : $smart_previous_page; |
|
26 | + return isset($_POST['smart_page_before_form']) ? $_POST['smart_page_before_form'] : $smart_previous_page; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -34,29 +34,29 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function smart_userIsAdmin($module = false) |
36 | 36 | { |
37 | - global $xoopsUser; |
|
38 | - static $smart_isAdmin; |
|
39 | - if (!$module) { |
|
40 | - global $xoopsModule; |
|
41 | - $module = $xoopsModule->getVar('dirname'); |
|
42 | - } |
|
43 | - if (isset($smart_isAdmin[$module])) { |
|
44 | - return $smart_isAdmin[$module]; |
|
45 | - } |
|
46 | - if (!$xoopsUser) { |
|
47 | - $smart_isAdmin[$module] = false; |
|
48 | - |
|
49 | - return $smart_isAdmin[$module]; |
|
50 | - } |
|
51 | - $smart_isAdmin[$module] = false; |
|
52 | - $smartModule = smart_getModuleInfo($module); |
|
53 | - if (!is_object($smartModule)) { |
|
54 | - return false; |
|
55 | - } |
|
56 | - $module_id = $smartModule->getVar('mid'); |
|
57 | - $smart_isAdmin[$module] = $xoopsUser->isAdmin($module_id); |
|
58 | - |
|
59 | - return $smart_isAdmin[$module]; |
|
37 | + global $xoopsUser; |
|
38 | + static $smart_isAdmin; |
|
39 | + if (!$module) { |
|
40 | + global $xoopsModule; |
|
41 | + $module = $xoopsModule->getVar('dirname'); |
|
42 | + } |
|
43 | + if (isset($smart_isAdmin[$module])) { |
|
44 | + return $smart_isAdmin[$module]; |
|
45 | + } |
|
46 | + if (!$xoopsUser) { |
|
47 | + $smart_isAdmin[$module] = false; |
|
48 | + |
|
49 | + return $smart_isAdmin[$module]; |
|
50 | + } |
|
51 | + $smart_isAdmin[$module] = false; |
|
52 | + $smartModule = smart_getModuleInfo($module); |
|
53 | + if (!is_object($smartModule)) { |
|
54 | + return false; |
|
55 | + } |
|
56 | + $module_id = $smartModule->getVar('mid'); |
|
57 | + $smart_isAdmin[$module] = $xoopsUser->isAdmin($module_id); |
|
58 | + |
|
59 | + return $smart_isAdmin[$module]; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | */ |
65 | 65 | function smart_isXoops22() |
66 | 66 | { |
67 | - $xoops22 = false; |
|
68 | - $xv = str_replace('XOOPS ', '', XOOPS_VERSION); |
|
69 | - if ('2' == substr($xv, 2, 1)) { |
|
70 | - $xoops22 = true; |
|
71 | - } |
|
67 | + $xoops22 = false; |
|
68 | + $xv = str_replace('XOOPS ', '', XOOPS_VERSION); |
|
69 | + if ('2' == substr($xv, 2, 1)) { |
|
70 | + $xoops22 = true; |
|
71 | + } |
|
72 | 72 | |
73 | - return $xoops22; |
|
73 | + return $xoops22; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -81,36 +81,36 @@ discard block |
||
81 | 81 | */ |
82 | 82 | function smart_getModuleName($withLink = true, $forBreadCrumb = false, $moduleName = false) |
83 | 83 | { |
84 | - if (!$moduleName) { |
|
85 | - global $xoopsModule; |
|
86 | - $moduleName = $xoopsModule->getVar('dirname'); |
|
87 | - } |
|
88 | - $smartModule = smart_getModuleInfo($moduleName); |
|
89 | - $smartModuleConfig = smart_getModuleConfig($moduleName); |
|
90 | - if (!isset($smartModule)) { |
|
91 | - return ''; |
|
92 | - } |
|
93 | - |
|
94 | - if ($forBreadCrumb |
|
95 | - && (isset($smartModuleConfig['show_mod_name_breadcrumb']) |
|
96 | - && !$smartModuleConfig['show_mod_name_breadcrumb'])) { |
|
97 | - return ''; |
|
98 | - } |
|
99 | - if (!$withLink) { |
|
100 | - return $smartModule->getVar('name'); |
|
101 | - } else { |
|
102 | - $seoMode = smart_getModuleModeSEO($moduleName); |
|
103 | - if ('rewrite' === $seoMode) { |
|
104 | - $seoModuleName = smart_getModuleNameForSEO($moduleName); |
|
105 | - $ret = XOOPS_URL . '/' . $seoModuleName . '/'; |
|
106 | - } elseif ('pathinfo' === $seoMode) { |
|
107 | - $ret = XOOPS_URL . '/modules/' . $moduleName . '/seo.php/' . $seoModuleName . '/'; |
|
108 | - } else { |
|
109 | - $ret = XOOPS_URL . '/modules/' . $moduleName . '/'; |
|
110 | - } |
|
111 | - |
|
112 | - return '<a href="' . $ret . '">' . $smartModule->getVar('name') . '</a>'; |
|
113 | - } |
|
84 | + if (!$moduleName) { |
|
85 | + global $xoopsModule; |
|
86 | + $moduleName = $xoopsModule->getVar('dirname'); |
|
87 | + } |
|
88 | + $smartModule = smart_getModuleInfo($moduleName); |
|
89 | + $smartModuleConfig = smart_getModuleConfig($moduleName); |
|
90 | + if (!isset($smartModule)) { |
|
91 | + return ''; |
|
92 | + } |
|
93 | + |
|
94 | + if ($forBreadCrumb |
|
95 | + && (isset($smartModuleConfig['show_mod_name_breadcrumb']) |
|
96 | + && !$smartModuleConfig['show_mod_name_breadcrumb'])) { |
|
97 | + return ''; |
|
98 | + } |
|
99 | + if (!$withLink) { |
|
100 | + return $smartModule->getVar('name'); |
|
101 | + } else { |
|
102 | + $seoMode = smart_getModuleModeSEO($moduleName); |
|
103 | + if ('rewrite' === $seoMode) { |
|
104 | + $seoModuleName = smart_getModuleNameForSEO($moduleName); |
|
105 | + $ret = XOOPS_URL . '/' . $seoModuleName . '/'; |
|
106 | + } elseif ('pathinfo' === $seoMode) { |
|
107 | + $ret = XOOPS_URL . '/modules/' . $moduleName . '/seo.php/' . $seoModuleName . '/'; |
|
108 | + } else { |
|
109 | + $ret = XOOPS_URL . '/modules/' . $moduleName . '/'; |
|
110 | + } |
|
111 | + |
|
112 | + return '<a href="' . $ret . '">' . $smartModule->getVar('name') . '</a>'; |
|
113 | + } |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | */ |
120 | 120 | function smart_getModuleNameForSEO($moduleName = false) |
121 | 121 | { |
122 | - $smartModule = smart_getModuleInfo($moduleName); |
|
123 | - $smartModuleConfig = smart_getModuleConfig($moduleName); |
|
124 | - if (isset($smartModuleConfig['seo_module_name'])) { |
|
125 | - return $smartModuleConfig['seo_module_name']; |
|
126 | - } |
|
127 | - $ret = smart_getModuleName(false, false, $moduleName); |
|
128 | - |
|
129 | - return strtolower($ret); |
|
122 | + $smartModule = smart_getModuleInfo($moduleName); |
|
123 | + $smartModuleConfig = smart_getModuleConfig($moduleName); |
|
124 | + if (isset($smartModuleConfig['seo_module_name'])) { |
|
125 | + return $smartModuleConfig['seo_module_name']; |
|
126 | + } |
|
127 | + $ret = smart_getModuleName(false, false, $moduleName); |
|
128 | + |
|
129 | + return strtolower($ret); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | */ |
136 | 136 | function smart_getModuleModeSEO($moduleName = false) |
137 | 137 | { |
138 | - $smartModule = smart_getModuleInfo($moduleName); |
|
139 | - $smartModuleConfig = smart_getModuleConfig($moduleName); |
|
138 | + $smartModule = smart_getModuleInfo($moduleName); |
|
139 | + $smartModuleConfig = smart_getModuleConfig($moduleName); |
|
140 | 140 | |
141 | - return isset($smartModuleConfig['seo_mode']) ? $smartModuleConfig['seo_mode'] : false; |
|
141 | + return isset($smartModuleConfig['seo_mode']) ? $smartModuleConfig['seo_mode'] : false; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | */ |
148 | 148 | function smart_getModuleIncludeIdSEO($moduleName = false) |
149 | 149 | { |
150 | - $smartModule = smart_getModuleInfo($moduleName); |
|
151 | - $smartModuleConfig = smart_getModuleConfig($moduleName); |
|
150 | + $smartModule = smart_getModuleInfo($moduleName); |
|
151 | + $smartModuleConfig = smart_getModuleConfig($moduleName); |
|
152 | 152 | |
153 | - return !empty($smartModuleConfig['seo_inc_id']); |
|
153 | + return !empty($smartModuleConfig['seo_inc_id']); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -159,25 +159,25 @@ discard block |
||
159 | 159 | */ |
160 | 160 | function smart_getenv($key) |
161 | 161 | { |
162 | - $ret = ''; |
|
163 | - $ret = isset($_SERVER[$key]) ? $_SERVER[$key] : (isset($_ENV[$key]) ? $_ENV[$key] : ''); |
|
162 | + $ret = ''; |
|
163 | + $ret = isset($_SERVER[$key]) ? $_SERVER[$key] : (isset($_ENV[$key]) ? $_ENV[$key] : ''); |
|
164 | 164 | |
165 | - return $ret; |
|
165 | + return $ret; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | function smart_xoops_cp_header() |
169 | 169 | { |
170 | - xoops_cp_header(); |
|
171 | - global $xoopsModule, $xoopsConfig; |
|
172 | - /** |
|
173 | - * include SmartObject admin language file |
|
174 | - */ |
|
175 | - $fileName = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/admin.php'; |
|
176 | - if (file_exists($fileName)) { |
|
177 | - require_once $fileName; |
|
178 | - } else { |
|
179 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/admin.php'; |
|
180 | - } ?> |
|
170 | + xoops_cp_header(); |
|
171 | + global $xoopsModule, $xoopsConfig; |
|
172 | + /** |
|
173 | + * include SmartObject admin language file |
|
174 | + */ |
|
175 | + $fileName = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/admin.php'; |
|
176 | + if (file_exists($fileName)) { |
|
177 | + require_once $fileName; |
|
178 | + } else { |
|
179 | + require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/admin.php'; |
|
180 | + } ?> |
|
181 | 181 | <script type='text/javascript'> |
182 | 182 | <!-- |
183 | 183 | var smart_url = '<?php echo SMARTOBJECT_URL ?>'; |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | src='<?php echo SMARTOBJECT_URL ?>include/smart.js'></script> |
191 | 191 | <?php |
192 | 192 | |
193 | - /** |
|
194 | - * Include the admin language constants for the SmartObject Framework |
|
195 | - */ |
|
196 | - $admin_file = SMARTOBJECT_ROOT_PATH . 'language/' . $xoopsConfig['language'] . '/admin.php'; |
|
197 | - if (!file_exists($admin_file)) { |
|
198 | - $admin_file = SMARTOBJECT_ROOT_PATH . 'language/english/admin.php'; |
|
199 | - } |
|
200 | - require_once $admin_file; |
|
193 | + /** |
|
194 | + * Include the admin language constants for the SmartObject Framework |
|
195 | + */ |
|
196 | + $admin_file = SMARTOBJECT_ROOT_PATH . 'language/' . $xoopsConfig['language'] . '/admin.php'; |
|
197 | + if (!file_exists($admin_file)) { |
|
198 | + $admin_file = SMARTOBJECT_ROOT_PATH . 'language/english/admin.php'; |
|
199 | + } |
|
200 | + require_once $admin_file; |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -211,21 +211,21 @@ discard block |
||
211 | 211 | */ |
212 | 212 | function smart_TableExists($table) |
213 | 213 | { |
214 | - $bRetVal = false; |
|
215 | - //Verifies that a MySQL table exists |
|
216 | - $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); |
|
217 | - $realname = $xoopsDB->prefix($table); |
|
218 | - $sql = 'SHOW TABLES FROM ' . XOOPS_DB_NAME; |
|
219 | - $ret = $xoopsDB->queryF($sql); |
|
220 | - while (list($m_table) = $xoopsDB->fetchRow($ret)) { |
|
221 | - if ($m_table == $realname) { |
|
222 | - $bRetVal = true; |
|
223 | - break; |
|
224 | - } |
|
225 | - } |
|
226 | - $xoopsDB->freeRecordSet($ret); |
|
227 | - |
|
228 | - return $bRetVal; |
|
214 | + $bRetVal = false; |
|
215 | + //Verifies that a MySQL table exists |
|
216 | + $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); |
|
217 | + $realname = $xoopsDB->prefix($table); |
|
218 | + $sql = 'SHOW TABLES FROM ' . XOOPS_DB_NAME; |
|
219 | + $ret = $xoopsDB->queryF($sql); |
|
220 | + while (list($m_table) = $xoopsDB->fetchRow($ret)) { |
|
221 | + if ($m_table == $realname) { |
|
222 | + $bRetVal = true; |
|
223 | + break; |
|
224 | + } |
|
225 | + } |
|
226 | + $xoopsDB->freeRecordSet($ret); |
|
227 | + |
|
228 | + return $bRetVal; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -240,19 +240,19 @@ discard block |
||
240 | 240 | */ |
241 | 241 | function smart_GetMeta($key, $moduleName = false) |
242 | 242 | { |
243 | - if (!$moduleName) { |
|
244 | - $moduleName = smart_getCurrentModuleName(); |
|
245 | - } |
|
246 | - $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); |
|
247 | - $sql = sprintf('SELECT metavalue FROM %s WHERE metakey=%s', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($key)); |
|
248 | - $ret = $xoopsDB->query($sql); |
|
249 | - if (!$ret) { |
|
250 | - $value = false; |
|
251 | - } else { |
|
252 | - list($value) = $xoopsDB->fetchRow($ret); |
|
253 | - } |
|
254 | - |
|
255 | - return $value; |
|
243 | + if (!$moduleName) { |
|
244 | + $moduleName = smart_getCurrentModuleName(); |
|
245 | + } |
|
246 | + $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); |
|
247 | + $sql = sprintf('SELECT metavalue FROM %s WHERE metakey=%s', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($key)); |
|
248 | + $ret = $xoopsDB->query($sql); |
|
249 | + if (!$ret) { |
|
250 | + $value = false; |
|
251 | + } else { |
|
252 | + list($value) = $xoopsDB->fetchRow($ret); |
|
253 | + } |
|
254 | + |
|
255 | + return $value; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -260,12 +260,12 @@ discard block |
||
260 | 260 | */ |
261 | 261 | function smart_getCurrentModuleName() |
262 | 262 | { |
263 | - global $xoopsModule; |
|
264 | - if (is_object($xoopsModule)) { |
|
265 | - return $xoopsModule->getVar('dirname'); |
|
266 | - } else { |
|
267 | - return false; |
|
268 | - } |
|
263 | + global $xoopsModule; |
|
264 | + if (is_object($xoopsModule)) { |
|
265 | + return $xoopsModule->getVar('dirname'); |
|
266 | + } else { |
|
267 | + return false; |
|
268 | + } |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -281,22 +281,22 @@ discard block |
||
281 | 281 | */ |
282 | 282 | function smart_SetMeta($key, $value, $moduleName = false) |
283 | 283 | { |
284 | - if (!$moduleName) { |
|
285 | - $moduleName = smart_getCurrentModuleName(); |
|
286 | - } |
|
287 | - $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); |
|
288 | - $ret = smart_GetMeta($key, $moduleName); |
|
289 | - if ('0' === $ret || $ret > 0) { |
|
290 | - $sql = sprintf('UPDATE %s SET metavalue = %s WHERE metakey = %s', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($value), $xoopsDB->quoteString($key)); |
|
291 | - } else { |
|
292 | - $sql = sprintf('INSERT INTO %s (metakey, metavalue) VALUES (%s, %s)', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($key), $xoopsDB->quoteString($value)); |
|
293 | - } |
|
294 | - $ret = $xoopsDB->queryF($sql); |
|
295 | - if (!$ret) { |
|
296 | - return false; |
|
297 | - } |
|
298 | - |
|
299 | - return true; |
|
284 | + if (!$moduleName) { |
|
285 | + $moduleName = smart_getCurrentModuleName(); |
|
286 | + } |
|
287 | + $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); |
|
288 | + $ret = smart_GetMeta($key, $moduleName); |
|
289 | + if ('0' === $ret || $ret > 0) { |
|
290 | + $sql = sprintf('UPDATE %s SET metavalue = %s WHERE metakey = %s', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($value), $xoopsDB->quoteString($key)); |
|
291 | + } else { |
|
292 | + $sql = sprintf('INSERT INTO %s (metakey, metavalue) VALUES (%s, %s)', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($key), $xoopsDB->quoteString($value)); |
|
293 | + } |
|
294 | + $ret = $xoopsDB->queryF($sql); |
|
295 | + if (!$ret) { |
|
296 | + return false; |
|
297 | + } |
|
298 | + |
|
299 | + return true; |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | // Thanks to Mithrandir:-) |
@@ -309,20 +309,20 @@ discard block |
||
309 | 309 | */ |
310 | 310 | function smart_substr($str, $start, $length, $trimmarker = '...') |
311 | 311 | { |
312 | - // if the string is empty, let's get out ;-) |
|
313 | - if ('' === $str) { |
|
314 | - return $str; |
|
315 | - } |
|
316 | - // reverse a string that is shortened with '' as trimmarker |
|
317 | - $reversed_string = strrev(xoops_substr($str, $start, $length, '')); |
|
318 | - // find first space in reversed string |
|
319 | - $position_of_space = strpos($reversed_string, ' ', 0); |
|
320 | - // truncate the original string to a length of $length |
|
321 | - // minus the position of the last space |
|
322 | - // plus the length of the $trimmarker |
|
323 | - $truncated_string = xoops_substr($str, $start, $length - $position_of_space + strlen($trimmarker), $trimmarker); |
|
324 | - |
|
325 | - return $truncated_string; |
|
312 | + // if the string is empty, let's get out ;-) |
|
313 | + if ('' === $str) { |
|
314 | + return $str; |
|
315 | + } |
|
316 | + // reverse a string that is shortened with '' as trimmarker |
|
317 | + $reversed_string = strrev(xoops_substr($str, $start, $length, '')); |
|
318 | + // find first space in reversed string |
|
319 | + $position_of_space = strpos($reversed_string, ' ', 0); |
|
320 | + // truncate the original string to a length of $length |
|
321 | + // minus the position of the last space |
|
322 | + // plus the length of the $trimmarker |
|
323 | + $truncated_string = xoops_substr($str, $start, $length - $position_of_space + strlen($trimmarker), $trimmarker); |
|
324 | + |
|
325 | + return $truncated_string; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
@@ -333,19 +333,19 @@ discard block |
||
333 | 333 | */ |
334 | 334 | function smart_getConfig($key, $moduleName = false, $default = 'default_is_undefined') |
335 | 335 | { |
336 | - if (!$moduleName) { |
|
337 | - $moduleName = smart_getCurrentModuleName(); |
|
338 | - } |
|
339 | - $configs = smart_getModuleConfig($moduleName); |
|
340 | - if (isset($configs[$key])) { |
|
341 | - return $configs[$key]; |
|
342 | - } else { |
|
343 | - if ('default_is_undefined' === $default) { |
|
344 | - return null; |
|
345 | - } else { |
|
346 | - return $default; |
|
347 | - } |
|
348 | - } |
|
336 | + if (!$moduleName) { |
|
337 | + $moduleName = smart_getCurrentModuleName(); |
|
338 | + } |
|
339 | + $configs = smart_getModuleConfig($moduleName); |
|
340 | + if (isset($configs[$key])) { |
|
341 | + return $configs[$key]; |
|
342 | + } else { |
|
343 | + if ('default_is_undefined' === $default) { |
|
344 | + return null; |
|
345 | + } else { |
|
346 | + return $default; |
|
347 | + } |
|
348 | + } |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | /** |
@@ -358,32 +358,32 @@ discard block |
||
358 | 358 | */ |
359 | 359 | function smart_copyr($source, $dest) |
360 | 360 | { |
361 | - // Simple copy for a file |
|
362 | - if (is_file($source)) { |
|
363 | - return copy($source, $dest); |
|
364 | - } |
|
365 | - // Make destination directory |
|
366 | - if (!is_dir($dest)) { |
|
367 | - mkdir($dest); |
|
368 | - } |
|
369 | - // Loop through the folder |
|
370 | - $dir = dir($source); |
|
371 | - while (false !== $entry = $dir->read()) { |
|
372 | - // Skip pointers |
|
373 | - if ('.' === $entry || '..' === $entry) { |
|
374 | - continue; |
|
375 | - } |
|
376 | - // Deep copy directories |
|
377 | - if (is_dir("$source/$entry") && ("$source/$entry" !== $dest)) { |
|
378 | - copyr("$source/$entry", "$dest/$entry"); |
|
379 | - } else { |
|
380 | - copy("$source/$entry", "$dest/$entry"); |
|
381 | - } |
|
382 | - } |
|
383 | - // Clean up |
|
384 | - $dir->close(); |
|
385 | - |
|
386 | - return true; |
|
361 | + // Simple copy for a file |
|
362 | + if (is_file($source)) { |
|
363 | + return copy($source, $dest); |
|
364 | + } |
|
365 | + // Make destination directory |
|
366 | + if (!is_dir($dest)) { |
|
367 | + mkdir($dest); |
|
368 | + } |
|
369 | + // Loop through the folder |
|
370 | + $dir = dir($source); |
|
371 | + while (false !== $entry = $dir->read()) { |
|
372 | + // Skip pointers |
|
373 | + if ('.' === $entry || '..' === $entry) { |
|
374 | + continue; |
|
375 | + } |
|
376 | + // Deep copy directories |
|
377 | + if (is_dir("$source/$entry") && ("$source/$entry" !== $dest)) { |
|
378 | + copyr("$source/$entry", "$dest/$entry"); |
|
379 | + } else { |
|
380 | + copy("$source/$entry", "$dest/$entry"); |
|
381 | + } |
|
382 | + } |
|
383 | + // Clean up |
|
384 | + $dir->close(); |
|
385 | + |
|
386 | + return true; |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | /** |
@@ -393,26 +393,26 @@ discard block |
||
393 | 393 | */ |
394 | 394 | function smart_admin_mkdir($target) |
395 | 395 | { |
396 | - // http://www.php.net/manual/en/function.mkdir.php |
|
397 | - // saint at corenova.com |
|
398 | - // bart at cdasites dot com |
|
399 | - if (is_dir($target) || empty($target)) { |
|
400 | - return true; // best case check first |
|
401 | - } |
|
402 | - if (file_exists($target) && !is_dir($target)) { |
|
403 | - return false; |
|
404 | - } |
|
405 | - if (smart_admin_mkdir(substr($target, 0, strrpos($target, '/')))) { |
|
406 | - if (!file_exists($target)) { |
|
407 | - $res = mkdir($target, 0777); // crawl back up & create dir tree |
|
408 | - smart_admin_chmod($target); |
|
409 | - |
|
410 | - return $res; |
|
411 | - } |
|
412 | - } |
|
413 | - $res = is_dir($target); |
|
414 | - |
|
415 | - return $res; |
|
396 | + // http://www.php.net/manual/en/function.mkdir.php |
|
397 | + // saint at corenova.com |
|
398 | + // bart at cdasites dot com |
|
399 | + if (is_dir($target) || empty($target)) { |
|
400 | + return true; // best case check first |
|
401 | + } |
|
402 | + if (file_exists($target) && !is_dir($target)) { |
|
403 | + return false; |
|
404 | + } |
|
405 | + if (smart_admin_mkdir(substr($target, 0, strrpos($target, '/')))) { |
|
406 | + if (!file_exists($target)) { |
|
407 | + $res = mkdir($target, 0777); // crawl back up & create dir tree |
|
408 | + smart_admin_chmod($target); |
|
409 | + |
|
410 | + return $res; |
|
411 | + } |
|
412 | + } |
|
413 | + $res = is_dir($target); |
|
414 | + |
|
415 | + return $res; |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | /** |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | */ |
424 | 424 | function smart_admin_chmod($target, $mode = 0777) |
425 | 425 | { |
426 | - return @ chmod($target, $mode); |
|
426 | + return @ chmod($target, $mode); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | /** |
@@ -434,31 +434,31 @@ discard block |
||
434 | 434 | */ |
435 | 435 | function smart_imageResize($src, $maxWidth, $maxHeight) |
436 | 436 | { |
437 | - $width = ''; |
|
438 | - $height = ''; |
|
439 | - $type = ''; |
|
440 | - $attr = ''; |
|
441 | - if (file_exists($src)) { |
|
442 | - list($width, $height, $type, $attr) = getimagesize($src); |
|
443 | - if ($width > $maxWidth) { |
|
444 | - $originalWidth = $width; |
|
445 | - $width = $maxWidth; |
|
446 | - $height = $width * $height / $originalWidth; |
|
447 | - } |
|
448 | - if ($height > $maxHeight) { |
|
449 | - $originalHeight = $height; |
|
450 | - $height = $maxHeight; |
|
451 | - $width = $height * $width / $originalHeight; |
|
452 | - } |
|
453 | - $attr = " width='$width' height='$height'"; |
|
454 | - } |
|
455 | - |
|
456 | - return [ |
|
457 | - $width, |
|
458 | - $height, |
|
459 | - $type, |
|
460 | - $attr |
|
461 | - ]; |
|
437 | + $width = ''; |
|
438 | + $height = ''; |
|
439 | + $type = ''; |
|
440 | + $attr = ''; |
|
441 | + if (file_exists($src)) { |
|
442 | + list($width, $height, $type, $attr) = getimagesize($src); |
|
443 | + if ($width > $maxWidth) { |
|
444 | + $originalWidth = $width; |
|
445 | + $width = $maxWidth; |
|
446 | + $height = $width * $height / $originalWidth; |
|
447 | + } |
|
448 | + if ($height > $maxHeight) { |
|
449 | + $originalHeight = $height; |
|
450 | + $height = $maxHeight; |
|
451 | + $width = $height * $width / $originalHeight; |
|
452 | + } |
|
453 | + $attr = " width='$width' height='$height'"; |
|
454 | + } |
|
455 | + |
|
456 | + return [ |
|
457 | + $width, |
|
458 | + $height, |
|
459 | + $type, |
|
460 | + $attr |
|
461 | + ]; |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | /** |
@@ -467,34 +467,34 @@ discard block |
||
467 | 467 | */ |
468 | 468 | function smart_getModuleInfo($moduleName = false) |
469 | 469 | { |
470 | - static $smartModules; |
|
471 | - if (isset($smartModules[$moduleName])) { |
|
472 | - $ret =& $smartModules[$moduleName]; |
|
473 | - |
|
474 | - return $ret; |
|
475 | - } |
|
476 | - global $xoopsModule; |
|
477 | - if (!$moduleName) { |
|
478 | - if (isset($xoopsModule) && is_object($xoopsModule)) { |
|
479 | - $smartModules[$xoopsModule->getVar('dirname')] = $xoopsModule; |
|
480 | - |
|
481 | - return $smartModules[$xoopsModule->getVar('dirname')]; |
|
482 | - } |
|
483 | - } |
|
484 | - if (!isset($smartModules[$moduleName])) { |
|
485 | - if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $moduleName) { |
|
486 | - $smartModules[$moduleName] = $xoopsModule; |
|
487 | - } else { |
|
488 | - $hModule = xoops_getHandler('module'); |
|
489 | - if ('xoops' !== $moduleName) { |
|
490 | - $smartModules[$moduleName] = $hModule->getByDirname($moduleName); |
|
491 | - } else { |
|
492 | - $smartModules[$moduleName] = $hModule->getByDirname('system'); |
|
493 | - } |
|
494 | - } |
|
495 | - } |
|
496 | - |
|
497 | - return $smartModules[$moduleName]; |
|
470 | + static $smartModules; |
|
471 | + if (isset($smartModules[$moduleName])) { |
|
472 | + $ret =& $smartModules[$moduleName]; |
|
473 | + |
|
474 | + return $ret; |
|
475 | + } |
|
476 | + global $xoopsModule; |
|
477 | + if (!$moduleName) { |
|
478 | + if (isset($xoopsModule) && is_object($xoopsModule)) { |
|
479 | + $smartModules[$xoopsModule->getVar('dirname')] = $xoopsModule; |
|
480 | + |
|
481 | + return $smartModules[$xoopsModule->getVar('dirname')]; |
|
482 | + } |
|
483 | + } |
|
484 | + if (!isset($smartModules[$moduleName])) { |
|
485 | + if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $moduleName) { |
|
486 | + $smartModules[$moduleName] = $xoopsModule; |
|
487 | + } else { |
|
488 | + $hModule = xoops_getHandler('module'); |
|
489 | + if ('xoops' !== $moduleName) { |
|
490 | + $smartModules[$moduleName] = $hModule->getByDirname($moduleName); |
|
491 | + } else { |
|
492 | + $smartModules[$moduleName] = $hModule->getByDirname('system'); |
|
493 | + } |
|
494 | + } |
|
495 | + } |
|
496 | + |
|
497 | + return $smartModules[$moduleName]; |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | /** |
@@ -503,40 +503,40 @@ discard block |
||
503 | 503 | */ |
504 | 504 | function smart_getModuleConfig($moduleName = false) |
505 | 505 | { |
506 | - static $smartConfigs; |
|
507 | - if (isset($smartConfigs[$moduleName])) { |
|
508 | - $ret =& $smartConfigs[$moduleName]; |
|
509 | - |
|
510 | - return $ret; |
|
511 | - } |
|
512 | - global $xoopsModule, $xoopsModuleConfig; |
|
513 | - if (!$moduleName) { |
|
514 | - if (isset($xoopsModule) && is_object($xoopsModule)) { |
|
515 | - $smartConfigs[$xoopsModule->getVar('dirname')] = $xoopsModuleConfig; |
|
516 | - |
|
517 | - return $smartConfigs[$xoopsModule->getVar('dirname')]; |
|
518 | - } |
|
519 | - } |
|
520 | - // if we still did not found the xoopsModule, this is because there is none |
|
521 | - if (!$moduleName) { |
|
522 | - $ret = false; |
|
523 | - |
|
524 | - return $ret; |
|
525 | - } |
|
526 | - if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $moduleName) { |
|
527 | - $smartConfigs[$moduleName] = $xoopsModuleConfig; |
|
528 | - } else { |
|
529 | - $module = smart_getModuleInfo($moduleName); |
|
530 | - if (!is_object($module)) { |
|
531 | - $ret = false; |
|
532 | - |
|
533 | - return $ret; |
|
534 | - } |
|
535 | - $hModConfig = xoops_getHandler('config'); |
|
536 | - $smartConfigs[$moduleName] =& $hModConfig->getConfigsByCat(0, $module->getVar('mid')); |
|
537 | - } |
|
538 | - |
|
539 | - return $smartConfigs[$moduleName]; |
|
506 | + static $smartConfigs; |
|
507 | + if (isset($smartConfigs[$moduleName])) { |
|
508 | + $ret =& $smartConfigs[$moduleName]; |
|
509 | + |
|
510 | + return $ret; |
|
511 | + } |
|
512 | + global $xoopsModule, $xoopsModuleConfig; |
|
513 | + if (!$moduleName) { |
|
514 | + if (isset($xoopsModule) && is_object($xoopsModule)) { |
|
515 | + $smartConfigs[$xoopsModule->getVar('dirname')] = $xoopsModuleConfig; |
|
516 | + |
|
517 | + return $smartConfigs[$xoopsModule->getVar('dirname')]; |
|
518 | + } |
|
519 | + } |
|
520 | + // if we still did not found the xoopsModule, this is because there is none |
|
521 | + if (!$moduleName) { |
|
522 | + $ret = false; |
|
523 | + |
|
524 | + return $ret; |
|
525 | + } |
|
526 | + if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $moduleName) { |
|
527 | + $smartConfigs[$moduleName] = $xoopsModuleConfig; |
|
528 | + } else { |
|
529 | + $module = smart_getModuleInfo($moduleName); |
|
530 | + if (!is_object($module)) { |
|
531 | + $ret = false; |
|
532 | + |
|
533 | + return $ret; |
|
534 | + } |
|
535 | + $hModConfig = xoops_getHandler('config'); |
|
536 | + $smartConfigs[$moduleName] =& $hModConfig->getConfigsByCat(0, $module->getVar('mid')); |
|
537 | + } |
|
538 | + |
|
539 | + return $smartConfigs[$moduleName]; |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | /** |
@@ -545,10 +545,10 @@ discard block |
||
545 | 545 | */ |
546 | 546 | function smart_deleteFile($dirname) |
547 | 547 | { |
548 | - // Simple delete for a file |
|
549 | - if (is_file($dirname)) { |
|
550 | - return unlink($dirname); |
|
551 | - } |
|
548 | + // Simple delete for a file |
|
549 | + if (is_file($dirname)) { |
|
550 | + return unlink($dirname); |
|
551 | + } |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | /** |
@@ -557,12 +557,12 @@ discard block |
||
557 | 557 | */ |
558 | 558 | function smart_formatErrors($errors = []) |
559 | 559 | { |
560 | - $ret = ''; |
|
561 | - foreach ($errors as $key => $value) { |
|
562 | - $ret .= '<br> - ' . $value; |
|
563 | - } |
|
560 | + $ret = ''; |
|
561 | + foreach ($errors as $key => $value) { |
|
562 | + $ret .= '<br> - ' . $value; |
|
563 | + } |
|
564 | 564 | |
565 | - return $ret; |
|
565 | + return $ret; |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
@@ -576,46 +576,46 @@ discard block |
||
576 | 576 | */ |
577 | 577 | function smart_getLinkedUnameFromId($userid = 0, $name = 0, $users = [], $withContact = false) |
578 | 578 | { |
579 | - if (!is_numeric($userid)) { |
|
580 | - return $userid; |
|
581 | - } |
|
582 | - $userid = (int)$userid; |
|
583 | - if ($userid > 0) { |
|
584 | - if ($users == []) { |
|
585 | - //fetching users |
|
586 | - $memberHandler = xoops_getHandler('member'); |
|
587 | - $user =& $memberHandler->getUser($userid); |
|
588 | - } else { |
|
589 | - if (!isset($users[$userid])) { |
|
590 | - return $GLOBALS['xoopsConfig']['anonymous']; |
|
591 | - } |
|
592 | - $user =& $users[$userid]; |
|
593 | - } |
|
594 | - if (is_object($user)) { |
|
595 | - $ts = MyTextSanitizer:: getInstance(); |
|
596 | - $username = $user->getVar('uname'); |
|
597 | - $fullname = ''; |
|
598 | - $fullname2 = $user->getVar('name'); |
|
599 | - if ($name && !empty($fullname2)) { |
|
600 | - $fullname = $user->getVar('name'); |
|
601 | - } |
|
602 | - if (!empty($fullname)) { |
|
603 | - $linkeduser = "$fullname [<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $ts->htmlSpecialChars($username) . '</a>]'; |
|
604 | - } else { |
|
605 | - $linkeduser = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . ucwords($ts->htmlSpecialChars($username)) . '</a>'; |
|
606 | - } |
|
607 | - // add contact info: email + PM |
|
608 | - if ($withContact) { |
|
609 | - $linkeduser .= ' <a href="mailto:' . $user->getVar('email') . '"><img style="vertical-align: middle;" src="' . XOOPS_URL . '/images/icons/email.gif' . '" alt="' . _CO_SOBJECT_SEND_EMAIL . '" title="' . _CO_SOBJECT_SEND_EMAIL . '"></a>'; |
|
610 | - $js = "javascript:openWithSelfMain('" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $userid . "', 'pmlite',450,370);"; |
|
611 | - $linkeduser .= ' <a href="' . $js . '"><img style="vertical-align: middle;" src="' . XOOPS_URL . '/images/icons/pm.gif' . '" alt="' . _CO_SOBJECT_SEND_PM . '" title="' . _CO_SOBJECT_SEND_PM . '"></a>'; |
|
612 | - } |
|
613 | - |
|
614 | - return $linkeduser; |
|
615 | - } |
|
616 | - } |
|
617 | - |
|
618 | - return $GLOBALS['xoopsConfig']['anonymous']; |
|
579 | + if (!is_numeric($userid)) { |
|
580 | + return $userid; |
|
581 | + } |
|
582 | + $userid = (int)$userid; |
|
583 | + if ($userid > 0) { |
|
584 | + if ($users == []) { |
|
585 | + //fetching users |
|
586 | + $memberHandler = xoops_getHandler('member'); |
|
587 | + $user =& $memberHandler->getUser($userid); |
|
588 | + } else { |
|
589 | + if (!isset($users[$userid])) { |
|
590 | + return $GLOBALS['xoopsConfig']['anonymous']; |
|
591 | + } |
|
592 | + $user =& $users[$userid]; |
|
593 | + } |
|
594 | + if (is_object($user)) { |
|
595 | + $ts = MyTextSanitizer:: getInstance(); |
|
596 | + $username = $user->getVar('uname'); |
|
597 | + $fullname = ''; |
|
598 | + $fullname2 = $user->getVar('name'); |
|
599 | + if ($name && !empty($fullname2)) { |
|
600 | + $fullname = $user->getVar('name'); |
|
601 | + } |
|
602 | + if (!empty($fullname)) { |
|
603 | + $linkeduser = "$fullname [<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $ts->htmlSpecialChars($username) . '</a>]'; |
|
604 | + } else { |
|
605 | + $linkeduser = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . ucwords($ts->htmlSpecialChars($username)) . '</a>'; |
|
606 | + } |
|
607 | + // add contact info: email + PM |
|
608 | + if ($withContact) { |
|
609 | + $linkeduser .= ' <a href="mailto:' . $user->getVar('email') . '"><img style="vertical-align: middle;" src="' . XOOPS_URL . '/images/icons/email.gif' . '" alt="' . _CO_SOBJECT_SEND_EMAIL . '" title="' . _CO_SOBJECT_SEND_EMAIL . '"></a>'; |
|
610 | + $js = "javascript:openWithSelfMain('" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $userid . "', 'pmlite',450,370);"; |
|
611 | + $linkeduser .= ' <a href="' . $js . '"><img style="vertical-align: middle;" src="' . XOOPS_URL . '/images/icons/pm.gif' . '" alt="' . _CO_SOBJECT_SEND_PM . '" title="' . _CO_SOBJECT_SEND_PM . '"></a>'; |
|
612 | + } |
|
613 | + |
|
614 | + return $linkeduser; |
|
615 | + } |
|
616 | + } |
|
617 | + |
|
618 | + return $GLOBALS['xoopsConfig']['anonymous']; |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | /** |
@@ -626,33 +626,33 @@ discard block |
||
626 | 626 | */ |
627 | 627 | function smart_adminMenu($currentoption = 0, $breadcrumb = '', $submenus = false, $currentsub = -1) |
628 | 628 | { |
629 | - global $xoopsModule, $xoopsConfig; |
|
630 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
631 | - if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php')) { |
|
632 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php'; |
|
633 | - } else { |
|
634 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/modinfo.php'; |
|
635 | - } |
|
636 | - if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/admin.php')) { |
|
637 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/admin.php'; |
|
638 | - } else { |
|
639 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/admin.php'; |
|
640 | - } |
|
641 | - $headermenu = []; |
|
642 | - $adminObject = []; |
|
643 | - include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/menu.php'; |
|
644 | - $tpl = new XoopsTpl(); |
|
645 | - $tpl->assign([ |
|
646 | - 'headermenu' => $headermenu, |
|
647 | - 'adminmenu' => $adminObject, |
|
648 | - 'current' => $currentoption, |
|
649 | - 'breadcrumb' => $breadcrumb, |
|
650 | - 'headermenucount' => count($headermenu), |
|
651 | - 'submenus' => $submenus, |
|
652 | - 'currentsub' => $currentsub, |
|
653 | - 'submenuscount' => count($submenus) |
|
654 | - ]); |
|
655 | - $tpl->display('db:smartobject_admin_menu.tpl'); |
|
629 | + global $xoopsModule, $xoopsConfig; |
|
630 | + require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
631 | + if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php')) { |
|
632 | + require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php'; |
|
633 | + } else { |
|
634 | + require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/modinfo.php'; |
|
635 | + } |
|
636 | + if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/admin.php')) { |
|
637 | + require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/admin.php'; |
|
638 | + } else { |
|
639 | + require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/admin.php'; |
|
640 | + } |
|
641 | + $headermenu = []; |
|
642 | + $adminObject = []; |
|
643 | + include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/menu.php'; |
|
644 | + $tpl = new XoopsTpl(); |
|
645 | + $tpl->assign([ |
|
646 | + 'headermenu' => $headermenu, |
|
647 | + 'adminmenu' => $adminObject, |
|
648 | + 'current' => $currentoption, |
|
649 | + 'breadcrumb' => $breadcrumb, |
|
650 | + 'headermenucount' => count($headermenu), |
|
651 | + 'submenus' => $submenus, |
|
652 | + 'currentsub' => $currentsub, |
|
653 | + 'submenuscount' => count($submenus) |
|
654 | + ]); |
|
655 | + $tpl->display('db:smartobject_admin_menu.tpl'); |
|
656 | 656 | } |
657 | 657 | |
658 | 658 | /** |
@@ -662,13 +662,13 @@ discard block |
||
662 | 662 | */ |
663 | 663 | function smart_collapsableBar($id = '', $title = '', $dsc = '') |
664 | 664 | { |
665 | - global $xoopsModule; |
|
666 | - echo "<h3 style=\"color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; \"><a href='javascript:;' onclick=\"togglecollapse('" . $id . "'); toggleIcon('" . $id . "_icon')\";>"; |
|
667 | - echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt=''></a> " . $title . '</h3>'; |
|
668 | - echo "<div id='" . $id . "'>"; |
|
669 | - if ('' !== $dsc) { |
|
670 | - echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $dsc . '</span>'; |
|
671 | - } |
|
665 | + global $xoopsModule; |
|
666 | + echo "<h3 style=\"color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; \"><a href='javascript:;' onclick=\"togglecollapse('" . $id . "'); toggleIcon('" . $id . "_icon')\";>"; |
|
667 | + echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt=''></a> " . $title . '</h3>'; |
|
668 | + echo "<div id='" . $id . "'>"; |
|
669 | + if ('' !== $dsc) { |
|
670 | + echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $dsc . '</span>'; |
|
671 | + } |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | /** |
@@ -678,15 +678,15 @@ discard block |
||
678 | 678 | */ |
679 | 679 | function smart_ajaxCollapsableBar($id = '', $title = '', $dsc = '') |
680 | 680 | { |
681 | - global $xoopsModule; |
|
682 | - $onClick = "ajaxtogglecollapse('$id')"; |
|
683 | - //$onClick = "togglecollapse('$id'); toggleIcon('" . $id . "_icon')"; |
|
684 | - echo '<h3 style="border: 1px solid; color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; " onclick="' . $onClick . '">'; |
|
685 | - echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt=''></a> " . $title . '</h3>'; |
|
686 | - echo "<div id='" . $id . "'>"; |
|
687 | - if ('' !== $dsc) { |
|
688 | - echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $dsc . '</span>'; |
|
689 | - } |
|
681 | + global $xoopsModule; |
|
682 | + $onClick = "ajaxtogglecollapse('$id')"; |
|
683 | + //$onClick = "togglecollapse('$id'); toggleIcon('" . $id . "_icon')"; |
|
684 | + echo '<h3 style="border: 1px solid; color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; " onclick="' . $onClick . '">'; |
|
685 | + echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt=''></a> " . $title . '</h3>'; |
|
686 | + echo "<div id='" . $id . "'>"; |
|
687 | + if ('' !== $dsc) { |
|
688 | + echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $dsc . '</span>'; |
|
689 | + } |
|
690 | 690 | } |
691 | 691 | |
692 | 692 | /** |
@@ -713,20 +713,20 @@ discard block |
||
713 | 713 | */ |
714 | 714 | function smart_openclose_collapsable($name) |
715 | 715 | { |
716 | - $urls = smart_getCurrentUrls(); |
|
717 | - $path = $urls['phpself']; |
|
718 | - $cookie_name = $path . '_smart_collaps_' . $name; |
|
719 | - $cookie_name = str_replace('.', '_', $cookie_name); |
|
720 | - $cookie = smart_getCookieVar($cookie_name, ''); |
|
721 | - if ('none' === $cookie) { |
|
722 | - echo ' |
|
716 | + $urls = smart_getCurrentUrls(); |
|
717 | + $path = $urls['phpself']; |
|
718 | + $cookie_name = $path . '_smart_collaps_' . $name; |
|
719 | + $cookie_name = str_replace('.', '_', $cookie_name); |
|
720 | + $cookie = smart_getCookieVar($cookie_name, ''); |
|
721 | + if ('none' === $cookie) { |
|
722 | + echo ' |
|
723 | 723 | <script type="text/javascript"><!-- |
724 | 724 | togglecollapse("' . $name . '"); toggleIcon("' . $name . '_icon"); |
725 | 725 | //--> |
726 | 726 | </script> |
727 | 727 | '; |
728 | - } |
|
729 | - /* if ($cookie == 'none') { |
|
728 | + } |
|
729 | + /* if ($cookie == 'none') { |
|
730 | 730 | echo ' |
731 | 731 | <script type="text/javascript"><!-- |
732 | 732 | hideElement("' . $name . '"); |
@@ -742,9 +742,9 @@ discard block |
||
742 | 742 | */ |
743 | 743 | function smart_close_collapsable($name) |
744 | 744 | { |
745 | - echo '</div>'; |
|
746 | - smart_openclose_collapsable($name); |
|
747 | - echo '<br>'; |
|
745 | + echo '</div>'; |
|
746 | + smart_openclose_collapsable($name); |
|
747 | + echo '<br>'; |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | /** |
@@ -754,11 +754,11 @@ discard block |
||
754 | 754 | */ |
755 | 755 | function smart_setCookieVar($name, $value, $time = 0) |
756 | 756 | { |
757 | - if (0 == $time) { |
|
758 | - $time = time() + 3600 * 24 * 365; |
|
759 | - //$time = ''; |
|
760 | - } |
|
761 | - setcookie($name, $value, $time, '/'); |
|
757 | + if (0 == $time) { |
|
758 | + $time = time() + 3600 * 24 * 365; |
|
759 | + //$time = ''; |
|
760 | + } |
|
761 | + setcookie($name, $value, $time, '/'); |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | /** |
@@ -768,12 +768,12 @@ discard block |
||
768 | 768 | */ |
769 | 769 | function smart_getCookieVar($name, $default = '') |
770 | 770 | { |
771 | - $name = str_replace('.', '_', $name); |
|
772 | - if (isset($_COOKIE[$name]) && ($_COOKIE[$name] > '')) { |
|
773 | - return $_COOKIE[$name]; |
|
774 | - } else { |
|
775 | - return $default; |
|
776 | - } |
|
771 | + $name = str_replace('.', '_', $name); |
|
772 | + if (isset($_COOKIE[$name]) && ($_COOKIE[$name] > '')) { |
|
773 | + return $_COOKIE[$name]; |
|
774 | + } else { |
|
775 | + return $default; |
|
776 | + } |
|
777 | 777 | } |
778 | 778 | |
779 | 779 | /** |
@@ -781,25 +781,25 @@ discard block |
||
781 | 781 | */ |
782 | 782 | function smart_getCurrentUrls() |
783 | 783 | { |
784 | - $urls = []; |
|
785 | - $http = (false === strpos(XOOPS_URL, 'https://')) ? 'http://' : 'https://'; |
|
786 | - $phpself = $_SERVER['PHP_SELF']; |
|
787 | - $httphost = $_SERVER['HTTP_HOST']; |
|
788 | - $querystring = $_SERVER['QUERY_STRING']; |
|
789 | - if ('' !== $querystring) { |
|
790 | - $querystring = '?' . $querystring; |
|
791 | - } |
|
792 | - $currenturl = $http . $httphost . $phpself . $querystring; |
|
793 | - $urls = []; |
|
794 | - $urls['http'] = $http; |
|
795 | - $urls['httphost'] = $httphost; |
|
796 | - $urls['phpself'] = $phpself; |
|
797 | - $urls['querystring'] = $querystring; |
|
798 | - $urls['full_phpself'] = $http . $httphost . $phpself; |
|
799 | - $urls['full'] = $currenturl; |
|
800 | - $urls['isHomePage'] = (XOOPS_URL . '/index.php') == ($http . $httphost . $phpself); |
|
801 | - |
|
802 | - return $urls; |
|
784 | + $urls = []; |
|
785 | + $http = (false === strpos(XOOPS_URL, 'https://')) ? 'http://' : 'https://'; |
|
786 | + $phpself = $_SERVER['PHP_SELF']; |
|
787 | + $httphost = $_SERVER['HTTP_HOST']; |
|
788 | + $querystring = $_SERVER['QUERY_STRING']; |
|
789 | + if ('' !== $querystring) { |
|
790 | + $querystring = '?' . $querystring; |
|
791 | + } |
|
792 | + $currenturl = $http . $httphost . $phpself . $querystring; |
|
793 | + $urls = []; |
|
794 | + $urls['http'] = $http; |
|
795 | + $urls['httphost'] = $httphost; |
|
796 | + $urls['phpself'] = $phpself; |
|
797 | + $urls['querystring'] = $querystring; |
|
798 | + $urls['full_phpself'] = $http . $httphost . $phpself; |
|
799 | + $urls['full'] = $currenturl; |
|
800 | + $urls['isHomePage'] = (XOOPS_URL . '/index.php') == ($http . $httphost . $phpself); |
|
801 | + |
|
802 | + return $urls; |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | /** |
@@ -807,9 +807,9 @@ discard block |
||
807 | 807 | */ |
808 | 808 | function smart_getCurrentPage() |
809 | 809 | { |
810 | - $urls = smart_getCurrentUrls(); |
|
810 | + $urls = smart_getCurrentUrls(); |
|
811 | 811 | |
812 | - return $urls['full']; |
|
812 | + return $urls['full']; |
|
813 | 813 | } |
814 | 814 | |
815 | 815 | /** |
@@ -872,29 +872,29 @@ discard block |
||
872 | 872 | */ |
873 | 873 | function smart_modFooter() |
874 | 874 | { |
875 | - global $xoopsConfig, $xoopsModule, $xoopsModuleConfig; |
|
876 | - |
|
877 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
878 | - $tpl = new XoopsTpl(); |
|
879 | - |
|
880 | - $hModule = xoops_getHandler('module'); |
|
881 | - $versioninfo =& $hModule->get($xoopsModule->getVar('mid')); |
|
882 | - $modfootertxt = 'Module ' . $versioninfo->getInfo('name') . ' - Version ' . $versioninfo->getInfo('version') . ''; |
|
883 | - $modfooter = "<a href='" . $versioninfo->getInfo('support_site_url') . "' target='_blank'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/assets/images/cssbutton.gif' title='" . $modfootertxt . "' alt='" . $modfootertxt . "'></a>"; |
|
884 | - $tpl->assign('modfooter', $modfooter); |
|
885 | - |
|
886 | - if (!defined('_AM_SOBJECT_XOOPS_PRO')) { |
|
887 | - define('_AM_SOBJECT_XOOPS_PRO', 'Do you need help with this module ?<br>Do you need new features not yet available?'); |
|
888 | - } |
|
889 | - $smartobjectConfig = smart_getModuleConfig('smartobject'); |
|
890 | - $tpl->assign('smartobject_enable_admin_footer', $smartobjectConfig['enable_admin_footer']); |
|
891 | - $tpl->display(SMARTOBJECT_ROOT_PATH . 'templates/smartobject_admin_footer.tpl'); |
|
875 | + global $xoopsConfig, $xoopsModule, $xoopsModuleConfig; |
|
876 | + |
|
877 | + require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
878 | + $tpl = new XoopsTpl(); |
|
879 | + |
|
880 | + $hModule = xoops_getHandler('module'); |
|
881 | + $versioninfo =& $hModule->get($xoopsModule->getVar('mid')); |
|
882 | + $modfootertxt = 'Module ' . $versioninfo->getInfo('name') . ' - Version ' . $versioninfo->getInfo('version') . ''; |
|
883 | + $modfooter = "<a href='" . $versioninfo->getInfo('support_site_url') . "' target='_blank'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/assets/images/cssbutton.gif' title='" . $modfootertxt . "' alt='" . $modfootertxt . "'></a>"; |
|
884 | + $tpl->assign('modfooter', $modfooter); |
|
885 | + |
|
886 | + if (!defined('_AM_SOBJECT_XOOPS_PRO')) { |
|
887 | + define('_AM_SOBJECT_XOOPS_PRO', 'Do you need help with this module ?<br>Do you need new features not yet available?'); |
|
888 | + } |
|
889 | + $smartobjectConfig = smart_getModuleConfig('smartobject'); |
|
890 | + $tpl->assign('smartobject_enable_admin_footer', $smartobjectConfig['enable_admin_footer']); |
|
891 | + $tpl->display(SMARTOBJECT_ROOT_PATH . 'templates/smartobject_admin_footer.tpl'); |
|
892 | 892 | } |
893 | 893 | |
894 | 894 | function smart_xoops_cp_footer() |
895 | 895 | { |
896 | - smart_modFooter(); |
|
897 | - xoops_cp_footer(); |
|
896 | + smart_modFooter(); |
|
897 | + xoops_cp_footer(); |
|
898 | 898 | } |
899 | 899 | |
900 | 900 | /** |
@@ -903,11 +903,11 @@ discard block |
||
903 | 903 | */ |
904 | 904 | function smart_sanitizeForCommonTags($text) |
905 | 905 | { |
906 | - global $xoopsConfig; |
|
907 | - $text = str_replace('{X_SITENAME}', $xoopsConfig['sitename'], $text); |
|
908 | - $text = str_replace('{X_ADMINMAIL}', $xoopsConfig['adminmail'], $text); |
|
906 | + global $xoopsConfig; |
|
907 | + $text = str_replace('{X_SITENAME}', $xoopsConfig['sitename'], $text); |
|
908 | + $text = str_replace('{X_ADMINMAIL}', $xoopsConfig['adminmail'], $text); |
|
909 | 909 | |
910 | - return $text; |
|
910 | + return $text; |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | /** |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | */ |
916 | 916 | function smart_addScript($src) |
917 | 917 | { |
918 | - echo '<script src="' . $src . '" type="text/javascript"></script>'; |
|
918 | + echo '<script src="' . $src . '" type="text/javascript"></script>'; |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | /** |
@@ -923,17 +923,17 @@ discard block |
||
923 | 923 | */ |
924 | 924 | function smart_addStyle($src) |
925 | 925 | { |
926 | - if ('smartobject' === $src) { |
|
927 | - $src = SMARTOBJECT_URL . 'assets/css/module.css'; |
|
928 | - } |
|
929 | - echo smart_get_css_link($src); |
|
926 | + if ('smartobject' === $src) { |
|
927 | + $src = SMARTOBJECT_URL . 'assets/css/module.css'; |
|
928 | + } |
|
929 | + echo smart_get_css_link($src); |
|
930 | 930 | } |
931 | 931 | |
932 | 932 | function smart_addAdminAjaxSupport() |
933 | 933 | { |
934 | - smart_addScript(SMARTOBJECT_URL . 'include/scriptaculous/lib/prototype.js'); |
|
935 | - smart_addScript(SMARTOBJECT_URL . 'include/scriptaculous/src/scriptaculous.js'); |
|
936 | - smart_addScript(SMARTOBJECT_URL . 'include/scriptaculous/src/smart.js'); |
|
934 | + smart_addScript(SMARTOBJECT_URL . 'include/scriptaculous/lib/prototype.js'); |
|
935 | + smart_addScript(SMARTOBJECT_URL . 'include/scriptaculous/src/scriptaculous.js'); |
|
936 | + smart_addScript(SMARTOBJECT_URL . 'include/scriptaculous/src/smart.js'); |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | /** |
@@ -942,11 +942,11 @@ discard block |
||
942 | 942 | */ |
943 | 943 | function smart_sanitizeForSmartpopupLink($text) |
944 | 944 | { |
945 | - $patterns[] = "/\[smartpopup=(['\"]?)([^\"'<>]*)\\1](.*)\[\/smartpopup\]/sU"; |
|
946 | - $replacements[] = "<a href=\"javascript:openWithSelfMain('\\2', 'smartpopup', 700, 519);\">\\3</a>"; |
|
947 | - $ret = preg_replace($patterns, $replacements, $text); |
|
945 | + $patterns[] = "/\[smartpopup=(['\"]?)([^\"'<>]*)\\1](.*)\[\/smartpopup\]/sU"; |
|
946 | + $replacements[] = "<a href=\"javascript:openWithSelfMain('\\2', 'smartpopup', 700, 519);\">\\3</a>"; |
|
947 | + $ret = preg_replace($patterns, $replacements, $text); |
|
948 | 948 | |
949 | - return $ret; |
|
949 | + return $ret; |
|
950 | 950 | } |
951 | 951 | |
952 | 952 | /** |
@@ -961,25 +961,25 @@ discard block |
||
961 | 961 | */ |
962 | 962 | function smart_getImageSize($url, & $width, & $height) |
963 | 963 | { |
964 | - if (empty($width) || empty($height)) { |
|
965 | - if (!$dimension = @ getimagesize($url)) { |
|
966 | - return false; |
|
967 | - } |
|
968 | - if (!empty($width)) { |
|
969 | - $height = $dimension[1] * $width / $dimension[0]; |
|
970 | - } elseif (!empty($height)) { |
|
971 | - $width = $dimension[0] * $height / $dimension[1]; |
|
972 | - } else { |
|
973 | - list($width, $height) = [ |
|
974 | - $dimension[0], |
|
975 | - $dimension[1] |
|
976 | - ]; |
|
977 | - } |
|
978 | - |
|
979 | - return true; |
|
980 | - } else { |
|
981 | - return true; |
|
982 | - } |
|
964 | + if (empty($width) || empty($height)) { |
|
965 | + if (!$dimension = @ getimagesize($url)) { |
|
966 | + return false; |
|
967 | + } |
|
968 | + if (!empty($width)) { |
|
969 | + $height = $dimension[1] * $width / $dimension[0]; |
|
970 | + } elseif (!empty($height)) { |
|
971 | + $width = $dimension[0] * $height / $dimension[1]; |
|
972 | + } else { |
|
973 | + list($width, $height) = [ |
|
974 | + $dimension[0], |
|
975 | + $dimension[1] |
|
976 | + ]; |
|
977 | + } |
|
978 | + |
|
979 | + return true; |
|
980 | + } else { |
|
981 | + return true; |
|
982 | + } |
|
983 | 983 | } |
984 | 984 | |
985 | 985 | /** |
@@ -992,10 +992,10 @@ discard block |
||
992 | 992 | */ |
993 | 993 | function smart_htmlnumericentities($str) |
994 | 994 | { |
995 | - // return preg_replace('/[^!-%\x27-;=?-~ ]/e', '"&#".ord("$0").chr(59)', $str); |
|
996 | - return preg_replace_callback('/[^!-%\x27-;=?-~ ]/', function ($m) { |
|
997 | - return '&#' . ord($m[0]) . chr(59); |
|
998 | - }, $str); |
|
995 | + // return preg_replace('/[^!-%\x27-;=?-~ ]/e', '"&#".ord("$0").chr(59)', $str); |
|
996 | + return preg_replace_callback('/[^!-%\x27-;=?-~ ]/', function ($m) { |
|
997 | + return '&#' . ord($m[0]) . chr(59); |
|
998 | + }, $str); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | /** |
@@ -1005,24 +1005,24 @@ discard block |
||
1005 | 1005 | */ |
1006 | 1006 | function smart_getcorehandler($name, $optional = false) |
1007 | 1007 | { |
1008 | - static $handlers; |
|
1009 | - $name = strtolower(trim($name)); |
|
1010 | - if (!isset($handlers[$name])) { |
|
1011 | - if (file_exists($hnd_file = XOOPS_ROOT_PATH . '/kernel/' . $name . '.php')) { |
|
1012 | - require_once $hnd_file; |
|
1013 | - } |
|
1014 | - $class = 'Xoops' . ucfirst($name) . 'Handler'; |
|
1015 | - if (class_exists($class)) { |
|
1016 | - $handlers[$name] = new $class($GLOBALS['xoopsDB'], 'xoops'); |
|
1017 | - } |
|
1018 | - } |
|
1019 | - if (!isset($handlers[$name]) && !$optional) { |
|
1020 | - trigger_error('Class <b>' . $class . '</b> does not exist<br>Handler Name: ' . $name, E_USER_ERROR); |
|
1021 | - } |
|
1022 | - if (isset($handlers[$name])) { |
|
1023 | - return $handlers[$name]; |
|
1024 | - } |
|
1025 | - $inst = false; |
|
1008 | + static $handlers; |
|
1009 | + $name = strtolower(trim($name)); |
|
1010 | + if (!isset($handlers[$name])) { |
|
1011 | + if (file_exists($hnd_file = XOOPS_ROOT_PATH . '/kernel/' . $name . '.php')) { |
|
1012 | + require_once $hnd_file; |
|
1013 | + } |
|
1014 | + $class = 'Xoops' . ucfirst($name) . 'Handler'; |
|
1015 | + if (class_exists($class)) { |
|
1016 | + $handlers[$name] = new $class($GLOBALS['xoopsDB'], 'xoops'); |
|
1017 | + } |
|
1018 | + } |
|
1019 | + if (!isset($handlers[$name]) && !$optional) { |
|
1020 | + trigger_error('Class <b>' . $class . '</b> does not exist<br>Handler Name: ' . $name, E_USER_ERROR); |
|
1021 | + } |
|
1022 | + if (isset($handlers[$name])) { |
|
1023 | + return $handlers[$name]; |
|
1024 | + } |
|
1025 | + $inst = false; |
|
1026 | 1026 | } |
1027 | 1027 | |
1028 | 1028 | /** |
@@ -1031,15 +1031,15 @@ discard block |
||
1031 | 1031 | */ |
1032 | 1032 | function smart_sanitizeAdsenses_callback($matches) |
1033 | 1033 | { |
1034 | - global $smartobjectAdsenseHandler; |
|
1035 | - if (isset($smartobjectAdsenseHandler->objects[$matches[1]])) { |
|
1036 | - $adsenseObj = $smartobjectAdsenseHandler->objects[$matches[1]]; |
|
1037 | - $ret = $adsenseObj->render(); |
|
1038 | - |
|
1039 | - return $ret; |
|
1040 | - } else { |
|
1041 | - return ''; |
|
1042 | - } |
|
1034 | + global $smartobjectAdsenseHandler; |
|
1035 | + if (isset($smartobjectAdsenseHandler->objects[$matches[1]])) { |
|
1036 | + $adsenseObj = $smartobjectAdsenseHandler->objects[$matches[1]]; |
|
1037 | + $ret = $adsenseObj->render(); |
|
1038 | + |
|
1039 | + return $ret; |
|
1040 | + } else { |
|
1041 | + return ''; |
|
1042 | + } |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | 1045 | /** |
@@ -1048,13 +1048,13 @@ discard block |
||
1048 | 1048 | */ |
1049 | 1049 | function smart_sanitizeAdsenses($text) |
1050 | 1050 | { |
1051 | - $patterns = []; |
|
1052 | - $replacements = []; |
|
1051 | + $patterns = []; |
|
1052 | + $replacements = []; |
|
1053 | 1053 | |
1054 | - $patterns[] = "/\[adsense](.*)\[\/adsense\]/sU"; |
|
1055 | - $text = preg_replace_callback($patterns, 'smart_sanitizeAdsenses_callback', $text); |
|
1054 | + $patterns[] = "/\[adsense](.*)\[\/adsense\]/sU"; |
|
1055 | + $text = preg_replace_callback($patterns, 'smart_sanitizeAdsenses_callback', $text); |
|
1056 | 1056 | |
1057 | - return $text; |
|
1057 | + return $text; |
|
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | /** |
@@ -1063,15 +1063,15 @@ discard block |
||
1063 | 1063 | */ |
1064 | 1064 | function smart_sanitizeCustomtags_callback($matches) |
1065 | 1065 | { |
1066 | - global $smartobjectCustomtagHandler; |
|
1067 | - if (isset($smartobjectCustomtagHandler->objects[$matches[1]])) { |
|
1068 | - $customObj = $smartobjectCustomtagHandler->objects[$matches[1]]; |
|
1069 | - $ret = $customObj->renderWithPhp(); |
|
1070 | - |
|
1071 | - return $ret; |
|
1072 | - } else { |
|
1073 | - return ''; |
|
1074 | - } |
|
1066 | + global $smartobjectCustomtagHandler; |
|
1067 | + if (isset($smartobjectCustomtagHandler->objects[$matches[1]])) { |
|
1068 | + $customObj = $smartobjectCustomtagHandler->objects[$matches[1]]; |
|
1069 | + $ret = $customObj->renderWithPhp(); |
|
1070 | + |
|
1071 | + return $ret; |
|
1072 | + } else { |
|
1073 | + return ''; |
|
1074 | + } |
|
1075 | 1075 | } |
1076 | 1076 | |
1077 | 1077 | /** |
@@ -1080,13 +1080,13 @@ discard block |
||
1080 | 1080 | */ |
1081 | 1081 | function smart_sanitizeCustomtags($text) |
1082 | 1082 | { |
1083 | - $patterns = []; |
|
1084 | - $replacements = []; |
|
1083 | + $patterns = []; |
|
1084 | + $replacements = []; |
|
1085 | 1085 | |
1086 | - $patterns[] = "/\[customtag](.*)\[\/customtag\]/sU"; |
|
1087 | - $text = preg_replace_callback($patterns, 'smart_sanitizeCustomtags_callback', $text); |
|
1086 | + $patterns[] = "/\[customtag](.*)\[\/customtag\]/sU"; |
|
1087 | + $text = preg_replace_callback($patterns, 'smart_sanitizeCustomtags_callback', $text); |
|
1088 | 1088 | |
1089 | - return $text; |
|
1089 | + return $text; |
|
1090 | 1090 | } |
1091 | 1091 | |
1092 | 1092 | /** |
@@ -1095,20 +1095,20 @@ discard block |
||
1095 | 1095 | */ |
1096 | 1096 | function smart_loadLanguageFile($module, $file) |
1097 | 1097 | { |
1098 | - global $xoopsConfig; |
|
1099 | - |
|
1100 | - $filename = XOOPS_ROOT_PATH . '/modules/' . $module . '/language/' . $xoopsConfig['language'] . '/' . $file . '.php'; |
|
1101 | - if (!file_exists($filename)) { |
|
1102 | - $filename = XOOPS_ROOT_PATH . '/modules/' . $module . '/language/english/' . $file . '.php'; |
|
1103 | - } |
|
1104 | - if (file_exists($filename)) { |
|
1105 | - require_once $filename; |
|
1106 | - } |
|
1098 | + global $xoopsConfig; |
|
1099 | + |
|
1100 | + $filename = XOOPS_ROOT_PATH . '/modules/' . $module . '/language/' . $xoopsConfig['language'] . '/' . $file . '.php'; |
|
1101 | + if (!file_exists($filename)) { |
|
1102 | + $filename = XOOPS_ROOT_PATH . '/modules/' . $module . '/language/english/' . $file . '.php'; |
|
1103 | + } |
|
1104 | + if (file_exists($filename)) { |
|
1105 | + require_once $filename; |
|
1106 | + } |
|
1107 | 1107 | } |
1108 | 1108 | |
1109 | 1109 | function smart_loadCommonLanguageFile() |
1110 | 1110 | { |
1111 | - smart_loadLanguageFile('smartobject', 'common'); |
|
1111 | + smart_loadLanguageFile('smartobject', 'common'); |
|
1112 | 1112 | } |
1113 | 1113 | |
1114 | 1114 | /** |
@@ -1118,35 +1118,35 @@ discard block |
||
1118 | 1118 | */ |
1119 | 1119 | function smart_purifyText($text, $keyword = false) |
1120 | 1120 | { |
1121 | - global $myts; |
|
1122 | - $text = str_replace(' ', ' ', $text); |
|
1123 | - $text = str_replace('<br>', ' ', $text); |
|
1124 | - $text = str_replace('<br>', ' ', $text); |
|
1125 | - $text = str_replace('<br', ' ', $text); |
|
1126 | - $text = strip_tags($text); |
|
1127 | - $text = html_entity_decode($text); |
|
1128 | - $text = $myts->undoHtmlSpecialChars($text); |
|
1129 | - $text = str_replace(')', ' ', $text); |
|
1130 | - $text = str_replace('(', ' ', $text); |
|
1131 | - $text = str_replace(':', ' ', $text); |
|
1132 | - $text = str_replace('&euro', ' euro ', $text); |
|
1133 | - $text = str_replace('&hellip', '...', $text); |
|
1134 | - $text = str_replace('&rsquo', ' ', $text); |
|
1135 | - $text = str_replace('!', ' ', $text); |
|
1136 | - $text = str_replace('?', ' ', $text); |
|
1137 | - $text = str_replace('"', ' ', $text); |
|
1138 | - $text = str_replace('-', ' ', $text); |
|
1139 | - $text = str_replace('\n', ' ', $text); |
|
1140 | - $text = str_replace('―', ' ', $text); |
|
1141 | - |
|
1142 | - if ($keyword) { |
|
1143 | - $text = str_replace('.', ' ', $text); |
|
1144 | - $text = str_replace(',', ' ', $text); |
|
1145 | - $text = str_replace('\'', ' ', $text); |
|
1146 | - } |
|
1147 | - $text = str_replace(';', ' ', $text); |
|
1148 | - |
|
1149 | - return $text; |
|
1121 | + global $myts; |
|
1122 | + $text = str_replace(' ', ' ', $text); |
|
1123 | + $text = str_replace('<br>', ' ', $text); |
|
1124 | + $text = str_replace('<br>', ' ', $text); |
|
1125 | + $text = str_replace('<br', ' ', $text); |
|
1126 | + $text = strip_tags($text); |
|
1127 | + $text = html_entity_decode($text); |
|
1128 | + $text = $myts->undoHtmlSpecialChars($text); |
|
1129 | + $text = str_replace(')', ' ', $text); |
|
1130 | + $text = str_replace('(', ' ', $text); |
|
1131 | + $text = str_replace(':', ' ', $text); |
|
1132 | + $text = str_replace('&euro', ' euro ', $text); |
|
1133 | + $text = str_replace('&hellip', '...', $text); |
|
1134 | + $text = str_replace('&rsquo', ' ', $text); |
|
1135 | + $text = str_replace('!', ' ', $text); |
|
1136 | + $text = str_replace('?', ' ', $text); |
|
1137 | + $text = str_replace('"', ' ', $text); |
|
1138 | + $text = str_replace('-', ' ', $text); |
|
1139 | + $text = str_replace('\n', ' ', $text); |
|
1140 | + $text = str_replace('―', ' ', $text); |
|
1141 | + |
|
1142 | + if ($keyword) { |
|
1143 | + $text = str_replace('.', ' ', $text); |
|
1144 | + $text = str_replace(',', ' ', $text); |
|
1145 | + $text = str_replace('\'', ' ', $text); |
|
1146 | + } |
|
1147 | + $text = str_replace(';', ' ', $text); |
|
1148 | + |
|
1149 | + return $text; |
|
1150 | 1150 | } |
1151 | 1151 | |
1152 | 1152 | /** |
@@ -1155,51 +1155,51 @@ discard block |
||
1155 | 1155 | */ |
1156 | 1156 | function smart_html2text($document) |
1157 | 1157 | { |
1158 | - // PHP Manual:: function preg_replace |
|
1159 | - // $document should contain an HTML document. |
|
1160 | - // This will remove HTML tags, javascript sections |
|
1161 | - // and white space. It will also convert some |
|
1162 | - // common HTML entities to their text equivalent. |
|
1163 | - // Credits: newbb2 |
|
1164 | - $search = [ |
|
1165 | - "'<script[^>]*?>.*?</script>'si", // Strip out javascript |
|
1166 | - "'<img.*?>'si", // Strip out img tags |
|
1167 | - "'<[\/\!]*?[^<>]*?>'si", // Strip out HTML tags |
|
1168 | - "'([\r\n])[\s]+'", // Strip out white space |
|
1169 | - "'&(quot|#34);'i", // Replace HTML entities |
|
1170 | - "'&(amp|#38);'i", |
|
1171 | - "'&(lt|#60);'i", |
|
1172 | - "'&(gt|#62);'i", |
|
1173 | - "'&(nbsp|#160);'i", |
|
1174 | - "'&(iexcl|#161);'i", |
|
1175 | - "'&(cent|#162);'i", |
|
1176 | - "'&(pound|#163);'i", |
|
1177 | - "'&(copy|#169);'i" |
|
1178 | - ]; // evaluate as php |
|
1179 | - |
|
1180 | - $replace = [ |
|
1181 | - '', |
|
1182 | - '', |
|
1183 | - '', |
|
1184 | - "\\1", |
|
1185 | - "\"", |
|
1186 | - '&', |
|
1187 | - '<', |
|
1188 | - '>', |
|
1189 | - ' ', |
|
1190 | - chr(161), |
|
1191 | - chr(162), |
|
1192 | - chr(163), |
|
1193 | - chr(169), |
|
1194 | - ]; |
|
1195 | - |
|
1196 | - $text = preg_replace($search, $replace, $document); |
|
1197 | - |
|
1198 | - preg_replace_callback('/&#(\d+);/', function ($matches) { |
|
1199 | - return chr($matches[1]); |
|
1200 | - }, $document); |
|
1201 | - |
|
1202 | - return $text; |
|
1158 | + // PHP Manual:: function preg_replace |
|
1159 | + // $document should contain an HTML document. |
|
1160 | + // This will remove HTML tags, javascript sections |
|
1161 | + // and white space. It will also convert some |
|
1162 | + // common HTML entities to their text equivalent. |
|
1163 | + // Credits: newbb2 |
|
1164 | + $search = [ |
|
1165 | + "'<script[^>]*?>.*?</script>'si", // Strip out javascript |
|
1166 | + "'<img.*?>'si", // Strip out img tags |
|
1167 | + "'<[\/\!]*?[^<>]*?>'si", // Strip out HTML tags |
|
1168 | + "'([\r\n])[\s]+'", // Strip out white space |
|
1169 | + "'&(quot|#34);'i", // Replace HTML entities |
|
1170 | + "'&(amp|#38);'i", |
|
1171 | + "'&(lt|#60);'i", |
|
1172 | + "'&(gt|#62);'i", |
|
1173 | + "'&(nbsp|#160);'i", |
|
1174 | + "'&(iexcl|#161);'i", |
|
1175 | + "'&(cent|#162);'i", |
|
1176 | + "'&(pound|#163);'i", |
|
1177 | + "'&(copy|#169);'i" |
|
1178 | + ]; // evaluate as php |
|
1179 | + |
|
1180 | + $replace = [ |
|
1181 | + '', |
|
1182 | + '', |
|
1183 | + '', |
|
1184 | + "\\1", |
|
1185 | + "\"", |
|
1186 | + '&', |
|
1187 | + '<', |
|
1188 | + '>', |
|
1189 | + ' ', |
|
1190 | + chr(161), |
|
1191 | + chr(162), |
|
1192 | + chr(163), |
|
1193 | + chr(169), |
|
1194 | + ]; |
|
1195 | + |
|
1196 | + $text = preg_replace($search, $replace, $document); |
|
1197 | + |
|
1198 | + preg_replace_callback('/&#(\d+);/', function ($matches) { |
|
1199 | + return chr($matches[1]); |
|
1200 | + }, $document); |
|
1201 | + |
|
1202 | + return $text; |
|
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 | /** |
@@ -1213,32 +1213,32 @@ discard block |
||
1213 | 1213 | */ |
1214 | 1214 | function smart_getfloat($str, $set = false) |
1215 | 1215 | { |
1216 | - if (preg_match("/([0-9\.,-]+)/", $str, $match)) { |
|
1217 | - // Found number in $str, so set $str that number |
|
1218 | - $str = $match[0]; |
|
1219 | - if (false !== strpos($str, ',')) { |
|
1220 | - // A comma exists, that makes it easy, cos we assume it separates the decimal part. |
|
1221 | - $str = str_replace('.', '', $str); // Erase thousand seps |
|
1222 | - $str = str_replace(',', '.', $str); // Convert , to . for floatval command |
|
1223 | - |
|
1224 | - return (float)$str; |
|
1225 | - } else { |
|
1226 | - // No comma exists, so we have to decide, how a single dot shall be treated |
|
1227 | - if (true === preg_match("/^[0-9\-]*[\.]{1}[0-9-]+$/", $str) && true === $set['single_dot_as_decimal']) { |
|
1228 | - // Treat single dot as decimal separator |
|
1229 | - return (float)$str; |
|
1230 | - } else { |
|
1231 | - //echo "str: ".$str; echo "ret: ".str_replace('.', '', $str); echo "<br><br> "; |
|
1232 | - // Else, treat all dots as thousand seps |
|
1233 | - $str = str_replace('.', '', $str); // Erase thousand seps |
|
1234 | - |
|
1235 | - return (float)$str; |
|
1236 | - } |
|
1237 | - } |
|
1238 | - } else { |
|
1239 | - // No number found, return zero |
|
1240 | - return 0; |
|
1241 | - } |
|
1216 | + if (preg_match("/([0-9\.,-]+)/", $str, $match)) { |
|
1217 | + // Found number in $str, so set $str that number |
|
1218 | + $str = $match[0]; |
|
1219 | + if (false !== strpos($str, ',')) { |
|
1220 | + // A comma exists, that makes it easy, cos we assume it separates the decimal part. |
|
1221 | + $str = str_replace('.', '', $str); // Erase thousand seps |
|
1222 | + $str = str_replace(',', '.', $str); // Convert , to . for floatval command |
|
1223 | + |
|
1224 | + return (float)$str; |
|
1225 | + } else { |
|
1226 | + // No comma exists, so we have to decide, how a single dot shall be treated |
|
1227 | + if (true === preg_match("/^[0-9\-]*[\.]{1}[0-9-]+$/", $str) && true === $set['single_dot_as_decimal']) { |
|
1228 | + // Treat single dot as decimal separator |
|
1229 | + return (float)$str; |
|
1230 | + } else { |
|
1231 | + //echo "str: ".$str; echo "ret: ".str_replace('.', '', $str); echo "<br><br> "; |
|
1232 | + // Else, treat all dots as thousand seps |
|
1233 | + $str = str_replace('.', '', $str); // Erase thousand seps |
|
1234 | + |
|
1235 | + return (float)$str; |
|
1236 | + } |
|
1237 | + } |
|
1238 | + } else { |
|
1239 | + // No number found, return zero |
|
1240 | + return 0; |
|
1241 | + } |
|
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | /** |
@@ -1248,26 +1248,26 @@ discard block |
||
1248 | 1248 | */ |
1249 | 1249 | function smart_currency($var, $currencyObj = false) |
1250 | 1250 | { |
1251 | - $ret = smart_getfloat($var, ['single_dot_as_decimal' => true]); |
|
1252 | - $ret = round($ret, 2); |
|
1253 | - // make sur we have at least .00 in the $var |
|
1254 | - $decimal_section_original = strstr($ret, '.'); |
|
1255 | - $decimal_section = $decimal_section_original; |
|
1256 | - if ($decimal_section) { |
|
1257 | - if (1 == strlen($decimal_section)) { |
|
1258 | - $decimal_section = '.00'; |
|
1259 | - } elseif (2 == strlen($decimal_section)) { |
|
1260 | - $decimal_section .= '0'; |
|
1261 | - } |
|
1262 | - $ret = str_replace($decimal_section_original, $decimal_section, $ret); |
|
1263 | - } else { |
|
1264 | - $ret .= '.00'; |
|
1265 | - } |
|
1266 | - if ($currencyObj) { |
|
1267 | - $ret = $ret . ' ' . $currencyObj->getCode(); |
|
1268 | - } |
|
1269 | - |
|
1270 | - return $ret; |
|
1251 | + $ret = smart_getfloat($var, ['single_dot_as_decimal' => true]); |
|
1252 | + $ret = round($ret, 2); |
|
1253 | + // make sur we have at least .00 in the $var |
|
1254 | + $decimal_section_original = strstr($ret, '.'); |
|
1255 | + $decimal_section = $decimal_section_original; |
|
1256 | + if ($decimal_section) { |
|
1257 | + if (1 == strlen($decimal_section)) { |
|
1258 | + $decimal_section = '.00'; |
|
1259 | + } elseif (2 == strlen($decimal_section)) { |
|
1260 | + $decimal_section .= '0'; |
|
1261 | + } |
|
1262 | + $ret = str_replace($decimal_section_original, $decimal_section, $ret); |
|
1263 | + } else { |
|
1264 | + $ret .= '.00'; |
|
1265 | + } |
|
1266 | + if ($currencyObj) { |
|
1267 | + $ret = $ret . ' ' . $currencyObj->getCode(); |
|
1268 | + } |
|
1269 | + |
|
1270 | + return $ret; |
|
1271 | 1271 | } |
1272 | 1272 | |
1273 | 1273 | /** |
@@ -1276,7 +1276,7 @@ discard block |
||
1276 | 1276 | */ |
1277 | 1277 | function smart_float($var) |
1278 | 1278 | { |
1279 | - return smart_currency($var); |
|
1279 | + return smart_currency($var); |
|
1280 | 1280 | } |
1281 | 1281 | |
1282 | 1282 | /** |
@@ -1285,16 +1285,16 @@ discard block |
||
1285 | 1285 | */ |
1286 | 1286 | function smart_getModuleAdminLink($moduleName = false) |
1287 | 1287 | { |
1288 | - global $xoopsModule; |
|
1289 | - if (!$moduleName && (isset($xoopsModule) && is_object($xoopsModule))) { |
|
1290 | - $moduleName = $xoopsModule->getVar('dirname'); |
|
1291 | - } |
|
1292 | - $ret = ''; |
|
1293 | - if ($moduleName) { |
|
1294 | - $ret = "<a href='" . XOOPS_URL . "/modules/$moduleName/admin/index.php'>" . _CO_SOBJECT_ADMIN_PAGE . '</a>'; |
|
1295 | - } |
|
1296 | - |
|
1297 | - return $ret; |
|
1288 | + global $xoopsModule; |
|
1289 | + if (!$moduleName && (isset($xoopsModule) && is_object($xoopsModule))) { |
|
1290 | + $moduleName = $xoopsModule->getVar('dirname'); |
|
1291 | + } |
|
1292 | + $ret = ''; |
|
1293 | + if ($moduleName) { |
|
1294 | + $ret = "<a href='" . XOOPS_URL . "/modules/$moduleName/admin/index.php'>" . _CO_SOBJECT_ADMIN_PAGE . '</a>'; |
|
1295 | + } |
|
1296 | + |
|
1297 | + return $ret; |
|
1298 | 1298 | } |
1299 | 1299 | |
1300 | 1300 | /** |
@@ -1302,19 +1302,19 @@ discard block |
||
1302 | 1302 | */ |
1303 | 1303 | function smart_getEditors() |
1304 | 1304 | { |
1305 | - $filename = XOOPS_ROOT_PATH . '/class/xoopseditor/xoopseditor.php'; |
|
1306 | - if (!file_exists($filename)) { |
|
1307 | - return false; |
|
1308 | - } |
|
1309 | - require_once $filename; |
|
1310 | - $xoopseditorHandler = XoopsEditorHandler::getInstance(); |
|
1311 | - $aList = $xoopseditorHandler->getList(); |
|
1312 | - $ret = []; |
|
1313 | - foreach ($aList as $k => $v) { |
|
1314 | - $ret[$v] = $k; |
|
1315 | - } |
|
1316 | - |
|
1317 | - return $ret; |
|
1305 | + $filename = XOOPS_ROOT_PATH . '/class/xoopseditor/xoopseditor.php'; |
|
1306 | + if (!file_exists($filename)) { |
|
1307 | + return false; |
|
1308 | + } |
|
1309 | + require_once $filename; |
|
1310 | + $xoopseditorHandler = XoopsEditorHandler::getInstance(); |
|
1311 | + $aList = $xoopseditorHandler->getList(); |
|
1312 | + $ret = []; |
|
1313 | + foreach ($aList as $k => $v) { |
|
1314 | + $ret[$v] = $k; |
|
1315 | + } |
|
1316 | + |
|
1317 | + return $ret; |
|
1318 | 1318 | } |
1319 | 1319 | |
1320 | 1320 | /** |
@@ -1324,11 +1324,11 @@ discard block |
||
1324 | 1324 | */ |
1325 | 1325 | function smart_getTablesArray($moduleName, $items) |
1326 | 1326 | { |
1327 | - $ret = []; |
|
1328 | - foreach ($items as $item) { |
|
1329 | - $ret[] = $moduleName . '_' . $item; |
|
1330 | - } |
|
1331 | - $ret[] = $moduleName . '_meta'; |
|
1327 | + $ret = []; |
|
1328 | + foreach ($items as $item) { |
|
1329 | + $ret[] = $moduleName . '_' . $item; |
|
1330 | + } |
|
1331 | + $ret[] = $moduleName . '_meta'; |
|
1332 | 1332 | |
1333 | - return $ret; |
|
1333 | + return $ret; |
|
1334 | 1334 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | function smart_get_css_link($cssfile) |
13 | 13 | { |
14 | - $ret = '<link rel="stylesheet" type="text/css" href="' . $cssfile . '">'; |
|
14 | + $ret = '<link rel="stylesheet" type="text/css" href="'.$cssfile.'">'; |
|
15 | 15 | |
16 | 16 | return $ret; |
17 | 17 | } |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | $seoMode = smart_getModuleModeSEO($moduleName); |
103 | 103 | if ('rewrite' === $seoMode) { |
104 | 104 | $seoModuleName = smart_getModuleNameForSEO($moduleName); |
105 | - $ret = XOOPS_URL . '/' . $seoModuleName . '/'; |
|
105 | + $ret = XOOPS_URL.'/'.$seoModuleName.'/'; |
|
106 | 106 | } elseif ('pathinfo' === $seoMode) { |
107 | - $ret = XOOPS_URL . '/modules/' . $moduleName . '/seo.php/' . $seoModuleName . '/'; |
|
107 | + $ret = XOOPS_URL.'/modules/'.$moduleName.'/seo.php/'.$seoModuleName.'/'; |
|
108 | 108 | } else { |
109 | - $ret = XOOPS_URL . '/modules/' . $moduleName . '/'; |
|
109 | + $ret = XOOPS_URL.'/modules/'.$moduleName.'/'; |
|
110 | 110 | } |
111 | 111 | |
112 | - return '<a href="' . $ret . '">' . $smartModule->getVar('name') . '</a>'; |
|
112 | + return '<a href="'.$ret.'">'.$smartModule->getVar('name').'</a>'; |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | /** |
173 | 173 | * include SmartObject admin language file |
174 | 174 | */ |
175 | - $fileName = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/admin.php'; |
|
175 | + $fileName = XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/'.$xoopsConfig['language'].'/admin.php'; |
|
176 | 176 | if (file_exists($fileName)) { |
177 | 177 | require_once $fileName; |
178 | 178 | } else { |
179 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/admin.php'; |
|
179 | + require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/english/admin.php'; |
|
180 | 180 | } ?> |
181 | 181 | <script type='text/javascript'> |
182 | 182 | <!-- |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | /** |
194 | 194 | * Include the admin language constants for the SmartObject Framework |
195 | 195 | */ |
196 | - $admin_file = SMARTOBJECT_ROOT_PATH . 'language/' . $xoopsConfig['language'] . '/admin.php'; |
|
196 | + $admin_file = SMARTOBJECT_ROOT_PATH.'language/'.$xoopsConfig['language'].'/admin.php'; |
|
197 | 197 | if (!file_exists($admin_file)) { |
198 | - $admin_file = SMARTOBJECT_ROOT_PATH . 'language/english/admin.php'; |
|
198 | + $admin_file = SMARTOBJECT_ROOT_PATH.'language/english/admin.php'; |
|
199 | 199 | } |
200 | 200 | require_once $admin_file; |
201 | 201 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | //Verifies that a MySQL table exists |
216 | 216 | $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); |
217 | 217 | $realname = $xoopsDB->prefix($table); |
218 | - $sql = 'SHOW TABLES FROM ' . XOOPS_DB_NAME; |
|
218 | + $sql = 'SHOW TABLES FROM '.XOOPS_DB_NAME; |
|
219 | 219 | $ret = $xoopsDB->queryF($sql); |
220 | 220 | while (list($m_table) = $xoopsDB->fetchRow($ret)) { |
221 | 221 | if ($m_table == $realname) { |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | $moduleName = smart_getCurrentModuleName(); |
245 | 245 | } |
246 | 246 | $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); |
247 | - $sql = sprintf('SELECT metavalue FROM %s WHERE metakey=%s', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($key)); |
|
247 | + $sql = sprintf('SELECT metavalue FROM %s WHERE metakey=%s', $xoopsDB->prefix($moduleName.'_meta'), $xoopsDB->quoteString($key)); |
|
248 | 248 | $ret = $xoopsDB->query($sql); |
249 | 249 | if (!$ret) { |
250 | 250 | $value = false; |
@@ -287,9 +287,9 @@ discard block |
||
287 | 287 | $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); |
288 | 288 | $ret = smart_GetMeta($key, $moduleName); |
289 | 289 | if ('0' === $ret || $ret > 0) { |
290 | - $sql = sprintf('UPDATE %s SET metavalue = %s WHERE metakey = %s', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($value), $xoopsDB->quoteString($key)); |
|
290 | + $sql = sprintf('UPDATE %s SET metavalue = %s WHERE metakey = %s', $xoopsDB->prefix($moduleName.'_meta'), $xoopsDB->quoteString($value), $xoopsDB->quoteString($key)); |
|
291 | 291 | } else { |
292 | - $sql = sprintf('INSERT INTO %s (metakey, metavalue) VALUES (%s, %s)', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($key), $xoopsDB->quoteString($value)); |
|
292 | + $sql = sprintf('INSERT INTO %s (metakey, metavalue) VALUES (%s, %s)', $xoopsDB->prefix($moduleName.'_meta'), $xoopsDB->quoteString($key), $xoopsDB->quoteString($value)); |
|
293 | 293 | } |
294 | 294 | $ret = $xoopsDB->queryF($sql); |
295 | 295 | if (!$ret) { |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | { |
470 | 470 | static $smartModules; |
471 | 471 | if (isset($smartModules[$moduleName])) { |
472 | - $ret =& $smartModules[$moduleName]; |
|
472 | + $ret = & $smartModules[$moduleName]; |
|
473 | 473 | |
474 | 474 | return $ret; |
475 | 475 | } |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | { |
506 | 506 | static $smartConfigs; |
507 | 507 | if (isset($smartConfigs[$moduleName])) { |
508 | - $ret =& $smartConfigs[$moduleName]; |
|
508 | + $ret = & $smartConfigs[$moduleName]; |
|
509 | 509 | |
510 | 510 | return $ret; |
511 | 511 | } |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | return $ret; |
534 | 534 | } |
535 | 535 | $hModConfig = xoops_getHandler('config'); |
536 | - $smartConfigs[$moduleName] =& $hModConfig->getConfigsByCat(0, $module->getVar('mid')); |
|
536 | + $smartConfigs[$moduleName] = & $hModConfig->getConfigsByCat(0, $module->getVar('mid')); |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | return $smartConfigs[$moduleName]; |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | { |
560 | 560 | $ret = ''; |
561 | 561 | foreach ($errors as $key => $value) { |
562 | - $ret .= '<br> - ' . $value; |
|
562 | + $ret .= '<br> - '.$value; |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | return $ret; |
@@ -579,17 +579,17 @@ discard block |
||
579 | 579 | if (!is_numeric($userid)) { |
580 | 580 | return $userid; |
581 | 581 | } |
582 | - $userid = (int)$userid; |
|
582 | + $userid = (int) $userid; |
|
583 | 583 | if ($userid > 0) { |
584 | 584 | if ($users == []) { |
585 | 585 | //fetching users |
586 | 586 | $memberHandler = xoops_getHandler('member'); |
587 | - $user =& $memberHandler->getUser($userid); |
|
587 | + $user = & $memberHandler->getUser($userid); |
|
588 | 588 | } else { |
589 | 589 | if (!isset($users[$userid])) { |
590 | 590 | return $GLOBALS['xoopsConfig']['anonymous']; |
591 | 591 | } |
592 | - $user =& $users[$userid]; |
|
592 | + $user = & $users[$userid]; |
|
593 | 593 | } |
594 | 594 | if (is_object($user)) { |
595 | 595 | $ts = MyTextSanitizer:: getInstance(); |
@@ -600,15 +600,15 @@ discard block |
||
600 | 600 | $fullname = $user->getVar('name'); |
601 | 601 | } |
602 | 602 | if (!empty($fullname)) { |
603 | - $linkeduser = "$fullname [<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $ts->htmlSpecialChars($username) . '</a>]'; |
|
603 | + $linkeduser = "$fullname [<a href='".XOOPS_URL.'/userinfo.php?uid='.$userid."'>".$ts->htmlSpecialChars($username).'</a>]'; |
|
604 | 604 | } else { |
605 | - $linkeduser = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . ucwords($ts->htmlSpecialChars($username)) . '</a>'; |
|
605 | + $linkeduser = "<a href='".XOOPS_URL.'/userinfo.php?uid='.$userid."'>".ucwords($ts->htmlSpecialChars($username)).'</a>'; |
|
606 | 606 | } |
607 | 607 | // add contact info: email + PM |
608 | 608 | if ($withContact) { |
609 | - $linkeduser .= ' <a href="mailto:' . $user->getVar('email') . '"><img style="vertical-align: middle;" src="' . XOOPS_URL . '/images/icons/email.gif' . '" alt="' . _CO_SOBJECT_SEND_EMAIL . '" title="' . _CO_SOBJECT_SEND_EMAIL . '"></a>'; |
|
610 | - $js = "javascript:openWithSelfMain('" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $userid . "', 'pmlite',450,370);"; |
|
611 | - $linkeduser .= ' <a href="' . $js . '"><img style="vertical-align: middle;" src="' . XOOPS_URL . '/images/icons/pm.gif' . '" alt="' . _CO_SOBJECT_SEND_PM . '" title="' . _CO_SOBJECT_SEND_PM . '"></a>'; |
|
609 | + $linkeduser .= ' <a href="mailto:'.$user->getVar('email').'"><img style="vertical-align: middle;" src="'.XOOPS_URL.'/images/icons/email.gif'.'" alt="'._CO_SOBJECT_SEND_EMAIL.'" title="'._CO_SOBJECT_SEND_EMAIL.'"></a>'; |
|
610 | + $js = "javascript:openWithSelfMain('".XOOPS_URL.'/pmlite.php?send2=1&to_userid='.$userid."', 'pmlite',450,370);"; |
|
611 | + $linkeduser .= ' <a href="'.$js.'"><img style="vertical-align: middle;" src="'.XOOPS_URL.'/images/icons/pm.gif'.'" alt="'._CO_SOBJECT_SEND_PM.'" title="'._CO_SOBJECT_SEND_PM.'"></a>'; |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | return $linkeduser; |
@@ -627,20 +627,20 @@ discard block |
||
627 | 627 | function smart_adminMenu($currentoption = 0, $breadcrumb = '', $submenus = false, $currentsub = -1) |
628 | 628 | { |
629 | 629 | global $xoopsModule, $xoopsConfig; |
630 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
631 | - if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php')) { |
|
632 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php'; |
|
630 | + require_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
631 | + if (file_exists(XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/'.$xoopsConfig['language'].'/modinfo.php')) { |
|
632 | + require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/'.$xoopsConfig['language'].'/modinfo.php'; |
|
633 | 633 | } else { |
634 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/modinfo.php'; |
|
634 | + require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/english/modinfo.php'; |
|
635 | 635 | } |
636 | - if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/admin.php')) { |
|
637 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/admin.php'; |
|
636 | + if (file_exists(XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/'.$xoopsConfig['language'].'/admin.php')) { |
|
637 | + require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/'.$xoopsConfig['language'].'/admin.php'; |
|
638 | 638 | } else { |
639 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/admin.php'; |
|
639 | + require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/english/admin.php'; |
|
640 | 640 | } |
641 | 641 | $headermenu = []; |
642 | 642 | $adminObject = []; |
643 | - include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/menu.php'; |
|
643 | + include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/admin/menu.php'; |
|
644 | 644 | $tpl = new XoopsTpl(); |
645 | 645 | $tpl->assign([ |
646 | 646 | 'headermenu' => $headermenu, |
@@ -663,11 +663,11 @@ discard block |
||
663 | 663 | function smart_collapsableBar($id = '', $title = '', $dsc = '') |
664 | 664 | { |
665 | 665 | global $xoopsModule; |
666 | - echo "<h3 style=\"color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; \"><a href='javascript:;' onclick=\"togglecollapse('" . $id . "'); toggleIcon('" . $id . "_icon')\";>"; |
|
667 | - echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt=''></a> " . $title . '</h3>'; |
|
668 | - echo "<div id='" . $id . "'>"; |
|
666 | + echo "<h3 style=\"color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; \"><a href='javascript:;' onclick=\"togglecollapse('".$id."'); toggleIcon('".$id."_icon')\";>"; |
|
667 | + echo "<img id='".$id."_icon' src=".SMARTOBJECT_URL."assets/images/close12.gif alt=''></a> ".$title.'</h3>'; |
|
668 | + echo "<div id='".$id."'>"; |
|
669 | 669 | if ('' !== $dsc) { |
670 | - echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $dsc . '</span>'; |
|
670 | + echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">".$dsc.'</span>'; |
|
671 | 671 | } |
672 | 672 | } |
673 | 673 | |
@@ -681,11 +681,11 @@ discard block |
||
681 | 681 | global $xoopsModule; |
682 | 682 | $onClick = "ajaxtogglecollapse('$id')"; |
683 | 683 | //$onClick = "togglecollapse('$id'); toggleIcon('" . $id . "_icon')"; |
684 | - echo '<h3 style="border: 1px solid; color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; " onclick="' . $onClick . '">'; |
|
685 | - echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt=''></a> " . $title . '</h3>'; |
|
686 | - echo "<div id='" . $id . "'>"; |
|
684 | + echo '<h3 style="border: 1px solid; color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; " onclick="'.$onClick.'">'; |
|
685 | + echo "<img id='".$id."_icon' src=".SMARTOBJECT_URL."assets/images/close12.gif alt=''></a> ".$title.'</h3>'; |
|
686 | + echo "<div id='".$id."'>"; |
|
687 | 687 | if ('' !== $dsc) { |
688 | - echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $dsc . '</span>'; |
|
688 | + echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">".$dsc.'</span>'; |
|
689 | 689 | } |
690 | 690 | } |
691 | 691 | |
@@ -715,13 +715,13 @@ discard block |
||
715 | 715 | { |
716 | 716 | $urls = smart_getCurrentUrls(); |
717 | 717 | $path = $urls['phpself']; |
718 | - $cookie_name = $path . '_smart_collaps_' . $name; |
|
718 | + $cookie_name = $path.'_smart_collaps_'.$name; |
|
719 | 719 | $cookie_name = str_replace('.', '_', $cookie_name); |
720 | 720 | $cookie = smart_getCookieVar($cookie_name, ''); |
721 | 721 | if ('none' === $cookie) { |
722 | 722 | echo ' |
723 | 723 | <script type="text/javascript"><!-- |
724 | - togglecollapse("' . $name . '"); toggleIcon("' . $name . '_icon"); |
|
724 | + togglecollapse("' . $name.'"); toggleIcon("'.$name.'_icon"); |
|
725 | 725 | //--> |
726 | 726 | </script> |
727 | 727 | '; |
@@ -787,17 +787,17 @@ discard block |
||
787 | 787 | $httphost = $_SERVER['HTTP_HOST']; |
788 | 788 | $querystring = $_SERVER['QUERY_STRING']; |
789 | 789 | if ('' !== $querystring) { |
790 | - $querystring = '?' . $querystring; |
|
790 | + $querystring = '?'.$querystring; |
|
791 | 791 | } |
792 | - $currenturl = $http . $httphost . $phpself . $querystring; |
|
792 | + $currenturl = $http.$httphost.$phpself.$querystring; |
|
793 | 793 | $urls = []; |
794 | 794 | $urls['http'] = $http; |
795 | 795 | $urls['httphost'] = $httphost; |
796 | 796 | $urls['phpself'] = $phpself; |
797 | 797 | $urls['querystring'] = $querystring; |
798 | - $urls['full_phpself'] = $http . $httphost . $phpself; |
|
798 | + $urls['full_phpself'] = $http.$httphost.$phpself; |
|
799 | 799 | $urls['full'] = $currenturl; |
800 | - $urls['isHomePage'] = (XOOPS_URL . '/index.php') == ($http . $httphost . $phpself); |
|
800 | + $urls['isHomePage'] = (XOOPS_URL.'/index.php') == ($http.$httphost.$phpself); |
|
801 | 801 | |
802 | 802 | return $urls; |
803 | 803 | } |
@@ -874,13 +874,13 @@ discard block |
||
874 | 874 | { |
875 | 875 | global $xoopsConfig, $xoopsModule, $xoopsModuleConfig; |
876 | 876 | |
877 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
877 | + require_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
878 | 878 | $tpl = new XoopsTpl(); |
879 | 879 | |
880 | 880 | $hModule = xoops_getHandler('module'); |
881 | - $versioninfo =& $hModule->get($xoopsModule->getVar('mid')); |
|
882 | - $modfootertxt = 'Module ' . $versioninfo->getInfo('name') . ' - Version ' . $versioninfo->getInfo('version') . ''; |
|
883 | - $modfooter = "<a href='" . $versioninfo->getInfo('support_site_url') . "' target='_blank'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/assets/images/cssbutton.gif' title='" . $modfootertxt . "' alt='" . $modfootertxt . "'></a>"; |
|
881 | + $versioninfo = & $hModule->get($xoopsModule->getVar('mid')); |
|
882 | + $modfootertxt = 'Module '.$versioninfo->getInfo('name').' - Version '.$versioninfo->getInfo('version').''; |
|
883 | + $modfooter = "<a href='".$versioninfo->getInfo('support_site_url')."' target='_blank'><img src='".XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/assets/images/cssbutton.gif' title='".$modfootertxt."' alt='".$modfootertxt."'></a>"; |
|
884 | 884 | $tpl->assign('modfooter', $modfooter); |
885 | 885 | |
886 | 886 | if (!defined('_AM_SOBJECT_XOOPS_PRO')) { |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | } |
889 | 889 | $smartobjectConfig = smart_getModuleConfig('smartobject'); |
890 | 890 | $tpl->assign('smartobject_enable_admin_footer', $smartobjectConfig['enable_admin_footer']); |
891 | - $tpl->display(SMARTOBJECT_ROOT_PATH . 'templates/smartobject_admin_footer.tpl'); |
|
891 | + $tpl->display(SMARTOBJECT_ROOT_PATH.'templates/smartobject_admin_footer.tpl'); |
|
892 | 892 | } |
893 | 893 | |
894 | 894 | function smart_xoops_cp_footer() |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | */ |
916 | 916 | function smart_addScript($src) |
917 | 917 | { |
918 | - echo '<script src="' . $src . '" type="text/javascript"></script>'; |
|
918 | + echo '<script src="'.$src.'" type="text/javascript"></script>'; |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | /** |
@@ -924,16 +924,16 @@ discard block |
||
924 | 924 | function smart_addStyle($src) |
925 | 925 | { |
926 | 926 | if ('smartobject' === $src) { |
927 | - $src = SMARTOBJECT_URL . 'assets/css/module.css'; |
|
927 | + $src = SMARTOBJECT_URL.'assets/css/module.css'; |
|
928 | 928 | } |
929 | 929 | echo smart_get_css_link($src); |
930 | 930 | } |
931 | 931 | |
932 | 932 | function smart_addAdminAjaxSupport() |
933 | 933 | { |
934 | - smart_addScript(SMARTOBJECT_URL . 'include/scriptaculous/lib/prototype.js'); |
|
935 | - smart_addScript(SMARTOBJECT_URL . 'include/scriptaculous/src/scriptaculous.js'); |
|
936 | - smart_addScript(SMARTOBJECT_URL . 'include/scriptaculous/src/smart.js'); |
|
934 | + smart_addScript(SMARTOBJECT_URL.'include/scriptaculous/lib/prototype.js'); |
|
935 | + smart_addScript(SMARTOBJECT_URL.'include/scriptaculous/src/scriptaculous.js'); |
|
936 | + smart_addScript(SMARTOBJECT_URL.'include/scriptaculous/src/smart.js'); |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | /** |
@@ -993,8 +993,8 @@ discard block |
||
993 | 993 | function smart_htmlnumericentities($str) |
994 | 994 | { |
995 | 995 | // return preg_replace('/[^!-%\x27-;=?-~ ]/e', '"&#".ord("$0").chr(59)', $str); |
996 | - return preg_replace_callback('/[^!-%\x27-;=?-~ ]/', function ($m) { |
|
997 | - return '&#' . ord($m[0]) . chr(59); |
|
996 | + return preg_replace_callback('/[^!-%\x27-;=?-~ ]/', function($m) { |
|
997 | + return '&#'.ord($m[0]).chr(59); |
|
998 | 998 | }, $str); |
999 | 999 | } |
1000 | 1000 | |
@@ -1008,16 +1008,16 @@ discard block |
||
1008 | 1008 | static $handlers; |
1009 | 1009 | $name = strtolower(trim($name)); |
1010 | 1010 | if (!isset($handlers[$name])) { |
1011 | - if (file_exists($hnd_file = XOOPS_ROOT_PATH . '/kernel/' . $name . '.php')) { |
|
1011 | + if (file_exists($hnd_file = XOOPS_ROOT_PATH.'/kernel/'.$name.'.php')) { |
|
1012 | 1012 | require_once $hnd_file; |
1013 | 1013 | } |
1014 | - $class = 'Xoops' . ucfirst($name) . 'Handler'; |
|
1014 | + $class = 'Xoops'.ucfirst($name).'Handler'; |
|
1015 | 1015 | if (class_exists($class)) { |
1016 | 1016 | $handlers[$name] = new $class($GLOBALS['xoopsDB'], 'xoops'); |
1017 | 1017 | } |
1018 | 1018 | } |
1019 | 1019 | if (!isset($handlers[$name]) && !$optional) { |
1020 | - trigger_error('Class <b>' . $class . '</b> does not exist<br>Handler Name: ' . $name, E_USER_ERROR); |
|
1020 | + trigger_error('Class <b>'.$class.'</b> does not exist<br>Handler Name: '.$name, E_USER_ERROR); |
|
1021 | 1021 | } |
1022 | 1022 | if (isset($handlers[$name])) { |
1023 | 1023 | return $handlers[$name]; |
@@ -1097,9 +1097,9 @@ discard block |
||
1097 | 1097 | { |
1098 | 1098 | global $xoopsConfig; |
1099 | 1099 | |
1100 | - $filename = XOOPS_ROOT_PATH . '/modules/' . $module . '/language/' . $xoopsConfig['language'] . '/' . $file . '.php'; |
|
1100 | + $filename = XOOPS_ROOT_PATH.'/modules/'.$module.'/language/'.$xoopsConfig['language'].'/'.$file.'.php'; |
|
1101 | 1101 | if (!file_exists($filename)) { |
1102 | - $filename = XOOPS_ROOT_PATH . '/modules/' . $module . '/language/english/' . $file . '.php'; |
|
1102 | + $filename = XOOPS_ROOT_PATH.'/modules/'.$module.'/language/english/'.$file.'.php'; |
|
1103 | 1103 | } |
1104 | 1104 | if (file_exists($filename)) { |
1105 | 1105 | require_once $filename; |
@@ -1195,7 +1195,7 @@ discard block |
||
1195 | 1195 | |
1196 | 1196 | $text = preg_replace($search, $replace, $document); |
1197 | 1197 | |
1198 | - preg_replace_callback('/&#(\d+);/', function ($matches) { |
|
1198 | + preg_replace_callback('/&#(\d+);/', function($matches) { |
|
1199 | 1199 | return chr($matches[1]); |
1200 | 1200 | }, $document); |
1201 | 1201 | |
@@ -1218,21 +1218,21 @@ discard block |
||
1218 | 1218 | $str = $match[0]; |
1219 | 1219 | if (false !== strpos($str, ',')) { |
1220 | 1220 | // A comma exists, that makes it easy, cos we assume it separates the decimal part. |
1221 | - $str = str_replace('.', '', $str); // Erase thousand seps |
|
1222 | - $str = str_replace(',', '.', $str); // Convert , to . for floatval command |
|
1221 | + $str = str_replace('.', '', $str); // Erase thousand seps |
|
1222 | + $str = str_replace(',', '.', $str); // Convert , to . for floatval command |
|
1223 | 1223 | |
1224 | - return (float)$str; |
|
1224 | + return (float) $str; |
|
1225 | 1225 | } else { |
1226 | 1226 | // No comma exists, so we have to decide, how a single dot shall be treated |
1227 | 1227 | if (true === preg_match("/^[0-9\-]*[\.]{1}[0-9-]+$/", $str) && true === $set['single_dot_as_decimal']) { |
1228 | 1228 | // Treat single dot as decimal separator |
1229 | - return (float)$str; |
|
1229 | + return (float) $str; |
|
1230 | 1230 | } else { |
1231 | 1231 | //echo "str: ".$str; echo "ret: ".str_replace('.', '', $str); echo "<br><br> "; |
1232 | 1232 | // Else, treat all dots as thousand seps |
1233 | - $str = str_replace('.', '', $str); // Erase thousand seps |
|
1233 | + $str = str_replace('.', '', $str); // Erase thousand seps |
|
1234 | 1234 | |
1235 | - return (float)$str; |
|
1235 | + return (float) $str; |
|
1236 | 1236 | } |
1237 | 1237 | } |
1238 | 1238 | } else { |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | $ret .= '.00'; |
1265 | 1265 | } |
1266 | 1266 | if ($currencyObj) { |
1267 | - $ret = $ret . ' ' . $currencyObj->getCode(); |
|
1267 | + $ret = $ret.' '.$currencyObj->getCode(); |
|
1268 | 1268 | } |
1269 | 1269 | |
1270 | 1270 | return $ret; |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | } |
1292 | 1292 | $ret = ''; |
1293 | 1293 | if ($moduleName) { |
1294 | - $ret = "<a href='" . XOOPS_URL . "/modules/$moduleName/admin/index.php'>" . _CO_SOBJECT_ADMIN_PAGE . '</a>'; |
|
1294 | + $ret = "<a href='".XOOPS_URL."/modules/$moduleName/admin/index.php'>"._CO_SOBJECT_ADMIN_PAGE.'</a>'; |
|
1295 | 1295 | } |
1296 | 1296 | |
1297 | 1297 | return $ret; |
@@ -1302,7 +1302,7 @@ discard block |
||
1302 | 1302 | */ |
1303 | 1303 | function smart_getEditors() |
1304 | 1304 | { |
1305 | - $filename = XOOPS_ROOT_PATH . '/class/xoopseditor/xoopseditor.php'; |
|
1305 | + $filename = XOOPS_ROOT_PATH.'/class/xoopseditor/xoopseditor.php'; |
|
1306 | 1306 | if (!file_exists($filename)) { |
1307 | 1307 | return false; |
1308 | 1308 | } |
@@ -1326,9 +1326,9 @@ discard block |
||
1326 | 1326 | { |
1327 | 1327 | $ret = []; |
1328 | 1328 | foreach ($items as $item) { |
1329 | - $ret[] = $moduleName . '_' . $item; |
|
1329 | + $ret[] = $moduleName.'_'.$item; |
|
1330 | 1330 | } |
1331 | - $ret[] = $moduleName . '_meta'; |
|
1331 | + $ret[] = $moduleName.'_meta'; |
|
1332 | 1332 | |
1333 | 1333 | return $ret; |
1334 | 1334 | } |
@@ -8,14 +8,14 @@ discard block |
||
8 | 8 | */ |
9 | 9 | class SmartobjectFile extends SmartobjectBasedUrl |
10 | 10 | { |
11 | - /** |
|
12 | - * SmartobjectFile constructor. |
|
13 | - */ |
|
14 | - public function __construct() |
|
15 | - { |
|
16 | - parent::__construct(); |
|
17 | - $this->quickInitVar('fileid', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_RATING_DIRNAME); |
|
18 | - } |
|
11 | + /** |
|
12 | + * SmartobjectFile constructor. |
|
13 | + */ |
|
14 | + public function __construct() |
|
15 | + { |
|
16 | + parent::__construct(); |
|
17 | + $this->quickInitVar('fileid', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_RATING_DIRNAME); |
|
18 | + } |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | */ |
24 | 24 | class SmartobjectFileHandler extends SmartPersistableObjectHandler |
25 | 25 | { |
26 | - /** |
|
27 | - * SmartobjectFileHandler constructor. |
|
28 | - * @param XoopsDatabase $db |
|
29 | - */ |
|
30 | - public function __construct(XoopsDatabase $db) |
|
31 | - { |
|
32 | - parent::__construct($db, 'file', 'fileid', 'caption', 'desc', 'smartobject'); |
|
33 | - } |
|
26 | + /** |
|
27 | + * SmartobjectFileHandler constructor. |
|
28 | + * @param XoopsDatabase $db |
|
29 | + */ |
|
30 | + public function __construct(XoopsDatabase $db) |
|
31 | + { |
|
32 | + parent::__construct($db, 'file', 'fileid', 'caption', 'desc', 'smartobject'); |
|
33 | + } |
|
34 | 34 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); |
3 | 3 | |
4 | -require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/basedurl.php'; |
|
4 | +require_once XOOPS_ROOT_PATH.'/modules/smartobject/class/basedurl.php'; |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Class SmartobjectFile |
@@ -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 | } |
@@ -69,9 +69,9 @@ |
||
69 | 69 | * @link http://smartfactory.ca The SmartFactory |
70 | 70 | * @package SmartObject |
71 | 71 | */ |
72 | -mt_srand((double)microtime() * 1000000); |
|
72 | +mt_srand((double) microtime() * 1000000); |
|
73 | 73 | |
74 | -require_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
74 | +require_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Class SmartUploader |
@@ -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); |
@@ -50,12 +50,12 @@ |
||
50 | 50 | $var = $object->vars[$key]; |
51 | 51 | $control = $object->controls[$key]; |
52 | 52 | |
53 | - parent::__construct($var['form_caption'] . '<br>' . _US_TYPEPASSTWICE, ' ', $key . '_password_tray'); |
|
53 | + parent::__construct($var['form_caption'].'<br>'._US_TYPEPASSTWICE, ' ', $key.'_password_tray'); |
|
54 | 54 | |
55 | - $password_box1 = new XoopsFormPassword('', $key . '1', 10, 32); |
|
55 | + $password_box1 = new XoopsFormPassword('', $key.'1', 10, 32); |
|
56 | 56 | $this->addElement($password_box1); |
57 | 57 | |
58 | - $password_box2 = new XoopsFormPassword('', $key . '2', 10, 32); |
|
58 | + $password_box2 = new XoopsFormPassword('', $key.'2', 10, 32); |
|
59 | 59 | $this->addElement($password_box2); |
60 | 60 | } |
61 | 61 | } |
@@ -13,50 +13,50 @@ |
||
13 | 13 | |
14 | 14 | class SmartFormSet_passwordElement extends XoopsFormElementTray |
15 | 15 | { |
16 | - /** |
|
17 | - * Size of the field. |
|
18 | - * @var int |
|
19 | - * @access private |
|
20 | - */ |
|
21 | - public $_size; |
|
22 | - |
|
23 | - /** |
|
24 | - * Maximum length of the text |
|
25 | - * @var int |
|
26 | - * @access private |
|
27 | - */ |
|
28 | - public $_maxlength; |
|
29 | - |
|
30 | - /** |
|
31 | - * Initial content of the field. |
|
32 | - * @var string |
|
33 | - * @access private |
|
34 | - */ |
|
35 | - public $_value; |
|
36 | - |
|
37 | - /** |
|
38 | - * Constructor |
|
39 | - * |
|
40 | - * @param string $object |
|
41 | - * @param string $key |
|
42 | - * @internal param string $caption Caption |
|
43 | - * @internal param string $name "name" attribute |
|
44 | - * @internal param int $size Size of the field |
|
45 | - * @internal param int $maxlength Maximum length of the text |
|
46 | - * @internal param int $value Initial value of the field. |
|
47 | - * <b>Warning:</b> this is readable in cleartext in the page's source! |
|
48 | - */ |
|
49 | - public function __construct($object, $key) |
|
50 | - { |
|
51 | - $var = $object->vars[$key]; |
|
52 | - $control = $object->controls[$key]; |
|
53 | - |
|
54 | - parent::__construct($var['form_caption'] . '<br>' . _US_TYPEPASSTWICE, ' ', $key . '_password_tray'); |
|
55 | - |
|
56 | - $password_box1 = new XoopsFormPassword('', $key . '1', 10, 32); |
|
57 | - $this->addElement($password_box1); |
|
58 | - |
|
59 | - $password_box2 = new XoopsFormPassword('', $key . '2', 10, 32); |
|
60 | - $this->addElement($password_box2); |
|
61 | - } |
|
16 | + /** |
|
17 | + * Size of the field. |
|
18 | + * @var int |
|
19 | + * @access private |
|
20 | + */ |
|
21 | + public $_size; |
|
22 | + |
|
23 | + /** |
|
24 | + * Maximum length of the text |
|
25 | + * @var int |
|
26 | + * @access private |
|
27 | + */ |
|
28 | + public $_maxlength; |
|
29 | + |
|
30 | + /** |
|
31 | + * Initial content of the field. |
|
32 | + * @var string |
|
33 | + * @access private |
|
34 | + */ |
|
35 | + public $_value; |
|
36 | + |
|
37 | + /** |
|
38 | + * Constructor |
|
39 | + * |
|
40 | + * @param string $object |
|
41 | + * @param string $key |
|
42 | + * @internal param string $caption Caption |
|
43 | + * @internal param string $name "name" attribute |
|
44 | + * @internal param int $size Size of the field |
|
45 | + * @internal param int $maxlength Maximum length of the text |
|
46 | + * @internal param int $value Initial value of the field. |
|
47 | + * <b>Warning:</b> this is readable in cleartext in the page's source! |
|
48 | + */ |
|
49 | + public function __construct($object, $key) |
|
50 | + { |
|
51 | + $var = $object->vars[$key]; |
|
52 | + $control = $object->controls[$key]; |
|
53 | + |
|
54 | + parent::__construct($var['form_caption'] . '<br>' . _US_TYPEPASSTWICE, ' ', $key . '_password_tray'); |
|
55 | + |
|
56 | + $password_box1 = new XoopsFormPassword('', $key . '1', 10, 32); |
|
57 | + $this->addElement($password_box1); |
|
58 | + |
|
59 | + $password_box2 = new XoopsFormPassword('', $key . '2', 10, 32); |
|
60 | + $this->addElement($password_box2); |
|
61 | + } |
|
62 | 62 | } |
@@ -14,15 +14,15 @@ discard block |
||
14 | 14 | */ |
15 | 15 | function xoops_debug_dumbQuery($msg = '') |
16 | 16 | { |
17 | - global $xoopsDB; |
|
18 | - $xoopsDB->query('SELECT * ' . $msg . ' FROM dudewhereismycar2'); |
|
17 | + global $xoopsDB; |
|
18 | + $xoopsDB->query('SELECT * ' . $msg . ' FROM dudewhereismycar2'); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | function xoops_debug_initiateQueryCount() |
22 | 22 | { |
23 | - global $smartfactory_query_count_activated, $smartfactory_query_count; |
|
24 | - $smartfactory_query_count_activated = true; |
|
25 | - $smartfactory_query_count = 0; |
|
23 | + global $smartfactory_query_count_activated, $smartfactory_query_count; |
|
24 | + $smartfactory_query_count_activated = true; |
|
25 | + $smartfactory_query_count = 0; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | */ |
31 | 31 | function xoops_debug_getQueryCount($msg = '') |
32 | 32 | { |
33 | - global $smartfactory_query_count; |
|
33 | + global $smartfactory_query_count; |
|
34 | 34 | |
35 | - return xoops_debug("xoops debug Query count ($msg): $smartfactory_query_count"); |
|
35 | + return xoops_debug("xoops debug Query count ($msg): $smartfactory_query_count"); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | */ |
42 | 42 | function xoops_debug($msg, $exit = false) |
43 | 43 | { |
44 | - echo "<div style='padding: 5px; color: red; font-weight: bold;'>debug:: $msg</div>"; |
|
45 | - if ($exit) { |
|
46 | - die(); |
|
47 | - } |
|
44 | + echo "<div style='padding: 5px; color: red; font-weight: bold;'>debug:: $msg</div>"; |
|
45 | + if ($exit) { |
|
46 | + die(); |
|
47 | + } |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | function xoops_comment($msg) |
54 | 54 | { |
55 | - echo "<div style='padding: 5px; color: green; font-weight: bold;'>=> $msg</div>"; |
|
55 | + echo "<div style='padding: 5px; color: green; font-weight: bold;'>=> $msg</div>"; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | */ |
61 | 61 | function xoops_debug_vardump($var) |
62 | 62 | { |
63 | - if (class_exists('MyTextSanitizer')) { |
|
64 | - $myts = MyTextSanitizer::getInstance(); |
|
65 | - xoops_debug($myts->displayTarea(var_export($var, true))); |
|
66 | - } else { |
|
67 | - xoops_debug(var_export($var, true)); |
|
68 | - } |
|
63 | + if (class_exists('MyTextSanitizer')) { |
|
64 | + $myts = MyTextSanitizer::getInstance(); |
|
65 | + xoops_debug($myts->displayTarea(var_export($var, true))); |
|
66 | + } else { |
|
67 | + xoops_debug(var_export($var, true)); |
|
68 | + } |
|
69 | 69 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | function xoops_debug_dumbQuery($msg = '') |
16 | 16 | { |
17 | 17 | global $xoopsDB; |
18 | - $xoopsDB->query('SELECT * ' . $msg . ' FROM dudewhereismycar2'); |
|
18 | + $xoopsDB->query('SELECT * '.$msg.' FROM dudewhereismycar2'); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | function xoops_debug_initiateQueryCount() |
@@ -178,7 +178,7 @@ |
||
178 | 178 | define('_CO_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION2', 'Vertical with icons'); |
179 | 179 | define('_CO_SOBJECT_BLOCKS_ADDTO_LAYOUT_OPTION3', 'Vertical no icon'); |
180 | 180 | define('_CO_SOBJECT_CURRENT_FILE', 'Current file: '); |
181 | -define('_CO_SOBJECT_URL_FILE_DSC', "Alternatively, you can use an URL. If you select a file via 'Browse' button, URL will be ignored. You can use the tag {XOOPS_URL} to print " . XOOPS_URL); |
|
181 | +define('_CO_SOBJECT_URL_FILE_DSC', "Alternatively, you can use an URL. If you select a file via 'Browse' button, URL will be ignored. You can use the tag {XOOPS_URL} to print ".XOOPS_URL); |
|
182 | 182 | define('_CO_SOBJECT_URL_FILE', 'URL: '); |
183 | 183 | define('_CO_SOBJECT_UPLOAD', 'Select a file to upload: '); |
184 | 184 |
@@ -152,16 +152,16 @@ |
||
152 | 152 | define('_CO_SOBJECT_UPLOAD_IMAGE', 'Upload a new image:'); |
153 | 153 | define('_CO_SOBJECT_VERSION_HISTORY', 'Version History'); |
154 | 154 | define( |
155 | - '_CO_SOBJECT_WARNING_BETA', |
|
156 | - 'This module comes as is, without any guarantees whatsoever. This module is BETA, meaning it is still under active development. This release is meant for <b>testing purposes only</b> and we <b>strongly</b> recommend that you do not use it on a live website or in a production environment.' |
|
155 | + '_CO_SOBJECT_WARNING_BETA', |
|
156 | + 'This module comes as is, without any guarantees whatsoever. This module is BETA, meaning it is still under active development. This release is meant for <b>testing purposes only</b> and we <b>strongly</b> recommend that you do not use it on a live website or in a production environment.' |
|
157 | 157 | ); |
158 | 158 | define( |
159 | - '_CO_SOBJECT_WARNING_FINAL', |
|
160 | - 'This module comes as is, without any guarantees whatsoever. Although this module is not beta, it is still under active development. This release can be used in a live website or a production environment, but its use is under your own responsibility, which means the author is not responsible.' |
|
159 | + '_CO_SOBJECT_WARNING_FINAL', |
|
160 | + 'This module comes as is, without any guarantees whatsoever. Although this module is not beta, it is still under active development. This release can be used in a live website or a production environment, but its use is under your own responsibility, which means the author is not responsible.' |
|
161 | 161 | ); |
162 | 162 | define( |
163 | - '_CO_SOBJECT_WARNING_RC', |
|
164 | - 'This module comes as is, without any guarantees whatsoever. This module is a Release Candidate and should not be used on a production web site. The module is still under active development and its use is under your own responsibility, which means the author is not responsible.' |
|
163 | + '_CO_SOBJECT_WARNING_RC', |
|
164 | + 'This module comes as is, without any guarantees whatsoever. This module is a Release Candidate and should not be used on a production web site. The module is still under active development and its use is under your own responsibility, which means the author is not responsible.' |
|
165 | 165 | ); |
166 | 166 | define('_CO_SOBJECT_WEIGHT_FORM_CAPTION', 'Weight'); |
167 | 167 | define('_CO_SOBJECT_WEIGHT_FORM_DSC', ''); |
@@ -248,7 +248,7 @@ |
||
248 | 248 | /** |
249 | 249 | * @param $field_id |
250 | 250 | * @param $options |
251 | - * @return mixed |
|
251 | + * @return string |
|
252 | 252 | */ |
253 | 253 | public function auto_complete_field($field_id, $options) |
254 | 254 | { |
@@ -15,319 +15,319 @@ discard block |
||
15 | 15 | */ |
16 | 16 | class Scriptaculous extends Prototype |
17 | 17 | { |
18 | - public $TOGGLE_EFFECTS = ['toggle_appear', 'toggle_slide', 'toggle_blind']; |
|
19 | - |
|
20 | - /** |
|
21 | - * Scriptaculous constructor. |
|
22 | - */ |
|
23 | - public function __construct() |
|
24 | - { |
|
25 | - } |
|
26 | - |
|
27 | - /** |
|
28 | - * @param $element_id |
|
29 | - * @param null $options |
|
30 | - * @return string |
|
31 | - */ |
|
32 | - public function dragable_element($element_id, $options = null) |
|
33 | - { |
|
34 | - return $this->tag($this->_dragable_element_js($element_id, $options)); |
|
35 | - } |
|
36 | - |
|
37 | - /** |
|
38 | - * @param $element_id |
|
39 | - * @param null $options |
|
40 | - * @return string |
|
41 | - */ |
|
42 | - public function drop_receiving_element($element_id, $options = null) |
|
43 | - { |
|
44 | - return $this->tag($this->_drop_receiving_element($element_id, $options)); |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * @param $name |
|
49 | - * @param bool $element_id |
|
50 | - * @param null $js_options |
|
51 | - * @return string |
|
52 | - */ |
|
53 | - public function visual_effect($name, $element_id = false, $js_options = null) |
|
54 | - { |
|
55 | - $element = $element_id ? "'$element_id'" : 'element'; |
|
56 | - |
|
57 | - $js_queue = ''; |
|
58 | - if (isset($js_options) && is_array($js_options['queue'])) { |
|
59 | - } elseif (isset($js_options)) { |
|
60 | - $js_queue = "'$js_options'"; |
|
61 | - } |
|
62 | - |
|
63 | - if (in_array($name, $this->TOGGLE_EFFECTS)) { |
|
64 | - return "Effect.toggle($element,'" . str_replace('toggle_', '', $name) . "'," . $this->_options_for_javascript($js_options) . ')'; |
|
65 | - } else { |
|
66 | - return 'new Effect.' . ucwords($name) . "($element," . $this->_options_for_javascript($js_options) . ')'; |
|
67 | - } |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * @param $element_id |
|
72 | - * @param null $options |
|
73 | - * @return string |
|
74 | - */ |
|
75 | - public function sortabe_element($element_id, $options = null) |
|
76 | - { |
|
77 | - return $this->tag($this->_sortabe_element($element_id, $options)); |
|
78 | - } |
|
79 | - |
|
80 | - ///////////////////////////////////////////////////////////////////////////////////// |
|
81 | - // Private functions |
|
82 | - ///////////////////////////////////////////////////////////////////////////////////// |
|
83 | - |
|
84 | - /** |
|
85 | - * @param $element_id |
|
86 | - * @param $options |
|
87 | - * @return string |
|
88 | - */ |
|
89 | - public function _sortabe_element($element_id, $options) |
|
90 | - { |
|
91 | - //if (isset($options['with'])) { |
|
92 | - $options['with'] = "Sortable.serialize('$element_id')"; |
|
93 | - // } |
|
94 | - |
|
95 | - //if (isset($option['onUpdate'])) { |
|
96 | - $options['onUpdate'] = 'function(){' . $this->remote_function($options) . '}'; |
|
97 | - //} |
|
98 | - |
|
99 | - foreach ($options as $var => $val) { |
|
100 | - if (in_array($var, $this->AJAX_OPTIONS)) { |
|
101 | - unset($options[$var]); |
|
102 | - } |
|
103 | - } |
|
104 | - |
|
105 | - $arr = ['tag', 'overlap', 'contraint', 'handle']; |
|
106 | - |
|
107 | - foreach ($arr as $var) { |
|
108 | - if (isset($options[$var])) { |
|
109 | - $options[$var] = "'" . $options[$var] . "'"; |
|
110 | - } |
|
111 | - } |
|
112 | - |
|
113 | - if (isset($options['containment'])) { |
|
114 | - $options['containment'] = $this->_array_or_string_for_javascript($options['containment']); |
|
115 | - } |
|
116 | - |
|
117 | - if (isset($options['only'])) { |
|
118 | - $options['only'] = $this->_array_or_string_for_javascript($options['only']); |
|
119 | - } |
|
120 | - |
|
121 | - return "Sortable.create('$element_id'," . $this->_options_for_javascript($options) . ')'; |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * @param $element_id |
|
126 | - * @param $options |
|
127 | - * @return string |
|
128 | - */ |
|
129 | - public function _dragable_element_js($element_id, $options) |
|
130 | - { |
|
131 | - return 'new Draggable(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')'; |
|
132 | - } |
|
133 | - |
|
134 | - /** |
|
135 | - * @param $element_id |
|
136 | - * @param $options |
|
137 | - * @return string |
|
138 | - */ |
|
139 | - public function _drop_receiving_element($element_id, $options) |
|
140 | - { |
|
141 | - |
|
142 | - //if (isset($options['with'])) { |
|
143 | - $options['with'] = '\'id=\' + encodeURIComponent(element.id)'; |
|
144 | - // } |
|
145 | - |
|
146 | - //if (isset($option['onDrop'])) |
|
147 | - |
|
148 | - { |
|
149 | - $options['onDrop'] = 'function(element){' . $this->remote_function($options) . '}'; |
|
150 | - } |
|
151 | - |
|
152 | - if (is_array($options)) { |
|
153 | - foreach ($options as $var => $val) { |
|
154 | - if (in_array($var, $this->AJAX_OPTIONS)) { |
|
155 | - unset($options[$var]); |
|
156 | - } |
|
157 | - } |
|
158 | - } |
|
159 | - |
|
160 | - if (isset($options['accept'])) { |
|
161 | - $options['accept'] = $this->_array_or_string_for_javascript($options['accept']); |
|
162 | - } |
|
163 | - |
|
164 | - if (isset($options['hoverclass'])) { |
|
165 | - $options['hoverclass'] = "'" . $options['hoverclass'] . "'"; |
|
166 | - } |
|
167 | - |
|
168 | - return 'Droppables.add(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')'; |
|
169 | - } |
|
170 | - |
|
171 | - ///////////////////////////////////////////////////////////////////////////////////// |
|
172 | - // Merged Javascript macro |
|
173 | - ///////////////////////////////////////////////////////////////////////////////////// |
|
174 | - |
|
175 | - /** |
|
176 | - * @param $field_id |
|
177 | - * @param $options |
|
178 | - * @param bool $tag |
|
179 | - * @return string |
|
180 | - */ |
|
181 | - public function in_place_editor($field_id, $options, $tag = true) |
|
182 | - { |
|
183 | - $function = 'new Ajax.InPlaceEditor('; |
|
184 | - $function .= "'$field_id', "; |
|
185 | - $function .= "'" . $options['url'] . "'"; |
|
186 | - |
|
187 | - $js_options = []; |
|
188 | - if (isset($options['cancel_text'])) { |
|
189 | - $js_options['cancelText'] = $options['cancel_text']; |
|
190 | - } |
|
191 | - if (isset($options['save_text'])) { |
|
192 | - $js_options['okText'] = $options['save_text']; |
|
193 | - } |
|
194 | - if (isset($options['loading_text'])) { |
|
195 | - $js_options['loadingText'] = $options['loading_text']; |
|
196 | - } |
|
197 | - if (isset($options['rows'])) { |
|
198 | - $js_options['rows'] = $options['rows']; |
|
199 | - } |
|
200 | - if (isset($options['cols'])) { |
|
201 | - $js_options['cols'] = $options['cols']; |
|
202 | - } |
|
203 | - if (isset($options['size'])) { |
|
204 | - $js_options['size'] = $options['size']; |
|
205 | - } |
|
206 | - if (isset($options['external_control'])) { |
|
207 | - $js_options['externalControl'] = "'" . $options['external_control'] . "'"; |
|
208 | - } |
|
209 | - if (isset($options['load_text_url'])) { |
|
210 | - $js_options['loadTextURL'] = "'" . $options['load_text_url'] . "'"; |
|
211 | - } |
|
212 | - if (isset($options['options'])) { |
|
213 | - $js_options['ajaxOptions'] = $options['options']; |
|
214 | - } |
|
215 | - if (isset($options['script'])) { |
|
216 | - $js_options['evalScripts'] = $options['script']; |
|
217 | - } |
|
218 | - if (isset($options['with'])) { |
|
219 | - $js_options['callback'] = 'function(form) { return ' . $options['with'] . ' }'; |
|
220 | - } |
|
221 | - |
|
222 | - $function .= ', ' . $this->_options_for_javascript($js_options) . ' )'; |
|
223 | - if ($tag) { |
|
224 | - return $this->tag($function); |
|
225 | - } else { |
|
226 | - return $function; |
|
227 | - } |
|
228 | - } |
|
229 | - |
|
230 | - /** |
|
231 | - * @param $object |
|
232 | - * @param null $tag_options |
|
233 | - * @param null $in_place_editor_options |
|
234 | - * @return string |
|
235 | - */ |
|
236 | - public function in_place_editor_field($object, $tag_options = null, $in_place_editor_options = null) |
|
237 | - { |
|
238 | - $ret_val = ''; |
|
239 | - $ret_val .= '<span id="' . $object . '" class="in_place_editor_field">' . (isset($tag_options['value']) ? $tag_options['value'] : '') . '</span>'; |
|
240 | - $ret_val .= $this->in_place_editor($object, $in_place_editor_options); |
|
241 | - |
|
242 | - return $ret_val; |
|
243 | - } |
|
244 | - |
|
245 | - /** |
|
246 | - * @param $field_id |
|
247 | - * @param $options |
|
248 | - * @return mixed |
|
249 | - */ |
|
250 | - public function auto_complete_field($field_id, $options) |
|
251 | - { |
|
252 | - $function = "var $field_id" . '_auto_completer = new Ajax.Autocompleter('; |
|
253 | - $function .= "'$field_id', "; |
|
254 | - $function .= "'" . (isset($options['update']) ? $options['update'] : $field_id . '_auto_complete') . "', "; |
|
255 | - $function .= "'" . $options['url'] . "'"; |
|
256 | - |
|
257 | - $js_options = []; |
|
258 | - if (isset($options['tokens'])) { |
|
259 | - $js_options['tokens'] = $this->javascript->_array_or_string_for_javascript($options['tokens']); |
|
260 | - } |
|
261 | - if (isset($options['with'])) { |
|
262 | - $js_options['callback'] = 'function(element, value) { return ' . $options['with'] . ' }'; |
|
263 | - } |
|
264 | - if (isset($options['indicator'])) { |
|
265 | - $js_options['indicator'] = "'" . $options['indicator'] . "'"; |
|
266 | - } |
|
267 | - if (isset($options['select'])) { |
|
268 | - $js_options['select'] = "'" . $options['select'] . "'"; |
|
269 | - } |
|
270 | - |
|
271 | - foreach (['on_show' => 'onShow', 'on_hide' => 'onHide', 'min_chars' => 'min_chars'] as $var => $val) { |
|
272 | - if (isset($options[$var])) { |
|
273 | - $js_options['$val'] = $options['var']; |
|
274 | - } |
|
275 | - } |
|
276 | - |
|
277 | - $function .= ', ' . $this->_options_for_javascript($js_options) . ' )'; |
|
278 | - |
|
279 | - return $this->tag($function); |
|
280 | - } |
|
281 | - |
|
282 | - /** |
|
283 | - * @param $entries |
|
284 | - * @param $field |
|
285 | - * @param null $phrase |
|
286 | - */ |
|
287 | - public function auto_complete_results($entries, $field, $phrase = null) |
|
288 | - { |
|
289 | - if (!is_array($entries)) { |
|
290 | - return; |
|
291 | - } |
|
292 | - $ret_val = '<ul>'; |
|
293 | - // Complete this function |
|
294 | - } |
|
295 | - |
|
296 | - /** |
|
297 | - * @param $object |
|
298 | - * @param null $tag_options |
|
299 | - * @param null $completion_options |
|
300 | - * @return string |
|
301 | - */ |
|
302 | - public function text_field_with_auto_complete($object, $tag_options = null, $completion_options = null) |
|
303 | - { |
|
304 | - $ret_val = isset($completion_options['skip_style']) ? '' : $this->_auto_complete_stylesheet(); |
|
305 | - $ret_val .= '<input autocomplete="off" id="' |
|
306 | - . $object |
|
307 | - . '" name="' |
|
308 | - . $object |
|
309 | - . '" size="' |
|
310 | - . (isset($tag_options['size']) ? $tag_options['size'] : 30) |
|
311 | - . '" type="text" value="' |
|
312 | - . (isset($tag_options['size']) ? $tag_options['value'] : '') |
|
313 | - . '" ' |
|
314 | - . (isset($tag_options['class']) ? 'class = "' |
|
315 | - . $tag_options['class'] |
|
316 | - . '" ' : '') |
|
317 | - . '>'; |
|
318 | - |
|
319 | - $ret_val .= '<div id="' . $object . '_auto_complete" class="auto_complete"></div>'; |
|
320 | - $ret_val .= $this->auto_complete_field($object, $completion_options); |
|
321 | - |
|
322 | - return $ret_val; |
|
323 | - } |
|
324 | - |
|
325 | - /** |
|
326 | - * @return string |
|
327 | - */ |
|
328 | - public function _auto_complete_stylesheet() |
|
329 | - { |
|
330 | - return '<style> div.auto_complete { |
|
18 | + public $TOGGLE_EFFECTS = ['toggle_appear', 'toggle_slide', 'toggle_blind']; |
|
19 | + |
|
20 | + /** |
|
21 | + * Scriptaculous constructor. |
|
22 | + */ |
|
23 | + public function __construct() |
|
24 | + { |
|
25 | + } |
|
26 | + |
|
27 | + /** |
|
28 | + * @param $element_id |
|
29 | + * @param null $options |
|
30 | + * @return string |
|
31 | + */ |
|
32 | + public function dragable_element($element_id, $options = null) |
|
33 | + { |
|
34 | + return $this->tag($this->_dragable_element_js($element_id, $options)); |
|
35 | + } |
|
36 | + |
|
37 | + /** |
|
38 | + * @param $element_id |
|
39 | + * @param null $options |
|
40 | + * @return string |
|
41 | + */ |
|
42 | + public function drop_receiving_element($element_id, $options = null) |
|
43 | + { |
|
44 | + return $this->tag($this->_drop_receiving_element($element_id, $options)); |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * @param $name |
|
49 | + * @param bool $element_id |
|
50 | + * @param null $js_options |
|
51 | + * @return string |
|
52 | + */ |
|
53 | + public function visual_effect($name, $element_id = false, $js_options = null) |
|
54 | + { |
|
55 | + $element = $element_id ? "'$element_id'" : 'element'; |
|
56 | + |
|
57 | + $js_queue = ''; |
|
58 | + if (isset($js_options) && is_array($js_options['queue'])) { |
|
59 | + } elseif (isset($js_options)) { |
|
60 | + $js_queue = "'$js_options'"; |
|
61 | + } |
|
62 | + |
|
63 | + if (in_array($name, $this->TOGGLE_EFFECTS)) { |
|
64 | + return "Effect.toggle($element,'" . str_replace('toggle_', '', $name) . "'," . $this->_options_for_javascript($js_options) . ')'; |
|
65 | + } else { |
|
66 | + return 'new Effect.' . ucwords($name) . "($element," . $this->_options_for_javascript($js_options) . ')'; |
|
67 | + } |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * @param $element_id |
|
72 | + * @param null $options |
|
73 | + * @return string |
|
74 | + */ |
|
75 | + public function sortabe_element($element_id, $options = null) |
|
76 | + { |
|
77 | + return $this->tag($this->_sortabe_element($element_id, $options)); |
|
78 | + } |
|
79 | + |
|
80 | + ///////////////////////////////////////////////////////////////////////////////////// |
|
81 | + // Private functions |
|
82 | + ///////////////////////////////////////////////////////////////////////////////////// |
|
83 | + |
|
84 | + /** |
|
85 | + * @param $element_id |
|
86 | + * @param $options |
|
87 | + * @return string |
|
88 | + */ |
|
89 | + public function _sortabe_element($element_id, $options) |
|
90 | + { |
|
91 | + //if (isset($options['with'])) { |
|
92 | + $options['with'] = "Sortable.serialize('$element_id')"; |
|
93 | + // } |
|
94 | + |
|
95 | + //if (isset($option['onUpdate'])) { |
|
96 | + $options['onUpdate'] = 'function(){' . $this->remote_function($options) . '}'; |
|
97 | + //} |
|
98 | + |
|
99 | + foreach ($options as $var => $val) { |
|
100 | + if (in_array($var, $this->AJAX_OPTIONS)) { |
|
101 | + unset($options[$var]); |
|
102 | + } |
|
103 | + } |
|
104 | + |
|
105 | + $arr = ['tag', 'overlap', 'contraint', 'handle']; |
|
106 | + |
|
107 | + foreach ($arr as $var) { |
|
108 | + if (isset($options[$var])) { |
|
109 | + $options[$var] = "'" . $options[$var] . "'"; |
|
110 | + } |
|
111 | + } |
|
112 | + |
|
113 | + if (isset($options['containment'])) { |
|
114 | + $options['containment'] = $this->_array_or_string_for_javascript($options['containment']); |
|
115 | + } |
|
116 | + |
|
117 | + if (isset($options['only'])) { |
|
118 | + $options['only'] = $this->_array_or_string_for_javascript($options['only']); |
|
119 | + } |
|
120 | + |
|
121 | + return "Sortable.create('$element_id'," . $this->_options_for_javascript($options) . ')'; |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * @param $element_id |
|
126 | + * @param $options |
|
127 | + * @return string |
|
128 | + */ |
|
129 | + public function _dragable_element_js($element_id, $options) |
|
130 | + { |
|
131 | + return 'new Draggable(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')'; |
|
132 | + } |
|
133 | + |
|
134 | + /** |
|
135 | + * @param $element_id |
|
136 | + * @param $options |
|
137 | + * @return string |
|
138 | + */ |
|
139 | + public function _drop_receiving_element($element_id, $options) |
|
140 | + { |
|
141 | + |
|
142 | + //if (isset($options['with'])) { |
|
143 | + $options['with'] = '\'id=\' + encodeURIComponent(element.id)'; |
|
144 | + // } |
|
145 | + |
|
146 | + //if (isset($option['onDrop'])) |
|
147 | + |
|
148 | + { |
|
149 | + $options['onDrop'] = 'function(element){' . $this->remote_function($options) . '}'; |
|
150 | + } |
|
151 | + |
|
152 | + if (is_array($options)) { |
|
153 | + foreach ($options as $var => $val) { |
|
154 | + if (in_array($var, $this->AJAX_OPTIONS)) { |
|
155 | + unset($options[$var]); |
|
156 | + } |
|
157 | + } |
|
158 | + } |
|
159 | + |
|
160 | + if (isset($options['accept'])) { |
|
161 | + $options['accept'] = $this->_array_or_string_for_javascript($options['accept']); |
|
162 | + } |
|
163 | + |
|
164 | + if (isset($options['hoverclass'])) { |
|
165 | + $options['hoverclass'] = "'" . $options['hoverclass'] . "'"; |
|
166 | + } |
|
167 | + |
|
168 | + return 'Droppables.add(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')'; |
|
169 | + } |
|
170 | + |
|
171 | + ///////////////////////////////////////////////////////////////////////////////////// |
|
172 | + // Merged Javascript macro |
|
173 | + ///////////////////////////////////////////////////////////////////////////////////// |
|
174 | + |
|
175 | + /** |
|
176 | + * @param $field_id |
|
177 | + * @param $options |
|
178 | + * @param bool $tag |
|
179 | + * @return string |
|
180 | + */ |
|
181 | + public function in_place_editor($field_id, $options, $tag = true) |
|
182 | + { |
|
183 | + $function = 'new Ajax.InPlaceEditor('; |
|
184 | + $function .= "'$field_id', "; |
|
185 | + $function .= "'" . $options['url'] . "'"; |
|
186 | + |
|
187 | + $js_options = []; |
|
188 | + if (isset($options['cancel_text'])) { |
|
189 | + $js_options['cancelText'] = $options['cancel_text']; |
|
190 | + } |
|
191 | + if (isset($options['save_text'])) { |
|
192 | + $js_options['okText'] = $options['save_text']; |
|
193 | + } |
|
194 | + if (isset($options['loading_text'])) { |
|
195 | + $js_options['loadingText'] = $options['loading_text']; |
|
196 | + } |
|
197 | + if (isset($options['rows'])) { |
|
198 | + $js_options['rows'] = $options['rows']; |
|
199 | + } |
|
200 | + if (isset($options['cols'])) { |
|
201 | + $js_options['cols'] = $options['cols']; |
|
202 | + } |
|
203 | + if (isset($options['size'])) { |
|
204 | + $js_options['size'] = $options['size']; |
|
205 | + } |
|
206 | + if (isset($options['external_control'])) { |
|
207 | + $js_options['externalControl'] = "'" . $options['external_control'] . "'"; |
|
208 | + } |
|
209 | + if (isset($options['load_text_url'])) { |
|
210 | + $js_options['loadTextURL'] = "'" . $options['load_text_url'] . "'"; |
|
211 | + } |
|
212 | + if (isset($options['options'])) { |
|
213 | + $js_options['ajaxOptions'] = $options['options']; |
|
214 | + } |
|
215 | + if (isset($options['script'])) { |
|
216 | + $js_options['evalScripts'] = $options['script']; |
|
217 | + } |
|
218 | + if (isset($options['with'])) { |
|
219 | + $js_options['callback'] = 'function(form) { return ' . $options['with'] . ' }'; |
|
220 | + } |
|
221 | + |
|
222 | + $function .= ', ' . $this->_options_for_javascript($js_options) . ' )'; |
|
223 | + if ($tag) { |
|
224 | + return $this->tag($function); |
|
225 | + } else { |
|
226 | + return $function; |
|
227 | + } |
|
228 | + } |
|
229 | + |
|
230 | + /** |
|
231 | + * @param $object |
|
232 | + * @param null $tag_options |
|
233 | + * @param null $in_place_editor_options |
|
234 | + * @return string |
|
235 | + */ |
|
236 | + public function in_place_editor_field($object, $tag_options = null, $in_place_editor_options = null) |
|
237 | + { |
|
238 | + $ret_val = ''; |
|
239 | + $ret_val .= '<span id="' . $object . '" class="in_place_editor_field">' . (isset($tag_options['value']) ? $tag_options['value'] : '') . '</span>'; |
|
240 | + $ret_val .= $this->in_place_editor($object, $in_place_editor_options); |
|
241 | + |
|
242 | + return $ret_val; |
|
243 | + } |
|
244 | + |
|
245 | + /** |
|
246 | + * @param $field_id |
|
247 | + * @param $options |
|
248 | + * @return mixed |
|
249 | + */ |
|
250 | + public function auto_complete_field($field_id, $options) |
|
251 | + { |
|
252 | + $function = "var $field_id" . '_auto_completer = new Ajax.Autocompleter('; |
|
253 | + $function .= "'$field_id', "; |
|
254 | + $function .= "'" . (isset($options['update']) ? $options['update'] : $field_id . '_auto_complete') . "', "; |
|
255 | + $function .= "'" . $options['url'] . "'"; |
|
256 | + |
|
257 | + $js_options = []; |
|
258 | + if (isset($options['tokens'])) { |
|
259 | + $js_options['tokens'] = $this->javascript->_array_or_string_for_javascript($options['tokens']); |
|
260 | + } |
|
261 | + if (isset($options['with'])) { |
|
262 | + $js_options['callback'] = 'function(element, value) { return ' . $options['with'] . ' }'; |
|
263 | + } |
|
264 | + if (isset($options['indicator'])) { |
|
265 | + $js_options['indicator'] = "'" . $options['indicator'] . "'"; |
|
266 | + } |
|
267 | + if (isset($options['select'])) { |
|
268 | + $js_options['select'] = "'" . $options['select'] . "'"; |
|
269 | + } |
|
270 | + |
|
271 | + foreach (['on_show' => 'onShow', 'on_hide' => 'onHide', 'min_chars' => 'min_chars'] as $var => $val) { |
|
272 | + if (isset($options[$var])) { |
|
273 | + $js_options['$val'] = $options['var']; |
|
274 | + } |
|
275 | + } |
|
276 | + |
|
277 | + $function .= ', ' . $this->_options_for_javascript($js_options) . ' )'; |
|
278 | + |
|
279 | + return $this->tag($function); |
|
280 | + } |
|
281 | + |
|
282 | + /** |
|
283 | + * @param $entries |
|
284 | + * @param $field |
|
285 | + * @param null $phrase |
|
286 | + */ |
|
287 | + public function auto_complete_results($entries, $field, $phrase = null) |
|
288 | + { |
|
289 | + if (!is_array($entries)) { |
|
290 | + return; |
|
291 | + } |
|
292 | + $ret_val = '<ul>'; |
|
293 | + // Complete this function |
|
294 | + } |
|
295 | + |
|
296 | + /** |
|
297 | + * @param $object |
|
298 | + * @param null $tag_options |
|
299 | + * @param null $completion_options |
|
300 | + * @return string |
|
301 | + */ |
|
302 | + public function text_field_with_auto_complete($object, $tag_options = null, $completion_options = null) |
|
303 | + { |
|
304 | + $ret_val = isset($completion_options['skip_style']) ? '' : $this->_auto_complete_stylesheet(); |
|
305 | + $ret_val .= '<input autocomplete="off" id="' |
|
306 | + . $object |
|
307 | + . '" name="' |
|
308 | + . $object |
|
309 | + . '" size="' |
|
310 | + . (isset($tag_options['size']) ? $tag_options['size'] : 30) |
|
311 | + . '" type="text" value="' |
|
312 | + . (isset($tag_options['size']) ? $tag_options['value'] : '') |
|
313 | + . '" ' |
|
314 | + . (isset($tag_options['class']) ? 'class = "' |
|
315 | + . $tag_options['class'] |
|
316 | + . '" ' : '') |
|
317 | + . '>'; |
|
318 | + |
|
319 | + $ret_val .= '<div id="' . $object . '_auto_complete" class="auto_complete"></div>'; |
|
320 | + $ret_val .= $this->auto_complete_field($object, $completion_options); |
|
321 | + |
|
322 | + return $ret_val; |
|
323 | + } |
|
324 | + |
|
325 | + /** |
|
326 | + * @return string |
|
327 | + */ |
|
328 | + public function _auto_complete_stylesheet() |
|
329 | + { |
|
330 | + return '<style> div.auto_complete { |
|
331 | 331 | width: 350px; |
332 | 332 | background: #fff; |
333 | 333 | } |
@@ -351,5 +351,5 @@ discard block |
||
351 | 351 | padding:0; |
352 | 352 | } |
353 | 353 | </style>'; |
354 | - } |
|
354 | + } |
|
355 | 355 | } |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | if (in_array($name, $this->TOGGLE_EFFECTS)) { |
64 | - return "Effect.toggle($element,'" . str_replace('toggle_', '', $name) . "'," . $this->_options_for_javascript($js_options) . ')'; |
|
64 | + return "Effect.toggle($element,'".str_replace('toggle_', '', $name)."',".$this->_options_for_javascript($js_options).')'; |
|
65 | 65 | } else { |
66 | - return 'new Effect.' . ucwords($name) . "($element," . $this->_options_for_javascript($js_options) . ')'; |
|
66 | + return 'new Effect.'.ucwords($name)."($element,".$this->_options_for_javascript($js_options).')'; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | // } |
94 | 94 | |
95 | 95 | //if (isset($option['onUpdate'])) { |
96 | - $options['onUpdate'] = 'function(){' . $this->remote_function($options) . '}'; |
|
96 | + $options['onUpdate'] = 'function(){'.$this->remote_function($options).'}'; |
|
97 | 97 | //} |
98 | 98 | |
99 | 99 | foreach ($options as $var => $val) { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | foreach ($arr as $var) { |
108 | 108 | if (isset($options[$var])) { |
109 | - $options[$var] = "'" . $options[$var] . "'"; |
|
109 | + $options[$var] = "'".$options[$var]."'"; |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $options['only'] = $this->_array_or_string_for_javascript($options['only']); |
119 | 119 | } |
120 | 120 | |
121 | - return "Sortable.create('$element_id'," . $this->_options_for_javascript($options) . ')'; |
|
121 | + return "Sortable.create('$element_id',".$this->_options_for_javascript($options).')'; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function _dragable_element_js($element_id, $options) |
130 | 130 | { |
131 | - return 'new Draggable(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')'; |
|
131 | + return 'new Draggable(\''.$element_id.'\','.$this->_options_for_javascript($options).')'; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | //if (isset($option['onDrop'])) |
147 | 147 | |
148 | 148 | { |
149 | - $options['onDrop'] = 'function(element){' . $this->remote_function($options) . '}'; |
|
149 | + $options['onDrop'] = 'function(element){'.$this->remote_function($options).'}'; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | if (is_array($options)) { |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | if (isset($options['hoverclass'])) { |
165 | - $options['hoverclass'] = "'" . $options['hoverclass'] . "'"; |
|
165 | + $options['hoverclass'] = "'".$options['hoverclass']."'"; |
|
166 | 166 | } |
167 | 167 | |
168 | - return 'Droppables.add(\'' . $element_id . '\',' . $this->_options_for_javascript($options) . ')'; |
|
168 | + return 'Droppables.add(\''.$element_id.'\','.$this->_options_for_javascript($options).')'; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | ///////////////////////////////////////////////////////////////////////////////////// |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | { |
183 | 183 | $function = 'new Ajax.InPlaceEditor('; |
184 | 184 | $function .= "'$field_id', "; |
185 | - $function .= "'" . $options['url'] . "'"; |
|
185 | + $function .= "'".$options['url']."'"; |
|
186 | 186 | |
187 | 187 | $js_options = []; |
188 | 188 | if (isset($options['cancel_text'])) { |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | $js_options['size'] = $options['size']; |
205 | 205 | } |
206 | 206 | if (isset($options['external_control'])) { |
207 | - $js_options['externalControl'] = "'" . $options['external_control'] . "'"; |
|
207 | + $js_options['externalControl'] = "'".$options['external_control']."'"; |
|
208 | 208 | } |
209 | 209 | if (isset($options['load_text_url'])) { |
210 | - $js_options['loadTextURL'] = "'" . $options['load_text_url'] . "'"; |
|
210 | + $js_options['loadTextURL'] = "'".$options['load_text_url']."'"; |
|
211 | 211 | } |
212 | 212 | if (isset($options['options'])) { |
213 | 213 | $js_options['ajaxOptions'] = $options['options']; |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | $js_options['evalScripts'] = $options['script']; |
217 | 217 | } |
218 | 218 | if (isset($options['with'])) { |
219 | - $js_options['callback'] = 'function(form) { return ' . $options['with'] . ' }'; |
|
219 | + $js_options['callback'] = 'function(form) { return '.$options['with'].' }'; |
|
220 | 220 | } |
221 | 221 | |
222 | - $function .= ', ' . $this->_options_for_javascript($js_options) . ' )'; |
|
222 | + $function .= ', '.$this->_options_for_javascript($js_options).' )'; |
|
223 | 223 | if ($tag) { |
224 | 224 | return $this->tag($function); |
225 | 225 | } else { |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | public function in_place_editor_field($object, $tag_options = null, $in_place_editor_options = null) |
237 | 237 | { |
238 | 238 | $ret_val = ''; |
239 | - $ret_val .= '<span id="' . $object . '" class="in_place_editor_field">' . (isset($tag_options['value']) ? $tag_options['value'] : '') . '</span>'; |
|
239 | + $ret_val .= '<span id="'.$object.'" class="in_place_editor_field">'.(isset($tag_options['value']) ? $tag_options['value'] : '').'</span>'; |
|
240 | 240 | $ret_val .= $this->in_place_editor($object, $in_place_editor_options); |
241 | 241 | |
242 | 242 | return $ret_val; |
@@ -249,23 +249,23 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function auto_complete_field($field_id, $options) |
251 | 251 | { |
252 | - $function = "var $field_id" . '_auto_completer = new Ajax.Autocompleter('; |
|
252 | + $function = "var $field_id".'_auto_completer = new Ajax.Autocompleter('; |
|
253 | 253 | $function .= "'$field_id', "; |
254 | - $function .= "'" . (isset($options['update']) ? $options['update'] : $field_id . '_auto_complete') . "', "; |
|
255 | - $function .= "'" . $options['url'] . "'"; |
|
254 | + $function .= "'".(isset($options['update']) ? $options['update'] : $field_id.'_auto_complete')."', "; |
|
255 | + $function .= "'".$options['url']."'"; |
|
256 | 256 | |
257 | 257 | $js_options = []; |
258 | 258 | if (isset($options['tokens'])) { |
259 | 259 | $js_options['tokens'] = $this->javascript->_array_or_string_for_javascript($options['tokens']); |
260 | 260 | } |
261 | 261 | if (isset($options['with'])) { |
262 | - $js_options['callback'] = 'function(element, value) { return ' . $options['with'] . ' }'; |
|
262 | + $js_options['callback'] = 'function(element, value) { return '.$options['with'].' }'; |
|
263 | 263 | } |
264 | 264 | if (isset($options['indicator'])) { |
265 | - $js_options['indicator'] = "'" . $options['indicator'] . "'"; |
|
265 | + $js_options['indicator'] = "'".$options['indicator']."'"; |
|
266 | 266 | } |
267 | 267 | if (isset($options['select'])) { |
268 | - $js_options['select'] = "'" . $options['select'] . "'"; |
|
268 | + $js_options['select'] = "'".$options['select']."'"; |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | foreach (['on_show' => 'onShow', 'on_hide' => 'onHide', 'min_chars' => 'min_chars'] as $var => $val) { |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | } |
275 | 275 | } |
276 | 276 | |
277 | - $function .= ', ' . $this->_options_for_javascript($js_options) . ' )'; |
|
277 | + $function .= ', '.$this->_options_for_javascript($js_options).' )'; |
|
278 | 278 | |
279 | 279 | return $this->tag($function); |
280 | 280 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | . '" ' : '') |
317 | 317 | . '>'; |
318 | 318 | |
319 | - $ret_val .= '<div id="' . $object . '_auto_complete" class="auto_complete"></div>'; |
|
319 | + $ret_val .= '<div id="'.$object.'_auto_complete" class="auto_complete"></div>'; |
|
320 | 320 | $ret_val .= $this->auto_complete_field($object, $completion_options); |
321 | 321 | |
322 | 322 | return $ret_val; |