Completed
Push — develop ( d568f8...c061fc )
by Agel_Nash
06:25
created
manager/includes/config_check.inc.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
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
 }
@@ -123,34 +123,34 @@  discard block
 block discarded – undo
123 123
     function checkSiteCache()
124 124
     {
125 125
         $modx = evolutionCMS();
126
-        $checked= true;
127
-        if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) {
128
-            $checked= @include_once($modx->config['base_path'] . 'assets/cache/siteCache.idx.php');
126
+        $checked = true;
127
+        if (file_exists($modx->config['base_path'].'assets/cache/siteCache.idx.php')) {
128
+            $checked = @include_once($modx->config['base_path'].'assets/cache/siteCache.idx.php');
129 129
         }
130 130
         return $checked;
131 131
     }
132 132
 }
133 133
 
134
-if (!is_writable(MODX_BASE_PATH . "assets/cache/")) {
134
+if (!is_writable(MODX_BASE_PATH."assets/cache/")) {
135 135
     $warningspresent = 1;
136 136
     $warnings[] = array($_lang['configcheck_cache']);
137 137
 }
138 138
 
139 139
 if (!checkSiteCache()) {
140 140
     $warningspresent = 1;
141
-    $warnings[]= array($lang['configcheck_sitecache_integrity']);
141
+    $warnings[] = array($lang['configcheck_sitecache_integrity']);
142 142
 }
143 143
 
144
-if (!is_writable(MODX_BASE_PATH . "assets/images/")) {
144
+if (!is_writable(MODX_BASE_PATH."assets/images/")) {
145 145
     $warningspresent = 1;
146 146
     $warnings[] = array($_lang['configcheck_images']);
147 147
 }
148 148
 
149
-if (strpos($modx->config['rb_base_dir'], MODX_BASE_PATH)!==0) {
149
+if (strpos($modx->config['rb_base_dir'], MODX_BASE_PATH) !== 0) {
150 150
     $warningspresent = 1;
151 151
     $warnings[] = array($_lang['configcheck_rb_base_dir']);
152 152
 }
153
-if (strpos($modx->config['filemanager_path'], MODX_BASE_PATH)!==0) {
153
+if (strpos($modx->config['filemanager_path'], MODX_BASE_PATH) !== 0) {
154 154
     $warningspresent = 1;
155 155
     $warnings[] = array($_lang['configcheck_filemanager_path']);
156 156
 }
@@ -158,13 +158,13 @@  discard block
 block discarded – undo
158 158
 // clear file info cache
159 159
 clearstatcache();
160 160
 
161
-if ($warningspresent==1) {
161
+if ($warningspresent == 1) {
162 162
     if (!isset($modx->config['send_errormail'])) {
163
-        $modx->config['send_errormail']='3';
163
+        $modx->config['send_errormail'] = '3';
164 164
     }
165
-    $config_check_results = "<h3>" . $_lang['configcheck_notok'] . "</h3>";
165
+    $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>";
166 166
 
167
-    for ($i=0;$i<count($warnings);$i++) {
167
+    for ($i = 0; $i < count($warnings); $i++) {
168 168
         switch ($warnings[$i][0]) {
169 169
         case $_lang['configcheck_configinc']:
170 170
             $warnings[$i][1] = $_lang['configcheck_configinc_msg'];
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
             break;
193 193
         case $_lang['configcheck_sysfiles_mod']:
194 194
             $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"];
195
-            $warnings[$i][2] = '<ul><li>' . implode('</li><li>', $sysfiles_check) . '</li></ul>';
195
+            $warnings[$i][2] = '<ul><li>'.implode('</li><li>', $sysfiles_check).'</li></ul>';
196 196
             if ($modx->hasPermission('settings')) {
197
-                $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>';
197
+                $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>';
198 198
             }
199 199
             if (!$_SESSION["mgrConfigCheck"]) {
200
-                $modx->logEvent(0, 3, $warnings[$i][1] . " " . implode(', ', $sysfiles_check), $_lang['configcheck_sysfiles_mod']);
200
+                $modx->logEvent(0, 3, $warnings[$i][1]." ".implode(', ', $sysfiles_check), $_lang['configcheck_sysfiles_mod']);
201 201
             }
202 202
             break;
203 203
         case $_lang['configcheck_lang_difference']:
@@ -220,18 +220,18 @@  discard block
 block discarded – undo
220 220
             break;
221 221
         case $_lang['configcheck_validate_referer']:
222 222
             $msg = $_lang['configcheck_validate_referer_msg'];
223
-            $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'validate_referer');
223
+            $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'validate_referer');
224 224
             $warnings[$i][1] = "<span id=\"validate_referer_warning_wrapper\">{$msg}</span>\n";
225 225
             break;
226 226
         case $_lang['configcheck_templateswitcher_present']:
227 227
             $msg = $_lang["configcheck_templateswitcher_present_msg"];
228 228
             if (isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') {
229
-                $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_disable"];
229
+                $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_disable"];
230 230
             }
231 231
             if (isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') {
232
-                $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_delete"];
232
+                $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_delete"];
233 233
             }
234
-            $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present');
234
+            $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present');
235 235
             $warnings[$i][1] = "<span id=\"templateswitcher_present_warning_wrapper\">{$msg}</span>\n";
236 236
             break;
237 237
         case $_lang['configcheck_rb_base_dir']:
@@ -244,20 +244,20 @@  discard block
 block discarded – undo
244 244
             $warnings[$i][1] = $_lang['configcheck_default_msg'];
245 245
     }
246 246
 
247
-        $admin_warning = $_SESSION['mgrRole']!=1 ? $_lang['configcheck_admin'] : "" ;
247
+        $admin_warning = $_SESSION['mgrRole'] != 1 ? $_lang['configcheck_admin'] : "";
248 248
         $config_check_results .= "
249 249
             <fieldset>
250
-            <p><strong>" . $_lang['configcheck_warning'] . "</strong> '" . $warnings[$i][0] . "'</p>
251
-            <p style=\"padding-left:1em\"><em>" . $_lang['configcheck_what'] . "</em><br />
252
-            " . $warnings[$i][1] . " " . $admin_warning . "</p>
253
-            " . (isset($warnings[$i][2]) ? '<div style="padding-left:1em">' . $warnings[$i][2] . '</div>' : '') . "
250
+            <p><strong>" . $_lang['configcheck_warning']."</strong> '".$warnings[$i][0]."'</p>
251
+            <p style=\"padding-left:1em\"><em>" . $_lang['configcheck_what']."</em><br />
252
+            " . $warnings[$i][1]." ".$admin_warning."</p>
253
+            " . (isset($warnings[$i][2]) ? '<div style="padding-left:1em">'.$warnings[$i][2].'</div>' : '')."
254 254
             </fieldset>
255 255
 ";
256
-        if ($i!=count($warnings)-1) {
256
+        if ($i != count($warnings) - 1) {
257 257
             $config_check_results .= "<br />";
258 258
         }
259 259
     }
260
-    $_SESSION["mgrConfigCheck"]=true;
260
+    $_SESSION["mgrConfigCheck"] = true;
261 261
 } else {
262 262
     $config_check_results = $_lang['configcheck_ok'];
263 263
 }
Please login to merge, or discard this patch.
manager/includes/document.parser.class.inc.php 1 patch
Spacing   +251 added lines, -251 removed lines patch added patch discarded remove patch
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
      */
226 226
     public function __call($method_name, $arguments)
227 227
     {
228
-        include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php');
228
+        include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php');
229 229
         if (method_exists($this->old, $method_name)) {
230 230
             $error_type = 1;
231 231
         } else {
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
             $info = debug_backtrace();
244 244
             $m[] = $msg;
245 245
             if (!empty($this->currentSnippet)) {
246
-                $m[] = 'Snippet - ' . $this->currentSnippet;
246
+                $m[] = 'Snippet - '.$this->currentSnippet;
247 247
             } elseif (!empty($this->event->activePlugin)) {
248
-                $m[] = 'Plugin - ' . $this->event->activePlugin;
248
+                $m[] = 'Plugin - '.$this->event->activePlugin;
249 249
             }
250 250
             $m[] = $this->decoded_request_uri;
251
-            $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')';
251
+            $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')';
252 252
             $msg = implode('<br />', $m);
253 253
             $this->logEvent(0, $error_type, $msg, $title);
254 254
         }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     {
266 266
         $flag = false;
267 267
         if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) {
268
-            $flag = (bool)$this->{$connector}->conn;
268
+            $flag = (bool) $this->{$connector}->conn;
269 269
         }
270 270
         return $flag;
271 271
     }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         }
293 293
         if (!$out && $flag) {
294 294
             $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname)));
295
-            $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php";
295
+            $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php";
296 296
             $out = is_file($filename) ? include $filename : false;
297 297
         }
298 298
         if ($out && !in_array($extname, $this->extensions)) {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     public function getMicroTime()
310 310
     {
311 311
         list($usec, $sec) = explode(' ', microtime());
312
-        return ((float)$usec + (float)$sec);
312
+        return ((float) $usec + (float) $sec);
313 313
     }
314 314
 
315 315
     /**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
             // append the redirect count string to the url
334 334
             $currentNumberOfRedirects = isset($_REQUEST['err']) ? $_REQUEST['err'] : 0;
335 335
             if ($currentNumberOfRedirects > 3) {
336
-                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>');
336
+                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>');
337 337
             } else {
338 338
                 $currentNumberOfRedirects += 1;
339 339
                 if (strpos($url, "?") > 0) {
@@ -344,9 +344,9 @@  discard block
 block discarded – undo
344 344
             }
345 345
         }
346 346
         if ($type == 'REDIRECT_REFRESH') {
347
-            $header = 'Refresh: 0;URL=' . $url;
347
+            $header = 'Refresh: 0;URL='.$url;
348 348
         } elseif ($type == 'REDIRECT_META') {
349
-            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />';
349
+            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />';
350 350
             echo $header;
351 351
             exit;
352 352
         } elseif ($type == 'REDIRECT_HEADER' || empty($type)) {
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
             global $base_url, $site_url;
355 355
             if (substr($url, 0, strlen($base_url)) == $base_url) {
356 356
                 // append $site_url to make it work with Location:
357
-                $url = $site_url . substr($url, strlen($base_url));
357
+                $url = $site_url.substr($url, strlen($base_url));
358 358
             }
359 359
             if (strpos($url, "\n") === false) {
360
-                $header = 'Location: ' . $url;
360
+                $header = 'Location: '.$url;
361 361
             } else {
362 362
                 $this->messageQuit('No newline allowed in redirect url.');
363 363
             }
@@ -471,8 +471,8 @@  discard block
 block discarded – undo
471 471
 
472 472
     private function recoverySiteCache()
473 473
     {
474
-        $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
475
-        $site_cache_path = $site_cache_dir . 'siteCache.idx.php';
474
+        $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
475
+        $site_cache_path = $site_cache_dir.'siteCache.idx.php';
476 476
 
477 477
         if (is_file($site_cache_path)) {
478 478
             include($site_cache_path);
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
             return;
482 482
         }
483 483
 
484
-        include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
484
+        include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
485 485
         $cache = new synccache();
486 486
         $cache->setCachepath($site_cache_dir);
487 487
         $cache->setReport(false);
@@ -533,8 +533,8 @@  discard block
 block discarded – undo
533 533
                 $this->invokeEvent("OnBeforeManagerPageInit");
534 534
             }
535 535
 
536
-            if (isset($_SESSION[$usrType . 'UsrConfigSet'])) {
537
-                $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet'];
536
+            if (isset($_SESSION[$usrType.'UsrConfigSet'])) {
537
+                $usrSettings = &$_SESSION[$usrType.'UsrConfigSet'];
538 538
             } else {
539 539
                 if ($usrType == 'web') {
540 540
                     $from = $tbl_web_user_settings;
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
                     $usrSettings[$row['setting_name']] = $row['setting_value'];
555 555
                 }
556 556
                 if (isset($usrType)) {
557
-                    $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
557
+                    $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings;
558 558
                 } // store user settings in session
559 559
             }
560 560
         }
@@ -699,10 +699,10 @@  discard block
 block discarded – undo
699 699
         $suf = $this->config['friendly_url_suffix'];
700 700
         $pre = preg_quote($pre, '/');
701 701
         $suf = preg_quote($suf, '/');
702
-        if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) {
702
+        if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) {
703 703
             $q = $_[1];
704 704
         }
705
-        if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) {
705
+        if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) {
706 706
             $q = $_[1];
707 707
         }
708 708
 
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
         if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */
725 725
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
726 726
             if ($this->config['use_alias_path'] == 1) {
727
-                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, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
727
+                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, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
728 728
                     $this->documentMethod = 'id';
729 729
                     return $q;
730 730
                 } else { /* not a valid id in terms of virtualDir, treat as alias */
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
      */
759 759
     public function getHashFile($key)
760 760
     {
761
-        return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php";
761
+        return $this->getCacheFolder()."docid_".$key.".pageCache.php";
762 762
     }
763 763
 
764 764
     /**
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
778 778
                 $params = $_GET;
779 779
                 ksort($params);
780
-                $hash .= '_' . md5(http_build_query($params));
780
+                $hash .= '_'.md5(http_build_query($params));
781 781
             }
782 782
         }
783 783
         $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params));
@@ -923,12 +923,12 @@  discard block
 block discarded – undo
923 923
         if ($js = $this->getRegisteredClientStartupScripts()) {
924 924
             // change to just before closing </head>
925 925
             // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent);
926
-            $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput);
926
+            $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput);
927 927
         }
928 928
 
929 929
         // Insert jscripts & html block into template - template must have a </body> tag
930 930
         if ($js = $this->getRegisteredClientScripts()) {
931
-            $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput);
931
+            $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput);
932 932
         }
933 933
         // End fix by sirlancelot
934 934
 
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
         // send out content-type and content-disposition headers
940 940
         if (IN_PARSER_MODE == "true") {
941 941
             $type = !empty($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html";
942
-            header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']);
942
+            header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']);
943 943
             //            if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error)
944 944
             //                header('HTTP/1.0 404 Not Found');
945 945
             if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) {
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
                     $name = preg_replace('|-+|', '-', $name);
958 958
                     $name = trim($name, '-');
959 959
                 }
960
-                $header = 'Content-Disposition: attachment; filename=' . $name;
960
+                $header = 'Content-Disposition: attachment; filename='.$name;
961 961
                 header($header);
962 962
             }
963 963
         }
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 
966 966
         $stats = $this->getTimerStats($this->tstart);
967 967
 
968
-        $out =& $this->documentOutput;
968
+        $out = & $this->documentOutput;
969 969
         $out = str_replace("[^q^]", $stats['queries'], $out);
970 970
         $out = str_replace("[^qt^]", $stats['queryTime'], $out);
971 971
         $out = str_replace("[^p^]", $stats['phpTime'], $out);
@@ -1004,17 +1004,17 @@  discard block
 block discarded – undo
1004 1004
                 $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet
1005 1005
                 $tt += $t;
1006 1006
             }
1007
-            echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />";
1007
+            echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />";
1008 1008
             echo $this->snippetsCode;
1009 1009
         }
1010 1010
         if ($this->dumpPlugins) {
1011 1011
             $ps = "";
1012 1012
             $tt = 0;
1013 1013
             foreach ($this->pluginsTime as $s => $t) {
1014
-                $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>";
1014
+                $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>";
1015 1015
                 $tt += $t;
1016 1016
             }
1017
-            echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />";
1017
+            echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />";
1018 1018
             echo $this->pluginsCode;
1019 1019
         }
1020 1020
 
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
         $srcTags = explode(',', $tags);
1041 1041
         $repTags = array();
1042 1042
         foreach ($srcTags as $tag) {
1043
-            $repTags[] = '\\' . $tag[0] . '\\' . $tag[1];
1043
+            $repTags[] = '\\'.$tag[0].'\\'.$tag[1];
1044 1044
         }
1045 1045
         return array($srcTags, $repTags);
1046 1046
     }
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
         $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']);
1063 1063
         $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache";
1064 1064
         $stats['queries'] = isset($this->executedQueries) ? $this->executedQueries : 0;
1065
-        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb";
1065
+        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb";
1066 1066
 
1067 1067
         return $stats;
1068 1068
     }
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
     {
1096 1096
         $cacheRefreshTime = 0;
1097 1097
         $recent_update = 0;
1098
-        @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php');
1098
+        @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php');
1099 1099
         $this->recentUpdate = $recent_update;
1100 1100
 
1101 1101
         $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time'];
@@ -1165,8 +1165,8 @@  discard block
 block discarded – undo
1165 1165
                 }
1166 1166
 
1167 1167
                 $docObjSerial = serialize($this->documentObject);
1168
-                $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;
1169
-                $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey);
1168
+                $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent;
1169
+                $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey);
1170 1170
                 file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent");
1171 1171
             }
1172 1172
         }
@@ -1208,16 +1208,16 @@  discard block
 block discarded – undo
1208 1208
             return array();
1209 1209
         }
1210 1210
         $spacer = md5('<<<EVO>>>');
1211
-        if ($left==='{{' && strpos($content, ';}}')!==false) {
1211
+        if ($left === '{{' && strpos($content, ';}}') !== false) {
1212 1212
             $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content);
1213 1213
         }
1214
-        if ($left==='{{' && strpos($content, '{{}}')!==false) {
1214
+        if ($left === '{{' && strpos($content, '{{}}') !== false) {
1215 1215
             $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content);
1216 1216
         }
1217
-        if ($left==='[[' && strpos($content, ']]]]')!==false) {
1217
+        if ($left === '[[' && strpos($content, ']]]]') !== false) {
1218 1218
             $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content);
1219 1219
         }
1220
-        if ($left==='[[' && strpos($content, ']]]')!==false) {
1220
+        if ($left === '[[' && strpos($content, ']]]') !== false) {
1221 1221
             $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content);
1222 1222
         }
1223 1223
 
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
         $pos[']]>'] = strpos($content, ']]>');
1226 1226
 
1227 1227
         if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) {
1228
-            $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3);
1228
+            $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3);
1229 1229
         }
1230 1230
 
1231 1231
         $lp = explode($left, $content);
@@ -1290,7 +1290,7 @@  discard block
 block discarded – undo
1290 1290
             }
1291 1291
         }
1292 1292
         foreach ($tags as $i=>$tag) {
1293
-            if (strpos($tag, $spacer)!==false) {
1293
+            if (strpos($tag, $spacer) !== false) {
1294 1294
                 $tags[$i] = str_replace($spacer, '', $tag);
1295 1295
             }
1296 1296
         }
@@ -1332,7 +1332,7 @@  discard block
 block discarded – undo
1332 1332
         }
1333 1333
 
1334 1334
         foreach ($matches[1] as $i => $key) {
1335
-            if (strpos($key, '[+')!==false) {
1335
+            if (strpos($key, '[+') !== false) {
1336 1336
                 continue;
1337 1337
             } // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1338 1338
             if (substr($key, 0, 1) == '#') {
@@ -1354,8 +1354,8 @@  discard block
 block discarded – undo
1354 1354
             }
1355 1355
 
1356 1356
             if (is_array($value)) {
1357
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php');
1358
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php');
1357
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php');
1358
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php');
1359 1359
                 $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]);
1360 1360
             }
1361 1361
 
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
             if (strpos($content, $s) !== false) {
1368 1368
                 $content = str_replace($s, $value, $content);
1369 1369
             } elseif ($this->debug) {
1370
-                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1370
+                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1371 1371
             }
1372 1372
         }
1373 1373
 
@@ -1535,7 +1535,7 @@  discard block
 block discarded – undo
1535 1535
             if (strpos($content, $s) !== false) {
1536 1536
                 $content = str_replace($s, $value, $content);
1537 1537
             } elseif ($this->debug) {
1538
-                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1538
+                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1539 1539
             }
1540 1540
         }
1541 1541
         return $content;
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
             }
1589 1589
 
1590 1590
             $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags
1591
-            $value = $this->mergePlaceholderContent($value, $params);  // parse page global placeholers
1591
+            $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers
1592 1592
             if ($this->config['enable_at_syntax']) {
1593 1593
                 $value = $this->mergeConditionalTagsContent($value);
1594 1594
             }
@@ -1604,7 +1604,7 @@  discard block
 block discarded – undo
1604 1604
             if (strpos($content, $s) !== false) {
1605 1605
                 $content = str_replace($s, $value, $content);
1606 1606
             } elseif ($this->debug) {
1607
-                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1607
+                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1608 1608
             }
1609 1609
         }
1610 1610
         return $content;
@@ -1661,7 +1661,7 @@  discard block
 block discarded – undo
1661 1661
             if (strpos($content, $s) !== false) {
1662 1662
                 $content = str_replace($s, $value, $content);
1663 1663
             } elseif ($this->debug) {
1664
-                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1664
+                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1665 1665
             }
1666 1666
         }
1667 1667
         return $content;
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
             return $content;
1686 1686
         }
1687 1687
 
1688
-        $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#';
1688
+        $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#';
1689 1689
         $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content);
1690 1690
 
1691 1691
         $pieces = explode('<@IF:', $content);
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
             }
1697 1697
             list($cmd, $text) = explode('>', $split, 2);
1698 1698
             $cmd = str_replace("'", "\'", $cmd);
1699
-            $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1699
+            $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>";
1700 1700
             $content .= $text;
1701 1701
         }
1702 1702
         $pieces = explode('<@ELSEIF:', $content);
@@ -1707,13 +1707,13 @@  discard block
 block discarded – undo
1707 1707
             }
1708 1708
             list($cmd, $text) = explode('>', $split, 2);
1709 1709
             $cmd = str_replace("'", "\'", $cmd);
1710
-            $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1710
+            $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>";
1711 1711
             $content .= $text;
1712 1712
         }
1713 1713
 
1714 1714
         $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content);
1715 1715
         ob_start();
1716
-        $content = eval('?>' . $content);
1716
+        $content = eval('?>'.$content);
1717 1717
         $content = ob_get_clean();
1718 1718
         $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content);
1719 1719
 
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
         $matches = $this->getTagsFromContent($content, $left, $right);
1839 1839
         if (!empty($matches)) {
1840 1840
             foreach ($matches[0] as $i => $v) {
1841
-                $addBreakMatches[$i] = $v . "\n";
1841
+                $addBreakMatches[$i] = $v."\n";
1842 1842
             }
1843 1843
             $content = str_replace($addBreakMatches, '', $content);
1844 1844
             if (strpos($content, $left) !== false) {
@@ -1872,7 +1872,7 @@  discard block
 block discarded – undo
1872 1872
             if (strpos($content, $s) !== false) {
1873 1873
                 $content = str_replace($s, $v, $content);
1874 1874
             } elseif ($this->debug) {
1875
-                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1875
+                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1876 1876
             }
1877 1877
         }
1878 1878
         return $content;
@@ -1936,7 +1936,7 @@  discard block
 block discarded – undo
1936 1936
                 $msg = ($msg === false) ? 'ob_get_contents() error' : $msg;
1937 1937
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg);
1938 1938
                 if ($this->isBackend()) {
1939
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>');
1939
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>');
1940 1940
                 }
1941 1941
             }
1942 1942
         } else {
@@ -1982,7 +1982,7 @@  discard block
 block discarded – undo
1982 1982
                 $echo = ($echo === false) ? 'ob_get_contents() error' : $echo;
1983 1983
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo);
1984 1984
                 if ($this->isBackend()) {
1985
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>');
1985
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>');
1986 1986
                 }
1987 1987
             }
1988 1988
         }
@@ -1990,7 +1990,7 @@  discard block
 block discarded – undo
1990 1990
         if (is_array($return) || is_object($return)) {
1991 1991
             return $return;
1992 1992
         } else {
1993
-            return $echo . $return;
1993
+            return $echo.$return;
1994 1994
         }
1995 1995
     }
1996 1996
 
@@ -2029,7 +2029,7 @@  discard block
 block discarded – undo
2029 2029
                 if (strpos($content, $s) !== false) {
2030 2030
                     $content = str_replace($s, $value, $content);
2031 2031
                 } elseif ($this->debug) {
2032
-                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2032
+                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2);
2033 2033
                 }
2034 2034
                 continue;
2035 2035
             }
@@ -2041,7 +2041,7 @@  discard block
 block discarded – undo
2041 2041
             if (strpos($content, $s) !== false) {
2042 2042
                 $content = str_replace($s, $value, $content);
2043 2043
             } elseif ($this->debug) {
2044
-                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2044
+                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2);
2045 2045
             }
2046 2046
         }
2047 2047
 
@@ -2132,7 +2132,7 @@  discard block
 block discarded – undo
2132 2132
             $eventtime = sprintf('%2.2f ms', $eventtime * 1000);
2133 2133
             $code = str_replace("\t", '  ', $this->htmlspecialchars($value));
2134 2134
             $piece = str_replace("\t", '  ', $this->htmlspecialchars($piece));
2135
-            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true)));
2135
+            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true)));
2136 2136
             $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>', $snippetObject['name'], $eventtime, $piece, $print_r_params, $code);
2137 2137
             $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime);
2138 2138
         }
@@ -2377,7 +2377,7 @@  discard block
 block discarded – undo
2377 2377
             $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where);
2378 2378
             $count = $this->db->getRecordCount($rs);
2379 2379
             if (1 < $count) {
2380
-                exit('Error $modx->_getSnippetObject()' . $snip_name);
2380
+                exit('Error $modx->_getSnippetObject()'.$snip_name);
2381 2381
             }
2382 2382
             if ($count) {
2383 2383
                 $row = $this->db->getRow($rs);
@@ -2403,7 +2403,7 @@  discard block
 block discarded – undo
2403 2403
     public function toAlias($text)
2404 2404
     {
2405 2405
         $suff = $this->config['friendly_url_suffix'];
2406
-        return str_replace(array('.xml' . $suff, '.rss' . $suff, '.js' . $suff, '.css' . $suff, '.txt' . $suff, '.json' . $suff, '.pdf' . $suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2406
+        return str_replace(array('.xml'.$suff, '.rss'.$suff, '.js'.$suff, '.css'.$suff, '.txt'.$suff, '.json'.$suff, '.pdf'.$suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2407 2407
     }
2408 2408
 
2409 2409
     /**
@@ -2435,7 +2435,7 @@  discard block
 block discarded – undo
2435 2435
                 $suff = '/';
2436 2436
             }
2437 2437
 
2438
-            $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff;
2438
+            $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff;
2439 2439
         }
2440 2440
 
2441 2441
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
                 preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match);
2473 2473
                 $ids = implode(',', array_unique($match['1']));
2474 2474
                 if ($ids) {
2475
-                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'");
2475
+                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'");
2476 2476
                     while ($row = $this->db->getRow($res)) {
2477 2477
                         if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) {
2478 2478
                             $parent = $row['parent'];
@@ -2483,7 +2483,7 @@  discard block
 block discarded – undo
2483 2483
                                 $parent = $this->aliasListing[$parent]['parent'];
2484 2484
                             }
2485 2485
 
2486
-                            $aliases[$row['id']] = $path . '/' . $row['alias'];
2486
+                            $aliases[$row['id']] = $path.'/'.$row['alias'];
2487 2487
                         } else {
2488 2488
                             $aliases[$row['id']] = $row['alias'];
2489 2489
                         }
@@ -2495,7 +2495,7 @@  discard block
 block discarded – undo
2495 2495
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2496 2496
             $pref = $this->config['friendly_url_prefix'];
2497 2497
             $suff = $this->config['friendly_url_suffix'];
2498
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2498
+            $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2499 2499
                 global $modx;
2500 2500
                 $thealias = $aliases[$m[1]];
2501 2501
                 $thefolder = $isfolder[$m[1]];
@@ -2510,7 +2510,7 @@  discard block
 block discarded – undo
2510 2510
             }, $documentSource);
2511 2511
         } else {
2512 2512
             $in = '!\[\~([0-9]+)\~\]!is';
2513
-            $out = "index.php?id=" . '\1';
2513
+            $out = "index.php?id=".'\1';
2514 2514
             $documentSource = preg_replace($in, $out, $documentSource);
2515 2515
         }
2516 2516
 
@@ -2531,7 +2531,7 @@  discard block
 block discarded – undo
2531 2531
         $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
2532 2532
         $len_base_url = strlen($this->config['base_url']);
2533 2533
 
2534
-        $url_path = $q;//LANG
2534
+        $url_path = $q; //LANG
2535 2535
 
2536 2536
         if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) {
2537 2537
             $url_path = substr($url_path, $len_base_url);
@@ -2543,7 +2543,7 @@  discard block
 block discarded – undo
2543 2543
             $strictURL = substr($strictURL, $len_base_url);
2544 2544
         }
2545 2545
         $http_host = $_SERVER['HTTP_HOST'];
2546
-        $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG
2546
+        $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG
2547 2547
 
2548 2548
         $site_url = $this->config['site_url'];
2549 2549
         $url_query_string = explode('?', $_SERVER['REQUEST_URI']);
@@ -2561,7 +2561,7 @@  discard block
 block discarded – undo
2561 2561
                 }
2562 2562
                 if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) {
2563 2563
                     if (empty($_POST)) {
2564
-                        if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) {
2564
+                        if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) {
2565 2565
                             $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
2566 2566
                             exit(0);
2567 2567
                         }
@@ -2619,7 +2619,7 @@  discard block
 block discarded – undo
2619 2619
                 $docgrp = implode(",", $docgrp);
2620 2620
             }
2621 2621
             // get document
2622
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2622
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2623 2623
             $rs = $this->db->select('sc.*', "{$tblsc} sc
2624 2624
                 LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1);
2625 2625
             if ($this->db->getRecordCount($rs) < 1) {
@@ -2655,9 +2655,9 @@  discard block
 block discarded – undo
2655 2655
             }
2656 2656
             if ($documentObject['template']) {
2657 2657
                 // load TVs and merge with document - Orig by Apodigm - Docvars
2658
-                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv
2659
-                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id
2660
-                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2658
+                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv
2659
+                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id
2660
+                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2661 2661
                 $tmplvars = array();
2662 2662
                 while ($row = $this->db->getRow($rs)) {
2663 2663
                     $tmplvars[$row['name']] = array(
@@ -2703,7 +2703,7 @@  discard block
 block discarded – undo
2703 2703
                 $st = md5($source);
2704 2704
             }
2705 2705
             if ($this->dumpSnippets == 1) {
2706
-                $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>";
2706
+                $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>";
2707 2707
             }
2708 2708
 
2709 2709
             // invoke OnParseDocument event
@@ -2791,7 +2791,7 @@  discard block
 block discarded – undo
2791 2791
 
2792 2792
             // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path
2793 2793
             if ($this->config['use_alias_path'] == 1) {
2794
-                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier;
2794
+                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier;
2795 2795
                 if (isset($this->documentListing[$alias])) {
2796 2796
                     $this->documentIdentifier = $this->documentListing[$alias];
2797 2797
                 } else {
@@ -2852,7 +2852,7 @@  discard block
 block discarded – undo
2852 2852
                 } else {
2853 2853
                     $docAlias = $this->db->escape($this->documentIdentifier);
2854 2854
                     $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'");
2855
-                    $this->documentIdentifier = (int)$this->db->getValue($rs);
2855
+                    $this->documentIdentifier = (int) $this->db->getValue($rs);
2856 2856
                 }
2857 2857
             }
2858 2858
             $this->documentMethod = 'id';
@@ -2909,7 +2909,7 @@  discard block
 block discarded – undo
2909 2909
                 $_REQUEST[$n] = $_GET[$n] = $v;
2910 2910
             }
2911 2911
         }
2912
-        $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path'];
2912
+        $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path'];
2913 2913
         $this->q = $qp['path'];
2914 2914
         return $qp['path'];
2915 2915
     }
@@ -3003,7 +3003,7 @@  discard block
 block discarded – undo
3003 3003
             $this->sendErrorPage();
3004 3004
         } else {
3005 3005
             // Inculde the necessary files to check document permissions
3006
-            include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
3006
+            include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
3007 3007
             $udperms = new udperms();
3008 3008
             $udperms->user = $this->getLoginUserID();
3009 3009
             $udperms->document = $this->documentIdentifier;
@@ -3057,7 +3057,7 @@  discard block
 block discarded – undo
3057 3057
         while ($id && $height--) {
3058 3058
             $thisid = $id;
3059 3059
             if ($this->config['aliaslistingfolder'] == 1) {
3060
-                $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");
3060
+                $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");
3061 3061
                 if (!$id || $id == '0') {
3062 3062
                     break;
3063 3063
                 }
@@ -3106,15 +3106,15 @@  discard block
 block discarded – undo
3106 3106
         }
3107 3107
 
3108 3108
         if ($this->config['aliaslistingfolder'] == 1) {
3109
-            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'");
3109
+            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'");
3110 3110
             $idx = array();
3111 3111
             while ($row = $this->db->getRow($res)) {
3112 3112
                 $pAlias = '';
3113 3113
                 if (isset($this->aliasListing[$row['parent']])) {
3114
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : '';
3115
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : '';
3114
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : '';
3115
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : '';
3116 3116
                 };
3117
-                $children[$pAlias . $row['alias']] = $row['id'];
3117
+                $children[$pAlias.$row['alias']] = $row['id'];
3118 3118
                 if ($row['isfolder'] == 1) {
3119 3119
                     $idx[] = $row['id'];
3120 3120
                 }
@@ -3145,7 +3145,7 @@  discard block
 block discarded – undo
3145 3145
                 $depth--;
3146 3146
 
3147 3147
                 foreach ($documentMap_cache[$id] as $childId) {
3148
-                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias'];
3148
+                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias'];
3149 3149
                     if (!strlen($pkey)) {
3150 3150
                         $pkey = "{$childId}";
3151 3151
                     }
@@ -3173,7 +3173,7 @@  discard block
 block discarded – undo
3173 3173
         if (substr(strtolower($url), 0, 11) == "javascript:") {
3174 3174
             $fnc = substr($url, 11);
3175 3175
         } elseif ($url) {
3176
-            $fnc = "window.location.href='" . addslashes($url) . "';";
3176
+            $fnc = "window.location.href='".addslashes($url)."';";
3177 3177
         } else {
3178 3178
             $fnc = "history.back(-1);";
3179 3179
         }
@@ -3182,7 +3182,7 @@  discard block
 block discarded – undo
3182 3182
             <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\">
3183 3183
             <script>
3184 3184
                 function __alertQuit() {
3185
-                    alert('" . addslashes($msg) . "');
3185
+                    alert('".addslashes($msg)."');
3186 3186
                     {$fnc}
3187 3187
                 }
3188 3188
                 window.setTimeout('__alertQuit();',100);
@@ -3204,9 +3204,9 @@  discard block
 block discarded – undo
3204 3204
         $state = 0;
3205 3205
         $pms = $_SESSION['mgrPermissions'];
3206 3206
         if ($pms) {
3207
-            $state = ((bool)$pms[$pm] === true);
3207
+            $state = ((bool) $pms[$pm] === true);
3208 3208
         }
3209
-        return (int)$state;
3209
+        return (int) $state;
3210 3210
     }
3211 3211
 
3212 3212
     /**
@@ -3219,8 +3219,8 @@  discard block
 block discarded – undo
3219 3219
      */
3220 3220
     public function elementIsLocked($type, $id, $includeThisUser = false)
3221 3221
     {
3222
-        $id = (int)$id;
3223
-        $type = (int)$type;
3222
+        $id = (int) $id;
3223
+        $type = (int) $type;
3224 3224
         if (!$type || !$id) {
3225 3225
             return null;
3226 3226
         }
@@ -3270,7 +3270,7 @@  discard block
 block discarded – undo
3270 3270
             return $lockedElements;
3271 3271
         }
3272 3272
 
3273
-        $type = (int)$type;
3273
+        $type = (int) $type;
3274 3274
         if (isset($lockedElements[$type])) {
3275 3275
             return $lockedElements[$type];
3276 3276
         } else {
@@ -3287,7 +3287,7 @@  discard block
 block discarded – undo
3287 3287
             $this->lockedElements = array();
3288 3288
             $this->cleanupExpiredLocks();
3289 3289
 
3290
-            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul
3290
+            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul
3291 3291
                 LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id");
3292 3292
             while ($row = $this->db->getRow($rs)) {
3293 3293
                 $this->lockedElements[$row['elementType']][$row['elementId']] = array(
@@ -3310,7 +3310,7 @@  discard block
 block discarded – undo
3310 3310
     public function cleanupExpiredLocks()
3311 3311
     {
3312 3312
         // Clean-up active_user_sessions first
3313
-        $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
3313
+        $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
3314 3314
         $validSessionTimeLimit = $this->time - $timeout;
3315 3315
         $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}");
3316 3316
 
@@ -3323,7 +3323,7 @@  discard block
 block discarded – undo
3323 3323
             foreach ($rs as $row) {
3324 3324
                 $userSids[] = $row['sid'];
3325 3325
             }
3326
-            $userSids = "'" . implode("','", $userSids) . "'";
3326
+            $userSids = "'".implode("','", $userSids)."'";
3327 3327
             $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})");
3328 3328
         } else {
3329 3329
             $this->db->delete($this->getFullTableName('active_user_locks'));
@@ -3404,8 +3404,8 @@  discard block
 block discarded – undo
3404 3404
     public function lockElement($type, $id)
3405 3405
     {
3406 3406
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3407
-        $type = (int)$type;
3408
-        $id = (int)$id;
3407
+        $type = (int) $type;
3408
+        $id = (int) $id;
3409 3409
         if (!$type || !$id || !$userId) {
3410 3410
             return false;
3411 3411
         }
@@ -3426,8 +3426,8 @@  discard block
 block discarded – undo
3426 3426
     public function unlockElement($type, $id, $includeAllUsers = false)
3427 3427
     {
3428 3428
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3429
-        $type = (int)$type;
3430
-        $id = (int)$id;
3429
+        $type = (int) $type;
3430
+        $id = (int) $id;
3431 3431
         if (!$type || !$id) {
3432 3432
             return false;
3433 3433
         }
@@ -3494,8 +3494,8 @@  discard block
 block discarded – undo
3494 3494
         }
3495 3495
 
3496 3496
         $usertype = $this->isFrontend() ? 1 : 0;
3497
-        $evtid = (int)$evtid;
3498
-        $type = (int)$type;
3497
+        $evtid = (int) $evtid;
3498
+        $type = (int) $type;
3499 3499
 
3500 3500
         // Types: 1 = information, 2 = warning, 3 = error
3501 3501
         if ($type < 1) {
@@ -3517,8 +3517,8 @@  discard block
 block discarded – undo
3517 3517
         if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') {
3518 3518
             if ($this->config['send_errormail'] <= $type) {
3519 3519
                 $this->sendmail(array(
3520
-                    'subject' => 'MODX System Error on ' . $this->config['site_name'],
3521
-                    'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.',
3520
+                    'subject' => 'MODX System Error on '.$this->config['site_name'],
3521
+                    'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.',
3522 3522
                     'type' => 'text'
3523 3523
                 ));
3524 3524
             }
@@ -3566,7 +3566,7 @@  discard block
 block discarded – undo
3566 3566
             $p['fromname'] = $userinfo['username'];
3567 3567
         }
3568 3568
         if ($msg === '' && !isset($p['body'])) {
3569
-            $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER'];
3569
+            $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER'];
3570 3570
         } elseif (is_string($msg) && 0 < strlen($msg)) {
3571 3571
             $p['body'] = $msg;
3572 3572
         }
@@ -3606,8 +3606,8 @@  discard block
 block discarded – undo
3606 3606
             $files = array();
3607 3607
         }
3608 3608
         foreach ($files as $f) {
3609
-            if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) {
3610
-                $this->mail->AddAttachment(MODX_BASE_PATH . $f);
3609
+            if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) {
3610
+                $this->mail->AddAttachment(MODX_BASE_PATH.$f);
3611 3611
             }
3612 3612
         }
3613 3613
         $rs = $this->mail->send();
@@ -3652,7 +3652,7 @@  discard block
 block discarded – undo
3652 3652
      */
3653 3653
     public function isFrontend()
3654 3654
     {
3655
-        return ! $this->isBackend();
3655
+        return !$this->isBackend();
3656 3656
     }
3657 3657
 
3658 3658
     /**
@@ -3676,14 +3676,14 @@  discard block
 block discarded – undo
3676 3676
         $tblsc = $this->getFullTableName("site_content");
3677 3677
         $tbldg = $this->getFullTableName("document_groups");
3678 3678
         // modify field names to use sc. table reference
3679
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3680
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3679
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3680
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3681 3681
         // get document groups for current user
3682 3682
         if ($docgrp = $this->getUserDocGroups()) {
3683 3683
             $docgrp = implode(",", $docgrp);
3684 3684
         }
3685 3685
         // build query
3686
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3686
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3687 3687
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3688 3688
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3689 3689
         $resourceArray = $this->db->makeArray($result);
@@ -3713,14 +3713,14 @@  discard block
 block discarded – undo
3713 3713
         $tbldg = $this->getFullTableName("document_groups");
3714 3714
 
3715 3715
         // modify field names to use sc. table reference
3716
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3717
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3716
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3717
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3718 3718
         // get document groups for current user
3719 3719
         if ($docgrp = $this->getUserDocGroups()) {
3720 3720
             $docgrp = implode(",", $docgrp);
3721 3721
         }
3722 3722
         // build query
3723
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3723
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3724 3724
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3725 3725
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3726 3726
         $resourceArray = $this->db->makeArray($result);
@@ -3754,16 +3754,16 @@  discard block
 block discarded – undo
3754 3754
             return $this->tmpCache[__FUNCTION__][$cacheKey];
3755 3755
         }
3756 3756
 
3757
-        $published = ($published !== 'all') ? 'AND sc.published = ' . $published : '';
3758
-        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : '';
3757
+        $published = ($published !== 'all') ? 'AND sc.published = '.$published : '';
3758
+        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : '';
3759 3759
 
3760 3760
         if ($where != '') {
3761
-            $where = 'AND ' . $where;
3761
+            $where = 'AND '.$where;
3762 3762
         }
3763 3763
 
3764 3764
         // modify field names to use sc. table reference
3765
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3766
-        $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3765
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3766
+        $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3767 3767
 
3768 3768
         // get document groups for current user
3769 3769
         if ($docgrp = $this->getUserDocGroups()) {
@@ -3771,7 +3771,7 @@  discard block
 block discarded – undo
3771 3771
         }
3772 3772
 
3773 3773
         // build query
3774
-        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3774
+        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3775 3775
 
3776 3776
         $tblsc = $this->getFullTableName('site_content');
3777 3777
         $tbldg = $this->getFullTableName('document_groups');
@@ -3822,10 +3822,10 @@  discard block
 block discarded – undo
3822 3822
             return false;
3823 3823
         } else {
3824 3824
             // modify field names to use sc. table reference
3825
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3826
-            $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3825
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3826
+            $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3827 3827
             if ($where != '') {
3828
-                $where = 'AND ' . $where;
3828
+                $where = 'AND '.$where;
3829 3829
             }
3830 3830
 
3831 3831
             $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : '';
@@ -3836,13 +3836,13 @@  discard block
 block discarded – undo
3836 3836
                 $docgrp = implode(',', $docgrp);
3837 3837
             }
3838 3838
 
3839
-            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3839
+            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3840 3840
 
3841 3841
             $tblsc = $this->getFullTableName('site_content');
3842 3842
             $tbldg = $this->getFullTableName('document_groups');
3843 3843
 
3844 3844
             $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3845
-                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
3845
+                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',', $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
3846 3846
 
3847 3847
             $resourceArray = $this->db->makeArray($result);
3848 3848
 
@@ -3946,12 +3946,12 @@  discard block
 block discarded – undo
3946 3946
             $tbldg = $this->getFullTableName("document_groups");
3947 3947
             $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : "";
3948 3948
             // modify field names to use sc. table reference
3949
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3949
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3950 3950
             // get document groups for current user
3951 3951
             if ($docgrp = $this->getUserDocGroups()) {
3952 3952
                 $docgrp = implode(",", $docgrp);
3953 3953
             }
3954
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3954
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3955 3955
             $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1);
3956 3956
             $pageInfo = $this->db->getRow($result);
3957 3957
 
@@ -3998,7 +3998,7 @@  discard block
 block discarded – undo
3998 3998
     {
3999 3999
         if ($this->currentSnippet) {
4000 4000
             $tbl = $this->getFullTableName("site_snippets");
4001
-            $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1);
4001
+            $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1);
4002 4002
             if ($snippetId = $this->db->getValue($rs)) {
4003 4003
                 return $snippetId;
4004 4004
             }
@@ -4025,23 +4025,23 @@  discard block
 block discarded – undo
4025 4025
      */
4026 4026
     public function clearCache($type = '', $report = false)
4027 4027
     {
4028
-        $cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
4028
+        $cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
4029 4029
         if (is_array($type)) {
4030 4030
             foreach ($type as $_) {
4031 4031
                 $this->clearCache($_, $report);
4032 4032
             }
4033 4033
         } elseif ($type == 'full') {
4034
-            include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
4034
+            include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
4035 4035
             $sync = new synccache();
4036 4036
             $sync->setCachepath($cache_dir);
4037 4037
             $sync->setReport($report);
4038 4038
             $sync->emptyCache();
4039 4039
         } elseif (preg_match('@^[1-9][0-9]*$@', $type)) {
4040 4040
             $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type;
4041
-            $file_name = "docid_" . $key . "_*.pageCache.php";
4042
-            $cache_path = $cache_dir . $file_name;
4041
+            $file_name = "docid_".$key."_*.pageCache.php";
4042
+            $cache_path = $cache_dir.$file_name;
4043 4043
             $files = glob($cache_path);
4044
-            $files[] = $cache_dir . "docid_" . $key . ".pageCache.php";
4044
+            $files[] = $cache_dir."docid_".$key.".pageCache.php";
4045 4045
             foreach ($files as $file) {
4046 4046
                 if (!is_file($file)) {
4047 4047
                     continue;
@@ -4049,7 +4049,7 @@  discard block
 block discarded – undo
4049 4049
                 unlink($file);
4050 4050
             }
4051 4051
         } else {
4052
-            $files = glob($cache_dir . '*');
4052
+            $files = glob($cache_dir.'*');
4053 4053
             foreach ($files as $file) {
4054 4054
                 $name = basename($file);
4055 4055
                 if (strpos($name, '.pageCache.php') === false) {
@@ -4117,14 +4117,14 @@  discard block
 block discarded – undo
4117 4117
                         $f_url_suffix = '/';
4118 4118
                     }
4119 4119
 
4120
-                    $alPath = !empty($al['path']) ? $al['path'] . '/' : '';
4120
+                    $alPath = !empty($al['path']) ? $al['path'].'/' : '';
4121 4121
 
4122 4122
                     if ($al && $al['alias']) {
4123 4123
                         $alias = $al['alias'];
4124 4124
                     }
4125 4125
                 }
4126 4126
 
4127
-                $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix;
4127
+                $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix;
4128 4128
                 $url = "{$alias}{$args}";
4129 4129
             } else {
4130 4130
                 $url = "index.php?id={$id}{$args}";
@@ -4143,7 +4143,7 @@  discard block
 block discarded – undo
4143 4143
             }
4144 4144
 
4145 4145
             //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080)
4146
-            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host;
4146
+            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host;
4147 4147
         }
4148 4148
 
4149 4149
         //fix strictUrl by Bumkaka
@@ -4152,9 +4152,9 @@  discard block
 block discarded – undo
4152 4152
         }
4153 4153
 
4154 4154
         if ($this->config['xhtml_urls']) {
4155
-            $url = preg_replace("/&(?!amp;)/", "&amp;", $host . $virtualDir . $url);
4155
+            $url = preg_replace("/&(?!amp;)/", "&amp;", $host.$virtualDir.$url);
4156 4156
         } else {
4157
-            $url = $host . $virtualDir . $url;
4157
+            $url = $host.$virtualDir.$url;
4158 4158
         }
4159 4159
 
4160 4160
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -4178,21 +4178,21 @@  discard block
 block discarded – undo
4178 4178
         if (isset($this->aliasListing[$id])) {
4179 4179
             $out = $this->aliasListing[$id];
4180 4180
         } else {
4181
-            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id);
4181
+            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id);
4182 4182
             if ($this->db->getRecordCount($q) == '1') {
4183 4183
                 $q = $this->db->getRow($q);
4184 4184
                 $this->aliasListing[$id] = array(
4185
-                    'id' => (int)$q['id'],
4185
+                    'id' => (int) $q['id'],
4186 4186
                     'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'],
4187
-                    'parent' => (int)$q['parent'],
4188
-                    'isfolder' => (int)$q['isfolder'],
4187
+                    'parent' => (int) $q['parent'],
4188
+                    'isfolder' => (int) $q['isfolder'],
4189 4189
                 );
4190 4190
                 if ($this->aliasListing[$id]['parent'] > 0) {
4191 4191
                     //fix alias_path_usage
4192 4192
                     if ($this->config['use_alias_path'] == '1') {
4193 4193
                         //&& $tmp['path'] != '' - fix error slash with epty path
4194 4194
                         $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']);
4195
-                        $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : '');
4195
+                        $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : '');
4196 4196
                     } else {
4197 4197
                         $this->aliasListing[$id]['path'] = '';
4198 4198
                     }
@@ -4233,7 +4233,7 @@  discard block
 block discarded – undo
4233 4233
         $out = array();
4234 4234
         if (empty($this->version) || !is_array($this->version)) {
4235 4235
             //include for compatibility modx version < 1.0.10
4236
-            include MODX_MANAGER_PATH . "includes/version.inc.php";
4236
+            include MODX_MANAGER_PATH."includes/version.inc.php";
4237 4237
             $this->version = array();
4238 4238
             $this->version['version'] = isset($modx_version) ? $modx_version : '';
4239 4239
             $this->version['branch'] = isset($modx_branch) ? $modx_branch : '';
@@ -4255,18 +4255,18 @@  discard block
 block discarded – undo
4255 4255
     {
4256 4256
         if (isset($this->snippetCache[$snippetName])) {
4257 4257
             $snippet = $this->snippetCache[$snippetName];
4258
-            $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4258
+            $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : '';
4259 4259
         } else { // not in cache so let's check the db
4260
-            $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;";
4260
+            $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;";
4261 4261
             $result = $this->db->query($sql);
4262 4262
             if ($this->db->getRecordCount($result) == 1) {
4263 4263
                 $row = $this->db->getRow($result);
4264 4264
                 $snippet = $this->snippetCache[$snippetName] = $row['snippet'];
4265 4265
                 $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties']));
4266
-                $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties);
4266
+                $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties);
4267 4267
             } else {
4268 4268
                 $snippet = $this->snippetCache[$snippetName] = "return false;";
4269
-                $properties = $this->snippetCache[$snippetName . "Props"] = '';
4269
+                $properties = $this->snippetCache[$snippetName."Props"] = '';
4270 4270
             }
4271 4271
         }
4272 4272
         // load default params/properties
@@ -4366,7 +4366,7 @@  discard block
 block discarded – undo
4366 4366
             if (strpos($tpl, $s) !== false) {
4367 4367
                 $tpl = str_replace($s, $value, $tpl);
4368 4368
             } elseif ($this->debug) {
4369
-                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2);
4369
+                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2);
4370 4370
             }
4371 4371
         }
4372 4372
 
@@ -4415,7 +4415,7 @@  discard block
 block discarded – undo
4415 4415
             case 'CODE':
4416 4416
                 break;
4417 4417
             case 'FILE':
4418
-                $template = file_get_contents(MODX_BASE_PATH . $template);
4418
+                $template = file_get_contents(MODX_BASE_PATH.$template);
4419 4419
                 break;
4420 4420
             case 'CHUNK':
4421 4421
                 $template = $this->getChunk($template);
@@ -4448,7 +4448,7 @@  discard block
 block discarded – undo
4448 4448
         if ($mode !== 'formatOnly' && empty($timestamp)) {
4449 4449
             return '-';
4450 4450
         }
4451
-        $timestamp = (int)$timestamp;
4451
+        $timestamp = (int) $timestamp;
4452 4452
 
4453 4453
         switch ($this->config['datetime_format']) {
4454 4454
             case 'YYYY/mm/dd':
@@ -4468,7 +4468,7 @@  discard block
 block discarded – undo
4468 4468
         }
4469 4469
 
4470 4470
         if (empty($mode)) {
4471
-            $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp);
4471
+            $strTime = strftime($dateFormat." %H:%M:%S", $timestamp);
4472 4472
         } elseif ($mode == 'dateOnly') {
4473 4473
             $strTime = strftime($dateFormat, $timestamp);
4474 4474
         } elseif ($mode == 'formatOnly') {
@@ -4522,7 +4522,7 @@  discard block
 block discarded – undo
4522 4522
             $S = 0;
4523 4523
         }
4524 4524
         $timeStamp = mktime($H, $M, $S, $m, $d, $Y);
4525
-        $timeStamp = (int)$timeStamp;
4525
+        $timeStamp = (int) $timeStamp;
4526 4526
         return $timeStamp;
4527 4527
     }
4528 4528
 
@@ -4564,7 +4564,7 @@  discard block
 block discarded – undo
4564 4564
                     if ($v === 'value') {
4565 4565
                         unset($_[$i]);
4566 4566
                     } else {
4567
-                        $_[$i] = 'tv.' . $v;
4567
+                        $_[$i] = 'tv.'.$v;
4568 4568
                     }
4569 4569
                 }
4570 4570
                 $fields = implode(',', $_);
@@ -4573,12 +4573,12 @@  discard block
 block discarded – undo
4573 4573
             }
4574 4574
 
4575 4575
             if ($tvsort != '') {
4576
-                $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4576
+                $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4577 4577
             }
4578 4578
             if ($tvidnames == "*") {
4579 4579
                 $query = "tv.id<>0";
4580 4580
             } else {
4581
-                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')";
4581
+                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')";
4582 4582
             }
4583 4583
 
4584 4584
             $this->getUserDocGroups();
@@ -4739,18 +4739,18 @@  discard block
 block discarded – undo
4739 4739
             }
4740 4740
 
4741 4741
             // get user defined template variables
4742
-            $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4743
-            $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4742
+            $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4743
+            $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4744 4744
 
4745 4745
             if ($idnames == '*') {
4746 4746
                 $query = 'tv.id<>0';
4747 4747
             } else {
4748
-                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')";
4748
+                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')";
4749 4749
             }
4750 4750
 
4751
-            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv
4752
-                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id
4753
-                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
4751
+            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv
4752
+                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id
4753
+                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
4754 4754
 
4755 4755
             $result = $this->db->makeArray($rs);
4756 4756
 
@@ -4799,16 +4799,16 @@  discard block
 block discarded – undo
4799 4799
             $output = array();
4800 4800
             $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames);
4801 4801
 
4802
-            $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier;
4802
+            $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier;
4803 4803
             // remove sort for speed
4804 4804
             $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');
4805 4805
 
4806 4806
             if ($result == false) {
4807 4807
                 return false;
4808 4808
             } else {
4809
-                $baspath = MODX_MANAGER_PATH . 'includes';
4810
-                include_once $baspath . '/tmplvars.format.inc.php';
4811
-                include_once $baspath . '/tmplvars.commands.inc.php';
4809
+                $baspath = MODX_MANAGER_PATH.'includes';
4810
+                include_once $baspath.'/tmplvars.format.inc.php';
4811
+                include_once $baspath.'/tmplvars.commands.inc.php';
4812 4812
 
4813 4813
                 for ($i = 0; $i < count($result); $i++) {
4814 4814
                     $row = $result[$i];
@@ -4833,7 +4833,7 @@  discard block
 block discarded – undo
4833 4833
      */
4834 4834
     public function getFullTableName($tbl)
4835 4835
     {
4836
-        return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`";
4836
+        return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`";
4837 4837
     }
4838 4838
 
4839 4839
     /**
@@ -4912,7 +4912,7 @@  discard block
 block discarded – undo
4912 4912
     public function getCachePath()
4913 4913
     {
4914 4914
         global $base_url;
4915
-        $pth = $base_url . $this->getCacheFolder();
4915
+        $pth = $base_url.$this->getCacheFolder();
4916 4916
         return $pth;
4917 4917
     }
4918 4918
 
@@ -4964,8 +4964,8 @@  discard block
 block discarded – undo
4964 4964
         $out = false;
4965 4965
 
4966 4966
         if (!empty($context)) {
4967
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4968
-                $out = $_SESSION[$context . 'InternalKey'];
4967
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4968
+                $out = $_SESSION[$context.'InternalKey'];
4969 4969
             }
4970 4970
         } else {
4971 4971
             switch (true) {
@@ -4993,8 +4993,8 @@  discard block
 block discarded – undo
4993 4993
         $out = false;
4994 4994
 
4995 4995
         if (!empty($context)) {
4996
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4997
-                $out = $_SESSION[$context . 'Shortname'];
4996
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4997
+                $out = $_SESSION[$context.'Shortname'];
4998 4998
             }
4999 4999
         } else {
5000 5000
             switch (true) {
@@ -5065,8 +5065,8 @@  discard block
 block discarded – undo
5065 5065
      */
5066 5066
     public function getWebUserInfo($uid)
5067 5067
     {
5068
-        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu
5069
-                INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5068
+        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu
5069
+                INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5070 5070
         if ($row = $this->db->getRow($rs)) {
5071 5071
             if (!isset($row['usertype']) or !$row["usertype"]) {
5072 5072
                 $row["usertype"] = "web";
@@ -5102,7 +5102,7 @@  discard block
 block discarded – undo
5102 5102
         } elseif (is_array($dg)) {
5103 5103
             // resolve ids to names
5104 5104
             $dgn = array();
5105
-            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")");
5105
+            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")");
5106 5106
             while ($row = $this->db->getRow($ds)) {
5107 5107
                 $dgn[] = $row['name'];
5108 5108
             }
@@ -5130,7 +5130,7 @@  discard block
 block discarded – undo
5130 5130
         $rt = false;
5131 5131
         if ($_SESSION["webValidated"] == 1) {
5132 5132
             $tbl = $this->getFullTableName("web_users");
5133
-            $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'");
5133
+            $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'");
5134 5134
             if ($row = $this->db->getRow($ds)) {
5135 5135
                 if ($row["password"] == md5($oldPwd)) {
5136 5136
                     if (strlen($newPwd) < 6) {
@@ -5140,7 +5140,7 @@  discard block
 block discarded – undo
5140 5140
                     } else {
5141 5141
                         $this->db->update(array(
5142 5142
                             'password' => $this->db->escape($newPwd),
5143
-                        ), $tbl, "id='" . $this->getLoginUserID() . "'");
5143
+                        ), $tbl, "id='".$this->getLoginUserID()."'");
5144 5144
                         // invoke OnWebChangePassword event
5145 5145
                         $this->invokeEvent("OnWebChangePassword", array(
5146 5146
                             "userid" => $row["id"],
@@ -5171,8 +5171,8 @@  discard block
 block discarded – undo
5171 5171
         // check cache
5172 5172
         $grpNames = isset($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false;
5173 5173
         if (!is_array($grpNames)) {
5174
-            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn
5175
-                    INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'");
5174
+            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn
5175
+                    INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'");
5176 5176
             $grpNames = $this->db->getColumn("name", $rs);
5177 5177
             // save to cache
5178 5178
             $_SESSION['webUserGroupNames'] = $grpNames;
@@ -5205,7 +5205,7 @@  discard block
 block discarded – undo
5205 5205
         if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) {
5206 5206
             $this->sjscripts[$nextpos] = $src;
5207 5207
         } else {
5208
-            $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>';
5208
+            $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>';
5209 5209
         }
5210 5210
     }
5211 5211
 
@@ -5284,7 +5284,7 @@  discard block
 block discarded – undo
5284 5284
         }
5285 5285
 
5286 5286
         if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) {
5287
-            $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>';
5287
+            $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>';
5288 5288
         }
5289 5289
         if ($startup) {
5290 5290
             $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1;
@@ -5431,7 +5431,7 @@  discard block
 block discarded – undo
5431 5431
                 $eventtime = $this->getMicroTime() - $eventtime;
5432 5432
                 $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000);
5433 5433
                 foreach ($parameter as $k => $v) {
5434
-                    $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>';
5434
+                    $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>';
5435 5435
                 }
5436 5436
                 $this->pluginsCode .= '</fieldset><br />';
5437 5437
                 $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime;
@@ -5459,13 +5459,13 @@  discard block
 block discarded – undo
5459 5459
         $plugin = array();
5460 5460
         if (isset($this->pluginCache[$pluginName])) {
5461 5461
             $pluginCode = $this->pluginCache[$pluginName];
5462
-            $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : '';
5462
+            $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : '';
5463 5463
         } else {
5464 5464
             $pluginName = $this->db->escape($pluginName);
5465 5465
             $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0");
5466 5466
             if ($row = $this->db->getRow($result)) {
5467 5467
                 $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode'];
5468
-                $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties'];
5468
+                $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties'];
5469 5469
             } else {
5470 5470
                 $pluginCode = $this->pluginCache[$pluginName] = "return false;";
5471 5471
                 $pluginProperties = '';
@@ -5567,7 +5567,7 @@  discard block
 block discarded – undo
5567 5567
     public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)
5568 5568
     {
5569 5569
         $params = array();
5570
-        $fullpath = $element_dir . '/' . $filename;
5570
+        $fullpath = $element_dir.'/'.$filename;
5571 5571
         if (is_readable($fullpath)) {
5572 5572
             $tpl = @fopen($fullpath, "r");
5573 5573
             if ($tpl) {
@@ -5734,8 +5734,8 @@  discard block
 block discarded – undo
5734 5734
         $ph = array('site_url' => MODX_SITE_URL);
5735 5735
         $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";
5736 5736
         $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';
5737
-        $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';
5738
-        $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';
5737
+        $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';
5738
+        $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';
5739 5739
         foreach ($parsed as $key => $val) {
5740 5740
             if (is_array($val)) {
5741 5741
                 foreach ($val as $key2 => $val2) {
@@ -5744,7 +5744,7 @@  discard block
 block discarded – undo
5744 5744
                         $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2);
5745 5745
                     }
5746 5746
                     if (preg_match($regexEmail, $val2, $url)) {
5747
-                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);
5747
+                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);
5748 5748
                     }
5749 5749
                     $parsed[$key][$key2] = $val2;
5750 5750
                 }
@@ -5754,7 +5754,7 @@  discard block
 block discarded – undo
5754 5754
                     $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val);
5755 5755
                 }
5756 5756
                 if (preg_match($regexEmail, $val, $url)) {
5757
-                    $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);
5757
+                    $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);
5758 5758
                 }
5759 5759
                 $parsed[$key] = $val;
5760 5760
             }
@@ -5768,32 +5768,32 @@  discard block
 block discarded – undo
5768 5768
         );
5769 5769
 
5770 5770
         $nl = "\n";
5771
-        $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';
5772
-        $list .= '<p>' . $nl;
5773
-        $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';
5774
-        $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';
5775
-        $list .= '</p><br/>' . $nl;
5776
-        $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';
5777
-        $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';
5778
-        $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';
5779
-        $list .= '<br/>' . $nl;
5771
+        $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';
5772
+        $list .= '<p>'.$nl;
5773
+        $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';
5774
+        $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';
5775
+        $list .= '</p><br/>'.$nl;
5776
+        $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';
5777
+        $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';
5778
+        $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';
5779
+        $list .= '<br/>'.$nl;
5780 5780
         $first = true;
5781 5781
         foreach ($arrayParams as $param => $label) {
5782 5782
             if (isset($parsed[$param])) {
5783 5783
                 if ($first) {
5784
-                    $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;
5785
-                    $list .= '<ul class="docBlockList">' . $nl;
5784
+                    $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;
5785
+                    $list .= '<ul class="docBlockList">'.$nl;
5786 5786
                     $first = false;
5787 5787
                 }
5788
-                $list .= '    <li><strong>' . $label . '</strong>' . $nl;
5789
-                $list .= '        <ul>' . $nl;
5788
+                $list .= '    <li><strong>'.$label.'</strong>'.$nl;
5789
+                $list .= '        <ul>'.$nl;
5790 5790
                 foreach ($parsed[$param] as $val) {
5791
-                    $list .= '            <li>' . $val . '</li>' . $nl;
5791
+                    $list .= '            <li>'.$val.'</li>'.$nl;
5792 5792
                 }
5793
-                $list .= '        </ul></li>' . $nl;
5793
+                $list .= '        </ul></li>'.$nl;
5794 5794
             }
5795 5795
         }
5796
-        $list .= !$first ? '</ul>' . $nl : '';
5796
+        $list .= !$first ? '</ul>'.$nl : '';
5797 5797
 
5798 5798
         return $list;
5799 5799
     }
@@ -5869,7 +5869,7 @@  discard block
 block discarded – undo
5869 5869
      */
5870 5870
     public function addSnippet($name, $phpCode)
5871 5871
     {
5872
-        $this->snippetCache['#' . $name] = $phpCode;
5872
+        $this->snippetCache['#'.$name] = $phpCode;
5873 5873
     }
5874 5874
 
5875 5875
     /**
@@ -5878,7 +5878,7 @@  discard block
 block discarded – undo
5878 5878
      */
5879 5879
     public function addChunk($name, $text)
5880 5880
     {
5881
-        $this->chunkCache['#' . $name] = $text;
5881
+        $this->chunkCache['#'.$name] = $text;
5882 5882
     }
5883 5883
 
5884 5884
     /**
@@ -5914,7 +5914,7 @@  discard block
 block discarded – undo
5914 5914
         }
5915 5915
 
5916 5916
         if (!$isSafe) {
5917
-            $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);
5917
+            $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);
5918 5918
             $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50)));
5919 5919
             $this->messageQuit($title, '', true, '', '', 'Parser', $msg);
5920 5920
             return;
@@ -5928,7 +5928,7 @@  discard block
 block discarded – undo
5928 5928
             return 'array()';
5929 5929
         }
5930 5930
 
5931
-        $output = $echo . $return;
5931
+        $output = $echo.$return;
5932 5932
         modx_sanitize_gpc($output);
5933 5933
         return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous
5934 5934
     }
@@ -5946,8 +5946,8 @@  discard block
 block discarded – undo
5946 5946
 
5947 5947
         $safe = explode(',', $safe_functions);
5948 5948
 
5949
-        $phpcode = rtrim($phpcode, ';') . ';';
5950
-        $tokens = token_get_all('<?php ' . $phpcode);
5949
+        $phpcode = rtrim($phpcode, ';').';';
5950
+        $tokens = token_get_all('<?php '.$phpcode);
5951 5951
         foreach ($tokens as $i => $token) {
5952 5952
             if (!is_array($token)) {
5953 5953
                 continue;
@@ -5982,7 +5982,7 @@  discard block
 block discarded – undo
5982 5982
      */
5983 5983
     public function atBindFileContent($str = '')
5984 5984
     {
5985
-        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', '');
5985
+        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', '');
5986 5986
 
5987 5987
         if (stripos($str, '@FILE') !== 0) {
5988 5988
             return $str;
@@ -6005,7 +6005,7 @@  discard block
 block discarded – undo
6005 6005
         $errorMsg = sprintf("Could not retrieve string '%s'.", $str);
6006 6006
 
6007 6007
         foreach ($search_path as $path) {
6008
-            $file_path = MODX_BASE_PATH . $path . $str;
6008
+            $file_path = MODX_BASE_PATH.$path.$str;
6009 6009
             if (strpos($file_path, MODX_MANAGER_PATH) === 0) {
6010 6010
                 return $errorMsg;
6011 6011
             } elseif (is_file($file_path)) {
@@ -6019,7 +6019,7 @@  discard block
 block discarded – undo
6019 6019
             return $errorMsg;
6020 6020
         }
6021 6021
 
6022
-        $content = (string)file_get_contents($file_path);
6022
+        $content = (string) file_get_contents($file_path);
6023 6023
         if ($content === false) {
6024 6024
             return $errorMsg;
6025 6025
         }
@@ -6131,22 +6131,22 @@  discard block
 block discarded – undo
6131 6131
 
6132 6132
         $version = isset($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
6133 6133
         $release_date = isset($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
6134
-        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI'];
6134
+        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI'];
6135 6135
         $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);
6136 6136
         $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);
6137 6137
         $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);
6138 6138
         if ($is_error) {
6139 6139
             $str = '<h2 style="color:red">&laquo; Evo Parse Error &raquo;</h2>';
6140 6140
             if ($msg != 'PHP Parse Error') {
6141
-                $str .= '<h3 style="color:red">' . $msg . '</h3>';
6141
+                $str .= '<h3 style="color:red">'.$msg.'</h3>';
6142 6142
             }
6143 6143
         } else {
6144 6144
             $str = '<h2 style="color:#003399">&laquo; Evo Debug/ stop message &raquo;</h2>';
6145
-            $str .= '<h3 style="color:#003399">' . $msg . '</h3>';
6145
+            $str .= '<h3 style="color:#003399">'.$msg.'</h3>';
6146 6146
         }
6147 6147
 
6148 6148
         if (!empty($query)) {
6149
-            $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL &gt; <span id="sqlHolder">' . $query . '</span></div>';
6149
+            $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL &gt; <span id="sqlHolder">'.$query.'</span></div>';
6150 6150
         }
6151 6151
 
6152 6152
         $errortype = array(
@@ -6169,13 +6169,13 @@  discard block
 block discarded – undo
6169 6169
 
6170 6170
         if (!empty($nr) || !empty($file)) {
6171 6171
             if ($text != '') {
6172
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';
6172
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';
6173 6173
             }
6174 6174
             if ($output != '') {
6175
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';
6175
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';
6176 6176
             }
6177 6177
             if ($nr !== '') {
6178
-                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]");
6178
+                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]");
6179 6179
             }
6180 6180
             if ($file) {
6181 6181
                 $table[] = array('File', $file);
@@ -6194,7 +6194,7 @@  discard block
 block discarded – undo
6194 6194
         }
6195 6195
 
6196 6196
         if (!empty($this->event->activePlugin)) {
6197
-            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')');
6197
+            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')');
6198 6198
         }
6199 6199
 
6200 6200
         $str .= $MakeTable->create($table, array('Error information', ''));
@@ -6204,17 +6204,17 @@  discard block
 block discarded – undo
6204 6204
         $table[] = array('REQUEST_URI', $request_uri);
6205 6205
 
6206 6206
         if ($this->manager->action) {
6207
-            include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
6207
+            include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
6208 6208
             global $action_list;
6209 6209
             $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : '';
6210 6210
 
6211
-            $table[] = array('Manager action', $this->manager->action . $actionName);
6211
+            $table[] = array('Manager action', $this->manager->action.$actionName);
6212 6212
         }
6213 6213
 
6214 6214
         if (preg_match('@^[0-9]+@', $this->documentIdentifier)) {
6215 6215
             $resource = $this->getDocumentObject('id', $this->documentIdentifier);
6216 6216
             $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');
6217
-            $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>');
6217
+            $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>');
6218 6218
         }
6219 6219
         $table[] = array('Referer', $referer);
6220 6220
         $table[] = array('User Agent', $ua);
@@ -6235,7 +6235,7 @@  discard block
 block discarded – undo
6235 6235
 
6236 6236
         $mem = memory_get_peak_usage(true);
6237 6237
         $total_mem = $mem - $this->mstart;
6238
-        $total_mem = ($total_mem / 1024 / 1024) . ' mb';
6238
+        $total_mem = ($total_mem / 1024 / 1024).' mb';
6239 6239
 
6240 6240
         $queryTime = $this->queryTime;
6241 6241
         $phpTime = $totalTime - $queryTime;
@@ -6256,18 +6256,18 @@  discard block
 block discarded – undo
6256 6256
         $str .= $this->get_backtrace(debug_backtrace());
6257 6257
         // Log error
6258 6258
         if (!empty($this->currentSnippet)) {
6259
-            $source = 'Snippet - ' . $this->currentSnippet;
6259
+            $source = 'Snippet - '.$this->currentSnippet;
6260 6260
         } elseif (!empty($this->event->activePlugin)) {
6261
-            $source = 'Plugin - ' . $this->event->activePlugin;
6261
+            $source = 'Plugin - '.$this->event->activePlugin;
6262 6262
         } elseif ($source !== '') {
6263
-            $source = 'Parser - ' . $source;
6263
+            $source = 'Parser - '.$source;
6264 6264
         } elseif ($query !== '') {
6265 6265
             $source = 'SQL Query';
6266 6266
         } else {
6267 6267
             $source = 'Parser';
6268 6268
         }
6269 6269
         if ($msg) {
6270
-            $source .= ' / ' . $msg;
6270
+            $source .= ' / '.$msg;
6271 6271
         }
6272 6272
         if (isset($actionName) && !empty($actionName)) {
6273 6273
             $source .= $actionName;
@@ -6299,12 +6299,12 @@  discard block
 block discarded – undo
6299 6299
 
6300 6300
         // Display error
6301 6301
         if (isset($_SESSION['mgrValidated'])) {
6302
-            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 . ' &raquo; ' . $release_date . '</title>
6302
+            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.' &raquo; '.$release_date.'</title>
6303 6303
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6304
-                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />
6304
+                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />
6305 6305
                  <style type="text/css">body { padding:10px; } td {font:inherit;}</style>
6306 6306
                  </head><body>
6307
-                 ' . $str . '</body></html>';
6307
+                 ' . $str.'</body></html>';
6308 6308
         } else {
6309 6309
             echo 'Error';
6310 6310
         }
@@ -6341,7 +6341,7 @@  discard block
 block discarded – undo
6341 6341
             switch ($val['type']) {
6342 6342
                 case '->':
6343 6343
                 case '::':
6344
-                    $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];
6344
+                    $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];
6345 6345
                     break;
6346 6346
                 default:
6347 6347
                     $functionName = $val['function'];
@@ -6351,7 +6351,7 @@  discard block
 block discarded – undo
6351 6351
             $args = array_pad(array(), $_, '$var');
6352 6352
             $args = implode(", ", $args);
6353 6353
             $modx = &$this;
6354
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6354
+            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) {
6355 6355
                 $arg = $val['args'][$tmp - 1];
6356 6356
                 switch (true) {
6357 6357
                     case is_null($arg): {
@@ -6363,7 +6363,7 @@  discard block
 block discarded – undo
6363 6363
                         break;
6364 6364
                     }
6365 6365
                     case is_scalar($arg): {
6366
-                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'");
6366
+                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'");
6367 6367
                         break;
6368 6368
                     }
6369 6369
                     case is_bool($arg): {
@@ -6371,23 +6371,23 @@  discard block
 block discarded – undo
6371 6371
                         break;
6372 6372
                     }
6373 6373
                     case is_array($arg): {
6374
-                        $out = 'array $var' . $tmp;
6374
+                        $out = 'array $var'.$tmp;
6375 6375
                         break;
6376 6376
                     }
6377 6377
                     case is_object($arg): {
6378
-                        $out = get_class($arg) . ' $var' . $tmp;
6378
+                        $out = get_class($arg).' $var'.$tmp;
6379 6379
                         break;
6380 6380
                     }
6381 6381
                     default: {
6382
-                        $out = '$var' . $tmp;
6382
+                        $out = '$var'.$tmp;
6383 6383
                     }
6384 6384
                 }
6385 6385
                 $tmp++;
6386 6386
                 return $out;
6387 6387
             }, $args);
6388 6388
             $line = array(
6389
-                "<strong>" . $functionName . "</strong>(" . $args . ")",
6390
-                $path . " on line " . $val['line']
6389
+                "<strong>".$functionName."</strong>(".$args.")",
6390
+                $path." on line ".$val['line']
6391 6391
             );
6392 6392
             $table[] = array(implode("<br />", $line));
6393 6393
         }
@@ -6428,7 +6428,7 @@  discard block
 block discarded – undo
6428 6428
             $alias = strip_tags($alias); // strip HTML
6429 6429
             $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters
6430 6430
             $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash
6431
-            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one
6431
+            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one
6432 6432
             $alias = trim($alias, '-'); // trim excess
6433 6433
             return $alias;
6434 6434
         }
@@ -6444,7 +6444,7 @@  discard block
 block discarded – undo
6444 6444
         $precisions = count($sizes) - 1;
6445 6445
         foreach ($sizes as $unit => $bytes) {
6446 6446
             if ($size >= $bytes) {
6447
-                return number_format($size / $bytes, $precisions) . ' ' . $unit;
6447
+                return number_format($size / $bytes, $precisions).' '.$unit;
6448 6448
             }
6449 6449
             $precisions--;
6450 6450
         }
@@ -6548,10 +6548,10 @@  discard block
 block discarded – undo
6548 6548
 
6549 6549
         if (strpos($str, MODX_MANAGER_PATH) === 0) {
6550 6550
             return false;
6551
-        } elseif (is_file(MODX_BASE_PATH . $str)) {
6552
-            $file_path = MODX_BASE_PATH . $str;
6553
-        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) {
6554
-            $file_path = MODX_BASE_PATH . $tpl_dir . $str;
6551
+        } elseif (is_file(MODX_BASE_PATH.$str)) {
6552
+            $file_path = MODX_BASE_PATH.$str;
6553
+        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) {
6554
+            $file_path = MODX_BASE_PATH.$tpl_dir.$str;
6555 6555
         } else {
6556 6556
             return false;
6557 6557
         }
@@ -6677,7 +6677,7 @@  discard block
 block discarded – undo
6677 6677
             $title = 'no title';
6678 6678
         }
6679 6679
         if (is_array($msg)) {
6680
-            $msg = '<pre>' . print_r($msg, true) . '</pre>';
6680
+            $msg = '<pre>'.print_r($msg, true).'</pre>';
6681 6681
         } elseif ($msg === '') {
6682 6682
             $msg = $_SERVER['REQUEST_URI'];
6683 6683
         }
@@ -6721,7 +6721,7 @@  discard block
 block discarded – undo
6721 6721
         if (is_array($SystemAlertMsgQueque)) {
6722 6722
             $title = '';
6723 6723
             if ($this->name && $this->activePlugin) {
6724
-                $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>";
6724
+                $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>";
6725 6725
             }
6726 6726
             $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>";
6727 6727
         }
Please login to merge, or discard this patch.
manager/includes/extenders/maketable.class.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function setTableWidth($value)
132 132
     {
133
-        $this->tableWidth = (int)$value;
133
+        $this->tableWidth = (int) $value;
134 134
     }
135 135
 
136 136
     /**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     {
318 318
         $currentWidth = '';
319 319
         if (is_array($this->columnWidths)) {
320
-            $currentWidth = $this->columnWidths[$columnPosition] ? ' width="' . $this->columnWidths[$columnPosition] . '" ' : '';
320
+            $currentWidth = $this->columnWidths[$columnPosition] ? ' width="'.$this->columnWidths[$columnPosition].'" ' : '';
321 321
         }
322 322
 
323 323
         return $currentWidth;
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
             $currentClass = $this->rowAlternateClass;
347 347
         }
348 348
 
349
-        return ' class="' . $currentClass . '"';
349
+        return ' class="'.$currentClass.'"';
350 350
     }
351 351
 
352 352
     /**
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
     {
361 361
         $cellAction = '';
362 362
         if ($this->cellAction) {
363
-            $cellAction = ' onClick="javascript:window.location=\'' . $this->cellAction . $this->actionField . '=' . urlencode($currentActionFieldValue) . '\'" ';
363
+            $cellAction = ' onClick="javascript:window.location=\''.$this->cellAction.$this->actionField.'='.urlencode($currentActionFieldValue).'\'" ';
364 364
         }
365 365
 
366 366
         return $cellAction;
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
     {
378 378
         $cell = $value;
379 379
         if ($this->linkAction) {
380
-            $cell = '<a href="' . $this->linkAction . $this->actionField . '=' . urlencode($currentActionFieldValue) . '">' . $cell . '</a>';
380
+            $cell = '<a href="'.$this->linkAction.$this->actionField.'='.urlencode($currentActionFieldValue).'">'.$cell.'</a>';
381 381
         }
382 382
 
383 383
         return $cell;
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
             $end = '?';
407 407
         }
408 408
 
409
-        return $link . $end;
409
+        return $link.$end;
410 410
     }
411 411
 
412 412
     /**
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
         if (is_array($fieldsArray)) {
427 427
             $i = 0;
428 428
             foreach ($fieldsArray as $fieldName => $fieldValue) {
429
-                $table .= "\t<tr" . $this->determineRowClass($i) . ">\n";
429
+                $table .= "\t<tr".$this->determineRowClass($i).">\n";
430 430
                 $currentActionFieldValue = $fieldValue[$this->actionField];
431 431
                 if (is_array($this->selectedValues)) {
432 432
                     $isChecked = array_search($currentActionFieldValue, $this->selectedValues) === false ? 0 : 1;
@@ -437,15 +437,15 @@  discard block
 block discarded – undo
437 437
                 $colPosition = 0;
438 438
                 foreach ($fieldValue as $key => $value) {
439 439
                     if (!in_array($key, $this->excludeFields)) {
440
-                        $table .= "\t\t<td" . $this->getCellAction($currentActionFieldValue) . ">";
440
+                        $table .= "\t\t<td".$this->getCellAction($currentActionFieldValue).">";
441 441
                         $table .= $this->createCellText($currentActionFieldValue, $value);
442 442
                         $table .= "</td>\n";
443 443
                         if ($i == 0) {
444 444
                             if (empty($header) && $this->formElementType) {
445
-                                $header .= "\t\t<th style=\"width:32px\" " . ($this->thClass ? 'class="' . $this->thClass . '"' : '') . ">" . ($this->allOption ? '<a href="javascript:clickAll()">all</a>' : '') . "</th>\n";
445
+                                $header .= "\t\t<th style=\"width:32px\" ".($this->thClass ? 'class="'.$this->thClass.'"' : '').">".($this->allOption ? '<a href="javascript:clickAll()">all</a>' : '')."</th>\n";
446 446
                             }
447 447
                             $headerText = array_key_exists($key, $fieldHeadersArray) ? $fieldHeadersArray[$key] : $key;
448
-                            $header .= "\t\t<th" . $this->getColumnWidth($colPosition) . ($this->thClass ? ' class="' . $this->thClass . '" ' : '') . ">" . $headerText . "</th>\n";
448
+                            $header .= "\t\t<th".$this->getColumnWidth($colPosition).($this->thClass ? ' class="'.$this->thClass.'" ' : '').">".$headerText."</th>\n";
449 449
                         }
450 450
                         $colPosition++;
451 451
                     }
@@ -453,9 +453,9 @@  discard block
 block discarded – undo
453 453
                 $i++;
454 454
                 $table .= "\t</tr>\n";
455 455
             }
456
-            $table = "\n" . '<table' . ($this->tableWidth > 0 ? ' width="' . $this->tableWidth . '"' : '') . ($this->tableClass ? ' class="' . $this->tableClass . '"' : '') . ($this->tableID ? ' id="' . $this->tableID . '"' : '') . ">\n" . ($header ? "\t<thead>\n\t<tr class=\"" . $this->rowHeaderClass . "\">\n" . $header . "\t</tr>\n\t</thead>\n" : '') . $table . "</table>\n";
456
+            $table = "\n".'<table'.($this->tableWidth > 0 ? ' width="'.$this->tableWidth.'"' : '').($this->tableClass ? ' class="'.$this->tableClass.'"' : '').($this->tableID ? ' id="'.$this->tableID.'"' : '').">\n".($header ? "\t<thead>\n\t<tr class=\"".$this->rowHeaderClass."\">\n".$header."\t</tr>\n\t</thead>\n" : '').$table."</table>\n";
457 457
             if ($this->formElementType) {
458
-                $table = "\n" . '<form id="' . $this->formName . '" name="' . $this->formName . '" action="' . $this->formAction . '" method="POST">' . $table;
458
+                $table = "\n".'<form id="'.$this->formName.'" name="'.$this->formName.'" action="'.$this->formAction.'" method="POST">'.$table;
459 459
             }
460 460
             if (strlen($this->pageNav) > 1) {//changed to display the pagination if exists.
461 461
                 /* commented this part because of cookie
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 
470 470
                 $table .= '</select>'.$_lang["pagination_table_perpage"].'</div>';
471 471
                 */
472
-                $table .= '<div id="pagination" class="paginate">' . $_lang["pagination_table_gotopage"] . '<ul>' . $this->pageNav . '</ul></div>';
472
+                $table .= '<div id="pagination" class="paginate">'.$_lang["pagination_table_gotopage"].'<ul>'.$this->pageNav.'</ul></div>';
473 473
                 //$table .= '<script language="javascript">function updatePageSize(size){window.location = \''.$this->prepareLink($linkpage).'pageSize=\'+size;}</script>';
474 474
             }
475 475
             if ($this->allOption) {
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 <script language="javascript">
478 478
 	toggled = 0;
479 479
 	function clickAll() {
480
-		myform = document.getElementById("' . $this->formName . '");
480
+		myform = document.getElementById("' . $this->formName.'");
481 481
 		for(i=0;i<myform.length;i++) {
482 482
 			if(myform.elements[i].type==\'checkbox\') {
483 483
 				myform.elements[i].checked=(toggled?false:true);
@@ -489,9 +489,9 @@  discard block
 block discarded – undo
489 489
             }
490 490
             if ($this->formElementType) {
491 491
                 if ($this->extra) {
492
-                    $table .= "\n" . $this->extra . "\n";
492
+                    $table .= "\n".$this->extra."\n";
493 493
                 }
494
-                $table .= "\n" . '</form>' . "\n";
494
+                $table .= "\n".'</form>'."\n";
495 495
             }
496 496
 
497 497
             return $table;
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
         $numPages = ceil($numRecords / MAX_DISPLAY_RECORDS_NUM);
515 515
         $nav = '';
516 516
         if ($numPages > 1) {
517
-            $currentURL = empty($qs) ? '' : '?' . $qs;
517
+            $currentURL = empty($qs) ? '' : '?'.$qs;
518 518
             if ($currentPage > 6) {
519 519
                 $nav .= $this->createPageLink($currentURL, 1, $_lang["pagination_table_first"]);
520 520
             }
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
                 $nav .= $this->createPageLink($currentURL, $numPages, $_lang["pagination_table_last"]);
540 540
             }
541 541
         }
542
-        $this->pageNav = ' ' . $nav;
542
+        $this->pageNav = ' '.$nav;
543 543
     }
544 544
 
545 545
     /**
@@ -555,14 +555,14 @@  discard block
 block discarded – undo
555 555
     public function createPageLink($link = '', $pageNum, $displayText, $currentPage = false, $qs = '')
556 556
     {
557 557
         $modx = evolutionCMS();
558
-        $orderBy = !empty($_GET['orderby']) ? '&orderby=' . $_GET['orderby'] : '';
559
-        $orderDir = !empty($_GET['orderdir']) ? '&orderdir=' . $_GET['orderdir'] : '';
558
+        $orderBy = !empty($_GET['orderby']) ? '&orderby='.$_GET['orderby'] : '';
559
+        $orderDir = !empty($_GET['orderdir']) ? '&orderdir='.$_GET['orderdir'] : '';
560 560
         if (!empty($qs)) {
561 561
             $qs = "?$qs";
562 562
         }
563 563
         $link = empty($link) ? $modx->makeUrl($modx->documentIdentifier, $modx->documentObject['alias'],
564
-            $qs . "page=$pageNum$orderBy$orderDir") : $this->prepareLink($link) . "page=$pageNum";
565
-        $nav = '<li' . ($currentPage ? ' class="currentPage"' : '') . '><a' . ($currentPage ? ' class="currentPage"' : '') . ' href="' . $link . '">' . $displayText . '</a></li>' . "\n";
564
+            $qs."page=$pageNum$orderBy$orderDir") : $this->prepareLink($link)."page=$pageNum";
565
+        $nav = '<li'.($currentPage ? ' class="currentPage"' : '').'><a'.($currentPage ? ' class="currentPage"' : '').' href="'.$link.'">'.$displayText.'</a></li>'."\n";
566 566
 
567 567
         return $nav;
568 568
     }
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
         $field = '';
581 581
         if ($this->formElementType) {
582 582
             $checked = $isChecked ? "checked " : "";
583
-            $field = "\t\t" . '<td><input type="' . $this->formElementType . '" name="' . ($this->formElementName ? $this->formElementName : $value) . '"  value="' . $value . '" ' . $checked . '/></td>' . "\n";
583
+            $field = "\t\t".'<td><input type="'.$this->formElementType.'" name="'.($this->formElementName ? $this->formElementName : $value).'"  value="'.$value.'" '.$checked.'/></td>'."\n";
584 584
         }
585 585
 
586 586
         return $field;
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
     public function handlePaging()
595 595
     {
596 596
         $offset = (is_numeric($_GET['page']) && $_GET['page'] > 0) ? $_GET['page'] - 1 : 0;
597
-        $limitClause = ' LIMIT ' . ($offset * MAX_DISPLAY_RECORDS_NUM) . ', ' . MAX_DISPLAY_RECORDS_NUM;
597
+        $limitClause = ' LIMIT '.($offset * MAX_DISPLAY_RECORDS_NUM).', '.MAX_DISPLAY_RECORDS_NUM;
598 598
 
599 599
         return $limitClause;
600 600
     }
@@ -609,10 +609,10 @@  discard block
 block discarded – undo
609 609
     public function handleSorting($natural_order = false)
610 610
     {
611 611
         $orderByClause = '';
612
-        if ((bool)$natural_order === false) {
612
+        if ((bool) $natural_order === false) {
613 613
             $orderby = !empty($_GET['orderby']) ? $_GET['orderby'] : "id";
614 614
             $orderdir = !empty($_GET['orderdir']) ? $_GET['orderdir'] : "DESC";
615
-            $orderByClause = !empty($orderby) ? ' ORDER BY ' . $orderby . ' ' . $orderdir . ' ' : "";
615
+            $orderByClause = !empty($orderby) ? ' ORDER BY '.$orderby.' '.$orderdir.' ' : "";
616 616
         }
617 617
 
618 618
         return $orderByClause;
@@ -641,6 +641,6 @@  discard block
 block discarded – undo
641 641
             }
642 642
         }
643 643
 
644
-        return '<a href="[~' . $modx->documentIdentifier . '~]?' . $qs . 'orderby=' . $key . $orderDir . '">' . $text . '</a>';
644
+        return '<a href="[~'.$modx->documentIdentifier.'~]?'.$qs.'orderby='.$key.$orderDir.'">'.$text.'</a>';
645 645
     }
646 646
 }
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers.class.inc.php 1 patch
Spacing   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if (!defined('MODX_CORE_PATH')) {
4
-    define('MODX_CORE_PATH', MODX_MANAGER_PATH . 'includes/');
4
+    define('MODX_CORE_PATH', MODX_MANAGER_PATH.'includes/');
5 5
 }
6 6
 
7 7
 class MODIFIERS
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
     public function phxFilter($key, $value, $modifiers)
79 79
     {
80 80
         $modx = evolutionCMS();
81
-        if (substr($modifiers, 0, 3)!=='id(') {
81
+        if (substr($modifiers, 0, 3) !== 'id(') {
82 82
             $value = $this->parseDocumentSource($value);
83 83
         }
84 84
         $this->srcValue = $value;
85 85
         $modifiers = trim($modifiers);
86
-        $modifiers = ':' . trim($modifiers, ':');
87
-        $modifiers = str_replace(array("\r\n","\r"), "\n", $modifiers);
86
+        $modifiers = ':'.trim($modifiers, ':');
87
+        $modifiers = str_replace(array("\r\n", "\r"), "\n", $modifiers);
88 88
         $modifiers = $this->splitEachModifiers($modifiers);
89 89
 
90 90
         $this->placeholders = array();
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $this->placeholders['dummy'] = '';
93 93
         $this->condition = array();
94 94
         $this->vars = array();
95
-        $this->vars['name']    = & $key;
95
+        $this->vars['name'] = & $key;
96 96
         $value = $this->parsePhx($key, $value, $modifiers);
97 97
         $this->vars = array();
98 98
         return $value;
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
         }
112 112
 
113 113
         $modifiers = substr($modifiers, 1);
114
-        $closure = $mode=='(' ? "{$c})" : $c;
115
-        if (strpos($modifiers, $closure)===false) {
114
+        $closure = $mode == '(' ? "{$c})" : $c;
115
+        if (strpos($modifiers, $closure) === false) {
116 116
             return false;
117 117
         }
118 118
 
@@ -128,23 +128,23 @@  discard block
 block discarded – undo
128 128
     public function _getOpt($mode, $delim, $modifiers)
129 129
     {
130 130
         if ($delim) {
131
-            if ($mode=='(') {
132
-                return substr($modifiers, 1, strpos($modifiers, $delim . ')')-1);
131
+            if ($mode == '(') {
132
+                return substr($modifiers, 1, strpos($modifiers, $delim.')') - 1);
133 133
             }
134 134
 
135
-            return substr($modifiers, 1, strpos($modifiers, $delim, 1)-1);
135
+            return substr($modifiers, 1, strpos($modifiers, $delim, 1) - 1);
136 136
         } else {
137
-            if ($mode=='(') {
137
+            if ($mode == '(') {
138 138
                 return substr($modifiers, 0, strpos($modifiers, ')'));
139 139
             }
140 140
 
141 141
             $chars = str_split($modifiers);
142
-            $opt='';
142
+            $opt = '';
143 143
             foreach ($chars as $c) {
144
-                if ($c==':' || $c==')') {
144
+                if ($c == ':' || $c == ')') {
145 145
                     break;
146 146
                 }
147
-                $opt .=$c;
147
+                $opt .= $c;
148 148
             }
149 149
             return $opt;
150 150
         }
@@ -152,20 +152,20 @@  discard block
 block discarded – undo
152 152
     public function _getRemainModifiers($mode, $delim, $modifiers)
153 153
     {
154 154
         if ($delim) {
155
-            if ($mode=='(') {
156
-                return $this->_fetchContent($modifiers, $delim . ')');
155
+            if ($mode == '(') {
156
+                return $this->_fetchContent($modifiers, $delim.')');
157 157
             } else {
158 158
                 $modifiers = trim($modifiers);
159 159
                 $modifiers = substr($modifiers, 1);
160 160
                 return $this->_fetchContent($modifiers, $delim);
161 161
             }
162 162
         } else {
163
-            if ($mode=='(') {
163
+            if ($mode == '(') {
164 164
                 return $this->_fetchContent($modifiers, ')');
165 165
             }
166 166
             $chars = str_split($modifiers);
167 167
             foreach ($chars as $c) {
168
-                if ($c==':') {
168
+                if ($c == ':') {
169 169
                     return $modifiers;
170 170
                 } else {
171 171
                     $modifiers = substr($modifiers, 1);
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     {
180 180
         $len = strlen($delim);
181 181
         $string = $this->parseDocumentSource($string);
182
-        return substr($string, strpos($string, $delim)+$len);
182
+        return substr($string, strpos($string, $delim) + $len);
183 183
     }
184 184
 
185 185
     public function splitEachModifiers($modifiers)
@@ -189,16 +189,16 @@  discard block
 block discarded – undo
189 189
         $cmd = '';
190 190
         $bt = '';
191 191
         $result = array();
192
-        while ($bt!==$modifiers) {
192
+        while ($bt !== $modifiers) {
193 193
             $bt = $modifiers;
194 194
             $c = substr($modifiers, 0, 1);
195 195
             $modifiers = substr($modifiers, 1);
196 196
 
197
-            if ($c===':' && preg_match('@^(!?[<>=]{1,2})@', $modifiers, $match)) { // :=, :!=, :<=, :>=, :!<=, :!>=
197
+            if ($c === ':' && preg_match('@^(!?[<>=]{1,2})@', $modifiers, $match)) { // :=, :!=, :<=, :>=, :!<=, :!>=
198 198
                 $c = substr($modifiers, strlen($match[1]), 1);
199 199
                 $debuginfo = "#i=0 #c=[{$c}] #m=[{$modifiers}]";
200
-                if ($c==='(') {
201
-                    $modifiers = substr($modifiers, strlen($match[1])+1);
200
+                if ($c === '(') {
201
+                    $modifiers = substr($modifiers, strlen($match[1]) + 1);
202 202
                 } else {
203 203
                     $modifiers = substr($modifiers, strlen($match[1]));
204 204
                 }
@@ -207,33 +207,33 @@  discard block
 block discarded – undo
207 207
                 $opt       = $this->_getOpt($c, $delim, $modifiers);
208 208
                 $modifiers = trim($this->_getRemainModifiers($c, $delim, $modifiers));
209 209
 
210
-                $result[]=array('cmd'=>trim($match[1]),'opt'=>$opt,'debuginfo'=>$debuginfo);
210
+                $result[] = array('cmd'=>trim($match[1]), 'opt'=>$opt, 'debuginfo'=>$debuginfo);
211 211
                 $cmd = '';
212
-            } elseif (in_array($c, array('+','-','*','/')) && preg_match('@^[0-9]+@', $modifiers, $match)) { // :+3, :-3, :*3 ...
212
+            } elseif (in_array($c, array('+', '-', '*', '/')) && preg_match('@^[0-9]+@', $modifiers, $match)) { // :+3, :-3, :*3 ...
213 213
                 $modifiers = substr($modifiers, strlen($match[0]));
214
-                $result[]=array('cmd'=>'math','opt'=>'%s' . $c . $match[0]);
214
+                $result[] = array('cmd'=>'math', 'opt'=>'%s'.$c.$match[0]);
215 215
                 $cmd = '';
216
-            } elseif ($c==='(' || $c==='=') {
216
+            } elseif ($c === '(' || $c === '=') {
217 217
                 $modifiers = $m1 = trim($modifiers);
218 218
                 $delim     = $this->_getDelim($c, $modifiers);
219 219
                 $opt       = $this->_getOpt($c, $delim, $modifiers);
220 220
                 $modifiers = trim($this->_getRemainModifiers($c, $delim, $modifiers));
221 221
                 $debuginfo = "#i=1 #c=[{$c}] #delim=[{$delim}] #m1=[{$m1}] remainMdf=[{$modifiers}]";
222 222
 
223
-                $result[]=array('cmd'=>trim($cmd),'opt'=>$opt,'debuginfo'=>$debuginfo);
223
+                $result[] = array('cmd'=>trim($cmd), 'opt'=>$opt, 'debuginfo'=>$debuginfo);
224 224
 
225 225
                 $cmd = '';
226
-            } elseif ($c==':') {
226
+            } elseif ($c == ':') {
227 227
                 $debuginfo = "#i=2 #c=[{$c}] #m=[{$modifiers}]";
228
-                if ($cmd!=='') {
229
-                    $result[]=array('cmd'=>trim($cmd),'opt'=>'','debuginfo'=>$debuginfo);
228
+                if ($cmd !== '') {
229
+                    $result[] = array('cmd'=>trim($cmd), 'opt'=>'', 'debuginfo'=>$debuginfo);
230 230
                 }
231 231
 
232 232
                 $cmd = '';
233
-            } elseif (trim($modifiers)=='' && trim($cmd)!=='') {
233
+            } elseif (trim($modifiers) == '' && trim($cmd) !== '') {
234 234
                 $debuginfo = "#i=3 #c=[{$c}] #m=[{$modifiers}]";
235 235
                 $cmd .= $c;
236
-                $result[]=array('cmd'=>trim($cmd),'opt'=>'','debuginfo'=>$debuginfo);
236
+                $result[] = array('cmd'=>trim($cmd), 'opt'=>'', 'debuginfo'=>$debuginfo);
237 237
 
238 238
                 break;
239 239
             } else {
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
         }
271 271
         $_ = explode(',', $this->condModifiers);
272 272
         if (in_array($lastKey, $_)) {
273
-            $modifiers[] = array('cmd'=>'then','opt'=>'1');
274
-            $modifiers[] = array('cmd'=>'else','opt'=>'0');
273
+            $modifiers[] = array('cmd'=>'then', 'opt'=>'1');
274
+            $modifiers[] = array('cmd'=>'else', 'opt'=>'0');
275 275
         }
276 276
 
277 277
         foreach ($modifiers as $i=>$a) {
@@ -282,17 +282,17 @@  discard block
 block discarded – undo
282 282
     }
283 283
 
284 284
     // Parser: modifier detection and eXtended processing if needed
285
-    public function Filter($key, $value, $cmd, $opt='')
285
+    public function Filter($key, $value, $cmd, $opt = '')
286 286
     {
287 287
         $modx = evolutionCMS();
288 288
 
289
-        if ($key==='documentObject') {
289
+        if ($key === 'documentObject') {
290 290
             $value = $modx->documentIdentifier;
291 291
         }
292 292
         $cmd = $this->parseDocumentSource($cmd);
293 293
         if (preg_match('@^[1-9][/0-9]*$@', $cmd)) {
294
-            if (strpos($cmd, '/')!==false) {
295
-                $cmd = $this->substr($cmd, strrpos($cmd, '/')+1);
294
+            if (strpos($cmd, '/') !== false) {
295
+                $cmd = $this->substr($cmd, strrpos($cmd, '/') + 1);
296 296
             }
297 297
             $opt = $cmd;
298 298
             $cmd = 'id';
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         }
308 308
 
309 309
         $cmd = strtolower($cmd);
310
-        if ($this->elmName!=='') {
310
+        if ($this->elmName !== '') {
311 311
             $value = $this->getValueFromElement($key, $value, $cmd, $opt);
312 312
         } else {
313 313
             $value = $this->getValueFromPreset($key, $value, $cmd, $opt);
@@ -320,11 +320,11 @@  discard block
 block discarded – undo
320 320
 
321 321
     public function isEmpty($cmd, $value)
322 322
     {
323
-        if ($value!=='') {
323
+        if ($value !== '') {
324 324
             return false;
325 325
         }
326 326
 
327
-        $_ = explode(',', $this->condModifiers . ',_default,default,if,input,or,and,show,this,select,switch,then,else,id,ifempty,smart_desc,smart_description,summary');
327
+        $_ = explode(',', $this->condModifiers.',_default,default,if,input,or,and,show,this,select,switch,then,else,id,ifempty,smart_desc,smart_description,summary');
328 328
         if (in_array($cmd, $_)) {
329 329
             return false;
330 330
         } else {
@@ -356,56 +356,56 @@  discard block
 block discarded – undo
356 356
             case 'eq':
357 357
             case 'is':
358 358
             case 'equals':
359
-                $this->condition[] = (int)($value == $opt); break;
359
+                $this->condition[] = (int) ($value == $opt); break;
360 360
             case 'neq':
361 361
             case 'ne':
362 362
             case 'notequals':
363 363
             case 'isnot':
364 364
             case 'isnt':
365 365
             case 'not':
366
-                $this->condition[] = (int)($value != $opt);break;
366
+                $this->condition[] = (int) ($value != $opt); break;
367 367
             case '%':
368
-                $this->condition[] = (int)($value%$opt==0);break;
368
+                $this->condition[] = (int) ($value % $opt == 0); break;
369 369
             case 'isempty':
370
-                $this->condition[] = (int)(empty($value)); break;
370
+                $this->condition[] = (int) (empty($value)); break;
371 371
             case 'isntempty':
372 372
             case 'isnotempty':
373
-                $this->condition[] = (int)(!empty($value)); break;
373
+                $this->condition[] = (int) (!empty($value)); break;
374 374
             case '>=':
375 375
             case 'gte':
376 376
             case 'eg':
377 377
             case 'isgte':
378
-                $this->condition[] = (int)($value >= $opt);break;
378
+                $this->condition[] = (int) ($value >= $opt); break;
379 379
             case '<=':
380 380
             case 'lte':
381 381
             case 'el':
382 382
             case 'islte':
383
-                $this->condition[] = (int)($value <= $opt);break;
383
+                $this->condition[] = (int) ($value <= $opt); break;
384 384
             case '>':
385 385
             case 'gt':
386 386
             case 'greaterthan':
387 387
             case 'isgreaterthan':
388 388
             case 'isgt':
389
-                $this->condition[] = (int)($value > $opt);break;
389
+                $this->condition[] = (int) ($value > $opt); break;
390 390
             case '<':
391 391
             case 'lt':
392 392
             case 'lowerthan':
393 393
             case 'islowerthan':
394 394
             case 'islt':
395
-                $this->condition[] = (int)($value < $opt);break;
395
+                $this->condition[] = (int) ($value < $opt); break;
396 396
             case 'find':
397
-                $this->condition[] = (int)(strpos($value, $opt)!==false);break;
397
+                $this->condition[] = (int) (strpos($value, $opt) !== false); break;
398 398
             case 'inarray':
399 399
             case 'in_array':
400 400
             case 'in':
401 401
                 $opt = explode(',', $opt);
402
-                $this->condition[] = (int)(in_array($value, $opt)!==false);break;
402
+                $this->condition[] = (int) (in_array($value, $opt) !== false); break;
403 403
             case 'wildcard_match':
404 404
             case 'wcard_match':
405 405
             case 'wildcard':
406 406
             case 'wcard':
407 407
             case 'fnmatch':
408
-                $this->condition[] = (int)(fnmatch($opt, $value)!==false);break;
408
+                $this->condition[] = (int) (fnmatch($opt, $value) !== false); break;
409 409
             case 'is_file':
410 410
             case 'is_dir':
411 411
             case 'file_exists':
@@ -416,13 +416,13 @@  discard block
 block discarded – undo
416 416
                 } else {
417 417
                     $path = $opt;
418 418
                 }
419
-                if (strpos($path, MODX_MANAGER_PATH)!==false) {
419
+                if (strpos($path, MODX_MANAGER_PATH) !== false) {
420 420
                     exit('Can not read core path');
421 421
                 }
422
-                if (strpos($path, $modx->config['base_path'])===false) {
422
+                if (strpos($path, $modx->config['base_path']) === false) {
423 423
                     $path = ltrim($path, '/');
424 424
                 }
425
-                $this->condition[] = (int)($cmd($path)!==false);break;
425
+                $this->condition[] = (int) ($cmd($path) !== false); break;
426 426
             case 'is_image':
427 427
                 if (!$opt) {
428 428
                     $path = $value;
@@ -430,16 +430,16 @@  discard block
 block discarded – undo
430 430
                     $path = $opt;
431 431
                 }
432 432
                 if (!is_file($path)) {
433
-                    $this->condition[]='0';
433
+                    $this->condition[] = '0';
434 434
                     break;
435 435
                 }
436 436
                 $_ = getimagesize($path);
437
-                $this->condition[] = (int)($_[0]);break;
437
+                $this->condition[] = (int) ($_[0]); break;
438 438
             case 'regex':
439 439
             case 'preg':
440 440
             case 'preg_match':
441 441
             case 'isinrole':
442
-            $this->condition[] = (int)(preg_match($opt, $value));break;
442
+            $this->condition[] = (int) (preg_match($opt, $value)); break;
443 443
             case 'ir':
444 444
             case 'memberof':
445 445
             case 'mo':
@@ -447,27 +447,27 @@  discard block
 block discarded – undo
447 447
                 $this->condition[] = $this->includeMdfFile('memberof');
448 448
                 break;
449 449
             case 'or':
450
-                $this->condition[] = '||';break;
450
+                $this->condition[] = '||'; break;
451 451
             case 'and':
452
-                $this->condition[] = '&&';break;
452
+                $this->condition[] = '&&'; break;
453 453
             case 'show':
454 454
             case 'this':
455 455
                 $conditional = implode(' ', $this->condition);
456
-                $isvalid = (int)(eval("return ({$conditional});"));
456
+                $isvalid = (int) (eval("return ({$conditional});"));
457 457
                 if ($isvalid) {
458 458
                     return $this->srcValue;
459 459
                 }
460 460
                 return null;
461 461
             case 'then':
462 462
                 $conditional = implode(' ', $this->condition);
463
-                $isvalid = (int)eval("return ({$conditional});");
463
+                $isvalid = (int) eval("return ({$conditional});");
464 464
                 if ($isvalid) {
465 465
                     return $opt;
466 466
                 }
467 467
                 return null;
468 468
             case 'else':
469 469
                 $conditional = implode(' ', $this->condition);
470
-                $isvalid = (int)eval("return ({$conditional});");
470
+                $isvalid = (int) eval("return ({$conditional});");
471 471
                 if (!$isvalid) {
472 472
                     return $opt;
473 473
                 }
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
                 $raw = explode('&', $opt);
478 478
                 $map = array();
479 479
                 $c = count($raw);
480
-                for ($m=0; $m<$c; $m++) {
480
+                for ($m = 0; $m < $c; $m++) {
481 481
                     $mi = explode('=', $raw[$m], 2);
482 482
                     $map[$mi[0]] = $mi[1];
483 483
                 }
@@ -510,18 +510,18 @@  discard block
 block discarded – undo
510 510
             case 'html_encode':
511 511
                 return preg_replace('/&amp;(#[0-9]+|[a-z]+);/i', '&$1;', htmlspecialchars($value, ENT_QUOTES, $modx->config['modx_charset']));
512 512
             case 'spam_protect':
513
-                return str_replace(array('@','.'), array('&#64;','&#46;'), $value);
513
+                return str_replace(array('@', '.'), array('&#64;', '&#46;'), $value);
514 514
             case 'strip':
515
-                if ($opt==='') {
515
+                if ($opt === '') {
516 516
                     $opt = ' ';
517 517
                 }
518 518
                 return preg_replace('/[\n\r\t\s]+/', $opt, $value);
519 519
             case 'strip_linefeeds':
520
-                return str_replace(array("\n","\r"), '', $value);
520
+                return str_replace(array("\n", "\r"), '', $value);
521 521
             case 'notags':
522 522
             case 'strip_tags':
523 523
             case 'remove_html':
524
-                if ($opt!=='') {
524
+                if ($opt !== '') {
525 525
                     $param = array();
526 526
                     foreach (explode(',', $opt) as $v) {
527 527
                         $v = trim($v, '</> ');
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
                 } else {
532 532
                     $params = '';
533 533
                 }
534
-                if (!strpos($params, '<br>')===false) {
534
+                if (!strpos($params, '<br>') === false) {
535 535
                     $value = preg_replace('@(<br[ /]*>)\n@', '$1', $value);
536 536
                     $value = preg_replace('@<br[ /]*>@', "\n", $value);
537 537
                 }
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
             case 'encode_url':
542 542
                 return urlencode($value);
543 543
             case 'base64_decode':
544
-                if ($opt!=='false') {
544
+                if ($opt !== 'false') {
545 545
                     $opt = true;
546 546
                 } else {
547 547
                     $opt = false;
@@ -578,12 +578,12 @@  discard block
 block discarded – undo
578 578
                 return implode(' ', $_);
579 579
             case 'zenhan':
580 580
                 if (empty($opt)) {
581
-                    $opt='VKas';
581
+                    $opt = 'VKas';
582 582
                 }
583 583
                 return mb_convert_kana($value, $opt, $modx->config['modx_charset']);
584 584
             case 'hanzen':
585 585
                 if (empty($opt)) {
586
-                    $opt='VKAS';
586
+                    $opt = 'VKAS';
587 587
                 }
588 588
                 return mb_convert_kana($value, $opt, $modx->config['modx_charset']);
589 589
             case 'str_shuffle':
@@ -609,13 +609,13 @@  discard block
 block discarded – undo
609 609
                 $value = preg_replace('/\r/', '', $value);
610 610
                 return count(preg_split('/\n+/', $value));
611 611
             case 'strpos':
612
-                if ($opt!=0&&empty($opt)) {
612
+                if ($opt != 0 && empty($opt)) {
613 613
                     return $value;
614 614
                 }
615 615
                 return $this->strpos($value, $opt);
616 616
             case 'wordwrap':
617 617
                 // default: 70
618
-                  $wrapat = (int)$opt > 0 ? (int)$opt : 70;
618
+                  $wrapat = (int) $opt > 0 ? (int) $opt : 70;
619 619
                 if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
620 620
                     return $this->includeMdfFile('wordwrap');
621 621
                 } else {
@@ -624,12 +624,12 @@  discard block
 block discarded – undo
624 624
                 // no break
625 625
             case 'wrap_text':
626 626
                 $width = preg_match('/^[1-9][0-9]*$/', $opt) ? $opt : 70;
627
-                if ($modx->config['manager_language']==='japanese-utf8') {
627
+                if ($modx->config['manager_language'] === 'japanese-utf8') {
628 628
                     $chunk = array();
629
-                    $bt='';
630
-                    while ($bt!=$value) {
629
+                    $bt = '';
630
+                    while ($bt != $value) {
631 631
                         $bt = $value;
632
-                        if ($this->strlen($value)<$width) {
632
+                        if ($this->strlen($value) < $width) {
633 633
                             $chunk[] = $value;
634 634
                             break;
635 635
                         }
@@ -645,31 +645,31 @@  discard block
 block discarded – undo
645 645
                 if (empty($opt)) {
646 646
                     break;
647 647
                 }
648
-                if (strpos($opt, ',')!==false) {
648
+                if (strpos($opt, ',') !== false) {
649 649
                     list($b, $e) = explode(',', $opt, 2);
650
-                    return $this->substr($value, $b, (int)$e);
650
+                    return $this->substr($value, $b, (int) $e);
651 651
                 } else {
652 652
                     return $this->substr($value, $opt);
653 653
                 }
654 654
                 // no break
655 655
             case 'limit':
656 656
             case 'trim_to': // http://www.movabletype.jp/documentation/appendices/modifiers/trim_to.html
657
-                if (strpos($opt, '+')!==false) {
657
+                if (strpos($opt, '+') !== false) {
658 658
                     list($len, $str) = explode('+', $opt, 2);
659 659
                 } else {
660 660
                     $len = $opt;
661 661
                     $str = '';
662 662
                 }
663
-                if ($len==='') {
663
+                if ($len === '') {
664 664
                     $len = 100;
665 665
                 }
666 666
                 if (abs($len) > $this->strlen($value)) {
667
-                    $str ='';
667
+                    $str = '';
668 668
                 }
669 669
                 if (preg_match('/^[1-9][0-9]*$/', $len)) {
670
-                    return $this->substr($value, 0, $len) . $str;
670
+                    return $this->substr($value, 0, $len).$str;
671 671
                 } elseif (preg_match('/^\-[1-9][0-9]*$/', $len)) {
672
-                    return $str . $this->substr($value, $len);
672
+                    return $str.$this->substr($value, $len);
673 673
                 }
674 674
                 break;
675 675
             case 'summary':
@@ -678,41 +678,41 @@  discard block
 block discarded – undo
678 678
                 return $this->includeMdfFile('summary');
679 679
             case 'replace':
680 680
             case 'str_replace':
681
-                if (empty($opt) || strpos($opt, ',')===false) {
681
+                if (empty($opt) || strpos($opt, ',') === false) {
682 682
                     break;
683 683
                 }
684
-                if (substr_count($opt, ',') ==1) {
684
+                if (substr_count($opt, ',') == 1) {
685 685
                     $delim = ',';
686
-                } elseif (substr_count($opt, '|') ==1) {
686
+                } elseif (substr_count($opt, '|') == 1) {
687 687
                     $delim = '|';
688
-                } elseif (substr_count($opt, '=>')==1) {
688
+                } elseif (substr_count($opt, '=>') == 1) {
689 689
                     $delim = '=>';
690
-                } elseif (substr_count($opt, '/') ==1) {
690
+                } elseif (substr_count($opt, '/') == 1) {
691 691
                     $delim = '/';
692 692
                 } else {
693 693
                     break;
694 694
                 }
695 695
                 list($s, $r) = explode($delim, $opt);
696
-                if ($value!=='') {
696
+                if ($value !== '') {
697 697
                     return str_replace($s, $r, $value);
698 698
                 }
699 699
                 break;
700 700
             case 'replace_to':
701 701
             case 'tpl':
702
-                if ($value!=='') {
703
-                    return str_replace(array('[+value+]','[+output+]','{value}','%s'), $value, $opt);
702
+                if ($value !== '') {
703
+                    return str_replace(array('[+value+]', '[+output+]', '{value}', '%s'), $value, $opt);
704 704
                 }
705 705
                 break;
706 706
             case 'eachtpl':
707 707
                 $value = explode('||', $value);
708 708
                 $_ = array();
709 709
                 foreach ($value as $v) {
710
-                    $_[] = str_replace(array('[+value+]','[+output+]','{value}','%s'), $v, $opt);
710
+                    $_[] = str_replace(array('[+value+]', '[+output+]', '{value}', '%s'), $v, $opt);
711 711
                 }
712 712
                 return implode("\n", $_);
713 713
             case 'array_pop':
714 714
             case 'array_shift':
715
-                if (strpos($value, '||')!==false) {
715
+                if (strpos($value, '||') !== false) {
716 716
                     $delim = '||';
717 717
                 } else {
718 718
                     $delim = ',';
@@ -720,43 +720,43 @@  discard block
 block discarded – undo
720 720
                 return $cmd(explode($delim, $value));
721 721
             case 'preg_replace':
722 722
             case 'regex_replace':
723
-                if (empty($opt) || strpos($opt, ',')===false) {
723
+                if (empty($opt) || strpos($opt, ',') === false) {
724 724
                     break;
725 725
                 }
726 726
                 list($s, $r) = explode(',', $opt, 2);
727
-                if ($value!=='') {
727
+                if ($value !== '') {
728 728
                     return preg_replace($s, $r, $value);
729 729
                 }
730 730
                 break;
731 731
             case 'cat':
732 732
             case 'concatenate':
733 733
             case '.':
734
-                if ($value!=='') {
735
-                    return $value . $opt;
734
+                if ($value !== '') {
735
+                    return $value.$opt;
736 736
                 }
737 737
                 break;
738 738
             case 'sprintf':
739 739
             case 'string_format':
740
-                if ($value!=='') {
740
+                if ($value !== '') {
741 741
                     return sprintf($opt, $value);
742 742
                 }
743 743
                 break;
744 744
             case 'number_format':
745
-                    if ($opt=='') {
745
+                    if ($opt == '') {
746 746
                         $opt = 0;
747 747
                     }
748 748
                     return number_format($value, $opt);
749 749
             case 'money_format':
750 750
                     setlocale(LC_MONETARY, setlocale(LC_TIME, 0));
751
-                    if ($value!=='') {
752
-                        return money_format($opt, (double)$value);
751
+                    if ($value !== '') {
752
+                        return money_format($opt, (double) $value);
753 753
                     }
754 754
                     break;
755 755
             case 'tobool':
756 756
                 return boolval($value);
757 757
             case 'nl2lf':
758
-                if ($value!=='') {
759
-                    return str_replace(array("\r\n","\n", "\r"), '\n', $value);
758
+                if ($value !== '') {
759
+                    return str_replace(array("\r\n", "\n", "\r"), '\n', $value);
760 760
                 }
761 761
                 break;
762 762
             case 'br2nl':
@@ -765,17 +765,17 @@  discard block
 block discarded – undo
765 765
                 if (version_compare(PHP_VERSION, '5.3.0', '<')) {
766 766
                     return nl2br($value);
767 767
                 }
768
-                if ($opt!=='') {
768
+                if ($opt !== '') {
769 769
                     $opt = trim($opt);
770 770
                     $opt = strtolower($opt);
771
-                    if ($opt==='false') {
771
+                    if ($opt === 'false') {
772 772
                         $opt = false;
773
-                    } elseif ($opt==='0') {
773
+                    } elseif ($opt === '0') {
774 774
                         $opt = false;
775 775
                     } else {
776 776
                         $opt = true;
777 777
                     }
778
-                } elseif (isset($modx->config['mce_element_format'])&&$modx->config['mce_element_format']==='html') {
778
+                } elseif (isset($modx->config['mce_element_format']) && $modx->config['mce_element_format'] === 'html') {
779 779
                     $opt = false;
780 780
                 } else {
781 781
                     $opt = true;
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
             case 'ltrim':
785 785
             case 'rtrim':
786 786
             case 'trim': // ref http://mblo.info/modifiers/custom-modifiers/rtrim_opt.html
787
-                if ($opt==='') {
787
+                if ($opt === '') {
788 788
                     return $cmd($value);
789 789
                 } else {
790 790
                     return $cmd($value, $opt);
@@ -806,10 +806,10 @@  discard block
 block discarded – undo
806 806
                 if (!preg_match('@^[0-9]+$@', $value)) {
807 807
                     $value = strtotime($value);
808 808
                 }
809
-                if (strpos($opt, '%')!==false) {
810
-                    return strftime($opt, 0+$value);
809
+                if (strpos($opt, '%') !== false) {
810
+                    return strftime($opt, 0 + $value);
811 811
                 } else {
812
-                    return date($opt, 0+$value);
812
+                    return date($opt, 0 + $value);
813 813
                 }
814 814
                     // no break
815 815
             case 'time':
@@ -819,12 +819,12 @@  discard block
 block discarded – undo
819 819
                 if (!preg_match('@^[0-9]+$@', $value)) {
820 820
                     $value = strtotime($value);
821 821
                 }
822
-                return strftime($opt, 0+$value);
822
+                return strftime($opt, 0 + $value);
823 823
             case 'strtotime':
824 824
                 return strtotime($value);
825 825
             #####  mathematical function
826 826
             case 'toint':
827
-                return (int)$value;
827
+                return (int) $value;
828 828
             case 'tofloat':
829 829
                 return floatval($value);
830 830
             case 'round':
@@ -841,27 +841,27 @@  discard block
 block discarded – undo
841 841
                 return $cmd($value);
842 842
             case 'math':
843 843
             case 'calc':
844
-                $value = (int)$value;
844
+                $value = (int) $value;
845 845
                 if (empty($value)) {
846 846
                     $value = '0';
847 847
                 }
848
-                $filter = str_replace(array('[+value+]','[+output+]','{value}','%s'), '?', $opt);
848
+                $filter = str_replace(array('[+value+]', '[+output+]', '{value}', '%s'), '?', $opt);
849 849
                 $filter = preg_replace('@([a-zA-Z\n\r\t\s])@', '', $filter);
850
-                if (strpos($filter, '?')===false) {
850
+                if (strpos($filter, '?') === false) {
851 851
                     $filter = "?{$filter}";
852 852
                 }
853 853
                 $filter = str_replace('?', $value, $filter);
854 854
                 return eval("return {$filter};");
855 855
             case 'count':
856
-                if ($value=='') {
856
+                if ($value == '') {
857 857
                     return 0;
858 858
                 }
859 859
                 $value = explode(',', $value);
860 860
                 return count($value);
861 861
             case 'sort':
862 862
             case 'rsort':
863
-                if (strpos($value, "\n")!==false) {
864
-                    $delim="\n";
863
+                if (strpos($value, "\n") !== false) {
864
+                    $delim = "\n";
865 865
                 } else {
866 866
                     $delim = ',';
867 867
                 }
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
             case 'privatemgr':
915 915
             case 'content_dispo':
916 916
             case 'hidemenu':
917
-                if ($cmd==='contenttype') {
917
+                if ($cmd === 'contenttype') {
918 918
                     $cmd = 'contentType';
919 919
                 }
920 920
                 return $this->getDocumentObject($value, $cmd);
@@ -937,11 +937,11 @@  discard block
 block discarded – undo
937 937
                 return $modx->getField($opt, $value);
938 938
             case 'children':
939 939
             case 'childids':
940
-                if ($value=='') {
940
+                if ($value == '') {
941 941
                     $value = 0;
942 942
                 } // 値がない場合はルートと見なす
943 943
                 $published = 1;
944
-                if ($opt=='') {
944
+                if ($opt == '') {
945 945
                     $opt = 'page';
946 946
                 }
947 947
                 $_ = explode(',', $opt);
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
                 $where = implode(' AND ', $where);
960 960
                 $children = $modx->getDocumentChildren($value, $published, '0', 'id', $where);
961 961
                 $result = array();
962
-                foreach ((array)$children as $child) {
962
+                foreach ((array) $children as $child) {
963 963
                     $result[] = $child['id'];
964 964
                 }
965 965
                 return implode(',', $result);
@@ -1019,14 +1019,14 @@  discard block
 block discarded – undo
1019 1019
                     return $value;
1020 1020
                 }
1021 1021
                 $value = realpath($value);
1022
-                if (strpos($value, MODX_MANAGER_PATH)!==false) {
1022
+                if (strpos($value, MODX_MANAGER_PATH) !== false) {
1023 1023
                     exit('Can not read core file');
1024 1024
                 }
1025 1025
                 $ext = strtolower(substr($value, -4));
1026
-                if ($ext==='.php') {
1026
+                if ($ext === '.php') {
1027 1027
                     exit('Can not read php file');
1028 1028
                 }
1029
-                if ($ext==='.cgi') {
1029
+                if ($ext === '.cgi') {
1030 1030
                     exit('Can not read cgi file');
1031 1031
                 }
1032 1032
                 return file_get_contents($value);
@@ -1043,11 +1043,11 @@  discard block
 block discarded – undo
1043 1043
                 $filename = trim($filename, '/');
1044 1044
 
1045 1045
                 $opt = trim($opt, '/');
1046
-                if ($opt!=='') {
1046
+                if ($opt !== '') {
1047 1047
                     $opt .= '/';
1048 1048
                 }
1049 1049
 
1050
-                $filename = MODX_BASE_PATH . $opt . $filename;
1050
+                $filename = MODX_BASE_PATH.$opt.$filename;
1051 1051
 
1052 1052
                 if (is_file($filename)) {
1053 1053
                     clearstatcache();
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
                     return $opt;
1107 1107
                 } break;
1108 1108
             case 'datagrid':
1109
-                include_once(MODX_CORE_PATH . 'controls/datagrid.class.php');
1109
+                include_once(MODX_CORE_PATH.'controls/datagrid.class.php');
1110 1110
                 $grd = new DataGrid(null, trim($value));
1111 1111
                 $grd->itemStyle = '';
1112 1112
                 $grd->altItemStyle = '';
@@ -1116,11 +1116,11 @@  discard block
 block discarded – undo
1116 1116
                 } else {
1117 1117
                     $_ = $pos;
1118 1118
                 }
1119
-                $grd->cdelim = strpos($_, "\t")!==false ? 'tab' : ',';
1119
+                $grd->cdelim = strpos($_, "\t") !== false ? 'tab' : ',';
1120 1120
                 return $grd->render();
1121 1121
             case 'rotate':
1122 1122
             case 'evenodd':
1123
-                if (strpos($opt, ',')===false) {
1123
+                if (strpos($opt, ',') === false) {
1124 1124
                     $opt = 'odd,even';
1125 1125
                 }
1126 1126
                 $_ = explode(',', $opt);
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
                 if (empty($opt)) {
1154 1154
                     $opt = 560;
1155 1155
                 }
1156
-                $h = round($opt*0.5625);
1156
+                $h = round($opt * 0.5625);
1157 1157
                 $tpl = '<iframe width="%s" height="%s" src="https://www.youtube.com/embed/%s" frameborder="0" allowfullscreen></iframe>';
1158 1158
                 return sprintf($tpl, $opt, $h, $value);
1159 1159
             //case 'youtube4x3':%s*0.75+25
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
         $key = $this->key;
1192 1192
         $value  = $this->value;
1193 1193
         $opt    = $this->opt;
1194
-        return include(MODX_CORE_PATH . "extenders/modifiers/mdf_{$cmd}.inc.php");
1194
+        return include(MODX_CORE_PATH."extenders/modifiers/mdf_{$cmd}.inc.php");
1195 1195
     }
1196 1196
 
1197 1197
     public function getValueFromElement($key, $value, $cmd, $opt)
@@ -1207,13 +1207,13 @@  discard block
 block discarded – undo
1207 1207
                 $row = $modx->db->getRow($result);
1208 1208
                 $php = $row['snippet'];
1209 1209
             } elseif ($total == 0) {
1210
-                $assets_path = MODX_BASE_PATH . 'assets/';
1211
-                if (is_file($assets_path . "modifiers/mdf_{$cmd}.inc.php")) {
1212
-                    $modifiers_path = $assets_path . "modifiers/mdf_{$cmd}.inc.php";
1213
-                } elseif (is_file($assets_path . "plugins/phx/modifiers/{$cmd}.phx.php")) {
1214
-                    $modifiers_path = $assets_path . "plugins/phx/modifiers/{$cmd}.phx.php";
1215
-                } elseif (is_file(MODX_CORE_PATH . "extenders/modifiers/mdf_{$cmd}.inc.php")) {
1216
-                    $modifiers_path = MODX_CORE_PATH . "extenders/modifiers/mdf_{$cmd}.inc.php";
1210
+                $assets_path = MODX_BASE_PATH.'assets/';
1211
+                if (is_file($assets_path."modifiers/mdf_{$cmd}.inc.php")) {
1212
+                    $modifiers_path = $assets_path."modifiers/mdf_{$cmd}.inc.php";
1213
+                } elseif (is_file($assets_path."plugins/phx/modifiers/{$cmd}.phx.php")) {
1214
+                    $modifiers_path = $assets_path."plugins/phx/modifiers/{$cmd}.phx.php";
1215
+                } elseif (is_file(MODX_CORE_PATH."extenders/modifiers/mdf_{$cmd}.inc.php")) {
1216
+                    $modifiers_path = MODX_CORE_PATH."extenders/modifiers/mdf_{$cmd}.inc.php";
1217 1217
                 } else {
1218 1218
                     $modifiers_path = false;
1219 1219
                 }
@@ -1221,17 +1221,17 @@  discard block
 block discarded – undo
1221 1221
                 if ($modifiers_path !== false) {
1222 1222
                     $php = @file_get_contents($modifiers_path);
1223 1223
                     $php = trim($php);
1224
-                    if (substr($php, 0, 5)==='<?php') {
1224
+                    if (substr($php, 0, 5) === '<?php') {
1225 1225
                         $php = substr($php, 6);
1226 1226
                     }
1227
-                    if (substr($php, 0, 2)==='<?') {
1227
+                    if (substr($php, 0, 2) === '<?') {
1228 1228
                         $php = substr($php, 3);
1229 1229
                     }
1230
-                    if (substr($php, -2)==='?>') {
1230
+                    if (substr($php, -2) === '?>') {
1231 1231
                         $php = substr($php, 0, -2);
1232 1232
                     }
1233
-                    if ($this->elmName!=='') {
1234
-                        $modx->snippetCache[$this->elmName . 'Props'] = '';
1233
+                    if ($this->elmName !== '') {
1234
+                        $modx->snippetCache[$this->elmName.'Props'] = '';
1235 1235
                     }
1236 1236
                 } else {
1237 1237
                     $php = false;
@@ -1239,15 +1239,15 @@  discard block
 block discarded – undo
1239 1239
             } else {
1240 1240
                 $php = false;
1241 1241
             }
1242
-            if ($this->elmName!=='') {
1243
-                $modx->snippetCache[$this->elmName]= $php;
1242
+            if ($this->elmName !== '') {
1243
+                $modx->snippetCache[$this->elmName] = $php;
1244 1244
             }
1245 1245
         }
1246
-        if ($php==='') {
1247
-            $php=false;
1246
+        if ($php === '') {
1247
+            $php = false;
1248 1248
         }
1249 1249
 
1250
-        if ($php===false) {
1250
+        if ($php === false) {
1251 1251
             $html = $modx->getChunk($this->elmName);
1252 1252
         } else {
1253 1253
             $html = false;
@@ -1267,56 +1267,56 @@  discard block
 block discarded – undo
1267 1267
             $this->vars['options'] = & $opt;
1268 1268
             $custom = eval($php);
1269 1269
             $msg = ob_get_contents();
1270
-            if ($value===$this->bt) {
1271
-                $value = $msg . $custom;
1270
+            if ($value === $this->bt) {
1271
+                $value = $msg.$custom;
1272 1272
             }
1273 1273
             ob_end_clean();
1274
-        } elseif ($html!==false && isset($value) && $value!=='') {
1275
-            $html = str_replace(array($self,'[+value+]'), $value, $html);
1276
-            $value = str_replace(array('[+options+]','[+param+]'), $opt, $html);
1274
+        } elseif ($html !== false && isset($value) && $value !== '') {
1275
+            $html = str_replace(array($self, '[+value+]'), $value, $html);
1276
+            $value = str_replace(array('[+options+]', '[+param+]'), $opt, $html);
1277 1277
         } else {
1278 1278
             return false;
1279 1279
         }
1280 1280
 
1281
-        if ($php===false && $html===false && $value!==''
1282
-           && (strpos($cmd, '[+value+]')!==false || strpos($cmd, $self)!==false)) {
1283
-            $value = str_replace(array('[+value+]',$self), $value, $cmd);
1281
+        if ($php === false && $html === false && $value !== ''
1282
+           && (strpos($cmd, '[+value+]') !== false || strpos($cmd, $self) !== false)) {
1283
+            $value = str_replace(array('[+value+]', $self), $value, $cmd);
1284 1284
         }
1285 1285
         return $value;
1286 1286
     }
1287 1287
 
1288
-    public function parseDocumentSource($content='')
1288
+    public function parseDocumentSource($content = '')
1289 1289
     {
1290 1290
         $modx = evolutionCMS();
1291 1291
 
1292
-        if (strpos($content, '[')===false && strpos($content, '{')===false) {
1292
+        if (strpos($content, '[') === false && strpos($content, '{') === false) {
1293 1293
             return $content;
1294 1294
         }
1295 1295
 
1296 1296
         if (!$modx->maxParserPasses) {
1297 1297
             $modx->maxParserPasses = 10;
1298 1298
         }
1299
-        $bt='';
1300
-        $i=0;
1301
-        while ($bt!==$content) {
1299
+        $bt = '';
1300
+        $i = 0;
1301
+        while ($bt !== $content) {
1302 1302
             $bt = $content;
1303
-            if (strpos($content, '[*')!==false && $modx->documentIdentifier) {
1303
+            if (strpos($content, '[*') !== false && $modx->documentIdentifier) {
1304 1304
                 $content = $modx->mergeDocumentContent($content);
1305 1305
             }
1306
-            if (strpos($content, '[(')!==false) {
1306
+            if (strpos($content, '[(') !== false) {
1307 1307
                 $content = $modx->mergeSettingsContent($content);
1308 1308
             }
1309
-            if (strpos($content, '{{')!==false) {
1309
+            if (strpos($content, '{{') !== false) {
1310 1310
                 $content = $modx->mergeChunkContent($content);
1311 1311
             }
1312
-            if (strpos($content, '[!')!==false) {
1313
-                $content = str_replace(array('[!','!]'), array('[[',']]'), $content);
1312
+            if (strpos($content, '[!') !== false) {
1313
+                $content = str_replace(array('[!', '!]'), array('[[', ']]'), $content);
1314 1314
             }
1315
-            if (strpos($content, '[[')!==false) {
1315
+            if (strpos($content, '[[') !== false) {
1316 1316
                 $content = $modx->evalSnippets($content);
1317 1317
             }
1318 1318
 
1319
-            if ($content===$bt) {
1319
+            if ($content === $bt) {
1320 1320
                 break;
1321 1321
             }
1322 1322
             if ($modx->maxParserPasses < $i) {
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
         return $content;
1328 1328
     }
1329 1329
 
1330
-    public function getDocumentObject($target='', $field='pagetitle')
1330
+    public function getDocumentObject($target = '', $field = 'pagetitle')
1331 1331
     {
1332 1332
         $modx = evolutionCMS();
1333 1333
 
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
             $target = $modx->config['site_start'];
1337 1337
         }
1338 1338
         if (preg_match('@^[1-9][0-9]*$@', $target)) {
1339
-            $method='id';
1339
+            $method = 'id';
1340 1340
         } else {
1341 1341
             $method = 'alias';
1342 1342
         }
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
             $this->documentObject[$target] = $modx->getDocumentObject($method, $target, 'direct');
1346 1346
         }
1347 1347
 
1348
-        if ($this->documentObject[$target]['publishedon']==='0') {
1348
+        if ($this->documentObject[$target]['publishedon'] === '0') {
1349 1349
             return '';
1350 1350
         } elseif (isset($this->documentObject[$target][$field])) {
1351 1351
             if (is_array($this->documentObject[$target][$field])) {
@@ -1361,7 +1361,7 @@  discard block
 block discarded – undo
1361 1361
 
1362 1362
     public function setPlaceholders($value = '', $key = '', $path = '')
1363 1363
     {
1364
-        if ($path!=='') {
1364
+        if ($path !== '') {
1365 1365
             $key = "{$path}.{$key}";
1366 1366
         }
1367 1367
         if (is_array($value)) {
@@ -1389,14 +1389,14 @@  discard block
 block discarded – undo
1389 1389
             $l = $this->strlen($str);
1390 1390
         }
1391 1391
         if (function_exists('mb_substr')) {
1392
-            if (strpos($str, "\r")!==false) {
1393
-                $str = str_replace(array("\r\n","\r"), "\n", $str);
1392
+            if (strpos($str, "\r") !== false) {
1393
+                $str = str_replace(array("\r\n", "\r"), "\n", $str);
1394 1394
             }
1395 1395
             return mb_substr($str, $s, $l, $modx->config['modx_charset']);
1396 1396
         }
1397 1397
         return substr($str, $s, $l);
1398 1398
     }
1399
-    public function strpos($haystack, $needle, $offset=0)
1399
+    public function strpos($haystack, $needle, $offset = 0)
1400 1400
     {
1401 1401
         $modx = evolutionCMS();
1402 1402
         if (function_exists('mb_strpos')) {
@@ -1429,14 +1429,14 @@  discard block
 block discarded – undo
1429 1429
     public function ucfirst($str)
1430 1430
     {
1431 1431
         if (function_exists('mb_strtoupper')) {
1432
-            return mb_strtoupper($this->substr($str, 0, 1)) . $this->substr($str, 1, $this->strlen($str));
1432
+            return mb_strtoupper($this->substr($str, 0, 1)).$this->substr($str, 1, $this->strlen($str));
1433 1433
         }
1434 1434
         return ucfirst($str);
1435 1435
     }
1436 1436
     public function lcfirst($str)
1437 1437
     {
1438 1438
         if (function_exists('mb_strtolower')) {
1439
-            return mb_strtolower($this->substr($str, 0, 1)) . $this->substr($str, 1, $this->strlen($str));
1439
+            return mb_strtolower($this->substr($str, 0, 1)).$this->substr($str, 1, $this->strlen($str));
1440 1440
         }
1441 1441
         return lcfirst($str);
1442 1442
     }
@@ -1462,14 +1462,14 @@  discard block
 block discarded – undo
1462 1462
     {
1463 1463
         return count(preg_split('~[^\p{L}\p{N}\']+~u', $str));
1464 1464
     }
1465
-    public function strip_tags($value, $params='')
1465
+    public function strip_tags($value, $params = '')
1466 1466
     {
1467 1467
         $modx = evolutionCMS();
1468 1468
 
1469
-        if (stripos($params, 'style')===false && stripos($value, '</style>')!==false) {
1469
+        if (stripos($params, 'style') === false && stripos($value, '</style>') !== false) {
1470 1470
             $value = preg_replace('@<style.*?>.*?</style>@is', '', $value);
1471 1471
         }
1472
-        if (stripos($params, 'script')===false && stripos($value, '</script>')!==false) {
1472
+        if (stripos($params, 'script') === false && stripos($value, '</script>') !== false) {
1473 1473
             $value = preg_replace('@<script.*?>.*?</script>@is', '', $value);
1474 1474
         }
1475 1475
 
Please login to merge, or discard this patch.
manager/includes/extenders/dbapi.mysqli.class.inc.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         $pre = null,
31 31
         $charset = '',
32 32
         $connection_method = 'SET CHARACTER SET'
33
-    ) {
33
+    ){
34 34
         $this->config['host'] = $host ? $host : $GLOBALS['database_server'];
35 35
         $this->config['dbase'] = $dbase ? $dbase : $GLOBALS['dbase'];
36 36
         $this->config['user'] = $uid ? $uid : $GLOBALS['database_user'];
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                         $ua = $modx->htmlspecialchars($_SERVER['HTTP_USER_AGENT']);
71 71
                         $referer = $modx->htmlspecialchars($_SERVER['HTTP_REFERER']);
72 72
                         $modx->sendmail(array(
73
-                            'subject' => 'Missing to create the database connection! from ' . $modx->config['site_name'],
73
+                            'subject' => 'Missing to create the database connection! from '.$modx->config['site_name'],
74 74
                             'body'    => "{$logtitle}\n{$request_uri}\n{$ua}\n{$referer}",
75 75
                             'type'    => 'text'
76 76
                         ));
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
             $tend = $modx->getMicroTime();
86 86
             $totaltime = $tend - $tstart;
87 87
             if ($modx->dumpSQL) {
88
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>" . sprintf("Database connection was created in %2.4f s",
89
-                        $totaltime) . "</fieldset><br />";
88
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>".sprintf("Database connection was created in %2.4f s",
89
+                        $totaltime)."</fieldset><br />";
90 90
             }
91 91
             $this->conn->set_charset($this->config['charset']);
92 92
             $this->isConnected = true;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         if (1000 < $safeCount) {
120 120
             exit("Too many loops '{$safeCount}'");
121 121
         }
122
-        if (! ($this->conn instanceof mysqli)) {
122
+        if (!($this->conn instanceof mysqli)) {
123 123
             $this->connect();
124 124
         }
125 125
         if (is_array($s)) {
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     public function query($sql, $watchError = true)
146 146
     {
147 147
         $modx = evolutionCMS();
148
-        if (! ($this->conn instanceof mysqli)) {
148
+        if (!($this->conn instanceof mysqli)) {
149 149
             $this->connect();
150 150
         }
151 151
         $tStart = $modx->getMicroTime();
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                 case 1091:
166 166
                     break;
167 167
                 default:
168
-                    $modx->messageQuit('Execution of a query to the database failed - ' . $this->getLastError(), $sql);
168
+                    $modx->messageQuit('Execution of a query to the database failed - '.$this->getLastError(), $sql);
169 169
             }
170 170
         } else {
171 171
             $tend = $modx->getMicroTime();
@@ -179,24 +179,24 @@  discard block
 block discarded – undo
179 179
                     $debug_path[] = $line['function'];
180 180
                 }
181 181
                 $debug_path = implode(' > ', array_reverse($debug_path));
182
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query " . ($modx->executedQueries + 1) . " - " . sprintf("%2.2f ms",
183
-                        $totalTime * 1000) . "</legend>";
184
-                $modx->queryCode .= $sql . '<br><br>';
182
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query ".($modx->executedQueries + 1)." - ".sprintf("%2.2f ms",
183
+                        $totalTime * 1000)."</legend>";
184
+                $modx->queryCode .= $sql.'<br><br>';
185 185
                 if ($modx->event->name) {
186
-                    $modx->queryCode .= 'Current Event  => ' . $modx->event->name . '<br>';
186
+                    $modx->queryCode .= 'Current Event  => '.$modx->event->name.'<br>';
187 187
                 }
188 188
                 if ($modx->event->activePlugin) {
189
-                    $modx->queryCode .= 'Current Plugin => ' . $modx->event->activePlugin . '<br>';
189
+                    $modx->queryCode .= 'Current Plugin => '.$modx->event->activePlugin.'<br>';
190 190
                 }
191 191
                 if ($modx->currentSnippet) {
192
-                    $modx->queryCode .= 'Current Snippet => ' . $modx->currentSnippet . '<br>';
192
+                    $modx->queryCode .= 'Current Snippet => '.$modx->currentSnippet.'<br>';
193 193
                 }
194 194
                 if (stripos($sql, 'select') === 0) {
195
-                    $modx->queryCode .= 'Record Count => ' . $this->getRecordCount($result) . '<br>';
195
+                    $modx->queryCode .= 'Record Count => '.$this->getRecordCount($result).'<br>';
196 196
                 } else {
197
-                    $modx->queryCode .= 'Affected Rows => ' . $this->getAffectedRows() . '<br>';
197
+                    $modx->queryCode .= 'Affected Rows => '.$this->getAffectedRows().'<br>';
198 198
                 }
199
-                $modx->queryCode .= 'Functions Path => ' . $debug_path . '<br>';
199
+                $modx->queryCode .= 'Functions Path => '.$debug_path.'<br>';
200 200
                 $modx->queryCode .= "</fieldset><br />";
201 201
             }
202 202
             $modx->executedQueries++;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
         $modx = evolutionCMS();
296 296
         $out = false;
297 297
         if (!$table) {
298
-            $modx->messageQuit('Empty ' . $table . ' parameter in DBAPI::update().');
298
+            $modx->messageQuit('Empty '.$table.' parameter in DBAPI::update().');
299 299
         } else {
300 300
             $table = $this->replaceFullTableName($table);
301 301
             if (is_array($fields)) {
@@ -303,18 +303,18 @@  discard block
 block discarded – undo
303 303
                     if ($value === null || strtolower($value) === 'null') {
304 304
                         $f = 'NULL';
305 305
                     } else {
306
-                        $f = "'" . $value . "'";
306
+                        $f = "'".$value."'";
307 307
                     }
308
-                    $fields[$key] = "`{$key}` = " . $f;
308
+                    $fields[$key] = "`{$key}` = ".$f;
309 309
                 }
310 310
                 $fields = implode(',', $fields);
311 311
             }
312 312
             $where = trim($where);
313 313
             if ($where !== '' && stripos($where, 'WHERE') !== 0) {
314
-                $where = 'WHERE ' . $where;
314
+                $where = 'WHERE '.$where;
315 315
             }
316 316
 
317
-            return $this->query('UPDATE ' . $table . ' SET ' . $fields . ' ' . $where);
317
+            return $this->query('UPDATE '.$table.' SET '.$fields.' '.$where);
318 318
         }
319 319
         return $out;
320 320
     }
@@ -340,12 +340,12 @@  discard block
 block discarded – undo
340 340
                 $this->query("INSERT INTO {$intotable} {$fields}");
341 341
             } else {
342 342
                 if (empty($fromtable)) {
343
-                    $fields = "(`" . implode("`, `", array_keys($fields)) . "`) VALUES('" . implode("', '",
344
-                            array_values($fields)) . "')";
343
+                    $fields = "(`".implode("`, `", array_keys($fields))."`) VALUES('".implode("', '",
344
+                            array_values($fields))."')";
345 345
                     $this->query("INSERT INTO {$intotable} {$fields}");
346 346
                 } else {
347 347
                     $fromtable = $this->replaceFullTableName($fromtable);
348
-                    $fields = "(" . implode(",", array_keys($fields)) . ")";
348
+                    $fields = "(".implode(",", array_keys($fields)).")";
349 349
                     $where = trim($where);
350 350
                     $limit = trim($limit);
351 351
                     if ($where !== '' && stripos($where, 'WHERE') !== 0) {
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
      */
440 440
     public function getInsertId($conn = null)
441 441
     {
442
-        if (! ($conn instanceof mysqli)) {
443
-            $conn =& $this->conn;
442
+        if (!($conn instanceof mysqli)) {
443
+            $conn = & $this->conn;
444 444
         }
445 445
 
446 446
         return $conn->insert_id;
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
      */
453 453
     public function getAffectedRows($conn = null)
454 454
     {
455
-        if (! ($conn instanceof mysqli)) {
456
-            $conn =& $this->conn;
455
+        if (!($conn instanceof mysqli)) {
456
+            $conn = & $this->conn;
457 457
         }
458 458
 
459 459
         return $conn->affected_rows;
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
      */
466 466
     public function getLastError($conn = null)
467 467
     {
468
-        if (! ($conn instanceof mysqli)) {
469
-            $conn =& $this->conn;
468
+        if (!($conn instanceof mysqli)) {
469
+            $conn = & $this->conn;
470 470
         }
471 471
 
472 472
         return $conn->error;
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
     public function getColumn($name, $dsq)
521 521
     {
522 522
         $col = array();
523
-        if (! ($dsq instanceof mysqli_result)) {
523
+        if (!($dsq instanceof mysqli_result)) {
524 524
             $dsq = $this->query($dsq);
525 525
         }
526 526
         if ($dsq) {
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
     public function getColumnNames($dsq)
540 540
     {
541 541
         $names = array();
542
-        if (! ($dsq instanceof mysqli_result)) {
542
+        if (!($dsq instanceof mysqli_result)) {
543 543
             $dsq = $this->query($dsq);
544 544
         }
545 545
         if ($dsq) {
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
     public function getValue($dsq)
560 560
     {
561 561
         $out = false;
562
-        if (! ($dsq instanceof mysqli_result)) {
562
+        if (!($dsq instanceof mysqli_result)) {
563 563
             $dsq = $this->query($dsq);
564 564
         }
565 565
         if ($dsq) {
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
     {
579 579
         $metadata = array();
580 580
         if (!empty($table) && is_scalar($table)) {
581
-            $sql = 'SHOW FIELDS FROM ' . $table;
581
+            $sql = 'SHOW FIELDS FROM '.$table;
582 582
             if ($ds = $this->query($sql)) {
583 583
                 while ($row = $this->getRow($ds)) {
584 584
                     $fieldName = $row['Field'];
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
         $tableName = trim($tableName);
658 658
         $dbase = trim($this->config['dbase'], '`');
659 659
         $prefix = $this->config['table_prefix'];
660
-        if ((bool)$force === true) {
660
+        if ((bool) $force === true) {
661 661
             $result = "`{$dbase}`.`{$prefix}{$tableName}`";
662 662
         } elseif (strpos($tableName, '[+prefix+]') !== false) {
663 663
             $result = preg_replace('@\[\+prefix\+\]([0-9a-zA-Z_]+)@', "`{$dbase}`.`{$prefix}$1`", $tableName);
@@ -674,9 +674,9 @@  discard block
 block discarded – undo
674 674
      */
675 675
     public function optimize($table_name)
676 676
     {
677
-        $rs = $this->query('OPTIMIZE TABLE ' . $table_name);
677
+        $rs = $this->query('OPTIMIZE TABLE '.$table_name);
678 678
         if ($rs) {
679
-            $rs = $this->query('ALTER TABLE ' . $table_name);
679
+            $rs = $this->query('ALTER TABLE '.$table_name);
680 680
         }
681 681
 
682 682
         return $rs;
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
      */
689 689
     public function truncate($table_name)
690 690
     {
691
-        return $this->query('TRUNCATE ' . $table_name);
691
+        return $this->query('TRUNCATE '.$table_name);
692 692
     }
693 693
 
694 694
     /**
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
         $_ = array();
715 715
         foreach ($fields as $k => $v) {
716 716
             if ($k !== $v) {
717
-                $_[] = $v . ' as ' . $k;
717
+                $_[] = $v.' as '.$k;
718 718
             } else {
719 719
                 $_[] = $v;
720 720
             }
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_summary.inc.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -2,23 +2,23 @@  discard block
 block discarded – undo
2 2
 if (strpos($opt, ',')) {
3 3
     list($limit, $delim) = explode(',', $opt);
4 4
 } elseif (preg_match('/^[1-9][0-9]*$/', $opt)) {
5
-    $limit=$opt;
6
-    $delim='';
5
+    $limit = $opt;
6
+    $delim = '';
7 7
 } else {
8
-    $limit=124;
9
-    $delim='';
8
+    $limit = 124;
9
+    $delim = '';
10 10
 }
11 11
 
12
-if ($delim==='') {
13
-    $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.';
12
+if ($delim === '') {
13
+    $delim = $modx->config['manager_language'] === 'japanese-utf8' ? '。' : '.';
14 14
 }
15
-$limit = (int)$limit;
15
+$limit = (int) $limit;
16 16
 
17 17
 $content = $modx->filter->parseDocumentSource($value);
18 18
 
19 19
 $content = strip_tags($content);
20 20
 
21
-$content = str_replace(array("\r\n","\r","\n","\t",'&nbsp;'), ' ', $content);
21
+$content = str_replace(array("\r\n", "\r", "\n", "\t", '&nbsp;'), ' ', $content);
22 22
 if (preg_match('/\s+/', $content)) {
23 23
     $content = preg_replace('/\s+/', ' ', $content);
24 24
 }
@@ -26,30 +26,30 @@  discard block
 block discarded – undo
26 26
 
27 27
 $pos = $modx->filter->strpos($content, $delim);
28 28
 
29
-if ($pos!==false && $pos<$limit) {
29
+if ($pos !== false && $pos < $limit) {
30 30
     $_ = explode($delim, $content);
31 31
     $text = '';
32 32
     foreach ($_ as $v) {
33
-        if ($limit <= $modx->filter->strlen($text . $v . $delim)) {
33
+        if ($limit <= $modx->filter->strlen($text.$v.$delim)) {
34 34
             break;
35 35
         }
36
-        $text .= $v . $delim;
36
+        $text .= $v.$delim;
37 37
     }
38 38
     if ($text) {
39 39
         $content = $text;
40 40
     }
41 41
 }
42 42
 
43
-if ($limit<$modx->filter->strlen($content) && strpos($content, ' ')!==false) {
43
+if ($limit < $modx->filter->strlen($content) && strpos($content, ' ') !== false) {
44 44
     $_ = explode(' ', $content);
45 45
     $text = '';
46 46
     foreach ($_ as $v) {
47
-        if ($limit <= $modx->filter->strlen($text . $v . ' ')) {
47
+        if ($limit <= $modx->filter->strlen($text.$v.' ')) {
48 48
             break;
49 49
         }
50
-        $text .= $v . ' ';
50
+        $text .= $v.' ';
51 51
     }
52
-    if ($text!=='') {
52
+    if ($text !== '') {
53 53
         $content = $text;
54 54
     }
55 55
 }
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 if ($limit < $modx->filter->strlen($content)) {
58 58
     $content = $modx->filter->substr($content, 0, $limit);
59 59
 }
60
-if ($modx->filter->substr($content, -1)==$delim) {
61
-    $content = rtrim($content, $delim) . $delim;
60
+if ($modx->filter->substr($content, -1) == $delim) {
61
+    $content = rtrim($content, $delim).$delim;
62 62
 }
63 63
 
64 64
 return $content;
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_getimage.inc.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 $pattern = '/<img[\s\n]+.*src=[\s\n]*"([^"]+\.(jpg|jpeg|png|gif))"[^>]+>/i';
3 3
 preg_match_all($pattern, $value, $images);
4
-if ($opt==='') {
4
+if ($opt === '') {
5 5
     if ($images[1][0]) {
6 6
         return $images[1][0];
7 7
     } else {
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     }
10 10
 } else {
11 11
     foreach ($images[0] as $i=>$image) {
12
-        if (strpos($image, $opt)!==false) {
12
+        if (strpos($image, $opt) !== false) {
13 13
             return $images[1][$i];
14 14
         }
15 15
     }
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_addbreak.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 $text = $modx->filter->parseDocumentSource($value);
3
-$text = str_replace(array("\r\n","\r"), "\n", $text);
3
+$text = str_replace(array("\r\n", "\r"), "\n", $text);
4 4
 
5 5
 $blockElms  = 'br,table,tbody,tr,td,th,thead,tfoot,caption,colgroup,div';
6 6
 $blockElms .= ',dl,dd,dt,ul,ol,li,pre,select,option,form,map,area,blockquote';
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
 $c = count($lines);
12 12
 foreach ($lines as $i=>$line) {
13 13
     $line = rtrim($line);
14
-    if ($i===$c-1) {
14
+    if ($i === $c - 1) {
15 15
         break;
16 16
     }
17 17
     foreach ($blockElms as $block) {
18
-        if (preg_match("@</?{$block}" . '[^>]*>$@', $line)) {
18
+        if (preg_match("@</?{$block}".'[^>]*>$@', $line)) {
19 19
             continue 2;
20 20
         }
21 21
     }
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_memberof.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 $userID = abs($modx->getLoginUserID('web'));
3
-$modx->qs_hash = md5($modx->qs_hash . "^{$userID}^");
3
+$modx->qs_hash = md5($modx->qs_hash."^{$userID}^");
4 4
 
5 5
 $groupNames = ($this->strlen($opt) > 0) ? explode(',', $opt) : array();
6 6
 
Please login to merge, or discard this patch.