Completed
Push — develop ( c061fc...beaa53 )
by Agel_Nash
06:06
created
manager/includes/document.parser.class.inc.php 1 patch
Spacing   +250 added lines, -250 removed lines patch added patch discarded remove patch
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      */
228 228
     public function __call($method_name, $arguments)
229 229
     {
230
-        include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php');
230
+        include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php');
231 231
         if (method_exists($this->old, $method_name)) {
232 232
             $error_type = 1;
233 233
         } else {
@@ -245,12 +245,12 @@  discard block
 block discarded – undo
245 245
             $info = debug_backtrace();
246 246
             $m[] = $msg;
247 247
             if (!empty($this->currentSnippet)) {
248
-                $m[] = 'Snippet - ' . $this->currentSnippet;
248
+                $m[] = 'Snippet - '.$this->currentSnippet;
249 249
             } elseif (!empty($this->event->activePlugin)) {
250
-                $m[] = 'Plugin - ' . $this->event->activePlugin;
250
+                $m[] = 'Plugin - '.$this->event->activePlugin;
251 251
             }
252 252
             $m[] = $this->decoded_request_uri;
253
-            $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')';
253
+            $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')';
254 254
             $msg = implode('<br />', $m);
255 255
             $this->logEvent(0, $error_type, $msg, $title);
256 256
         }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     {
268 268
         $flag = false;
269 269
         if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) {
270
-            $flag = (bool)$this->{$connector}->conn;
270
+            $flag = (bool) $this->{$connector}->conn;
271 271
         }
272 272
         return $flag;
273 273
     }
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
         }
295 295
         if (!$out && $flag) {
296 296
             $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname)));
297
-            $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php";
297
+            $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php";
298 298
             $out = is_file($filename) ? include $filename : false;
299 299
         }
300 300
         if ($out && !in_array($extname, $this->extensions)) {
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
     public function getMicroTime()
312 312
     {
313 313
         list($usec, $sec) = explode(' ', microtime());
314
-        return ((float)$usec + (float)$sec);
314
+        return ((float) $usec + (float) $sec);
315 315
     }
316 316
 
317 317
     /**
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             // append the redirect count string to the url
336 336
             $currentNumberOfRedirects = isset($_REQUEST['err']) ? $_REQUEST['err'] : 0;
337 337
             if ($currentNumberOfRedirects > 3) {
338
-                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>');
338
+                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>');
339 339
             } else {
340 340
                 $currentNumberOfRedirects += 1;
341 341
                 if (strpos($url, "?") > 0) {
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
             }
347 347
         }
348 348
         if ($type == 'REDIRECT_REFRESH') {
349
-            $header = 'Refresh: 0;URL=' . $url;
349
+            $header = 'Refresh: 0;URL='.$url;
350 350
         } elseif ($type == 'REDIRECT_META') {
351
-            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />';
351
+            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />';
352 352
             echo $header;
353 353
             exit;
354 354
         } elseif ($type == 'REDIRECT_HEADER' || empty($type)) {
@@ -356,10 +356,10 @@  discard block
 block discarded – undo
356 356
             global $base_url, $site_url;
357 357
             if (substr($url, 0, strlen($base_url)) == $base_url) {
358 358
                 // append $site_url to make it work with Location:
359
-                $url = $site_url . substr($url, strlen($base_url));
359
+                $url = $site_url.substr($url, strlen($base_url));
360 360
             }
361 361
             if (strpos($url, "\n") === false) {
362
-                $header = 'Location: ' . $url;
362
+                $header = 'Location: '.$url;
363 363
             } else {
364 364
                 $this->messageQuit('No newline allowed in redirect url.');
365 365
             }
@@ -473,8 +473,8 @@  discard block
 block discarded – undo
473 473
 
474 474
     private function recoverySiteCache()
475 475
     {
476
-        $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
477
-        $site_cache_path = $site_cache_dir . 'siteCache.idx.php';
476
+        $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
477
+        $site_cache_path = $site_cache_dir.'siteCache.idx.php';
478 478
 
479 479
         if (is_file($site_cache_path)) {
480 480
             include($site_cache_path);
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
             return;
484 484
         }
485 485
 
486
-        include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
486
+        include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
487 487
         $cache = new synccache();
488 488
         $cache->setCachepath($site_cache_dir);
489 489
         $cache->setReport(false);
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
                 $this->invokeEvent("OnBeforeManagerPageInit");
536 536
             }
537 537
 
538
-            if (isset($_SESSION[$usrType . 'UsrConfigSet'])) {
539
-                $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet'];
538
+            if (isset($_SESSION[$usrType.'UsrConfigSet'])) {
539
+                $usrSettings = &$_SESSION[$usrType.'UsrConfigSet'];
540 540
             } else {
541 541
                 if ($usrType == 'web') {
542 542
                     $from = $tbl_web_user_settings;
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
                     $usrSettings[$row['setting_name']] = $row['setting_value'];
557 557
                 }
558 558
                 if (isset($usrType)) {
559
-                    $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
559
+                    $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings;
560 560
                 } // store user settings in session
561 561
             }
562 562
         }
@@ -701,10 +701,10 @@  discard block
 block discarded – undo
701 701
         $suf = $this->config['friendly_url_suffix'];
702 702
         $pre = preg_quote($pre, '/');
703 703
         $suf = preg_quote($suf, '/');
704
-        if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) {
704
+        if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) {
705 705
             $q = $_[1];
706 706
         }
707
-        if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) {
707
+        if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) {
708 708
             $q = $_[1];
709 709
         }
710 710
 
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
         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 */
727 727
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
728 728
             if ($this->config['use_alias_path'] == 1) {
729
-                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))))) {
729
+                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))))) {
730 730
                     $this->documentMethod = 'id';
731 731
                     return $q;
732 732
                 } else { /* not a valid id in terms of virtualDir, treat as alias */
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
      */
761 761
     public function getHashFile($key)
762 762
     {
763
-        return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php";
763
+        return $this->getCacheFolder()."docid_".$key.".pageCache.php";
764 764
     }
765 765
 
766 766
     /**
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
780 780
                 $params = $_GET;
781 781
                 ksort($params);
782
-                $hash .= '_' . md5(http_build_query($params));
782
+                $hash .= '_'.md5(http_build_query($params));
783 783
             }
784 784
         }
785 785
         $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params));
@@ -925,12 +925,12 @@  discard block
 block discarded – undo
925 925
         if ($js = $this->getRegisteredClientStartupScripts()) {
926 926
             // change to just before closing </head>
927 927
             // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent);
928
-            $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput);
928
+            $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput);
929 929
         }
930 930
 
931 931
         // Insert jscripts & html block into template - template must have a </body> tag
932 932
         if ($js = $this->getRegisteredClientScripts()) {
933
-            $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput);
933
+            $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput);
934 934
         }
935 935
         // End fix by sirlancelot
936 936
 
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
         // send out content-type and content-disposition headers
942 942
         if (IN_PARSER_MODE == "true") {
943 943
             $type = !empty($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html";
944
-            header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']);
944
+            header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']);
945 945
             //            if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error)
946 946
             //                header('HTTP/1.0 404 Not Found');
947 947
             if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) {
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
                     $name = preg_replace('|-+|', '-', $name);
960 960
                     $name = trim($name, '-');
961 961
                 }
962
-                $header = 'Content-Disposition: attachment; filename=' . $name;
962
+                $header = 'Content-Disposition: attachment; filename='.$name;
963 963
                 header($header);
964 964
             }
965 965
         }
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
 
968 968
         $stats = $this->getTimerStats($this->tstart);
969 969
 
970
-        $out =& $this->documentOutput;
970
+        $out = & $this->documentOutput;
971 971
         $out = str_replace("[^q^]", $stats['queries'], $out);
972 972
         $out = str_replace("[^qt^]", $stats['queryTime'], $out);
973 973
         $out = str_replace("[^p^]", $stats['phpTime'], $out);
@@ -1006,17 +1006,17 @@  discard block
 block discarded – undo
1006 1006
                 $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet
1007 1007
                 $tt += $t;
1008 1008
             }
1009
-            echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />";
1009
+            echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />";
1010 1010
             echo $this->snippetsCode;
1011 1011
         }
1012 1012
         if ($this->dumpPlugins) {
1013 1013
             $ps = "";
1014 1014
             $tt = 0;
1015 1015
             foreach ($this->pluginsTime as $s => $t) {
1016
-                $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>";
1016
+                $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>";
1017 1017
                 $tt += $t;
1018 1018
             }
1019
-            echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />";
1019
+            echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />";
1020 1020
             echo $this->pluginsCode;
1021 1021
         }
1022 1022
 
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
         $srcTags = explode(',', $tags);
1043 1043
         $repTags = array();
1044 1044
         foreach ($srcTags as $tag) {
1045
-            $repTags[] = '\\' . $tag[0] . '\\' . $tag[1];
1045
+            $repTags[] = '\\'.$tag[0].'\\'.$tag[1];
1046 1046
         }
1047 1047
         return array($srcTags, $repTags);
1048 1048
     }
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
         $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']);
1065 1065
         $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache";
1066 1066
         $stats['queries'] = isset($this->executedQueries) ? $this->executedQueries : 0;
1067
-        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb";
1067
+        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb";
1068 1068
 
1069 1069
         return $stats;
1070 1070
     }
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
     {
1098 1098
         $cacheRefreshTime = 0;
1099 1099
         $recent_update = 0;
1100
-        @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php');
1100
+        @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php');
1101 1101
         $this->recentUpdate = $recent_update;
1102 1102
 
1103 1103
         $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time'];
@@ -1167,8 +1167,8 @@  discard block
 block discarded – undo
1167 1167
                 }
1168 1168
 
1169 1169
                 $docObjSerial = serialize($this->documentObject);
1170
-                $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;
1171
-                $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey);
1170
+                $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent;
1171
+                $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey);
1172 1172
                 file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent");
1173 1173
             }
1174 1174
         }
@@ -1210,16 +1210,16 @@  discard block
 block discarded – undo
1210 1210
             return array();
1211 1211
         }
1212 1212
         $spacer = md5('<<<EVO>>>');
1213
-        if ($left==='{{' && strpos($content, ';}}')!==false) {
1213
+        if ($left === '{{' && strpos($content, ';}}') !== false) {
1214 1214
             $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content);
1215 1215
         }
1216
-        if ($left==='{{' && strpos($content, '{{}}')!==false) {
1216
+        if ($left === '{{' && strpos($content, '{{}}') !== false) {
1217 1217
             $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content);
1218 1218
         }
1219
-        if ($left==='[[' && strpos($content, ']]]]')!==false) {
1219
+        if ($left === '[[' && strpos($content, ']]]]') !== false) {
1220 1220
             $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content);
1221 1221
         }
1222
-        if ($left==='[[' && strpos($content, ']]]')!==false) {
1222
+        if ($left === '[[' && strpos($content, ']]]') !== false) {
1223 1223
             $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content);
1224 1224
         }
1225 1225
 
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
         $pos[']]>'] = strpos($content, ']]>');
1228 1228
 
1229 1229
         if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) {
1230
-            $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3);
1230
+            $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3);
1231 1231
         }
1232 1232
 
1233 1233
         $lp = explode($left, $content);
@@ -1292,7 +1292,7 @@  discard block
 block discarded – undo
1292 1292
             }
1293 1293
         }
1294 1294
         foreach ($tags as $i=>$tag) {
1295
-            if (strpos($tag, $spacer)!==false) {
1295
+            if (strpos($tag, $spacer) !== false) {
1296 1296
                 $tags[$i] = str_replace($spacer, '', $tag);
1297 1297
             }
1298 1298
         }
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
         }
1335 1335
 
1336 1336
         foreach ($matches[1] as $i => $key) {
1337
-            if (strpos($key, '[+')!==false) {
1337
+            if (strpos($key, '[+') !== false) {
1338 1338
                 continue;
1339 1339
             } // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1340 1340
             if (substr($key, 0, 1) == '#') {
@@ -1356,8 +1356,8 @@  discard block
 block discarded – undo
1356 1356
             }
1357 1357
 
1358 1358
             if (is_array($value)) {
1359
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php');
1360
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php');
1359
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php');
1360
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php');
1361 1361
                 $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]);
1362 1362
             }
1363 1363
 
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
             if (strpos($content, $s) !== false) {
1370 1370
                 $content = str_replace($s, $value, $content);
1371 1371
             } elseif ($this->debug) {
1372
-                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1372
+                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1373 1373
             }
1374 1374
         }
1375 1375
 
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
             if (strpos($content, $s) !== false) {
1538 1538
                 $content = str_replace($s, $value, $content);
1539 1539
             } elseif ($this->debug) {
1540
-                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1540
+                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1541 1541
             }
1542 1542
         }
1543 1543
         return $content;
@@ -1590,7 +1590,7 @@  discard block
 block discarded – undo
1590 1590
             }
1591 1591
 
1592 1592
             $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags
1593
-            $value = $this->mergePlaceholderContent($value, $params);  // parse page global placeholers
1593
+            $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers
1594 1594
             if ($this->config['enable_at_syntax']) {
1595 1595
                 $value = $this->mergeConditionalTagsContent($value);
1596 1596
             }
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
             if (strpos($content, $s) !== false) {
1607 1607
                 $content = str_replace($s, $value, $content);
1608 1608
             } elseif ($this->debug) {
1609
-                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1609
+                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1610 1610
             }
1611 1611
         }
1612 1612
         return $content;
@@ -1663,7 +1663,7 @@  discard block
 block discarded – undo
1663 1663
             if (strpos($content, $s) !== false) {
1664 1664
                 $content = str_replace($s, $value, $content);
1665 1665
             } elseif ($this->debug) {
1666
-                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1666
+                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1667 1667
             }
1668 1668
         }
1669 1669
         return $content;
@@ -1687,7 +1687,7 @@  discard block
 block discarded – undo
1687 1687
             return $content;
1688 1688
         }
1689 1689
 
1690
-        $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#';
1690
+        $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#';
1691 1691
         $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content);
1692 1692
 
1693 1693
         $pieces = explode('<@IF:', $content);
@@ -1698,7 +1698,7 @@  discard block
 block discarded – undo
1698 1698
             }
1699 1699
             list($cmd, $text) = explode('>', $split, 2);
1700 1700
             $cmd = str_replace("'", "\'", $cmd);
1701
-            $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1701
+            $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>";
1702 1702
             $content .= $text;
1703 1703
         }
1704 1704
         $pieces = explode('<@ELSEIF:', $content);
@@ -1709,13 +1709,13 @@  discard block
 block discarded – undo
1709 1709
             }
1710 1710
             list($cmd, $text) = explode('>', $split, 2);
1711 1711
             $cmd = str_replace("'", "\'", $cmd);
1712
-            $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1712
+            $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>";
1713 1713
             $content .= $text;
1714 1714
         }
1715 1715
 
1716 1716
         $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content);
1717 1717
         ob_start();
1718
-        $content = eval('?>' . $content);
1718
+        $content = eval('?>'.$content);
1719 1719
         $content = ob_get_clean();
1720 1720
         $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content);
1721 1721
 
@@ -1840,7 +1840,7 @@  discard block
 block discarded – undo
1840 1840
         $matches = $this->getTagsFromContent($content, $left, $right);
1841 1841
         if (!empty($matches)) {
1842 1842
             foreach ($matches[0] as $i => $v) {
1843
-                $addBreakMatches[$i] = $v . "\n";
1843
+                $addBreakMatches[$i] = $v."\n";
1844 1844
             }
1845 1845
             $content = str_replace($addBreakMatches, '', $content);
1846 1846
             if (strpos($content, $left) !== false) {
@@ -1874,7 +1874,7 @@  discard block
 block discarded – undo
1874 1874
             if (strpos($content, $s) !== false) {
1875 1875
                 $content = str_replace($s, $v, $content);
1876 1876
             } elseif ($this->debug) {
1877
-                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1877
+                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1878 1878
             }
1879 1879
         }
1880 1880
         return $content;
@@ -1938,7 +1938,7 @@  discard block
 block discarded – undo
1938 1938
                 $msg = ($msg === false) ? 'ob_get_contents() error' : $msg;
1939 1939
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg);
1940 1940
                 if ($this->isBackend()) {
1941
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>');
1941
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>');
1942 1942
                 }
1943 1943
             }
1944 1944
         } else {
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
                 $echo = ($echo === false) ? 'ob_get_contents() error' : $echo;
1985 1985
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo);
1986 1986
                 if ($this->isBackend()) {
1987
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>');
1987
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>');
1988 1988
                 }
1989 1989
             }
1990 1990
         }
@@ -1992,7 +1992,7 @@  discard block
 block discarded – undo
1992 1992
         if (is_array($return) || is_object($return)) {
1993 1993
             return $return;
1994 1994
         } else {
1995
-            return $echo . $return;
1995
+            return $echo.$return;
1996 1996
         }
1997 1997
     }
1998 1998
 
@@ -2031,7 +2031,7 @@  discard block
 block discarded – undo
2031 2031
                 if (strpos($content, $s) !== false) {
2032 2032
                     $content = str_replace($s, $value, $content);
2033 2033
                 } elseif ($this->debug) {
2034
-                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2034
+                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2);
2035 2035
                 }
2036 2036
                 continue;
2037 2037
             }
@@ -2043,7 +2043,7 @@  discard block
 block discarded – undo
2043 2043
             if (strpos($content, $s) !== false) {
2044 2044
                 $content = str_replace($s, $value, $content);
2045 2045
             } elseif ($this->debug) {
2046
-                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2046
+                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2);
2047 2047
             }
2048 2048
         }
2049 2049
 
@@ -2134,7 +2134,7 @@  discard block
 block discarded – undo
2134 2134
             $eventtime = sprintf('%2.2f ms', $eventtime * 1000);
2135 2135
             $code = str_replace("\t", '  ', $this->htmlspecialchars($value));
2136 2136
             $piece = str_replace("\t", '  ', $this->htmlspecialchars($piece));
2137
-            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true)));
2137
+            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true)));
2138 2138
             $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);
2139 2139
             $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime);
2140 2140
         }
@@ -2379,7 +2379,7 @@  discard block
 block discarded – undo
2379 2379
             $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where);
2380 2380
             $count = $this->db->getRecordCount($rs);
2381 2381
             if (1 < $count) {
2382
-                exit('Error $modx->_getSnippetObject()' . $snip_name);
2382
+                exit('Error $modx->_getSnippetObject()'.$snip_name);
2383 2383
             }
2384 2384
             if ($count) {
2385 2385
                 $row = $this->db->getRow($rs);
@@ -2405,7 +2405,7 @@  discard block
 block discarded – undo
2405 2405
     public function toAlias($text)
2406 2406
     {
2407 2407
         $suff = $this->config['friendly_url_suffix'];
2408
-        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);
2408
+        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);
2409 2409
     }
2410 2410
 
2411 2411
     /**
@@ -2437,7 +2437,7 @@  discard block
 block discarded – undo
2437 2437
                 $suff = '/';
2438 2438
             }
2439 2439
 
2440
-            $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff;
2440
+            $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff;
2441 2441
         }
2442 2442
 
2443 2443
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -2474,7 +2474,7 @@  discard block
 block discarded – undo
2474 2474
                 preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match);
2475 2475
                 $ids = implode(',', array_unique($match['1']));
2476 2476
                 if ($ids) {
2477
-                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'");
2477
+                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'");
2478 2478
                     while ($row = $this->db->getRow($res)) {
2479 2479
                         if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) {
2480 2480
                             $parent = $row['parent'];
@@ -2485,7 +2485,7 @@  discard block
 block discarded – undo
2485 2485
                                 $parent = $this->aliasListing[$parent]['parent'];
2486 2486
                             }
2487 2487
 
2488
-                            $aliases[$row['id']] = $path . '/' . $row['alias'];
2488
+                            $aliases[$row['id']] = $path.'/'.$row['alias'];
2489 2489
                         } else {
2490 2490
                             $aliases[$row['id']] = $row['alias'];
2491 2491
                         }
@@ -2497,7 +2497,7 @@  discard block
 block discarded – undo
2497 2497
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2498 2498
             $pref = $this->config['friendly_url_prefix'];
2499 2499
             $suff = $this->config['friendly_url_suffix'];
2500
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2500
+            $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2501 2501
                 global $modx;
2502 2502
                 $thealias = $aliases[$m[1]];
2503 2503
                 $thefolder = $isfolder[$m[1]];
@@ -2512,7 +2512,7 @@  discard block
 block discarded – undo
2512 2512
             }, $documentSource);
2513 2513
         } else {
2514 2514
             $in = '!\[\~([0-9]+)\~\]!is';
2515
-            $out = "index.php?id=" . '\1';
2515
+            $out = "index.php?id=".'\1';
2516 2516
             $documentSource = preg_replace($in, $out, $documentSource);
2517 2517
         }
2518 2518
 
@@ -2533,7 +2533,7 @@  discard block
 block discarded – undo
2533 2533
         $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
2534 2534
         $len_base_url = strlen($this->config['base_url']);
2535 2535
 
2536
-        $url_path = $q;//LANG
2536
+        $url_path = $q; //LANG
2537 2537
 
2538 2538
         if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) {
2539 2539
             $url_path = substr($url_path, $len_base_url);
@@ -2545,7 +2545,7 @@  discard block
 block discarded – undo
2545 2545
             $strictURL = substr($strictURL, $len_base_url);
2546 2546
         }
2547 2547
         $http_host = $_SERVER['HTTP_HOST'];
2548
-        $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG
2548
+        $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG
2549 2549
 
2550 2550
         $site_url = $this->config['site_url'];
2551 2551
         $url_query_string = explode('?', $_SERVER['REQUEST_URI']);
@@ -2563,7 +2563,7 @@  discard block
 block discarded – undo
2563 2563
                 }
2564 2564
                 if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) {
2565 2565
                     if (empty($_POST)) {
2566
-                        if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) {
2566
+                        if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) {
2567 2567
                             $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
2568 2568
                             exit(0);
2569 2569
                         }
@@ -2621,7 +2621,7 @@  discard block
 block discarded – undo
2621 2621
                 $docgrp = implode(",", $docgrp);
2622 2622
             }
2623 2623
             // get document
2624
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2624
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2625 2625
             $rs = $this->db->select('sc.*', "{$tblsc} sc
2626 2626
                 LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1);
2627 2627
             if ($this->db->getRecordCount($rs) < 1) {
@@ -2657,9 +2657,9 @@  discard block
 block discarded – undo
2657 2657
             }
2658 2658
             if ($documentObject['template']) {
2659 2659
                 // load TVs and merge with document - Orig by Apodigm - Docvars
2660
-                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv
2661
-                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id
2662
-                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2660
+                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv
2661
+                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id
2662
+                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2663 2663
                 $tmplvars = array();
2664 2664
                 while ($row = $this->db->getRow($rs)) {
2665 2665
                     $tmplvars[$row['name']] = array(
@@ -2705,7 +2705,7 @@  discard block
 block discarded – undo
2705 2705
                 $st = md5($source);
2706 2706
             }
2707 2707
             if ($this->dumpSnippets == 1) {
2708
-                $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>";
2708
+                $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>";
2709 2709
             }
2710 2710
 
2711 2711
             // invoke OnParseDocument event
@@ -2793,7 +2793,7 @@  discard block
 block discarded – undo
2793 2793
 
2794 2794
             // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path
2795 2795
             if ($this->config['use_alias_path'] == 1) {
2796
-                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier;
2796
+                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier;
2797 2797
                 if (isset($this->documentListing[$alias])) {
2798 2798
                     $this->documentIdentifier = $this->documentListing[$alias];
2799 2799
                 } else {
@@ -2854,7 +2854,7 @@  discard block
 block discarded – undo
2854 2854
                 } else {
2855 2855
                     $docAlias = $this->db->escape($this->documentIdentifier);
2856 2856
                     $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'");
2857
-                    $this->documentIdentifier = (int)$this->db->getValue($rs);
2857
+                    $this->documentIdentifier = (int) $this->db->getValue($rs);
2858 2858
                 }
2859 2859
             }
2860 2860
             $this->documentMethod = 'id';
@@ -2911,7 +2911,7 @@  discard block
 block discarded – undo
2911 2911
                 $_REQUEST[$n] = $_GET[$n] = $v;
2912 2912
             }
2913 2913
         }
2914
-        $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path'];
2914
+        $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path'];
2915 2915
         $this->q = $qp['path'];
2916 2916
         return $qp['path'];
2917 2917
     }
@@ -3005,7 +3005,7 @@  discard block
 block discarded – undo
3005 3005
             $this->sendErrorPage();
3006 3006
         } else {
3007 3007
             // Inculde the necessary files to check document permissions
3008
-            include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
3008
+            include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
3009 3009
             $udperms = new udperms();
3010 3010
             $udperms->user = $this->getLoginUserID();
3011 3011
             $udperms->document = $this->documentIdentifier;
@@ -3059,7 +3059,7 @@  discard block
 block discarded – undo
3059 3059
         while ($id && $height--) {
3060 3060
             $thisid = $id;
3061 3061
             if ($this->config['aliaslistingfolder'] == 1) {
3062
-                $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");
3062
+                $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");
3063 3063
                 if (!$id || $id == '0') {
3064 3064
                     break;
3065 3065
                 }
@@ -3108,15 +3108,15 @@  discard block
 block discarded – undo
3108 3108
         }
3109 3109
 
3110 3110
         if ($this->config['aliaslistingfolder'] == 1) {
3111
-            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'");
3111
+            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'");
3112 3112
             $idx = array();
3113 3113
             while ($row = $this->db->getRow($res)) {
3114 3114
                 $pAlias = '';
3115 3115
                 if (isset($this->aliasListing[$row['parent']])) {
3116
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : '';
3117
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : '';
3116
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : '';
3117
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : '';
3118 3118
                 };
3119
-                $children[$pAlias . $row['alias']] = $row['id'];
3119
+                $children[$pAlias.$row['alias']] = $row['id'];
3120 3120
                 if ($row['isfolder'] == 1) {
3121 3121
                     $idx[] = $row['id'];
3122 3122
                 }
@@ -3147,7 +3147,7 @@  discard block
 block discarded – undo
3147 3147
                 $depth--;
3148 3148
 
3149 3149
                 foreach ($documentMap_cache[$id] as $childId) {
3150
-                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias'];
3150
+                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias'];
3151 3151
                     if (!strlen($pkey)) {
3152 3152
                         $pkey = "{$childId}";
3153 3153
                     }
@@ -3175,7 +3175,7 @@  discard block
 block discarded – undo
3175 3175
         if (substr(strtolower($url), 0, 11) == "javascript:") {
3176 3176
             $fnc = substr($url, 11);
3177 3177
         } elseif ($url) {
3178
-            $fnc = "window.location.href='" . addslashes($url) . "';";
3178
+            $fnc = "window.location.href='".addslashes($url)."';";
3179 3179
         } else {
3180 3180
             $fnc = "history.back(-1);";
3181 3181
         }
@@ -3184,7 +3184,7 @@  discard block
 block discarded – undo
3184 3184
             <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\">
3185 3185
             <script>
3186 3186
                 function __alertQuit() {
3187
-                    alert('" . addslashes($msg) . "');
3187
+                    alert('".addslashes($msg)."');
3188 3188
                     {$fnc}
3189 3189
                 }
3190 3190
                 window.setTimeout('__alertQuit();',100);
@@ -3206,9 +3206,9 @@  discard block
 block discarded – undo
3206 3206
         $state = 0;
3207 3207
         $pms = $_SESSION['mgrPermissions'];
3208 3208
         if ($pms) {
3209
-            $state = ((bool)$pms[$pm] === true);
3209
+            $state = ((bool) $pms[$pm] === true);
3210 3210
         }
3211
-        return (int)$state;
3211
+        return (int) $state;
3212 3212
     }
3213 3213
 
3214 3214
     /**
@@ -3221,8 +3221,8 @@  discard block
 block discarded – undo
3221 3221
      */
3222 3222
     public function elementIsLocked($type, $id, $includeThisUser = false)
3223 3223
     {
3224
-        $id = (int)$id;
3225
-        $type = (int)$type;
3224
+        $id = (int) $id;
3225
+        $type = (int) $type;
3226 3226
         if (!$type || !$id) {
3227 3227
             return null;
3228 3228
         }
@@ -3272,7 +3272,7 @@  discard block
 block discarded – undo
3272 3272
             return $lockedElements;
3273 3273
         }
3274 3274
 
3275
-        $type = (int)$type;
3275
+        $type = (int) $type;
3276 3276
         if (isset($lockedElements[$type])) {
3277 3277
             return $lockedElements[$type];
3278 3278
         } else {
@@ -3289,7 +3289,7 @@  discard block
 block discarded – undo
3289 3289
             $this->lockedElements = array();
3290 3290
             $this->cleanupExpiredLocks();
3291 3291
 
3292
-            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul
3292
+            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul
3293 3293
                 LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id");
3294 3294
             while ($row = $this->db->getRow($rs)) {
3295 3295
                 $this->lockedElements[$row['elementType']][$row['elementId']] = array(
@@ -3312,7 +3312,7 @@  discard block
 block discarded – undo
3312 3312
     public function cleanupExpiredLocks()
3313 3313
     {
3314 3314
         // Clean-up active_user_sessions first
3315
-        $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
3315
+        $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
3316 3316
         $validSessionTimeLimit = $this->time - $timeout;
3317 3317
         $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}");
3318 3318
 
@@ -3325,7 +3325,7 @@  discard block
 block discarded – undo
3325 3325
             foreach ($rs as $row) {
3326 3326
                 $userSids[] = $row['sid'];
3327 3327
             }
3328
-            $userSids = "'" . implode("','", $userSids) . "'";
3328
+            $userSids = "'".implode("','", $userSids)."'";
3329 3329
             $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})");
3330 3330
         } else {
3331 3331
             $this->db->delete($this->getFullTableName('active_user_locks'));
@@ -3406,8 +3406,8 @@  discard block
 block discarded – undo
3406 3406
     public function lockElement($type, $id)
3407 3407
     {
3408 3408
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3409
-        $type = (int)$type;
3410
-        $id = (int)$id;
3409
+        $type = (int) $type;
3410
+        $id = (int) $id;
3411 3411
         if (!$type || !$id || !$userId) {
3412 3412
             return false;
3413 3413
         }
@@ -3428,8 +3428,8 @@  discard block
 block discarded – undo
3428 3428
     public function unlockElement($type, $id, $includeAllUsers = false)
3429 3429
     {
3430 3430
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3431
-        $type = (int)$type;
3432
-        $id = (int)$id;
3431
+        $type = (int) $type;
3432
+        $id = (int) $id;
3433 3433
         if (!$type || !$id) {
3434 3434
             return false;
3435 3435
         }
@@ -3496,8 +3496,8 @@  discard block
 block discarded – undo
3496 3496
         }
3497 3497
 
3498 3498
         $usertype = $this->isFrontend() ? 1 : 0;
3499
-        $evtid = (int)$evtid;
3500
-        $type = (int)$type;
3499
+        $evtid = (int) $evtid;
3500
+        $type = (int) $type;
3501 3501
 
3502 3502
         // Types: 1 = information, 2 = warning, 3 = error
3503 3503
         if ($type < 1) {
@@ -3519,8 +3519,8 @@  discard block
 block discarded – undo
3519 3519
         if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') {
3520 3520
             if ($this->config['send_errormail'] <= $type) {
3521 3521
                 $this->sendmail(array(
3522
-                    'subject' => 'MODX System Error on ' . $this->config['site_name'],
3523
-                    'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.',
3522
+                    'subject' => 'MODX System Error on '.$this->config['site_name'],
3523
+                    'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.',
3524 3524
                     'type' => 'text'
3525 3525
                 ));
3526 3526
             }
@@ -3568,7 +3568,7 @@  discard block
 block discarded – undo
3568 3568
             $p['fromname'] = $userinfo['username'];
3569 3569
         }
3570 3570
         if ($msg === '' && !isset($p['body'])) {
3571
-            $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER'];
3571
+            $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER'];
3572 3572
         } elseif (is_string($msg) && 0 < strlen($msg)) {
3573 3573
             $p['body'] = $msg;
3574 3574
         }
@@ -3608,8 +3608,8 @@  discard block
 block discarded – undo
3608 3608
             $files = array();
3609 3609
         }
3610 3610
         foreach ($files as $f) {
3611
-            if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) {
3612
-                $this->mail->AddAttachment(MODX_BASE_PATH . $f);
3611
+            if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) {
3612
+                $this->mail->AddAttachment(MODX_BASE_PATH.$f);
3613 3613
             }
3614 3614
         }
3615 3615
         $rs = $this->mail->send();
@@ -3654,7 +3654,7 @@  discard block
 block discarded – undo
3654 3654
      */
3655 3655
     public function isFrontend()
3656 3656
     {
3657
-        return ! $this->isBackend();
3657
+        return !$this->isBackend();
3658 3658
     }
3659 3659
 
3660 3660
     /**
@@ -3678,14 +3678,14 @@  discard block
 block discarded – undo
3678 3678
         $tblsc = $this->getFullTableName("site_content");
3679 3679
         $tbldg = $this->getFullTableName("document_groups");
3680 3680
         // modify field names to use sc. table reference
3681
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3682
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3681
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3682
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3683 3683
         // get document groups for current user
3684 3684
         if ($docgrp = $this->getUserDocGroups()) {
3685 3685
             $docgrp = implode(",", $docgrp);
3686 3686
         }
3687 3687
         // build query
3688
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3688
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3689 3689
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3690 3690
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3691 3691
         $resourceArray = $this->db->makeArray($result);
@@ -3715,14 +3715,14 @@  discard block
 block discarded – undo
3715 3715
         $tbldg = $this->getFullTableName("document_groups");
3716 3716
 
3717 3717
         // modify field names to use sc. table reference
3718
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3719
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3718
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3719
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3720 3720
         // get document groups for current user
3721 3721
         if ($docgrp = $this->getUserDocGroups()) {
3722 3722
             $docgrp = implode(",", $docgrp);
3723 3723
         }
3724 3724
         // build query
3725
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3725
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3726 3726
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3727 3727
                 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}");
3728 3728
         $resourceArray = $this->db->makeArray($result);
@@ -3756,16 +3756,16 @@  discard block
 block discarded – undo
3756 3756
             return $this->tmpCache[__FUNCTION__][$cacheKey];
3757 3757
         }
3758 3758
 
3759
-        $published = ($published !== 'all') ? 'AND sc.published = ' . $published : '';
3760
-        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : '';
3759
+        $published = ($published !== 'all') ? 'AND sc.published = '.$published : '';
3760
+        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : '';
3761 3761
 
3762 3762
         if ($where != '') {
3763
-            $where = 'AND ' . $where;
3763
+            $where = 'AND '.$where;
3764 3764
         }
3765 3765
 
3766 3766
         // modify field names to use sc. table reference
3767
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3768
-        $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3767
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3768
+        $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3769 3769
 
3770 3770
         // get document groups for current user
3771 3771
         if ($docgrp = $this->getUserDocGroups()) {
@@ -3773,7 +3773,7 @@  discard block
 block discarded – undo
3773 3773
         }
3774 3774
 
3775 3775
         // build query
3776
-        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3776
+        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3777 3777
 
3778 3778
         $tblsc = $this->getFullTableName('site_content');
3779 3779
         $tbldg = $this->getFullTableName('document_groups');
@@ -3824,10 +3824,10 @@  discard block
 block discarded – undo
3824 3824
             return false;
3825 3825
         } else {
3826 3826
             // modify field names to use sc. table reference
3827
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3828
-            $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3827
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3828
+            $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3829 3829
             if ($where != '') {
3830
-                $where = 'AND ' . $where;
3830
+                $where = 'AND '.$where;
3831 3831
             }
3832 3832
 
3833 3833
             $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : '';
@@ -3838,13 +3838,13 @@  discard block
 block discarded – undo
3838 3838
                 $docgrp = implode(',', $docgrp);
3839 3839
             }
3840 3840
 
3841
-            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3841
+            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3842 3842
 
3843 3843
             $tblsc = $this->getFullTableName('site_content');
3844 3844
             $tbldg = $this->getFullTableName('document_groups');
3845 3845
 
3846 3846
             $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3847
-                    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);
3847
+                    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);
3848 3848
 
3849 3849
             $resourceArray = $this->db->makeArray($result);
3850 3850
 
@@ -3948,12 +3948,12 @@  discard block
 block discarded – undo
3948 3948
             $tbldg = $this->getFullTableName("document_groups");
3949 3949
             $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : "";
3950 3950
             // modify field names to use sc. table reference
3951
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3951
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3952 3952
             // get document groups for current user
3953 3953
             if ($docgrp = $this->getUserDocGroups()) {
3954 3954
                 $docgrp = implode(",", $docgrp);
3955 3955
             }
3956
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3956
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3957 3957
             $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1);
3958 3958
             $pageInfo = $this->db->getRow($result);
3959 3959
 
@@ -4000,7 +4000,7 @@  discard block
 block discarded – undo
4000 4000
     {
4001 4001
         if ($this->currentSnippet) {
4002 4002
             $tbl = $this->getFullTableName("site_snippets");
4003
-            $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1);
4003
+            $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1);
4004 4004
             if ($snippetId = $this->db->getValue($rs)) {
4005 4005
                 return $snippetId;
4006 4006
             }
@@ -4027,23 +4027,23 @@  discard block
 block discarded – undo
4027 4027
      */
4028 4028
     public function clearCache($type = '', $report = false)
4029 4029
     {
4030
-        $cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
4030
+        $cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
4031 4031
         if (is_array($type)) {
4032 4032
             foreach ($type as $_) {
4033 4033
                 $this->clearCache($_, $report);
4034 4034
             }
4035 4035
         } elseif ($type == 'full') {
4036
-            include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
4036
+            include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
4037 4037
             $sync = new synccache();
4038 4038
             $sync->setCachepath($cache_dir);
4039 4039
             $sync->setReport($report);
4040 4040
             $sync->emptyCache();
4041 4041
         } elseif (preg_match('@^[1-9][0-9]*$@', $type)) {
4042 4042
             $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type;
4043
-            $file_name = "docid_" . $key . "_*.pageCache.php";
4044
-            $cache_path = $cache_dir . $file_name;
4043
+            $file_name = "docid_".$key."_*.pageCache.php";
4044
+            $cache_path = $cache_dir.$file_name;
4045 4045
             $files = glob($cache_path);
4046
-            $files[] = $cache_dir . "docid_" . $key . ".pageCache.php";
4046
+            $files[] = $cache_dir."docid_".$key.".pageCache.php";
4047 4047
             foreach ($files as $file) {
4048 4048
                 if (!is_file($file)) {
4049 4049
                     continue;
@@ -4051,7 +4051,7 @@  discard block
 block discarded – undo
4051 4051
                 unlink($file);
4052 4052
             }
4053 4053
         } else {
4054
-            $files = glob($cache_dir . '*');
4054
+            $files = glob($cache_dir.'*');
4055 4055
             foreach ($files as $file) {
4056 4056
                 $name = basename($file);
4057 4057
                 if (strpos($name, '.pageCache.php') === false) {
@@ -4119,14 +4119,14 @@  discard block
 block discarded – undo
4119 4119
                         $f_url_suffix = '/';
4120 4120
                     }
4121 4121
 
4122
-                    $alPath = !empty($al['path']) ? $al['path'] . '/' : '';
4122
+                    $alPath = !empty($al['path']) ? $al['path'].'/' : '';
4123 4123
 
4124 4124
                     if ($al && $al['alias']) {
4125 4125
                         $alias = $al['alias'];
4126 4126
                     }
4127 4127
                 }
4128 4128
 
4129
-                $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix;
4129
+                $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix;
4130 4130
                 $url = "{$alias}{$args}";
4131 4131
             } else {
4132 4132
                 $url = "index.php?id={$id}{$args}";
@@ -4145,7 +4145,7 @@  discard block
 block discarded – undo
4145 4145
             }
4146 4146
 
4147 4147
             //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080)
4148
-            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host;
4148
+            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host;
4149 4149
         }
4150 4150
 
4151 4151
         //fix strictUrl by Bumkaka
@@ -4154,9 +4154,9 @@  discard block
 block discarded – undo
4154 4154
         }
4155 4155
 
4156 4156
         if ($this->config['xhtml_urls']) {
4157
-            $url = preg_replace("/&(?!amp;)/", "&amp;", $host . $virtualDir . $url);
4157
+            $url = preg_replace("/&(?!amp;)/", "&amp;", $host.$virtualDir.$url);
4158 4158
         } else {
4159
-            $url = $host . $virtualDir . $url;
4159
+            $url = $host.$virtualDir.$url;
4160 4160
         }
4161 4161
 
4162 4162
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -4180,21 +4180,21 @@  discard block
 block discarded – undo
4180 4180
         if (isset($this->aliasListing[$id])) {
4181 4181
             $out = $this->aliasListing[$id];
4182 4182
         } else {
4183
-            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id);
4183
+            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id);
4184 4184
             if ($this->db->getRecordCount($q) == '1') {
4185 4185
                 $q = $this->db->getRow($q);
4186 4186
                 $this->aliasListing[$id] = array(
4187
-                    'id' => (int)$q['id'],
4187
+                    'id' => (int) $q['id'],
4188 4188
                     'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'],
4189
-                    'parent' => (int)$q['parent'],
4190
-                    'isfolder' => (int)$q['isfolder'],
4189
+                    'parent' => (int) $q['parent'],
4190
+                    'isfolder' => (int) $q['isfolder'],
4191 4191
                 );
4192 4192
                 if ($this->aliasListing[$id]['parent'] > 0) {
4193 4193
                     //fix alias_path_usage
4194 4194
                     if ($this->config['use_alias_path'] == '1') {
4195 4195
                         //&& $tmp['path'] != '' - fix error slash with epty path
4196 4196
                         $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']);
4197
-                        $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : '');
4197
+                        $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : '');
4198 4198
                     } else {
4199 4199
                         $this->aliasListing[$id]['path'] = '';
4200 4200
                     }
@@ -4235,7 +4235,7 @@  discard block
 block discarded – undo
4235 4235
         $out = array();
4236 4236
         if (empty($this->version) || !is_array($this->version)) {
4237 4237
             //include for compatibility modx version < 1.0.10
4238
-            include MODX_MANAGER_PATH . "includes/version.inc.php";
4238
+            include MODX_MANAGER_PATH."includes/version.inc.php";
4239 4239
             $this->version = array();
4240 4240
             $this->version['version'] = isset($modx_version) ? $modx_version : '';
4241 4241
             $this->version['branch'] = isset($modx_branch) ? $modx_branch : '';
@@ -4257,18 +4257,18 @@  discard block
 block discarded – undo
4257 4257
     {
4258 4258
         if (isset($this->snippetCache[$snippetName])) {
4259 4259
             $snippet = $this->snippetCache[$snippetName];
4260
-            $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4260
+            $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : '';
4261 4261
         } else { // not in cache so let's check the db
4262
-            $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;";
4262
+            $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;";
4263 4263
             $result = $this->db->query($sql);
4264 4264
             if ($this->db->getRecordCount($result) == 1) {
4265 4265
                 $row = $this->db->getRow($result);
4266 4266
                 $snippet = $this->snippetCache[$snippetName] = $row['snippet'];
4267 4267
                 $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties']));
4268
-                $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties);
4268
+                $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties);
4269 4269
             } else {
4270 4270
                 $snippet = $this->snippetCache[$snippetName] = "return false;";
4271
-                $properties = $this->snippetCache[$snippetName . "Props"] = '';
4271
+                $properties = $this->snippetCache[$snippetName."Props"] = '';
4272 4272
             }
4273 4273
         }
4274 4274
         // load default params/properties
@@ -4368,7 +4368,7 @@  discard block
 block discarded – undo
4368 4368
             if (strpos($tpl, $s) !== false) {
4369 4369
                 $tpl = str_replace($s, $value, $tpl);
4370 4370
             } elseif ($this->debug) {
4371
-                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2);
4371
+                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2);
4372 4372
             }
4373 4373
         }
4374 4374
 
@@ -4417,7 +4417,7 @@  discard block
 block discarded – undo
4417 4417
             case 'CODE':
4418 4418
                 break;
4419 4419
             case 'FILE':
4420
-                $template = file_get_contents(MODX_BASE_PATH . $template);
4420
+                $template = file_get_contents(MODX_BASE_PATH.$template);
4421 4421
                 break;
4422 4422
             case 'CHUNK':
4423 4423
                 $template = $this->getChunk($template);
@@ -4450,7 +4450,7 @@  discard block
 block discarded – undo
4450 4450
         if ($mode !== 'formatOnly' && empty($timestamp)) {
4451 4451
             return '-';
4452 4452
         }
4453
-        $timestamp = (int)$timestamp;
4453
+        $timestamp = (int) $timestamp;
4454 4454
 
4455 4455
         switch ($this->config['datetime_format']) {
4456 4456
             case 'YYYY/mm/dd':
@@ -4470,7 +4470,7 @@  discard block
 block discarded – undo
4470 4470
         }
4471 4471
 
4472 4472
         if (empty($mode)) {
4473
-            $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp);
4473
+            $strTime = strftime($dateFormat." %H:%M:%S", $timestamp);
4474 4474
         } elseif ($mode == 'dateOnly') {
4475 4475
             $strTime = strftime($dateFormat, $timestamp);
4476 4476
         } elseif ($mode == 'formatOnly') {
@@ -4524,7 +4524,7 @@  discard block
 block discarded – undo
4524 4524
             $S = 0;
4525 4525
         }
4526 4526
         $timeStamp = mktime($H, $M, $S, $m, $d, $Y);
4527
-        $timeStamp = (int)$timeStamp;
4527
+        $timeStamp = (int) $timeStamp;
4528 4528
         return $timeStamp;
4529 4529
     }
4530 4530
 
@@ -4566,7 +4566,7 @@  discard block
 block discarded – undo
4566 4566
                     if ($v === 'value') {
4567 4567
                         unset($_[$i]);
4568 4568
                     } else {
4569
-                        $_[$i] = 'tv.' . $v;
4569
+                        $_[$i] = 'tv.'.$v;
4570 4570
                     }
4571 4571
                 }
4572 4572
                 $fields = implode(',', $_);
@@ -4575,12 +4575,12 @@  discard block
 block discarded – undo
4575 4575
             }
4576 4576
 
4577 4577
             if ($tvsort != '') {
4578
-                $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4578
+                $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4579 4579
             }
4580 4580
             if ($tvidnames == "*") {
4581 4581
                 $query = "tv.id<>0";
4582 4582
             } else {
4583
-                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')";
4583
+                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')";
4584 4584
             }
4585 4585
 
4586 4586
             $this->getUserDocGroups();
@@ -4741,18 +4741,18 @@  discard block
 block discarded – undo
4741 4741
             }
4742 4742
 
4743 4743
             // get user defined template variables
4744
-            $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4745
-            $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4744
+            $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4745
+            $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4746 4746
 
4747 4747
             if ($idnames == '*') {
4748 4748
                 $query = 'tv.id<>0';
4749 4749
             } else {
4750
-                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')";
4750
+                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')";
4751 4751
             }
4752 4752
 
4753
-            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv
4754
-                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id
4755
-                    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}" : ""));
4753
+            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv
4754
+                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id
4755
+                    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}" : ""));
4756 4756
 
4757 4757
             $result = $this->db->makeArray($rs);
4758 4758
 
@@ -4801,16 +4801,16 @@  discard block
 block discarded – undo
4801 4801
             $output = array();
4802 4802
             $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames);
4803 4803
 
4804
-            $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier;
4804
+            $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier;
4805 4805
             // remove sort for speed
4806 4806
             $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');
4807 4807
 
4808 4808
             if ($result == false) {
4809 4809
                 return false;
4810 4810
             } else {
4811
-                $baspath = MODX_MANAGER_PATH . 'includes';
4812
-                include_once $baspath . '/tmplvars.format.inc.php';
4813
-                include_once $baspath . '/tmplvars.commands.inc.php';
4811
+                $baspath = MODX_MANAGER_PATH.'includes';
4812
+                include_once $baspath.'/tmplvars.format.inc.php';
4813
+                include_once $baspath.'/tmplvars.commands.inc.php';
4814 4814
 
4815 4815
                 for ($i = 0; $i < count($result); $i++) {
4816 4816
                     $row = $result[$i];
@@ -4835,7 +4835,7 @@  discard block
 block discarded – undo
4835 4835
      */
4836 4836
     public function getFullTableName($tbl)
4837 4837
     {
4838
-        return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`";
4838
+        return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`";
4839 4839
     }
4840 4840
 
4841 4841
     /**
@@ -4914,7 +4914,7 @@  discard block
 block discarded – undo
4914 4914
     public function getCachePath()
4915 4915
     {
4916 4916
         global $base_url;
4917
-        $pth = $base_url . $this->getCacheFolder();
4917
+        $pth = $base_url.$this->getCacheFolder();
4918 4918
         return $pth;
4919 4919
     }
4920 4920
 
@@ -4966,8 +4966,8 @@  discard block
 block discarded – undo
4966 4966
         $out = false;
4967 4967
 
4968 4968
         if (!empty($context)) {
4969
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4970
-                $out = $_SESSION[$context . 'InternalKey'];
4969
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4970
+                $out = $_SESSION[$context.'InternalKey'];
4971 4971
             }
4972 4972
         } else {
4973 4973
             switch (true) {
@@ -4995,8 +4995,8 @@  discard block
 block discarded – undo
4995 4995
         $out = false;
4996 4996
 
4997 4997
         if (!empty($context)) {
4998
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4999
-                $out = $_SESSION[$context . 'Shortname'];
4998
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4999
+                $out = $_SESSION[$context.'Shortname'];
5000 5000
             }
5001 5001
         } else {
5002 5002
             switch (true) {
@@ -5067,8 +5067,8 @@  discard block
 block discarded – undo
5067 5067
      */
5068 5068
     public function getWebUserInfo($uid)
5069 5069
     {
5070
-        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu
5071
-                INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5070
+        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu
5071
+                INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5072 5072
         if ($row = $this->db->getRow($rs)) {
5073 5073
             if (!isset($row['usertype']) or !$row["usertype"]) {
5074 5074
                 $row["usertype"] = "web";
@@ -5104,7 +5104,7 @@  discard block
 block discarded – undo
5104 5104
         } elseif (is_array($dg)) {
5105 5105
             // resolve ids to names
5106 5106
             $dgn = array();
5107
-            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")");
5107
+            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")");
5108 5108
             while ($row = $this->db->getRow($ds)) {
5109 5109
                 $dgn[] = $row['name'];
5110 5110
             }
@@ -5132,7 +5132,7 @@  discard block
 block discarded – undo
5132 5132
         $rt = false;
5133 5133
         if ($_SESSION["webValidated"] == 1) {
5134 5134
             $tbl = $this->getFullTableName("web_users");
5135
-            $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'");
5135
+            $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'");
5136 5136
             if ($row = $this->db->getRow($ds)) {
5137 5137
                 if ($row["password"] == md5($oldPwd)) {
5138 5138
                     if (strlen($newPwd) < 6) {
@@ -5142,7 +5142,7 @@  discard block
 block discarded – undo
5142 5142
                     } else {
5143 5143
                         $this->db->update(array(
5144 5144
                             'password' => $this->db->escape($newPwd),
5145
-                        ), $tbl, "id='" . $this->getLoginUserID() . "'");
5145
+                        ), $tbl, "id='".$this->getLoginUserID()."'");
5146 5146
                         // invoke OnWebChangePassword event
5147 5147
                         $this->invokeEvent("OnWebChangePassword", array(
5148 5148
                             "userid" => $row["id"],
@@ -5173,8 +5173,8 @@  discard block
 block discarded – undo
5173 5173
         // check cache
5174 5174
         $grpNames = isset($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false;
5175 5175
         if (!is_array($grpNames)) {
5176
-            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn
5177
-                    INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'");
5176
+            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn
5177
+                    INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'");
5178 5178
             $grpNames = $this->db->getColumn("name", $rs);
5179 5179
             // save to cache
5180 5180
             $_SESSION['webUserGroupNames'] = $grpNames;
@@ -5207,7 +5207,7 @@  discard block
 block discarded – undo
5207 5207
         if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) {
5208 5208
             $this->sjscripts[$nextpos] = $src;
5209 5209
         } else {
5210
-            $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>';
5210
+            $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>';
5211 5211
         }
5212 5212
     }
5213 5213
 
@@ -5286,7 +5286,7 @@  discard block
 block discarded – undo
5286 5286
         }
5287 5287
 
5288 5288
         if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) {
5289
-            $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>';
5289
+            $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>';
5290 5290
         }
5291 5291
         if ($startup) {
5292 5292
             $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1;
@@ -5433,7 +5433,7 @@  discard block
 block discarded – undo
5433 5433
                 $eventtime = $this->getMicroTime() - $eventtime;
5434 5434
                 $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000);
5435 5435
                 foreach ($parameter as $k => $v) {
5436
-                    $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>';
5436
+                    $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>';
5437 5437
                 }
5438 5438
                 $this->pluginsCode .= '</fieldset><br />';
5439 5439
                 $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime;
@@ -5461,13 +5461,13 @@  discard block
 block discarded – undo
5461 5461
         $plugin = array();
5462 5462
         if (isset($this->pluginCache[$pluginName])) {
5463 5463
             $pluginCode = $this->pluginCache[$pluginName];
5464
-            $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : '';
5464
+            $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : '';
5465 5465
         } else {
5466 5466
             $pluginName = $this->db->escape($pluginName);
5467 5467
             $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0");
5468 5468
             if ($row = $this->db->getRow($result)) {
5469 5469
                 $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode'];
5470
-                $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties'];
5470
+                $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties'];
5471 5471
             } else {
5472 5472
                 $pluginCode = $this->pluginCache[$pluginName] = "return false;";
5473 5473
                 $pluginProperties = '';
@@ -5569,7 +5569,7 @@  discard block
 block discarded – undo
5569 5569
     public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)
5570 5570
     {
5571 5571
         $params = array();
5572
-        $fullpath = $element_dir . '/' . $filename;
5572
+        $fullpath = $element_dir.'/'.$filename;
5573 5573
         if (is_readable($fullpath)) {
5574 5574
             $tpl = @fopen($fullpath, "r");
5575 5575
             if ($tpl) {
@@ -5736,8 +5736,8 @@  discard block
 block discarded – undo
5736 5736
         $ph = array('site_url' => MODX_SITE_URL);
5737 5737
         $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";
5738 5738
         $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';
5739
-        $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';
5740
-        $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';
5739
+        $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';
5740
+        $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';
5741 5741
         foreach ($parsed as $key => $val) {
5742 5742
             if (is_array($val)) {
5743 5743
                 foreach ($val as $key2 => $val2) {
@@ -5746,7 +5746,7 @@  discard block
 block discarded – undo
5746 5746
                         $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2);
5747 5747
                     }
5748 5748
                     if (preg_match($regexEmail, $val2, $url)) {
5749
-                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);
5749
+                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);
5750 5750
                     }
5751 5751
                     $parsed[$key][$key2] = $val2;
5752 5752
                 }
@@ -5756,7 +5756,7 @@  discard block
 block discarded – undo
5756 5756
                     $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val);
5757 5757
                 }
5758 5758
                 if (preg_match($regexEmail, $val, $url)) {
5759
-                    $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);
5759
+                    $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);
5760 5760
                 }
5761 5761
                 $parsed[$key] = $val;
5762 5762
             }
@@ -5770,32 +5770,32 @@  discard block
 block discarded – undo
5770 5770
         );
5771 5771
 
5772 5772
         $nl = "\n";
5773
-        $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';
5774
-        $list .= '<p>' . $nl;
5775
-        $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';
5776
-        $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';
5777
-        $list .= '</p><br/>' . $nl;
5778
-        $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';
5779
-        $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';
5780
-        $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';
5781
-        $list .= '<br/>' . $nl;
5773
+        $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';
5774
+        $list .= '<p>'.$nl;
5775
+        $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';
5776
+        $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';
5777
+        $list .= '</p><br/>'.$nl;
5778
+        $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';
5779
+        $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';
5780
+        $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';
5781
+        $list .= '<br/>'.$nl;
5782 5782
         $first = true;
5783 5783
         foreach ($arrayParams as $param => $label) {
5784 5784
             if (isset($parsed[$param])) {
5785 5785
                 if ($first) {
5786
-                    $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;
5787
-                    $list .= '<ul class="docBlockList">' . $nl;
5786
+                    $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;
5787
+                    $list .= '<ul class="docBlockList">'.$nl;
5788 5788
                     $first = false;
5789 5789
                 }
5790
-                $list .= '    <li><strong>' . $label . '</strong>' . $nl;
5791
-                $list .= '        <ul>' . $nl;
5790
+                $list .= '    <li><strong>'.$label.'</strong>'.$nl;
5791
+                $list .= '        <ul>'.$nl;
5792 5792
                 foreach ($parsed[$param] as $val) {
5793
-                    $list .= '            <li>' . $val . '</li>' . $nl;
5793
+                    $list .= '            <li>'.$val.'</li>'.$nl;
5794 5794
                 }
5795
-                $list .= '        </ul></li>' . $nl;
5795
+                $list .= '        </ul></li>'.$nl;
5796 5796
             }
5797 5797
         }
5798
-        $list .= !$first ? '</ul>' . $nl : '';
5798
+        $list .= !$first ? '</ul>'.$nl : '';
5799 5799
 
5800 5800
         return $list;
5801 5801
     }
@@ -5871,7 +5871,7 @@  discard block
 block discarded – undo
5871 5871
      */
5872 5872
     public function addSnippet($name, $phpCode)
5873 5873
     {
5874
-        $this->snippetCache['#' . $name] = $phpCode;
5874
+        $this->snippetCache['#'.$name] = $phpCode;
5875 5875
     }
5876 5876
 
5877 5877
     /**
@@ -5880,7 +5880,7 @@  discard block
 block discarded – undo
5880 5880
      */
5881 5881
     public function addChunk($name, $text)
5882 5882
     {
5883
-        $this->chunkCache['#' . $name] = $text;
5883
+        $this->chunkCache['#'.$name] = $text;
5884 5884
     }
5885 5885
 
5886 5886
     /**
@@ -5916,7 +5916,7 @@  discard block
 block discarded – undo
5916 5916
         }
5917 5917
 
5918 5918
         if (!$isSafe) {
5919
-            $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);
5919
+            $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);
5920 5920
             $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50)));
5921 5921
             $this->messageQuit($title, '', true, '', '', 'Parser', $msg);
5922 5922
             return;
@@ -5930,7 +5930,7 @@  discard block
 block discarded – undo
5930 5930
             return 'array()';
5931 5931
         }
5932 5932
 
5933
-        $output = $echo . $return;
5933
+        $output = $echo.$return;
5934 5934
         modx_sanitize_gpc($output);
5935 5935
         return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous
5936 5936
     }
@@ -5948,8 +5948,8 @@  discard block
 block discarded – undo
5948 5948
 
5949 5949
         $safe = explode(',', $safe_functions);
5950 5950
 
5951
-        $phpcode = rtrim($phpcode, ';') . ';';
5952
-        $tokens = token_get_all('<?php ' . $phpcode);
5951
+        $phpcode = rtrim($phpcode, ';').';';
5952
+        $tokens = token_get_all('<?php '.$phpcode);
5953 5953
         foreach ($tokens as $i => $token) {
5954 5954
             if (!is_array($token)) {
5955 5955
                 continue;
@@ -5984,7 +5984,7 @@  discard block
 block discarded – undo
5984 5984
      */
5985 5985
     public function atBindFileContent($str = '')
5986 5986
     {
5987
-        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', '');
5987
+        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', '');
5988 5988
 
5989 5989
         if (stripos($str, '@FILE') !== 0) {
5990 5990
             return $str;
@@ -6007,7 +6007,7 @@  discard block
 block discarded – undo
6007 6007
         $errorMsg = sprintf("Could not retrieve string '%s'.", $str);
6008 6008
 
6009 6009
         foreach ($search_path as $path) {
6010
-            $file_path = MODX_BASE_PATH . $path . $str;
6010
+            $file_path = MODX_BASE_PATH.$path.$str;
6011 6011
             if (strpos($file_path, MODX_MANAGER_PATH) === 0) {
6012 6012
                 return $errorMsg;
6013 6013
             } elseif (is_file($file_path)) {
@@ -6021,7 +6021,7 @@  discard block
 block discarded – undo
6021 6021
             return $errorMsg;
6022 6022
         }
6023 6023
 
6024
-        $content = (string)file_get_contents($file_path);
6024
+        $content = (string) file_get_contents($file_path);
6025 6025
         if ($content === false) {
6026 6026
             return $errorMsg;
6027 6027
         }
@@ -6133,22 +6133,22 @@  discard block
 block discarded – undo
6133 6133
 
6134 6134
         $version = isset($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
6135 6135
         $release_date = isset($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
6136
-        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI'];
6136
+        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI'];
6137 6137
         $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);
6138 6138
         $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);
6139 6139
         $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);
6140 6140
         if ($is_error) {
6141 6141
             $str = '<h2 style="color:red">&laquo; Evo Parse Error &raquo;</h2>';
6142 6142
             if ($msg != 'PHP Parse Error') {
6143
-                $str .= '<h3 style="color:red">' . $msg . '</h3>';
6143
+                $str .= '<h3 style="color:red">'.$msg.'</h3>';
6144 6144
             }
6145 6145
         } else {
6146 6146
             $str = '<h2 style="color:#003399">&laquo; Evo Debug/ stop message &raquo;</h2>';
6147
-            $str .= '<h3 style="color:#003399">' . $msg . '</h3>';
6147
+            $str .= '<h3 style="color:#003399">'.$msg.'</h3>';
6148 6148
         }
6149 6149
 
6150 6150
         if (!empty($query)) {
6151
-            $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>';
6151
+            $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>';
6152 6152
         }
6153 6153
 
6154 6154
         $errortype = array(
@@ -6171,13 +6171,13 @@  discard block
 block discarded – undo
6171 6171
 
6172 6172
         if (!empty($nr) || !empty($file)) {
6173 6173
             if ($text != '') {
6174
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';
6174
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';
6175 6175
             }
6176 6176
             if ($output != '') {
6177
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';
6177
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';
6178 6178
             }
6179 6179
             if ($nr !== '') {
6180
-                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]");
6180
+                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]");
6181 6181
             }
6182 6182
             if ($file) {
6183 6183
                 $table[] = array('File', $file);
@@ -6196,7 +6196,7 @@  discard block
 block discarded – undo
6196 6196
         }
6197 6197
 
6198 6198
         if (!empty($this->event->activePlugin)) {
6199
-            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')');
6199
+            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')');
6200 6200
         }
6201 6201
 
6202 6202
         $str .= $MakeTable->create($table, array('Error information', ''));
@@ -6206,17 +6206,17 @@  discard block
 block discarded – undo
6206 6206
         $table[] = array('REQUEST_URI', $request_uri);
6207 6207
 
6208 6208
         if ($this->manager->action) {
6209
-            include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
6209
+            include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
6210 6210
             global $action_list;
6211 6211
             $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : '';
6212 6212
 
6213
-            $table[] = array('Manager action', $this->manager->action . $actionName);
6213
+            $table[] = array('Manager action', $this->manager->action.$actionName);
6214 6214
         }
6215 6215
 
6216 6216
         if (preg_match('@^[0-9]+@', $this->documentIdentifier)) {
6217 6217
             $resource = $this->getDocumentObject('id', $this->documentIdentifier);
6218 6218
             $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');
6219
-            $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>');
6219
+            $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>');
6220 6220
         }
6221 6221
         $table[] = array('Referer', $referer);
6222 6222
         $table[] = array('User Agent', $ua);
@@ -6237,7 +6237,7 @@  discard block
 block discarded – undo
6237 6237
 
6238 6238
         $mem = memory_get_peak_usage(true);
6239 6239
         $total_mem = $mem - $this->mstart;
6240
-        $total_mem = ($total_mem / 1024 / 1024) . ' mb';
6240
+        $total_mem = ($total_mem / 1024 / 1024).' mb';
6241 6241
 
6242 6242
         $queryTime = $this->queryTime;
6243 6243
         $phpTime = $totalTime - $queryTime;
@@ -6258,18 +6258,18 @@  discard block
 block discarded – undo
6258 6258
         $str .= $this->get_backtrace(debug_backtrace());
6259 6259
         // Log error
6260 6260
         if (!empty($this->currentSnippet)) {
6261
-            $source = 'Snippet - ' . $this->currentSnippet;
6261
+            $source = 'Snippet - '.$this->currentSnippet;
6262 6262
         } elseif (!empty($this->event->activePlugin)) {
6263
-            $source = 'Plugin - ' . $this->event->activePlugin;
6263
+            $source = 'Plugin - '.$this->event->activePlugin;
6264 6264
         } elseif ($source !== '') {
6265
-            $source = 'Parser - ' . $source;
6265
+            $source = 'Parser - '.$source;
6266 6266
         } elseif ($query !== '') {
6267 6267
             $source = 'SQL Query';
6268 6268
         } else {
6269 6269
             $source = 'Parser';
6270 6270
         }
6271 6271
         if ($msg) {
6272
-            $source .= ' / ' . $msg;
6272
+            $source .= ' / '.$msg;
6273 6273
         }
6274 6274
         if (isset($actionName) && !empty($actionName)) {
6275 6275
             $source .= $actionName;
@@ -6301,12 +6301,12 @@  discard block
 block discarded – undo
6301 6301
 
6302 6302
         // Display error
6303 6303
         if (isset($_SESSION['mgrValidated'])) {
6304
-            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>
6304
+            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>
6305 6305
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6306
-                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />
6306
+                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />
6307 6307
                  <style type="text/css">body { padding:10px; } td {font:inherit;}</style>
6308 6308
                  </head><body>
6309
-                 ' . $str . '</body></html>';
6309
+                 ' . $str.'</body></html>';
6310 6310
         } else {
6311 6311
             echo 'Error';
6312 6312
         }
@@ -6343,7 +6343,7 @@  discard block
 block discarded – undo
6343 6343
             switch ($val['type']) {
6344 6344
                 case '->':
6345 6345
                 case '::':
6346
-                    $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];
6346
+                    $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];
6347 6347
                     break;
6348 6348
                 default:
6349 6349
                     $functionName = $val['function'];
@@ -6353,7 +6353,7 @@  discard block
 block discarded – undo
6353 6353
             $args = array_pad(array(), $_, '$var');
6354 6354
             $args = implode(", ", $args);
6355 6355
             $modx = &$this;
6356
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6356
+            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) {
6357 6357
                 $arg = $val['args'][$tmp - 1];
6358 6358
                 switch (true) {
6359 6359
                     case is_null($arg): {
@@ -6365,7 +6365,7 @@  discard block
 block discarded – undo
6365 6365
                         break;
6366 6366
                     }
6367 6367
                     case is_scalar($arg): {
6368
-                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'");
6368
+                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'");
6369 6369
                         break;
6370 6370
                     }
6371 6371
                     case is_bool($arg): {
@@ -6373,23 +6373,23 @@  discard block
 block discarded – undo
6373 6373
                         break;
6374 6374
                     }
6375 6375
                     case is_array($arg): {
6376
-                        $out = 'array $var' . $tmp;
6376
+                        $out = 'array $var'.$tmp;
6377 6377
                         break;
6378 6378
                     }
6379 6379
                     case is_object($arg): {
6380
-                        $out = get_class($arg) . ' $var' . $tmp;
6380
+                        $out = get_class($arg).' $var'.$tmp;
6381 6381
                         break;
6382 6382
                     }
6383 6383
                     default: {
6384
-                        $out = '$var' . $tmp;
6384
+                        $out = '$var'.$tmp;
6385 6385
                     }
6386 6386
                 }
6387 6387
                 $tmp++;
6388 6388
                 return $out;
6389 6389
             }, $args);
6390 6390
             $line = array(
6391
-                "<strong>" . $functionName . "</strong>(" . $args . ")",
6392
-                $path . " on line " . $val['line']
6391
+                "<strong>".$functionName."</strong>(".$args.")",
6392
+                $path." on line ".$val['line']
6393 6393
             );
6394 6394
             $table[] = array(implode("<br />", $line));
6395 6395
         }
@@ -6430,7 +6430,7 @@  discard block
 block discarded – undo
6430 6430
             $alias = strip_tags($alias); // strip HTML
6431 6431
             $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters
6432 6432
             $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash
6433
-            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one
6433
+            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one
6434 6434
             $alias = trim($alias, '-'); // trim excess
6435 6435
             return $alias;
6436 6436
         }
@@ -6446,7 +6446,7 @@  discard block
 block discarded – undo
6446 6446
         $precisions = count($sizes) - 1;
6447 6447
         foreach ($sizes as $unit => $bytes) {
6448 6448
             if ($size >= $bytes) {
6449
-                return number_format($size / $bytes, $precisions) . ' ' . $unit;
6449
+                return number_format($size / $bytes, $precisions).' '.$unit;
6450 6450
             }
6451 6451
             $precisions--;
6452 6452
         }
@@ -6550,10 +6550,10 @@  discard block
 block discarded – undo
6550 6550
 
6551 6551
         if (strpos($str, MODX_MANAGER_PATH) === 0) {
6552 6552
             return false;
6553
-        } elseif (is_file(MODX_BASE_PATH . $str)) {
6554
-            $file_path = MODX_BASE_PATH . $str;
6555
-        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) {
6556
-            $file_path = MODX_BASE_PATH . $tpl_dir . $str;
6553
+        } elseif (is_file(MODX_BASE_PATH.$str)) {
6554
+            $file_path = MODX_BASE_PATH.$str;
6555
+        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) {
6556
+            $file_path = MODX_BASE_PATH.$tpl_dir.$str;
6557 6557
         } else {
6558 6558
             return false;
6559 6559
         }
@@ -6679,7 +6679,7 @@  discard block
 block discarded – undo
6679 6679
             $title = 'no title';
6680 6680
         }
6681 6681
         if (is_array($msg)) {
6682
-            $msg = '<pre>' . print_r($msg, true) . '</pre>';
6682
+            $msg = '<pre>'.print_r($msg, true).'</pre>';
6683 6683
         } elseif ($msg === '') {
6684 6684
             $msg = $_SERVER['REQUEST_URI'];
6685 6685
         }
Please login to merge, or discard this patch.
manager/includes/SystemEvent.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
         if (is_array($SystemAlertMsgQueque)) {
36 36
             $title = '';
37 37
             if ($this->name && $this->activePlugin) {
38
-                $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>";
38
+                $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>";
39 39
             }
40 40
             $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>";
41 41
         }
Please login to merge, or discard this patch.