Completed
Push — develop ( d568f8...c061fc )
by Agel_Nash
06:25
created
manager/includes/document.parser.class.inc.php 2 patches
Spacing   +251 added lines, -251 removed lines patch added patch discarded remove patch
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
      */
226 226
     public function __call($method_name, $arguments)
227 227
     {
228
-        include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php');
228
+        include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php');
229 229
         if (method_exists($this->old, $method_name)) {
230 230
             $error_type = 1;
231 231
         } else {
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
             $info = debug_backtrace();
244 244
             $m[] = $msg;
245 245
             if (!empty($this->currentSnippet)) {
246
-                $m[] = 'Snippet - ' . $this->currentSnippet;
246
+                $m[] = 'Snippet - '.$this->currentSnippet;
247 247
             } elseif (!empty($this->event->activePlugin)) {
248
-                $m[] = 'Plugin - ' . $this->event->activePlugin;
248
+                $m[] = 'Plugin - '.$this->event->activePlugin;
249 249
             }
250 250
             $m[] = $this->decoded_request_uri;
251
-            $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')';
251
+            $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')';
252 252
             $msg = implode('<br />', $m);
253 253
             $this->logEvent(0, $error_type, $msg, $title);
254 254
         }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     {
266 266
         $flag = false;
267 267
         if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) {
268
-            $flag = (bool)$this->{$connector}->conn;
268
+            $flag = (bool) $this->{$connector}->conn;
269 269
         }
270 270
         return $flag;
271 271
     }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         }
293 293
         if (!$out && $flag) {
294 294
             $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname)));
295
-            $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php";
295
+            $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php";
296 296
             $out = is_file($filename) ? include $filename : false;
297 297
         }
298 298
         if ($out && !in_array($extname, $this->extensions)) {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     public function getMicroTime()
310 310
     {
311 311
         list($usec, $sec) = explode(' ', microtime());
312
-        return ((float)$usec + (float)$sec);
312
+        return ((float) $usec + (float) $sec);
313 313
     }
314 314
 
315 315
     /**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
             // append the redirect count string to the url
334 334
             $currentNumberOfRedirects = isset($_REQUEST['err']) ? $_REQUEST['err'] : 0;
335 335
             if ($currentNumberOfRedirects > 3) {
336
-                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>');
336
+                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>');
337 337
             } else {
338 338
                 $currentNumberOfRedirects += 1;
339 339
                 if (strpos($url, "?") > 0) {
@@ -344,9 +344,9 @@  discard block
 block discarded – undo
344 344
             }
345 345
         }
346 346
         if ($type == 'REDIRECT_REFRESH') {
347
-            $header = 'Refresh: 0;URL=' . $url;
347
+            $header = 'Refresh: 0;URL='.$url;
348 348
         } elseif ($type == 'REDIRECT_META') {
349
-            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />';
349
+            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />';
350 350
             echo $header;
351 351
             exit;
352 352
         } elseif ($type == 'REDIRECT_HEADER' || empty($type)) {
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
             global $base_url, $site_url;
355 355
             if (substr($url, 0, strlen($base_url)) == $base_url) {
356 356
                 // append $site_url to make it work with Location:
357
-                $url = $site_url . substr($url, strlen($base_url));
357
+                $url = $site_url.substr($url, strlen($base_url));
358 358
             }
359 359
             if (strpos($url, "\n") === false) {
360
-                $header = 'Location: ' . $url;
360
+                $header = 'Location: '.$url;
361 361
             } else {
362 362
                 $this->messageQuit('No newline allowed in redirect url.');
363 363
             }
@@ -471,8 +471,8 @@  discard block
 block discarded – undo
471 471
 
472 472
     private function recoverySiteCache()
473 473
     {
474
-        $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
475
-        $site_cache_path = $site_cache_dir . 'siteCache.idx.php';
474
+        $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
475
+        $site_cache_path = $site_cache_dir.'siteCache.idx.php';
476 476
 
477 477
         if (is_file($site_cache_path)) {
478 478
             include($site_cache_path);
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
             return;
482 482
         }
483 483
 
484
-        include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
484
+        include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
485 485
         $cache = new synccache();
486 486
         $cache->setCachepath($site_cache_dir);
487 487
         $cache->setReport(false);
@@ -533,8 +533,8 @@  discard block
 block discarded – undo
533 533
                 $this->invokeEvent("OnBeforeManagerPageInit");
534 534
             }
535 535
 
536
-            if (isset($_SESSION[$usrType . 'UsrConfigSet'])) {
537
-                $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet'];
536
+            if (isset($_SESSION[$usrType.'UsrConfigSet'])) {
537
+                $usrSettings = &$_SESSION[$usrType.'UsrConfigSet'];
538 538
             } else {
539 539
                 if ($usrType == 'web') {
540 540
                     $from = $tbl_web_user_settings;
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
                     $usrSettings[$row['setting_name']] = $row['setting_value'];
555 555
                 }
556 556
                 if (isset($usrType)) {
557
-                    $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
557
+                    $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings;
558 558
                 } // store user settings in session
559 559
             }
560 560
         }
@@ -699,10 +699,10 @@  discard block
 block discarded – undo
699 699
         $suf = $this->config['friendly_url_suffix'];
700 700
         $pre = preg_quote($pre, '/');
701 701
         $suf = preg_quote($suf, '/');
702
-        if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) {
702
+        if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) {
703 703
             $q = $_[1];
704 704
         }
705
-        if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) {
705
+        if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) {
706 706
             $q = $_[1];
707 707
         }
708 708
 
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
         if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */
725 725
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
726 726
             if ($this->config['use_alias_path'] == 1) {
727
-                if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
727
+                if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir.'/'.$q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
728 728
                     $this->documentMethod = 'id';
729 729
                     return $q;
730 730
                 } else { /* not a valid id in terms of virtualDir, treat as alias */
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
      */
759 759
     public function getHashFile($key)
760 760
     {
761
-        return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php";
761
+        return $this->getCacheFolder()."docid_".$key.".pageCache.php";
762 762
     }
763 763
 
764 764
     /**
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
778 778
                 $params = $_GET;
779 779
                 ksort($params);
780
-                $hash .= '_' . md5(http_build_query($params));
780
+                $hash .= '_'.md5(http_build_query($params));
781 781
             }
782 782
         }
783 783
         $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params));
@@ -923,12 +923,12 @@  discard block
 block discarded – undo
923 923
         if ($js = $this->getRegisteredClientStartupScripts()) {
924 924
             // change to just before closing </head>
925 925
             // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent);
926
-            $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput);
926
+            $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput);
927 927
         }
928 928
 
929 929
         // Insert jscripts & html block into template - template must have a </body> tag
930 930
         if ($js = $this->getRegisteredClientScripts()) {
931
-            $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput);
931
+            $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput);
932 932
         }
933 933
         // End fix by sirlancelot
934 934
 
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
         // send out content-type and content-disposition headers
940 940
         if (IN_PARSER_MODE == "true") {
941 941
             $type = !empty($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html";
942
-            header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']);
942
+            header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']);
943 943
             //            if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error)
944 944
             //                header('HTTP/1.0 404 Not Found');
945 945
             if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) {
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
                     $name = preg_replace('|-+|', '-', $name);
958 958
                     $name = trim($name, '-');
959 959
                 }
960
-                $header = 'Content-Disposition: attachment; filename=' . $name;
960
+                $header = 'Content-Disposition: attachment; filename='.$name;
961 961
                 header($header);
962 962
             }
963 963
         }
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 
966 966
         $stats = $this->getTimerStats($this->tstart);
967 967
 
968
-        $out =& $this->documentOutput;
968
+        $out = & $this->documentOutput;
969 969
         $out = str_replace("[^q^]", $stats['queries'], $out);
970 970
         $out = str_replace("[^qt^]", $stats['queryTime'], $out);
971 971
         $out = str_replace("[^p^]", $stats['phpTime'], $out);
@@ -1004,17 +1004,17 @@  discard block
 block discarded – undo
1004 1004
                 $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet
1005 1005
                 $tt += $t;
1006 1006
             }
1007
-            echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />";
1007
+            echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />";
1008 1008
             echo $this->snippetsCode;
1009 1009
         }
1010 1010
         if ($this->dumpPlugins) {
1011 1011
             $ps = "";
1012 1012
             $tt = 0;
1013 1013
             foreach ($this->pluginsTime as $s => $t) {
1014
-                $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>";
1014
+                $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>";
1015 1015
                 $tt += $t;
1016 1016
             }
1017
-            echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />";
1017
+            echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />";
1018 1018
             echo $this->pluginsCode;
1019 1019
         }
1020 1020
 
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
         $srcTags = explode(',', $tags);
1041 1041
         $repTags = array();
1042 1042
         foreach ($srcTags as $tag) {
1043
-            $repTags[] = '\\' . $tag[0] . '\\' . $tag[1];
1043
+            $repTags[] = '\\'.$tag[0].'\\'.$tag[1];
1044 1044
         }
1045 1045
         return array($srcTags, $repTags);
1046 1046
     }
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
         $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']);
1063 1063
         $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache";
1064 1064
         $stats['queries'] = isset($this->executedQueries) ? $this->executedQueries : 0;
1065
-        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb";
1065
+        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb";
1066 1066
 
1067 1067
         return $stats;
1068 1068
     }
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
     {
1096 1096
         $cacheRefreshTime = 0;
1097 1097
         $recent_update = 0;
1098
-        @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php');
1098
+        @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php');
1099 1099
         $this->recentUpdate = $recent_update;
1100 1100
 
1101 1101
         $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time'];
@@ -1165,8 +1165,8 @@  discard block
 block discarded – undo
1165 1165
                 }
1166 1166
 
1167 1167
                 $docObjSerial = serialize($this->documentObject);
1168
-                $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;
1169
-                $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey);
1168
+                $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent;
1169
+                $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey);
1170 1170
                 file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent");
1171 1171
             }
1172 1172
         }
@@ -1208,16 +1208,16 @@  discard block
 block discarded – undo
1208 1208
             return array();
1209 1209
         }
1210 1210
         $spacer = md5('<<<EVO>>>');
1211
-        if ($left==='{{' && strpos($content, ';}}')!==false) {
1211
+        if ($left === '{{' && strpos($content, ';}}') !== false) {
1212 1212
             $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content);
1213 1213
         }
1214
-        if ($left==='{{' && strpos($content, '{{}}')!==false) {
1214
+        if ($left === '{{' && strpos($content, '{{}}') !== false) {
1215 1215
             $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content);
1216 1216
         }
1217
-        if ($left==='[[' && strpos($content, ']]]]')!==false) {
1217
+        if ($left === '[[' && strpos($content, ']]]]') !== false) {
1218 1218
             $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content);
1219 1219
         }
1220
-        if ($left==='[[' && strpos($content, ']]]')!==false) {
1220
+        if ($left === '[[' && strpos($content, ']]]') !== false) {
1221 1221
             $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content);
1222 1222
         }
1223 1223
 
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
         $pos[']]>'] = strpos($content, ']]>');
1226 1226
 
1227 1227
         if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) {
1228
-            $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3);
1228
+            $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3);
1229 1229
         }
1230 1230
 
1231 1231
         $lp = explode($left, $content);
@@ -1290,7 +1290,7 @@  discard block
 block discarded – undo
1290 1290
             }
1291 1291
         }
1292 1292
         foreach ($tags as $i=>$tag) {
1293
-            if (strpos($tag, $spacer)!==false) {
1293
+            if (strpos($tag, $spacer) !== false) {
1294 1294
                 $tags[$i] = str_replace($spacer, '', $tag);
1295 1295
             }
1296 1296
         }
@@ -1332,7 +1332,7 @@  discard block
 block discarded – undo
1332 1332
         }
1333 1333
 
1334 1334
         foreach ($matches[1] as $i => $key) {
1335
-            if (strpos($key, '[+')!==false) {
1335
+            if (strpos($key, '[+') !== false) {
1336 1336
                 continue;
1337 1337
             } // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1338 1338
             if (substr($key, 0, 1) == '#') {
@@ -1354,8 +1354,8 @@  discard block
 block discarded – undo
1354 1354
             }
1355 1355
 
1356 1356
             if (is_array($value)) {
1357
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php');
1358
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php');
1357
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php');
1358
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php');
1359 1359
                 $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]);
1360 1360
             }
1361 1361
 
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
             if (strpos($content, $s) !== false) {
1368 1368
                 $content = str_replace($s, $value, $content);
1369 1369
             } elseif ($this->debug) {
1370
-                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1370
+                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1371 1371
             }
1372 1372
         }
1373 1373
 
@@ -1535,7 +1535,7 @@  discard block
 block discarded – undo
1535 1535
             if (strpos($content, $s) !== false) {
1536 1536
                 $content = str_replace($s, $value, $content);
1537 1537
             } elseif ($this->debug) {
1538
-                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1538
+                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1539 1539
             }
1540 1540
         }
1541 1541
         return $content;
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
             }
1589 1589
 
1590 1590
             $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags
1591
-            $value = $this->mergePlaceholderContent($value, $params);  // parse page global placeholers
1591
+            $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers
1592 1592
             if ($this->config['enable_at_syntax']) {
1593 1593
                 $value = $this->mergeConditionalTagsContent($value);
1594 1594
             }
@@ -1604,7 +1604,7 @@  discard block
 block discarded – undo
1604 1604
             if (strpos($content, $s) !== false) {
1605 1605
                 $content = str_replace($s, $value, $content);
1606 1606
             } elseif ($this->debug) {
1607
-                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1607
+                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1608 1608
             }
1609 1609
         }
1610 1610
         return $content;
@@ -1661,7 +1661,7 @@  discard block
 block discarded – undo
1661 1661
             if (strpos($content, $s) !== false) {
1662 1662
                 $content = str_replace($s, $value, $content);
1663 1663
             } elseif ($this->debug) {
1664
-                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1664
+                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1665 1665
             }
1666 1666
         }
1667 1667
         return $content;
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
             return $content;
1686 1686
         }
1687 1687
 
1688
-        $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#';
1688
+        $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#';
1689 1689
         $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content);
1690 1690
 
1691 1691
         $pieces = explode('<@IF:', $content);
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
             }
1697 1697
             list($cmd, $text) = explode('>', $split, 2);
1698 1698
             $cmd = str_replace("'", "\'", $cmd);
1699
-            $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1699
+            $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>";
1700 1700
             $content .= $text;
1701 1701
         }
1702 1702
         $pieces = explode('<@ELSEIF:', $content);
@@ -1707,13 +1707,13 @@  discard block
 block discarded – undo
1707 1707
             }
1708 1708
             list($cmd, $text) = explode('>', $split, 2);
1709 1709
             $cmd = str_replace("'", "\'", $cmd);
1710
-            $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1710
+            $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>";
1711 1711
             $content .= $text;
1712 1712
         }
1713 1713
 
1714 1714
         $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content);
1715 1715
         ob_start();
1716
-        $content = eval('?>' . $content);
1716
+        $content = eval('?>'.$content);
1717 1717
         $content = ob_get_clean();
1718 1718
         $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content);
1719 1719
 
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
         $matches = $this->getTagsFromContent($content, $left, $right);
1839 1839
         if (!empty($matches)) {
1840 1840
             foreach ($matches[0] as $i => $v) {
1841
-                $addBreakMatches[$i] = $v . "\n";
1841
+                $addBreakMatches[$i] = $v."\n";
1842 1842
             }
1843 1843
             $content = str_replace($addBreakMatches, '', $content);
1844 1844
             if (strpos($content, $left) !== false) {
@@ -1872,7 +1872,7 @@  discard block
 block discarded – undo
1872 1872
             if (strpos($content, $s) !== false) {
1873 1873
                 $content = str_replace($s, $v, $content);
1874 1874
             } elseif ($this->debug) {
1875
-                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1875
+                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1876 1876
             }
1877 1877
         }
1878 1878
         return $content;
@@ -1936,7 +1936,7 @@  discard block
 block discarded – undo
1936 1936
                 $msg = ($msg === false) ? 'ob_get_contents() error' : $msg;
1937 1937
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg);
1938 1938
                 if ($this->isBackend()) {
1939
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>');
1939
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>');
1940 1940
                 }
1941 1941
             }
1942 1942
         } else {
@@ -1982,7 +1982,7 @@  discard block
 block discarded – undo
1982 1982
                 $echo = ($echo === false) ? 'ob_get_contents() error' : $echo;
1983 1983
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo);
1984 1984
                 if ($this->isBackend()) {
1985
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>');
1985
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>');
1986 1986
                 }
1987 1987
             }
1988 1988
         }
@@ -1990,7 +1990,7 @@  discard block
 block discarded – undo
1990 1990
         if (is_array($return) || is_object($return)) {
1991 1991
             return $return;
1992 1992
         } else {
1993
-            return $echo . $return;
1993
+            return $echo.$return;
1994 1994
         }
1995 1995
     }
1996 1996
 
@@ -2029,7 +2029,7 @@  discard block
 block discarded – undo
2029 2029
                 if (strpos($content, $s) !== false) {
2030 2030
                     $content = str_replace($s, $value, $content);
2031 2031
                 } elseif ($this->debug) {
2032
-                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2032
+                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2);
2033 2033
                 }
2034 2034
                 continue;
2035 2035
             }
@@ -2041,7 +2041,7 @@  discard block
 block discarded – undo
2041 2041
             if (strpos($content, $s) !== false) {
2042 2042
                 $content = str_replace($s, $value, $content);
2043 2043
             } elseif ($this->debug) {
2044
-                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2044
+                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2);
2045 2045
             }
2046 2046
         }
2047 2047
 
@@ -2132,7 +2132,7 @@  discard block
 block discarded – undo
2132 2132
             $eventtime = sprintf('%2.2f ms', $eventtime * 1000);
2133 2133
             $code = str_replace("\t", '  ', $this->htmlspecialchars($value));
2134 2134
             $piece = str_replace("\t", '  ', $this->htmlspecialchars($piece));
2135
-            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true)));
2135
+            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true)));
2136 2136
             $this->snippetsCode .= sprintf('<fieldset style="margin:1em;"><legend><b>%s</b>(%s)</legend><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">[[%s]]</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre></fieldset>', $snippetObject['name'], $eventtime, $piece, $print_r_params, $code);
2137 2137
             $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime);
2138 2138
         }
@@ -2377,7 +2377,7 @@  discard block
 block discarded – undo
2377 2377
             $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where);
2378 2378
             $count = $this->db->getRecordCount($rs);
2379 2379
             if (1 < $count) {
2380
-                exit('Error $modx->_getSnippetObject()' . $snip_name);
2380
+                exit('Error $modx->_getSnippetObject()'.$snip_name);
2381 2381
             }
2382 2382
             if ($count) {
2383 2383
                 $row = $this->db->getRow($rs);
@@ -2403,7 +2403,7 @@  discard block
 block discarded – undo
2403 2403
     public function toAlias($text)
2404 2404
     {
2405 2405
         $suff = $this->config['friendly_url_suffix'];
2406
-        return str_replace(array('.xml' . $suff, '.rss' . $suff, '.js' . $suff, '.css' . $suff, '.txt' . $suff, '.json' . $suff, '.pdf' . $suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2406
+        return str_replace(array('.xml'.$suff, '.rss'.$suff, '.js'.$suff, '.css'.$suff, '.txt'.$suff, '.json'.$suff, '.pdf'.$suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2407 2407
     }
2408 2408
 
2409 2409
     /**
@@ -2435,7 +2435,7 @@  discard block
 block discarded – undo
2435 2435
                 $suff = '/';
2436 2436
             }
2437 2437
 
2438
-            $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff;
2438
+            $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff;
2439 2439
         }
2440 2440
 
2441 2441
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
                 preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match);
2473 2473
                 $ids = implode(',', array_unique($match['1']));
2474 2474
                 if ($ids) {
2475
-                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'");
2475
+                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'");
2476 2476
                     while ($row = $this->db->getRow($res)) {
2477 2477
                         if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) {
2478 2478
                             $parent = $row['parent'];
@@ -2483,7 +2483,7 @@  discard block
 block discarded – undo
2483 2483
                                 $parent = $this->aliasListing[$parent]['parent'];
2484 2484
                             }
2485 2485
 
2486
-                            $aliases[$row['id']] = $path . '/' . $row['alias'];
2486
+                            $aliases[$row['id']] = $path.'/'.$row['alias'];
2487 2487
                         } else {
2488 2488
                             $aliases[$row['id']] = $row['alias'];
2489 2489
                         }
@@ -2495,7 +2495,7 @@  discard block
 block discarded – undo
2495 2495
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2496 2496
             $pref = $this->config['friendly_url_prefix'];
2497 2497
             $suff = $this->config['friendly_url_suffix'];
2498
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2498
+            $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2499 2499
                 global $modx;
2500 2500
                 $thealias = $aliases[$m[1]];
2501 2501
                 $thefolder = $isfolder[$m[1]];
@@ -2510,7 +2510,7 @@  discard block
 block discarded – undo
2510 2510
             }, $documentSource);
2511 2511
         } else {
2512 2512
             $in = '!\[\~([0-9]+)\~\]!is';
2513
-            $out = "index.php?id=" . '\1';
2513
+            $out = "index.php?id=".'\1';
2514 2514
             $documentSource = preg_replace($in, $out, $documentSource);
2515 2515
         }
2516 2516
 
@@ -2531,7 +2531,7 @@  discard block
 block discarded – undo
2531 2531
         $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
2532 2532
         $len_base_url = strlen($this->config['base_url']);
2533 2533
 
2534
-        $url_path = $q;//LANG
2534
+        $url_path = $q; //LANG
2535 2535
 
2536 2536
         if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) {
2537 2537
             $url_path = substr($url_path, $len_base_url);
@@ -2543,7 +2543,7 @@  discard block
 block discarded – undo
2543 2543
             $strictURL = substr($strictURL, $len_base_url);
2544 2544
         }
2545 2545
         $http_host = $_SERVER['HTTP_HOST'];
2546
-        $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG
2546
+        $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG
2547 2547
 
2548 2548
         $site_url = $this->config['site_url'];
2549 2549
         $url_query_string = explode('?', $_SERVER['REQUEST_URI']);
@@ -2561,7 +2561,7 @@  discard block
 block discarded – undo
2561 2561
                 }
2562 2562
                 if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) {
2563 2563
                     if (empty($_POST)) {
2564
-                        if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) {
2564
+                        if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) {
2565 2565
                             $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
2566 2566
                             exit(0);
2567 2567
                         }
@@ -2619,7 +2619,7 @@  discard block
 block discarded – undo
2619 2619
                 $docgrp = implode(",", $docgrp);
2620 2620
             }
2621 2621
             // get document
2622
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2622
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2623 2623
             $rs = $this->db->select('sc.*', "{$tblsc} sc
2624 2624
                 LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1);
2625 2625
             if ($this->db->getRecordCount($rs) < 1) {
@@ -2655,9 +2655,9 @@  discard block
 block discarded – undo
2655 2655
             }
2656 2656
             if ($documentObject['template']) {
2657 2657
                 // load TVs and merge with document - Orig by Apodigm - Docvars
2658
-                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv
2659
-                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id
2660
-                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2658
+                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv
2659
+                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id
2660
+                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2661 2661
                 $tmplvars = array();
2662 2662
                 while ($row = $this->db->getRow($rs)) {
2663 2663
                     $tmplvars[$row['name']] = array(
@@ -2703,7 +2703,7 @@  discard block
 block discarded – undo
2703 2703
                 $st = md5($source);
2704 2704
             }
2705 2705
             if ($this->dumpSnippets == 1) {
2706
-                $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS " . ($i + 1) . "</b></legend><p>The following snippets (if any) were parsed during this pass.</p>";
2706
+                $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS ".($i + 1)."</b></legend><p>The following snippets (if any) were parsed during this pass.</p>";
2707 2707
             }
2708 2708
 
2709 2709
             // invoke OnParseDocument event
@@ -2791,7 +2791,7 @@  discard block
 block discarded – undo
2791 2791
 
2792 2792
             // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path
2793 2793
             if ($this->config['use_alias_path'] == 1) {
2794
-                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier;
2794
+                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier;
2795 2795
                 if (isset($this->documentListing[$alias])) {
2796 2796
                     $this->documentIdentifier = $this->documentListing[$alias];
2797 2797
                 } else {
@@ -2852,7 +2852,7 @@  discard block
 block discarded – undo
2852 2852
                 } else {
2853 2853
                     $docAlias = $this->db->escape($this->documentIdentifier);
2854 2854
                     $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'");
2855
-                    $this->documentIdentifier = (int)$this->db->getValue($rs);
2855
+                    $this->documentIdentifier = (int) $this->db->getValue($rs);
2856 2856
                 }
2857 2857
             }
2858 2858
             $this->documentMethod = 'id';
@@ -2909,7 +2909,7 @@  discard block
 block discarded – undo
2909 2909
                 $_REQUEST[$n] = $_GET[$n] = $v;
2910 2910
             }
2911 2911
         }
2912
-        $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path'];
2912
+        $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path'];
2913 2913
         $this->q = $qp['path'];
2914 2914
         return $qp['path'];
2915 2915
     }
@@ -3003,7 +3003,7 @@  discard block
 block discarded – undo
3003 3003
             $this->sendErrorPage();
3004 3004
         } else {
3005 3005
             // Inculde the necessary files to check document permissions
3006
-            include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
3006
+            include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
3007 3007
             $udperms = new udperms();
3008 3008
             $udperms->user = $this->getLoginUserID();
3009 3009
             $udperms->document = $this->documentIdentifier;
@@ -3057,7 +3057,7 @@  discard block
 block discarded – undo
3057 3057
         while ($id && $height--) {
3058 3058
             $thisid = $id;
3059 3059
             if ($this->config['aliaslistingfolder'] == 1) {
3060
-                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1");
3060
+                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1");
3061 3061
                 if (!$id || $id == '0') {
3062 3062
                     break;
3063 3063
                 }
@@ -3106,15 +3106,15 @@  discard block
 block discarded – undo
3106 3106
         }
3107 3107
 
3108 3108
         if ($this->config['aliaslistingfolder'] == 1) {
3109
-            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'");
3109
+            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'");
3110 3110
             $idx = array();
3111 3111
             while ($row = $this->db->getRow($res)) {
3112 3112
                 $pAlias = '';
3113 3113
                 if (isset($this->aliasListing[$row['parent']])) {
3114
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : '';
3115
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : '';
3114
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : '';
3115
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : '';
3116 3116
                 };
3117
-                $children[$pAlias . $row['alias']] = $row['id'];
3117
+                $children[$pAlias.$row['alias']] = $row['id'];
3118 3118
                 if ($row['isfolder'] == 1) {
3119 3119
                     $idx[] = $row['id'];
3120 3120
                 }
@@ -3145,7 +3145,7 @@  discard block
 block discarded – undo
3145 3145
                 $depth--;
3146 3146
 
3147 3147
                 foreach ($documentMap_cache[$id] as $childId) {
3148
-                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias'];
3148
+                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias'];
3149 3149
                     if (!strlen($pkey)) {
3150 3150
                         $pkey = "{$childId}";
3151 3151
                     }
@@ -3173,7 +3173,7 @@  discard block
 block discarded – undo
3173 3173
         if (substr(strtolower($url), 0, 11) == "javascript:") {
3174 3174
             $fnc = substr($url, 11);
3175 3175
         } elseif ($url) {
3176
-            $fnc = "window.location.href='" . addslashes($url) . "';";
3176
+            $fnc = "window.location.href='".addslashes($url)."';";
3177 3177
         } else {
3178 3178
             $fnc = "history.back(-1);";
3179 3179
         }
@@ -3182,7 +3182,7 @@  discard block
 block discarded – undo
3182 3182
             <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\">
3183 3183
             <script>
3184 3184
                 function __alertQuit() {
3185
-                    alert('" . addslashes($msg) . "');
3185
+                    alert('".addslashes($msg)."');
3186 3186
                     {$fnc}
3187 3187
                 }
3188 3188
                 window.setTimeout('__alertQuit();',100);
@@ -3204,9 +3204,9 @@  discard block
 block discarded – undo
3204 3204
         $state = 0;
3205 3205
         $pms = $_SESSION['mgrPermissions'];
3206 3206
         if ($pms) {
3207
-            $state = ((bool)$pms[$pm] === true);
3207
+            $state = ((bool) $pms[$pm] === true);
3208 3208
         }
3209
-        return (int)$state;
3209
+        return (int) $state;
3210 3210
     }
3211 3211
 
3212 3212
     /**
@@ -3219,8 +3219,8 @@  discard block
 block discarded – undo
3219 3219
      */
3220 3220
     public function elementIsLocked($type, $id, $includeThisUser = false)
3221 3221
     {
3222
-        $id = (int)$id;
3223
-        $type = (int)$type;
3222
+        $id = (int) $id;
3223
+        $type = (int) $type;
3224 3224
         if (!$type || !$id) {
3225 3225
             return null;
3226 3226
         }
@@ -3270,7 +3270,7 @@  discard block
 block discarded – undo
3270 3270
             return $lockedElements;
3271 3271
         }
3272 3272
 
3273
-        $type = (int)$type;
3273
+        $type = (int) $type;
3274 3274
         if (isset($lockedElements[$type])) {
3275 3275
             return $lockedElements[$type];
3276 3276
         } else {
@@ -3287,7 +3287,7 @@  discard block
 block discarded – undo
3287 3287
             $this->lockedElements = array();
3288 3288
             $this->cleanupExpiredLocks();
3289 3289
 
3290
-            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul
3290
+            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul
3291 3291
                 LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id");
3292 3292
             while ($row = $this->db->getRow($rs)) {
3293 3293
                 $this->lockedElements[$row['elementType']][$row['elementId']] = array(
@@ -3310,7 +3310,7 @@  discard block
 block discarded – undo
3310 3310
     public function cleanupExpiredLocks()
3311 3311
     {
3312 3312
         // Clean-up active_user_sessions first
3313
-        $timeout = (int)$this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum
3313
+        $timeout = (int) $this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum
3314 3314
         $validSessionTimeLimit = $this->time - $timeout;
3315 3315
         $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}");
3316 3316
 
@@ -3323,7 +3323,7 @@  discard block
 block discarded – undo
3323 3323
             foreach ($rs as $row) {
3324 3324
                 $userSids[] = $row['sid'];
3325 3325
             }
3326
-            $userSids = "'" . implode("','", $userSids) . "'";
3326
+            $userSids = "'".implode("','", $userSids)."'";
3327 3327
             $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})");
3328 3328
         } else {
3329 3329
             $this->db->delete($this->getFullTableName('active_user_locks'));
@@ -3404,8 +3404,8 @@  discard block
 block discarded – undo
3404 3404
     public function lockElement($type, $id)
3405 3405
     {
3406 3406
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3407
-        $type = (int)$type;
3408
-        $id = (int)$id;
3407
+        $type = (int) $type;
3408
+        $id = (int) $id;
3409 3409
         if (!$type || !$id || !$userId) {
3410 3410
             return false;
3411 3411
         }
@@ -3426,8 +3426,8 @@  discard block
 block discarded – undo
3426 3426
     public function unlockElement($type, $id, $includeAllUsers = false)
3427 3427
     {
3428 3428
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3429
-        $type = (int)$type;
3430
-        $id = (int)$id;
3429
+        $type = (int) $type;
3430
+        $id = (int) $id;
3431 3431
         if (!$type || !$id) {
3432 3432
             return false;
3433 3433
         }
@@ -3494,8 +3494,8 @@  discard block
 block discarded – undo
3494 3494
         }
3495 3495
 
3496 3496
         $usertype = $this->isFrontend() ? 1 : 0;
3497
-        $evtid = (int)$evtid;
3498
-        $type = (int)$type;
3497
+        $evtid = (int) $evtid;
3498
+        $type = (int) $type;
3499 3499
 
3500 3500
         // Types: 1 = information, 2 = warning, 3 = error
3501 3501
         if ($type < 1) {
@@ -3517,8 +3517,8 @@  discard block
 block discarded – undo
3517 3517
         if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') {
3518 3518
             if ($this->config['send_errormail'] <= $type) {
3519 3519
                 $this->sendmail(array(
3520
-                    'subject' => 'MODX System Error on ' . $this->config['site_name'],
3521
-                    'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.',
3520
+                    'subject' => 'MODX System Error on '.$this->config['site_name'],
3521
+                    'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.',
3522 3522
                     'type' => 'text'
3523 3523
                 ));
3524 3524
             }
@@ -3566,7 +3566,7 @@  discard block
 block discarded – undo
3566 3566
             $p['fromname'] = $userinfo['username'];
3567 3567
         }
3568 3568
         if ($msg === '' && !isset($p['body'])) {
3569
-            $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER'];
3569
+            $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER'];
3570 3570
         } elseif (is_string($msg) && 0 < strlen($msg)) {
3571 3571
             $p['body'] = $msg;
3572 3572
         }
@@ -3606,8 +3606,8 @@  discard block
 block discarded – undo
3606 3606
             $files = array();
3607 3607
         }
3608 3608
         foreach ($files as $f) {
3609
-            if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) {
3610
-                $this->mail->AddAttachment(MODX_BASE_PATH . $f);
3609
+            if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) {
3610
+                $this->mail->AddAttachment(MODX_BASE_PATH.$f);
3611 3611
             }
3612 3612
         }
3613 3613
         $rs = $this->mail->send();
@@ -3652,7 +3652,7 @@  discard block
 block discarded – undo
3652 3652
      */
3653 3653
     public function isFrontend()
3654 3654
     {
3655
-        return ! $this->isBackend();
3655
+        return !$this->isBackend();
3656 3656
     }
3657 3657
 
3658 3658
     /**
@@ -3676,14 +3676,14 @@  discard block
 block discarded – undo
3676 3676
         $tblsc = $this->getFullTableName("site_content");
3677 3677
         $tbldg = $this->getFullTableName("document_groups");
3678 3678
         // modify field names to use sc. table reference
3679
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3680
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3679
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3680
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3681 3681
         // get document groups for current user
3682 3682
         if ($docgrp = $this->getUserDocGroups()) {
3683 3683
             $docgrp = implode(",", $docgrp);
3684 3684
         }
3685 3685
         // build query
3686
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3686
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3687 3687
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3688 3688
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3689 3689
         $resourceArray = $this->db->makeArray($result);
@@ -3713,14 +3713,14 @@  discard block
 block discarded – undo
3713 3713
         $tbldg = $this->getFullTableName("document_groups");
3714 3714
 
3715 3715
         // modify field names to use sc. table reference
3716
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3717
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3716
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3717
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3718 3718
         // get document groups for current user
3719 3719
         if ($docgrp = $this->getUserDocGroups()) {
3720 3720
             $docgrp = implode(",", $docgrp);
3721 3721
         }
3722 3722
         // build query
3723
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3723
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3724 3724
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3725 3725
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3726 3726
         $resourceArray = $this->db->makeArray($result);
@@ -3754,16 +3754,16 @@  discard block
 block discarded – undo
3754 3754
             return $this->tmpCache[__FUNCTION__][$cacheKey];
3755 3755
         }
3756 3756
 
3757
-        $published = ($published !== 'all') ? 'AND sc.published = ' . $published : '';
3758
-        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : '';
3757
+        $published = ($published !== 'all') ? 'AND sc.published = '.$published : '';
3758
+        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : '';
3759 3759
 
3760 3760
         if ($where != '') {
3761
-            $where = 'AND ' . $where;
3761
+            $where = 'AND '.$where;
3762 3762
         }
3763 3763
 
3764 3764
         // modify field names to use sc. table reference
3765
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3766
-        $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3765
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3766
+        $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3767 3767
 
3768 3768
         // get document groups for current user
3769 3769
         if ($docgrp = $this->getUserDocGroups()) {
@@ -3771,7 +3771,7 @@  discard block
 block discarded – undo
3771 3771
         }
3772 3772
 
3773 3773
         // build query
3774
-        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3774
+        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3775 3775
 
3776 3776
         $tblsc = $this->getFullTableName('site_content');
3777 3777
         $tbldg = $this->getFullTableName('document_groups');
@@ -3822,10 +3822,10 @@  discard block
 block discarded – undo
3822 3822
             return false;
3823 3823
         } else {
3824 3824
             // modify field names to use sc. table reference
3825
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3826
-            $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3825
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3826
+            $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3827 3827
             if ($where != '') {
3828
-                $where = 'AND ' . $where;
3828
+                $where = 'AND '.$where;
3829 3829
             }
3830 3830
 
3831 3831
             $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : '';
@@ -3836,13 +3836,13 @@  discard block
 block discarded – undo
3836 3836
                 $docgrp = implode(',', $docgrp);
3837 3837
             }
3838 3838
 
3839
-            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3839
+            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3840 3840
 
3841 3841
             $tblsc = $this->getFullTableName('site_content');
3842 3842
             $tbldg = $this->getFullTableName('document_groups');
3843 3843
 
3844 3844
             $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3845
-                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
3845
+                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',', $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
3846 3846
 
3847 3847
             $resourceArray = $this->db->makeArray($result);
3848 3848
 
@@ -3946,12 +3946,12 @@  discard block
 block discarded – undo
3946 3946
             $tbldg = $this->getFullTableName("document_groups");
3947 3947
             $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : "";
3948 3948
             // modify field names to use sc. table reference
3949
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3949
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3950 3950
             // get document groups for current user
3951 3951
             if ($docgrp = $this->getUserDocGroups()) {
3952 3952
                 $docgrp = implode(",", $docgrp);
3953 3953
             }
3954
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3954
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3955 3955
             $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1);
3956 3956
             $pageInfo = $this->db->getRow($result);
3957 3957
 
@@ -3998,7 +3998,7 @@  discard block
 block discarded – undo
3998 3998
     {
3999 3999
         if ($this->currentSnippet) {
4000 4000
             $tbl = $this->getFullTableName("site_snippets");
4001
-            $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1);
4001
+            $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1);
4002 4002
             if ($snippetId = $this->db->getValue($rs)) {
4003 4003
                 return $snippetId;
4004 4004
             }
@@ -4025,23 +4025,23 @@  discard block
 block discarded – undo
4025 4025
      */
4026 4026
     public function clearCache($type = '', $report = false)
4027 4027
     {
4028
-        $cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
4028
+        $cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
4029 4029
         if (is_array($type)) {
4030 4030
             foreach ($type as $_) {
4031 4031
                 $this->clearCache($_, $report);
4032 4032
             }
4033 4033
         } elseif ($type == 'full') {
4034
-            include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
4034
+            include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
4035 4035
             $sync = new synccache();
4036 4036
             $sync->setCachepath($cache_dir);
4037 4037
             $sync->setReport($report);
4038 4038
             $sync->emptyCache();
4039 4039
         } elseif (preg_match('@^[1-9][0-9]*$@', $type)) {
4040 4040
             $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type;
4041
-            $file_name = "docid_" . $key . "_*.pageCache.php";
4042
-            $cache_path = $cache_dir . $file_name;
4041
+            $file_name = "docid_".$key."_*.pageCache.php";
4042
+            $cache_path = $cache_dir.$file_name;
4043 4043
             $files = glob($cache_path);
4044
-            $files[] = $cache_dir . "docid_" . $key . ".pageCache.php";
4044
+            $files[] = $cache_dir."docid_".$key.".pageCache.php";
4045 4045
             foreach ($files as $file) {
4046 4046
                 if (!is_file($file)) {
4047 4047
                     continue;
@@ -4049,7 +4049,7 @@  discard block
 block discarded – undo
4049 4049
                 unlink($file);
4050 4050
             }
4051 4051
         } else {
4052
-            $files = glob($cache_dir . '*');
4052
+            $files = glob($cache_dir.'*');
4053 4053
             foreach ($files as $file) {
4054 4054
                 $name = basename($file);
4055 4055
                 if (strpos($name, '.pageCache.php') === false) {
@@ -4117,14 +4117,14 @@  discard block
 block discarded – undo
4117 4117
                         $f_url_suffix = '/';
4118 4118
                     }
4119 4119
 
4120
-                    $alPath = !empty($al['path']) ? $al['path'] . '/' : '';
4120
+                    $alPath = !empty($al['path']) ? $al['path'].'/' : '';
4121 4121
 
4122 4122
                     if ($al && $al['alias']) {
4123 4123
                         $alias = $al['alias'];
4124 4124
                     }
4125 4125
                 }
4126 4126
 
4127
-                $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix;
4127
+                $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix;
4128 4128
                 $url = "{$alias}{$args}";
4129 4129
             } else {
4130 4130
                 $url = "index.php?id={$id}{$args}";
@@ -4143,7 +4143,7 @@  discard block
 block discarded – undo
4143 4143
             }
4144 4144
 
4145 4145
             //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080)
4146
-            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host;
4146
+            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host;
4147 4147
         }
4148 4148
 
4149 4149
         //fix strictUrl by Bumkaka
@@ -4152,9 +4152,9 @@  discard block
 block discarded – undo
4152 4152
         }
4153 4153
 
4154 4154
         if ($this->config['xhtml_urls']) {
4155
-            $url = preg_replace("/&(?!amp;)/", "&amp;", $host . $virtualDir . $url);
4155
+            $url = preg_replace("/&(?!amp;)/", "&amp;", $host.$virtualDir.$url);
4156 4156
         } else {
4157
-            $url = $host . $virtualDir . $url;
4157
+            $url = $host.$virtualDir.$url;
4158 4158
         }
4159 4159
 
4160 4160
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -4178,21 +4178,21 @@  discard block
 block discarded – undo
4178 4178
         if (isset($this->aliasListing[$id])) {
4179 4179
             $out = $this->aliasListing[$id];
4180 4180
         } else {
4181
-            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id);
4181
+            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id);
4182 4182
             if ($this->db->getRecordCount($q) == '1') {
4183 4183
                 $q = $this->db->getRow($q);
4184 4184
                 $this->aliasListing[$id] = array(
4185
-                    'id' => (int)$q['id'],
4185
+                    'id' => (int) $q['id'],
4186 4186
                     'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'],
4187
-                    'parent' => (int)$q['parent'],
4188
-                    'isfolder' => (int)$q['isfolder'],
4187
+                    'parent' => (int) $q['parent'],
4188
+                    'isfolder' => (int) $q['isfolder'],
4189 4189
                 );
4190 4190
                 if ($this->aliasListing[$id]['parent'] > 0) {
4191 4191
                     //fix alias_path_usage
4192 4192
                     if ($this->config['use_alias_path'] == '1') {
4193 4193
                         //&& $tmp['path'] != '' - fix error slash with epty path
4194 4194
                         $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']);
4195
-                        $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : '');
4195
+                        $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : '');
4196 4196
                     } else {
4197 4197
                         $this->aliasListing[$id]['path'] = '';
4198 4198
                     }
@@ -4233,7 +4233,7 @@  discard block
 block discarded – undo
4233 4233
         $out = array();
4234 4234
         if (empty($this->version) || !is_array($this->version)) {
4235 4235
             //include for compatibility modx version < 1.0.10
4236
-            include MODX_MANAGER_PATH . "includes/version.inc.php";
4236
+            include MODX_MANAGER_PATH."includes/version.inc.php";
4237 4237
             $this->version = array();
4238 4238
             $this->version['version'] = isset($modx_version) ? $modx_version : '';
4239 4239
             $this->version['branch'] = isset($modx_branch) ? $modx_branch : '';
@@ -4255,18 +4255,18 @@  discard block
 block discarded – undo
4255 4255
     {
4256 4256
         if (isset($this->snippetCache[$snippetName])) {
4257 4257
             $snippet = $this->snippetCache[$snippetName];
4258
-            $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4258
+            $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : '';
4259 4259
         } else { // not in cache so let's check the db
4260
-            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "'  AND ss.disabled=0;";
4260
+            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->db->escape($snippetName)."'  AND ss.disabled=0;";
4261 4261
             $result = $this->db->query($sql);
4262 4262
             if ($this->db->getRecordCount($result) == 1) {
4263 4263
                 $row = $this->db->getRow($result);
4264 4264
                 $snippet = $this->snippetCache[$snippetName] = $row['snippet'];
4265 4265
                 $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties']));
4266
-                $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties);
4266
+                $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties);
4267 4267
             } else {
4268 4268
                 $snippet = $this->snippetCache[$snippetName] = "return false;";
4269
-                $properties = $this->snippetCache[$snippetName . "Props"] = '';
4269
+                $properties = $this->snippetCache[$snippetName."Props"] = '';
4270 4270
             }
4271 4271
         }
4272 4272
         // load default params/properties
@@ -4366,7 +4366,7 @@  discard block
 block discarded – undo
4366 4366
             if (strpos($tpl, $s) !== false) {
4367 4367
                 $tpl = str_replace($s, $value, $tpl);
4368 4368
             } elseif ($this->debug) {
4369
-                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2);
4369
+                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2);
4370 4370
             }
4371 4371
         }
4372 4372
 
@@ -4415,7 +4415,7 @@  discard block
 block discarded – undo
4415 4415
             case 'CODE':
4416 4416
                 break;
4417 4417
             case 'FILE':
4418
-                $template = file_get_contents(MODX_BASE_PATH . $template);
4418
+                $template = file_get_contents(MODX_BASE_PATH.$template);
4419 4419
                 break;
4420 4420
             case 'CHUNK':
4421 4421
                 $template = $this->getChunk($template);
@@ -4448,7 +4448,7 @@  discard block
 block discarded – undo
4448 4448
         if ($mode !== 'formatOnly' && empty($timestamp)) {
4449 4449
             return '-';
4450 4450
         }
4451
-        $timestamp = (int)$timestamp;
4451
+        $timestamp = (int) $timestamp;
4452 4452
 
4453 4453
         switch ($this->config['datetime_format']) {
4454 4454
             case 'YYYY/mm/dd':
@@ -4468,7 +4468,7 @@  discard block
 block discarded – undo
4468 4468
         }
4469 4469
 
4470 4470
         if (empty($mode)) {
4471
-            $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp);
4471
+            $strTime = strftime($dateFormat." %H:%M:%S", $timestamp);
4472 4472
         } elseif ($mode == 'dateOnly') {
4473 4473
             $strTime = strftime($dateFormat, $timestamp);
4474 4474
         } elseif ($mode == 'formatOnly') {
@@ -4522,7 +4522,7 @@  discard block
 block discarded – undo
4522 4522
             $S = 0;
4523 4523
         }
4524 4524
         $timeStamp = mktime($H, $M, $S, $m, $d, $Y);
4525
-        $timeStamp = (int)$timeStamp;
4525
+        $timeStamp = (int) $timeStamp;
4526 4526
         return $timeStamp;
4527 4527
     }
4528 4528
 
@@ -4564,7 +4564,7 @@  discard block
 block discarded – undo
4564 4564
                     if ($v === 'value') {
4565 4565
                         unset($_[$i]);
4566 4566
                     } else {
4567
-                        $_[$i] = 'tv.' . $v;
4567
+                        $_[$i] = 'tv.'.$v;
4568 4568
                     }
4569 4569
                 }
4570 4570
                 $fields = implode(',', $_);
@@ -4573,12 +4573,12 @@  discard block
 block discarded – undo
4573 4573
             }
4574 4574
 
4575 4575
             if ($tvsort != '') {
4576
-                $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4576
+                $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4577 4577
             }
4578 4578
             if ($tvidnames == "*") {
4579 4579
                 $query = "tv.id<>0";
4580 4580
             } else {
4581
-                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')";
4581
+                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')";
4582 4582
             }
4583 4583
 
4584 4584
             $this->getUserDocGroups();
@@ -4739,18 +4739,18 @@  discard block
 block discarded – undo
4739 4739
             }
4740 4740
 
4741 4741
             // get user defined template variables
4742
-            $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4743
-            $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4742
+            $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4743
+            $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4744 4744
 
4745 4745
             if ($idnames == '*') {
4746 4746
                 $query = 'tv.id<>0';
4747 4747
             } else {
4748
-                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')";
4748
+                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')";
4749 4749
             }
4750 4750
 
4751
-            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv
4752
-                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id
4753
-                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
4751
+            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv
4752
+                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id
4753
+                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
4754 4754
 
4755 4755
             $result = $this->db->makeArray($rs);
4756 4756
 
@@ -4799,16 +4799,16 @@  discard block
 block discarded – undo
4799 4799
             $output = array();
4800 4800
             $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames);
4801 4801
 
4802
-            $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier;
4802
+            $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier;
4803 4803
             // remove sort for speed
4804 4804
             $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');
4805 4805
 
4806 4806
             if ($result == false) {
4807 4807
                 return false;
4808 4808
             } else {
4809
-                $baspath = MODX_MANAGER_PATH . 'includes';
4810
-                include_once $baspath . '/tmplvars.format.inc.php';
4811
-                include_once $baspath . '/tmplvars.commands.inc.php';
4809
+                $baspath = MODX_MANAGER_PATH.'includes';
4810
+                include_once $baspath.'/tmplvars.format.inc.php';
4811
+                include_once $baspath.'/tmplvars.commands.inc.php';
4812 4812
 
4813 4813
                 for ($i = 0; $i < count($result); $i++) {
4814 4814
                     $row = $result[$i];
@@ -4833,7 +4833,7 @@  discard block
 block discarded – undo
4833 4833
      */
4834 4834
     public function getFullTableName($tbl)
4835 4835
     {
4836
-        return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`";
4836
+        return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`";
4837 4837
     }
4838 4838
 
4839 4839
     /**
@@ -4912,7 +4912,7 @@  discard block
 block discarded – undo
4912 4912
     public function getCachePath()
4913 4913
     {
4914 4914
         global $base_url;
4915
-        $pth = $base_url . $this->getCacheFolder();
4915
+        $pth = $base_url.$this->getCacheFolder();
4916 4916
         return $pth;
4917 4917
     }
4918 4918
 
@@ -4964,8 +4964,8 @@  discard block
 block discarded – undo
4964 4964
         $out = false;
4965 4965
 
4966 4966
         if (!empty($context)) {
4967
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4968
-                $out = $_SESSION[$context . 'InternalKey'];
4967
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4968
+                $out = $_SESSION[$context.'InternalKey'];
4969 4969
             }
4970 4970
         } else {
4971 4971
             switch (true) {
@@ -4993,8 +4993,8 @@  discard block
 block discarded – undo
4993 4993
         $out = false;
4994 4994
 
4995 4995
         if (!empty($context)) {
4996
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4997
-                $out = $_SESSION[$context . 'Shortname'];
4996
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4997
+                $out = $_SESSION[$context.'Shortname'];
4998 4998
             }
4999 4999
         } else {
5000 5000
             switch (true) {
@@ -5065,8 +5065,8 @@  discard block
 block discarded – undo
5065 5065
      */
5066 5066
     public function getWebUserInfo($uid)
5067 5067
     {
5068
-        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu
5069
-                INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5068
+        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu
5069
+                INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5070 5070
         if ($row = $this->db->getRow($rs)) {
5071 5071
             if (!isset($row['usertype']) or !$row["usertype"]) {
5072 5072
                 $row["usertype"] = "web";
@@ -5102,7 +5102,7 @@  discard block
 block discarded – undo
5102 5102
         } elseif (is_array($dg)) {
5103 5103
             // resolve ids to names
5104 5104
             $dgn = array();
5105
-            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")");
5105
+            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")");
5106 5106
             while ($row = $this->db->getRow($ds)) {
5107 5107
                 $dgn[] = $row['name'];
5108 5108
             }
@@ -5130,7 +5130,7 @@  discard block
 block discarded – undo
5130 5130
         $rt = false;
5131 5131
         if ($_SESSION["webValidated"] == 1) {
5132 5132
             $tbl = $this->getFullTableName("web_users");
5133
-            $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'");
5133
+            $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'");
5134 5134
             if ($row = $this->db->getRow($ds)) {
5135 5135
                 if ($row["password"] == md5($oldPwd)) {
5136 5136
                     if (strlen($newPwd) < 6) {
@@ -5140,7 +5140,7 @@  discard block
 block discarded – undo
5140 5140
                     } else {
5141 5141
                         $this->db->update(array(
5142 5142
                             'password' => $this->db->escape($newPwd),
5143
-                        ), $tbl, "id='" . $this->getLoginUserID() . "'");
5143
+                        ), $tbl, "id='".$this->getLoginUserID()."'");
5144 5144
                         // invoke OnWebChangePassword event
5145 5145
                         $this->invokeEvent("OnWebChangePassword", array(
5146 5146
                             "userid" => $row["id"],
@@ -5171,8 +5171,8 @@  discard block
 block discarded – undo
5171 5171
         // check cache
5172 5172
         $grpNames = isset($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false;
5173 5173
         if (!is_array($grpNames)) {
5174
-            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn
5175
-                    INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'");
5174
+            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn
5175
+                    INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'");
5176 5176
             $grpNames = $this->db->getColumn("name", $rs);
5177 5177
             // save to cache
5178 5178
             $_SESSION['webUserGroupNames'] = $grpNames;
@@ -5205,7 +5205,7 @@  discard block
 block discarded – undo
5205 5205
         if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) {
5206 5206
             $this->sjscripts[$nextpos] = $src;
5207 5207
         } else {
5208
-            $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>';
5208
+            $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>';
5209 5209
         }
5210 5210
     }
5211 5211
 
@@ -5284,7 +5284,7 @@  discard block
 block discarded – undo
5284 5284
         }
5285 5285
 
5286 5286
         if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) {
5287
-            $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>';
5287
+            $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>';
5288 5288
         }
5289 5289
         if ($startup) {
5290 5290
             $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1;
@@ -5431,7 +5431,7 @@  discard block
 block discarded – undo
5431 5431
                 $eventtime = $this->getMicroTime() - $eventtime;
5432 5432
                 $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000);
5433 5433
                 foreach ($parameter as $k => $v) {
5434
-                    $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>';
5434
+                    $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>';
5435 5435
                 }
5436 5436
                 $this->pluginsCode .= '</fieldset><br />';
5437 5437
                 $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime;
@@ -5459,13 +5459,13 @@  discard block
 block discarded – undo
5459 5459
         $plugin = array();
5460 5460
         if (isset($this->pluginCache[$pluginName])) {
5461 5461
             $pluginCode = $this->pluginCache[$pluginName];
5462
-            $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : '';
5462
+            $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : '';
5463 5463
         } else {
5464 5464
             $pluginName = $this->db->escape($pluginName);
5465 5465
             $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0");
5466 5466
             if ($row = $this->db->getRow($result)) {
5467 5467
                 $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode'];
5468
-                $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties'];
5468
+                $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties'];
5469 5469
             } else {
5470 5470
                 $pluginCode = $this->pluginCache[$pluginName] = "return false;";
5471 5471
                 $pluginProperties = '';
@@ -5567,7 +5567,7 @@  discard block
 block discarded – undo
5567 5567
     public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)
5568 5568
     {
5569 5569
         $params = array();
5570
-        $fullpath = $element_dir . '/' . $filename;
5570
+        $fullpath = $element_dir.'/'.$filename;
5571 5571
         if (is_readable($fullpath)) {
5572 5572
             $tpl = @fopen($fullpath, "r");
5573 5573
             if ($tpl) {
@@ -5734,8 +5734,8 @@  discard block
 block discarded – undo
5734 5734
         $ph = array('site_url' => MODX_SITE_URL);
5735 5735
         $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";
5736 5736
         $regexEmail = '#([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)#i';
5737
-        $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';
5738
-        $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';
5737
+        $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';
5738
+        $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';
5739 5739
         foreach ($parsed as $key => $val) {
5740 5740
             if (is_array($val)) {
5741 5741
                 foreach ($val as $key2 => $val2) {
@@ -5744,7 +5744,7 @@  discard block
 block discarded – undo
5744 5744
                         $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2);
5745 5745
                     }
5746 5746
                     if (preg_match($regexEmail, $val2, $url)) {
5747
-                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);
5747
+                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);
5748 5748
                     }
5749 5749
                     $parsed[$key][$key2] = $val2;
5750 5750
                 }
@@ -5754,7 +5754,7 @@  discard block
 block discarded – undo
5754 5754
                     $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val);
5755 5755
                 }
5756 5756
                 if (preg_match($regexEmail, $val, $url)) {
5757
-                    $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);
5757
+                    $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);
5758 5758
                 }
5759 5759
                 $parsed[$key] = $val;
5760 5760
             }
@@ -5768,32 +5768,32 @@  discard block
 block discarded – undo
5768 5768
         );
5769 5769
 
5770 5770
         $nl = "\n";
5771
-        $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';
5772
-        $list .= '<p>' . $nl;
5773
-        $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';
5774
-        $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';
5775
-        $list .= '</p><br/>' . $nl;
5776
-        $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';
5777
-        $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';
5778
-        $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';
5779
-        $list .= '<br/>' . $nl;
5771
+        $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';
5772
+        $list .= '<p>'.$nl;
5773
+        $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';
5774
+        $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';
5775
+        $list .= '</p><br/>'.$nl;
5776
+        $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';
5777
+        $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';
5778
+        $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';
5779
+        $list .= '<br/>'.$nl;
5780 5780
         $first = true;
5781 5781
         foreach ($arrayParams as $param => $label) {
5782 5782
             if (isset($parsed[$param])) {
5783 5783
                 if ($first) {
5784
-                    $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;
5785
-                    $list .= '<ul class="docBlockList">' . $nl;
5784
+                    $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;
5785
+                    $list .= '<ul class="docBlockList">'.$nl;
5786 5786
                     $first = false;
5787 5787
                 }
5788
-                $list .= '    <li><strong>' . $label . '</strong>' . $nl;
5789
-                $list .= '        <ul>' . $nl;
5788
+                $list .= '    <li><strong>'.$label.'</strong>'.$nl;
5789
+                $list .= '        <ul>'.$nl;
5790 5790
                 foreach ($parsed[$param] as $val) {
5791
-                    $list .= '            <li>' . $val . '</li>' . $nl;
5791
+                    $list .= '            <li>'.$val.'</li>'.$nl;
5792 5792
                 }
5793
-                $list .= '        </ul></li>' . $nl;
5793
+                $list .= '        </ul></li>'.$nl;
5794 5794
             }
5795 5795
         }
5796
-        $list .= !$first ? '</ul>' . $nl : '';
5796
+        $list .= !$first ? '</ul>'.$nl : '';
5797 5797
 
5798 5798
         return $list;
5799 5799
     }
@@ -5869,7 +5869,7 @@  discard block
 block discarded – undo
5869 5869
      */
5870 5870
     public function addSnippet($name, $phpCode)
5871 5871
     {
5872
-        $this->snippetCache['#' . $name] = $phpCode;
5872
+        $this->snippetCache['#'.$name] = $phpCode;
5873 5873
     }
5874 5874
 
5875 5875
     /**
@@ -5878,7 +5878,7 @@  discard block
 block discarded – undo
5878 5878
      */
5879 5879
     public function addChunk($name, $text)
5880 5880
     {
5881
-        $this->chunkCache['#' . $name] = $text;
5881
+        $this->chunkCache['#'.$name] = $text;
5882 5882
     }
5883 5883
 
5884 5884
     /**
@@ -5914,7 +5914,7 @@  discard block
 block discarded – undo
5914 5914
         }
5915 5915
 
5916 5916
         if (!$isSafe) {
5917
-            $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);
5917
+            $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);
5918 5918
             $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50)));
5919 5919
             $this->messageQuit($title, '', true, '', '', 'Parser', $msg);
5920 5920
             return;
@@ -5928,7 +5928,7 @@  discard block
 block discarded – undo
5928 5928
             return 'array()';
5929 5929
         }
5930 5930
 
5931
-        $output = $echo . $return;
5931
+        $output = $echo.$return;
5932 5932
         modx_sanitize_gpc($output);
5933 5933
         return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous
5934 5934
     }
@@ -5946,8 +5946,8 @@  discard block
 block discarded – undo
5946 5946
 
5947 5947
         $safe = explode(',', $safe_functions);
5948 5948
 
5949
-        $phpcode = rtrim($phpcode, ';') . ';';
5950
-        $tokens = token_get_all('<?php ' . $phpcode);
5949
+        $phpcode = rtrim($phpcode, ';').';';
5950
+        $tokens = token_get_all('<?php '.$phpcode);
5951 5951
         foreach ($tokens as $i => $token) {
5952 5952
             if (!is_array($token)) {
5953 5953
                 continue;
@@ -5982,7 +5982,7 @@  discard block
 block discarded – undo
5982 5982
      */
5983 5983
     public function atBindFileContent($str = '')
5984 5984
     {
5985
-        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', '');
5985
+        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', '');
5986 5986
 
5987 5987
         if (stripos($str, '@FILE') !== 0) {
5988 5988
             return $str;
@@ -6005,7 +6005,7 @@  discard block
 block discarded – undo
6005 6005
         $errorMsg = sprintf("Could not retrieve string '%s'.", $str);
6006 6006
 
6007 6007
         foreach ($search_path as $path) {
6008
-            $file_path = MODX_BASE_PATH . $path . $str;
6008
+            $file_path = MODX_BASE_PATH.$path.$str;
6009 6009
             if (strpos($file_path, MODX_MANAGER_PATH) === 0) {
6010 6010
                 return $errorMsg;
6011 6011
             } elseif (is_file($file_path)) {
@@ -6019,7 +6019,7 @@  discard block
 block discarded – undo
6019 6019
             return $errorMsg;
6020 6020
         }
6021 6021
 
6022
-        $content = (string)file_get_contents($file_path);
6022
+        $content = (string) file_get_contents($file_path);
6023 6023
         if ($content === false) {
6024 6024
             return $errorMsg;
6025 6025
         }
@@ -6131,22 +6131,22 @@  discard block
 block discarded – undo
6131 6131
 
6132 6132
         $version = isset($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
6133 6133
         $release_date = isset($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
6134
-        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI'];
6134
+        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI'];
6135 6135
         $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);
6136 6136
         $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);
6137 6137
         $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);
6138 6138
         if ($is_error) {
6139 6139
             $str = '<h2 style="color:red">&laquo; Evo Parse Error &raquo;</h2>';
6140 6140
             if ($msg != 'PHP Parse Error') {
6141
-                $str .= '<h3 style="color:red">' . $msg . '</h3>';
6141
+                $str .= '<h3 style="color:red">'.$msg.'</h3>';
6142 6142
             }
6143 6143
         } else {
6144 6144
             $str = '<h2 style="color:#003399">&laquo; Evo Debug/ stop message &raquo;</h2>';
6145
-            $str .= '<h3 style="color:#003399">' . $msg . '</h3>';
6145
+            $str .= '<h3 style="color:#003399">'.$msg.'</h3>';
6146 6146
         }
6147 6147
 
6148 6148
         if (!empty($query)) {
6149
-            $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL &gt; <span id="sqlHolder">' . $query . '</span></div>';
6149
+            $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL &gt; <span id="sqlHolder">'.$query.'</span></div>';
6150 6150
         }
6151 6151
 
6152 6152
         $errortype = array(
@@ -6169,13 +6169,13 @@  discard block
 block discarded – undo
6169 6169
 
6170 6170
         if (!empty($nr) || !empty($file)) {
6171 6171
             if ($text != '') {
6172
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';
6172
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';
6173 6173
             }
6174 6174
             if ($output != '') {
6175
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';
6175
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';
6176 6176
             }
6177 6177
             if ($nr !== '') {
6178
-                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]");
6178
+                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]");
6179 6179
             }
6180 6180
             if ($file) {
6181 6181
                 $table[] = array('File', $file);
@@ -6194,7 +6194,7 @@  discard block
 block discarded – undo
6194 6194
         }
6195 6195
 
6196 6196
         if (!empty($this->event->activePlugin)) {
6197
-            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')');
6197
+            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')');
6198 6198
         }
6199 6199
 
6200 6200
         $str .= $MakeTable->create($table, array('Error information', ''));
@@ -6204,17 +6204,17 @@  discard block
 block discarded – undo
6204 6204
         $table[] = array('REQUEST_URI', $request_uri);
6205 6205
 
6206 6206
         if ($this->manager->action) {
6207
-            include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
6207
+            include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
6208 6208
             global $action_list;
6209 6209
             $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : '';
6210 6210
 
6211
-            $table[] = array('Manager action', $this->manager->action . $actionName);
6211
+            $table[] = array('Manager action', $this->manager->action.$actionName);
6212 6212
         }
6213 6213
 
6214 6214
         if (preg_match('@^[0-9]+@', $this->documentIdentifier)) {
6215 6215
             $resource = $this->getDocumentObject('id', $this->documentIdentifier);
6216 6216
             $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');
6217
-            $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>');
6217
+            $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>');
6218 6218
         }
6219 6219
         $table[] = array('Referer', $referer);
6220 6220
         $table[] = array('User Agent', $ua);
@@ -6235,7 +6235,7 @@  discard block
 block discarded – undo
6235 6235
 
6236 6236
         $mem = memory_get_peak_usage(true);
6237 6237
         $total_mem = $mem - $this->mstart;
6238
-        $total_mem = ($total_mem / 1024 / 1024) . ' mb';
6238
+        $total_mem = ($total_mem / 1024 / 1024).' mb';
6239 6239
 
6240 6240
         $queryTime = $this->queryTime;
6241 6241
         $phpTime = $totalTime - $queryTime;
@@ -6256,18 +6256,18 @@  discard block
 block discarded – undo
6256 6256
         $str .= $this->get_backtrace(debug_backtrace());
6257 6257
         // Log error
6258 6258
         if (!empty($this->currentSnippet)) {
6259
-            $source = 'Snippet - ' . $this->currentSnippet;
6259
+            $source = 'Snippet - '.$this->currentSnippet;
6260 6260
         } elseif (!empty($this->event->activePlugin)) {
6261
-            $source = 'Plugin - ' . $this->event->activePlugin;
6261
+            $source = 'Plugin - '.$this->event->activePlugin;
6262 6262
         } elseif ($source !== '') {
6263
-            $source = 'Parser - ' . $source;
6263
+            $source = 'Parser - '.$source;
6264 6264
         } elseif ($query !== '') {
6265 6265
             $source = 'SQL Query';
6266 6266
         } else {
6267 6267
             $source = 'Parser';
6268 6268
         }
6269 6269
         if ($msg) {
6270
-            $source .= ' / ' . $msg;
6270
+            $source .= ' / '.$msg;
6271 6271
         }
6272 6272
         if (isset($actionName) && !empty($actionName)) {
6273 6273
             $source .= $actionName;
@@ -6299,12 +6299,12 @@  discard block
 block discarded – undo
6299 6299
 
6300 6300
         // Display error
6301 6301
         if (isset($_SESSION['mgrValidated'])) {
6302
-            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager ' . $version . ' &raquo; ' . $release_date . '</title>
6302
+            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager '.$version.' &raquo; '.$release_date.'</title>
6303 6303
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6304
-                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />
6304
+                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />
6305 6305
                  <style type="text/css">body { padding:10px; } td {font:inherit;}</style>
6306 6306
                  </head><body>
6307
-                 ' . $str . '</body></html>';
6307
+                 ' . $str.'</body></html>';
6308 6308
         } else {
6309 6309
             echo 'Error';
6310 6310
         }
@@ -6341,7 +6341,7 @@  discard block
 block discarded – undo
6341 6341
             switch ($val['type']) {
6342 6342
                 case '->':
6343 6343
                 case '::':
6344
-                    $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];
6344
+                    $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];
6345 6345
                     break;
6346 6346
                 default:
6347 6347
                     $functionName = $val['function'];
@@ -6351,7 +6351,7 @@  discard block
 block discarded – undo
6351 6351
             $args = array_pad(array(), $_, '$var');
6352 6352
             $args = implode(", ", $args);
6353 6353
             $modx = &$this;
6354
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6354
+            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) {
6355 6355
                 $arg = $val['args'][$tmp - 1];
6356 6356
                 switch (true) {
6357 6357
                     case is_null($arg): {
@@ -6363,7 +6363,7 @@  discard block
 block discarded – undo
6363 6363
                         break;
6364 6364
                     }
6365 6365
                     case is_scalar($arg): {
6366
-                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'");
6366
+                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'");
6367 6367
                         break;
6368 6368
                     }
6369 6369
                     case is_bool($arg): {
@@ -6371,23 +6371,23 @@  discard block
 block discarded – undo
6371 6371
                         break;
6372 6372
                     }
6373 6373
                     case is_array($arg): {
6374
-                        $out = 'array $var' . $tmp;
6374
+                        $out = 'array $var'.$tmp;
6375 6375
                         break;
6376 6376
                     }
6377 6377
                     case is_object($arg): {
6378
-                        $out = get_class($arg) . ' $var' . $tmp;
6378
+                        $out = get_class($arg).' $var'.$tmp;
6379 6379
                         break;
6380 6380
                     }
6381 6381
                     default: {
6382
-                        $out = '$var' . $tmp;
6382
+                        $out = '$var'.$tmp;
6383 6383
                     }
6384 6384
                 }
6385 6385
                 $tmp++;
6386 6386
                 return $out;
6387 6387
             }, $args);
6388 6388
             $line = array(
6389
-                "<strong>" . $functionName . "</strong>(" . $args . ")",
6390
-                $path . " on line " . $val['line']
6389
+                "<strong>".$functionName."</strong>(".$args.")",
6390
+                $path." on line ".$val['line']
6391 6391
             );
6392 6392
             $table[] = array(implode("<br />", $line));
6393 6393
         }
@@ -6428,7 +6428,7 @@  discard block
 block discarded – undo
6428 6428
             $alias = strip_tags($alias); // strip HTML
6429 6429
             $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters
6430 6430
             $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash
6431
-            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one
6431
+            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one
6432 6432
             $alias = trim($alias, '-'); // trim excess
6433 6433
             return $alias;
6434 6434
         }
@@ -6444,7 +6444,7 @@  discard block
 block discarded – undo
6444 6444
         $precisions = count($sizes) - 1;
6445 6445
         foreach ($sizes as $unit => $bytes) {
6446 6446
             if ($size >= $bytes) {
6447
-                return number_format($size / $bytes, $precisions) . ' ' . $unit;
6447
+                return number_format($size / $bytes, $precisions).' '.$unit;
6448 6448
             }
6449 6449
             $precisions--;
6450 6450
         }
@@ -6548,10 +6548,10 @@  discard block
 block discarded – undo
6548 6548
 
6549 6549
         if (strpos($str, MODX_MANAGER_PATH) === 0) {
6550 6550
             return false;
6551
-        } elseif (is_file(MODX_BASE_PATH . $str)) {
6552
-            $file_path = MODX_BASE_PATH . $str;
6553
-        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) {
6554
-            $file_path = MODX_BASE_PATH . $tpl_dir . $str;
6551
+        } elseif (is_file(MODX_BASE_PATH.$str)) {
6552
+            $file_path = MODX_BASE_PATH.$str;
6553
+        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) {
6554
+            $file_path = MODX_BASE_PATH.$tpl_dir.$str;
6555 6555
         } else {
6556 6556
             return false;
6557 6557
         }
@@ -6677,7 +6677,7 @@  discard block
 block discarded – undo
6677 6677
             $title = 'no title';
6678 6678
         }
6679 6679
         if (is_array($msg)) {
6680
-            $msg = '<pre>' . print_r($msg, true) . '</pre>';
6680
+            $msg = '<pre>'.print_r($msg, true).'</pre>';
6681 6681
         } elseif ($msg === '') {
6682 6682
             $msg = $_SERVER['REQUEST_URI'];
6683 6683
         }
@@ -6721,7 +6721,7 @@  discard block
 block discarded – undo
6721 6721
         if (is_array($SystemAlertMsgQueque)) {
6722 6722
             $title = '';
6723 6723
             if ($this->name && $this->activePlugin) {
6724
-                $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>";
6724
+                $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>";
6725 6725
             }
6726 6726
             $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>";
6727 6727
         }
Please login to merge, or discard this patch.
Braces   +32 added lines, -17 removed lines patch added patch discarded remove patch
@@ -721,13 +721,15 @@  discard block
 block discarded – undo
721 721
             $this->virtualDir = '';
722 722
         }
723 723
 
724
-        if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */
724
+        if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) {
725
+/* we got an ID returned, check to make sure it's not an alias */
725 726
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
726 727
             if ($this->config['use_alias_path'] == 1) {
727 728
                 if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
728 729
                     $this->documentMethod = 'id';
729 730
                     return $q;
730
-                } else { /* not a valid id in terms of virtualDir, treat as alias */
731
+                } else {
732
+/* not a valid id in terms of virtualDir, treat as alias */
731 733
                     $this->documentMethod = 'alias';
732 734
                     return $q;
733 735
                 }
@@ -735,7 +737,8 @@  discard block
 block discarded – undo
735 737
                 $this->documentMethod = 'id';
736 738
                 return $q;
737 739
             }
738
-        } else { /* we didn't get an ID back, so instead we assume it's an alias */
740
+        } else {
741
+/* we didn't get an ID back, so instead we assume it's an alias */
739 742
             if ($this->config['friendly_alias_urls'] != 1) {
740 743
                 $q = $qOrig;
741 744
             }
@@ -1108,7 +1111,8 @@  discard block
 block discarded – undo
1108 1111
         $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0";
1109 1112
         $result_pub = $this->db->select('id', '[+prefix+]site_content', $where);
1110 1113
         $this->db->update($field, '[+prefix+]site_content', $where);
1111
-        if ($this->db->getRecordCount($result_pub) >= 1) { //Event unPublished doc
1114
+        if ($this->db->getRecordCount($result_pub) >= 1) {
1115
+//Event unPublished doc
1112 1116
             while ($row_pub = $this->db->getRow($result_pub)) {
1113 1117
                 $this->invokeEvent("OnDocUnPublished", array(
1114 1118
                     "docid" => $row_pub['id']
@@ -1121,7 +1125,8 @@  discard block
 block discarded – undo
1121 1125
         $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1";
1122 1126
         $result_unpub = $this->db->select('id', '[+prefix+]site_content', $where);
1123 1127
         $this->db->update($field, '[+prefix+]site_content', $where);
1124
-        if ($this->db->getRecordCount($result_unpub) >= 1) { //Event unPublished doc
1128
+        if ($this->db->getRecordCount($result_unpub) >= 1) {
1129
+//Event unPublished doc
1125 1130
             while ($row_unpub = $this->db->getRow($result_unpub)) {
1126 1131
                 $this->invokeEvent("OnDocUnPublished", array(
1127 1132
                     "docid" => $row_unpub['id']
@@ -1272,7 +1277,8 @@  discard block
 block discarded – undo
1272 1277
                         }
1273 1278
                     }
1274 1279
 
1275
-                    if (!in_array($fetch, $tags)) {  // Avoid double Matches
1280
+                    if (!in_array($fetch, $tags)) {
1281
+// Avoid double Matches
1276 1282
                         $tags[] = $fetch; // Fetch
1277 1283
                     };
1278 1284
                     $fetch = ''; // and reset
@@ -2057,7 +2063,8 @@  discard block
 block discarded – undo
2057 2063
      * @return mixed|string
2058 2064
      */
2059 2065
     public function _getSGVar($value)
2060
-    { // Get super globals
2066
+    {
2067
+// Get super globals
2061 2068
         $key = $value;
2062 2069
         $_ = $this->config['enable_filter'];
2063 2070
         $this->config['enable_filter'] = 1;
@@ -2462,7 +2469,8 @@  discard block
 block discarded – undo
2462 2469
         if ($this->config['friendly_urls'] == 1) {
2463 2470
             $aliases = array();
2464 2471
             if (is_array($this->documentListing)) {
2465
-                foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site!
2472
+                foreach ($this->documentListing as $path => $docid) {
2473
+// This is big Loop on large site!
2466 2474
                     $aliases[$docid] = $path;
2467 2475
                     $isfolder[$docid] = $this->aliasListing[$docid]['isfolder'];
2468 2476
                 }
@@ -2495,7 +2503,7 @@  discard block
 block discarded – undo
2495 2503
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2496 2504
             $pref = $this->config['friendly_url_prefix'];
2497 2505
             $suff = $this->config['friendly_url_suffix'];
2498
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2506
+            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){
2499 2507
                 global $modx;
2500 2508
                 $thealias = $aliases[$m[1]];
2501 2509
                 $thefolder = $isfolder[$m[1]];
@@ -4256,7 +4264,8 @@  discard block
 block discarded – undo
4256 4264
         if (isset($this->snippetCache[$snippetName])) {
4257 4265
             $snippet = $this->snippetCache[$snippetName];
4258 4266
             $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4259
-        } else { // not in cache so let's check the db
4267
+        } else {
4268
+// not in cache so let's check the db
4260 4269
             $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "'  AND ss.disabled=0;";
4261 4270
             $result = $this->db->query($sql);
4262 4271
             if ($this->db->getRecordCount($result) == 1) {
@@ -5234,10 +5243,12 @@  discard block
 block discarded – undo
5234 5243
             return '';
5235 5244
         } // nothing to register
5236 5245
         if (!is_array($options)) {
5237
-            if (is_bool($options)) {  // backward compatibility with old plaintext parameter
5246
+            if (is_bool($options)) {
5247
+// backward compatibility with old plaintext parameter
5238 5248
 
5239 5249
                 $options = array('plaintext' => $options);
5240
-            } elseif (is_string($options)) { // Also allow script name as 2nd param
5250
+            } elseif (is_string($options)) {
5251
+// Also allow script name as 2nd param
5241 5252
 
5242 5253
                 $options = array('name' => $options);
5243 5254
             } else {
@@ -5251,7 +5262,8 @@  discard block
 block discarded – undo
5251 5262
         unset($overwritepos); // probably unnecessary--just making sure
5252 5263
 
5253 5264
         $useThisVer = true;
5254
-        if (isset($this->loadedjscripts[$key])) { // a matching script was found
5265
+        if (isset($this->loadedjscripts[$key])) {
5266
+// a matching script was found
5255 5267
             // if existing script is a startup script, make sure the candidate is also a startup script
5256 5268
             if ($this->loadedjscripts[$key]['startup']) {
5257 5269
                 $startup = true;
@@ -5271,7 +5283,8 @@  discard block
 block discarded – undo
5271 5283
                     // overwrite the old script (the position may be important for dependent scripts)
5272 5284
                     $overwritepos = $this->loadedjscripts[$key]['pos'];
5273 5285
                 }
5274
-            } else { // Use the original version
5286
+            } else {
5287
+// Use the original version
5275 5288
                 if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) {
5276 5289
                     // need to move the exisiting script to the head
5277 5290
                     $version = $this->loadedjscripts[$key][$version];
@@ -5396,7 +5409,8 @@  discard block
 block discarded – undo
5396 5409
         }
5397 5410
 
5398 5411
         $results = null;
5399
-        foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop
5412
+        foreach ($this->pluginEvent[$evtName] as $pluginName) {
5413
+// start for loop
5400 5414
             if ($this->dumpPlugins) {
5401 5415
                 $eventtime = $this->getMicroTime();
5402 5416
             }
@@ -5939,7 +5953,8 @@  discard block
 block discarded – undo
5939 5953
      * @return bool
5940 5954
      */
5941 5955
     public function isSafeCode($phpcode = '', $safe_functions = '')
5942
-    { // return true or false
5956
+    {
5957
+// return true or false
5943 5958
         if ($safe_functions == '') {
5944 5959
             return false;
5945 5960
         }
@@ -6351,7 +6366,7 @@  discard block
 block discarded – undo
6351 6366
             $args = array_pad(array(), $_, '$var');
6352 6367
             $args = implode(", ", $args);
6353 6368
             $modx = &$this;
6354
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6369
+            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){
6355 6370
                 $arg = $val['args'][$tmp - 1];
6356 6371
                 switch (true) {
6357 6372
                     case is_null($arg): {
Please login to merge, or discard this patch.
manager/includes/extenders/maketable.class.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function setTableWidth($value)
132 132
     {
133
-        $this->tableWidth = (int)$value;
133
+        $this->tableWidth = (int) $value;
134 134
     }
135 135
 
136 136
     /**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     {
318 318
         $currentWidth = '';
319 319
         if (is_array($this->columnWidths)) {
320
-            $currentWidth = $this->columnWidths[$columnPosition] ? ' width="' . $this->columnWidths[$columnPosition] . '" ' : '';
320
+            $currentWidth = $this->columnWidths[$columnPosition] ? ' width="'.$this->columnWidths[$columnPosition].'" ' : '';
321 321
         }
322 322
 
323 323
         return $currentWidth;
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
             $currentClass = $this->rowAlternateClass;
347 347
         }
348 348
 
349
-        return ' class="' . $currentClass . '"';
349
+        return ' class="'.$currentClass.'"';
350 350
     }
351 351
 
352 352
     /**
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
     {
361 361
         $cellAction = '';
362 362
         if ($this->cellAction) {
363
-            $cellAction = ' onClick="javascript:window.location=\'' . $this->cellAction . $this->actionField . '=' . urlencode($currentActionFieldValue) . '\'" ';
363
+            $cellAction = ' onClick="javascript:window.location=\''.$this->cellAction.$this->actionField.'='.urlencode($currentActionFieldValue).'\'" ';
364 364
         }
365 365
 
366 366
         return $cellAction;
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
     {
378 378
         $cell = $value;
379 379
         if ($this->linkAction) {
380
-            $cell = '<a href="' . $this->linkAction . $this->actionField . '=' . urlencode($currentActionFieldValue) . '">' . $cell . '</a>';
380
+            $cell = '<a href="'.$this->linkAction.$this->actionField.'='.urlencode($currentActionFieldValue).'">'.$cell.'</a>';
381 381
         }
382 382
 
383 383
         return $cell;
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
             $end = '?';
407 407
         }
408 408
 
409
-        return $link . $end;
409
+        return $link.$end;
410 410
     }
411 411
 
412 412
     /**
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
         if (is_array($fieldsArray)) {
427 427
             $i = 0;
428 428
             foreach ($fieldsArray as $fieldName => $fieldValue) {
429
-                $table .= "\t<tr" . $this->determineRowClass($i) . ">\n";
429
+                $table .= "\t<tr".$this->determineRowClass($i).">\n";
430 430
                 $currentActionFieldValue = $fieldValue[$this->actionField];
431 431
                 if (is_array($this->selectedValues)) {
432 432
                     $isChecked = array_search($currentActionFieldValue, $this->selectedValues) === false ? 0 : 1;
@@ -437,15 +437,15 @@  discard block
 block discarded – undo
437 437
                 $colPosition = 0;
438 438
                 foreach ($fieldValue as $key => $value) {
439 439
                     if (!in_array($key, $this->excludeFields)) {
440
-                        $table .= "\t\t<td" . $this->getCellAction($currentActionFieldValue) . ">";
440
+                        $table .= "\t\t<td".$this->getCellAction($currentActionFieldValue).">";
441 441
                         $table .= $this->createCellText($currentActionFieldValue, $value);
442 442
                         $table .= "</td>\n";
443 443
                         if ($i == 0) {
444 444
                             if (empty($header) && $this->formElementType) {
445
-                                $header .= "\t\t<th style=\"width:32px\" " . ($this->thClass ? 'class="' . $this->thClass . '"' : '') . ">" . ($this->allOption ? '<a href="javascript:clickAll()">all</a>' : '') . "</th>\n";
445
+                                $header .= "\t\t<th style=\"width:32px\" ".($this->thClass ? 'class="'.$this->thClass.'"' : '').">".($this->allOption ? '<a href="javascript:clickAll()">all</a>' : '')."</th>\n";
446 446
                             }
447 447
                             $headerText = array_key_exists($key, $fieldHeadersArray) ? $fieldHeadersArray[$key] : $key;
448
-                            $header .= "\t\t<th" . $this->getColumnWidth($colPosition) . ($this->thClass ? ' class="' . $this->thClass . '" ' : '') . ">" . $headerText . "</th>\n";
448
+                            $header .= "\t\t<th".$this->getColumnWidth($colPosition).($this->thClass ? ' class="'.$this->thClass.'" ' : '').">".$headerText."</th>\n";
449 449
                         }
450 450
                         $colPosition++;
451 451
                     }
@@ -453,9 +453,9 @@  discard block
 block discarded – undo
453 453
                 $i++;
454 454
                 $table .= "\t</tr>\n";
455 455
             }
456
-            $table = "\n" . '<table' . ($this->tableWidth > 0 ? ' width="' . $this->tableWidth . '"' : '') . ($this->tableClass ? ' class="' . $this->tableClass . '"' : '') . ($this->tableID ? ' id="' . $this->tableID . '"' : '') . ">\n" . ($header ? "\t<thead>\n\t<tr class=\"" . $this->rowHeaderClass . "\">\n" . $header . "\t</tr>\n\t</thead>\n" : '') . $table . "</table>\n";
456
+            $table = "\n".'<table'.($this->tableWidth > 0 ? ' width="'.$this->tableWidth.'"' : '').($this->tableClass ? ' class="'.$this->tableClass.'"' : '').($this->tableID ? ' id="'.$this->tableID.'"' : '').">\n".($header ? "\t<thead>\n\t<tr class=\"".$this->rowHeaderClass."\">\n".$header."\t</tr>\n\t</thead>\n" : '').$table."</table>\n";
457 457
             if ($this->formElementType) {
458
-                $table = "\n" . '<form id="' . $this->formName . '" name="' . $this->formName . '" action="' . $this->formAction . '" method="POST">' . $table;
458
+                $table = "\n".'<form id="'.$this->formName.'" name="'.$this->formName.'" action="'.$this->formAction.'" method="POST">'.$table;
459 459
             }
460 460
             if (strlen($this->pageNav) > 1) {//changed to display the pagination if exists.
461 461
                 /* commented this part because of cookie
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 
470 470
                 $table .= '</select>'.$_lang["pagination_table_perpage"].'</div>';
471 471
                 */
472
-                $table .= '<div id="pagination" class="paginate">' . $_lang["pagination_table_gotopage"] . '<ul>' . $this->pageNav . '</ul></div>';
472
+                $table .= '<div id="pagination" class="paginate">'.$_lang["pagination_table_gotopage"].'<ul>'.$this->pageNav.'</ul></div>';
473 473
                 //$table .= '<script language="javascript">function updatePageSize(size){window.location = \''.$this->prepareLink($linkpage).'pageSize=\'+size;}</script>';
474 474
             }
475 475
             if ($this->allOption) {
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 <script language="javascript">
478 478
 	toggled = 0;
479 479
 	function clickAll() {
480
-		myform = document.getElementById("' . $this->formName . '");
480
+		myform = document.getElementById("' . $this->formName.'");
481 481
 		for(i=0;i<myform.length;i++) {
482 482
 			if(myform.elements[i].type==\'checkbox\') {
483 483
 				myform.elements[i].checked=(toggled?false:true);
@@ -489,9 +489,9 @@  discard block
 block discarded – undo
489 489
             }
490 490
             if ($this->formElementType) {
491 491
                 if ($this->extra) {
492
-                    $table .= "\n" . $this->extra . "\n";
492
+                    $table .= "\n".$this->extra."\n";
493 493
                 }
494
-                $table .= "\n" . '</form>' . "\n";
494
+                $table .= "\n".'</form>'."\n";
495 495
             }
496 496
 
497 497
             return $table;
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
         $numPages = ceil($numRecords / MAX_DISPLAY_RECORDS_NUM);
515 515
         $nav = '';
516 516
         if ($numPages > 1) {
517
-            $currentURL = empty($qs) ? '' : '?' . $qs;
517
+            $currentURL = empty($qs) ? '' : '?'.$qs;
518 518
             if ($currentPage > 6) {
519 519
                 $nav .= $this->createPageLink($currentURL, 1, $_lang["pagination_table_first"]);
520 520
             }
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
                 $nav .= $this->createPageLink($currentURL, $numPages, $_lang["pagination_table_last"]);
540 540
             }
541 541
         }
542
-        $this->pageNav = ' ' . $nav;
542
+        $this->pageNav = ' '.$nav;
543 543
     }
544 544
 
545 545
     /**
@@ -555,14 +555,14 @@  discard block
 block discarded – undo
555 555
     public function createPageLink($link = '', $pageNum, $displayText, $currentPage = false, $qs = '')
556 556
     {
557 557
         $modx = evolutionCMS();
558
-        $orderBy = !empty($_GET['orderby']) ? '&orderby=' . $_GET['orderby'] : '';
559
-        $orderDir = !empty($_GET['orderdir']) ? '&orderdir=' . $_GET['orderdir'] : '';
558
+        $orderBy = !empty($_GET['orderby']) ? '&orderby='.$_GET['orderby'] : '';
559
+        $orderDir = !empty($_GET['orderdir']) ? '&orderdir='.$_GET['orderdir'] : '';
560 560
         if (!empty($qs)) {
561 561
             $qs = "?$qs";
562 562
         }
563 563
         $link = empty($link) ? $modx->makeUrl($modx->documentIdentifier, $modx->documentObject['alias'],
564
-            $qs . "page=$pageNum$orderBy$orderDir") : $this->prepareLink($link) . "page=$pageNum";
565
-        $nav = '<li' . ($currentPage ? ' class="currentPage"' : '') . '><a' . ($currentPage ? ' class="currentPage"' : '') . ' href="' . $link . '">' . $displayText . '</a></li>' . "\n";
564
+            $qs."page=$pageNum$orderBy$orderDir") : $this->prepareLink($link)."page=$pageNum";
565
+        $nav = '<li'.($currentPage ? ' class="currentPage"' : '').'><a'.($currentPage ? ' class="currentPage"' : '').' href="'.$link.'">'.$displayText.'</a></li>'."\n";
566 566
 
567 567
         return $nav;
568 568
     }
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
         $field = '';
581 581
         if ($this->formElementType) {
582 582
             $checked = $isChecked ? "checked " : "";
583
-            $field = "\t\t" . '<td><input type="' . $this->formElementType . '" name="' . ($this->formElementName ? $this->formElementName : $value) . '"  value="' . $value . '" ' . $checked . '/></td>' . "\n";
583
+            $field = "\t\t".'<td><input type="'.$this->formElementType.'" name="'.($this->formElementName ? $this->formElementName : $value).'"  value="'.$value.'" '.$checked.'/></td>'."\n";
584 584
         }
585 585
 
586 586
         return $field;
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
     public function handlePaging()
595 595
     {
596 596
         $offset = (is_numeric($_GET['page']) && $_GET['page'] > 0) ? $_GET['page'] - 1 : 0;
597
-        $limitClause = ' LIMIT ' . ($offset * MAX_DISPLAY_RECORDS_NUM) . ', ' . MAX_DISPLAY_RECORDS_NUM;
597
+        $limitClause = ' LIMIT '.($offset * MAX_DISPLAY_RECORDS_NUM).', '.MAX_DISPLAY_RECORDS_NUM;
598 598
 
599 599
         return $limitClause;
600 600
     }
@@ -609,10 +609,10 @@  discard block
 block discarded – undo
609 609
     public function handleSorting($natural_order = false)
610 610
     {
611 611
         $orderByClause = '';
612
-        if ((bool)$natural_order === false) {
612
+        if ((bool) $natural_order === false) {
613 613
             $orderby = !empty($_GET['orderby']) ? $_GET['orderby'] : "id";
614 614
             $orderdir = !empty($_GET['orderdir']) ? $_GET['orderdir'] : "DESC";
615
-            $orderByClause = !empty($orderby) ? ' ORDER BY ' . $orderby . ' ' . $orderdir . ' ' : "";
615
+            $orderByClause = !empty($orderby) ? ' ORDER BY '.$orderby.' '.$orderdir.' ' : "";
616 616
         }
617 617
 
618 618
         return $orderByClause;
@@ -641,6 +641,6 @@  discard block
 block discarded – undo
641 641
             }
642 642
         }
643 643
 
644
-        return '<a href="[~' . $modx->documentIdentifier . '~]?' . $qs . 'orderby=' . $key . $orderDir . '">' . $text . '</a>';
644
+        return '<a href="[~'.$modx->documentIdentifier.'~]?'.$qs.'orderby='.$key.$orderDir.'">'.$text.'</a>';
645 645
     }
646 646
 }
Please login to merge, or discard this patch.
manager/includes/extenders/dbapi.mysqli.class.inc.php 2 patches
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         $pre = null,
31 31
         $charset = '',
32 32
         $connection_method = 'SET CHARACTER SET'
33
-    ) {
33
+    ){
34 34
         $this->config['host'] = $host ? $host : $GLOBALS['database_server'];
35 35
         $this->config['dbase'] = $dbase ? $dbase : $GLOBALS['dbase'];
36 36
         $this->config['user'] = $uid ? $uid : $GLOBALS['database_user'];
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                         $ua = $modx->htmlspecialchars($_SERVER['HTTP_USER_AGENT']);
71 71
                         $referer = $modx->htmlspecialchars($_SERVER['HTTP_REFERER']);
72 72
                         $modx->sendmail(array(
73
-                            'subject' => 'Missing to create the database connection! from ' . $modx->config['site_name'],
73
+                            'subject' => 'Missing to create the database connection! from '.$modx->config['site_name'],
74 74
                             'body'    => "{$logtitle}\n{$request_uri}\n{$ua}\n{$referer}",
75 75
                             'type'    => 'text'
76 76
                         ));
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
             $tend = $modx->getMicroTime();
86 86
             $totaltime = $tend - $tstart;
87 87
             if ($modx->dumpSQL) {
88
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>" . sprintf("Database connection was created in %2.4f s",
89
-                        $totaltime) . "</fieldset><br />";
88
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>".sprintf("Database connection was created in %2.4f s",
89
+                        $totaltime)."</fieldset><br />";
90 90
             }
91 91
             $this->conn->set_charset($this->config['charset']);
92 92
             $this->isConnected = true;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         if (1000 < $safeCount) {
120 120
             exit("Too many loops '{$safeCount}'");
121 121
         }
122
-        if (! ($this->conn instanceof mysqli)) {
122
+        if (!($this->conn instanceof mysqli)) {
123 123
             $this->connect();
124 124
         }
125 125
         if (is_array($s)) {
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     public function query($sql, $watchError = true)
146 146
     {
147 147
         $modx = evolutionCMS();
148
-        if (! ($this->conn instanceof mysqli)) {
148
+        if (!($this->conn instanceof mysqli)) {
149 149
             $this->connect();
150 150
         }
151 151
         $tStart = $modx->getMicroTime();
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                 case 1091:
166 166
                     break;
167 167
                 default:
168
-                    $modx->messageQuit('Execution of a query to the database failed - ' . $this->getLastError(), $sql);
168
+                    $modx->messageQuit('Execution of a query to the database failed - '.$this->getLastError(), $sql);
169 169
             }
170 170
         } else {
171 171
             $tend = $modx->getMicroTime();
@@ -179,24 +179,24 @@  discard block
 block discarded – undo
179 179
                     $debug_path[] = $line['function'];
180 180
                 }
181 181
                 $debug_path = implode(' > ', array_reverse($debug_path));
182
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query " . ($modx->executedQueries + 1) . " - " . sprintf("%2.2f ms",
183
-                        $totalTime * 1000) . "</legend>";
184
-                $modx->queryCode .= $sql . '<br><br>';
182
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query ".($modx->executedQueries + 1)." - ".sprintf("%2.2f ms",
183
+                        $totalTime * 1000)."</legend>";
184
+                $modx->queryCode .= $sql.'<br><br>';
185 185
                 if ($modx->event->name) {
186
-                    $modx->queryCode .= 'Current Event  => ' . $modx->event->name . '<br>';
186
+                    $modx->queryCode .= 'Current Event  => '.$modx->event->name.'<br>';
187 187
                 }
188 188
                 if ($modx->event->activePlugin) {
189
-                    $modx->queryCode .= 'Current Plugin => ' . $modx->event->activePlugin . '<br>';
189
+                    $modx->queryCode .= 'Current Plugin => '.$modx->event->activePlugin.'<br>';
190 190
                 }
191 191
                 if ($modx->currentSnippet) {
192
-                    $modx->queryCode .= 'Current Snippet => ' . $modx->currentSnippet . '<br>';
192
+                    $modx->queryCode .= 'Current Snippet => '.$modx->currentSnippet.'<br>';
193 193
                 }
194 194
                 if (stripos($sql, 'select') === 0) {
195
-                    $modx->queryCode .= 'Record Count => ' . $this->getRecordCount($result) . '<br>';
195
+                    $modx->queryCode .= 'Record Count => '.$this->getRecordCount($result).'<br>';
196 196
                 } else {
197
-                    $modx->queryCode .= 'Affected Rows => ' . $this->getAffectedRows() . '<br>';
197
+                    $modx->queryCode .= 'Affected Rows => '.$this->getAffectedRows().'<br>';
198 198
                 }
199
-                $modx->queryCode .= 'Functions Path => ' . $debug_path . '<br>';
199
+                $modx->queryCode .= 'Functions Path => '.$debug_path.'<br>';
200 200
                 $modx->queryCode .= "</fieldset><br />";
201 201
             }
202 202
             $modx->executedQueries++;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
         $modx = evolutionCMS();
296 296
         $out = false;
297 297
         if (!$table) {
298
-            $modx->messageQuit('Empty ' . $table . ' parameter in DBAPI::update().');
298
+            $modx->messageQuit('Empty '.$table.' parameter in DBAPI::update().');
299 299
         } else {
300 300
             $table = $this->replaceFullTableName($table);
301 301
             if (is_array($fields)) {
@@ -303,18 +303,18 @@  discard block
 block discarded – undo
303 303
                     if ($value === null || strtolower($value) === 'null') {
304 304
                         $f = 'NULL';
305 305
                     } else {
306
-                        $f = "'" . $value . "'";
306
+                        $f = "'".$value."'";
307 307
                     }
308
-                    $fields[$key] = "`{$key}` = " . $f;
308
+                    $fields[$key] = "`{$key}` = ".$f;
309 309
                 }
310 310
                 $fields = implode(',', $fields);
311 311
             }
312 312
             $where = trim($where);
313 313
             if ($where !== '' && stripos($where, 'WHERE') !== 0) {
314
-                $where = 'WHERE ' . $where;
314
+                $where = 'WHERE '.$where;
315 315
             }
316 316
 
317
-            return $this->query('UPDATE ' . $table . ' SET ' . $fields . ' ' . $where);
317
+            return $this->query('UPDATE '.$table.' SET '.$fields.' '.$where);
318 318
         }
319 319
         return $out;
320 320
     }
@@ -340,12 +340,12 @@  discard block
 block discarded – undo
340 340
                 $this->query("INSERT INTO {$intotable} {$fields}");
341 341
             } else {
342 342
                 if (empty($fromtable)) {
343
-                    $fields = "(`" . implode("`, `", array_keys($fields)) . "`) VALUES('" . implode("', '",
344
-                            array_values($fields)) . "')";
343
+                    $fields = "(`".implode("`, `", array_keys($fields))."`) VALUES('".implode("', '",
344
+                            array_values($fields))."')";
345 345
                     $this->query("INSERT INTO {$intotable} {$fields}");
346 346
                 } else {
347 347
                     $fromtable = $this->replaceFullTableName($fromtable);
348
-                    $fields = "(" . implode(",", array_keys($fields)) . ")";
348
+                    $fields = "(".implode(",", array_keys($fields)).")";
349 349
                     $where = trim($where);
350 350
                     $limit = trim($limit);
351 351
                     if ($where !== '' && stripos($where, 'WHERE') !== 0) {
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
      */
440 440
     public function getInsertId($conn = null)
441 441
     {
442
-        if (! ($conn instanceof mysqli)) {
443
-            $conn =& $this->conn;
442
+        if (!($conn instanceof mysqli)) {
443
+            $conn = & $this->conn;
444 444
         }
445 445
 
446 446
         return $conn->insert_id;
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
      */
453 453
     public function getAffectedRows($conn = null)
454 454
     {
455
-        if (! ($conn instanceof mysqli)) {
456
-            $conn =& $this->conn;
455
+        if (!($conn instanceof mysqli)) {
456
+            $conn = & $this->conn;
457 457
         }
458 458
 
459 459
         return $conn->affected_rows;
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
      */
466 466
     public function getLastError($conn = null)
467 467
     {
468
-        if (! ($conn instanceof mysqli)) {
469
-            $conn =& $this->conn;
468
+        if (!($conn instanceof mysqli)) {
469
+            $conn = & $this->conn;
470 470
         }
471 471
 
472 472
         return $conn->error;
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
     public function getColumn($name, $dsq)
521 521
     {
522 522
         $col = array();
523
-        if (! ($dsq instanceof mysqli_result)) {
523
+        if (!($dsq instanceof mysqli_result)) {
524 524
             $dsq = $this->query($dsq);
525 525
         }
526 526
         if ($dsq) {
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
     public function getColumnNames($dsq)
540 540
     {
541 541
         $names = array();
542
-        if (! ($dsq instanceof mysqli_result)) {
542
+        if (!($dsq instanceof mysqli_result)) {
543 543
             $dsq = $this->query($dsq);
544 544
         }
545 545
         if ($dsq) {
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
     public function getValue($dsq)
560 560
     {
561 561
         $out = false;
562
-        if (! ($dsq instanceof mysqli_result)) {
562
+        if (!($dsq instanceof mysqli_result)) {
563 563
             $dsq = $this->query($dsq);
564 564
         }
565 565
         if ($dsq) {
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
     {
579 579
         $metadata = array();
580 580
         if (!empty($table) && is_scalar($table)) {
581
-            $sql = 'SHOW FIELDS FROM ' . $table;
581
+            $sql = 'SHOW FIELDS FROM '.$table;
582 582
             if ($ds = $this->query($sql)) {
583 583
                 while ($row = $this->getRow($ds)) {
584 584
                     $fieldName = $row['Field'];
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
         $tableName = trim($tableName);
658 658
         $dbase = trim($this->config['dbase'], '`');
659 659
         $prefix = $this->config['table_prefix'];
660
-        if ((bool)$force === true) {
660
+        if ((bool) $force === true) {
661 661
             $result = "`{$dbase}`.`{$prefix}{$tableName}`";
662 662
         } elseif (strpos($tableName, '[+prefix+]') !== false) {
663 663
             $result = preg_replace('@\[\+prefix\+\]([0-9a-zA-Z_]+)@', "`{$dbase}`.`{$prefix}$1`", $tableName);
@@ -674,9 +674,9 @@  discard block
 block discarded – undo
674 674
      */
675 675
     public function optimize($table_name)
676 676
     {
677
-        $rs = $this->query('OPTIMIZE TABLE ' . $table_name);
677
+        $rs = $this->query('OPTIMIZE TABLE '.$table_name);
678 678
         if ($rs) {
679
-            $rs = $this->query('ALTER TABLE ' . $table_name);
679
+            $rs = $this->query('ALTER TABLE '.$table_name);
680 680
         }
681 681
 
682 682
         return $rs;
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
      */
689 689
     public function truncate($table_name)
690 690
     {
691
-        return $this->query('TRUNCATE ' . $table_name);
691
+        return $this->query('TRUNCATE '.$table_name);
692 692
     }
693 693
 
694 694
     /**
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
         $_ = array();
715 715
         foreach ($fields as $k => $v) {
716 716
             if ($k !== $v) {
717
-                $_[] = $v . ' as ' . $k;
717
+                $_[] = $v.' as '.$k;
718 718
             } else {
719 719
                 $_[] = $v;
720 720
             }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -373,7 +373,8 @@
 block discarded – undo
373 373
      * @return bool|mixed|mysqli_result
374 374
      */
375 375
     public function save($fields, $table, $where = '')
376
-    { // This is similar to "replace into table".
376
+    {
377
+// This is similar to "replace into table".
377 378
 
378 379
         if ($where === '') {
379 380
             $mode = 'insert';
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_summary.inc.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -2,23 +2,23 @@  discard block
 block discarded – undo
2 2
 if (strpos($opt, ',')) {
3 3
     list($limit, $delim) = explode(',', $opt);
4 4
 } elseif (preg_match('/^[1-9][0-9]*$/', $opt)) {
5
-    $limit=$opt;
6
-    $delim='';
5
+    $limit = $opt;
6
+    $delim = '';
7 7
 } else {
8
-    $limit=124;
9
-    $delim='';
8
+    $limit = 124;
9
+    $delim = '';
10 10
 }
11 11
 
12
-if ($delim==='') {
13
-    $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.';
12
+if ($delim === '') {
13
+    $delim = $modx->config['manager_language'] === 'japanese-utf8' ? '。' : '.';
14 14
 }
15
-$limit = (int)$limit;
15
+$limit = (int) $limit;
16 16
 
17 17
 $content = $modx->filter->parseDocumentSource($value);
18 18
 
19 19
 $content = strip_tags($content);
20 20
 
21
-$content = str_replace(array("\r\n","\r","\n","\t",'&nbsp;'), ' ', $content);
21
+$content = str_replace(array("\r\n", "\r", "\n", "\t", '&nbsp;'), ' ', $content);
22 22
 if (preg_match('/\s+/', $content)) {
23 23
     $content = preg_replace('/\s+/', ' ', $content);
24 24
 }
@@ -26,30 +26,30 @@  discard block
 block discarded – undo
26 26
 
27 27
 $pos = $modx->filter->strpos($content, $delim);
28 28
 
29
-if ($pos!==false && $pos<$limit) {
29
+if ($pos !== false && $pos < $limit) {
30 30
     $_ = explode($delim, $content);
31 31
     $text = '';
32 32
     foreach ($_ as $v) {
33
-        if ($limit <= $modx->filter->strlen($text . $v . $delim)) {
33
+        if ($limit <= $modx->filter->strlen($text.$v.$delim)) {
34 34
             break;
35 35
         }
36
-        $text .= $v . $delim;
36
+        $text .= $v.$delim;
37 37
     }
38 38
     if ($text) {
39 39
         $content = $text;
40 40
     }
41 41
 }
42 42
 
43
-if ($limit<$modx->filter->strlen($content) && strpos($content, ' ')!==false) {
43
+if ($limit < $modx->filter->strlen($content) && strpos($content, ' ') !== false) {
44 44
     $_ = explode(' ', $content);
45 45
     $text = '';
46 46
     foreach ($_ as $v) {
47
-        if ($limit <= $modx->filter->strlen($text . $v . ' ')) {
47
+        if ($limit <= $modx->filter->strlen($text.$v.' ')) {
48 48
             break;
49 49
         }
50
-        $text .= $v . ' ';
50
+        $text .= $v.' ';
51 51
     }
52
-    if ($text!=='') {
52
+    if ($text !== '') {
53 53
         $content = $text;
54 54
     }
55 55
 }
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 if ($limit < $modx->filter->strlen($content)) {
58 58
     $content = $modx->filter->substr($content, 0, $limit);
59 59
 }
60
-if ($modx->filter->substr($content, -1)==$delim) {
61
-    $content = rtrim($content, $delim) . $delim;
60
+if ($modx->filter->substr($content, -1) == $delim) {
61
+    $content = rtrim($content, $delim).$delim;
62 62
 }
63 63
 
64 64
 return $content;
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_getimage.inc.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 $pattern = '/<img[\s\n]+.*src=[\s\n]*"([^"]+\.(jpg|jpeg|png|gif))"[^>]+>/i';
3 3
 preg_match_all($pattern, $value, $images);
4
-if ($opt==='') {
4
+if ($opt === '') {
5 5
     if ($images[1][0]) {
6 6
         return $images[1][0];
7 7
     } else {
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     }
10 10
 } else {
11 11
     foreach ($images[0] as $i=>$image) {
12
-        if (strpos($image, $opt)!==false) {
12
+        if (strpos($image, $opt) !== false) {
13 13
             return $images[1][$i];
14 14
         }
15 15
     }
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_addbreak.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 $text = $modx->filter->parseDocumentSource($value);
3
-$text = str_replace(array("\r\n","\r"), "\n", $text);
3
+$text = str_replace(array("\r\n", "\r"), "\n", $text);
4 4
 
5 5
 $blockElms  = 'br,table,tbody,tr,td,th,thead,tfoot,caption,colgroup,div';
6 6
 $blockElms .= ',dl,dd,dt,ul,ol,li,pre,select,option,form,map,area,blockquote';
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
 $c = count($lines);
12 12
 foreach ($lines as $i=>$line) {
13 13
     $line = rtrim($line);
14
-    if ($i===$c-1) {
14
+    if ($i === $c - 1) {
15 15
         break;
16 16
     }
17 17
     foreach ($blockElms as $block) {
18
-        if (preg_match("@</?{$block}" . '[^>]*>$@', $line)) {
18
+        if (preg_match("@</?{$block}".'[^>]*>$@', $line)) {
19 19
             continue 2;
20 20
         }
21 21
     }
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_memberof.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 $userID = abs($modx->getLoginUserID('web'));
3
-$modx->qs_hash = md5($modx->qs_hash . "^{$userID}^");
3
+$modx->qs_hash = md5($modx->qs_hash."^{$userID}^");
4 4
 
5 5
 $groupNames = ($this->strlen($opt) > 0) ? explode(',', $opt) : array();
6 6
 
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_wordwrap.inc.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1 1
 <?php
2
-return preg_replace_callback("~(\b\w+\b)~", function ($m) use ($wrapat) {
2
+return preg_replace_callback("~(\b\w+\b)~", function($m) use ($wrapat) {
3 3
     return wordwrap($m[1], $wrapat, ' ', 1);
4 4
 }, $value);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1 1
 <?php
2
-return preg_replace_callback("~(\b\w+\b)~", function ($m) use ($wrapat) {
2
+return preg_replace_callback("~(\b\w+\b)~", function ($m) use ($wrapat){
3 3
     return wordwrap($m[1], $wrapat, ' ', 1);
4 4
 }, $value);
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_moduser.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-$userid = (int)$value;
2
+$userid = (int) $value;
3 3
 if (!isset($modx->filter->cache['ui'][$userid])) {
4 4
     if ($userid < 0) {
5 5
         $user = $modx->getWebUserInfo(abs($userid));
Please login to merge, or discard this patch.