Completed
Branch develop (db0854)
by Agel_Nash
05:19
created
manager/includes/document.parser.class.inc.php 1 patch
Spacing   +267 added lines, -267 removed lines patch added patch discarded remove patch
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      */
206 206
     function __call($method_name, $arguments)
207 207
     {
208
-        include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php');
208
+        include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php');
209 209
         if (method_exists($this->old, $method_name)) {
210 210
             $error_type = 1;
211 211
         } else {
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
             $info = debug_backtrace();
224 224
             $m[] = $msg;
225 225
             if (!empty($this->currentSnippet)) {
226
-                $m[] = 'Snippet - ' . $this->currentSnippet;
226
+                $m[] = 'Snippet - '.$this->currentSnippet;
227 227
             } elseif (!empty($this->event->activePlugin)) {
228
-                $m[] = 'Plugin - ' . $this->event->activePlugin;
228
+                $m[] = 'Plugin - '.$this->event->activePlugin;
229 229
             }
230 230
             $m[] = $this->decoded_request_uri;
231
-            $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')';
231
+            $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')';
232 232
             $msg = implode('<br />', $m);
233 233
             $this->logEvent(0, $error_type, $msg, $title);
234 234
         }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     {
246 246
         $flag = false;
247 247
         if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) {
248
-            $flag = (bool)$this->{$connector}->conn;
248
+            $flag = (bool) $this->{$connector}->conn;
249 249
         }
250 250
         return $flag;
251 251
     }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
         }
273 273
         if (!$out && $flag) {
274 274
             $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname)));
275
-            $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php";
275
+            $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php";
276 276
             $out = is_file($filename) ? include $filename : false;
277 277
         }
278 278
         if ($out && !in_array($extname, $this->extensions)) {
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     public function getMicroTime()
290 290
     {
291 291
         list ($usec, $sec) = explode(' ', microtime());
292
-        return ((float)$usec + (float)$sec);
292
+        return ((float) $usec + (float) $sec);
293 293
     }
294 294
 
295 295
     /**
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
             // append the redirect count string to the url
314 314
             $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0;
315 315
             if ($currentNumberOfRedirects > 3) {
316
-                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>');
316
+                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>');
317 317
             } else {
318 318
                 $currentNumberOfRedirects += 1;
319 319
                 if (strpos($url, "?") > 0) {
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
             }
325 325
         }
326 326
         if ($type == 'REDIRECT_REFRESH') {
327
-            $header = 'Refresh: 0;URL=' . $url;
327
+            $header = 'Refresh: 0;URL='.$url;
328 328
         } elseif ($type == 'REDIRECT_META') {
329
-            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />';
329
+            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />';
330 330
             echo $header;
331 331
             exit;
332 332
         } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) {
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
             global $base_url, $site_url;
335 335
             if (substr($url, 0, strlen($base_url)) == $base_url) {
336 336
                 // append $site_url to make it work with Location:
337
-                $url = $site_url . substr($url, strlen($base_url));
337
+                $url = $site_url.substr($url, strlen($base_url));
338 338
             }
339 339
             if (strpos($url, "\n") === false) {
340
-                $header = 'Location: ' . $url;
340
+                $header = 'Location: '.$url;
341 341
             } else {
342 342
                 $this->messageQuit('No newline allowed in redirect url.');
343 343
             }
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
             header($responseCode);
347 347
         }
348 348
 
349
-        if(!empty($header)) {
349
+        if (!empty($header)) {
350 350
             header($header);
351 351
         }
352 352
 
@@ -450,8 +450,8 @@  discard block
 block discarded – undo
450 450
 
451 451
     private function recoverySiteCache()
452 452
     {
453
-        $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
454
-        $site_cache_path = $site_cache_dir . 'siteCache.idx.php';
453
+        $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
454
+        $site_cache_path = $site_cache_dir.'siteCache.idx.php';
455 455
 
456 456
         if (is_file($site_cache_path)) {
457 457
             include($site_cache_path);
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
             return;
461 461
         }
462 462
 
463
-        include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
463
+        include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
464 464
         $cache = new synccache();
465 465
         $cache->setCachepath($site_cache_dir);
466 466
         $cache->setReport(false);
@@ -512,8 +512,8 @@  discard block
 block discarded – undo
512 512
                 $this->invokeEvent("OnBeforeManagerPageInit");
513 513
             }
514 514
 
515
-            if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) {
516
-                $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet'];
515
+            if (isset ($_SESSION[$usrType.'UsrConfigSet'])) {
516
+                $usrSettings = &$_SESSION[$usrType.'UsrConfigSet'];
517 517
             } else {
518 518
                 if ($usrType == 'web') {
519 519
                     $from = $tbl_web_user_settings;
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
                     $usrSettings[$row['setting_name']] = $row['setting_value'];
534 534
                 }
535 535
                 if (isset ($usrType)) {
536
-                    $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
536
+                    $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings;
537 537
                 } // store user settings in session
538 538
             }
539 539
         }
@@ -678,10 +678,10 @@  discard block
 block discarded – undo
678 678
         $suf = $this->config['friendly_url_suffix'];
679 679
         $pre = preg_quote($pre, '/');
680 680
         $suf = preg_quote($suf, '/');
681
-        if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) {
681
+        if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) {
682 682
             $q = $_[1];
683 683
         }
684
-        if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) {
684
+        if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) {
685 685
             $q = $_[1];
686 686
         }
687 687
 
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
         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 */
704 704
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
705 705
             if ($this->config['use_alias_path'] == 1) {
706
-                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))))) {
706
+                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))))) {
707 707
                     $this->documentMethod = 'id';
708 708
                     return $q;
709 709
                 } else { /* not a valid id in terms of virtualDir, treat as alias */
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
      */
738 738
     public function getHashFile($key)
739 739
     {
740
-        return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php";
740
+        return $this->getCacheFolder()."docid_".$key.".pageCache.php";
741 741
     }
742 742
 
743 743
     /**
@@ -748,9 +748,9 @@  discard block
 block discarded – undo
748 748
         $hash = $id;
749 749
         $tmp = null;
750 750
         $params = array();
751
-        if(!empty($this->systemCacheKey)){
751
+        if (!empty($this->systemCacheKey)) {
752 752
             $hash = $this->systemCacheKey;
753
-        }else {
753
+        } else {
754 754
             if (!empty($_GET)) {
755 755
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
756 756
                 $params = $_GET;
@@ -758,8 +758,8 @@  discard block
 block discarded – undo
758 758
                 $hash .= '_'.md5(http_build_query($params));
759 759
             }
760 760
         }
761
-        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params));
762
-        if (is_array($evtOut) && count($evtOut) > 0){
761
+        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params));
762
+        if (is_array($evtOut) && count($evtOut) > 0) {
763 763
             $tmp = array_pop($evtOut);
764 764
         }
765 765
         return empty($tmp) ? $hash : $tmp;
@@ -901,12 +901,12 @@  discard block
 block discarded – undo
901 901
         if ($js = $this->getRegisteredClientStartupScripts()) {
902 902
             // change to just before closing </head>
903 903
             // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent);
904
-            $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput);
904
+            $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput);
905 905
         }
906 906
 
907 907
         // Insert jscripts & html block into template - template must have a </body> tag
908 908
         if ($js = $this->getRegisteredClientScripts()) {
909
-            $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput);
909
+            $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput);
910 910
         }
911 911
         // End fix by sirlancelot
912 912
 
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
         // send out content-type and content-disposition headers
918 918
         if (IN_PARSER_MODE == "true") {
919 919
             $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html";
920
-            header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']);
920
+            header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']);
921 921
             //            if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error)
922 922
             //                header('HTTP/1.0 404 Not Found');
923 923
             if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) {
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
                     $name = preg_replace('|-+|', '-', $name);
936 936
                     $name = trim($name, '-');
937 937
                 }
938
-                $header = 'Content-Disposition: attachment; filename=' . $name;
938
+                $header = 'Content-Disposition: attachment; filename='.$name;
939 939
                 header($header);
940 940
             }
941 941
         }
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
 
944 944
         $stats = $this->getTimerStats($this->tstart);
945 945
 
946
-        $out =& $this->documentOutput;
946
+        $out = & $this->documentOutput;
947 947
         $out = str_replace("[^q^]", $stats['queries'], $out);
948 948
         $out = str_replace("[^qt^]", $stats['queryTime'], $out);
949 949
         $out = str_replace("[^p^]", $stats['phpTime'], $out);
@@ -982,17 +982,17 @@  discard block
 block discarded – undo
982 982
                 $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet
983 983
                 $tt += $t;
984 984
             }
985
-            echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />";
985
+            echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />";
986 986
             echo $this->snippetsCode;
987 987
         }
988 988
         if ($this->dumpPlugins) {
989 989
             $ps = "";
990 990
             $tt = 0;
991 991
             foreach ($this->pluginsTime as $s => $t) {
992
-                $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>";
992
+                $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>";
993 993
                 $tt += $t;
994 994
             }
995
-            echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />";
995
+            echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />";
996 996
             echo $this->pluginsCode;
997 997
         }
998 998
 
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
         $srcTags = explode(',', $tags);
1019 1019
         $repTags = array();
1020 1020
         foreach ($srcTags as $tag) {
1021
-            $repTags[] = '\\' . $tag[0] . '\\' . $tag[1];
1021
+            $repTags[] = '\\'.$tag[0].'\\'.$tag[1];
1022 1022
         }
1023 1023
         return array($srcTags, $repTags);
1024 1024
     }
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
         $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']);
1041 1041
         $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache";
1042 1042
         $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0;
1043
-        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb";
1043
+        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb";
1044 1044
 
1045 1045
         return $stats;
1046 1046
     }
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
     {
1074 1074
         $cacheRefreshTime = 0;
1075 1075
         $recent_update = 0;
1076
-        @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php');
1076
+        @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php');
1077 1077
         $this->recentUpdate = $recent_update;
1078 1078
 
1079 1079
         $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time'];
@@ -1127,8 +1127,8 @@  discard block
 block discarded – undo
1127 1127
                 }
1128 1128
 
1129 1129
                 $docObjSerial = serialize($this->documentObject);
1130
-                $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;
1131
-                $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey);
1130
+                $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent;
1131
+                $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey);
1132 1132
                 file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent");
1133 1133
             }
1134 1134
         }
@@ -1170,16 +1170,16 @@  discard block
 block discarded – undo
1170 1170
             return array();
1171 1171
         }
1172 1172
         $spacer = md5('<<<EVO>>>');
1173
-        if($left==='{{' && strpos($content,';}}')!==false)  $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1174
-        if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1175
-        if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1176
-        if($left==='[[' && strpos($content,']]]')!==false)  $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1173
+        if ($left === '{{' && strpos($content, ';}}') !== false)  $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content);
1174
+        if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content);
1175
+        if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content);
1176
+        if ($left === '[[' && strpos($content, ']]]') !== false)  $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content);
1177 1177
 
1178 1178
         $pos['<![CDATA['] = strpos($content, '<![CDATA[');
1179 1179
         $pos[']]>'] = strpos($content, ']]>');
1180 1180
 
1181 1181
         if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) {
1182
-            $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3);
1182
+            $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3);
1183 1183
         }
1184 1184
 
1185 1185
         $lp = explode($left, $content);
@@ -1243,8 +1243,8 @@  discard block
 block discarded – undo
1243 1243
                 }
1244 1244
             }
1245 1245
         }
1246
-        foreach($tags as $i=>$tag) {
1247
-            if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);
1246
+        foreach ($tags as $i=>$tag) {
1247
+            if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag);
1248 1248
         }
1249 1249
         return $tags;
1250 1250
     }
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
         }
1285 1285
 
1286 1286
         foreach ($matches[1] as $i => $key) {
1287
-            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1287
+            if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1288 1288
             if (substr($key, 0, 1) == '#') {
1289 1289
                 $key = substr($key, 1);
1290 1290
             } // remove # for QuickEdit format
@@ -1304,8 +1304,8 @@  discard block
 block discarded – undo
1304 1304
             }
1305 1305
 
1306 1306
             if (is_array($value)) {
1307
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php');
1308
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php');
1307
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php');
1308
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php');
1309 1309
                 $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]);
1310 1310
             }
1311 1311
 
@@ -1316,8 +1316,8 @@  discard block
 block discarded – undo
1316 1316
 
1317 1317
             if (strpos($content, $s) !== false) {
1318 1318
                 $content = str_replace($s, $value, $content);
1319
-            } elseif($this->debug) {
1320
-                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1319
+            } elseif ($this->debug) {
1320
+                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1321 1321
             }
1322 1322
         }
1323 1323
 
@@ -1484,8 +1484,8 @@  discard block
 block discarded – undo
1484 1484
             $s = &$matches[0][$i];
1485 1485
             if (strpos($content, $s) !== false) {
1486 1486
                 $content = str_replace($s, $value, $content);
1487
-            } elseif($this->debug) {
1488
-                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1487
+            } elseif ($this->debug) {
1488
+                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1489 1489
             }
1490 1490
         }
1491 1491
         return $content;
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
             }
1539 1539
 
1540 1540
             $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags
1541
-            $value = $this->mergePlaceholderContent($value, $params);  // parse page global placeholers
1541
+            $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers
1542 1542
             if ($this->config['enable_at_syntax']) {
1543 1543
                 $value = $this->mergeConditionalTagsContent($value);
1544 1544
             }
@@ -1553,8 +1553,8 @@  discard block
 block discarded – undo
1553 1553
             $s = &$matches[0][$i];
1554 1554
             if (strpos($content, $s) !== false) {
1555 1555
                 $content = str_replace($s, $value, $content);
1556
-            } elseif($this->debug) {
1557
-                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1556
+            } elseif ($this->debug) {
1557
+                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1558 1558
             }
1559 1559
         }
1560 1560
         return $content;
@@ -1612,8 +1612,8 @@  discard block
 block discarded – undo
1612 1612
             $s = &$matches[0][$i];
1613 1613
             if (strpos($content, $s) !== false) {
1614 1614
                 $content = str_replace($s, $value, $content);
1615
-            } elseif($this->debug) {
1616
-                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1615
+            } elseif ($this->debug) {
1616
+                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1617 1617
             }
1618 1618
         }
1619 1619
         return $content;
@@ -1637,7 +1637,7 @@  discard block
 block discarded – undo
1637 1637
             return $content;
1638 1638
         }
1639 1639
 
1640
-        $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#';
1640
+        $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#';
1641 1641
         $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content);
1642 1642
 
1643 1643
         $pieces = explode('<@IF:', $content);
@@ -1648,7 +1648,7 @@  discard block
 block discarded – undo
1648 1648
             }
1649 1649
             list($cmd, $text) = explode('>', $split, 2);
1650 1650
             $cmd = str_replace("'", "\'", $cmd);
1651
-            $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1651
+            $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>";
1652 1652
             $content .= $text;
1653 1653
         }
1654 1654
         $pieces = explode('<@ELSEIF:', $content);
@@ -1659,13 +1659,13 @@  discard block
 block discarded – undo
1659 1659
             }
1660 1660
             list($cmd, $text) = explode('>', $split, 2);
1661 1661
             $cmd = str_replace("'", "\'", $cmd);
1662
-            $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1662
+            $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>";
1663 1663
             $content .= $text;
1664 1664
         }
1665 1665
 
1666 1666
         $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content);
1667 1667
         ob_start();
1668
-        $content = eval('?>' . $content);
1668
+        $content = eval('?>'.$content);
1669 1669
         $content = ob_get_clean();
1670 1670
         $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content);
1671 1671
 
@@ -1790,7 +1790,7 @@  discard block
 block discarded – undo
1790 1790
         $matches = $this->getTagsFromContent($content, $left, $right);
1791 1791
         if (!empty($matches)) {
1792 1792
             foreach ($matches[0] as $i => $v) {
1793
-                $addBreakMatches[$i] = $v . "\n";
1793
+                $addBreakMatches[$i] = $v."\n";
1794 1794
             }
1795 1795
             $content = str_replace($addBreakMatches, '', $content);
1796 1796
             if (strpos($content, $left) !== false) {
@@ -1823,8 +1823,8 @@  discard block
 block discarded – undo
1823 1823
             $s = &$matches[0][$i];
1824 1824
             if (strpos($content, $s) !== false) {
1825 1825
                 $content = str_replace($s, $v, $content);
1826
-            } elseif($this->debug) {
1827
-                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1826
+            } elseif ($this->debug) {
1827
+                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1828 1828
             }
1829 1829
         }
1830 1830
         return $content;
@@ -1888,7 +1888,7 @@  discard block
 block discarded – undo
1888 1888
                 $msg = ($msg === false) ? 'ob_get_contents() error' : $msg;
1889 1889
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg);
1890 1890
                 if ($this->isBackend()) {
1891
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>');
1891
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>');
1892 1892
                 }
1893 1893
             }
1894 1894
         } else {
@@ -1934,7 +1934,7 @@  discard block
 block discarded – undo
1934 1934
                 $echo = ($echo === false) ? 'ob_get_contents() error' : $echo;
1935 1935
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo);
1936 1936
                 if ($this->isBackend()) {
1937
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>');
1937
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>');
1938 1938
                 }
1939 1939
             }
1940 1940
         }
@@ -1942,7 +1942,7 @@  discard block
 block discarded – undo
1942 1942
         if (is_array($return) || is_object($return)) {
1943 1943
             return $return;
1944 1944
         } else {
1945
-            return $echo . $return;
1945
+            return $echo.$return;
1946 1946
         }
1947 1947
     }
1948 1948
 
@@ -1980,8 +1980,8 @@  discard block
 block discarded – undo
1980 1980
                 }
1981 1981
                 if (strpos($content, $s) !== false) {
1982 1982
                     $content = str_replace($s, $value, $content);
1983
-                } elseif($this->debug) {
1984
-                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1983
+                } elseif ($this->debug) {
1984
+                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2);
1985 1985
                 }
1986 1986
                 continue;
1987 1987
             }
@@ -1992,8 +1992,8 @@  discard block
 block discarded – undo
1992 1992
 
1993 1993
             if (strpos($content, $s) !== false) {
1994 1994
                 $content = str_replace($s, $value, $content);
1995
-            } elseif($this->debug) {
1996
-                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1995
+            } elseif ($this->debug) {
1996
+                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2);
1997 1997
             }
1998 1998
         }
1999 1999
 
@@ -2084,7 +2084,7 @@  discard block
 block discarded – undo
2084 2084
             $eventtime = sprintf('%2.2f ms', $eventtime * 1000);
2085 2085
             $code = str_replace("\t", '  ', $this->htmlspecialchars($value));
2086 2086
             $piece = str_replace("\t", '  ', $this->htmlspecialchars($piece));
2087
-            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true)));
2087
+            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true)));
2088 2088
             $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);
2089 2089
             $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime);
2090 2090
         }
@@ -2328,7 +2328,7 @@  discard block
 block discarded – undo
2328 2328
             $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where);
2329 2329
             $count = $this->db->getRecordCount($rs);
2330 2330
             if (1 < $count) {
2331
-                exit('Error $modx->_getSnippetObject()' . $snip_name);
2331
+                exit('Error $modx->_getSnippetObject()'.$snip_name);
2332 2332
             }
2333 2333
             if ($count) {
2334 2334
                 $row = $this->db->getRow($rs);
@@ -2354,7 +2354,7 @@  discard block
 block discarded – undo
2354 2354
     public function toAlias($text)
2355 2355
     {
2356 2356
         $suff = $this->config['friendly_url_suffix'];
2357
-        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);
2357
+        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);
2358 2358
     }
2359 2359
 
2360 2360
     /**
@@ -2386,7 +2386,7 @@  discard block
 block discarded – undo
2386 2386
                 $suff = '/';
2387 2387
             }
2388 2388
 
2389
-            $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff;
2389
+            $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff;
2390 2390
         }
2391 2391
 
2392 2392
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -2423,7 +2423,7 @@  discard block
 block discarded – undo
2423 2423
                 preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match);
2424 2424
                 $ids = implode(',', array_unique($match['1']));
2425 2425
                 if ($ids) {
2426
-                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'");
2426
+                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'");
2427 2427
                     while ($row = $this->db->getRow($res)) {
2428 2428
                         if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) {
2429 2429
                             $parent = $row['parent'];
@@ -2434,7 +2434,7 @@  discard block
 block discarded – undo
2434 2434
                                 $parent = $this->aliasListing[$parent]['parent'];
2435 2435
                             }
2436 2436
 
2437
-                            $aliases[$row['id']] = $path . '/' . $row['alias'];
2437
+                            $aliases[$row['id']] = $path.'/'.$row['alias'];
2438 2438
                         } else {
2439 2439
                             $aliases[$row['id']] = $row['alias'];
2440 2440
                         }
@@ -2446,7 +2446,7 @@  discard block
 block discarded – undo
2446 2446
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2447 2447
             $pref = $this->config['friendly_url_prefix'];
2448 2448
             $suff = $this->config['friendly_url_suffix'];
2449
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2449
+            $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2450 2450
                 global $modx;
2451 2451
                 $thealias = $aliases[$m[1]];
2452 2452
                 $thefolder = $isfolder[$m[1]];
@@ -2462,7 +2462,7 @@  discard block
 block discarded – undo
2462 2462
 
2463 2463
         } else {
2464 2464
             $in = '!\[\~([0-9]+)\~\]!is';
2465
-            $out = "index.php?id=" . '\1';
2465
+            $out = "index.php?id=".'\1';
2466 2466
             $documentSource = preg_replace($in, $out, $documentSource);
2467 2467
         }
2468 2468
 
@@ -2483,7 +2483,7 @@  discard block
 block discarded – undo
2483 2483
         $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
2484 2484
         $len_base_url = strlen($this->config['base_url']);
2485 2485
 
2486
-        $url_path = $q;//LANG
2486
+        $url_path = $q; //LANG
2487 2487
 
2488 2488
         if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) {
2489 2489
             $url_path = substr($url_path, $len_base_url);
@@ -2495,7 +2495,7 @@  discard block
 block discarded – undo
2495 2495
             $strictURL = substr($strictURL, $len_base_url);
2496 2496
         }
2497 2497
         $http_host = $_SERVER['HTTP_HOST'];
2498
-        $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG
2498
+        $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG
2499 2499
 
2500 2500
         $site_url = $this->config['site_url'];
2501 2501
 
@@ -2511,7 +2511,7 @@  discard block
 block discarded – undo
2511 2511
                 }
2512 2512
                 if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) {
2513 2513
                     if (empty($_POST)) {
2514
-                        if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) {
2514
+                        if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) {
2515 2515
                             $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
2516 2516
                             exit(0);
2517 2517
                         }
@@ -2574,7 +2574,7 @@  discard block
 block discarded – undo
2574 2574
                 $docgrp = implode(",", $docgrp);
2575 2575
             }
2576 2576
             // get document
2577
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2577
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2578 2578
             $rs = $this->db->select('sc.*', "{$tblsc} sc
2579 2579
                 LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1);
2580 2580
             if ($this->db->getRecordCount($rs) < 1) {
@@ -2610,9 +2610,9 @@  discard block
 block discarded – undo
2610 2610
             }
2611 2611
             if ($documentObject['template']) {
2612 2612
                 // load TVs and merge with document - Orig by Apodigm - Docvars
2613
-                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv
2614
-                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id
2615
-                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2613
+                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv
2614
+                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id
2615
+                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2616 2616
                 $tmplvars = array();
2617 2617
                 while ($row = $this->db->getRow($rs)) {
2618 2618
                     $tmplvars[$row['name']] = array(
@@ -2658,7 +2658,7 @@  discard block
 block discarded – undo
2658 2658
                 $st = md5($source);
2659 2659
             }
2660 2660
             if ($this->dumpSnippets == 1) {
2661
-                $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>";
2661
+                $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>";
2662 2662
             }
2663 2663
 
2664 2664
             // invoke OnParseDocument event
@@ -2744,7 +2744,7 @@  discard block
 block discarded – undo
2744 2744
 
2745 2745
             // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path
2746 2746
             if ($this->config['use_alias_path'] == 1) {
2747
-                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier;
2747
+                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier;
2748 2748
                 if (isset($this->documentListing[$alias])) {
2749 2749
                     $this->documentIdentifier = $this->documentListing[$alias];
2750 2750
                 } else {
@@ -2805,7 +2805,7 @@  discard block
 block discarded – undo
2805 2805
                 } else {
2806 2806
                     $docAlias = $this->db->escape($this->documentIdentifier);
2807 2807
                     $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'");
2808
-                    $this->documentIdentifier = (int)$this->db->getValue($rs);
2808
+                    $this->documentIdentifier = (int) $this->db->getValue($rs);
2809 2809
                 }
2810 2810
             }
2811 2811
             $this->documentMethod = 'id';
@@ -2858,7 +2858,7 @@  discard block
 block discarded – undo
2858 2858
                 $_REQUEST[$n] = $_GET[$n] = $v;
2859 2859
             }
2860 2860
         }
2861
-        $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path'];
2861
+        $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path'];
2862 2862
         $this->q = $qp['path'];
2863 2863
         return $qp['path'];
2864 2864
     }
@@ -2952,7 +2952,7 @@  discard block
 block discarded – undo
2952 2952
             $this->sendErrorPage();
2953 2953
         } else {
2954 2954
             // Inculde the necessary files to check document permissions
2955
-            include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
2955
+            include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
2956 2956
             $udperms = new udperms();
2957 2957
             $udperms->user = $this->getLoginUserID();
2958 2958
             $udperms->document = $this->documentIdentifier;
@@ -3006,7 +3006,7 @@  discard block
 block discarded – undo
3006 3006
         while ($id && $height--) {
3007 3007
             $thisid = $id;
3008 3008
             if ($this->config['aliaslistingfolder'] == 1) {
3009
-                $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");
3009
+                $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");
3010 3010
                 if (!$id || $id == '0') {
3011 3011
                     break;
3012 3012
                 }
@@ -3057,15 +3057,15 @@  discard block
 block discarded – undo
3057 3057
 
3058 3058
         if ($this->config['aliaslistingfolder'] == 1) {
3059 3059
 
3060
-            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'");
3060
+            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'");
3061 3061
             $idx = array();
3062 3062
             while ($row = $this->db->getRow($res)) {
3063 3063
                 $pAlias = '';
3064 3064
                 if (isset($this->aliasListing[$row['parent']])) {
3065
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : '';
3066
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : '';
3065
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : '';
3066
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : '';
3067 3067
                 };
3068
-                $children[$pAlias . $row['alias']] = $row['id'];
3068
+                $children[$pAlias.$row['alias']] = $row['id'];
3069 3069
                 if ($row['isfolder'] == 1) {
3070 3070
                     $idx[] = $row['id'];
3071 3071
                 }
@@ -3097,7 +3097,7 @@  discard block
 block discarded – undo
3097 3097
                 $depth--;
3098 3098
 
3099 3099
                 foreach ($documentMap_cache[$id] as $childId) {
3100
-                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias'];
3100
+                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias'];
3101 3101
                     if (!strlen($pkey)) {
3102 3102
                         $pkey = "{$childId}";
3103 3103
                     }
@@ -3126,7 +3126,7 @@  discard block
 block discarded – undo
3126 3126
         if (substr(strtolower($url), 0, 11) == "javascript:") {
3127 3127
             $fnc = substr($url, 11);
3128 3128
         } elseif ($url) {
3129
-            $fnc = "window.location.href='" . addslashes($url) . "';";
3129
+            $fnc = "window.location.href='".addslashes($url)."';";
3130 3130
         } else {
3131 3131
             $fnc = "history.back(-1);";
3132 3132
         }
@@ -3135,7 +3135,7 @@  discard block
 block discarded – undo
3135 3135
             <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\">
3136 3136
             <script>
3137 3137
                 function __alertQuit() {
3138
-                    alert('" . addslashes($msg) . "');
3138
+                    alert('".addslashes($msg)."');
3139 3139
                     {$fnc}
3140 3140
                 }
3141 3141
                 window.setTimeout('__alertQuit();',100);
@@ -3157,9 +3157,9 @@  discard block
 block discarded – undo
3157 3157
         $state = 0;
3158 3158
         $pms = $_SESSION['mgrPermissions'];
3159 3159
         if ($pms) {
3160
-            $state = ((bool)$pms[$pm] === true);
3160
+            $state = ((bool) $pms[$pm] === true);
3161 3161
         }
3162
-        return (int)$state;
3162
+        return (int) $state;
3163 3163
     }
3164 3164
 
3165 3165
     /**
@@ -3172,8 +3172,8 @@  discard block
 block discarded – undo
3172 3172
      */
3173 3173
     public function elementIsLocked($type, $id, $includeThisUser = false)
3174 3174
     {
3175
-        $id = (int)$id;
3176
-        $type = (int)$type;
3175
+        $id = (int) $id;
3176
+        $type = (int) $type;
3177 3177
         if (!$type || !$id) {
3178 3178
             return null;
3179 3179
         }
@@ -3223,7 +3223,7 @@  discard block
 block discarded – undo
3223 3223
             return $lockedElements;
3224 3224
         }
3225 3225
 
3226
-        $type = (int)$type;
3226
+        $type = (int) $type;
3227 3227
         if (isset($lockedElements[$type])) {
3228 3228
             return $lockedElements[$type];
3229 3229
         } else {
@@ -3240,7 +3240,7 @@  discard block
 block discarded – undo
3240 3240
             $this->lockedElements = array();
3241 3241
             $this->cleanupExpiredLocks();
3242 3242
 
3243
-            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul
3243
+            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul
3244 3244
                 LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id");
3245 3245
             while ($row = $this->db->getRow($rs)) {
3246 3246
                 $this->lockedElements[$row['elementType']][$row['elementId']] = array(
@@ -3263,7 +3263,7 @@  discard block
 block discarded – undo
3263 3263
     public function cleanupExpiredLocks()
3264 3264
     {
3265 3265
         // Clean-up active_user_sessions first
3266
-        $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
3266
+        $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
3267 3267
         $validSessionTimeLimit = $this->time - $timeout;
3268 3268
         $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}");
3269 3269
 
@@ -3276,7 +3276,7 @@  discard block
 block discarded – undo
3276 3276
             foreach ($rs as $row) {
3277 3277
                 $userSids[] = $row['sid'];
3278 3278
             }
3279
-            $userSids = "'" . implode("','", $userSids) . "'";
3279
+            $userSids = "'".implode("','", $userSids)."'";
3280 3280
             $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})");
3281 3281
         } else {
3282 3282
             $this->db->delete($this->getFullTableName('active_user_locks'));
@@ -3360,8 +3360,8 @@  discard block
 block discarded – undo
3360 3360
     public function lockElement($type, $id)
3361 3361
     {
3362 3362
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3363
-        $type = (int)$type;
3364
-        $id = (int)$id;
3363
+        $type = (int) $type;
3364
+        $id = (int) $id;
3365 3365
         if (!$type || !$id || !$userId) {
3366 3366
             return false;
3367 3367
         }
@@ -3382,8 +3382,8 @@  discard block
 block discarded – undo
3382 3382
     public function unlockElement($type, $id, $includeAllUsers = false)
3383 3383
     {
3384 3384
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3385
-        $type = (int)$type;
3386
-        $id = (int)$id;
3385
+        $type = (int) $type;
3386
+        $id = (int) $id;
3387 3387
         if (!$type || !$id) {
3388 3388
             return false;
3389 3389
         }
@@ -3450,8 +3450,8 @@  discard block
 block discarded – undo
3450 3450
         }
3451 3451
 
3452 3452
         $usertype = $this->isFrontend() ? 1 : 0;
3453
-        $evtid = (int)$evtid;
3454
-        $type = (int)$type;
3453
+        $evtid = (int) $evtid;
3454
+        $type = (int) $type;
3455 3455
 
3456 3456
         // Types: 1 = information, 2 = warning, 3 = error
3457 3457
         if ($type < 1) {
@@ -3473,8 +3473,8 @@  discard block
 block discarded – undo
3473 3473
         if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') {
3474 3474
             if ($this->config['send_errormail'] <= $type) {
3475 3475
                 $this->sendmail(array(
3476
-                    'subject' => 'MODX System Error on ' . $this->config['site_name'],
3477
-                    'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.',
3476
+                    'subject' => 'MODX System Error on '.$this->config['site_name'],
3477
+                    'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.',
3478 3478
                     'type' => 'text'
3479 3479
                 ));
3480 3480
             }
@@ -3522,7 +3522,7 @@  discard block
 block discarded – undo
3522 3522
             $p['fromname'] = $userinfo['username'];
3523 3523
         }
3524 3524
         if ($msg === '' && !isset($p['body'])) {
3525
-            $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER'];
3525
+            $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER'];
3526 3526
         } elseif (is_string($msg) && 0 < strlen($msg)) {
3527 3527
             $p['body'] = $msg;
3528 3528
         }
@@ -3562,8 +3562,8 @@  discard block
 block discarded – undo
3562 3562
             $files = array();
3563 3563
         }
3564 3564
         foreach ($files as $f) {
3565
-            if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) {
3566
-                $this->mail->AddAttachment(MODX_BASE_PATH . $f);
3565
+            if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) {
3566
+                $this->mail->AddAttachment(MODX_BASE_PATH.$f);
3567 3567
             }
3568 3568
         }
3569 3569
         $rs = $this->mail->send();
@@ -3608,7 +3608,7 @@  discard block
 block discarded – undo
3608 3608
      */
3609 3609
     public function isFrontend()
3610 3610
     {
3611
-        return ! $this->isBackend();
3611
+        return !$this->isBackend();
3612 3612
     }
3613 3613
 
3614 3614
     /**
@@ -3633,14 +3633,14 @@  discard block
 block discarded – undo
3633 3633
         $tblsc = $this->getFullTableName("site_content");
3634 3634
         $tbldg = $this->getFullTableName("document_groups");
3635 3635
         // modify field names to use sc. table reference
3636
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3637
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3636
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3637
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3638 3638
         // get document groups for current user
3639 3639
         if ($docgrp = $this->getUserDocGroups()) {
3640 3640
             $docgrp = implode(",", $docgrp);
3641 3641
         }
3642 3642
         // build query
3643
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3643
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3644 3644
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3645 3645
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3646 3646
         $resourceArray = $this->db->makeArray($result);
@@ -3670,14 +3670,14 @@  discard block
 block discarded – undo
3670 3670
         $tbldg = $this->getFullTableName("document_groups");
3671 3671
 
3672 3672
         // modify field names to use sc. table reference
3673
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3674
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3673
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3674
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3675 3675
         // get document groups for current user
3676 3676
         if ($docgrp = $this->getUserDocGroups()) {
3677 3677
             $docgrp = implode(",", $docgrp);
3678 3678
         }
3679 3679
         // build query
3680
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3680
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3681 3681
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3682 3682
                 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}");
3683 3683
         $resourceArray = $this->db->makeArray($result);
@@ -3712,16 +3712,16 @@  discard block
 block discarded – undo
3712 3712
             return $this->tmpCache[__FUNCTION__][$cacheKey];
3713 3713
         }
3714 3714
 
3715
-        $published = ($published !== 'all') ? 'AND sc.published = ' . $published : '';
3716
-        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : '';
3715
+        $published = ($published !== 'all') ? 'AND sc.published = '.$published : '';
3716
+        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : '';
3717 3717
 
3718 3718
         if ($where != '') {
3719
-            $where = 'AND ' . $where;
3719
+            $where = 'AND '.$where;
3720 3720
         }
3721 3721
 
3722 3722
         // modify field names to use sc. table reference
3723
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3724
-        $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3723
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3724
+        $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3725 3725
 
3726 3726
         // get document groups for current user
3727 3727
         if ($docgrp = $this->getUserDocGroups()) {
@@ -3729,7 +3729,7 @@  discard block
 block discarded – undo
3729 3729
         }
3730 3730
 
3731 3731
         // build query
3732
-        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3732
+        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3733 3733
 
3734 3734
         $tblsc = $this->getFullTableName('site_content');
3735 3735
         $tbldg = $this->getFullTableName('document_groups');
@@ -3781,10 +3781,10 @@  discard block
 block discarded – undo
3781 3781
             return false;
3782 3782
         } else {
3783 3783
             // modify field names to use sc. table reference
3784
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3785
-            $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3784
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3785
+            $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3786 3786
             if ($where != '') {
3787
-                $where = 'AND ' . $where;
3787
+                $where = 'AND '.$where;
3788 3788
             }
3789 3789
 
3790 3790
             $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : '';
@@ -3795,13 +3795,13 @@  discard block
 block discarded – undo
3795 3795
                 $docgrp = implode(',', $docgrp);
3796 3796
             }
3797 3797
 
3798
-            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3798
+            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3799 3799
 
3800 3800
             $tblsc = $this->getFullTableName('site_content');
3801 3801
             $tbldg = $this->getFullTableName('document_groups');
3802 3802
 
3803 3803
             $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3804
-                    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);
3804
+                    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);
3805 3805
 
3806 3806
             $resourceArray = $this->db->makeArray($result);
3807 3807
 
@@ -3906,12 +3906,12 @@  discard block
 block discarded – undo
3906 3906
             $tbldg = $this->getFullTableName("document_groups");
3907 3907
             $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : "";
3908 3908
             // modify field names to use sc. table reference
3909
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3909
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3910 3910
             // get document groups for current user
3911 3911
             if ($docgrp = $this->getUserDocGroups()) {
3912 3912
                 $docgrp = implode(",", $docgrp);
3913 3913
             }
3914
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3914
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3915 3915
             $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1);
3916 3916
             $pageInfo = $this->db->getRow($result);
3917 3917
 
@@ -3958,7 +3958,7 @@  discard block
 block discarded – undo
3958 3958
     {
3959 3959
         if ($this->currentSnippet) {
3960 3960
             $tbl = $this->getFullTableName("site_snippets");
3961
-            $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1);
3961
+            $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1);
3962 3962
             if ($snippetId = $this->db->getValue($rs)) {
3963 3963
                 return $snippetId;
3964 3964
             }
@@ -3985,23 +3985,23 @@  discard block
 block discarded – undo
3985 3985
      */
3986 3986
     public function clearCache($type = '', $report = false)
3987 3987
     {
3988
-        $cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
3988
+        $cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
3989 3989
         if (is_array($type)) {
3990 3990
             foreach ($type as $_) {
3991 3991
                 $this->clearCache($_, $report);
3992 3992
             }
3993 3993
         } elseif ($type == 'full') {
3994
-            include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
3994
+            include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
3995 3995
             $sync = new synccache();
3996 3996
             $sync->setCachepath($cache_dir);
3997 3997
             $sync->setReport($report);
3998 3998
             $sync->emptyCache();
3999 3999
         } elseif (preg_match('@^[1-9][0-9]*$@', $type)) {
4000 4000
             $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type;
4001
-            $file_name = "docid_" . $key . "_*.pageCache.php";
4002
-            $cache_path = $cache_dir . $file_name;
4001
+            $file_name = "docid_".$key."_*.pageCache.php";
4002
+            $cache_path = $cache_dir.$file_name;
4003 4003
             $files = glob($cache_path);
4004
-            $files[] = $cache_dir . "docid_" . $key . ".pageCache.php";
4004
+            $files[] = $cache_dir."docid_".$key.".pageCache.php";
4005 4005
             foreach ($files as $file) {
4006 4006
                 if (!is_file($file)) {
4007 4007
                     continue;
@@ -4009,7 +4009,7 @@  discard block
 block discarded – undo
4009 4009
                 unlink($file);
4010 4010
             }
4011 4011
         } else {
4012
-            $files = glob($cache_dir . '*');
4012
+            $files = glob($cache_dir.'*');
4013 4013
             foreach ($files as $file) {
4014 4014
                 $name = basename($file);
4015 4015
                 if (strpos($name, '.pageCache.php') === false) {
@@ -4078,7 +4078,7 @@  discard block
 block discarded – undo
4078 4078
                         $f_url_suffix = '/';
4079 4079
                     }
4080 4080
 
4081
-                    $alPath = !empty ($al['path']) ? $al['path'] . '/' : '';
4081
+                    $alPath = !empty ($al['path']) ? $al['path'].'/' : '';
4082 4082
 
4083 4083
                     if ($al && $al['alias']) {
4084 4084
                         $alias = $al['alias'];
@@ -4086,7 +4086,7 @@  discard block
 block discarded – undo
4086 4086
 
4087 4087
                 }
4088 4088
 
4089
-                $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix;
4089
+                $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix;
4090 4090
                 $url = "{$alias}{$args}";
4091 4091
             } else {
4092 4092
                 $url = "index.php?id={$id}{$args}";
@@ -4105,7 +4105,7 @@  discard block
 block discarded – undo
4105 4105
             }
4106 4106
 
4107 4107
             //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080)
4108
-            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host;
4108
+            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host;
4109 4109
         }
4110 4110
 
4111 4111
         //fix strictUrl by Bumkaka
@@ -4114,9 +4114,9 @@  discard block
 block discarded – undo
4114 4114
         }
4115 4115
 
4116 4116
         if ($this->config['xhtml_urls']) {
4117
-            $url = preg_replace("/&(?!amp;)/", "&amp;", $host . $virtualDir . $url);
4117
+            $url = preg_replace("/&(?!amp;)/", "&amp;", $host.$virtualDir.$url);
4118 4118
         } else {
4119
-            $url = $host . $virtualDir . $url;
4119
+            $url = $host.$virtualDir.$url;
4120 4120
         }
4121 4121
 
4122 4122
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -4140,21 +4140,21 @@  discard block
 block discarded – undo
4140 4140
         if (isset($this->aliasListing[$id])) {
4141 4141
             $out = $this->aliasListing[$id];
4142 4142
         } else {
4143
-            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id);
4143
+            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id);
4144 4144
             if ($this->db->getRecordCount($q) == '1') {
4145 4145
                 $q = $this->db->getRow($q);
4146 4146
                 $this->aliasListing[$id] = array(
4147
-                    'id' => (int)$q['id'],
4147
+                    'id' => (int) $q['id'],
4148 4148
                     'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'],
4149
-                    'parent' => (int)$q['parent'],
4150
-                    'isfolder' => (int)$q['isfolder'],
4149
+                    'parent' => (int) $q['parent'],
4150
+                    'isfolder' => (int) $q['isfolder'],
4151 4151
                 );
4152 4152
                 if ($this->aliasListing[$id]['parent'] > 0) {
4153 4153
                     //fix alias_path_usage
4154 4154
                     if ($this->config['use_alias_path'] == '1') {
4155 4155
                         //&& $tmp['path'] != '' - fix error slash with epty path
4156 4156
                         $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']);
4157
-                        $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : '');
4157
+                        $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : '');
4158 4158
                     } else {
4159 4159
                         $this->aliasListing[$id]['path'] = '';
4160 4160
                     }
@@ -4195,7 +4195,7 @@  discard block
 block discarded – undo
4195 4195
         $out = array();
4196 4196
         if (empty($this->version) || !is_array($this->version)) {
4197 4197
             //include for compatibility modx version < 1.0.10
4198
-            include MODX_MANAGER_PATH . "includes/version.inc.php";
4198
+            include MODX_MANAGER_PATH."includes/version.inc.php";
4199 4199
             $this->version = array();
4200 4200
             $this->version['version'] = isset($modx_version) ? $modx_version : '';
4201 4201
             $this->version['branch'] = isset($modx_branch) ? $modx_branch : '';
@@ -4217,18 +4217,18 @@  discard block
 block discarded – undo
4217 4217
     {
4218 4218
         if (isset ($this->snippetCache[$snippetName])) {
4219 4219
             $snippet = $this->snippetCache[$snippetName];
4220
-            $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4220
+            $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : '';
4221 4221
         } else { // not in cache so let's check the db
4222
-            $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;";
4222
+            $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;";
4223 4223
             $result = $this->db->query($sql);
4224 4224
             if ($this->db->getRecordCount($result) == 1) {
4225 4225
                 $row = $this->db->getRow($result);
4226 4226
                 $snippet = $this->snippetCache[$snippetName] = $row['snippet'];
4227 4227
                 $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties']));
4228
-                $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties);
4228
+                $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties);
4229 4229
             } else {
4230 4230
                 $snippet = $this->snippetCache[$snippetName] = "return false;";
4231
-                $properties = $this->snippetCache[$snippetName . "Props"] = '';
4231
+                $properties = $this->snippetCache[$snippetName."Props"] = '';
4232 4232
             }
4233 4233
         }
4234 4234
         // load default params/properties
@@ -4328,8 +4328,8 @@  discard block
 block discarded – undo
4328 4328
             }
4329 4329
             if (strpos($tpl, $s) !== false) {
4330 4330
                 $tpl = str_replace($s, $value, $tpl);
4331
-            } elseif($this->debug) {
4332
-                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2);
4331
+            } elseif ($this->debug) {
4332
+                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2);
4333 4333
             }
4334 4334
         }
4335 4335
 
@@ -4378,7 +4378,7 @@  discard block
 block discarded – undo
4378 4378
             case 'CODE':
4379 4379
                 break;
4380 4380
             case 'FILE':
4381
-                $template = file_get_contents(MODX_BASE_PATH . $template);
4381
+                $template = file_get_contents(MODX_BASE_PATH.$template);
4382 4382
                 break;
4383 4383
             case 'CHUNK':
4384 4384
                 $template = $this->getChunk($template);
@@ -4411,7 +4411,7 @@  discard block
 block discarded – undo
4411 4411
         if ($mode !== 'formatOnly' && empty($timestamp)) {
4412 4412
             return '-';
4413 4413
         }
4414
-        $timestamp = (int)$timestamp;
4414
+        $timestamp = (int) $timestamp;
4415 4415
 
4416 4416
         switch ($this->config['datetime_format']) {
4417 4417
             case 'YYYY/mm/dd':
@@ -4431,7 +4431,7 @@  discard block
 block discarded – undo
4431 4431
         }
4432 4432
 
4433 4433
         if (empty($mode)) {
4434
-            $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp);
4434
+            $strTime = strftime($dateFormat." %H:%M:%S", $timestamp);
4435 4435
         } elseif ($mode == 'dateOnly') {
4436 4436
             $strTime = strftime($dateFormat, $timestamp);
4437 4437
         } elseif ($mode == 'formatOnly') {
@@ -4485,7 +4485,7 @@  discard block
 block discarded – undo
4485 4485
             $S = 0;
4486 4486
         }
4487 4487
         $timeStamp = mktime($H, $M, $S, $m, $d, $Y);
4488
-        $timeStamp = (int)$timeStamp;
4488
+        $timeStamp = (int) $timeStamp;
4489 4489
         return $timeStamp;
4490 4490
     }
4491 4491
 
@@ -4527,7 +4527,7 @@  discard block
 block discarded – undo
4527 4527
                     if ($v === 'value') {
4528 4528
                         unset($_[$i]);
4529 4529
                     } else {
4530
-                        $_[$i] = 'tv.' . $v;
4530
+                        $_[$i] = 'tv.'.$v;
4531 4531
                     }
4532 4532
                 }
4533 4533
                 $fields = implode(',', $_);
@@ -4536,12 +4536,12 @@  discard block
 block discarded – undo
4536 4536
             }
4537 4537
 
4538 4538
             if ($tvsort != '') {
4539
-                $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4539
+                $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4540 4540
             }
4541 4541
             if ($tvidnames == "*") {
4542 4542
                 $query = "tv.id<>0";
4543 4543
             } else {
4544
-                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')";
4544
+                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')";
4545 4545
             }
4546 4546
 
4547 4547
             $this->getUserDocGroups();
@@ -4685,7 +4685,7 @@  discard block
 block discarded – undo
4685 4685
             return $this->tmpCache[__FUNCTION__][$cacheKey];
4686 4686
         }
4687 4687
 
4688
-        if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) {
4688
+        if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) {
4689 4689
             return false;
4690 4690
         } else {
4691 4691
 
@@ -4703,23 +4703,23 @@  discard block
 block discarded – undo
4703 4703
             }
4704 4704
 
4705 4705
             // get user defined template variables
4706
-            $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4707
-            $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4706
+            $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4707
+            $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4708 4708
 
4709 4709
             if ($idnames == '*') {
4710 4710
                 $query = 'tv.id<>0';
4711 4711
             } else {
4712
-                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')";
4712
+                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')";
4713 4713
             }
4714 4714
 
4715
-            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv
4716
-                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id
4717
-                    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}" : ""));
4715
+            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv
4716
+                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id
4717
+                    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}" : ""));
4718 4718
 
4719 4719
             $result = $this->db->makeArray($rs);
4720 4720
 
4721 4721
             // get default/built-in template variables
4722
-            if(is_array($docRow)){
4722
+            if (is_array($docRow)) {
4723 4723
                 ksort($docRow);
4724 4724
 
4725 4725
                 foreach ($docRow as $key => $value) {
@@ -4757,22 +4757,22 @@  discard block
 block discarded – undo
4757 4757
      */
4758 4758
     public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '')
4759 4759
     {
4760
-        if (is_array($idnames) && empty($idnames) ) {
4760
+        if (is_array($idnames) && empty($idnames)) {
4761 4761
             return false;
4762 4762
         } else {
4763 4763
             $output = array();
4764 4764
             $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames);
4765 4765
 
4766
-            $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier;
4766
+            $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier;
4767 4767
             // remove sort for speed
4768 4768
             $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');
4769 4769
 
4770 4770
             if ($result == false) {
4771 4771
                 return false;
4772 4772
             } else {
4773
-                $baspath = MODX_MANAGER_PATH . 'includes';
4774
-                include_once $baspath . '/tmplvars.format.inc.php';
4775
-                include_once $baspath . '/tmplvars.commands.inc.php';
4773
+                $baspath = MODX_MANAGER_PATH.'includes';
4774
+                include_once $baspath.'/tmplvars.format.inc.php';
4775
+                include_once $baspath.'/tmplvars.commands.inc.php';
4776 4776
 
4777 4777
                 for ($i = 0; $i < count($result); $i++) {
4778 4778
                     $row = $result[$i];
@@ -4797,7 +4797,7 @@  discard block
 block discarded – undo
4797 4797
      */
4798 4798
     public function getFullTableName($tbl)
4799 4799
     {
4800
-        return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`";
4800
+        return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`";
4801 4801
     }
4802 4802
 
4803 4803
     /**
@@ -4876,7 +4876,7 @@  discard block
 block discarded – undo
4876 4876
     public function getCachePath()
4877 4877
     {
4878 4878
         global $base_url;
4879
-        $pth = $base_url . $this->getCacheFolder();
4879
+        $pth = $base_url.$this->getCacheFolder();
4880 4880
         return $pth;
4881 4881
     }
4882 4882
 
@@ -4928,8 +4928,8 @@  discard block
 block discarded – undo
4928 4928
         $out = false;
4929 4929
 
4930 4930
         if (!empty($context)) {
4931
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4932
-                $out = $_SESSION[$context . 'InternalKey'];
4931
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4932
+                $out = $_SESSION[$context.'InternalKey'];
4933 4933
             }
4934 4934
         } else {
4935 4935
             switch (true) {
@@ -4957,8 +4957,8 @@  discard block
 block discarded – undo
4957 4957
         $out = false;
4958 4958
 
4959 4959
         if (!empty($context)) {
4960
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4961
-                $out = $_SESSION[$context . 'Shortname'];
4960
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4961
+                $out = $_SESSION[$context.'Shortname'];
4962 4962
             }
4963 4963
         } else {
4964 4964
             switch (true) {
@@ -5029,8 +5029,8 @@  discard block
 block discarded – undo
5029 5029
      */
5030 5030
     public function getWebUserInfo($uid)
5031 5031
     {
5032
-        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu
5033
-                INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5032
+        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu
5033
+                INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5034 5034
         if ($row = $this->db->getRow($rs)) {
5035 5035
             if (!isset($row['usertype']) or !$row["usertype"]) {
5036 5036
                 $row["usertype"] = "web";
@@ -5066,7 +5066,7 @@  discard block
 block discarded – undo
5066 5066
         } else if (is_array($dg)) {
5067 5067
             // resolve ids to names
5068 5068
             $dgn = array();
5069
-            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")");
5069
+            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")");
5070 5070
             while ($row = $this->db->getRow($ds)) {
5071 5071
                 $dgn[] = $row['name'];
5072 5072
             }
@@ -5094,7 +5094,7 @@  discard block
 block discarded – undo
5094 5094
         $rt = false;
5095 5095
         if ($_SESSION["webValidated"] == 1) {
5096 5096
             $tbl = $this->getFullTableName("web_users");
5097
-            $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'");
5097
+            $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'");
5098 5098
             if ($row = $this->db->getRow($ds)) {
5099 5099
                 if ($row["password"] == md5($oldPwd)) {
5100 5100
                     if (strlen($newPwd) < 6) {
@@ -5104,7 +5104,7 @@  discard block
 block discarded – undo
5104 5104
                     } else {
5105 5105
                         $this->db->update(array(
5106 5106
                             'password' => $this->db->escape($newPwd),
5107
-                        ), $tbl, "id='" . $this->getLoginUserID() . "'");
5107
+                        ), $tbl, "id='".$this->getLoginUserID()."'");
5108 5108
                         // invoke OnWebChangePassword event
5109 5109
                         $this->invokeEvent("OnWebChangePassword", array(
5110 5110
                             "userid" => $row["id"],
@@ -5135,8 +5135,8 @@  discard block
 block discarded – undo
5135 5135
         // check cache
5136 5136
         $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false;
5137 5137
         if (!is_array($grpNames)) {
5138
-            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn
5139
-                    INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'");
5138
+            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn
5139
+                    INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'");
5140 5140
             $grpNames = $this->db->getColumn("name", $rs);
5141 5141
             // save to cache
5142 5142
             $_SESSION['webUserGroupNames'] = $grpNames;
@@ -5169,7 +5169,7 @@  discard block
 block discarded – undo
5169 5169
         if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) {
5170 5170
             $this->sjscripts[$nextpos] = $src;
5171 5171
         } else {
5172
-            $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>';
5172
+            $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>';
5173 5173
         }
5174 5174
     }
5175 5175
 
@@ -5248,7 +5248,7 @@  discard block
 block discarded – undo
5248 5248
         }
5249 5249
 
5250 5250
         if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) {
5251
-            $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>';
5251
+            $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>';
5252 5252
         }
5253 5253
         if ($startup) {
5254 5254
             $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1;
@@ -5395,7 +5395,7 @@  discard block
 block discarded – undo
5395 5395
                 $eventtime = $this->getMicroTime() - $eventtime;
5396 5396
                 $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000);
5397 5397
                 foreach ($parameter as $k => $v) {
5398
-                    $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>';
5398
+                    $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>';
5399 5399
                 }
5400 5400
                 $this->pluginsCode .= '</fieldset><br />';
5401 5401
                 $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime;
@@ -5423,13 +5423,13 @@  discard block
 block discarded – undo
5423 5423
         $plugin = array();
5424 5424
         if (isset ($this->pluginCache[$pluginName])) {
5425 5425
             $pluginCode = $this->pluginCache[$pluginName];
5426
-            $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : '';
5426
+            $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : '';
5427 5427
         } else {
5428 5428
             $pluginName = $this->db->escape($pluginName);
5429 5429
             $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0");
5430 5430
             if ($row = $this->db->getRow($result)) {
5431 5431
                 $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode'];
5432
-                $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties'];
5432
+                $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties'];
5433 5433
             } else {
5434 5434
                 $pluginCode = $this->pluginCache[$pluginName] = "return false;";
5435 5435
                 $pluginProperties = '';
@@ -5536,7 +5536,7 @@  discard block
 block discarded – undo
5536 5536
     public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)
5537 5537
     {
5538 5538
         $params = array();
5539
-        $fullpath = $element_dir . '/' . $filename;
5539
+        $fullpath = $element_dir.'/'.$filename;
5540 5540
         if (is_readable($fullpath)) {
5541 5541
             $tpl = @fopen($fullpath, "r");
5542 5542
             if ($tpl) {
@@ -5703,8 +5703,8 @@  discard block
 block discarded – undo
5703 5703
         $ph = array('site_url' => MODX_SITE_URL);
5704 5704
         $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";
5705 5705
         $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';
5706
-        $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';
5707
-        $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';
5706
+        $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';
5707
+        $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';
5708 5708
         foreach ($parsed as $key => $val) {
5709 5709
             if (is_array($val)) {
5710 5710
                 foreach ($val as $key2 => $val2) {
@@ -5713,7 +5713,7 @@  discard block
 block discarded – undo
5713 5713
                         $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2);
5714 5714
                     }
5715 5715
                     if (preg_match($regexEmail, $val2, $url)) {
5716
-                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);
5716
+                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);
5717 5717
                     }
5718 5718
                     $parsed[$key][$key2] = $val2;
5719 5719
                 }
@@ -5723,7 +5723,7 @@  discard block
 block discarded – undo
5723 5723
                     $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val);
5724 5724
                 }
5725 5725
                 if (preg_match($regexEmail, $val, $url)) {
5726
-                    $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);
5726
+                    $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);
5727 5727
                 }
5728 5728
                 $parsed[$key] = $val;
5729 5729
             }
@@ -5737,32 +5737,32 @@  discard block
 block discarded – undo
5737 5737
         );
5738 5738
 
5739 5739
         $nl = "\n";
5740
-        $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';
5741
-        $list .= '<p>' . $nl;
5742
-        $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';
5743
-        $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';
5744
-        $list .= '</p><br/>' . $nl;
5745
-        $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';
5746
-        $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';
5747
-        $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';
5748
-        $list .= '<br/>' . $nl;
5740
+        $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';
5741
+        $list .= '<p>'.$nl;
5742
+        $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';
5743
+        $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';
5744
+        $list .= '</p><br/>'.$nl;
5745
+        $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';
5746
+        $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';
5747
+        $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';
5748
+        $list .= '<br/>'.$nl;
5749 5749
         $first = true;
5750 5750
         foreach ($arrayParams as $param => $label) {
5751 5751
             if (isset($parsed[$param])) {
5752 5752
                 if ($first) {
5753
-                    $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;
5754
-                    $list .= '<ul class="docBlockList">' . $nl;
5753
+                    $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;
5754
+                    $list .= '<ul class="docBlockList">'.$nl;
5755 5755
                     $first = false;
5756 5756
                 }
5757
-                $list .= '    <li><strong>' . $label . '</strong>' . $nl;
5758
-                $list .= '        <ul>' . $nl;
5757
+                $list .= '    <li><strong>'.$label.'</strong>'.$nl;
5758
+                $list .= '        <ul>'.$nl;
5759 5759
                 foreach ($parsed[$param] as $val) {
5760
-                    $list .= '            <li>' . $val . '</li>' . $nl;
5760
+                    $list .= '            <li>'.$val.'</li>'.$nl;
5761 5761
                 }
5762
-                $list .= '        </ul></li>' . $nl;
5762
+                $list .= '        </ul></li>'.$nl;
5763 5763
             }
5764 5764
         }
5765
-        $list .= !$first ? '</ul>' . $nl : '';
5765
+        $list .= !$first ? '</ul>'.$nl : '';
5766 5766
 
5767 5767
         return $list;
5768 5768
     }
@@ -5838,7 +5838,7 @@  discard block
 block discarded – undo
5838 5838
      */
5839 5839
     public function addSnippet($name, $phpCode)
5840 5840
     {
5841
-        $this->snippetCache['#' . $name] = $phpCode;
5841
+        $this->snippetCache['#'.$name] = $phpCode;
5842 5842
     }
5843 5843
 
5844 5844
     /**
@@ -5847,7 +5847,7 @@  discard block
 block discarded – undo
5847 5847
      */
5848 5848
     public function addChunk($name, $text)
5849 5849
     {
5850
-        $this->chunkCache['#' . $name] = $text;
5850
+        $this->chunkCache['#'.$name] = $text;
5851 5851
     }
5852 5852
 
5853 5853
     /**
@@ -5883,7 +5883,7 @@  discard block
 block discarded – undo
5883 5883
         }
5884 5884
 
5885 5885
         if (!$isSafe) {
5886
-            $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);
5886
+            $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);
5887 5887
             $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50)));
5888 5888
             $this->messageQuit($title, '', true, '', '', 'Parser', $msg);
5889 5889
             return;
@@ -5897,7 +5897,7 @@  discard block
 block discarded – undo
5897 5897
             return 'array()';
5898 5898
         }
5899 5899
 
5900
-        $output = $echo . $return;
5900
+        $output = $echo.$return;
5901 5901
         modx_sanitize_gpc($output);
5902 5902
         return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous
5903 5903
     }
@@ -5915,8 +5915,8 @@  discard block
 block discarded – undo
5915 5915
 
5916 5916
         $safe = explode(',', $safe_functions);
5917 5917
 
5918
-        $phpcode = rtrim($phpcode, ';') . ';';
5919
-        $tokens = token_get_all('<?php ' . $phpcode);
5918
+        $phpcode = rtrim($phpcode, ';').';';
5919
+        $tokens = token_get_all('<?php '.$phpcode);
5920 5920
         foreach ($tokens as $i => $token) {
5921 5921
             if (!is_array($token)) {
5922 5922
                 continue;
@@ -5952,7 +5952,7 @@  discard block
 block discarded – undo
5952 5952
     public function atBindFileContent($str = '')
5953 5953
     {
5954 5954
 
5955
-        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', '');
5955
+        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', '');
5956 5956
 
5957 5957
         if (stripos($str, '@FILE') !== 0) {
5958 5958
             return $str;
@@ -5975,7 +5975,7 @@  discard block
 block discarded – undo
5975 5975
         $errorMsg = sprintf("Could not retrieve string '%s'.", $str);
5976 5976
 
5977 5977
         foreach ($search_path as $path) {
5978
-            $file_path = MODX_BASE_PATH . $path . $str;
5978
+            $file_path = MODX_BASE_PATH.$path.$str;
5979 5979
             if (strpos($file_path, MODX_MANAGER_PATH) === 0) {
5980 5980
                 return $errorMsg;
5981 5981
             } elseif (is_file($file_path)) {
@@ -5989,7 +5989,7 @@  discard block
 block discarded – undo
5989 5989
             return $errorMsg;
5990 5990
         }
5991 5991
 
5992
-        $content = (string)file_get_contents($file_path);
5992
+        $content = (string) file_get_contents($file_path);
5993 5993
         if ($content === false) {
5994 5994
             return $errorMsg;
5995 5995
         }
@@ -6102,22 +6102,22 @@  discard block
 block discarded – undo
6102 6102
 
6103 6103
         $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
6104 6104
         $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
6105
-        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI'];
6105
+        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI'];
6106 6106
         $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);
6107 6107
         $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);
6108 6108
         $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);
6109 6109
         if ($is_error) {
6110 6110
             $str = '<h2 style="color:red">&laquo; Evo Parse Error &raquo;</h2>';
6111 6111
             if ($msg != 'PHP Parse Error') {
6112
-                $str .= '<h3 style="color:red">' . $msg . '</h3>';
6112
+                $str .= '<h3 style="color:red">'.$msg.'</h3>';
6113 6113
             }
6114 6114
         } else {
6115 6115
             $str = '<h2 style="color:#003399">&laquo; Evo Debug/ stop message &raquo;</h2>';
6116
-            $str .= '<h3 style="color:#003399">' . $msg . '</h3>';
6116
+            $str .= '<h3 style="color:#003399">'.$msg.'</h3>';
6117 6117
         }
6118 6118
 
6119 6119
         if (!empty ($query)) {
6120
-            $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>';
6120
+            $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>';
6121 6121
         }
6122 6122
 
6123 6123
         $errortype = array(
@@ -6140,13 +6140,13 @@  discard block
 block discarded – undo
6140 6140
 
6141 6141
         if (!empty($nr) || !empty($file)) {
6142 6142
             if ($text != '') {
6143
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';
6143
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';
6144 6144
             }
6145 6145
             if ($output != '') {
6146
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';
6146
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';
6147 6147
             }
6148 6148
             if ($nr !== '') {
6149
-                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]");
6149
+                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]");
6150 6150
             }
6151 6151
             if ($file) {
6152 6152
                 $table[] = array('File', $file);
@@ -6166,7 +6166,7 @@  discard block
 block discarded – undo
6166 6166
         }
6167 6167
 
6168 6168
         if (!empty($this->event->activePlugin)) {
6169
-            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')');
6169
+            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')');
6170 6170
         }
6171 6171
 
6172 6172
         $str .= $MakeTable->create($table, array('Error information', ''));
@@ -6176,17 +6176,17 @@  discard block
 block discarded – undo
6176 6176
         $table[] = array('REQUEST_URI', $request_uri);
6177 6177
 
6178 6178
         if ($this->manager->action) {
6179
-            include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
6179
+            include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
6180 6180
             global $action_list;
6181 6181
             $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : '';
6182 6182
 
6183
-            $table[] = array('Manager action', $this->manager->action . $actionName);
6183
+            $table[] = array('Manager action', $this->manager->action.$actionName);
6184 6184
         }
6185 6185
 
6186 6186
         if (preg_match('@^[0-9]+@', $this->documentIdentifier)) {
6187 6187
             $resource = $this->getDocumentObject('id', $this->documentIdentifier);
6188 6188
             $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');
6189
-            $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>');
6189
+            $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>');
6190 6190
         }
6191 6191
         $table[] = array('Referer', $referer);
6192 6192
         $table[] = array('User Agent', $ua);
@@ -6207,7 +6207,7 @@  discard block
 block discarded – undo
6207 6207
 
6208 6208
         $mem = memory_get_peak_usage(true);
6209 6209
         $total_mem = $mem - $this->mstart;
6210
-        $total_mem = ($total_mem / 1024 / 1024) . ' mb';
6210
+        $total_mem = ($total_mem / 1024 / 1024).' mb';
6211 6211
 
6212 6212
         $queryTime = $this->queryTime;
6213 6213
         $phpTime = $totalTime - $queryTime;
@@ -6228,18 +6228,18 @@  discard block
 block discarded – undo
6228 6228
         $str .= $this->get_backtrace(debug_backtrace());
6229 6229
         // Log error
6230 6230
         if (!empty($this->currentSnippet)) {
6231
-            $source = 'Snippet - ' . $this->currentSnippet;
6231
+            $source = 'Snippet - '.$this->currentSnippet;
6232 6232
         } elseif (!empty($this->event->activePlugin)) {
6233
-            $source = 'Plugin - ' . $this->event->activePlugin;
6233
+            $source = 'Plugin - '.$this->event->activePlugin;
6234 6234
         } elseif ($source !== '') {
6235
-            $source = 'Parser - ' . $source;
6235
+            $source = 'Parser - '.$source;
6236 6236
         } elseif ($query !== '') {
6237 6237
             $source = 'SQL Query';
6238 6238
         } else {
6239 6239
             $source = 'Parser';
6240 6240
         }
6241 6241
         if ($msg) {
6242
-            $source .= ' / ' . $msg;
6242
+            $source .= ' / '.$msg;
6243 6243
         }
6244 6244
         if (isset($actionName) && !empty($actionName)) {
6245 6245
             $source .= $actionName;
@@ -6271,12 +6271,12 @@  discard block
 block discarded – undo
6271 6271
 
6272 6272
         // Display error
6273 6273
         if (isset($_SESSION['mgrValidated'])) {
6274
-            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>
6274
+            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>
6275 6275
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6276
-                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />
6276
+                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />
6277 6277
                  <style type="text/css">body { padding:10px; } td {font:inherit;}</style>
6278 6278
                  </head><body>
6279
-                 ' . $str . '</body></html>';
6279
+                 ' . $str.'</body></html>';
6280 6280
 
6281 6281
         } else {
6282 6282
             echo 'Error';
@@ -6314,7 +6314,7 @@  discard block
 block discarded – undo
6314 6314
             switch ($val['type']) {
6315 6315
                 case '->':
6316 6316
                 case '::':
6317
-                    $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];
6317
+                    $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];
6318 6318
                     break;
6319 6319
                 default:
6320 6320
                     $functionName = $val['function'];
@@ -6324,7 +6324,7 @@  discard block
 block discarded – undo
6324 6324
             $args = array_pad(array(), $_, '$var');
6325 6325
             $args = implode(", ", $args);
6326 6326
             $modx = &$this;
6327
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6327
+            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) {
6328 6328
                 $arg = $val['args'][$tmp - 1];
6329 6329
                 switch (true) {
6330 6330
                     case is_null($arg): {
@@ -6336,7 +6336,7 @@  discard block
 block discarded – undo
6336 6336
                         break;
6337 6337
                     }
6338 6338
                     case is_scalar($arg): {
6339
-                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'");
6339
+                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'");
6340 6340
                         break;
6341 6341
                     }
6342 6342
                     case is_bool($arg): {
@@ -6344,23 +6344,23 @@  discard block
 block discarded – undo
6344 6344
                         break;
6345 6345
                     }
6346 6346
                     case is_array($arg): {
6347
-                        $out = 'array $var' . $tmp;
6347
+                        $out = 'array $var'.$tmp;
6348 6348
                         break;
6349 6349
                     }
6350 6350
                     case is_object($arg): {
6351
-                        $out = get_class($arg) . ' $var' . $tmp;
6351
+                        $out = get_class($arg).' $var'.$tmp;
6352 6352
                         break;
6353 6353
                     }
6354 6354
                     default: {
6355
-                        $out = '$var' . $tmp;
6355
+                        $out = '$var'.$tmp;
6356 6356
                     }
6357 6357
                 }
6358 6358
                 $tmp++;
6359 6359
                 return $out;
6360 6360
             }, $args);
6361 6361
             $line = array(
6362
-                "<strong>" . $functionName . "</strong>(" . $args . ")",
6363
-                $path . " on line " . $val['line']
6362
+                "<strong>".$functionName."</strong>(".$args.")",
6363
+                $path." on line ".$val['line']
6364 6364
             );
6365 6365
             $table[] = array(implode("<br />", $line));
6366 6366
         }
@@ -6401,7 +6401,7 @@  discard block
 block discarded – undo
6401 6401
             $alias = strip_tags($alias); // strip HTML
6402 6402
             $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters
6403 6403
             $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash
6404
-            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one
6404
+            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one
6405 6405
             $alias = trim($alias, '-'); // trim excess
6406 6406
             return $alias;
6407 6407
         }
@@ -6417,7 +6417,7 @@  discard block
 block discarded – undo
6417 6417
         $precisions = count($sizes) - 1;
6418 6418
         foreach ($sizes as $unit => $bytes) {
6419 6419
             if ($size >= $bytes) {
6420
-                return number_format($size / $bytes, $precisions) . ' ' . $unit;
6420
+                return number_format($size / $bytes, $precisions).' '.$unit;
6421 6421
             }
6422 6422
             $precisions--;
6423 6423
         }
@@ -6521,10 +6521,10 @@  discard block
 block discarded – undo
6521 6521
 
6522 6522
         if (strpos($str, MODX_MANAGER_PATH) === 0) {
6523 6523
             return false;
6524
-        } elseif (is_file(MODX_BASE_PATH . $str)) {
6525
-            $file_path = MODX_BASE_PATH . $str;
6526
-        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) {
6527
-            $file_path = MODX_BASE_PATH . $tpl_dir . $str;
6524
+        } elseif (is_file(MODX_BASE_PATH.$str)) {
6525
+            $file_path = MODX_BASE_PATH.$str;
6526
+        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) {
6527
+            $file_path = MODX_BASE_PATH.$tpl_dir.$str;
6528 6528
         } else {
6529 6529
             return false;
6530 6530
         }
@@ -6650,7 +6650,7 @@  discard block
 block discarded – undo
6650 6650
             $title = 'no title';
6651 6651
         }
6652 6652
         if (is_array($msg)) {
6653
-            $msg = '<pre>' . print_r($msg, true) . '</pre>';
6653
+            $msg = '<pre>'.print_r($msg, true).'</pre>';
6654 6654
         } elseif ($msg === '') {
6655 6655
             $msg = $_SERVER['REQUEST_URI'];
6656 6656
         }
@@ -6695,7 +6695,7 @@  discard block
 block discarded – undo
6695 6695
         if (is_array($SystemAlertMsgQueque)) {
6696 6696
             $title = '';
6697 6697
             if ($this->name && $this->activePlugin) {
6698
-                $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>";
6698
+                $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>";
6699 6699
             }
6700 6700
             $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>";
6701 6701
         }
Please login to merge, or discard this patch.