@@ -36,16 +36,16 @@ discard block |
||
36 | 36 | $action = "", |
37 | 37 | $itemid = "", |
38 | 38 | $itemname = "" |
39 | - ) { |
|
39 | + ){ |
|
40 | 40 | $modx = evolutionCMS(); |
41 | 41 | $this->entry['msg'] = $msg; // writes testmessage to the object |
42 | - $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
42 | + $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
43 | 43 | |
44 | 44 | // User Credentials |
45 | 45 | $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey; |
46 | 46 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
47 | 47 | |
48 | - $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
|
48 | + $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object |
|
49 | 49 | if ($this->entry['itemId'] == 0) { |
50 | 50 | $this->entry['itemId'] = "-"; |
51 | 51 | } // to stop items having id 0 |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | $fields['message'] = $modx->db->escape($this->entry['msg']); |
94 | 94 | $insert_id = $modx->db->insert($fields, $tbl_manager_log); |
95 | 95 | if (!$insert_id) { |
96 | - $modx->messageQuit("Logging error: couldn't save log to table! Error code: " . $modx->db->getLastError()); |
|
96 | + $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError()); |
|
97 | 97 | } else { |
98 | - $limit = (isset($modx->config['manager_log_limit'])) ? (int)$modx->config['manager_log_limit'] : 3000; |
|
99 | - $trim = (isset($modx->config['manager_log_trim'])) ? (int)$modx->config['manager_log_trim'] : 100; |
|
98 | + $limit = (isset($modx->config['manager_log_limit'])) ? (int) $modx->config['manager_log_limit'] : 3000; |
|
99 | + $trim = (isset($modx->config['manager_log_trim'])) ? (int) $modx->config['manager_log_trim'] : 100; |
|
100 | 100 | if (($insert_id % $trim) === 0) { |
101 | 101 | $modx->rotate_log('manager_log', $limit, $trim); |
102 | 102 | } |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | 6 | // PROCESSOR FIRST |
7 | -if($_SESSION['mgrRole'] == 1) { |
|
8 | - if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
7 | +if ($_SESSION['mgrRole'] == 1) { |
|
8 | + if ($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
9 | 9 | $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
10 | - if(!empty($current)) { |
|
10 | + if (!empty($current)) { |
|
11 | 11 | $modx->manager->setSystemChecksum($current); |
12 | 12 | $modx->clearCache('full'); |
13 | 13 | $modx->config['sys_files_checksum'] = $current; |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | $warningspresent = 0; |
20 | 20 | |
21 | 21 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
22 | -if ($sysfiles_check!=='0'){ |
|
22 | +if ($sysfiles_check !== '0') { |
|
23 | 23 | $warningspresent = 1; |
24 | 24 | $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
25 | 25 | } |
26 | 26 | |
27 | -if (is_writable("includes/config.inc.php")){ |
|
27 | +if (is_writable("includes/config.inc.php")) { |
|
28 | 28 | // Warn if world writable |
29 | - if(@fileperms('includes/config.inc.php') & 0x0002) { |
|
29 | + if (@fileperms('includes/config.inc.php') & 0x0002) { |
|
30 | 30 | $warningspresent = 1; |
31 | 31 | $warnings[] = array($_lang['configcheck_configinc']); |
32 | 32 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | $warnings[] = array($_lang['configcheck_php_gdzip']); |
43 | 43 | } |
44 | 44 | |
45 | -if(!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') { |
|
46 | - if(isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') { |
|
45 | +if (!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') { |
|
46 | + if (isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') { |
|
47 | 47 | if ($modx->db->getValue($modx->db->select('COUNT(setting_value)', $modx->getFullTableName('system_settings'), "setting_name='validate_referer' AND setting_value='0'"))) { |
48 | 48 | $warningspresent = 1; |
49 | 49 | $warnings[] = array($_lang['configcheck_validate_referer']); |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | // check for Template Switcher plugin |
55 | -if(!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') { |
|
56 | - if(isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') { |
|
55 | +if (!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') { |
|
56 | + if (isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') { |
|
57 | 57 | $rs = $modx->db->select('name, disabled', $modx->getFullTableName('site_plugins'), "name IN ('TemplateSwitcher', 'Template Switcher', 'templateswitcher', 'template_switcher', 'template switcher') OR plugincode LIKE '%TemplateSwitcher%'"); |
58 | 58 | $row = $modx->db->getRow($rs); |
59 | - if($row && $row['disabled'] == 0) { |
|
59 | + if ($row && $row['disabled'] == 0) { |
|
60 | 60 | $warningspresent = 1; |
61 | 61 | $warnings[] = array($_lang['configcheck_templateswitcher_present']); |
62 | 62 | $tplName = $row['name']; |
@@ -120,36 +120,36 @@ discard block |
||
120 | 120 | /** |
121 | 121 | * @return bool |
122 | 122 | */ |
123 | - function checkSiteCache() { |
|
123 | + function checkSiteCache(){ |
|
124 | 124 | $modx = evolutionCMS(); |
125 | - $checked= true; |
|
126 | - if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) { |
|
127 | - $checked= @include_once ($modx->config['base_path'] . 'assets/cache/siteCache.idx.php'); |
|
125 | + $checked = true; |
|
126 | + if (file_exists($modx->config['base_path'].'assets/cache/siteCache.idx.php')) { |
|
127 | + $checked = @include_once ($modx->config['base_path'].'assets/cache/siteCache.idx.php'); |
|
128 | 128 | } |
129 | 129 | return $checked; |
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | -if (!is_writable(MODX_BASE_PATH . "assets/cache/")) { |
|
133 | +if (!is_writable(MODX_BASE_PATH."assets/cache/")) { |
|
134 | 134 | $warningspresent = 1; |
135 | 135 | $warnings[] = array($_lang['configcheck_cache']); |
136 | 136 | } |
137 | 137 | |
138 | 138 | if (!checkSiteCache()) { |
139 | 139 | $warningspresent = 1; |
140 | - $warnings[]= array($lang['configcheck_sitecache_integrity']); |
|
140 | + $warnings[] = array($lang['configcheck_sitecache_integrity']); |
|
141 | 141 | } |
142 | 142 | |
143 | -if (!is_writable(MODX_BASE_PATH . "assets/images/")) { |
|
143 | +if (!is_writable(MODX_BASE_PATH."assets/images/")) { |
|
144 | 144 | $warningspresent = 1; |
145 | 145 | $warnings[] = array($_lang['configcheck_images']); |
146 | 146 | } |
147 | 147 | |
148 | -if(strpos($modx->config['rb_base_dir'],MODX_BASE_PATH)!==0) { |
|
148 | +if (strpos($modx->config['rb_base_dir'], MODX_BASE_PATH) !== 0) { |
|
149 | 149 | $warningspresent = 1; |
150 | 150 | $warnings[] = array($_lang['configcheck_rb_base_dir']); |
151 | 151 | } |
152 | -if(strpos($modx->config['filemanager_path'],MODX_BASE_PATH)!==0) { |
|
152 | +if (strpos($modx->config['filemanager_path'], MODX_BASE_PATH) !== 0) { |
|
153 | 153 | $warningspresent = 1; |
154 | 154 | $warnings[] = array($_lang['configcheck_filemanager_path']); |
155 | 155 | } |
@@ -157,36 +157,36 @@ discard block |
||
157 | 157 | // clear file info cache |
158 | 158 | clearstatcache(); |
159 | 159 | |
160 | -if ($warningspresent==1) { |
|
160 | +if ($warningspresent == 1) { |
|
161 | 161 | |
162 | -if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
|
162 | +if (!isset($modx->config['send_errormail'])) $modx->config['send_errormail'] = '3'; |
|
163 | 163 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
164 | 164 | |
165 | -for ($i=0;$i<count($warnings);$i++) { |
|
165 | +for ($i = 0; $i < count($warnings); $i++) { |
|
166 | 166 | switch ($warnings[$i][0]) { |
167 | 167 | case $_lang['configcheck_configinc']; |
168 | 168 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
169 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
169 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_configinc']); |
|
170 | 170 | break; |
171 | 171 | case $_lang['configcheck_installer'] : |
172 | 172 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
173 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
173 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_installer']); |
|
174 | 174 | break; |
175 | 175 | case $_lang['configcheck_cache'] : |
176 | 176 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
177 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
177 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_cache']); |
|
178 | 178 | break; |
179 | 179 | case $_lang['configcheck_images'] : |
180 | 180 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
181 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
181 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_images']); |
|
182 | 182 | break; |
183 | 183 | case $_lang['configcheck_sysfiles_mod']: |
184 | 184 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
185 | - $warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
186 | - if($modx->hasPermission('settings')) { |
|
187 | - $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
185 | + $warnings[$i][2] = '<ul><li>'.implode('</li><li>', $sysfiles_check).'</li></ul>'; |
|
186 | + if ($modx->hasPermission('settings')) { |
|
187 | + $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\''.$_lang["reset_sysfiles_checksum_alert"].'\')">'.$_lang["reset_sysfiles_checksum_button"].'</a></li></ul>'; |
|
188 | 188 | } |
189 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
189 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1]." ".implode(', ', $sysfiles_check), $_lang['configcheck_sysfiles_mod']); |
|
190 | 190 | break; |
191 | 191 | case $_lang['configcheck_lang_difference'] : |
192 | 192 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
@@ -208,18 +208,18 @@ discard block |
||
208 | 208 | break; |
209 | 209 | case $_lang['configcheck_validate_referer'] : |
210 | 210 | $msg = $_lang['configcheck_validate_referer_msg']; |
211 | - $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'validate_referer'); |
|
211 | + $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'validate_referer'); |
|
212 | 212 | $warnings[$i][1] = "<span id=\"validate_referer_warning_wrapper\">{$msg}</span>\n"; |
213 | 213 | break; |
214 | 214 | case $_lang['configcheck_templateswitcher_present'] : |
215 | 215 | $msg = $_lang["configcheck_templateswitcher_present_msg"]; |
216 | - if(isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') { |
|
217 | - $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_disable"]; |
|
216 | + if (isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') { |
|
217 | + $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_disable"]; |
|
218 | 218 | } |
219 | - if(isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') { |
|
220 | - $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_delete"]; |
|
219 | + if (isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') { |
|
220 | + $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_delete"]; |
|
221 | 221 | } |
222 | - $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present'); |
|
222 | + $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present'); |
|
223 | 223 | $warnings[$i][1] = "<span id=\"templateswitcher_present_warning_wrapper\">{$msg}</span>\n"; |
224 | 224 | break; |
225 | 225 | case $_lang['configcheck_rb_base_dir'] : |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $warnings[$i][1] = $_lang['configcheck_default_msg']; |
233 | 233 | } |
234 | 234 | |
235 | - $admin_warning = $_SESSION['mgrRole']!=1 ? $_lang['configcheck_admin'] : "" ; |
|
235 | + $admin_warning = $_SESSION['mgrRole'] != 1 ? $_lang['configcheck_admin'] : ""; |
|
236 | 236 | $config_check_results .= " |
237 | 237 | <fieldset> |
238 | 238 | <p><strong>".$_lang['configcheck_warning']."</strong> '".$warnings[$i][0]."'</p> |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | ".(isset($warnings[$i][2]) ? '<div style="padding-left:1em">'.$warnings[$i][2].'</div>' : '')." |
242 | 242 | </fieldset> |
243 | 243 | "; |
244 | - if ($i!=count($warnings)-1) { |
|
244 | + if ($i != count($warnings) - 1) { |
|
245 | 245 | $config_check_results .= "<br />"; |
246 | 246 | } |
247 | 247 | } |
248 | - $_SESSION["mgrConfigCheck"]=true; |
|
248 | + $_SESSION["mgrConfigCheck"] = true; |
|
249 | 249 | } else { |
250 | 250 | $config_check_results = $_lang['configcheck_ok']; |
251 | 251 | } |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | $warningspresent = 0; |
20 | 20 | |
21 | 21 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
22 | -if ($sysfiles_check!=='0'){ |
|
22 | +if ($sysfiles_check!=='0') { |
|
23 | 23 | $warningspresent = 1; |
24 | 24 | $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
25 | 25 | } |
26 | 26 | |
27 | -if (is_writable("includes/config.inc.php")){ |
|
27 | +if (is_writable("includes/config.inc.php")) { |
|
28 | 28 | // Warn if world writable |
29 | 29 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
30 | 30 | $warningspresent = 1; |
@@ -120,7 +120,8 @@ discard block |
||
120 | 120 | /** |
121 | 121 | * @return bool |
122 | 122 | */ |
123 | - function checkSiteCache() { |
|
123 | + function checkSiteCache() |
|
124 | + { |
|
124 | 125 | $modx = evolutionCMS(); |
125 | 126 | $checked= true; |
126 | 127 | if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) { |
@@ -159,26 +160,36 @@ discard block |
||
159 | 160 | |
160 | 161 | if ($warningspresent==1) { |
161 | 162 | |
162 | -if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
|
163 | +if(!isset($modx->config['send_errormail'])) { |
|
164 | + $modx->config['send_errormail']='3'; |
|
165 | +} |
|
163 | 166 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
164 | 167 | |
165 | 168 | for ($i=0;$i<count($warnings);$i++) { |
166 | 169 | switch ($warnings[$i][0]) { |
167 | 170 | case $_lang['configcheck_configinc']; |
168 | 171 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
169 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
172 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
173 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
174 | + } |
|
170 | 175 | break; |
171 | 176 | case $_lang['configcheck_installer'] : |
172 | 177 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
173 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
178 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
179 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
180 | + } |
|
174 | 181 | break; |
175 | 182 | case $_lang['configcheck_cache'] : |
176 | 183 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
177 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
184 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
185 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
186 | + } |
|
178 | 187 | break; |
179 | 188 | case $_lang['configcheck_images'] : |
180 | 189 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
181 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
190 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
191 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
192 | + } |
|
182 | 193 | break; |
183 | 194 | case $_lang['configcheck_sysfiles_mod']: |
184 | 195 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
@@ -186,7 +197,9 @@ discard block |
||
186 | 197 | if($modx->hasPermission('settings')) { |
187 | 198 | $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
188 | 199 | } |
189 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
200 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
201 | + $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
202 | + } |
|
190 | 203 | break; |
191 | 204 | case $_lang['configcheck_lang_difference'] : |
192 | 205 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
@@ -729,7 +729,8 @@ discard block |
||
729 | 729 | } |
730 | 730 | |
731 | 731 | if (preg_match('@^[1-9][0-9]*$@', |
732 | - $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */ |
|
732 | + $q) && !isset($this->documentListing[$q])) { |
|
733 | +/* we got an ID returned, check to make sure it's not an alias */ |
|
733 | 734 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
734 | 735 | if ($this->config['use_alias_path'] == 1) { |
735 | 736 | if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, |
@@ -738,7 +739,8 @@ discard block |
||
738 | 739 | $this->documentMethod = 'id'; |
739 | 740 | |
740 | 741 | return $q; |
741 | - } else { /* not a valid id in terms of virtualDir, treat as alias */ |
|
742 | + } else { |
|
743 | +/* not a valid id in terms of virtualDir, treat as alias */ |
|
742 | 744 | $this->documentMethod = 'alias'; |
743 | 745 | |
744 | 746 | return $q; |
@@ -748,7 +750,8 @@ discard block |
||
748 | 750 | |
749 | 751 | return $q; |
750 | 752 | } |
751 | - } else { /* we didn't get an ID back, so instead we assume it's an alias */ |
|
753 | + } else { |
|
754 | +/* we didn't get an ID back, so instead we assume it's an alias */ |
|
752 | 755 | if ($this->config['friendly_alias_urls'] != 1) { |
753 | 756 | $q = $qOrig; |
754 | 757 | } |
@@ -1278,7 +1281,8 @@ discard block |
||
1278 | 1281 | } |
1279 | 1282 | } |
1280 | 1283 | |
1281 | - if (!in_array($fetch, $tags)) { // Avoid double Matches |
|
1284 | + if (!in_array($fetch, $tags)) { |
|
1285 | +// Avoid double Matches |
|
1282 | 1286 | $tags[] = $fetch; // Fetch |
1283 | 1287 | }; |
1284 | 1288 | $fetch = ''; // and reset |
@@ -2089,7 +2093,8 @@ discard block |
||
2089 | 2093 | * @return mixed|string |
2090 | 2094 | */ |
2091 | 2095 | public function _getSGVar($value) |
2092 | - { // Get super globals |
|
2096 | + { |
|
2097 | +// Get super globals |
|
2093 | 2098 | $key = $value; |
2094 | 2099 | $_ = $this->config['enable_filter']; |
2095 | 2100 | $this->config['enable_filter'] = 1; |
@@ -2510,7 +2515,8 @@ discard block |
||
2510 | 2515 | if ($this->config['friendly_urls'] == 1) { |
2511 | 2516 | $aliases = array(); |
2512 | 2517 | if (is_array($this->documentListing)) { |
2513 | - foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site! |
|
2518 | + foreach ($this->documentListing as $path => $docid) { |
|
2519 | +// This is big Loop on large site! |
|
2514 | 2520 | $aliases[$docid] = $path; |
2515 | 2521 | $isfolder[$docid] = $this->aliasListing[$docid]['isfolder']; |
2516 | 2522 | } |
@@ -2545,7 +2551,7 @@ discard block |
||
2545 | 2551 | $pref = $this->config['friendly_url_prefix']; |
2546 | 2552 | $suff = $this->config['friendly_url_suffix']; |
2547 | 2553 | $documentSource = preg_replace_callback($in, |
2548 | - function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2554 | + function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){ |
|
2549 | 2555 | $modx = evolutionCMS(); |
2550 | 2556 | $thealias = $aliases[$m[1]]; |
2551 | 2557 | $thefolder = $isfolder[$m[1]]; |
@@ -4387,7 +4393,8 @@ discard block |
||
4387 | 4393 | if (isset ($this->snippetCache[$snippetName])) { |
4388 | 4394 | $snippet = $this->snippetCache[$snippetName]; |
4389 | 4395 | $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
4390 | - } else { // not in cache so let's check the db |
|
4396 | + } else { |
|
4397 | +// not in cache so let's check the db |
|
4391 | 4398 | $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "' AND ss.disabled=0;"; |
4392 | 4399 | $result = $this->db->query($sql); |
4393 | 4400 | if ($this->db->getRecordCount($result) == 1) { |
@@ -5426,12 +5433,16 @@ discard block |
||
5426 | 5433 | return ''; |
5427 | 5434 | } // nothing to register |
5428 | 5435 | if (!is_array($options)) { |
5429 | - if (is_bool($options)) // backward compatibility with old plaintext parameter |
|
5436 | + if (is_bool($options)) { |
|
5437 | + // backward compatibility with old plaintext parameter |
|
5430 | 5438 | { |
5431 | 5439 | $options = array('plaintext' => $options); |
5432 | - } elseif (is_string($options)) // Also allow script name as 2nd param |
|
5440 | + } |
|
5441 | + } elseif (is_string($options)) { |
|
5442 | + // Also allow script name as 2nd param |
|
5433 | 5443 | { |
5434 | 5444 | $options = array('name' => $options); |
5445 | + } |
|
5435 | 5446 | } else { |
5436 | 5447 | $options = array(); |
5437 | 5448 | } |
@@ -5443,7 +5454,8 @@ discard block |
||
5443 | 5454 | unset($overwritepos); // probably unnecessary--just making sure |
5444 | 5455 | |
5445 | 5456 | $useThisVer = true; |
5446 | - if (isset($this->loadedjscripts[$key])) { // a matching script was found |
|
5457 | + if (isset($this->loadedjscripts[$key])) { |
|
5458 | +// a matching script was found |
|
5447 | 5459 | // if existing script is a startup script, make sure the candidate is also a startup script |
5448 | 5460 | if ($this->loadedjscripts[$key]['startup']) { |
5449 | 5461 | $startup = true; |
@@ -5463,7 +5475,8 @@ discard block |
||
5463 | 5475 | // overwrite the old script (the position may be important for dependent scripts) |
5464 | 5476 | $overwritepos = $this->loadedjscripts[$key]['pos']; |
5465 | 5477 | } |
5466 | - } else { // Use the original version |
|
5478 | + } else { |
|
5479 | +// Use the original version |
|
5467 | 5480 | if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) { |
5468 | 5481 | // need to move the exisiting script to the head |
5469 | 5482 | $version = $this->loadedjscripts[$key][$version]; |
@@ -5591,7 +5604,8 @@ discard block |
||
5591 | 5604 | } |
5592 | 5605 | |
5593 | 5606 | $results = null; |
5594 | - foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop |
|
5607 | + foreach ($this->pluginEvent[$evtName] as $pluginName) { |
|
5608 | +// start for loop |
|
5595 | 5609 | if ($this->dumpPlugins) { |
5596 | 5610 | $eventtime = $this->getMicroTime(); |
5597 | 5611 | } |
@@ -6161,7 +6175,8 @@ discard block |
||
6161 | 6175 | * @return bool |
6162 | 6176 | */ |
6163 | 6177 | public function isSafeCode($phpcode = '', $safe_functions = '') |
6164 | - { // return true or false |
|
6178 | + { |
|
6179 | +// return true or false |
|
6165 | 6180 | if ($safe_functions == '') { |
6166 | 6181 | return false; |
6167 | 6182 | } |
@@ -6599,7 +6614,7 @@ discard block |
||
6599 | 6614 | $args = array_pad(array(), $_, '$var'); |
6600 | 6615 | $args = implode(", ", $args); |
6601 | 6616 | $modx = &$this; |
6602 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6617 | + $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){ |
|
6603 | 6618 | $arg = $val['args'][$tmp - 1]; |
6604 | 6619 | switch (true) { |
6605 | 6620 | case is_null($arg): { |
@@ -2399,11 +2399,11 @@ discard block |
||
2399 | 2399 | if (isset($this->snippetCache[$snip_name])) { |
2400 | 2400 | $snippetObject['name'] = $snip_name; |
2401 | 2401 | $snippetObject['content'] = $this->snippetCache[$snip_name]; |
2402 | - if (isset($this->snippetCache["{$snip_name}Props"])) { |
|
2403 | - if (!isset($this->snippetCache["{$snip_name}Props"])) { |
|
2404 | - $this->snippetCache["{$snip_name}Props"] = ''; |
|
2402 | + if (isset($this->snippetCache["{$snip_name}props"])) { |
|
2403 | + if (!isset($this->snippetCache["{$snip_name}props"])) { |
|
2404 | + $this->snippetCache["{$snip_name}props"] = ''; |
|
2405 | 2405 | } |
2406 | - $snippetObject['properties'] = $this->snippetCache["{$snip_name}Props"]; |
|
2406 | + $snippetObject['properties'] = $this->snippetCache["{$snip_name}props"]; |
|
2407 | 2407 | } |
2408 | 2408 | } elseif (substr($snip_name, 0, 1) === '@' && isset($this->pluginEvent[trim($snip_name, '@')])) { |
2409 | 2409 | $snippetObject['name'] = trim($snip_name, '@'); |
@@ -2429,7 +2429,7 @@ discard block |
||
2429 | 2429 | $snippetObject['content'] = $snip_content; |
2430 | 2430 | $snippetObject['properties'] = $snip_prop; |
2431 | 2431 | $this->snippetCache[$snip_name] = $snip_content; |
2432 | - $this->snippetCache["{$snip_name}Props"] = $snip_prop; |
|
2432 | + $this->snippetCache["{$snip_name}props"] = $snip_prop; |
|
2433 | 2433 | } |
2434 | 2434 | |
2435 | 2435 | return $snippetObject; |
@@ -3774,7 +3774,7 @@ discard block |
||
3774 | 3774 | } |
3775 | 3775 | // build query |
3776 | 3776 | $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
3777 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3777 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
3778 | 3778 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", |
3779 | 3779 | "{$sort} {$dir}"); |
3780 | 3780 | $resourceArray = $this->db->makeArray($result); |
@@ -3817,7 +3817,7 @@ discard block |
||
3817 | 3817 | } |
3818 | 3818 | // build query |
3819 | 3819 | $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
3820 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3820 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
3821 | 3821 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", |
3822 | 3822 | "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3823 | 3823 | $resourceArray = $this->db->makeArray($result); |
@@ -3882,7 +3882,7 @@ discard block |
||
3882 | 3882 | $tblsc = $this->getFullTableName('site_content'); |
3883 | 3883 | $tbldg = $this->getFullTableName('document_groups'); |
3884 | 3884 | |
3885 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3885 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
3886 | 3886 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", |
3887 | 3887 | "sc.parent = '{$parentid}' {$published} {$deleted} {$where} AND ({$access}) GROUP BY sc.id", |
3888 | 3888 | ($sort ? "{$sort} {$dir}" : ""), $limit); |
@@ -3959,7 +3959,7 @@ discard block |
||
3959 | 3959 | $tblsc = $this->getFullTableName('site_content'); |
3960 | 3960 | $tbldg = $this->getFullTableName('document_groups'); |
3961 | 3961 | |
3962 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3962 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
3963 | 3963 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', |
3964 | 3964 | $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", |
3965 | 3965 | ($sort ? "{$sort} {$dir}" : ""), $limit); |
@@ -4561,7 +4561,7 @@ discard block |
||
4561 | 4561 | $template = $doc['content']; |
4562 | 4562 | break; |
4563 | 4563 | case 'SELECT': |
4564 | - $this->db->getValue($this->db->query("SELECT {$template}")); |
|
4564 | + $this->db->getValue($this->db->query("select {$template}")); |
|
4565 | 4565 | break; |
4566 | 4566 | default: |
4567 | 4567 | if (!($template = $this->getChunk($tpl))) { |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php" |
281 | 281 | * $extname - extension name in lowercase |
282 | 282 | * |
283 | - * @param $extname |
|
283 | + * @param string $extname |
|
284 | 284 | * @param bool $reload |
285 | 285 | * @return bool |
286 | 286 | */ |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | * @param int $count_attempts |
326 | 326 | * @param string $type $type |
327 | 327 | * @param string $responseCode |
328 | - * @return bool|null |
|
328 | + * @return false|null |
|
329 | 329 | * @global string $base_url |
330 | 330 | * @global string $site_url |
331 | 331 | */ |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | /** |
1045 | - * @param $contents |
|
1045 | + * @param string $contents |
|
1046 | 1046 | * @return mixed |
1047 | 1047 | */ |
1048 | 1048 | public function RecoveryEscapedTags($contents) |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | } |
1069 | 1069 | |
1070 | 1070 | /** |
1071 | - * @param $tstart |
|
1071 | + * @param double $tstart |
|
1072 | 1072 | * @return array |
1073 | 1073 | */ |
1074 | 1074 | public function getTimerStats($tstart) |
@@ -1851,7 +1851,7 @@ discard block |
||
1851 | 1851 | |
1852 | 1852 | /** |
1853 | 1853 | * Remove Comment-Tags from output like <!--@- Comment -@--> |
1854 | - * @param $content |
|
1854 | + * @param string $content |
|
1855 | 1855 | * @param string $left |
1856 | 1856 | * @param string $right |
1857 | 1857 | * @return mixed |
@@ -2029,7 +2029,7 @@ discard block |
||
2029 | 2029 | /** |
2030 | 2030 | * Run snippets as per the tags in $documentSource and replace the tags with the returned values. |
2031 | 2031 | * |
2032 | - * @param $content |
|
2032 | + * @param string $content |
|
2033 | 2033 | * @return string |
2034 | 2034 | * @internal param string $documentSource |
2035 | 2035 | */ |
@@ -3098,7 +3098,7 @@ discard block |
||
3098 | 3098 | |
3099 | 3099 | /** |
3100 | 3100 | * @param $templateID |
3101 | - * @return mixed |
|
3101 | + * @return string |
|
3102 | 3102 | */ |
3103 | 3103 | public function _getTemplateCodeFromDB($templateID) |
3104 | 3104 | { |
@@ -3142,7 +3142,7 @@ discard block |
||
3142 | 3142 | /** |
3143 | 3143 | * @param $id |
3144 | 3144 | * @param int $top |
3145 | - * @return mixed |
|
3145 | + * @return string |
|
3146 | 3146 | */ |
3147 | 3147 | public function getUltimateParentId($id, $top = 0) |
3148 | 3148 | { |
@@ -3482,7 +3482,7 @@ discard block |
||
3482 | 3482 | * |
3483 | 3483 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3484 | 3484 | * @param int $id Element- / Resource-id |
3485 | - * @return bool |
|
3485 | + * @return false|null |
|
3486 | 3486 | */ |
3487 | 3487 | public function lockElement($type, $id) |
3488 | 3488 | { |
@@ -3505,7 +3505,7 @@ discard block |
||
3505 | 3505 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3506 | 3506 | * @param int $id Element- / Resource-id |
3507 | 3507 | * @param bool $includeAllUsers true = Deletes not only own user-locks |
3508 | - * @return bool |
|
3508 | + * @return false|null |
|
3509 | 3509 | */ |
3510 | 3510 | public function unlockElement($type, $id, $includeAllUsers = false) |
3511 | 3511 | { |
@@ -3616,7 +3616,7 @@ discard block |
||
3616 | 3616 | * @param array $params |
3617 | 3617 | * @param string $msg |
3618 | 3618 | * @param array $files |
3619 | - * @return mixed |
|
3619 | + * @return boolean |
|
3620 | 3620 | */ |
3621 | 3621 | public function sendmail($params = array(), $msg = '', $files = array()) |
3622 | 3622 | { |
@@ -4053,7 +4053,7 @@ discard block |
||
4053 | 4053 | * Default: 1 |
4054 | 4054 | * @param string $fields List of fields |
4055 | 4055 | * Default: id, pagetitle, description, alias |
4056 | - * @return boolean|array |
|
4056 | + * @return string |
|
4057 | 4057 | */ |
4058 | 4058 | public function getPageInfo($pageid = -1, $active = 1, $fields = 'id, pagetitle, description, alias') |
4059 | 4059 | { |
@@ -4151,7 +4151,7 @@ discard block |
||
4151 | 4151 | * |
4152 | 4152 | * @param string $type |
4153 | 4153 | * @param bool $report |
4154 | - * @return bool |
|
4154 | + * @return boolean|null |
|
4155 | 4155 | */ |
4156 | 4156 | public function clearCache($type = '', $report = false) |
4157 | 4157 | { |
@@ -4524,7 +4524,7 @@ discard block |
||
4524 | 4524 | * - Placeholders prefix. Default: '{'. |
4525 | 4525 | * @param string $suffix {string} |
4526 | 4526 | * - Placeholders suffix. Default: '}'. |
4527 | - * @return bool|mixed|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
4527 | + * @return false|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
4528 | 4528 | * - Parsed chunk or false if $chunkArr is not array. |
4529 | 4529 | */ |
4530 | 4530 | public function parseChunk($chunkName, $chunkArr, $prefix = '{', $suffix = '}') |
@@ -5558,7 +5558,7 @@ discard block |
||
5558 | 5558 | * Remove event listener - only for use within the current execution cycle |
5559 | 5559 | * |
5560 | 5560 | * @param string $evtName |
5561 | - * @return boolean |
|
5561 | + * @return false|null |
|
5562 | 5562 | */ |
5563 | 5563 | public function removeEventListener($evtName) |
5564 | 5564 | { |
@@ -5582,7 +5582,7 @@ discard block |
||
5582 | 5582 | * |
5583 | 5583 | * @param string $evtName |
5584 | 5584 | * @param array $extParams Parameters available to plugins. Each array key will be the PHP variable name, and the array value will be the variable value. |
5585 | - * @return boolean|array |
|
5585 | + * @return false|null |
|
5586 | 5586 | */ |
5587 | 5587 | public function invokeEvent($evtName, $extParams = array()) |
5588 | 5588 | { |
@@ -6204,7 +6204,7 @@ discard block |
||
6204 | 6204 | |
6205 | 6205 | /** |
6206 | 6206 | * @param string $str |
6207 | - * @return bool|mixed|string |
|
6207 | + * @return string |
|
6208 | 6208 | */ |
6209 | 6209 | public function atBindFileContent($str = '') |
6210 | 6210 | { |
@@ -6261,8 +6261,8 @@ discard block |
||
6261 | 6261 | } |
6262 | 6262 | |
6263 | 6263 | /** |
6264 | - * @param $str |
|
6265 | - * @return bool|string |
|
6264 | + * @param string $str |
|
6265 | + * @return false|string |
|
6266 | 6266 | */ |
6267 | 6267 | public function getExtFromFilename($str) |
6268 | 6268 | { |
@@ -6290,7 +6290,7 @@ discard block |
||
6290 | 6290 | * @param string $text Error message |
6291 | 6291 | * @param string $file File where the error was detected |
6292 | 6292 | * @param string $line Line number within $file |
6293 | - * @return boolean |
|
6293 | + * @return boolean|null |
|
6294 | 6294 | */ |
6295 | 6295 | public function phpError($nr, $text, $file, $line) |
6296 | 6296 | { |
@@ -6342,7 +6342,7 @@ discard block |
||
6342 | 6342 | * @param string $text |
6343 | 6343 | * @param string $line |
6344 | 6344 | * @param string $output |
6345 | - * @return bool |
|
6345 | + * @return null|boolean |
|
6346 | 6346 | */ |
6347 | 6347 | public function messageQuit( |
6348 | 6348 | $msg = 'unspecified error', |
@@ -6785,7 +6785,7 @@ discard block |
||
6785 | 6785 | |
6786 | 6786 | /** |
6787 | 6787 | * @param string $str |
6788 | - * @return bool|mixed|string |
|
6788 | + * @return string |
|
6789 | 6789 | */ |
6790 | 6790 | public function atBindInclude($str = '') |
6791 | 6791 | { |
@@ -6837,7 +6837,7 @@ discard block |
||
6837 | 6837 | * @param $str |
6838 | 6838 | * @param int $flags |
6839 | 6839 | * @param string $encode |
6840 | - * @return mixed |
|
6840 | + * @return string |
|
6841 | 6841 | */ |
6842 | 6842 | public function htmlspecialchars($str, $flags = ENT_COMPAT, $encode = '') |
6843 | 6843 | { |
@@ -6847,7 +6847,7 @@ discard block |
||
6847 | 6847 | } |
6848 | 6848 | |
6849 | 6849 | /** |
6850 | - * @param $string |
|
6850 | + * @param string $string |
|
6851 | 6851 | * @param bool $returnData |
6852 | 6852 | * @return bool|mixed |
6853 | 6853 | */ |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | function __call($method_name, $arguments) |
230 | 230 | { |
231 | - include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php'); |
|
231 | + include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php'); |
|
232 | 232 | if (method_exists($this->old, $method_name)) { |
233 | 233 | $error_type = 1; |
234 | 234 | } else { |
@@ -246,12 +246,12 @@ discard block |
||
246 | 246 | $info = debug_backtrace(); |
247 | 247 | $m[] = $msg; |
248 | 248 | if (!empty($this->currentSnippet)) { |
249 | - $m[] = 'Snippet - ' . $this->currentSnippet; |
|
249 | + $m[] = 'Snippet - '.$this->currentSnippet; |
|
250 | 250 | } elseif (!empty($this->event->activePlugin)) { |
251 | - $m[] = 'Plugin - ' . $this->event->activePlugin; |
|
251 | + $m[] = 'Plugin - '.$this->event->activePlugin; |
|
252 | 252 | } |
253 | 253 | $m[] = $this->decoded_request_uri; |
254 | - $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; |
|
254 | + $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; |
|
255 | 255 | $msg = implode('<br />', $m); |
256 | 256 | $this->logEvent(0, $error_type, $msg, $title); |
257 | 257 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | { |
269 | 269 | $flag = false; |
270 | 270 | if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) { |
271 | - $flag = (bool)$this->{$connector}->conn; |
|
271 | + $flag = (bool) $this->{$connector}->conn; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | return $flag; |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | } |
297 | 297 | if (!$out && $flag) { |
298 | 298 | $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); |
299 | - $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; |
|
299 | + $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; |
|
300 | 300 | $out = is_file($filename) ? include $filename : false; |
301 | 301 | } |
302 | 302 | if ($out && !in_array($extname, $this->extensions)) { |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | { |
316 | 316 | list ($usec, $sec) = explode(' ', microtime()); |
317 | 317 | |
318 | - return ((float)$usec + (float)$sec); |
|
318 | + return ((float) $usec + (float) $sec); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | /** |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | // append the redirect count string to the url |
340 | 340 | $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0; |
341 | 341 | if ($currentNumberOfRedirects > 3) { |
342 | - $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>'); |
|
342 | + $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>'); |
|
343 | 343 | } else { |
344 | 344 | $currentNumberOfRedirects += 1; |
345 | 345 | if (strpos($url, "?") > 0) { |
@@ -350,9 +350,9 @@ discard block |
||
350 | 350 | } |
351 | 351 | } |
352 | 352 | if ($type == 'REDIRECT_REFRESH') { |
353 | - $header = 'Refresh: 0;URL=' . $url; |
|
353 | + $header = 'Refresh: 0;URL='.$url; |
|
354 | 354 | } elseif ($type == 'REDIRECT_META') { |
355 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />'; |
|
355 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />'; |
|
356 | 356 | echo $header; |
357 | 357 | exit; |
358 | 358 | } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) { |
@@ -360,10 +360,10 @@ discard block |
||
360 | 360 | global $base_url, $site_url; |
361 | 361 | if (substr($url, 0, strlen($base_url)) == $base_url) { |
362 | 362 | // append $site_url to make it work with Location: |
363 | - $url = $site_url . substr($url, strlen($base_url)); |
|
363 | + $url = $site_url.substr($url, strlen($base_url)); |
|
364 | 364 | } |
365 | 365 | if (strpos($url, "\n") === false) { |
366 | - $header = 'Location: ' . $url; |
|
366 | + $header = 'Location: '.$url; |
|
367 | 367 | } else { |
368 | 368 | $this->messageQuit('No newline allowed in redirect url.'); |
369 | 369 | } |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | |
479 | 479 | private function recoverySiteCache() |
480 | 480 | { |
481 | - $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
482 | - $site_cache_path = $site_cache_dir . 'siteCache.idx.php'; |
|
481 | + $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
482 | + $site_cache_path = $site_cache_dir.'siteCache.idx.php'; |
|
483 | 483 | |
484 | 484 | if (is_file($site_cache_path)) { |
485 | 485 | include($site_cache_path); |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | return; |
489 | 489 | } |
490 | 490 | |
491 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
491 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
492 | 492 | $cache = new synccache(); |
493 | 493 | $cache->setCachepath($site_cache_dir); |
494 | 494 | $cache->setReport(false); |
@@ -540,8 +540,8 @@ discard block |
||
540 | 540 | $this->invokeEvent("OnBeforeManagerPageInit"); |
541 | 541 | } |
542 | 542 | |
543 | - if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) { |
|
544 | - $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet']; |
|
543 | + if (isset ($_SESSION[$usrType.'UsrConfigSet'])) { |
|
544 | + $usrSettings = &$_SESSION[$usrType.'UsrConfigSet']; |
|
545 | 545 | } else { |
546 | 546 | if ($usrType == 'web') { |
547 | 547 | $from = $tbl_web_user_settings; |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | $usrSettings[$row['setting_name']] = $row['setting_value']; |
562 | 562 | } |
563 | 563 | if (isset ($usrType)) { |
564 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; |
|
564 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings; |
|
565 | 565 | } // store user settings in session |
566 | 566 | } |
567 | 567 | } |
@@ -707,10 +707,10 @@ discard block |
||
707 | 707 | $suf = $this->config['friendly_url_suffix']; |
708 | 708 | $pre = preg_quote($pre, '/'); |
709 | 709 | $suf = preg_quote($suf, '/'); |
710 | - if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) { |
|
710 | + if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) { |
|
711 | 711 | $q = $_[1]; |
712 | 712 | } |
713 | - if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) { |
|
713 | + if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) { |
|
714 | 714 | $q = $_[1]; |
715 | 715 | } |
716 | 716 | |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */ |
734 | 734 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
735 | 735 | if ($this->config['use_alias_path'] == 1) { |
736 | - if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, |
|
736 | + if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir.'/'.$q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, |
|
737 | 737 | $this->getChildIds($this->documentListing[$this->virtualDir], |
738 | 738 | 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) { |
739 | 739 | $this->documentMethod = 'id'; |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | */ |
774 | 774 | public function getHashFile($key) |
775 | 775 | { |
776 | - return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php"; |
|
776 | + return $this->getCacheFolder()."docid_".$key.".pageCache.php"; |
|
777 | 777 | } |
778 | 778 | |
779 | 779 | /** |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
793 | 793 | $params = $_GET; |
794 | 794 | ksort($params); |
795 | - $hash .= '_' . md5(http_build_query($params)); |
|
795 | + $hash .= '_'.md5(http_build_query($params)); |
|
796 | 796 | } |
797 | 797 | } |
798 | 798 | $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); |
@@ -941,12 +941,12 @@ discard block |
||
941 | 941 | if ($js = $this->getRegisteredClientStartupScripts()) { |
942 | 942 | // change to just before closing </head> |
943 | 943 | // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); |
944 | - $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); |
|
944 | + $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); |
|
945 | 945 | } |
946 | 946 | |
947 | 947 | // Insert jscripts & html block into template - template must have a </body> tag |
948 | 948 | if ($js = $this->getRegisteredClientScripts()) { |
949 | - $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); |
|
949 | + $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); |
|
950 | 950 | } |
951 | 951 | // End fix by sirlancelot |
952 | 952 | |
@@ -957,7 +957,7 @@ discard block |
||
957 | 957 | // send out content-type and content-disposition headers |
958 | 958 | if (IN_PARSER_MODE == "true") { |
959 | 959 | $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html"; |
960 | - header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']); |
|
960 | + header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']); |
|
961 | 961 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error) |
962 | 962 | // header('HTTP/1.0 404 Not Found'); |
963 | 963 | if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { |
@@ -975,7 +975,7 @@ discard block |
||
975 | 975 | $name = preg_replace('|-+|', '-', $name); |
976 | 976 | $name = trim($name, '-'); |
977 | 977 | } |
978 | - $header = 'Content-Disposition: attachment; filename=' . $name; |
|
978 | + $header = 'Content-Disposition: attachment; filename='.$name; |
|
979 | 979 | header($header); |
980 | 980 | } |
981 | 981 | } |
@@ -983,7 +983,7 @@ discard block |
||
983 | 983 | |
984 | 984 | $stats = $this->getTimerStats($this->tstart); |
985 | 985 | |
986 | - $out =& $this->documentOutput; |
|
986 | + $out = & $this->documentOutput; |
|
987 | 987 | $out = str_replace("[^q^]", $stats['queries'], $out); |
988 | 988 | $out = str_replace("[^qt^]", $stats['queryTime'], $out); |
989 | 989 | $out = str_replace("[^p^]", $stats['phpTime'], $out); |
@@ -1022,19 +1022,19 @@ discard block |
||
1022 | 1022 | $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet |
1023 | 1023 | $tt += $t; |
1024 | 1024 | } |
1025 | - echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", |
|
1026 | - $tt) . ")</legend>{$sc}</fieldset><br />"; |
|
1025 | + echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", |
|
1026 | + $tt).")</legend>{$sc}</fieldset><br />"; |
|
1027 | 1027 | echo $this->snippetsCode; |
1028 | 1028 | } |
1029 | 1029 | if ($this->dumpPlugins) { |
1030 | 1030 | $ps = ""; |
1031 | 1031 | $tt = 0; |
1032 | 1032 | foreach ($this->pluginsTime as $s => $t) { |
1033 | - $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; |
|
1033 | + $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; |
|
1034 | 1034 | $tt += $t; |
1035 | 1035 | } |
1036 | - echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", |
|
1037 | - $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; |
|
1036 | + echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", |
|
1037 | + $tt * 1000).")</legend>{$ps}</fieldset><br />"; |
|
1038 | 1038 | echo $this->pluginsCode; |
1039 | 1039 | } |
1040 | 1040 | |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | $srcTags = explode(',', $tags); |
1062 | 1062 | $repTags = array(); |
1063 | 1063 | foreach ($srcTags as $tag) { |
1064 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1]; |
|
1064 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1]; |
|
1065 | 1065 | } |
1066 | 1066 | |
1067 | 1067 | return array($srcTags, $repTags); |
@@ -1084,7 +1084,7 @@ discard block |
||
1084 | 1084 | $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); |
1085 | 1085 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache"; |
1086 | 1086 | $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0; |
1087 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb"; |
|
1087 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb"; |
|
1088 | 1088 | |
1089 | 1089 | return $stats; |
1090 | 1090 | } |
@@ -1117,7 +1117,7 @@ discard block |
||
1117 | 1117 | { |
1118 | 1118 | $cacheRefreshTime = 0; |
1119 | 1119 | $recent_update = 0; |
1120 | - @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php'); |
|
1120 | + @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php'); |
|
1121 | 1121 | $this->recentUpdate = $recent_update; |
1122 | 1122 | |
1123 | 1123 | $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time']; |
@@ -1171,8 +1171,8 @@ discard block |
||
1171 | 1171 | } |
1172 | 1172 | |
1173 | 1173 | $docObjSerial = serialize($this->documentObject); |
1174 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent; |
|
1175 | - $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey); |
|
1174 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent; |
|
1175 | + $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey); |
|
1176 | 1176 | file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); |
1177 | 1177 | } |
1178 | 1178 | } |
@@ -1232,7 +1232,7 @@ discard block |
||
1232 | 1232 | $pos[']]>'] = strpos($content, ']]>'); |
1233 | 1233 | |
1234 | 1234 | if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { |
1235 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3); |
|
1235 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3); |
|
1236 | 1236 | } |
1237 | 1237 | |
1238 | 1238 | $lp = explode($left, $content); |
@@ -1362,8 +1362,8 @@ discard block |
||
1362 | 1362 | } |
1363 | 1363 | |
1364 | 1364 | if (is_array($value)) { |
1365 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php'); |
|
1366 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
1365 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php'); |
|
1366 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
1367 | 1367 | $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]); |
1368 | 1368 | } |
1369 | 1369 | |
@@ -1375,7 +1375,7 @@ discard block |
||
1375 | 1375 | if (strpos($content, $s) !== false) { |
1376 | 1376 | $content = str_replace($s, $value, $content); |
1377 | 1377 | } elseif ($this->debug) { |
1378 | - $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1378 | + $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1379 | 1379 | } |
1380 | 1380 | } |
1381 | 1381 | |
@@ -1544,7 +1544,7 @@ discard block |
||
1544 | 1544 | if (strpos($content, $s) !== false) { |
1545 | 1545 | $content = str_replace($s, $value, $content); |
1546 | 1546 | } elseif ($this->debug) { |
1547 | - $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1547 | + $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1548 | 1548 | } |
1549 | 1549 | } |
1550 | 1550 | |
@@ -1598,7 +1598,7 @@ discard block |
||
1598 | 1598 | } |
1599 | 1599 | |
1600 | 1600 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags |
1601 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1601 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1602 | 1602 | if ($this->config['enable_at_syntax']) { |
1603 | 1603 | $value = $this->mergeConditionalTagsContent($value); |
1604 | 1604 | } |
@@ -1614,7 +1614,7 @@ discard block |
||
1614 | 1614 | if (strpos($content, $s) !== false) { |
1615 | 1615 | $content = str_replace($s, $value, $content); |
1616 | 1616 | } elseif ($this->debug) { |
1617 | - $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1617 | + $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1618 | 1618 | } |
1619 | 1619 | } |
1620 | 1620 | |
@@ -1674,7 +1674,7 @@ discard block |
||
1674 | 1674 | if (strpos($content, $s) !== false) { |
1675 | 1675 | $content = str_replace($s, $value, $content); |
1676 | 1676 | } elseif ($this->debug) { |
1677 | - $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1677 | + $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1678 | 1678 | } |
1679 | 1679 | } |
1680 | 1680 | |
@@ -1695,7 +1695,7 @@ discard block |
||
1695 | 1695 | $elseiftag = '<@ELSEIF:', |
1696 | 1696 | $elsetag = '<@ELSE>', |
1697 | 1697 | $endiftag = '<@ENDIF>' |
1698 | - ) { |
|
1698 | + ){ |
|
1699 | 1699 | if (strpos($content, '@IF') !== false) { |
1700 | 1700 | $content = $this->_prepareCTag($content, $iftag, $elseiftag, $elsetag, $endiftag); |
1701 | 1701 | } |
@@ -1704,7 +1704,7 @@ discard block |
||
1704 | 1704 | return $content; |
1705 | 1705 | } |
1706 | 1706 | |
1707 | - $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; |
|
1707 | + $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; |
|
1708 | 1708 | $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), |
1709 | 1709 | $content); |
1710 | 1710 | |
@@ -1716,7 +1716,7 @@ discard block |
||
1716 | 1716 | } |
1717 | 1717 | list($cmd, $text) = explode('>', $split, 2); |
1718 | 1718 | $cmd = str_replace("'", "\'", $cmd); |
1719 | - $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1719 | + $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1720 | 1720 | $content .= $text; |
1721 | 1721 | } |
1722 | 1722 | $pieces = explode('<@ELSEIF:', $content); |
@@ -1727,13 +1727,13 @@ discard block |
||
1727 | 1727 | } |
1728 | 1728 | list($cmd, $text) = explode('>', $split, 2); |
1729 | 1729 | $cmd = str_replace("'", "\'", $cmd); |
1730 | - $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1730 | + $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1731 | 1731 | $content .= $text; |
1732 | 1732 | } |
1733 | 1733 | |
1734 | 1734 | $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); |
1735 | 1735 | ob_start(); |
1736 | - $content = eval('?>' . $content); |
|
1736 | + $content = eval('?>'.$content); |
|
1737 | 1737 | $content = ob_get_clean(); |
1738 | 1738 | $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), |
1739 | 1739 | $content); |
@@ -1755,7 +1755,7 @@ discard block |
||
1755 | 1755 | $elseiftag = '<@ELSEIF:', |
1756 | 1756 | $elsetag = '<@ELSE>', |
1757 | 1757 | $endiftag = '<@ENDIF>' |
1758 | - ) { |
|
1758 | + ){ |
|
1759 | 1759 | if (strpos($content, '<!--@IF ') !== false) { |
1760 | 1760 | $content = str_replace('<!--@IF ', $iftag, $content); |
1761 | 1761 | } // for jp |
@@ -1865,7 +1865,7 @@ discard block |
||
1865 | 1865 | $matches = $this->getTagsFromContent($content, $left, $right); |
1866 | 1866 | if (!empty($matches)) { |
1867 | 1867 | foreach ($matches[0] as $i => $v) { |
1868 | - $addBreakMatches[$i] = $v . "\n"; |
|
1868 | + $addBreakMatches[$i] = $v."\n"; |
|
1869 | 1869 | } |
1870 | 1870 | $content = str_replace($addBreakMatches, '', $content); |
1871 | 1871 | if (strpos($content, $left) !== false) { |
@@ -1900,7 +1900,7 @@ discard block |
||
1900 | 1900 | if (strpos($content, $s) !== false) { |
1901 | 1901 | $content = str_replace($s, $v, $content); |
1902 | 1902 | } elseif ($this->debug) { |
1903 | - $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1903 | + $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1904 | 1904 | } |
1905 | 1905 | } |
1906 | 1906 | |
@@ -1967,7 +1967,7 @@ discard block |
||
1967 | 1967 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', |
1968 | 1968 | $error_info['message'], $error_info['line'], $msg); |
1969 | 1969 | if ($this->isBackend()) { |
1970 | - $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>'); |
|
1970 | + $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>'); |
|
1971 | 1971 | } |
1972 | 1972 | } |
1973 | 1973 | } else { |
@@ -2014,7 +2014,7 @@ discard block |
||
2014 | 2014 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', |
2015 | 2015 | $error_info['message'], $error_info['line'], $echo); |
2016 | 2016 | if ($this->isBackend()) { |
2017 | - $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>'); |
|
2017 | + $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>'); |
|
2018 | 2018 | } |
2019 | 2019 | } |
2020 | 2020 | } |
@@ -2022,7 +2022,7 @@ discard block |
||
2022 | 2022 | if (is_array($return) || is_object($return)) { |
2023 | 2023 | return $return; |
2024 | 2024 | } else { |
2025 | - return $echo . $return; |
|
2025 | + return $echo.$return; |
|
2026 | 2026 | } |
2027 | 2027 | } |
2028 | 2028 | |
@@ -2062,7 +2062,7 @@ discard block |
||
2062 | 2062 | if (strpos($content, $s) !== false) { |
2063 | 2063 | $content = str_replace($s, $value, $content); |
2064 | 2064 | } elseif ($this->debug) { |
2065 | - $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
2065 | + $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
2066 | 2066 | } |
2067 | 2067 | continue; |
2068 | 2068 | } |
@@ -2074,7 +2074,7 @@ discard block |
||
2074 | 2074 | if (strpos($content, $s) !== false) { |
2075 | 2075 | $content = str_replace($s, $value, $content); |
2076 | 2076 | } elseif ($this->debug) { |
2077 | - $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
2077 | + $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
2078 | 2078 | } |
2079 | 2079 | } |
2080 | 2080 | |
@@ -2167,7 +2167,7 @@ discard block |
||
2167 | 2167 | $code = str_replace("\t", ' ', $this->htmlspecialchars($value)); |
2168 | 2168 | $piece = str_replace("\t", ' ', $this->htmlspecialchars($piece)); |
2169 | 2169 | $print_r_params = str_replace("\t", ' ', |
2170 | - $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); |
|
2170 | + $this->htmlspecialchars('$modx->event->params = '.print_r($params, true))); |
|
2171 | 2171 | $this->snippetsCode .= sprintf('<fieldset style="margin:1em;"><legend><b>%s</b>(%s)</legend><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">[[%s]]</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre></fieldset>', |
2172 | 2172 | $snippetObject['name'], $eventtime, $piece, $print_r_params, $code); |
2173 | 2173 | $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); |
@@ -2416,7 +2416,7 @@ discard block |
||
2416 | 2416 | $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where); |
2417 | 2417 | $count = $this->db->getRecordCount($rs); |
2418 | 2418 | if (1 < $count) { |
2419 | - exit('Error $modx->_getSnippetObject()' . $snip_name); |
|
2419 | + exit('Error $modx->_getSnippetObject()'.$snip_name); |
|
2420 | 2420 | } |
2421 | 2421 | if ($count) { |
2422 | 2422 | $row = $this->db->getRow($rs); |
@@ -2445,13 +2445,13 @@ discard block |
||
2445 | 2445 | $suff = $this->config['friendly_url_suffix']; |
2446 | 2446 | |
2447 | 2447 | return str_replace(array( |
2448 | - '.xml' . $suff, |
|
2449 | - '.rss' . $suff, |
|
2450 | - '.js' . $suff, |
|
2451 | - '.css' . $suff, |
|
2452 | - '.txt' . $suff, |
|
2453 | - '.json' . $suff, |
|
2454 | - '.pdf' . $suff |
|
2448 | + '.xml'.$suff, |
|
2449 | + '.rss'.$suff, |
|
2450 | + '.js'.$suff, |
|
2451 | + '.css'.$suff, |
|
2452 | + '.txt'.$suff, |
|
2453 | + '.json'.$suff, |
|
2454 | + '.pdf'.$suff |
|
2455 | 2455 | ), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text); |
2456 | 2456 | } |
2457 | 2457 | |
@@ -2484,7 +2484,7 @@ discard block |
||
2484 | 2484 | $suff = '/'; |
2485 | 2485 | } |
2486 | 2486 | |
2487 | - $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff; |
|
2487 | + $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff; |
|
2488 | 2488 | } |
2489 | 2489 | |
2490 | 2490 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -2522,7 +2522,7 @@ discard block |
||
2522 | 2522 | $ids = implode(',', array_unique($match['1'])); |
2523 | 2523 | if ($ids) { |
2524 | 2524 | $res = $this->db->select("id,alias,isfolder,parent,alias_visible", |
2525 | - $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'"); |
|
2525 | + $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'"); |
|
2526 | 2526 | while ($row = $this->db->getRow($res)) { |
2527 | 2527 | if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) { |
2528 | 2528 | $parent = $row['parent']; |
@@ -2533,7 +2533,7 @@ discard block |
||
2533 | 2533 | $parent = $this->aliasListing[$parent]['parent']; |
2534 | 2534 | } |
2535 | 2535 | |
2536 | - $aliases[$row['id']] = $path . '/' . $row['alias']; |
|
2536 | + $aliases[$row['id']] = $path.'/'.$row['alias']; |
|
2537 | 2537 | } else { |
2538 | 2538 | $aliases[$row['id']] = $row['alias']; |
2539 | 2539 | } |
@@ -2546,7 +2546,7 @@ discard block |
||
2546 | 2546 | $pref = $this->config['friendly_url_prefix']; |
2547 | 2547 | $suff = $this->config['friendly_url_suffix']; |
2548 | 2548 | $documentSource = preg_replace_callback($in, |
2549 | - function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2549 | + function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2550 | 2550 | $modx = evolutionCMS(); |
2551 | 2551 | $thealias = $aliases[$m[1]]; |
2552 | 2552 | $thefolder = $isfolder[$m[1]]; |
@@ -2565,7 +2565,7 @@ discard block |
||
2565 | 2565 | |
2566 | 2566 | } else { |
2567 | 2567 | $in = '!\[\~([0-9]+)\~\]!is'; |
2568 | - $out = "index.php?id=" . '\1'; |
|
2568 | + $out = "index.php?id=".'\1'; |
|
2569 | 2569 | $documentSource = preg_replace($in, $out, $documentSource); |
2570 | 2570 | } |
2571 | 2571 | |
@@ -2586,7 +2586,7 @@ discard block |
||
2586 | 2586 | $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; |
2587 | 2587 | $len_base_url = strlen($this->config['base_url']); |
2588 | 2588 | |
2589 | - $url_path = $q;//LANG |
|
2589 | + $url_path = $q; //LANG |
|
2590 | 2590 | |
2591 | 2591 | if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) { |
2592 | 2592 | $url_path = substr($url_path, $len_base_url); |
@@ -2598,7 +2598,7 @@ discard block |
||
2598 | 2598 | $strictURL = substr($strictURL, $len_base_url); |
2599 | 2599 | } |
2600 | 2600 | $http_host = $_SERVER['HTTP_HOST']; |
2601 | - $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG |
|
2601 | + $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG |
|
2602 | 2602 | |
2603 | 2603 | $site_url = $this->config['site_url']; |
2604 | 2604 | |
@@ -2615,7 +2615,7 @@ discard block |
||
2615 | 2615 | } |
2616 | 2616 | if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) { |
2617 | 2617 | if (empty($_POST)) { |
2618 | - if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) { |
|
2618 | + if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) { |
|
2619 | 2619 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently'); |
2620 | 2620 | exit(0); |
2621 | 2621 | } |
@@ -2680,7 +2680,7 @@ discard block |
||
2680 | 2680 | $docgrp = implode(",", $docgrp); |
2681 | 2681 | } |
2682 | 2682 | // get document |
2683 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2683 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2684 | 2684 | $rs = $this->db->select('sc.*', "{$tblsc} sc |
2685 | 2685 | LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); |
2686 | 2686 | if ($this->db->getRecordCount($rs) < 1) { |
@@ -2718,9 +2718,9 @@ discard block |
||
2718 | 2718 | if ($documentObject['template']) { |
2719 | 2719 | // load TVs and merge with document - Orig by Apodigm - Docvars |
2720 | 2720 | $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", |
2721 | - $this->getFullTableName("site_tmplvars") . " tv |
|
2722 | - INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
2723 | - LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", |
|
2721 | + $this->getFullTableName("site_tmplvars")." tv |
|
2722 | + INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id |
|
2723 | + LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", |
|
2724 | 2724 | "tvtpl.templateid = '{$documentObject['template']}'"); |
2725 | 2725 | $tmplvars = array(); |
2726 | 2726 | while ($row = $this->db->getRow($rs)) { |
@@ -2767,7 +2767,7 @@ discard block |
||
2767 | 2767 | $st = md5($source); |
2768 | 2768 | } |
2769 | 2769 | if ($this->dumpSnippets == 1) { |
2770 | - $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS " . ($i + 1) . "</b></legend><p>The following snippets (if any) were parsed during this pass.</p>"; |
|
2770 | + $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS ".($i + 1)."</b></legend><p>The following snippets (if any) were parsed during this pass.</p>"; |
|
2771 | 2771 | } |
2772 | 2772 | |
2773 | 2773 | // invoke OnParseDocument event |
@@ -2810,7 +2810,7 @@ discard block |
||
2810 | 2810 | */ |
2811 | 2811 | public function executeParser() |
2812 | 2812 | { |
2813 | - if(MODX_CLI) { |
|
2813 | + if (MODX_CLI) { |
|
2814 | 2814 | throw new RuntimeException('Call DocumentParser::executeParser on CLI mode'); |
2815 | 2815 | } |
2816 | 2816 | |
@@ -2856,7 +2856,7 @@ discard block |
||
2856 | 2856 | |
2857 | 2857 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path |
2858 | 2858 | if ($this->config['use_alias_path'] == 1) { |
2859 | - $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier; |
|
2859 | + $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier; |
|
2860 | 2860 | if (isset($this->documentListing[$alias])) { |
2861 | 2861 | $this->documentIdentifier = $this->documentListing[$alias]; |
2862 | 2862 | } else { |
@@ -2919,7 +2919,7 @@ discard block |
||
2919 | 2919 | $docAlias = $this->db->escape($this->documentIdentifier); |
2920 | 2920 | $rs = $this->db->select('id', $this->getFullTableName('site_content'), |
2921 | 2921 | "deleted=0 and alias='{$docAlias}'"); |
2922 | - $this->documentIdentifier = (int)$this->db->getValue($rs); |
|
2922 | + $this->documentIdentifier = (int) $this->db->getValue($rs); |
|
2923 | 2923 | } |
2924 | 2924 | } |
2925 | 2925 | $this->documentMethod = 'id'; |
@@ -2973,7 +2973,7 @@ discard block |
||
2973 | 2973 | $_REQUEST[$n] = $_GET[$n] = $v; |
2974 | 2974 | } |
2975 | 2975 | } |
2976 | - $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path']; |
|
2976 | + $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path']; |
|
2977 | 2977 | $this->q = $qp['path']; |
2978 | 2978 | |
2979 | 2979 | return $qp['path']; |
@@ -3069,7 +3069,7 @@ discard block |
||
3069 | 3069 | $this->sendErrorPage(); |
3070 | 3070 | } else { |
3071 | 3071 | // Inculde the necessary files to check document permissions |
3072 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
3072 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
3073 | 3073 | $udperms = new udperms(); |
3074 | 3074 | $udperms->user = $this->getLoginUserID(); |
3075 | 3075 | $udperms->document = $this->documentIdentifier; |
@@ -3123,7 +3123,7 @@ discard block |
||
3123 | 3123 | while ($id && $height--) { |
3124 | 3124 | $thisid = $id; |
3125 | 3125 | if ($this->config['aliaslistingfolder'] == 1) { |
3126 | - $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1"); |
|
3126 | + $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1"); |
|
3127 | 3127 | if (!$id || $id == '0') { |
3128 | 3128 | break; |
3129 | 3129 | } |
@@ -3177,15 +3177,15 @@ discard block |
||
3177 | 3177 | if ($this->config['aliaslistingfolder'] == 1) { |
3178 | 3178 | |
3179 | 3179 | $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), |
3180 | - "parent IN (" . $id . ") AND deleted = '0'"); |
|
3180 | + "parent IN (".$id.") AND deleted = '0'"); |
|
3181 | 3181 | $idx = array(); |
3182 | 3182 | while ($row = $this->db->getRow($res)) { |
3183 | 3183 | $pAlias = ''; |
3184 | 3184 | if (isset($this->aliasListing[$row['parent']])) { |
3185 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : ''; |
|
3186 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : ''; |
|
3185 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : ''; |
|
3186 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : ''; |
|
3187 | 3187 | }; |
3188 | - $children[$pAlias . $row['alias']] = $row['id']; |
|
3188 | + $children[$pAlias.$row['alias']] = $row['id']; |
|
3189 | 3189 | if ($row['isfolder'] == 1) { |
3190 | 3190 | $idx[] = $row['id']; |
3191 | 3191 | } |
@@ -3218,7 +3218,7 @@ discard block |
||
3218 | 3218 | $depth--; |
3219 | 3219 | |
3220 | 3220 | foreach ($documentMap_cache[$id] as $childId) { |
3221 | - $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias']; |
|
3221 | + $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias']; |
|
3222 | 3222 | if (!strlen($pkey)) { |
3223 | 3223 | $pkey = "{$childId}"; |
3224 | 3224 | } |
@@ -3248,7 +3248,7 @@ discard block |
||
3248 | 3248 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
3249 | 3249 | $fnc = substr($url, 11); |
3250 | 3250 | } elseif ($url) { |
3251 | - $fnc = "window.location.href='" . addslashes($url) . "';"; |
|
3251 | + $fnc = "window.location.href='".addslashes($url)."';"; |
|
3252 | 3252 | } else { |
3253 | 3253 | $fnc = "history.back(-1);"; |
3254 | 3254 | } |
@@ -3257,7 +3257,7 @@ discard block |
||
3257 | 3257 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\"> |
3258 | 3258 | <script> |
3259 | 3259 | function __alertQuit() { |
3260 | - alert('" . addslashes($msg) . "'); |
|
3260 | + alert('".addslashes($msg)."'); |
|
3261 | 3261 | {$fnc} |
3262 | 3262 | } |
3263 | 3263 | window.setTimeout('__alertQuit();',100); |
@@ -3279,10 +3279,10 @@ discard block |
||
3279 | 3279 | $state = 0; |
3280 | 3280 | $pms = $_SESSION['mgrPermissions']; |
3281 | 3281 | if ($pms) { |
3282 | - $state = ((bool)$pms[$pm] === true); |
|
3282 | + $state = ((bool) $pms[$pm] === true); |
|
3283 | 3283 | } |
3284 | 3284 | |
3285 | - return (int)$state; |
|
3285 | + return (int) $state; |
|
3286 | 3286 | } |
3287 | 3287 | |
3288 | 3288 | /** |
@@ -3295,8 +3295,8 @@ discard block |
||
3295 | 3295 | */ |
3296 | 3296 | public function elementIsLocked($type, $id, $includeThisUser = false) |
3297 | 3297 | { |
3298 | - $id = (int)$id; |
|
3299 | - $type = (int)$type; |
|
3298 | + $id = (int) $id; |
|
3299 | + $type = (int) $type; |
|
3300 | 3300 | if (!$type || !$id) { |
3301 | 3301 | return null; |
3302 | 3302 | } |
@@ -3346,7 +3346,7 @@ discard block |
||
3346 | 3346 | return $lockedElements; |
3347 | 3347 | } |
3348 | 3348 | |
3349 | - $type = (int)$type; |
|
3349 | + $type = (int) $type; |
|
3350 | 3350 | if (isset($lockedElements[$type])) { |
3351 | 3351 | return $lockedElements[$type]; |
3352 | 3352 | } else { |
@@ -3364,7 +3364,7 @@ discard block |
||
3364 | 3364 | $this->cleanupExpiredLocks(); |
3365 | 3365 | |
3366 | 3366 | $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', |
3367 | - $this->getFullTableName('active_user_locks') . " ul |
|
3367 | + $this->getFullTableName('active_user_locks')." ul |
|
3368 | 3368 | LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); |
3369 | 3369 | while ($row = $this->db->getRow($rs)) { |
3370 | 3370 | $this->lockedElements[$row['elementType']][$row['elementId']] = array( |
@@ -3387,7 +3387,7 @@ discard block |
||
3387 | 3387 | public function cleanupExpiredLocks() |
3388 | 3388 | { |
3389 | 3389 | // Clean-up active_user_sessions first |
3390 | - $timeout = (int)$this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
3390 | + $timeout = (int) $this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
3391 | 3391 | $validSessionTimeLimit = $this->time - $timeout; |
3392 | 3392 | $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}"); |
3393 | 3393 | |
@@ -3400,7 +3400,7 @@ discard block |
||
3400 | 3400 | foreach ($rs as $row) { |
3401 | 3401 | $userSids[] = $row['sid']; |
3402 | 3402 | } |
3403 | - $userSids = "'" . implode("','", $userSids) . "'"; |
|
3403 | + $userSids = "'".implode("','", $userSids)."'"; |
|
3404 | 3404 | $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})"); |
3405 | 3405 | } else { |
3406 | 3406 | $this->db->delete($this->getFullTableName('active_user_locks')); |
@@ -3487,8 +3487,8 @@ discard block |
||
3487 | 3487 | public function lockElement($type, $id) |
3488 | 3488 | { |
3489 | 3489 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3490 | - $type = (int)$type; |
|
3491 | - $id = (int)$id; |
|
3490 | + $type = (int) $type; |
|
3491 | + $id = (int) $id; |
|
3492 | 3492 | if (!$type || !$id || !$userId) { |
3493 | 3493 | return false; |
3494 | 3494 | } |
@@ -3510,8 +3510,8 @@ discard block |
||
3510 | 3510 | public function unlockElement($type, $id, $includeAllUsers = false) |
3511 | 3511 | { |
3512 | 3512 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3513 | - $type = (int)$type; |
|
3514 | - $id = (int)$id; |
|
3513 | + $type = (int) $type; |
|
3514 | + $id = (int) $id; |
|
3515 | 3515 | if (!$type || !$id) { |
3516 | 3516 | return false; |
3517 | 3517 | } |
@@ -3581,8 +3581,8 @@ discard block |
||
3581 | 3581 | } |
3582 | 3582 | |
3583 | 3583 | $usertype = $this->isFrontend() ? 1 : 0; |
3584 | - $evtid = (int)$evtid; |
|
3585 | - $type = (int)$type; |
|
3584 | + $evtid = (int) $evtid; |
|
3585 | + $type = (int) $type; |
|
3586 | 3586 | |
3587 | 3587 | // Types: 1 = information, 2 = warning, 3 = error |
3588 | 3588 | if ($type < 1) { |
@@ -3604,8 +3604,8 @@ discard block |
||
3604 | 3604 | if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') { |
3605 | 3605 | if ($this->config['send_errormail'] <= $type) { |
3606 | 3606 | $this->sendmail(array( |
3607 | - 'subject' => 'MODX System Error on ' . $this->config['site_name'], |
|
3608 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.', |
|
3607 | + 'subject' => 'MODX System Error on '.$this->config['site_name'], |
|
3608 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.', |
|
3609 | 3609 | 'type' => 'text' |
3610 | 3610 | )); |
3611 | 3611 | } |
@@ -3653,7 +3653,7 @@ discard block |
||
3653 | 3653 | $p['fromname'] = $userinfo['username']; |
3654 | 3654 | } |
3655 | 3655 | if ($msg === '' && !isset($p['body'])) { |
3656 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER']; |
|
3656 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER']; |
|
3657 | 3657 | } elseif (is_string($msg) && 0 < strlen($msg)) { |
3658 | 3658 | $p['body'] = $msg; |
3659 | 3659 | } |
@@ -3693,8 +3693,8 @@ discard block |
||
3693 | 3693 | $files = array(); |
3694 | 3694 | } |
3695 | 3695 | foreach ($files as $f) { |
3696 | - if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { |
|
3697 | - $this->mail->AddAttachment(MODX_BASE_PATH . $f); |
|
3696 | + if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { |
|
3697 | + $this->mail->AddAttachment(MODX_BASE_PATH.$f); |
|
3698 | 3698 | } |
3699 | 3699 | } |
3700 | 3700 | $rs = $this->mail->send(); |
@@ -3759,7 +3759,7 @@ discard block |
||
3759 | 3759 | $sort = 'menuindex', |
3760 | 3760 | $dir = 'ASC', |
3761 | 3761 | $fields = 'id, pagetitle, description, parent, alias, menutitle' |
3762 | - ) { |
|
3762 | + ){ |
|
3763 | 3763 | |
3764 | 3764 | $cacheKey = md5(print_r(func_get_args(), true)); |
3765 | 3765 | if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) { |
@@ -3769,14 +3769,14 @@ discard block |
||
3769 | 3769 | $tblsc = $this->getFullTableName("site_content"); |
3770 | 3770 | $tbldg = $this->getFullTableName("document_groups"); |
3771 | 3771 | // modify field names to use sc. table reference |
3772 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3773 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3772 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3773 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3774 | 3774 | // get document groups for current user |
3775 | 3775 | if ($docgrp = $this->getUserDocGroups()) { |
3776 | 3776 | $docgrp = implode(",", $docgrp); |
3777 | 3777 | } |
3778 | 3778 | // build query |
3779 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3779 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3780 | 3780 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3781 | 3781 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", |
3782 | 3782 | "{$sort} {$dir}"); |
@@ -3802,7 +3802,7 @@ discard block |
||
3802 | 3802 | $sort = 'menuindex', |
3803 | 3803 | $dir = 'ASC', |
3804 | 3804 | $fields = 'id, pagetitle, description, parent, alias, menutitle' |
3805 | - ) { |
|
3805 | + ){ |
|
3806 | 3806 | $cacheKey = md5(print_r(func_get_args(), true)); |
3807 | 3807 | if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) { |
3808 | 3808 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
@@ -3812,14 +3812,14 @@ discard block |
||
3812 | 3812 | $tbldg = $this->getFullTableName("document_groups"); |
3813 | 3813 | |
3814 | 3814 | // modify field names to use sc. table reference |
3815 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3816 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3815 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3816 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3817 | 3817 | // get document groups for current user |
3818 | 3818 | if ($docgrp = $this->getUserDocGroups()) { |
3819 | 3819 | $docgrp = implode(",", $docgrp); |
3820 | 3820 | } |
3821 | 3821 | // build query |
3822 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3822 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3823 | 3823 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3824 | 3824 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", |
3825 | 3825 | "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
@@ -3856,23 +3856,23 @@ discard block |
||
3856 | 3856 | $sort = 'menuindex', |
3857 | 3857 | $dir = 'ASC', |
3858 | 3858 | $limit = '' |
3859 | - ) { |
|
3859 | + ){ |
|
3860 | 3860 | |
3861 | 3861 | $cacheKey = md5(print_r(func_get_args(), true)); |
3862 | 3862 | if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) { |
3863 | 3863 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
3864 | 3864 | } |
3865 | 3865 | |
3866 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : ''; |
|
3867 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : ''; |
|
3866 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : ''; |
|
3867 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : ''; |
|
3868 | 3868 | |
3869 | 3869 | if ($where != '') { |
3870 | - $where = 'AND ' . $where; |
|
3870 | + $where = 'AND '.$where; |
|
3871 | 3871 | } |
3872 | 3872 | |
3873 | 3873 | // modify field names to use sc. table reference |
3874 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3875 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3874 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3875 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3876 | 3876 | |
3877 | 3877 | // get document groups for current user |
3878 | 3878 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -3880,7 +3880,7 @@ discard block |
||
3880 | 3880 | } |
3881 | 3881 | |
3882 | 3882 | // build query |
3883 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3883 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3884 | 3884 | |
3885 | 3885 | $tblsc = $this->getFullTableName('site_content'); |
3886 | 3886 | $tbldg = $this->getFullTableName('document_groups'); |
@@ -3923,7 +3923,7 @@ discard block |
||
3923 | 3923 | $sort = 'menuindex', |
3924 | 3924 | $dir = 'ASC', |
3925 | 3925 | $limit = '' |
3926 | - ) { |
|
3926 | + ){ |
|
3927 | 3927 | |
3928 | 3928 | $cacheKey = md5(print_r(func_get_args(), true)); |
3929 | 3929 | if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) { |
@@ -3943,10 +3943,10 @@ discard block |
||
3943 | 3943 | return false; |
3944 | 3944 | } else { |
3945 | 3945 | // modify field names to use sc. table reference |
3946 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3947 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3946 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3947 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3948 | 3948 | if ($where != '') { |
3949 | - $where = 'AND ' . $where; |
|
3949 | + $where = 'AND '.$where; |
|
3950 | 3950 | } |
3951 | 3951 | |
3952 | 3952 | $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; |
@@ -3957,14 +3957,14 @@ discard block |
||
3957 | 3957 | $docgrp = implode(',', $docgrp); |
3958 | 3958 | } |
3959 | 3959 | |
3960 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3960 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3961 | 3961 | |
3962 | 3962 | $tblsc = $this->getFullTableName('site_content'); |
3963 | 3963 | $tbldg = $this->getFullTableName('document_groups'); |
3964 | 3964 | |
3965 | 3965 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3966 | - LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', |
|
3967 | - $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", |
|
3966 | + LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',', |
|
3967 | + $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", |
|
3968 | 3968 | ($sort ? "{$sort} {$dir}" : ""), $limit); |
3969 | 3969 | |
3970 | 3970 | $resourceArray = $this->db->makeArray($result); |
@@ -4070,12 +4070,12 @@ discard block |
||
4070 | 4070 | $tbldg = $this->getFullTableName("document_groups"); |
4071 | 4071 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : ""; |
4072 | 4072 | // modify field names to use sc. table reference |
4073 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4073 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4074 | 4074 | // get document groups for current user |
4075 | 4075 | if ($docgrp = $this->getUserDocGroups()) { |
4076 | 4076 | $docgrp = implode(",", $docgrp); |
4077 | 4077 | } |
4078 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
4078 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
4079 | 4079 | $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", |
4080 | 4080 | "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); |
4081 | 4081 | $pageInfo = $this->db->getRow($result); |
@@ -4127,7 +4127,7 @@ discard block |
||
4127 | 4127 | { |
4128 | 4128 | if ($this->currentSnippet) { |
4129 | 4129 | $tbl = $this->getFullTableName("site_snippets"); |
4130 | - $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1); |
|
4130 | + $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1); |
|
4131 | 4131 | if ($snippetId = $this->db->getValue($rs)) { |
4132 | 4132 | return $snippetId; |
4133 | 4133 | } |
@@ -4155,23 +4155,23 @@ discard block |
||
4155 | 4155 | */ |
4156 | 4156 | public function clearCache($type = '', $report = false) |
4157 | 4157 | { |
4158 | - $cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
4158 | + $cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
4159 | 4159 | if (is_array($type)) { |
4160 | 4160 | foreach ($type as $_) { |
4161 | 4161 | $this->clearCache($_, $report); |
4162 | 4162 | } |
4163 | 4163 | } elseif ($type == 'full') { |
4164 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
4164 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
4165 | 4165 | $sync = new synccache(); |
4166 | 4166 | $sync->setCachepath($cache_dir); |
4167 | 4167 | $sync->setReport($report); |
4168 | 4168 | $sync->emptyCache(); |
4169 | 4169 | } elseif (preg_match('@^[1-9][0-9]*$@', $type)) { |
4170 | 4170 | $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type; |
4171 | - $file_name = "docid_" . $key . "_*.pageCache.php"; |
|
4172 | - $cache_path = $cache_dir . $file_name; |
|
4171 | + $file_name = "docid_".$key."_*.pageCache.php"; |
|
4172 | + $cache_path = $cache_dir.$file_name; |
|
4173 | 4173 | $files = glob($cache_path); |
4174 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php"; |
|
4174 | + $files[] = $cache_dir."docid_".$key.".pageCache.php"; |
|
4175 | 4175 | foreach ($files as $file) { |
4176 | 4176 | if (!is_file($file)) { |
4177 | 4177 | continue; |
@@ -4179,7 +4179,7 @@ discard block |
||
4179 | 4179 | unlink($file); |
4180 | 4180 | } |
4181 | 4181 | } else { |
4182 | - $files = glob($cache_dir . '*'); |
|
4182 | + $files = glob($cache_dir.'*'); |
|
4183 | 4183 | foreach ($files as $file) { |
4184 | 4184 | $name = basename($file); |
4185 | 4185 | if (strpos($name, '.pageCache.php') === false) { |
@@ -4248,7 +4248,7 @@ discard block |
||
4248 | 4248 | $f_url_suffix = '/'; |
4249 | 4249 | } |
4250 | 4250 | |
4251 | - $alPath = !empty ($al['path']) ? $al['path'] . '/' : ''; |
|
4251 | + $alPath = !empty ($al['path']) ? $al['path'].'/' : ''; |
|
4252 | 4252 | |
4253 | 4253 | if ($al && $al['alias']) { |
4254 | 4254 | $alias = $al['alias']; |
@@ -4256,7 +4256,7 @@ discard block |
||
4256 | 4256 | |
4257 | 4257 | } |
4258 | 4258 | |
4259 | - $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix; |
|
4259 | + $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix; |
|
4260 | 4260 | $url = "{$alias}{$args}"; |
4261 | 4261 | } else { |
4262 | 4262 | $url = "index.php?id={$id}{$args}"; |
@@ -4275,7 +4275,7 @@ discard block |
||
4275 | 4275 | } |
4276 | 4276 | |
4277 | 4277 | //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080) |
4278 | - $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host; |
|
4278 | + $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host; |
|
4279 | 4279 | } |
4280 | 4280 | |
4281 | 4281 | //fix strictUrl by Bumkaka |
@@ -4284,9 +4284,9 @@ discard block |
||
4284 | 4284 | } |
4285 | 4285 | |
4286 | 4286 | if ($this->config['xhtml_urls']) { |
4287 | - $url = preg_replace("/&(?!amp;)/", "&", $host . $virtualDir . $url); |
|
4287 | + $url = preg_replace("/&(?!amp;)/", "&", $host.$virtualDir.$url); |
|
4288 | 4288 | } else { |
4289 | - $url = $host . $virtualDir . $url; |
|
4289 | + $url = $host.$virtualDir.$url; |
|
4290 | 4290 | } |
4291 | 4291 | |
4292 | 4292 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -4310,21 +4310,21 @@ discard block |
||
4310 | 4310 | if (isset($this->aliasListing[$id])) { |
4311 | 4311 | $out = $this->aliasListing[$id]; |
4312 | 4312 | } else { |
4313 | - $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id); |
|
4313 | + $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id); |
|
4314 | 4314 | if ($this->db->getRecordCount($q) == '1') { |
4315 | 4315 | $q = $this->db->getRow($q); |
4316 | 4316 | $this->aliasListing[$id] = array( |
4317 | - 'id' => (int)$q['id'], |
|
4317 | + 'id' => (int) $q['id'], |
|
4318 | 4318 | 'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'], |
4319 | - 'parent' => (int)$q['parent'], |
|
4320 | - 'isfolder' => (int)$q['isfolder'], |
|
4319 | + 'parent' => (int) $q['parent'], |
|
4320 | + 'isfolder' => (int) $q['isfolder'], |
|
4321 | 4321 | ); |
4322 | 4322 | if ($this->aliasListing[$id]['parent'] > 0) { |
4323 | 4323 | //fix alias_path_usage |
4324 | 4324 | if ($this->config['use_alias_path'] == '1') { |
4325 | 4325 | //&& $tmp['path'] != '' - fix error slash with epty path |
4326 | 4326 | $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']); |
4327 | - $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : ''); |
|
4327 | + $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : ''); |
|
4328 | 4328 | } else { |
4329 | 4329 | $this->aliasListing[$id]['path'] = ''; |
4330 | 4330 | } |
@@ -4366,7 +4366,7 @@ discard block |
||
4366 | 4366 | $out = array(); |
4367 | 4367 | if (empty($this->version) || !is_array($this->version)) { |
4368 | 4368 | //include for compatibility modx version < 1.0.10 |
4369 | - include MODX_MANAGER_PATH . "includes/version.inc.php"; |
|
4369 | + include MODX_MANAGER_PATH."includes/version.inc.php"; |
|
4370 | 4370 | $this->version = array(); |
4371 | 4371 | $this->version['version'] = isset($modx_version) ? $modx_version : ''; |
4372 | 4372 | $this->version['branch'] = isset($modx_branch) ? $modx_branch : ''; |
@@ -4389,19 +4389,19 @@ discard block |
||
4389 | 4389 | { |
4390 | 4390 | if (isset ($this->snippetCache[$snippetName])) { |
4391 | 4391 | $snippet = $this->snippetCache[$snippetName]; |
4392 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
|
4392 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : ''; |
|
4393 | 4393 | } else { // not in cache so let's check the db |
4394 | - $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "' AND ss.disabled=0;"; |
|
4394 | + $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->db->escape($snippetName)."' AND ss.disabled=0;"; |
|
4395 | 4395 | $result = $this->db->query($sql); |
4396 | 4396 | if ($this->db->getRecordCount($result) == 1) { |
4397 | 4397 | $row = $this->db->getRow($result); |
4398 | 4398 | $snippet = $this->snippetCache[$snippetName] = $row['snippet']; |
4399 | 4399 | $mergedProperties = array_merge($this->parseProperties($row['properties']), |
4400 | 4400 | $this->parseProperties($row['sharedproperties'])); |
4401 | - $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties); |
|
4401 | + $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties); |
|
4402 | 4402 | } else { |
4403 | 4403 | $snippet = $this->snippetCache[$snippetName] = "return false;"; |
4404 | - $properties = $this->snippetCache[$snippetName . "Props"] = ''; |
|
4404 | + $properties = $this->snippetCache[$snippetName."Props"] = ''; |
|
4405 | 4405 | } |
4406 | 4406 | } |
4407 | 4407 | // load default params/properties |
@@ -4505,7 +4505,7 @@ discard block |
||
4505 | 4505 | if (strpos($tpl, $s) !== false) { |
4506 | 4506 | $tpl = str_replace($s, $value, $tpl); |
4507 | 4507 | } elseif ($this->debug) { |
4508 | - $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
4508 | + $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
4509 | 4509 | } |
4510 | 4510 | } |
4511 | 4511 | |
@@ -4554,7 +4554,7 @@ discard block |
||
4554 | 4554 | case 'CODE': |
4555 | 4555 | break; |
4556 | 4556 | case 'FILE': |
4557 | - $template = file_get_contents(MODX_BASE_PATH . $template); |
|
4557 | + $template = file_get_contents(MODX_BASE_PATH.$template); |
|
4558 | 4558 | break; |
4559 | 4559 | case 'CHUNK': |
4560 | 4560 | $template = $this->getChunk($template); |
@@ -4588,7 +4588,7 @@ discard block |
||
4588 | 4588 | if ($mode !== 'formatOnly' && empty($timestamp)) { |
4589 | 4589 | return '-'; |
4590 | 4590 | } |
4591 | - $timestamp = (int)$timestamp; |
|
4591 | + $timestamp = (int) $timestamp; |
|
4592 | 4592 | |
4593 | 4593 | switch ($this->config['datetime_format']) { |
4594 | 4594 | case 'YYYY/mm/dd': |
@@ -4608,7 +4608,7 @@ discard block |
||
4608 | 4608 | } |
4609 | 4609 | |
4610 | 4610 | if (empty($mode)) { |
4611 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp); |
|
4611 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp); |
|
4612 | 4612 | } elseif ($mode == 'dateOnly') { |
4613 | 4613 | $strTime = strftime($dateFormat, $timestamp); |
4614 | 4614 | } elseif ($mode == 'formatOnly') { |
@@ -4663,7 +4663,7 @@ discard block |
||
4663 | 4663 | $S = 0; |
4664 | 4664 | } |
4665 | 4665 | $timeStamp = mktime($H, $M, $S, $m, $d, $Y); |
4666 | - $timeStamp = (int)$timeStamp; |
|
4666 | + $timeStamp = (int) $timeStamp; |
|
4667 | 4667 | |
4668 | 4668 | return $timeStamp; |
4669 | 4669 | } |
@@ -4701,7 +4701,7 @@ discard block |
||
4701 | 4701 | $tvfields = "*", |
4702 | 4702 | $tvsort = "rank", |
4703 | 4703 | $tvsortdir = "ASC" |
4704 | - ) { |
|
4704 | + ){ |
|
4705 | 4705 | $docs = $this->getDocumentChildren($parentid, $published, 0, '*', '', $docsort, $docsortdir); |
4706 | 4706 | if (!$docs) { |
4707 | 4707 | return false; |
@@ -4714,7 +4714,7 @@ discard block |
||
4714 | 4714 | if ($v === 'value') { |
4715 | 4715 | unset($_[$i]); |
4716 | 4716 | } else { |
4717 | - $_[$i] = 'tv.' . $v; |
|
4717 | + $_[$i] = 'tv.'.$v; |
|
4718 | 4718 | } |
4719 | 4719 | } |
4720 | 4720 | $fields = implode(',', $_); |
@@ -4723,13 +4723,13 @@ discard block |
||
4723 | 4723 | } |
4724 | 4724 | |
4725 | 4725 | if ($tvsort != '') { |
4726 | - $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4726 | + $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4727 | 4727 | } |
4728 | 4728 | if ($tvidnames == "*") { |
4729 | 4729 | $query = "tv.id<>0"; |
4730 | 4730 | } else { |
4731 | - $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", |
|
4732 | - $tvidnames) . "')"; |
|
4731 | + $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", |
|
4732 | + $tvidnames)."')"; |
|
4733 | 4733 | } |
4734 | 4734 | |
4735 | 4735 | $this->getUserDocGroups(); |
@@ -4791,7 +4791,7 @@ discard block |
||
4791 | 4791 | $sortDir = 'ASC', |
4792 | 4792 | $where = '', |
4793 | 4793 | $resultKey = 'id' |
4794 | - ) { |
|
4794 | + ){ |
|
4795 | 4795 | $docs = $this->getDocumentChildren($parentid, $published, 0, 'id', $where, $sortBy, $sortDir); |
4796 | 4796 | |
4797 | 4797 | if (!$docs) { |
@@ -4886,7 +4886,7 @@ discard block |
||
4886 | 4886 | $published = 1, |
4887 | 4887 | $sort = 'rank', |
4888 | 4888 | $dir = 'ASC' |
4889 | - ) { |
|
4889 | + ){ |
|
4890 | 4890 | $cacheKey = md5(print_r(func_get_args(), true)); |
4891 | 4891 | if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) { |
4892 | 4892 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
@@ -4911,20 +4911,20 @@ discard block |
||
4911 | 4911 | } |
4912 | 4912 | |
4913 | 4913 | // get user defined template variables |
4914 | - $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', |
|
4914 | + $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', |
|
4915 | 4915 | array_filter(array_map('trim', explode(',', $fields)))); |
4916 | - $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4916 | + $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4917 | 4917 | |
4918 | 4918 | if ($idnames == '*') { |
4919 | 4919 | $query = 'tv.id<>0'; |
4920 | 4920 | } else { |
4921 | - $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; |
|
4921 | + $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; |
|
4922 | 4922 | } |
4923 | 4923 | |
4924 | 4924 | $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", |
4925 | - $this->getFullTableName('site_tmplvars') . " tv |
|
4926 | - INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
4927 | - LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", |
|
4925 | + $this->getFullTableName('site_tmplvars')." tv |
|
4926 | + INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id |
|
4927 | + LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", |
|
4928 | 4928 | "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : "")); |
4929 | 4929 | |
4930 | 4930 | $result = $this->db->makeArray($rs); |
@@ -4974,16 +4974,16 @@ discard block |
||
4974 | 4974 | $output = array(); |
4975 | 4975 | $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames); |
4976 | 4976 | |
4977 | - $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier; |
|
4977 | + $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier; |
|
4978 | 4978 | // remove sort for speed |
4979 | 4979 | $result = $this->getTemplateVars($vars, '*', $docid, $published, '', ''); |
4980 | 4980 | |
4981 | 4981 | if ($result == false) { |
4982 | 4982 | return false; |
4983 | 4983 | } else { |
4984 | - $baspath = MODX_MANAGER_PATH . 'includes'; |
|
4985 | - include_once $baspath . '/tmplvars.format.inc.php'; |
|
4986 | - include_once $baspath . '/tmplvars.commands.inc.php'; |
|
4984 | + $baspath = MODX_MANAGER_PATH.'includes'; |
|
4985 | + include_once $baspath.'/tmplvars.format.inc.php'; |
|
4986 | + include_once $baspath.'/tmplvars.commands.inc.php'; |
|
4987 | 4987 | |
4988 | 4988 | for ($i = 0; $i < count($result); $i++) { |
4989 | 4989 | $row = $result[$i]; |
@@ -5009,7 +5009,7 @@ discard block |
||
5009 | 5009 | */ |
5010 | 5010 | public function getFullTableName($tbl) |
5011 | 5011 | { |
5012 | - return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`"; |
|
5012 | + return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`"; |
|
5013 | 5013 | } |
5014 | 5014 | |
5015 | 5015 | /** |
@@ -5088,7 +5088,7 @@ discard block |
||
5088 | 5088 | public function getCachePath() |
5089 | 5089 | { |
5090 | 5090 | global $base_url; |
5091 | - $pth = $base_url . $this->getCacheFolder(); |
|
5091 | + $pth = $base_url.$this->getCacheFolder(); |
|
5092 | 5092 | |
5093 | 5093 | return $pth; |
5094 | 5094 | } |
@@ -5141,8 +5141,8 @@ discard block |
||
5141 | 5141 | $out = false; |
5142 | 5142 | |
5143 | 5143 | if (!empty($context)) { |
5144 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
5145 | - $out = $_SESSION[$context . 'InternalKey']; |
|
5144 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
5145 | + $out = $_SESSION[$context.'InternalKey']; |
|
5146 | 5146 | } |
5147 | 5147 | } else { |
5148 | 5148 | switch (true) { |
@@ -5171,8 +5171,8 @@ discard block |
||
5171 | 5171 | $out = false; |
5172 | 5172 | |
5173 | 5173 | if (!empty($context)) { |
5174 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
5175 | - $out = $_SESSION[$context . 'Shortname']; |
|
5174 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
5175 | + $out = $_SESSION[$context.'Shortname']; |
|
5176 | 5176 | } |
5177 | 5177 | } else { |
5178 | 5178 | switch (true) { |
@@ -5244,8 +5244,8 @@ discard block |
||
5244 | 5244 | */ |
5245 | 5245 | public function getWebUserInfo($uid) |
5246 | 5246 | { |
5247 | - $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu |
|
5248 | - INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", |
|
5247 | + $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu |
|
5248 | + INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", |
|
5249 | 5249 | "wu.id='{$uid}'"); |
5250 | 5250 | if ($row = $this->db->getRow($rs)) { |
5251 | 5251 | if (!isset($row['usertype']) or !$row["usertype"]) { |
@@ -5288,7 +5288,7 @@ discard block |
||
5288 | 5288 | // resolve ids to names |
5289 | 5289 | $dgn = array(); |
5290 | 5290 | $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), |
5291 | - "id IN (" . implode(",", $dg) . ")"); |
|
5291 | + "id IN (".implode(",", $dg).")"); |
|
5292 | 5292 | while ($row = $this->db->getRow($ds)) { |
5293 | 5293 | $dgn[] = $row['name']; |
5294 | 5294 | } |
@@ -5319,7 +5319,7 @@ discard block |
||
5319 | 5319 | $rt = false; |
5320 | 5320 | if ($_SESSION["webValidated"] == 1) { |
5321 | 5321 | $tbl = $this->getFullTableName("web_users"); |
5322 | - $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5322 | + $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); |
|
5323 | 5323 | if ($row = $this->db->getRow($ds)) { |
5324 | 5324 | if ($row["password"] == md5($oldPwd)) { |
5325 | 5325 | if (strlen($newPwd) < 6) { |
@@ -5329,7 +5329,7 @@ discard block |
||
5329 | 5329 | } else { |
5330 | 5330 | $this->db->update(array( |
5331 | 5331 | 'password' => $this->db->escape($newPwd), |
5332 | - ), $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5332 | + ), $tbl, "id='".$this->getLoginUserID()."'"); |
|
5333 | 5333 | // invoke OnWebChangePassword event |
5334 | 5334 | $this->invokeEvent("OnWebChangePassword", array( |
5335 | 5335 | "userid" => $row["id"], |
@@ -5362,8 +5362,8 @@ discard block |
||
5362 | 5362 | // check cache |
5363 | 5363 | $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false; |
5364 | 5364 | if (!is_array($grpNames)) { |
5365 | - $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn |
|
5366 | - INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'"); |
|
5365 | + $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn |
|
5366 | + INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'"); |
|
5367 | 5367 | $grpNames = $this->db->getColumn("name", $rs); |
5368 | 5368 | // save to cache |
5369 | 5369 | $_SESSION['webUserGroupNames'] = $grpNames; |
@@ -5397,7 +5397,7 @@ discard block |
||
5397 | 5397 | if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { |
5398 | 5398 | $this->sjscripts[$nextpos] = $src; |
5399 | 5399 | } else { |
5400 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>'; |
|
5400 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>'; |
|
5401 | 5401 | } |
5402 | 5402 | } |
5403 | 5403 | |
@@ -5424,7 +5424,7 @@ discard block |
||
5424 | 5424 | $src, |
5425 | 5425 | $options = array('name' => '', 'version' => '0', 'plaintext' => false), |
5426 | 5426 | $startup = false |
5427 | - ) { |
|
5427 | + ){ |
|
5428 | 5428 | if (empty($src)) { |
5429 | 5429 | return ''; |
5430 | 5430 | } // nothing to register |
@@ -5479,7 +5479,7 @@ discard block |
||
5479 | 5479 | } |
5480 | 5480 | |
5481 | 5481 | if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { |
5482 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>'; |
|
5482 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>'; |
|
5483 | 5483 | } |
5484 | 5484 | if ($startup) { |
5485 | 5485 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1; |
@@ -5630,7 +5630,7 @@ discard block |
||
5630 | 5630 | $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, |
5631 | 5631 | $pluginName, $eventtime * 1000); |
5632 | 5632 | foreach ($parameter as $k => $v) { |
5633 | - $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; |
|
5633 | + $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; |
|
5634 | 5634 | } |
5635 | 5635 | $this->pluginsCode .= '</fieldset><br />'; |
5636 | 5636 | $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; |
@@ -5659,14 +5659,14 @@ discard block |
||
5659 | 5659 | $plugin = array(); |
5660 | 5660 | if (isset ($this->pluginCache[$pluginName])) { |
5661 | 5661 | $pluginCode = $this->pluginCache[$pluginName]; |
5662 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : ''; |
|
5662 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : ''; |
|
5663 | 5663 | } else { |
5664 | 5664 | $pluginName = $this->db->escape($pluginName); |
5665 | 5665 | $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), |
5666 | 5666 | "name='{$pluginName}' AND disabled=0"); |
5667 | 5667 | if ($row = $this->db->getRow($result)) { |
5668 | 5668 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode']; |
5669 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties']; |
|
5669 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties']; |
|
5670 | 5670 | } else { |
5671 | 5671 | $pluginCode = $this->pluginCache[$pluginName] = "return false;"; |
5672 | 5672 | $pluginProperties = ''; |
@@ -5776,7 +5776,7 @@ discard block |
||
5776 | 5776 | public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) |
5777 | 5777 | { |
5778 | 5778 | $params = array(); |
5779 | - $fullpath = $element_dir . '/' . $filename; |
|
5779 | + $fullpath = $element_dir.'/'.$filename; |
|
5780 | 5780 | if (is_readable($fullpath)) { |
5781 | 5781 | $tpl = @fopen($fullpath, "r"); |
5782 | 5782 | if ($tpl) { |
@@ -5888,7 +5888,7 @@ discard block |
||
5888 | 5888 | $name_found, |
5889 | 5889 | $description_found, |
5890 | 5890 | $docblock_end_found |
5891 | - ) { |
|
5891 | + ){ |
|
5892 | 5892 | $param = ''; |
5893 | 5893 | $val = ''; |
5894 | 5894 | $ma = null; |
@@ -5953,8 +5953,8 @@ discard block |
||
5953 | 5953 | $ph = array('site_url' => MODX_SITE_URL); |
5954 | 5954 | $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/"; |
5955 | 5955 | $regexEmail = '#([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)#i'; |
5956 | - $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : ''; |
|
5957 | - $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : ''; |
|
5956 | + $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : ''; |
|
5957 | + $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : ''; |
|
5958 | 5958 | foreach ($parsed as $key => $val) { |
5959 | 5959 | if (is_array($val)) { |
5960 | 5960 | foreach ($val as $key2 => $val2) { |
@@ -5964,7 +5964,7 @@ discard block |
||
5964 | 5964 | $val2); |
5965 | 5965 | } |
5966 | 5966 | if (preg_match($regexEmail, $val2, $url)) { |
5967 | - $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2); |
|
5967 | + $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2); |
|
5968 | 5968 | } |
5969 | 5969 | $parsed[$key][$key2] = $val2; |
5970 | 5970 | } |
@@ -5974,7 +5974,7 @@ discard block |
||
5974 | 5974 | $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val); |
5975 | 5975 | } |
5976 | 5976 | if (preg_match($regexEmail, $val, $url)) { |
5977 | - $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val); |
|
5977 | + $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val); |
|
5978 | 5978 | } |
5979 | 5979 | $parsed[$key] = $val; |
5980 | 5980 | } |
@@ -5988,33 +5988,33 @@ discard block |
||
5988 | 5988 | ); |
5989 | 5989 | |
5990 | 5990 | $nl = "\n"; |
5991 | - $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], |
|
5992 | - "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : ''; |
|
5993 | - $list .= '<p>' . $nl; |
|
5994 | - $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : ''; |
|
5995 | - $list .= isset($parsed['description']) ? $parsed['description'] . $nl : ''; |
|
5996 | - $list .= '</p><br/>' . $nl; |
|
5997 | - $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : ''; |
|
5998 | - $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : ''; |
|
5999 | - $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : ''; |
|
6000 | - $list .= '<br/>' . $nl; |
|
5991 | + $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], |
|
5992 | + "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : ''; |
|
5993 | + $list .= '<p>'.$nl; |
|
5994 | + $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : ''; |
|
5995 | + $list .= isset($parsed['description']) ? $parsed['description'].$nl : ''; |
|
5996 | + $list .= '</p><br/>'.$nl; |
|
5997 | + $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : ''; |
|
5998 | + $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : ''; |
|
5999 | + $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : ''; |
|
6000 | + $list .= '<br/>'.$nl; |
|
6001 | 6001 | $first = true; |
6002 | 6002 | foreach ($arrayParams as $param => $label) { |
6003 | 6003 | if (isset($parsed[$param])) { |
6004 | 6004 | if ($first) { |
6005 | - $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl; |
|
6006 | - $list .= '<ul class="docBlockList">' . $nl; |
|
6005 | + $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl; |
|
6006 | + $list .= '<ul class="docBlockList">'.$nl; |
|
6007 | 6007 | $first = false; |
6008 | 6008 | } |
6009 | - $list .= ' <li><strong>' . $label . '</strong>' . $nl; |
|
6010 | - $list .= ' <ul>' . $nl; |
|
6009 | + $list .= ' <li><strong>'.$label.'</strong>'.$nl; |
|
6010 | + $list .= ' <ul>'.$nl; |
|
6011 | 6011 | foreach ($parsed[$param] as $val) { |
6012 | - $list .= ' <li>' . $val . '</li>' . $nl; |
|
6012 | + $list .= ' <li>'.$val.'</li>'.$nl; |
|
6013 | 6013 | } |
6014 | - $list .= ' </ul></li>' . $nl; |
|
6014 | + $list .= ' </ul></li>'.$nl; |
|
6015 | 6015 | } |
6016 | 6016 | } |
6017 | - $list .= !$first ? '</ul>' . $nl : ''; |
|
6017 | + $list .= !$first ? '</ul>'.$nl : ''; |
|
6018 | 6018 | |
6019 | 6019 | return $list; |
6020 | 6020 | } |
@@ -6092,7 +6092,7 @@ discard block |
||
6092 | 6092 | */ |
6093 | 6093 | public function addSnippet($name, $phpCode) |
6094 | 6094 | { |
6095 | - $this->snippetCache['#' . $name] = $phpCode; |
|
6095 | + $this->snippetCache['#'.$name] = $phpCode; |
|
6096 | 6096 | } |
6097 | 6097 | |
6098 | 6098 | /** |
@@ -6101,7 +6101,7 @@ discard block |
||
6101 | 6101 | */ |
6102 | 6102 | public function addChunk($name, $text) |
6103 | 6103 | { |
6104 | - $this->chunkCache['#' . $name] = $text; |
|
6104 | + $this->chunkCache['#'.$name] = $text; |
|
6105 | 6105 | } |
6106 | 6106 | |
6107 | 6107 | /** |
@@ -6137,7 +6137,7 @@ discard block |
||
6137 | 6137 | } |
6138 | 6138 | |
6139 | 6139 | if (!$isSafe) { |
6140 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true); |
|
6140 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true); |
|
6141 | 6141 | $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50))); |
6142 | 6142 | $this->messageQuit($title, '', true, '', '', 'Parser', $msg); |
6143 | 6143 | |
@@ -6152,7 +6152,7 @@ discard block |
||
6152 | 6152 | return 'array()'; |
6153 | 6153 | } |
6154 | 6154 | |
6155 | - $output = $echo . $return; |
|
6155 | + $output = $echo.$return; |
|
6156 | 6156 | modx_sanitize_gpc($output); |
6157 | 6157 | |
6158 | 6158 | return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous |
@@ -6171,8 +6171,8 @@ discard block |
||
6171 | 6171 | |
6172 | 6172 | $safe = explode(',', $safe_functions); |
6173 | 6173 | |
6174 | - $phpcode = rtrim($phpcode, ';') . ';'; |
|
6175 | - $tokens = token_get_all('<?php ' . $phpcode); |
|
6174 | + $phpcode = rtrim($phpcode, ';').';'; |
|
6175 | + $tokens = token_get_all('<?php '.$phpcode); |
|
6176 | 6176 | foreach ($tokens as $i => $token) { |
6177 | 6177 | if (!is_array($token)) { |
6178 | 6178 | continue; |
@@ -6213,7 +6213,7 @@ discard block |
||
6213 | 6213 | 'assets/tvs/', |
6214 | 6214 | 'assets/chunks/', |
6215 | 6215 | 'assets/templates/', |
6216 | - $this->config['rb_base_url'] . 'files/', |
|
6216 | + $this->config['rb_base_url'].'files/', |
|
6217 | 6217 | '' |
6218 | 6218 | ); |
6219 | 6219 | |
@@ -6238,7 +6238,7 @@ discard block |
||
6238 | 6238 | $errorMsg = sprintf("Could not retrieve string '%s'.", $str); |
6239 | 6239 | |
6240 | 6240 | foreach ($search_path as $path) { |
6241 | - $file_path = MODX_BASE_PATH . $path . $str; |
|
6241 | + $file_path = MODX_BASE_PATH.$path.$str; |
|
6242 | 6242 | if (strpos($file_path, MODX_MANAGER_PATH) === 0) { |
6243 | 6243 | return $errorMsg; |
6244 | 6244 | } elseif (is_file($file_path)) { |
@@ -6252,7 +6252,7 @@ discard block |
||
6252 | 6252 | return $errorMsg; |
6253 | 6253 | } |
6254 | 6254 | |
6255 | - $content = (string)file_get_contents($file_path); |
|
6255 | + $content = (string) file_get_contents($file_path); |
|
6256 | 6256 | if ($content === false) { |
6257 | 6257 | return $errorMsg; |
6258 | 6258 | } |
@@ -6354,7 +6354,7 @@ discard block |
||
6354 | 6354 | $text = '', |
6355 | 6355 | $line = '', |
6356 | 6356 | $output = '' |
6357 | - ) { |
|
6357 | + ){ |
|
6358 | 6358 | |
6359 | 6359 | if (0 < $this->messageQuitCount) { |
6360 | 6360 | return; |
@@ -6374,22 +6374,22 @@ discard block |
||
6374 | 6374 | |
6375 | 6375 | $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : ''; |
6376 | 6376 | $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : ''; |
6377 | - $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; |
|
6377 | + $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; |
|
6378 | 6378 | $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']); |
6379 | 6379 | $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']); |
6380 | 6380 | $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']); |
6381 | 6381 | if ($is_error) { |
6382 | 6382 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>'; |
6383 | 6383 | if ($msg != 'PHP Parse Error') { |
6384 | - $str .= '<h3 style="color:red">' . $msg . '</h3>'; |
|
6384 | + $str .= '<h3 style="color:red">'.$msg.'</h3>'; |
|
6385 | 6385 | } |
6386 | 6386 | } else { |
6387 | 6387 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>'; |
6388 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>'; |
|
6388 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>'; |
|
6389 | 6389 | } |
6390 | 6390 | |
6391 | 6391 | if (!empty ($query)) { |
6392 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">' . $query . '</span></div>'; |
|
6392 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">'.$query.'</span></div>'; |
|
6393 | 6393 | } |
6394 | 6394 | |
6395 | 6395 | $errortype = array( |
@@ -6412,13 +6412,13 @@ discard block |
||
6412 | 6412 | |
6413 | 6413 | if (!empty($nr) || !empty($file)) { |
6414 | 6414 | if ($text != '') { |
6415 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>'; |
|
6415 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>'; |
|
6416 | 6416 | } |
6417 | 6417 | if ($output != '') { |
6418 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>'; |
|
6418 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>'; |
|
6419 | 6419 | } |
6420 | 6420 | if ($nr !== '') { |
6421 | - $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); |
|
6421 | + $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); |
|
6422 | 6422 | } |
6423 | 6423 | if ($file) { |
6424 | 6424 | $table[] = array('File', $file); |
@@ -6438,7 +6438,7 @@ discard block |
||
6438 | 6438 | } |
6439 | 6439 | |
6440 | 6440 | if (!empty($this->event->activePlugin)) { |
6441 | - $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); |
|
6441 | + $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); |
|
6442 | 6442 | } |
6443 | 6443 | |
6444 | 6444 | $str .= $MakeTable->create($table, array('Error information', '')); |
@@ -6448,11 +6448,11 @@ discard block |
||
6448 | 6448 | $table[] = array('REQUEST_URI', $request_uri); |
6449 | 6449 | |
6450 | 6450 | if ($this->manager->action) { |
6451 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
6451 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
6452 | 6452 | global $action_list; |
6453 | 6453 | $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : ''; |
6454 | 6454 | |
6455 | - $table[] = array('Manager action', $this->manager->action . $actionName); |
|
6455 | + $table[] = array('Manager action', $this->manager->action.$actionName); |
|
6456 | 6456 | } |
6457 | 6457 | |
6458 | 6458 | if (preg_match('@^[0-9]+@', $this->documentIdentifier)) { |
@@ -6460,7 +6460,7 @@ discard block |
||
6460 | 6460 | $url = $this->makeUrl($this->documentIdentifier, '', '', 'full'); |
6461 | 6461 | $table[] = array( |
6462 | 6462 | 'Resource', |
6463 | - '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>' |
|
6463 | + '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>' |
|
6464 | 6464 | ); |
6465 | 6465 | } |
6466 | 6466 | $table[] = array('Referer', $referer); |
@@ -6485,7 +6485,7 @@ discard block |
||
6485 | 6485 | |
6486 | 6486 | $mem = memory_get_peak_usage(true); |
6487 | 6487 | $total_mem = $mem - $this->mstart; |
6488 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb'; |
|
6488 | + $total_mem = ($total_mem / 1024 / 1024).' mb'; |
|
6489 | 6489 | |
6490 | 6490 | $queryTime = $this->queryTime; |
6491 | 6491 | $phpTime = $totalTime - $queryTime; |
@@ -6506,18 +6506,18 @@ discard block |
||
6506 | 6506 | $str .= $this->get_backtrace(debug_backtrace()); |
6507 | 6507 | // Log error |
6508 | 6508 | if (!empty($this->currentSnippet)) { |
6509 | - $source = 'Snippet - ' . $this->currentSnippet; |
|
6509 | + $source = 'Snippet - '.$this->currentSnippet; |
|
6510 | 6510 | } elseif (!empty($this->event->activePlugin)) { |
6511 | - $source = 'Plugin - ' . $this->event->activePlugin; |
|
6511 | + $source = 'Plugin - '.$this->event->activePlugin; |
|
6512 | 6512 | } elseif ($source !== '') { |
6513 | - $source = 'Parser - ' . $source; |
|
6513 | + $source = 'Parser - '.$source; |
|
6514 | 6514 | } elseif ($query !== '') { |
6515 | 6515 | $source = 'SQL Query'; |
6516 | 6516 | } else { |
6517 | 6517 | $source = 'Parser'; |
6518 | 6518 | } |
6519 | 6519 | if ($msg) { |
6520 | - $source .= ' / ' . $msg; |
|
6520 | + $source .= ' / '.$msg; |
|
6521 | 6521 | } |
6522 | 6522 | if (isset($actionName) && !empty($actionName)) { |
6523 | 6523 | $source .= $actionName; |
@@ -6549,12 +6549,12 @@ discard block |
||
6549 | 6549 | |
6550 | 6550 | // Display error |
6551 | 6551 | if (isset($_SESSION['mgrValidated'])) { |
6552 | - echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager ' . $version . ' » ' . $release_date . '</title> |
|
6552 | + echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager '.$version.' » '.$release_date.'</title> |
|
6553 | 6553 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
6554 | - <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" /> |
|
6554 | + <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" /> |
|
6555 | 6555 | <style type="text/css">body { padding:10px; } td {font:inherit;}</style> |
6556 | 6556 | </head><body> |
6557 | - ' . $str . '</body></html>'; |
|
6557 | + ' . $str.'</body></html>'; |
|
6558 | 6558 | |
6559 | 6559 | } else { |
6560 | 6560 | echo 'Error'; |
@@ -6592,7 +6592,7 @@ discard block |
||
6592 | 6592 | switch ($val['type']) { |
6593 | 6593 | case '->': |
6594 | 6594 | case '::': |
6595 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function']; |
|
6595 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function']; |
|
6596 | 6596 | break; |
6597 | 6597 | default: |
6598 | 6598 | $functionName = $val['function']; |
@@ -6602,7 +6602,7 @@ discard block |
||
6602 | 6602 | $args = array_pad(array(), $_, '$var'); |
6603 | 6603 | $args = implode(", ", $args); |
6604 | 6604 | $modx = &$this; |
6605 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6605 | + $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { |
|
6606 | 6606 | $arg = $val['args'][$tmp - 1]; |
6607 | 6607 | switch (true) { |
6608 | 6608 | case is_null($arg): { |
@@ -6614,8 +6614,8 @@ discard block |
||
6614 | 6614 | break; |
6615 | 6615 | } |
6616 | 6616 | case is_scalar($arg): { |
6617 | - $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", |
|
6618 | - "\\'", $arg)) . "'"); |
|
6617 | + $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", |
|
6618 | + "\\'", $arg))."'"); |
|
6619 | 6619 | break; |
6620 | 6620 | } |
6621 | 6621 | case is_bool($arg): { |
@@ -6623,15 +6623,15 @@ discard block |
||
6623 | 6623 | break; |
6624 | 6624 | } |
6625 | 6625 | case is_array($arg): { |
6626 | - $out = 'array $var' . $tmp; |
|
6626 | + $out = 'array $var'.$tmp; |
|
6627 | 6627 | break; |
6628 | 6628 | } |
6629 | 6629 | case is_object($arg): { |
6630 | - $out = get_class($arg) . ' $var' . $tmp; |
|
6630 | + $out = get_class($arg).' $var'.$tmp; |
|
6631 | 6631 | break; |
6632 | 6632 | } |
6633 | 6633 | default: { |
6634 | - $out = '$var' . $tmp; |
|
6634 | + $out = '$var'.$tmp; |
|
6635 | 6635 | } |
6636 | 6636 | } |
6637 | 6637 | $tmp++; |
@@ -6639,8 +6639,8 @@ discard block |
||
6639 | 6639 | return $out; |
6640 | 6640 | }, $args); |
6641 | 6641 | $line = array( |
6642 | - "<strong>" . $functionName . "</strong>(" . $args . ")", |
|
6643 | - $path . " on line " . $val['line'] |
|
6642 | + "<strong>".$functionName."</strong>(".$args.")", |
|
6643 | + $path." on line ".$val['line'] |
|
6644 | 6644 | ); |
6645 | 6645 | $table[] = array(implode("<br />", $line)); |
6646 | 6646 | } |
@@ -6682,7 +6682,7 @@ discard block |
||
6682 | 6682 | $alias = strip_tags($alias); // strip HTML |
6683 | 6683 | $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters |
6684 | 6684 | $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash |
6685 | - $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6685 | + $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6686 | 6686 | $alias = trim($alias, '-'); // trim excess |
6687 | 6687 | |
6688 | 6688 | return $alias; |
@@ -6699,7 +6699,7 @@ discard block |
||
6699 | 6699 | $precisions = count($sizes) - 1; |
6700 | 6700 | foreach ($sizes as $unit => $bytes) { |
6701 | 6701 | if ($size >= $bytes) { |
6702 | - return number_format($size / $bytes, $precisions) . ' ' . $unit; |
|
6702 | + return number_format($size / $bytes, $precisions).' '.$unit; |
|
6703 | 6703 | } |
6704 | 6704 | $precisions--; |
6705 | 6705 | } |
@@ -6805,10 +6805,10 @@ discard block |
||
6805 | 6805 | |
6806 | 6806 | if (strpos($str, MODX_MANAGER_PATH) === 0) { |
6807 | 6807 | return false; |
6808 | - } elseif (is_file(MODX_BASE_PATH . $str)) { |
|
6809 | - $file_path = MODX_BASE_PATH . $str; |
|
6810 | - } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { |
|
6811 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str; |
|
6808 | + } elseif (is_file(MODX_BASE_PATH.$str)) { |
|
6809 | + $file_path = MODX_BASE_PATH.$str; |
|
6810 | + } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { |
|
6811 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str; |
|
6812 | 6812 | } else { |
6813 | 6813 | return false; |
6814 | 6814 | } |
@@ -6938,7 +6938,7 @@ discard block |
||
6938 | 6938 | $title = 'no title'; |
6939 | 6939 | } |
6940 | 6940 | if (is_array($msg)) { |
6941 | - $msg = '<pre>' . print_r($msg, true) . '</pre>'; |
|
6941 | + $msg = '<pre>'.print_r($msg, true).'</pre>'; |
|
6942 | 6942 | } elseif ($msg === '') { |
6943 | 6943 | $msg = $_SERVER['REQUEST_URI']; |
6944 | 6944 | } |
@@ -6983,7 +6983,7 @@ discard block |
||
6983 | 6983 | if (is_array($SystemAlertMsgQueque)) { |
6984 | 6984 | $title = ''; |
6985 | 6985 | if ($this->name && $this->activePlugin) { |
6986 | - $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
|
6986 | + $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>"; |
|
6987 | 6987 | } |
6988 | 6988 | $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
6989 | 6989 | } |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | */ |
132 | 132 | function ProcessFile($file) { |
133 | 133 | // get the file |
134 | - $buffer = @file_get_contents($file); |
|
135 | - if ($buffer === false) $buffer = " Could not retrieve document '$file'."; |
|
134 | + $buffer = @file_get_contents($file); |
|
135 | + if ($buffer === false) $buffer = " Could not retrieve document '$file'."; |
|
136 | 136 | return $buffer; |
137 | 137 | } |
138 | 138 | |
@@ -168,20 +168,20 @@ discard block |
||
168 | 168 | function parseTvValues($param, $tvsArray) |
169 | 169 | { |
170 | 170 | $modx = evolutionCMS(); |
171 | - $tvsArray = is_array($modx->documentObject) ? array_merge($tvsArray, $modx->documentObject) : $tvsArray; |
|
172 | - if (strpos($param, '[*') !== false) { |
|
173 | - $matches = $modx->getTagsFromContent($param, '[*', '*]'); |
|
174 | - foreach ($matches[0] as $i=>$match) { |
|
175 | - if(isset($tvsArray[ $matches[1][$i] ])) { |
|
176 | - if(is_array($tvsArray[ $matches[1][$i] ])) { |
|
177 | - $value = $tvsArray[$matches[1][$i]]['value']; |
|
178 | - $value = $value === '' ? $tvsArray[$matches[1][$i]]['default_text'] : $value; |
|
179 | - } else { |
|
180 | - $value = $tvsArray[ $matches[1][$i] ]; |
|
181 | - } |
|
182 | - $param = str_replace($match, $value, $param); |
|
183 | - } |
|
184 | - } |
|
185 | - } |
|
186 | - return $param; |
|
171 | + $tvsArray = is_array($modx->documentObject) ? array_merge($tvsArray, $modx->documentObject) : $tvsArray; |
|
172 | + if (strpos($param, '[*') !== false) { |
|
173 | + $matches = $modx->getTagsFromContent($param, '[*', '*]'); |
|
174 | + foreach ($matches[0] as $i=>$match) { |
|
175 | + if(isset($tvsArray[ $matches[1][$i] ])) { |
|
176 | + if(is_array($tvsArray[ $matches[1][$i] ])) { |
|
177 | + $value = $tvsArray[$matches[1][$i]]['value']; |
|
178 | + $value = $value === '' ? $tvsArray[$matches[1][$i]]['default_text'] : $value; |
|
179 | + } else { |
|
180 | + $value = $tvsArray[ $matches[1][$i] ]; |
|
181 | + } |
|
182 | + $param = str_replace($match, $value, $param); |
|
183 | + } |
|
184 | + } |
|
185 | + } |
|
186 | + return $param; |
|
187 | 187 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * Created by Raymond Irving Feb, 2005 |
5 | 5 | */ |
6 | 6 | global $BINDINGS; // Array of supported bindings. must be upper case |
7 | -$BINDINGS = array ( |
|
7 | +$BINDINGS = array( |
|
8 | 8 | 'FILE', |
9 | 9 | 'CHUNK', |
10 | 10 | 'DOCUMENT', |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | * @param array $tvsArray |
23 | 23 | * @return string |
24 | 24 | */ |
25 | -function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) { |
|
25 | +function ProcessTVCommand($value, $name = '', $docid = '', $src = 'docform', $tvsArray = array()){ |
|
26 | 26 | $modx = evolutionCMS(); |
27 | - $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
27 | + $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier; |
|
28 | 28 | $nvalue = trim($value); |
29 | 29 | if (substr($nvalue, 0, 1) != '@') |
30 | 30 | return $value; |
31 | - elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
31 | + elseif (isset($modx->config['enable_bindings']) && $modx->config['enable_bindings'] != 1 && $src === 'docform') { |
|
32 | 32 | return '@Bindings is disabled.'; |
33 | 33 | } |
34 | 34 | else { |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | break; |
55 | 55 | |
56 | 56 | case "SELECT" : // selects a record from the cms database |
57 | - $rt = array (); |
|
58 | - $replacementVars = array ( |
|
57 | + $rt = array(); |
|
58 | + $replacementVars = array( |
|
59 | 59 | 'DBASE' => $modx->db->config['dbase'], |
60 | 60 | 'PREFIX' => $modx->db->config['table_prefix'] |
61 | 61 | ); |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | break; |
97 | 97 | |
98 | 98 | case 'DIRECTORY' : |
99 | - $files = array (); |
|
100 | - $path = $modx->config['base_path'] . $param; |
|
99 | + $files = array(); |
|
100 | + $path = $modx->config['base_path'].$param; |
|
101 | 101 | if (substr($path, -1, 1) != '/') { |
102 | 102 | $path .= '/'; |
103 | 103 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @param $file |
130 | 130 | * @return string |
131 | 131 | */ |
132 | -function ProcessFile($file) { |
|
132 | +function ProcessFile($file){ |
|
133 | 133 | // get the file |
134 | 134 | $buffer = @file_get_contents($file); |
135 | 135 | if ($buffer === false) $buffer = " Could not retrieve document '$file'."; |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | { |
147 | 147 | global $BINDINGS; |
148 | 148 | $binding_array = array(); |
149 | - foreach($BINDINGS as $cmd) |
|
149 | + foreach ($BINDINGS as $cmd) |
|
150 | 150 | { |
151 | - if(strpos($binding_string,'@'.$cmd)===0) |
|
151 | + if (strpos($binding_string, '@'.$cmd) === 0) |
|
152 | 152 | { |
153 | - $code = substr($binding_string,strlen($cmd)+1); |
|
154 | - $binding_array = array($cmd,trim($code)); |
|
153 | + $code = substr($binding_string, strlen($cmd) + 1); |
|
154 | + $binding_array = array($cmd, trim($code)); |
|
155 | 155 | break; |
156 | 156 | } |
157 | 157 | } |
@@ -172,12 +172,12 @@ discard block |
||
172 | 172 | if (strpos($param, '[*') !== false) { |
173 | 173 | $matches = $modx->getTagsFromContent($param, '[*', '*]'); |
174 | 174 | foreach ($matches[0] as $i=>$match) { |
175 | - if(isset($tvsArray[ $matches[1][$i] ])) { |
|
176 | - if(is_array($tvsArray[ $matches[1][$i] ])) { |
|
175 | + if (isset($tvsArray[$matches[1][$i]])) { |
|
176 | + if (is_array($tvsArray[$matches[1][$i]])) { |
|
177 | 177 | $value = $tvsArray[$matches[1][$i]]['value']; |
178 | 178 | $value = $value === '' ? $tvsArray[$matches[1][$i]]['default_text'] : $value; |
179 | 179 | } else { |
180 | - $value = $tvsArray[ $matches[1][$i] ]; |
|
180 | + $value = $tvsArray[$matches[1][$i]]; |
|
181 | 181 | } |
182 | 182 | $param = str_replace($match, $value, $param); |
183 | 183 | } |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | * @param array $tvsArray |
23 | 23 | * @return string |
24 | 24 | */ |
25 | -function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) { |
|
25 | +function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) |
|
26 | +{ |
|
26 | 27 | $modx = evolutionCMS(); |
27 | 28 | $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
28 | 29 | $nvalue = trim($value); |
29 | - if (substr($nvalue, 0, 1) != '@') |
|
30 | - return $value; |
|
31 | - elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
30 | + if (substr($nvalue, 0, 1) != '@') { |
|
31 | + return $value; |
|
32 | + } elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
32 | 33 | return '@Bindings is disabled.'; |
33 | - } |
|
34 | - else { |
|
34 | + } else { |
|
35 | 35 | list ($cmd, $param) = ParseCommand($nvalue); |
36 | 36 | $cmd = trim($cmd); |
37 | 37 | $param = parseTvValues($param, $tvsArray); |
@@ -47,10 +47,11 @@ discard block |
||
47 | 47 | |
48 | 48 | case "DOCUMENT" : // retrieve a document and process it's content |
49 | 49 | $rs = $modx->getDocument($param); |
50 | - if (is_array($rs)) |
|
51 | - $output = $rs['content']; |
|
52 | - else |
|
53 | - $output = "Unable to locate document $param"; |
|
50 | + if (is_array($rs)) { |
|
51 | + $output = $rs['content']; |
|
52 | + } else { |
|
53 | + $output = "Unable to locate document $param"; |
|
54 | + } |
|
54 | 55 | break; |
55 | 56 | |
56 | 57 | case "SELECT" : // selects a record from the cms database |
@@ -80,8 +81,10 @@ discard block |
||
80 | 81 | |
81 | 82 | // Grab document regardless of publish status |
82 | 83 | $doc = $modx->getPageInfo($parent_id, 0, 'id,parent,published'); |
83 | - if ($doc['parent'] != 0 && !$doc['published']) |
|
84 | - continue; // hide unpublished docs if we're not at the top |
|
84 | + if ($doc['parent'] != 0 && !$doc['published']) { |
|
85 | + continue; |
|
86 | + } |
|
87 | + // hide unpublished docs if we're not at the top |
|
85 | 88 | |
86 | 89 | $tv = $modx->getTemplateVar($name, '*', $doc['id'], $doc['published']); |
87 | 90 | |
@@ -129,10 +132,13 @@ discard block |
||
129 | 132 | * @param $file |
130 | 133 | * @return string |
131 | 134 | */ |
132 | -function ProcessFile($file) { |
|
135 | +function ProcessFile($file) |
|
136 | +{ |
|
133 | 137 | // get the file |
134 | 138 | $buffer = @file_get_contents($file); |
135 | - if ($buffer === false) $buffer = " Could not retrieve document '$file'."; |
|
139 | + if ($buffer === false) { |
|
140 | + $buffer = " Could not retrieve document '$file'."; |
|
141 | + } |
|
136 | 142 | return $buffer; |
137 | 143 | } |
138 | 144 | |
@@ -146,10 +152,8 @@ discard block |
||
146 | 152 | { |
147 | 153 | global $BINDINGS; |
148 | 154 | $binding_array = array(); |
149 | - foreach($BINDINGS as $cmd) |
|
150 | - { |
|
151 | - if(strpos($binding_string,'@'.$cmd)===0) |
|
152 | - { |
|
155 | + foreach($BINDINGS as $cmd) { |
|
156 | + if(strpos($binding_string,'@'.$cmd)===0) { |
|
153 | 157 | $code = substr($binding_string,strlen($cmd)+1); |
154 | 158 | $binding_array = array($cmd,trim($code)); |
155 | 159 | break; |
@@ -10,178 +10,178 @@ |
||
10 | 10 | Class TemplateParser { |
11 | 11 | |
12 | 12 | /** |
13 | - * @param array $config [action, tabs, toArray] |
|
14 | - * @param array $data |
|
15 | - * @return string |
|
16 | - */ |
|
17 | - public function output($config = array(), $data = array()) { |
|
13 | + * @param array $config [action, tabs, toArray] |
|
14 | + * @param array $data |
|
15 | + * @return string |
|
16 | + */ |
|
17 | + public function output($config = array(), $data = array()) { |
|
18 | 18 | $modx = evolutionCMS(); |
19 | 19 | |
20 | - $output = ''; |
|
21 | - $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
|
22 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
20 | + $output = ''; |
|
21 | + $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
|
22 | + $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
23 | 23 | |
24 | - if($action) { |
|
25 | - $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
|
24 | + if($action) { |
|
25 | + $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
|
26 | 26 | FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
27 | 27 | INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
28 | 28 | WHERE t1.action IN(' . $action . ') ' . $tab . ' |
29 | 29 | ORDER BY t1.tab ASC, t1.rank ASC'); |
30 | 30 | |
31 | - if($modx->db->getRecordCount($sql)) { |
|
32 | - $tabs = array(); |
|
33 | - while($row = $modx->db->getRow($sql)) { |
|
34 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
35 | - $row['value'] = $data[$row['name']]; |
|
36 | - } |
|
37 | - $tabs[$row['tab']]['category_name'] = $row['category_name']; |
|
38 | - $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
|
39 | - } |
|
40 | - |
|
41 | - if(!empty($config['toArray'])) { |
|
42 | - $output = $tabs; |
|
43 | - } else { |
|
44 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
45 | - $output .= ' |
|
31 | + if($modx->db->getRecordCount($sql)) { |
|
32 | + $tabs = array(); |
|
33 | + while($row = $modx->db->getRow($sql)) { |
|
34 | + if(!$row['value'] && !empty($data[$row['name']])) { |
|
35 | + $row['value'] = $data[$row['name']]; |
|
36 | + } |
|
37 | + $tabs[$row['tab']]['category_name'] = $row['category_name']; |
|
38 | + $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
|
39 | + } |
|
40 | + |
|
41 | + if(!empty($config['toArray'])) { |
|
42 | + $output = $tabs; |
|
43 | + } else { |
|
44 | + $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
45 | + $output .= ' |
|
46 | 46 | <script type="text/javascript"> |
47 | 47 | var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
48 | 48 | </script>'; |
49 | 49 | |
50 | - foreach($tabs as $idTab => $tab) { |
|
51 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
52 | - $output .= ' |
|
50 | + foreach($tabs as $idTab => $tab) { |
|
51 | + $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
52 | + $output .= ' |
|
53 | 53 | <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
54 | 54 | <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
55 | - unset($tab['category_name']); |
|
56 | - foreach($tab as $item) { |
|
57 | - $output .= $item; |
|
58 | - } |
|
59 | - $output .= '</div>'; |
|
60 | - } |
|
61 | - $output .= '</div>'; |
|
62 | - } |
|
63 | - } |
|
64 | - } |
|
65 | - |
|
66 | - return $output; |
|
67 | - } |
|
55 | + unset($tab['category_name']); |
|
56 | + foreach($tab as $item) { |
|
57 | + $output .= $item; |
|
58 | + } |
|
59 | + $output .= '</div>'; |
|
60 | + } |
|
61 | + $output .= '</div>'; |
|
62 | + } |
|
63 | + } |
|
64 | + } |
|
65 | + |
|
66 | + return $output; |
|
67 | + } |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * @param array $data |
71 | 71 | * @return string |
72 | 72 | */ |
73 | - private function render($data) { |
|
74 | - $modx = evolutionCMS(); global $_lang, $_country_lang; |
|
73 | + private function render($data) { |
|
74 | + $modx = evolutionCMS(); global $_lang, $_country_lang; |
|
75 | 75 | |
76 | - $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
|
77 | - $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $_POST[$data['name']][$data['value']] : (isset($data['value']) ? $modx->htmlspecialchars($data['value']) : '')); |
|
78 | - $data['readonly'] = ($data['readonly'] ? ' readonly' : ''); |
|
76 | + $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
|
77 | + $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $_POST[$data['name']][$data['value']] : (isset($data['value']) ? $modx->htmlspecialchars($data['value']) : '')); |
|
78 | + $data['readonly'] = ($data['readonly'] ? ' readonly' : ''); |
|
79 | 79 | |
80 | - $output = ''; |
|
81 | - $output .= '<div class="form-group row">'; |
|
80 | + $output = ''; |
|
81 | + $output .= '<div class="form-group row">'; |
|
82 | 82 | |
83 | - switch($data['type']) { |
|
83 | + switch($data['type']) { |
|
84 | 84 | |
85 | - case 'text': |
|
86 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
85 | + case 'text': |
|
86 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
87 | 87 | <div class="col-sm-7"> |
88 | 88 | <input type="text" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
89 | - $output .= $data['content']; |
|
90 | - $output .= '</div>'; |
|
89 | + $output .= $data['content']; |
|
90 | + $output .= '</div>'; |
|
91 | 91 | |
92 | - break; |
|
92 | + break; |
|
93 | 93 | |
94 | - case 'textarea': |
|
95 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
94 | + case 'textarea': |
|
95 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
96 | 96 | <div class="col-sm-7"> |
97 | 97 | <textarea name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;"[+readonly+]>[+value+]</textarea>'; |
98 | - $output .= $data['content']; |
|
99 | - $output .= '</div>'; |
|
98 | + $output .= $data['content']; |
|
99 | + $output .= '</div>'; |
|
100 | 100 | |
101 | - break; |
|
101 | + break; |
|
102 | 102 | |
103 | - case 'date': |
|
104 | - $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $modx->toDateFormat($_POST[$data['name']][$data['value']]) : (isset($data['value']) ? $modx->toDateFormat($data['value']) : '')); |
|
105 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
103 | + case 'date': |
|
104 | + $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $modx->toDateFormat($_POST[$data['name']][$data['value']]) : (isset($data['value']) ? $modx->toDateFormat($data['value']) : '')); |
|
105 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
106 | 106 | <div class="col-sm-7"> |
107 | 107 | <input type="text" name="[+name+]" class="form-control DatePicker" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
108 | - $output .= $data['content']; |
|
109 | - $output .= '</div>'; |
|
110 | - |
|
111 | - break; |
|
112 | - |
|
113 | - case 'select': |
|
114 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
115 | - $output .= '<div class="col-sm-7">'; |
|
116 | - $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
|
117 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
118 | - $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
|
119 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
120 | - foreach($_country_lang as $key => $value) { |
|
121 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
122 | - } |
|
123 | - } else { |
|
124 | - if($data['elements']) { |
|
125 | - $elements = explode('||', $data['elements']); |
|
126 | - foreach($elements as $key => $value) { |
|
127 | - $value = explode('==', $value); |
|
128 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
129 | - } |
|
130 | - } |
|
131 | - } |
|
132 | - $output .= '</select>'; |
|
133 | - $output .= $data['content']; |
|
134 | - $output .= '</div>'; |
|
135 | - |
|
136 | - break; |
|
137 | - |
|
138 | - case 'checkbox': |
|
139 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
140 | - $output .= '<div class="col-sm-7">'; |
|
141 | - $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
142 | - if($data['elements']) { |
|
143 | - $elements = explode('||', $data['elements']); |
|
144 | - foreach($elements as $key => $value) { |
|
145 | - $value = explode('==', $value); |
|
146 | - $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
147 | - } |
|
148 | - } |
|
149 | - $output .= $data['content']; |
|
150 | - $output .= '</div>'; |
|
151 | - |
|
152 | - break; |
|
153 | - |
|
154 | - case 'radio': |
|
155 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
156 | - $output .= '<div class="col-sm-7">'; |
|
157 | - $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
158 | - if($data['elements']) { |
|
159 | - $elements = explode('||', $data['elements']); |
|
160 | - foreach($elements as $key => $value) { |
|
161 | - $value = explode('==', $value); |
|
162 | - $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
163 | - } |
|
164 | - } |
|
165 | - $output .= $data['content']; |
|
166 | - $output .= '</div>'; |
|
167 | - |
|
168 | - break; |
|
169 | - |
|
170 | - case 'custom': |
|
171 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
172 | - $output .= '<div class="col-sm-7">'; |
|
173 | - $output .= $data['content']; |
|
174 | - $output .= '</div>'; |
|
175 | - |
|
176 | - break; |
|
177 | - } |
|
178 | - |
|
179 | - $output .= '</div>'; |
|
180 | - |
|
181 | - $output = $modx->parseText($output, $data); |
|
182 | - |
|
183 | - return $output; |
|
184 | - } |
|
108 | + $output .= $data['content']; |
|
109 | + $output .= '</div>'; |
|
110 | + |
|
111 | + break; |
|
112 | + |
|
113 | + case 'select': |
|
114 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
115 | + $output .= '<div class="col-sm-7">'; |
|
116 | + $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
|
117 | + if($data['name'] == 'country' && isset($_country_lang)) { |
|
118 | + $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
|
119 | + $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
120 | + foreach($_country_lang as $key => $value) { |
|
121 | + $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
122 | + } |
|
123 | + } else { |
|
124 | + if($data['elements']) { |
|
125 | + $elements = explode('||', $data['elements']); |
|
126 | + foreach($elements as $key => $value) { |
|
127 | + $value = explode('==', $value); |
|
128 | + $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
129 | + } |
|
130 | + } |
|
131 | + } |
|
132 | + $output .= '</select>'; |
|
133 | + $output .= $data['content']; |
|
134 | + $output .= '</div>'; |
|
135 | + |
|
136 | + break; |
|
137 | + |
|
138 | + case 'checkbox': |
|
139 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
140 | + $output .= '<div class="col-sm-7">'; |
|
141 | + $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
142 | + if($data['elements']) { |
|
143 | + $elements = explode('||', $data['elements']); |
|
144 | + foreach($elements as $key => $value) { |
|
145 | + $value = explode('==', $value); |
|
146 | + $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
147 | + } |
|
148 | + } |
|
149 | + $output .= $data['content']; |
|
150 | + $output .= '</div>'; |
|
151 | + |
|
152 | + break; |
|
153 | + |
|
154 | + case 'radio': |
|
155 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
156 | + $output .= '<div class="col-sm-7">'; |
|
157 | + $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
158 | + if($data['elements']) { |
|
159 | + $elements = explode('||', $data['elements']); |
|
160 | + foreach($elements as $key => $value) { |
|
161 | + $value = explode('==', $value); |
|
162 | + $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
163 | + } |
|
164 | + } |
|
165 | + $output .= $data['content']; |
|
166 | + $output .= '</div>'; |
|
167 | + |
|
168 | + break; |
|
169 | + |
|
170 | + case 'custom': |
|
171 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
172 | + $output .= '<div class="col-sm-7">'; |
|
173 | + $output .= $data['content']; |
|
174 | + $output .= '</div>'; |
|
175 | + |
|
176 | + break; |
|
177 | + } |
|
178 | + |
|
179 | + $output .= '</div>'; |
|
180 | + |
|
181 | + $output = $modx->parseText($output, $data); |
|
182 | + |
|
183 | + return $output; |
|
184 | + } |
|
185 | 185 | |
186 | 186 | } |
187 | 187 |
@@ -7,53 +7,53 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -Class TemplateParser { |
|
10 | +Class TemplateParser{ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * @param array $config [action, tabs, toArray] |
14 | 14 | * @param array $data |
15 | 15 | * @return string |
16 | 16 | */ |
17 | - public function output($config = array(), $data = array()) { |
|
17 | + public function output($config = array(), $data = array()){ |
|
18 | 18 | $modx = evolutionCMS(); |
19 | 19 | |
20 | 20 | $output = ''; |
21 | 21 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
22 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
22 | + $tab = isset($config['tab']) ? ' AND tab IN('.$config['tab'].')' : ''; |
|
23 | 23 | |
24 | - if($action) { |
|
24 | + if ($action) { |
|
25 | 25 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
26 | - FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
|
27 | - INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
|
28 | - WHERE t1.action IN(' . $action . ') ' . $tab . ' |
|
26 | + FROM ' . $modx->getFullTableName('system_templates').' AS t1 |
|
27 | + INNER JOIN ' . $modx->getFullTableName('categories').' AS t2 ON t2.id=t1.category |
|
28 | + WHERE t1.action IN(' . $action.') '.$tab.' |
|
29 | 29 | ORDER BY t1.tab ASC, t1.rank ASC'); |
30 | 30 | |
31 | - if($modx->db->getRecordCount($sql)) { |
|
31 | + if ($modx->db->getRecordCount($sql)) { |
|
32 | 32 | $tabs = array(); |
33 | - while($row = $modx->db->getRow($sql)) { |
|
34 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
33 | + while ($row = $modx->db->getRow($sql)) { |
|
34 | + if (!$row['value'] && !empty($data[$row['name']])) { |
|
35 | 35 | $row['value'] = $data[$row['name']]; |
36 | 36 | } |
37 | 37 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
38 | 38 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
39 | 39 | } |
40 | 40 | |
41 | - if(!empty($config['toArray'])) { |
|
41 | + if (!empty($config['toArray'])) { |
|
42 | 42 | $output = $tabs; |
43 | 43 | } else { |
44 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
44 | + $output .= '<div class="tab-pane" id="pane_'.$action.'">'; |
|
45 | 45 | $output .= ' |
46 | 46 | <script type="text/javascript"> |
47 | - var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
47 | + var pane_' . $action.' = new WebFXTabPane(document.getElementById("pane_'.$action.'"), '.($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
48 | 48 | </script>'; |
49 | 49 | |
50 | - foreach($tabs as $idTab => $tab) { |
|
51 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
50 | + foreach ($tabs as $idTab => $tab) { |
|
51 | + $output .= '<div class="tab-page" id="tab_'.$action.'_'.$idTab.'">'; |
|
52 | 52 | $output .= ' |
53 | - <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
|
54 | - <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
|
53 | + <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']).'</h2> |
|
54 | + <script type="text/javascript">pane_' . $action.'.addTabPage(document.getElementById("tab_'.$action.'_'.$idTab.'"));</script>'; |
|
55 | 55 | unset($tab['category_name']); |
56 | - foreach($tab as $item) { |
|
56 | + foreach ($tab as $item) { |
|
57 | 57 | $output .= $item; |
58 | 58 | } |
59 | 59 | $output .= '</div>'; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param array $data |
71 | 71 | * @return string |
72 | 72 | */ |
73 | - private function render($data) { |
|
73 | + private function render($data){ |
|
74 | 74 | $modx = evolutionCMS(); global $_lang, $_country_lang; |
75 | 75 | |
76 | 76 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $output = ''; |
81 | 81 | $output .= '<div class="form-group row">'; |
82 | 82 | |
83 | - switch($data['type']) { |
|
83 | + switch ($data['type']) { |
|
84 | 84 | |
85 | 85 | case 'text': |
86 | 86 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -114,18 +114,18 @@ discard block |
||
114 | 114 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
115 | 115 | $output .= '<div class="col-sm-7">'; |
116 | 116 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
117 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | + if ($data['name'] == 'country' && isset($_country_lang)) { |
|
118 | 118 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
119 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
120 | - foreach($_country_lang as $key => $value) { |
|
121 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
119 | + $output .= '<option value=""'.(!isset($chosenCountry) ? ' selected' : '').'> </option>'; |
|
120 | + foreach ($_country_lang as $key => $value) { |
|
121 | + $output .= '<option value="'.$key.'"'.(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').'>'.$value.'</option>'; |
|
122 | 122 | } |
123 | 123 | } else { |
124 | - if($data['elements']) { |
|
124 | + if ($data['elements']) { |
|
125 | 125 | $elements = explode('||', $data['elements']); |
126 | - foreach($elements as $key => $value) { |
|
126 | + foreach ($elements as $key => $value) { |
|
127 | 127 | $value = explode('==', $value); |
128 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
128 | + $output .= '<option value="'.$value[1].'">'.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]).'</option>'; |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | } |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
140 | 140 | $output .= '<div class="col-sm-7">'; |
141 | 141 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
142 | - if($data['elements']) { |
|
142 | + if ($data['elements']) { |
|
143 | 143 | $elements = explode('||', $data['elements']); |
144 | - foreach($elements as $key => $value) { |
|
144 | + foreach ($elements as $key => $value) { |
|
145 | 145 | $value = explode('==', $value); |
146 | - $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
146 | + $output .= '<br /><input type="checkbox" name="'.$value[0].'" class="form-control" id="'.$value[0].'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | $output .= $data['content']; |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
156 | 156 | $output .= '<div class="col-sm-7">'; |
157 | 157 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
158 | - if($data['elements']) { |
|
158 | + if ($data['elements']) { |
|
159 | 159 | $elements = explode('||', $data['elements']); |
160 | - foreach($elements as $key => $value) { |
|
160 | + foreach ($elements as $key => $value) { |
|
161 | 161 | $value = explode('==', $value); |
162 | - $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
162 | + $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_'.$key.'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | $output .= $data['content']; |
@@ -7,53 +7,55 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -Class TemplateParser { |
|
10 | +Class TemplateParser |
|
11 | +{ |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * @param array $config [action, tabs, toArray] |
14 | 15 | * @param array $data |
15 | 16 | * @return string |
16 | 17 | */ |
17 | - public function output($config = array(), $data = array()) { |
|
18 | + public function output($config = array(), $data = array()) |
|
19 | + { |
|
18 | 20 | $modx = evolutionCMS(); |
19 | 21 | |
20 | 22 | $output = ''; |
21 | 23 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
22 | 24 | $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
23 | 25 | |
24 | - if($action) { |
|
26 | + if($action) { |
|
25 | 27 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
26 | 28 | FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
27 | 29 | INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
28 | 30 | WHERE t1.action IN(' . $action . ') ' . $tab . ' |
29 | 31 | ORDER BY t1.tab ASC, t1.rank ASC'); |
30 | 32 | |
31 | - if($modx->db->getRecordCount($sql)) { |
|
33 | + if($modx->db->getRecordCount($sql)) { |
|
32 | 34 | $tabs = array(); |
33 | - while($row = $modx->db->getRow($sql)) { |
|
34 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
35 | + while($row = $modx->db->getRow($sql)) { |
|
36 | + if(!$row['value'] && !empty($data[$row['name']])) { |
|
35 | 37 | $row['value'] = $data[$row['name']]; |
36 | 38 | } |
37 | 39 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
38 | 40 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
39 | 41 | } |
40 | 42 | |
41 | - if(!empty($config['toArray'])) { |
|
43 | + if(!empty($config['toArray'])) { |
|
42 | 44 | $output = $tabs; |
43 | - } else { |
|
45 | + } else { |
|
44 | 46 | $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
45 | 47 | $output .= ' |
46 | 48 | <script type="text/javascript"> |
47 | 49 | var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
48 | 50 | </script>'; |
49 | 51 | |
50 | - foreach($tabs as $idTab => $tab) { |
|
52 | + foreach($tabs as $idTab => $tab) { |
|
51 | 53 | $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
52 | 54 | $output .= ' |
53 | 55 | <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
54 | 56 | <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
55 | 57 | unset($tab['category_name']); |
56 | - foreach($tab as $item) { |
|
58 | + foreach($tab as $item) { |
|
57 | 59 | $output .= $item; |
58 | 60 | } |
59 | 61 | $output .= '</div>'; |
@@ -70,7 +72,8 @@ discard block |
||
70 | 72 | * @param array $data |
71 | 73 | * @return string |
72 | 74 | */ |
73 | - private function render($data) { |
|
75 | + private function render($data) |
|
76 | + { |
|
74 | 77 | $modx = evolutionCMS(); global $_lang, $_country_lang; |
75 | 78 | |
76 | 79 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -80,7 +83,7 @@ discard block |
||
80 | 83 | $output = ''; |
81 | 84 | $output .= '<div class="form-group row">'; |
82 | 85 | |
83 | - switch($data['type']) { |
|
86 | + switch($data['type']) { |
|
84 | 87 | |
85 | 88 | case 'text': |
86 | 89 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -114,16 +117,16 @@ discard block |
||
114 | 117 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
115 | 118 | $output .= '<div class="col-sm-7">'; |
116 | 119 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
117 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
120 | + if($data['name'] == 'country' && isset($_country_lang)) { |
|
118 | 121 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
119 | 122 | $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
120 | - foreach($_country_lang as $key => $value) { |
|
123 | + foreach($_country_lang as $key => $value) { |
|
121 | 124 | $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
122 | 125 | } |
123 | - } else { |
|
124 | - if($data['elements']) { |
|
126 | + } else { |
|
127 | + if($data['elements']) { |
|
125 | 128 | $elements = explode('||', $data['elements']); |
126 | - foreach($elements as $key => $value) { |
|
129 | + foreach($elements as $key => $value) { |
|
127 | 130 | $value = explode('==', $value); |
128 | 131 | $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
129 | 132 | } |
@@ -139,9 +142,9 @@ discard block |
||
139 | 142 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
140 | 143 | $output .= '<div class="col-sm-7">'; |
141 | 144 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
142 | - if($data['elements']) { |
|
145 | + if($data['elements']) { |
|
143 | 146 | $elements = explode('||', $data['elements']); |
144 | - foreach($elements as $key => $value) { |
|
147 | + foreach($elements as $key => $value) { |
|
145 | 148 | $value = explode('==', $value); |
146 | 149 | $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
147 | 150 | } |
@@ -155,9 +158,9 @@ discard block |
||
155 | 158 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
156 | 159 | $output .= '<div class="col-sm-7">'; |
157 | 160 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
158 | - if($data['elements']) { |
|
161 | + if($data['elements']) { |
|
159 | 162 | $elements = explode('||', $data['elements']); |
160 | - foreach($elements as $key => $value) { |
|
163 | + foreach($elements as $key => $value) { |
|
161 | 164 | $value = explode('==', $value); |
162 | 165 | $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
163 | 166 | } |
@@ -21,320 +21,320 @@ discard block |
||
21 | 21 | $o = ''; |
22 | 22 | |
23 | 23 | // process any TV commands in value |
24 | - $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
25 | - $value = ProcessTVCommand($value, $name, $docid); |
|
24 | + $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
25 | + $value = ProcessTVCommand($value, $name, $docid); |
|
26 | 26 | |
27 | - $params = array(); |
|
28 | - if($paramstring) { |
|
29 | - $cp = explode("&", $paramstring); |
|
30 | - foreach($cp as $p => $v) { |
|
31 | - $v = trim($v); // trim |
|
32 | - $ar = explode("=", $v); |
|
33 | - if(is_array($ar) && count($ar) == 2) { |
|
34 | - $params[$ar[0]] = decodeParamValue($ar[1]); |
|
35 | - } |
|
36 | - } |
|
37 | - } |
|
27 | + $params = array(); |
|
28 | + if($paramstring) { |
|
29 | + $cp = explode("&", $paramstring); |
|
30 | + foreach($cp as $p => $v) { |
|
31 | + $v = trim($v); // trim |
|
32 | + $ar = explode("=", $v); |
|
33 | + if(is_array($ar) && count($ar) == 2) { |
|
34 | + $params[$ar[0]] = decodeParamValue($ar[1]); |
|
35 | + } |
|
36 | + } |
|
37 | + } |
|
38 | 38 | |
39 | - $id = "tv$name"; |
|
40 | - switch($format) { |
|
41 | - case 'image': |
|
42 | - $images = parseInput($value, '||', 'array'); |
|
43 | - foreach($images as $image) { |
|
44 | - if(!is_array($image)) { |
|
45 | - $image = explode('==', $image); |
|
46 | - } |
|
47 | - $src = $image[0]; |
|
39 | + $id = "tv$name"; |
|
40 | + switch($format) { |
|
41 | + case 'image': |
|
42 | + $images = parseInput($value, '||', 'array'); |
|
43 | + foreach($images as $image) { |
|
44 | + if(!is_array($image)) { |
|
45 | + $image = explode('==', $image); |
|
46 | + } |
|
47 | + $src = $image[0]; |
|
48 | 48 | |
49 | - if($src) { |
|
50 | - // We have a valid source |
|
51 | - $attributes = ''; |
|
52 | - $attr = array( |
|
53 | - 'class' => $params['class'], |
|
54 | - 'src' => $src, |
|
55 | - 'id' => ($params['id'] ? $params['id'] : ''), |
|
56 | - 'alt' => $modx->htmlspecialchars($params['alttext']), |
|
57 | - 'style' => $params['style'] |
|
58 | - ); |
|
59 | - if(isset($params['align']) && $params['align'] != 'none') { |
|
60 | - $attr['align'] = $params['align']; |
|
61 | - } |
|
62 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
63 | - $attributes .= ' ' . $params['attrib']; |
|
49 | + if($src) { |
|
50 | + // We have a valid source |
|
51 | + $attributes = ''; |
|
52 | + $attr = array( |
|
53 | + 'class' => $params['class'], |
|
54 | + 'src' => $src, |
|
55 | + 'id' => ($params['id'] ? $params['id'] : ''), |
|
56 | + 'alt' => $modx->htmlspecialchars($params['alttext']), |
|
57 | + 'style' => $params['style'] |
|
58 | + ); |
|
59 | + if(isset($params['align']) && $params['align'] != 'none') { |
|
60 | + $attr['align'] = $params['align']; |
|
61 | + } |
|
62 | + foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
63 | + $attributes .= ' ' . $params['attrib']; |
|
64 | 64 | |
65 | - // Output the image with attributes |
|
66 | - $o .= '<img' . rtrim($attributes) . ' />'; |
|
67 | - } |
|
68 | - } |
|
69 | - break; |
|
65 | + // Output the image with attributes |
|
66 | + $o .= '<img' . rtrim($attributes) . ' />'; |
|
67 | + } |
|
68 | + } |
|
69 | + break; |
|
70 | 70 | |
71 | - case "delim": // display as delimitted list |
|
72 | - $value = parseInput($value, "||"); |
|
73 | - $p = $params['format'] ? $params['format'] : " "; |
|
74 | - if($p == "\\n") { |
|
75 | - $p = "\n"; |
|
76 | - } |
|
77 | - $o = str_replace("||", $p, $value); |
|
78 | - break; |
|
71 | + case "delim": // display as delimitted list |
|
72 | + $value = parseInput($value, "||"); |
|
73 | + $p = $params['format'] ? $params['format'] : " "; |
|
74 | + if($p == "\\n") { |
|
75 | + $p = "\n"; |
|
76 | + } |
|
77 | + $o = str_replace("||", $p, $value); |
|
78 | + break; |
|
79 | 79 | |
80 | - case "string": |
|
81 | - $value = parseInput($value); |
|
82 | - $format = strtolower($params['format']); |
|
83 | - if($format == 'upper case') { |
|
84 | - $o = strtoupper($value); |
|
85 | - } else if($format == 'lower case') { |
|
86 | - $o = strtolower($value); |
|
87 | - } else if($format == 'sentence case') { |
|
88 | - $o = ucfirst($value); |
|
89 | - } else if($format == 'capitalize') { |
|
90 | - $o = ucwords($value); |
|
91 | - } else { |
|
92 | - $o = $value; |
|
93 | - } |
|
94 | - break; |
|
80 | + case "string": |
|
81 | + $value = parseInput($value); |
|
82 | + $format = strtolower($params['format']); |
|
83 | + if($format == 'upper case') { |
|
84 | + $o = strtoupper($value); |
|
85 | + } else if($format == 'lower case') { |
|
86 | + $o = strtolower($value); |
|
87 | + } else if($format == 'sentence case') { |
|
88 | + $o = ucfirst($value); |
|
89 | + } else if($format == 'capitalize') { |
|
90 | + $o = ucwords($value); |
|
91 | + } else { |
|
92 | + $o = $value; |
|
93 | + } |
|
94 | + break; |
|
95 | 95 | |
96 | - case "date": |
|
97 | - if($value != '' || $params['default'] == 'Yes') { |
|
98 | - if(empty($value)) { |
|
99 | - $value = 'now'; |
|
100 | - } |
|
101 | - $timestamp = getUnixtimeFromDateString($value); |
|
102 | - $p = $params['format'] ? $params['format'] : "%A %d, %B %Y"; |
|
103 | - $o = strftime($p, $timestamp); |
|
104 | - } else { |
|
105 | - $value = ''; |
|
106 | - } |
|
107 | - break; |
|
96 | + case "date": |
|
97 | + if($value != '' || $params['default'] == 'Yes') { |
|
98 | + if(empty($value)) { |
|
99 | + $value = 'now'; |
|
100 | + } |
|
101 | + $timestamp = getUnixtimeFromDateString($value); |
|
102 | + $p = $params['format'] ? $params['format'] : "%A %d, %B %Y"; |
|
103 | + $o = strftime($p, $timestamp); |
|
104 | + } else { |
|
105 | + $value = ''; |
|
106 | + } |
|
107 | + break; |
|
108 | 108 | |
109 | - case "hyperlink": |
|
110 | - $value = parseInput($value, "||", "array"); |
|
111 | - $o = ''; |
|
112 | - $countValue = count($value); |
|
113 | - for($i = 0; $i < $countValue; $i++) { |
|
114 | - list($name, $url) = is_array($value[$i]) ? $value[$i] : explode("==", $value[$i]); |
|
115 | - if(!$url) { |
|
116 | - $url = $name; |
|
117 | - } |
|
118 | - if($url) { |
|
119 | - if($o) { |
|
120 | - $o .= '<br />'; |
|
121 | - } |
|
122 | - $attributes = ''; |
|
123 | - // setup the link attributes |
|
124 | - $attr = array( |
|
125 | - 'href' => $url, |
|
126 | - 'title' => $params['title'] ? $modx->htmlspecialchars($params['title']) : $name, |
|
127 | - 'class' => $params['class'], |
|
128 | - 'style' => $params['style'], |
|
129 | - 'target' => $params['target'], |
|
130 | - ); |
|
131 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
132 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
109 | + case "hyperlink": |
|
110 | + $value = parseInput($value, "||", "array"); |
|
111 | + $o = ''; |
|
112 | + $countValue = count($value); |
|
113 | + for($i = 0; $i < $countValue; $i++) { |
|
114 | + list($name, $url) = is_array($value[$i]) ? $value[$i] : explode("==", $value[$i]); |
|
115 | + if(!$url) { |
|
116 | + $url = $name; |
|
117 | + } |
|
118 | + if($url) { |
|
119 | + if($o) { |
|
120 | + $o .= '<br />'; |
|
121 | + } |
|
122 | + $attributes = ''; |
|
123 | + // setup the link attributes |
|
124 | + $attr = array( |
|
125 | + 'href' => $url, |
|
126 | + 'title' => $params['title'] ? $modx->htmlspecialchars($params['title']) : $name, |
|
127 | + 'class' => $params['class'], |
|
128 | + 'style' => $params['style'], |
|
129 | + 'target' => $params['target'], |
|
130 | + ); |
|
131 | + foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
132 | + $attributes .= ' ' . $params['attrib']; // add extra |
|
133 | 133 | |
134 | - // Output the link |
|
135 | - $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>'; |
|
136 | - } |
|
137 | - } |
|
138 | - break; |
|
134 | + // Output the link |
|
135 | + $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>'; |
|
136 | + } |
|
137 | + } |
|
138 | + break; |
|
139 | 139 | |
140 | - case "htmltag": |
|
141 | - $value = parseInput($value, "||", "array"); |
|
142 | - $tagid = $params['tagid']; |
|
143 | - $tagname = ($params['tagname']) ? $params['tagname'] : 'div'; |
|
144 | - $o = ''; |
|
145 | - // Loop through a list of tags |
|
140 | + case "htmltag": |
|
141 | + $value = parseInput($value, "||", "array"); |
|
142 | + $tagid = $params['tagid']; |
|
143 | + $tagname = ($params['tagname']) ? $params['tagname'] : 'div'; |
|
144 | + $o = ''; |
|
145 | + // Loop through a list of tags |
|
146 | 146 | $countValue = count($value); |
147 | - for($i = 0; $i < $countValue; $i++) { |
|
148 | - $tagvalue = is_array($value[$i]) ? implode(' ', $value[$i]) : $value[$i]; |
|
149 | - if(!$tagvalue) { |
|
150 | - continue; |
|
151 | - } |
|
147 | + for($i = 0; $i < $countValue; $i++) { |
|
148 | + $tagvalue = is_array($value[$i]) ? implode(' ', $value[$i]) : $value[$i]; |
|
149 | + if(!$tagvalue) { |
|
150 | + continue; |
|
151 | + } |
|
152 | 152 | |
153 | - $attributes = ''; |
|
154 | - $attr = array( |
|
155 | - 'id' => ($tagid ? $tagid : $id), |
|
156 | - // 'tv' already added to id |
|
157 | - 'class' => $params['class'], |
|
158 | - 'style' => $params['style'], |
|
159 | - ); |
|
160 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
161 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
153 | + $attributes = ''; |
|
154 | + $attr = array( |
|
155 | + 'id' => ($tagid ? $tagid : $id), |
|
156 | + // 'tv' already added to id |
|
157 | + 'class' => $params['class'], |
|
158 | + 'style' => $params['style'], |
|
159 | + ); |
|
160 | + foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
161 | + $attributes .= ' ' . $params['attrib']; // add extra |
|
162 | 162 | |
163 | - // Output the HTML Tag |
|
164 | - $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>'; |
|
165 | - } |
|
166 | - break; |
|
163 | + // Output the HTML Tag |
|
164 | + $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>'; |
|
165 | + } |
|
166 | + break; |
|
167 | 167 | |
168 | - case "richtext": |
|
169 | - $value = parseInput($value); |
|
170 | - $w = $params['w'] ? $params['w'] : '100%'; |
|
171 | - $h = $params['h'] ? $params['h'] : '400px'; |
|
172 | - $richtexteditor = $params['edt'] ? $params['edt'] : ""; |
|
173 | - $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">'; |
|
174 | - $o .= $modx->htmlspecialchars($value); |
|
175 | - $o .= '</textarea></div>'; |
|
176 | - $replace_richtext = array($id); |
|
177 | - // setup editors |
|
178 | - if(!empty($replace_richtext) && !empty($richtexteditor)) { |
|
179 | - // invoke OnRichTextEditorInit event |
|
180 | - $evtOut = $modx->invokeEvent("OnRichTextEditorInit", array( |
|
181 | - 'editor' => $richtexteditor, |
|
182 | - 'elements' => $replace_richtext, |
|
183 | - 'forfrontend' => 1, |
|
184 | - 'width' => $w, |
|
185 | - 'height' => $h |
|
186 | - )); |
|
187 | - if(is_array($evtOut)) { |
|
188 | - $o .= implode("", $evtOut); |
|
189 | - } |
|
190 | - } |
|
191 | - break; |
|
168 | + case "richtext": |
|
169 | + $value = parseInput($value); |
|
170 | + $w = $params['w'] ? $params['w'] : '100%'; |
|
171 | + $h = $params['h'] ? $params['h'] : '400px'; |
|
172 | + $richtexteditor = $params['edt'] ? $params['edt'] : ""; |
|
173 | + $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">'; |
|
174 | + $o .= $modx->htmlspecialchars($value); |
|
175 | + $o .= '</textarea></div>'; |
|
176 | + $replace_richtext = array($id); |
|
177 | + // setup editors |
|
178 | + if(!empty($replace_richtext) && !empty($richtexteditor)) { |
|
179 | + // invoke OnRichTextEditorInit event |
|
180 | + $evtOut = $modx->invokeEvent("OnRichTextEditorInit", array( |
|
181 | + 'editor' => $richtexteditor, |
|
182 | + 'elements' => $replace_richtext, |
|
183 | + 'forfrontend' => 1, |
|
184 | + 'width' => $w, |
|
185 | + 'height' => $h |
|
186 | + )); |
|
187 | + if(is_array($evtOut)) { |
|
188 | + $o .= implode("", $evtOut); |
|
189 | + } |
|
190 | + } |
|
191 | + break; |
|
192 | 192 | |
193 | - case "unixtime": |
|
194 | - $value = parseInput($value); |
|
195 | - $o = getUnixtimeFromDateString($value); |
|
196 | - break; |
|
193 | + case "unixtime": |
|
194 | + $value = parseInput($value); |
|
195 | + $o = getUnixtimeFromDateString($value); |
|
196 | + break; |
|
197 | 197 | |
198 | - case "viewport": |
|
199 | - $value = parseInput($value); |
|
200 | - $id = '_' . time(); |
|
201 | - if(!$params['vpid']) { |
|
202 | - $params['vpid'] = $id; |
|
203 | - } |
|
204 | - $sTag = "<iframe"; |
|
205 | - $eTag = "</iframe>"; |
|
206 | - $autoMode = "0"; |
|
207 | - $w = $params['width']; |
|
208 | - $h = $params['height']; |
|
209 | - if($params['stretch'] == 'Yes') { |
|
210 | - $w = "100%"; |
|
211 | - $h = "100%"; |
|
212 | - } |
|
213 | - if($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
|
214 | - $autoMode = "3"; //both |
|
215 | - } else if($params['awidth'] == 'Yes') { |
|
216 | - $autoMode = "1"; //width only |
|
217 | - } else if($params['aheight'] == 'Yes') { |
|
218 | - $autoMode = "2"; //height only |
|
219 | - } |
|
198 | + case "viewport": |
|
199 | + $value = parseInput($value); |
|
200 | + $id = '_' . time(); |
|
201 | + if(!$params['vpid']) { |
|
202 | + $params['vpid'] = $id; |
|
203 | + } |
|
204 | + $sTag = "<iframe"; |
|
205 | + $eTag = "</iframe>"; |
|
206 | + $autoMode = "0"; |
|
207 | + $w = $params['width']; |
|
208 | + $h = $params['height']; |
|
209 | + if($params['stretch'] == 'Yes') { |
|
210 | + $w = "100%"; |
|
211 | + $h = "100%"; |
|
212 | + } |
|
213 | + if($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
|
214 | + $autoMode = "3"; //both |
|
215 | + } else if($params['awidth'] == 'Yes') { |
|
216 | + $autoMode = "1"; //width only |
|
217 | + } else if($params['aheight'] == 'Yes') { |
|
218 | + $autoMode = "2"; //height only |
|
219 | + } |
|
220 | 220 | |
221 | - $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array( |
|
222 | - 'name' => 'viewport', |
|
223 | - 'version' => '0', |
|
224 | - 'plaintext' => false |
|
225 | - )); |
|
226 | - $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' "; |
|
227 | - if($params['class']) { |
|
228 | - $o .= " class='" . $params['class'] . "' "; |
|
229 | - } |
|
230 | - if($params['style']) { |
|
231 | - $o .= " style='" . $params['style'] . "' "; |
|
232 | - } |
|
233 | - if($params['attrib']) { |
|
234 | - $o .= $params['attrib'] . " "; |
|
235 | - } |
|
236 | - $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' "; |
|
237 | - $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' "; |
|
238 | - $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' "; |
|
239 | - $o .= ">"; |
|
240 | - $o .= $eTag; |
|
241 | - break; |
|
221 | + $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array( |
|
222 | + 'name' => 'viewport', |
|
223 | + 'version' => '0', |
|
224 | + 'plaintext' => false |
|
225 | + )); |
|
226 | + $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' "; |
|
227 | + if($params['class']) { |
|
228 | + $o .= " class='" . $params['class'] . "' "; |
|
229 | + } |
|
230 | + if($params['style']) { |
|
231 | + $o .= " style='" . $params['style'] . "' "; |
|
232 | + } |
|
233 | + if($params['attrib']) { |
|
234 | + $o .= $params['attrib'] . " "; |
|
235 | + } |
|
236 | + $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' "; |
|
237 | + $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' "; |
|
238 | + $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' "; |
|
239 | + $o .= ">"; |
|
240 | + $o .= $eTag; |
|
241 | + break; |
|
242 | 242 | |
243 | - case "datagrid": |
|
244 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
245 | - $grd = new DataGrid('', $value); |
|
243 | + case "datagrid": |
|
244 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
245 | + $grd = new DataGrid('', $value); |
|
246 | 246 | |
247 | - $grd->noRecordMsg = $params['egmsg']; |
|
247 | + $grd->noRecordMsg = $params['egmsg']; |
|
248 | 248 | |
249 | - $grd->columnHeaderClass = $params['chdrc']; |
|
250 | - $grd->cssClass = $params['tblc']; |
|
251 | - $grd->itemClass = $params['itmc']; |
|
252 | - $grd->altItemClass = $params['aitmc']; |
|
249 | + $grd->columnHeaderClass = $params['chdrc']; |
|
250 | + $grd->cssClass = $params['tblc']; |
|
251 | + $grd->itemClass = $params['itmc']; |
|
252 | + $grd->altItemClass = $params['aitmc']; |
|
253 | 253 | |
254 | - $grd->columnHeaderStyle = $params['chdrs']; |
|
255 | - $grd->cssStyle = $params['tbls']; |
|
256 | - $grd->itemStyle = $params['itms']; |
|
257 | - $grd->altItemStyle = $params['aitms']; |
|
254 | + $grd->columnHeaderStyle = $params['chdrs']; |
|
255 | + $grd->cssStyle = $params['tbls']; |
|
256 | + $grd->itemStyle = $params['itms']; |
|
257 | + $grd->altItemStyle = $params['aitms']; |
|
258 | 258 | |
259 | - $grd->columns = $params['cols']; |
|
260 | - $grd->fields = $params['flds']; |
|
261 | - $grd->colWidths = $params['cwidth']; |
|
262 | - $grd->colAligns = $params['calign']; |
|
263 | - $grd->colColors = $params['ccolor']; |
|
264 | - $grd->colTypes = $params['ctype']; |
|
259 | + $grd->columns = $params['cols']; |
|
260 | + $grd->fields = $params['flds']; |
|
261 | + $grd->colWidths = $params['cwidth']; |
|
262 | + $grd->colAligns = $params['calign']; |
|
263 | + $grd->colColors = $params['ccolor']; |
|
264 | + $grd->colTypes = $params['ctype']; |
|
265 | 265 | |
266 | - $grd->cellPadding = $params['cpad']; |
|
267 | - $grd->cellSpacing = $params['cspace']; |
|
268 | - $grd->header = $params['head']; |
|
269 | - $grd->footer = $params['foot']; |
|
270 | - $grd->pageSize = $params['psize']; |
|
271 | - $grd->pagerLocation = $params['ploc']; |
|
272 | - $grd->pagerClass = $params['pclass']; |
|
273 | - $grd->pagerStyle = $params['pstyle']; |
|
274 | - $o = $grd->render(); |
|
275 | - break; |
|
266 | + $grd->cellPadding = $params['cpad']; |
|
267 | + $grd->cellSpacing = $params['cspace']; |
|
268 | + $grd->header = $params['head']; |
|
269 | + $grd->footer = $params['foot']; |
|
270 | + $grd->pageSize = $params['psize']; |
|
271 | + $grd->pagerLocation = $params['ploc']; |
|
272 | + $grd->pagerClass = $params['pclass']; |
|
273 | + $grd->pagerStyle = $params['pstyle']; |
|
274 | + $o = $grd->render(); |
|
275 | + break; |
|
276 | 276 | |
277 | - case 'htmlentities': |
|
278 | - $value = parseInput($value); |
|
279 | - if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
280 | - // remove delimiter from checkbox and listbox-multiple TVs |
|
281 | - $value = str_replace('||', '', $value); |
|
282 | - } |
|
283 | - $o = htmlentities($value, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
284 | - break; |
|
277 | + case 'htmlentities': |
|
278 | + $value = parseInput($value); |
|
279 | + if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
280 | + // remove delimiter from checkbox and listbox-multiple TVs |
|
281 | + $value = str_replace('||', '', $value); |
|
282 | + } |
|
283 | + $o = htmlentities($value, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
284 | + break; |
|
285 | 285 | |
286 | - case 'custom_widget': |
|
287 | - $widget_output = ''; |
|
288 | - $o = ''; |
|
289 | - /* If we are loading a file */ |
|
290 | - if(substr($params['output'], 0, 5) == "@FILE") { |
|
291 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6)); |
|
292 | - if(!file_exists($file_name)) { |
|
293 | - $widget_output = $file_name . ' does not exist'; |
|
294 | - } else { |
|
295 | - $widget_output = file_get_contents($file_name); |
|
296 | - } |
|
297 | - } elseif(substr($params['output'], 0, 8) == '@INCLUDE') { |
|
298 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9)); |
|
299 | - if(!file_exists($file_name)) { |
|
300 | - $widget_output = $file_name . ' does not exist'; |
|
301 | - } else { |
|
302 | - /* The included file needs to set $widget_output. Can be string, array, object */ |
|
303 | - include $file_name; |
|
304 | - } |
|
305 | - } elseif(substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') { |
|
306 | - $chunk_name = trim(substr($params['output'], 7)); |
|
307 | - $widget_output = $modx->getChunk($chunk_name); |
|
308 | - } elseif(substr($params['output'], 0, 5) == '@EVAL' && $value !== '') { |
|
309 | - $eval_str = trim(substr($params['output'], 6)); |
|
310 | - $widget_output = eval($eval_str); |
|
311 | - } elseif($value !== '') { |
|
312 | - $widget_output = $params['output']; |
|
313 | - } else { |
|
314 | - $widget_output = ''; |
|
315 | - } |
|
316 | - if(is_string($widget_output)) { |
|
317 | - $_ = $modx->config['enable_filter']; |
|
318 | - $modx->config['enable_filter'] = 1; |
|
319 | - $widget_output = $modx->parseText($widget_output, array('value' => $value)); |
|
320 | - $modx->config['enable_filter'] = $_; |
|
321 | - $o = $modx->parseDocumentSource($widget_output); |
|
322 | - } else { |
|
323 | - $o = $widget_output; |
|
324 | - } |
|
325 | - break; |
|
286 | + case 'custom_widget': |
|
287 | + $widget_output = ''; |
|
288 | + $o = ''; |
|
289 | + /* If we are loading a file */ |
|
290 | + if(substr($params['output'], 0, 5) == "@FILE") { |
|
291 | + $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6)); |
|
292 | + if(!file_exists($file_name)) { |
|
293 | + $widget_output = $file_name . ' does not exist'; |
|
294 | + } else { |
|
295 | + $widget_output = file_get_contents($file_name); |
|
296 | + } |
|
297 | + } elseif(substr($params['output'], 0, 8) == '@INCLUDE') { |
|
298 | + $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9)); |
|
299 | + if(!file_exists($file_name)) { |
|
300 | + $widget_output = $file_name . ' does not exist'; |
|
301 | + } else { |
|
302 | + /* The included file needs to set $widget_output. Can be string, array, object */ |
|
303 | + include $file_name; |
|
304 | + } |
|
305 | + } elseif(substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') { |
|
306 | + $chunk_name = trim(substr($params['output'], 7)); |
|
307 | + $widget_output = $modx->getChunk($chunk_name); |
|
308 | + } elseif(substr($params['output'], 0, 5) == '@EVAL' && $value !== '') { |
|
309 | + $eval_str = trim(substr($params['output'], 6)); |
|
310 | + $widget_output = eval($eval_str); |
|
311 | + } elseif($value !== '') { |
|
312 | + $widget_output = $params['output']; |
|
313 | + } else { |
|
314 | + $widget_output = ''; |
|
315 | + } |
|
316 | + if(is_string($widget_output)) { |
|
317 | + $_ = $modx->config['enable_filter']; |
|
318 | + $modx->config['enable_filter'] = 1; |
|
319 | + $widget_output = $modx->parseText($widget_output, array('value' => $value)); |
|
320 | + $modx->config['enable_filter'] = $_; |
|
321 | + $o = $modx->parseDocumentSource($widget_output); |
|
322 | + } else { |
|
323 | + $o = $widget_output; |
|
324 | + } |
|
325 | + break; |
|
326 | 326 | |
327 | - default: |
|
328 | - $value = parseInput($value); |
|
329 | - if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
330 | - // add separator |
|
331 | - $value = explode('||', $value); |
|
332 | - $value = implode($sep, $value); |
|
333 | - } |
|
334 | - $o = $value; |
|
335 | - break; |
|
336 | - } |
|
337 | - return $o; |
|
327 | + default: |
|
328 | + $value = parseInput($value); |
|
329 | + if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
330 | + // add separator |
|
331 | + $value = explode('||', $value); |
|
332 | + $value = implode($sep, $value); |
|
333 | + } |
|
334 | + $o = $value; |
|
335 | + break; |
|
336 | + } |
|
337 | + return $o; |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | /** |
@@ -342,8 +342,8 @@ discard block |
||
342 | 342 | * @return string |
343 | 343 | */ |
344 | 344 | function decodeParamValue($s) { |
345 | - $s = str_replace("%3D", '=', $s); // = |
|
346 | - return str_replace("%26", '&', $s); // & |
|
345 | + $s = str_replace("%3D", '=', $s); // = |
|
346 | + return str_replace("%26", '&', $s); // & |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | /** |
@@ -357,19 +357,19 @@ discard block |
||
357 | 357 | */ |
358 | 358 | function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array |
359 | 359 | $modx = evolutionCMS(); |
360 | - if($modx->db->isResult($src)) { |
|
361 | - // must be a recordset |
|
362 | - $rows = array(); |
|
363 | - while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
364 | - return ($type == "array") ? $rows : implode($delim, $rows); |
|
365 | - } else { |
|
366 | - // must be a text |
|
367 | - if($type == "array") { |
|
368 | - return explode($delim, $src); |
|
369 | - } else { |
|
370 | - return $src; |
|
371 | - } |
|
372 | - } |
|
360 | + if($modx->db->isResult($src)) { |
|
361 | + // must be a recordset |
|
362 | + $rows = array(); |
|
363 | + while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
364 | + return ($type == "array") ? $rows : implode($delim, $rows); |
|
365 | + } else { |
|
366 | + // must be a text |
|
367 | + if($type == "array") { |
|
368 | + return explode($delim, $src); |
|
369 | + } else { |
|
370 | + return $src; |
|
371 | + } |
|
372 | + } |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | /** |
@@ -377,21 +377,21 @@ discard block |
||
377 | 377 | * @return bool|false|int |
378 | 378 | */ |
379 | 379 | function getUnixtimeFromDateString($value) { |
380 | - $timestamp = false; |
|
381 | - // Check for MySQL or legacy style date |
|
382 | - $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
|
383 | - $date_match_2 = '/^([0-9]{4})-([0-9]{2})-([0-9]{2})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
|
384 | - $matches = array(); |
|
385 | - if(strpos($value, '-') !== false) { |
|
386 | - if(preg_match($date_match_1, $value, $matches)) { |
|
387 | - $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); |
|
388 | - } elseif(preg_match($date_match_2, $value, $matches)) { |
|
389 | - $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
|
390 | - } |
|
391 | - } |
|
392 | - // If those didn't work, use strtotime to figure out the date |
|
393 | - if($timestamp === false || $timestamp === -1) { |
|
394 | - $timestamp = strtotime($value); |
|
395 | - } |
|
396 | - return $timestamp; |
|
380 | + $timestamp = false; |
|
381 | + // Check for MySQL or legacy style date |
|
382 | + $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
|
383 | + $date_match_2 = '/^([0-9]{4})-([0-9]{2})-([0-9]{2})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
|
384 | + $matches = array(); |
|
385 | + if(strpos($value, '-') !== false) { |
|
386 | + if(preg_match($date_match_1, $value, $matches)) { |
|
387 | + $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); |
|
388 | + } elseif(preg_match($date_match_2, $value, $matches)) { |
|
389 | + $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
|
390 | + } |
|
391 | + } |
|
392 | + // If those didn't work, use strtotime to figure out the date |
|
393 | + if($timestamp === false || $timestamp === -1) { |
|
394 | + $timestamp = strtotime($value); |
|
395 | + } |
|
396 | + return $timestamp; |
|
397 | 397 | } |
@@ -15,38 +15,38 @@ discard block |
||
15 | 15 | * @param string $sep |
16 | 16 | * @return mixed|string |
17 | 17 | */ |
18 | -function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') { |
|
18 | +function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = ''){ |
|
19 | 19 | |
20 | 20 | $modx = evolutionCMS(); |
21 | 21 | $o = ''; |
22 | 22 | |
23 | 23 | // process any TV commands in value |
24 | - $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
24 | + $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier; |
|
25 | 25 | $value = ProcessTVCommand($value, $name, $docid); |
26 | 26 | |
27 | 27 | $params = array(); |
28 | - if($paramstring) { |
|
28 | + if ($paramstring) { |
|
29 | 29 | $cp = explode("&", $paramstring); |
30 | - foreach($cp as $p => $v) { |
|
30 | + foreach ($cp as $p => $v) { |
|
31 | 31 | $v = trim($v); // trim |
32 | 32 | $ar = explode("=", $v); |
33 | - if(is_array($ar) && count($ar) == 2) { |
|
33 | + if (is_array($ar) && count($ar) == 2) { |
|
34 | 34 | $params[$ar[0]] = decodeParamValue($ar[1]); |
35 | 35 | } |
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | 39 | $id = "tv$name"; |
40 | - switch($format) { |
|
40 | + switch ($format) { |
|
41 | 41 | case 'image': |
42 | 42 | $images = parseInput($value, '||', 'array'); |
43 | - foreach($images as $image) { |
|
44 | - if(!is_array($image)) { |
|
43 | + foreach ($images as $image) { |
|
44 | + if (!is_array($image)) { |
|
45 | 45 | $image = explode('==', $image); |
46 | 46 | } |
47 | 47 | $src = $image[0]; |
48 | 48 | |
49 | - if($src) { |
|
49 | + if ($src) { |
|
50 | 50 | // We have a valid source |
51 | 51 | $attributes = ''; |
52 | 52 | $attr = array( |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | 'alt' => $modx->htmlspecialchars($params['alttext']), |
57 | 57 | 'style' => $params['style'] |
58 | 58 | ); |
59 | - if(isset($params['align']) && $params['align'] != 'none') { |
|
59 | + if (isset($params['align']) && $params['align'] != 'none') { |
|
60 | 60 | $attr['align'] = $params['align']; |
61 | 61 | } |
62 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
63 | - $attributes .= ' ' . $params['attrib']; |
|
62 | + foreach ($attr as $k => $v) $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
63 | + $attributes .= ' '.$params['attrib']; |
|
64 | 64 | |
65 | 65 | // Output the image with attributes |
66 | - $o .= '<img' . rtrim($attributes) . ' />'; |
|
66 | + $o .= '<img'.rtrim($attributes).' />'; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | break; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | case "delim": // display as delimitted list |
72 | 72 | $value = parseInput($value, "||"); |
73 | 73 | $p = $params['format'] ? $params['format'] : " "; |
74 | - if($p == "\\n") { |
|
74 | + if ($p == "\\n") { |
|
75 | 75 | $p = "\n"; |
76 | 76 | } |
77 | 77 | $o = str_replace("||", $p, $value); |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | case "string": |
81 | 81 | $value = parseInput($value); |
82 | 82 | $format = strtolower($params['format']); |
83 | - if($format == 'upper case') { |
|
83 | + if ($format == 'upper case') { |
|
84 | 84 | $o = strtoupper($value); |
85 | - } else if($format == 'lower case') { |
|
85 | + } else if ($format == 'lower case') { |
|
86 | 86 | $o = strtolower($value); |
87 | - } else if($format == 'sentence case') { |
|
87 | + } else if ($format == 'sentence case') { |
|
88 | 88 | $o = ucfirst($value); |
89 | - } else if($format == 'capitalize') { |
|
89 | + } else if ($format == 'capitalize') { |
|
90 | 90 | $o = ucwords($value); |
91 | 91 | } else { |
92 | 92 | $o = $value; |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | break; |
95 | 95 | |
96 | 96 | case "date": |
97 | - if($value != '' || $params['default'] == 'Yes') { |
|
98 | - if(empty($value)) { |
|
97 | + if ($value != '' || $params['default'] == 'Yes') { |
|
98 | + if (empty($value)) { |
|
99 | 99 | $value = 'now'; |
100 | 100 | } |
101 | 101 | $timestamp = getUnixtimeFromDateString($value); |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | $value = parseInput($value, "||", "array"); |
111 | 111 | $o = ''; |
112 | 112 | $countValue = count($value); |
113 | - for($i = 0; $i < $countValue; $i++) { |
|
113 | + for ($i = 0; $i < $countValue; $i++) { |
|
114 | 114 | list($name, $url) = is_array($value[$i]) ? $value[$i] : explode("==", $value[$i]); |
115 | - if(!$url) { |
|
115 | + if (!$url) { |
|
116 | 116 | $url = $name; |
117 | 117 | } |
118 | - if($url) { |
|
119 | - if($o) { |
|
118 | + if ($url) { |
|
119 | + if ($o) { |
|
120 | 120 | $o .= '<br />'; |
121 | 121 | } |
122 | 122 | $attributes = ''; |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | 'style' => $params['style'], |
129 | 129 | 'target' => $params['target'], |
130 | 130 | ); |
131 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
132 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
131 | + foreach ($attr as $k => $v) $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
132 | + $attributes .= ' '.$params['attrib']; // add extra |
|
133 | 133 | |
134 | 134 | // Output the link |
135 | - $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>'; |
|
135 | + $o .= '<a'.rtrim($attributes).'>'.($params['text'] ? $modx->htmlspecialchars($params['text']) : $name).'</a>'; |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | break; |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | $o = ''; |
145 | 145 | // Loop through a list of tags |
146 | 146 | $countValue = count($value); |
147 | - for($i = 0; $i < $countValue; $i++) { |
|
147 | + for ($i = 0; $i < $countValue; $i++) { |
|
148 | 148 | $tagvalue = is_array($value[$i]) ? implode(' ', $value[$i]) : $value[$i]; |
149 | - if(!$tagvalue) { |
|
149 | + if (!$tagvalue) { |
|
150 | 150 | continue; |
151 | 151 | } |
152 | 152 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | 'class' => $params['class'], |
158 | 158 | 'style' => $params['style'], |
159 | 159 | ); |
160 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
161 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
160 | + foreach ($attr as $k => $v) $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
161 | + $attributes .= ' '.$params['attrib']; // add extra |
|
162 | 162 | |
163 | 163 | // Output the HTML Tag |
164 | - $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>'; |
|
164 | + $o .= '<'.$tagname.rtrim($attributes).'>'.$tagvalue.'</'.$tagname.'>'; |
|
165 | 165 | } |
166 | 166 | break; |
167 | 167 | |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | $w = $params['w'] ? $params['w'] : '100%'; |
171 | 171 | $h = $params['h'] ? $params['h'] : '400px'; |
172 | 172 | $richtexteditor = $params['edt'] ? $params['edt'] : ""; |
173 | - $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">'; |
|
173 | + $o = '<div class="MODX_RichTextWidget"><textarea id="'.$id.'" name="'.$id.'" style="width:'.$w.'; height:'.$h.';">'; |
|
174 | 174 | $o .= $modx->htmlspecialchars($value); |
175 | 175 | $o .= '</textarea></div>'; |
176 | 176 | $replace_richtext = array($id); |
177 | 177 | // setup editors |
178 | - if(!empty($replace_richtext) && !empty($richtexteditor)) { |
|
178 | + if (!empty($replace_richtext) && !empty($richtexteditor)) { |
|
179 | 179 | // invoke OnRichTextEditorInit event |
180 | 180 | $evtOut = $modx->invokeEvent("OnRichTextEditorInit", array( |
181 | 181 | 'editor' => $richtexteditor, |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | 'width' => $w, |
185 | 185 | 'height' => $h |
186 | 186 | )); |
187 | - if(is_array($evtOut)) { |
|
187 | + if (is_array($evtOut)) { |
|
188 | 188 | $o .= implode("", $evtOut); |
189 | 189 | } |
190 | 190 | } |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | |
198 | 198 | case "viewport": |
199 | 199 | $value = parseInput($value); |
200 | - $id = '_' . time(); |
|
201 | - if(!$params['vpid']) { |
|
200 | + $id = '_'.time(); |
|
201 | + if (!$params['vpid']) { |
|
202 | 202 | $params['vpid'] = $id; |
203 | 203 | } |
204 | 204 | $sTag = "<iframe"; |
@@ -206,42 +206,42 @@ discard block |
||
206 | 206 | $autoMode = "0"; |
207 | 207 | $w = $params['width']; |
208 | 208 | $h = $params['height']; |
209 | - if($params['stretch'] == 'Yes') { |
|
209 | + if ($params['stretch'] == 'Yes') { |
|
210 | 210 | $w = "100%"; |
211 | 211 | $h = "100%"; |
212 | 212 | } |
213 | - if($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
|
214 | - $autoMode = "3"; //both |
|
215 | - } else if($params['awidth'] == 'Yes') { |
|
213 | + if ($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
|
214 | + $autoMode = "3"; //both |
|
215 | + } else if ($params['awidth'] == 'Yes') { |
|
216 | 216 | $autoMode = "1"; //width only |
217 | - } else if($params['aheight'] == 'Yes') { |
|
218 | - $autoMode = "2"; //height only |
|
217 | + } else if ($params['aheight'] == 'Yes') { |
|
218 | + $autoMode = "2"; //height only |
|
219 | 219 | } |
220 | 220 | |
221 | - $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array( |
|
221 | + $modx->regClientStartupScript(MODX_MANAGER_URL."media/script/bin/viewport.js", array( |
|
222 | 222 | 'name' => 'viewport', |
223 | 223 | 'version' => '0', |
224 | 224 | 'plaintext' => false |
225 | 225 | )); |
226 | - $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' "; |
|
227 | - if($params['class']) { |
|
228 | - $o .= " class='" . $params['class'] . "' "; |
|
226 | + $o = $sTag." id='".$params['vpid']."' name='".$params['vpid']."' "; |
|
227 | + if ($params['class']) { |
|
228 | + $o .= " class='".$params['class']."' "; |
|
229 | 229 | } |
230 | - if($params['style']) { |
|
231 | - $o .= " style='" . $params['style'] . "' "; |
|
230 | + if ($params['style']) { |
|
231 | + $o .= " style='".$params['style']."' "; |
|
232 | 232 | } |
233 | - if($params['attrib']) { |
|
234 | - $o .= $params['attrib'] . " "; |
|
233 | + if ($params['attrib']) { |
|
234 | + $o .= $params['attrib']." "; |
|
235 | 235 | } |
236 | - $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' "; |
|
237 | - $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' "; |
|
238 | - $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' "; |
|
236 | + $o .= "scrolling='".($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto"))."' "; |
|
237 | + $o .= "src='".$value."' frameborder='".$params['borsize']."' "; |
|
238 | + $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'".$params['vpid']."\\',".$autoMode.")',100);\" width='".$w."' height='".$h."' "; |
|
239 | 239 | $o .= ">"; |
240 | 240 | $o .= $eTag; |
241 | 241 | break; |
242 | 242 | |
243 | 243 | case "datagrid": |
244 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
244 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
245 | 245 | $grd = new DataGrid('', $value); |
246 | 246 | |
247 | 247 | $grd->noRecordMsg = $params['egmsg']; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | case 'htmlentities': |
278 | 278 | $value = parseInput($value); |
279 | - if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
279 | + if ($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
280 | 280 | // remove delimiter from checkbox and listbox-multiple TVs |
281 | 281 | $value = str_replace('||', '', $value); |
282 | 282 | } |
@@ -287,33 +287,33 @@ discard block |
||
287 | 287 | $widget_output = ''; |
288 | 288 | $o = ''; |
289 | 289 | /* If we are loading a file */ |
290 | - if(substr($params['output'], 0, 5) == "@FILE") { |
|
291 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6)); |
|
292 | - if(!file_exists($file_name)) { |
|
293 | - $widget_output = $file_name . ' does not exist'; |
|
290 | + if (substr($params['output'], 0, 5) == "@FILE") { |
|
291 | + $file_name = MODX_BASE_PATH.trim(substr($params['output'], 6)); |
|
292 | + if (!file_exists($file_name)) { |
|
293 | + $widget_output = $file_name.' does not exist'; |
|
294 | 294 | } else { |
295 | 295 | $widget_output = file_get_contents($file_name); |
296 | 296 | } |
297 | - } elseif(substr($params['output'], 0, 8) == '@INCLUDE') { |
|
298 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9)); |
|
299 | - if(!file_exists($file_name)) { |
|
300 | - $widget_output = $file_name . ' does not exist'; |
|
297 | + } elseif (substr($params['output'], 0, 8) == '@INCLUDE') { |
|
298 | + $file_name = MODX_BASE_PATH.trim(substr($params['output'], 9)); |
|
299 | + if (!file_exists($file_name)) { |
|
300 | + $widget_output = $file_name.' does not exist'; |
|
301 | 301 | } else { |
302 | 302 | /* The included file needs to set $widget_output. Can be string, array, object */ |
303 | 303 | include $file_name; |
304 | 304 | } |
305 | - } elseif(substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') { |
|
305 | + } elseif (substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') { |
|
306 | 306 | $chunk_name = trim(substr($params['output'], 7)); |
307 | 307 | $widget_output = $modx->getChunk($chunk_name); |
308 | - } elseif(substr($params['output'], 0, 5) == '@EVAL' && $value !== '') { |
|
308 | + } elseif (substr($params['output'], 0, 5) == '@EVAL' && $value !== '') { |
|
309 | 309 | $eval_str = trim(substr($params['output'], 6)); |
310 | 310 | $widget_output = eval($eval_str); |
311 | - } elseif($value !== '') { |
|
311 | + } elseif ($value !== '') { |
|
312 | 312 | $widget_output = $params['output']; |
313 | 313 | } else { |
314 | 314 | $widget_output = ''; |
315 | 315 | } |
316 | - if(is_string($widget_output)) { |
|
316 | + if (is_string($widget_output)) { |
|
317 | 317 | $_ = $modx->config['enable_filter']; |
318 | 318 | $modx->config['enable_filter'] = 1; |
319 | 319 | $widget_output = $modx->parseText($widget_output, array('value' => $value)); |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | |
327 | 327 | default: |
328 | 328 | $value = parseInput($value); |
329 | - if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
329 | + if ($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
330 | 330 | // add separator |
331 | 331 | $value = explode('||', $value); |
332 | 332 | $value = implode($sep, $value); |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * @param string $s |
342 | 342 | * @return string |
343 | 343 | */ |
344 | -function decodeParamValue($s) { |
|
344 | +function decodeParamValue($s){ |
|
345 | 345 | $s = str_replace("%3D", '=', $s); // = |
346 | 346 | return str_replace("%26", '&', $s); // & |
347 | 347 | } |
@@ -355,16 +355,16 @@ discard block |
||
355 | 355 | * @param bool $columns |
356 | 356 | * @return array|string |
357 | 357 | */ |
358 | -function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array |
|
358 | +function parseInput($src, $delim = "||", $type = "string", $columns = true){ // type can be: string, array |
|
359 | 359 | $modx = evolutionCMS(); |
360 | - if($modx->db->isResult($src)) { |
|
360 | + if ($modx->db->isResult($src)) { |
|
361 | 361 | // must be a recordset |
362 | 362 | $rows = array(); |
363 | - while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
363 | + while ($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
364 | 364 | return ($type == "array") ? $rows : implode($delim, $rows); |
365 | 365 | } else { |
366 | 366 | // must be a text |
367 | - if($type == "array") { |
|
367 | + if ($type == "array") { |
|
368 | 368 | return explode($delim, $src); |
369 | 369 | } else { |
370 | 370 | return $src; |
@@ -376,21 +376,21 @@ discard block |
||
376 | 376 | * @param string $value |
377 | 377 | * @return bool|false|int |
378 | 378 | */ |
379 | -function getUnixtimeFromDateString($value) { |
|
379 | +function getUnixtimeFromDateString($value){ |
|
380 | 380 | $timestamp = false; |
381 | 381 | // Check for MySQL or legacy style date |
382 | 382 | $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
383 | 383 | $date_match_2 = '/^([0-9]{4})-([0-9]{2})-([0-9]{2})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
384 | 384 | $matches = array(); |
385 | - if(strpos($value, '-') !== false) { |
|
386 | - if(preg_match($date_match_1, $value, $matches)) { |
|
385 | + if (strpos($value, '-') !== false) { |
|
386 | + if (preg_match($date_match_1, $value, $matches)) { |
|
387 | 387 | $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); |
388 | - } elseif(preg_match($date_match_2, $value, $matches)) { |
|
388 | + } elseif (preg_match($date_match_2, $value, $matches)) { |
|
389 | 389 | $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
390 | 390 | } |
391 | 391 | } |
392 | 392 | // If those didn't work, use strtotime to figure out the date |
393 | - if($timestamp === false || $timestamp === -1) { |
|
393 | + if ($timestamp === false || $timestamp === -1) { |
|
394 | 394 | $timestamp = strtotime($value); |
395 | 395 | } |
396 | 396 | return $timestamp; |
@@ -15,7 +15,8 @@ discard block |
||
15 | 15 | * @param string $sep |
16 | 16 | * @return mixed|string |
17 | 17 | */ |
18 | -function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') { |
|
18 | +function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') |
|
19 | +{ |
|
19 | 20 | |
20 | 21 | $modx = evolutionCMS(); |
21 | 22 | $o = ''; |
@@ -59,7 +60,9 @@ discard block |
||
59 | 60 | if(isset($params['align']) && $params['align'] != 'none') { |
60 | 61 | $attr['align'] = $params['align']; |
61 | 62 | } |
62 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
63 | + foreach($attr as $k => $v) { |
|
64 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
65 | + } |
|
63 | 66 | $attributes .= ' ' . $params['attrib']; |
64 | 67 | |
65 | 68 | // Output the image with attributes |
@@ -128,7 +131,9 @@ discard block |
||
128 | 131 | 'style' => $params['style'], |
129 | 132 | 'target' => $params['target'], |
130 | 133 | ); |
131 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
134 | + foreach($attr as $k => $v) { |
|
135 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
136 | + } |
|
132 | 137 | $attributes .= ' ' . $params['attrib']; // add extra |
133 | 138 | |
134 | 139 | // Output the link |
@@ -157,7 +162,9 @@ discard block |
||
157 | 162 | 'class' => $params['class'], |
158 | 163 | 'style' => $params['style'], |
159 | 164 | ); |
160 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
165 | + foreach($attr as $k => $v) { |
|
166 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
167 | + } |
|
161 | 168 | $attributes .= ' ' . $params['attrib']; // add extra |
162 | 169 | |
163 | 170 | // Output the HTML Tag |
@@ -341,7 +348,8 @@ discard block |
||
341 | 348 | * @param string $s |
342 | 349 | * @return string |
343 | 350 | */ |
344 | -function decodeParamValue($s) { |
|
351 | +function decodeParamValue($s) |
|
352 | +{ |
|
345 | 353 | $s = str_replace("%3D", '=', $s); // = |
346 | 354 | return str_replace("%26", '&', $s); // & |
347 | 355 | } |
@@ -355,12 +363,16 @@ discard block |
||
355 | 363 | * @param bool $columns |
356 | 364 | * @return array|string |
357 | 365 | */ |
358 | -function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array |
|
366 | +function parseInput($src, $delim = "||", $type = "string", $columns = true) |
|
367 | +{ |
|
368 | +// type can be: string, array |
|
359 | 369 | $modx = evolutionCMS(); |
360 | 370 | if($modx->db->isResult($src)) { |
361 | 371 | // must be a recordset |
362 | 372 | $rows = array(); |
363 | - while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
373 | + while($cols = $modx->db->getRow($src, 'num')) { |
|
374 | + $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
375 | + } |
|
364 | 376 | return ($type == "array") ? $rows : implode($delim, $rows); |
365 | 377 | } else { |
366 | 378 | // must be a text |
@@ -376,7 +388,8 @@ discard block |
||
376 | 388 | * @param string $value |
377 | 389 | * @return bool|false|int |
378 | 390 | */ |
379 | -function getUnixtimeFromDateString($value) { |
|
391 | +function getUnixtimeFromDateString($value) |
|
392 | +{ |
|
380 | 393 | $timestamp = false; |
381 | 394 | // Check for MySQL or legacy style date |
382 | 395 | $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | class DATEPICKER { |
4 | - function __construct() { |
|
5 | - } |
|
4 | + function __construct() { |
|
5 | + } |
|
6 | 6 | |
7 | - function getDP() { |
|
8 | - $modx = evolutionCMS(); global $_lang; |
|
7 | + function getDP() { |
|
8 | + $modx = evolutionCMS(); global $_lang; |
|
9 | 9 | |
10 | - $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
|
11 | - return $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
12 | - } |
|
10 | + $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
|
11 | + return $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
12 | + } |
|
13 | 13 | } |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class DATEPICKER { |
|
4 | - function __construct() { |
|
3 | +class DATEPICKER{ |
|
4 | + function __construct(){ |
|
5 | 5 | } |
6 | 6 | |
7 | - function getDP() { |
|
7 | + function getDP(){ |
|
8 | 8 | $modx = evolutionCMS(); global $_lang; |
9 | 9 | |
10 | - $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
|
10 | + $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
|
11 | 11 | return $modx->parseText($tpl, $_lang, '[%', '%]'); |
12 | 12 | } |
13 | 13 | } |
@@ -1,10 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class DATEPICKER { |
|
4 | - function __construct() { |
|
3 | +class DATEPICKER |
|
4 | +{ |
|
5 | + function __construct() |
|
6 | + { |
|
5 | 7 | } |
6 | 8 | |
7 | - function getDP() { |
|
9 | + function getDP() |
|
10 | + { |
|
8 | 11 | $modx = evolutionCMS(); global $_lang; |
9 | 12 | |
10 | 13 | $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | -class DATEPICKER { |
|
3 | - function __construct() { |
|
2 | +class DATEPICKER{ |
|
3 | + function __construct(){ |
|
4 | 4 | } |
5 | - function getDP() { |
|
5 | + function getDP(){ |
|
6 | 6 | $modx = evolutionCMS(); global$_lang; |
7 | 7 | |
8 | 8 | $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
9 | - return $modx->parseText($tpl,$_lang,'[%','%]'); |
|
9 | + return $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
10 | 10 | } |
11 | 11 | } |
@@ -1,8 +1,11 @@ |
||
1 | 1 | <?php |
2 | -class DATEPICKER { |
|
3 | - function __construct() { |
|
2 | +class DATEPICKER |
|
3 | +{ |
|
4 | + function __construct() |
|
5 | + { |
|
4 | 6 | } |
5 | - function getDP() { |
|
7 | + function getDP() |
|
8 | + { |
|
6 | 9 | $modx = evolutionCMS(); global$_lang; |
7 | 10 | |
8 | 11 | $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | -class DATEPICKER { |
|
2 | +class DATEPICKER{ |
|
3 | 3 | /** |
4 | 4 | * @return string |
5 | 5 | */ |
6 | - public function getDP() { |
|
6 | + public function getDP(){ |
|
7 | 7 | $modx = evolutionCMS(); |
8 | 8 | |
9 | 9 | $load_script = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
10 | - if(!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode(); |
|
10 | + if (!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode(); |
|
11 | 11 | $modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy'; |
12 | 12 | return $modx->mergeSettingsContent($load_script); |
13 | 13 | } |
@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * @return string |
17 | 17 | */ |
18 | - public function getLangCode() { |
|
18 | + public function getLangCode(){ |
|
19 | 19 | $modx = evolutionCMS(); global $modx_lang_attribute; |
20 | 20 | |
21 | - if(!$modx_lang_attribute) return 'en'; |
|
21 | + if (!$modx_lang_attribute) return 'en'; |
|
22 | 22 | |
23 | 23 | $lc = $modx_lang_attribute; |
24 | - if($lc === 'uk') return 'ru'; |
|
25 | - $dp_path = str_replace('\\','/',dirname(__FILE__)); |
|
24 | + if ($lc === 'uk') return 'ru'; |
|
25 | + $dp_path = str_replace('\\', '/', dirname(__FILE__)); |
|
26 | 26 | |
27 | 27 | return (is_file("{$dp_path}/i18n/datepicker.{$lc}.js")) ? $modx_lang_attribute : 'en'; |
28 | 28 | } |
@@ -1,13 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | -class DATEPICKER { |
|
2 | +class DATEPICKER |
|
3 | +{ |
|
3 | 4 | /** |
4 | 5 | * @return string |
5 | 6 | */ |
6 | - public function getDP() { |
|
7 | + public function getDP() |
|
8 | + { |
|
7 | 9 | $modx = evolutionCMS(); |
8 | 10 | |
9 | 11 | $load_script = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
10 | - if(!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode(); |
|
12 | + if(!isset($modx->config['lang_code'])) { |
|
13 | + $modx->config['lang_code'] = $this->getLangCode(); |
|
14 | + } |
|
11 | 15 | $modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy'; |
12 | 16 | return $modx->mergeSettingsContent($load_script); |
13 | 17 | } |
@@ -15,13 +19,18 @@ discard block |
||
15 | 19 | /** |
16 | 20 | * @return string |
17 | 21 | */ |
18 | - public function getLangCode() { |
|
22 | + public function getLangCode() |
|
23 | + { |
|
19 | 24 | $modx = evolutionCMS(); global $modx_lang_attribute; |
20 | 25 | |
21 | - if(!$modx_lang_attribute) return 'en'; |
|
26 | + if(!$modx_lang_attribute) { |
|
27 | + return 'en'; |
|
28 | + } |
|
22 | 29 | |
23 | 30 | $lc = $modx_lang_attribute; |
24 | - if($lc === 'uk') return 'ru'; |
|
31 | + if($lc === 'uk') { |
|
32 | + return 'ru'; |
|
33 | + } |
|
25 | 34 | $dp_path = str_replace('\\','/',dirname(__FILE__)); |
26 | 35 | |
27 | 36 | return (is_file("{$dp_path}/i18n/datepicker.{$lc}.js")) ? $modx_lang_attribute : 'en'; |