Completed
Push — develop ( 4e806c...6a553b )
by Agel_Nash
10:03
created
manager/includes/secure_mgr_documents.inc.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@
 block discarded – undo
20 20
         ($docid > 0 ? "id='$docid'" : "privatemgr = 1"));
21 21
     $rs = $modx->getDatabase()->select(
22 22
         'DISTINCT sc.id',
23
-        $modx->getDatabase()->getFullTableName("site_content") . " sc
24
-			LEFT JOIN " . $modx->getDatabase()->getFullTableName("document_groups") . " dg ON dg.document = sc.id
25
-			LEFT JOIN " . $modx->getDatabase()->getFullTableName("membergroup_access") . " mga ON mga.documentgroup = dg.document_group",
26
-        ($docid > 0 ? " sc.id='{$docid}' AND " : "") . "mga.id>0"
23
+        $modx->getDatabase()->getFullTableName("site_content")." sc
24
+			LEFT JOIN " . $modx->getDatabase()->getFullTableName("document_groups")." dg ON dg.document = sc.id
25
+			LEFT JOIN " . $modx->getDatabase()->getFullTableName("membergroup_access")." mga ON mga.documentgroup = dg.document_group",
26
+        ($docid > 0 ? " sc.id='{$docid}' AND " : "")."mga.id>0"
27 27
     );
28 28
     $ids = $modx->getDatabase()->getColumn("id", $rs);
29 29
     if (count($ids) > 0) {
30 30
         $modx->getDatabase()->update('privatemgr = 1', $modx->getDatabase()->getFullTableName("site_content"),
31
-            "id IN (" . implode(", ", $ids) . ")");
31
+            "id IN (".implode(", ", $ids).")");
32 32
     }
33 33
 }
Please login to merge, or discard this patch.
manager/includes/messageCount.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,15 +4,15 @@
 block discarded – undo
4 4
 }
5 5
 
6 6
 $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('user_messages'),
7
-    "recipient=" . $modx->getLoginUserID() . " AND messageread=0");
7
+    "recipient=".$modx->getLoginUserID()." AND messageread=0");
8 8
 $nrnewmessages = $modx->getDatabase()->getValue($rs);
9
-$rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('user_messages'), "recipient=" . $modx->getLoginUserID());
9
+$rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID());
10 10
 $nrtotalmessages = $modx->getDatabase()->getValue($rs);
11 11
 $messagesallowed = $modx->hasPermission('messages');
12 12
 
13 13
 // ajax response
14 14
 if (isset($_POST['updateMsgCount'])) {
15 15
     header("Content-Type: application/json; charset=utf-8");
16
-    print $nrnewmessages . ',' . $nrtotalmessages;
16
+    print $nrnewmessages.','.$nrtotalmessages;
17 17
     exit;
18 18
 }
Please login to merge, or discard this patch.
manager/includes/src/Core.php 3 patches
Spacing   +272 added lines, -272 removed lines patch added patch discarded remove patch
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
         if (empty($services)) {
220 220
             $services   = include EVO_SERVICES_FILE;
221 221
         }
222
-        $this->services     =  $services;
222
+        $this->services = $services;
223 223
 
224 224
         $this->initialize();
225 225
     }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
     private function checkServiceAlias($name){
285 285
         foreach ($this->providerAliases as $alias => $interface) {
286
-            if($name === $interface) {
286
+            if ($name === $interface) {
287 287
                 return $alias;
288 288
             }
289 289
         }
@@ -478,12 +478,12 @@  discard block
 block discarded – undo
478 478
             $info = debug_backtrace();
479 479
             $m[] = $msg;
480 480
             if (!empty($this->currentSnippet)) {
481
-                $m[] = 'Snippet - ' . $this->currentSnippet;
481
+                $m[] = 'Snippet - '.$this->currentSnippet;
482 482
             } elseif (!empty($this->event->activePlugin)) {
483
-                $m[] = 'Plugin - ' . $this->event->activePlugin;
483
+                $m[] = 'Plugin - '.$this->event->activePlugin;
484 484
             }
485 485
             $m[] = $this->decoded_request_uri;
486
-            $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')';
486
+            $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')';
487 487
             $msg = implode('<br />', $m);
488 488
             $this->logEvent(0, $error_type, $msg, $title);
489 489
         }
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
     {
501 501
         $flag = false;
502 502
         if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof Interfaces\DatabaseInterface) {
503
-            $flag = (bool)$this->{$connector}->conn;
503
+            $flag = (bool) $this->{$connector}->conn;
504 504
         }
505 505
         return $flag;
506 506
     }
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
             }
532 532
             if (!$out && $flag) {
533 533
                 $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname)));
534
-                $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php";
534
+                $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php";
535 535
                 $out = is_file($filename) ? include $filename : false;
536 536
             }
537 537
             if ($out && !in_array($extname, $this->extensions)) {
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
     public function getMicroTime()
550 550
     {
551 551
         list ($usec, $sec) = explode(' ', microtime());
552
-        return ((float)$usec + (float)$sec);
552
+        return ((float) $usec + (float) $sec);
553 553
     }
554 554
 
555 555
     /**
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
             // append the redirect count string to the url
574 574
             $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0;
575 575
             if ($currentNumberOfRedirects > 3) {
576
-                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>');
576
+                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>');
577 577
             } else {
578 578
                 $currentNumberOfRedirects += 1;
579 579
                 if (strpos($url, "?") > 0) {
@@ -584,9 +584,9 @@  discard block
 block discarded – undo
584 584
             }
585 585
         }
586 586
         if ($type == 'REDIRECT_REFRESH') {
587
-            $header = 'Refresh: 0;URL=' . $url;
587
+            $header = 'Refresh: 0;URL='.$url;
588 588
         } elseif ($type == 'REDIRECT_META') {
589
-            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />';
589
+            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />';
590 590
             echo $header;
591 591
             exit;
592 592
         } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) {
@@ -594,10 +594,10 @@  discard block
 block discarded – undo
594 594
             global $base_url, $site_url;
595 595
             if (substr($url, 0, strlen($base_url)) == $base_url) {
596 596
                 // append $site_url to make it work with Location:
597
-                $url = $site_url . substr($url, strlen($base_url));
597
+                $url = $site_url.substr($url, strlen($base_url));
598 598
             }
599 599
             if (strpos($url, "\n") === false) {
600
-                $header = 'Location: ' . $url;
600
+                $header = 'Location: '.$url;
601 601
             } else {
602 602
                 $this->messageQuit('No newline allowed in redirect url.');
603 603
             }
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
             header($responseCode);
607 607
         }
608 608
 
609
-        if(!empty($header)) {
609
+        if (!empty($header)) {
610 610
             header($header);
611 611
         }
612 612
 
@@ -711,8 +711,8 @@  discard block
 block discarded – undo
711 711
 
712 712
     private function recoverySiteCache()
713 713
     {
714
-        $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
715
-        $site_cache_path = $site_cache_dir . 'siteCache.idx.php';
714
+        $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
715
+        $site_cache_path = $site_cache_dir.'siteCache.idx.php';
716 716
 
717 717
         if (is_file($site_cache_path)) {
718 718
             include($site_cache_path);
@@ -775,8 +775,8 @@  discard block
 block discarded – undo
775 775
                 $this->invokeEvent("OnBeforeManagerPageInit");
776 776
             }
777 777
 
778
-            if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) {
779
-                $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet'];
778
+            if (isset ($_SESSION[$usrType.'UsrConfigSet'])) {
779
+                $usrSettings = &$_SESSION[$usrType.'UsrConfigSet'];
780 780
             } else {
781 781
                 if ($usrType == 'web') {
782 782
                     $from = $tbl_web_user_settings;
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
                     $usrSettings[$row['setting_name']] = $row['setting_value'];
797 797
                 }
798 798
                 if (isset ($usrType)) {
799
-                    $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
799
+                    $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings;
800 800
                 } // store user settings in session
801 801
             }
802 802
         }
@@ -941,10 +941,10 @@  discard block
 block discarded – undo
941 941
         $suf = $this->config['friendly_url_suffix'];
942 942
         $pre = preg_quote($pre, '/');
943 943
         $suf = preg_quote($suf, '/');
944
-        if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) {
944
+        if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) {
945 945
             $q = $_[1];
946 946
         }
947
-        if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) {
947
+        if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) {
948 948
             $q = $_[1];
949 949
         }
950 950
 
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
         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 */
967 967
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
968 968
             if ($this->config['use_alias_path'] == 1) {
969
-                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))))) {
969
+                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))))) {
970 970
                     $this->documentMethod = 'id';
971 971
                     return $q;
972 972
                 } else { /* not a valid id in terms of virtualDir, treat as alias */
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
      */
1001 1001
     public function getHashFile($key)
1002 1002
     {
1003
-        return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php";
1003
+        return $this->getCacheFolder()."docid_".$key.".pageCache.php";
1004 1004
     }
1005 1005
 
1006 1006
     /**
@@ -1011,9 +1011,9 @@  discard block
 block discarded – undo
1011 1011
         $hash = $id;
1012 1012
         $tmp = null;
1013 1013
         $params = array();
1014
-        if(!empty($this->systemCacheKey)){
1014
+        if (!empty($this->systemCacheKey)) {
1015 1015
             $hash = $this->systemCacheKey;
1016
-        }else {
1016
+        } else {
1017 1017
             if (!empty($_GET)) {
1018 1018
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
1019 1019
                 $params = $_GET;
@@ -1021,8 +1021,8 @@  discard block
 block discarded – undo
1021 1021
                 $hash .= '_'.md5(http_build_query($params));
1022 1022
             }
1023 1023
         }
1024
-        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params));
1025
-        if (is_array($evtOut) && count($evtOut) > 0){
1024
+        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params));
1025
+        if (is_array($evtOut) && count($evtOut) > 0) {
1026 1026
             $tmp = array_pop($evtOut);
1027 1027
         }
1028 1028
         return empty($tmp) ? $hash : $tmp;
@@ -1170,12 +1170,12 @@  discard block
 block discarded – undo
1170 1170
         if ($js = $this->getRegisteredClientStartupScripts()) {
1171 1171
             // change to just before closing </head>
1172 1172
             // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent);
1173
-            $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput);
1173
+            $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput);
1174 1174
         }
1175 1175
 
1176 1176
         // Insert jscripts & html block into template - template must have a </body> tag
1177 1177
         if ($js = $this->getRegisteredClientScripts()) {
1178
-            $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput);
1178
+            $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput);
1179 1179
         }
1180 1180
         // End fix by sirlancelot
1181 1181
 
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
         // send out content-type and content-disposition headers
1187 1187
         if (IN_PARSER_MODE == "true") {
1188 1188
             $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html";
1189
-            header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']);
1189
+            header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']);
1190 1190
             //            if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error)
1191 1191
             //                header('HTTP/1.0 404 Not Found');
1192 1192
             if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) {
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
                     $name = preg_replace('|-+|', '-', $name);
1205 1205
                     $name = trim($name, '-');
1206 1206
                 }
1207
-                $header = 'Content-Disposition: attachment; filename=' . $name;
1207
+                $header = 'Content-Disposition: attachment; filename='.$name;
1208 1208
                 header($header);
1209 1209
             }
1210 1210
         }
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
 
1213 1213
         $stats = $this->getTimerStats($this->tstart);
1214 1214
 
1215
-        $out =& $this->documentOutput;
1215
+        $out = & $this->documentOutput;
1216 1216
         $out = str_replace("[^q^]", $stats['queries'], $out);
1217 1217
         $out = str_replace("[^qt^]", $stats['queryTime'], $out);
1218 1218
         $out = str_replace("[^p^]", $stats['phpTime'], $out);
@@ -1251,17 +1251,17 @@  discard block
 block discarded – undo
1251 1251
                 $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet
1252 1252
                 $tt += $t;
1253 1253
             }
1254
-            echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />";
1254
+            echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />";
1255 1255
             echo $this->snippetsCode;
1256 1256
         }
1257 1257
         if ($this->dumpPlugins) {
1258 1258
             $ps = "";
1259 1259
             $tt = 0;
1260 1260
             foreach ($this->pluginsTime as $s => $t) {
1261
-                $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>";
1261
+                $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>";
1262 1262
                 $tt += $t;
1263 1263
             }
1264
-            echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />";
1264
+            echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />";
1265 1265
             echo $this->pluginsCode;
1266 1266
         }
1267 1267
 
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
         $srcTags = explode(',', $tags);
1288 1288
         $repTags = array();
1289 1289
         foreach ($srcTags as $tag) {
1290
-            $repTags[] = '\\' . $tag[0] . '\\' . $tag[1];
1290
+            $repTags[] = '\\'.$tag[0].'\\'.$tag[1];
1291 1291
         }
1292 1292
         return array($srcTags, $repTags);
1293 1293
     }
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
         $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']);
1310 1310
         $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache";
1311 1311
         $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0;
1312
-        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb";
1312
+        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb";
1313 1313
 
1314 1314
         return $stats;
1315 1315
     }
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
     {
1343 1343
         $cacheRefreshTime = 0;
1344 1344
         $recent_update = 0;
1345
-        @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php');
1345
+        @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php');
1346 1346
         $this->recentUpdate = $recent_update;
1347 1347
 
1348 1348
         $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time'];
@@ -1424,8 +1424,8 @@  discard block
 block discarded – undo
1424 1424
                 }
1425 1425
 
1426 1426
                 $docObjSerial = serialize($this->documentObject);
1427
-                $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;
1428
-                $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey);
1427
+                $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent;
1428
+                $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey);
1429 1429
                 file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent");
1430 1430
             }
1431 1431
         }
@@ -1467,16 +1467,16 @@  discard block
 block discarded – undo
1467 1467
             return array();
1468 1468
         }
1469 1469
         $spacer = md5('<<<EVO>>>');
1470
-        if($left==='{{' && strpos($content,';}}')!==false)  $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1471
-        if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1472
-        if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1473
-        if($left==='[[' && strpos($content,']]]')!==false)  $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1470
+        if ($left === '{{' && strpos($content, ';}}') !== false)  $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content);
1471
+        if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content);
1472
+        if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content);
1473
+        if ($left === '[[' && strpos($content, ']]]') !== false)  $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content);
1474 1474
 
1475 1475
         $pos['<![CDATA['] = strpos($content, '<![CDATA[');
1476 1476
         $pos[']]>'] = strpos($content, ']]>');
1477 1477
 
1478 1478
         if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) {
1479
-            $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3);
1479
+            $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3);
1480 1480
         }
1481 1481
 
1482 1482
         $lp = explode($left, $content);
@@ -1540,8 +1540,8 @@  discard block
 block discarded – undo
1540 1540
                 }
1541 1541
             }
1542 1542
         }
1543
-        foreach($tags as $i=>$tag) {
1544
-            if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);
1543
+        foreach ($tags as $i=>$tag) {
1544
+            if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag);
1545 1545
         }
1546 1546
         return $tags;
1547 1547
     }
@@ -1581,7 +1581,7 @@  discard block
 block discarded – undo
1581 1581
         }
1582 1582
 
1583 1583
         foreach ($matches[1] as $i => $key) {
1584
-            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1584
+            if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1585 1585
             if (substr($key, 0, 1) == '#') {
1586 1586
                 $key = substr($key, 1);
1587 1587
             } // remove # for QuickEdit format
@@ -1611,8 +1611,8 @@  discard block
 block discarded – undo
1611 1611
 
1612 1612
             if (strpos($content, $s) !== false) {
1613 1613
                 $content = str_replace($s, $value, $content);
1614
-            } elseif($this->debug) {
1615
-                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1614
+            } elseif ($this->debug) {
1615
+                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1616 1616
             }
1617 1617
         }
1618 1618
 
@@ -1779,8 +1779,8 @@  discard block
 block discarded – undo
1779 1779
             $s = &$matches[0][$i];
1780 1780
             if (strpos($content, $s) !== false) {
1781 1781
                 $content = str_replace($s, $value, $content);
1782
-            } elseif($this->debug) {
1783
-                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1782
+            } elseif ($this->debug) {
1783
+                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1784 1784
             }
1785 1785
         }
1786 1786
         return $content;
@@ -1833,7 +1833,7 @@  discard block
 block discarded – undo
1833 1833
             }
1834 1834
 
1835 1835
             $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags
1836
-            $value = $this->mergePlaceholderContent($value, $params);  // parse page global placeholers
1836
+            $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers
1837 1837
             if ($this->config['enable_at_syntax']) {
1838 1838
                 $value = $this->mergeConditionalTagsContent($value);
1839 1839
             }
@@ -1848,8 +1848,8 @@  discard block
 block discarded – undo
1848 1848
             $s = &$matches[0][$i];
1849 1849
             if (strpos($content, $s) !== false) {
1850 1850
                 $content = str_replace($s, $value, $content);
1851
-            } elseif($this->debug) {
1852
-                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1851
+            } elseif ($this->debug) {
1852
+                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1853 1853
             }
1854 1854
         }
1855 1855
         return $content;
@@ -1907,8 +1907,8 @@  discard block
 block discarded – undo
1907 1907
             $s = &$matches[0][$i];
1908 1908
             if (strpos($content, $s) !== false) {
1909 1909
                 $content = str_replace($s, $value, $content);
1910
-            } elseif($this->debug) {
1911
-                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1910
+            } elseif ($this->debug) {
1911
+                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1912 1912
             }
1913 1913
         }
1914 1914
         return $content;
@@ -1932,7 +1932,7 @@  discard block
 block discarded – undo
1932 1932
             return $content;
1933 1933
         }
1934 1934
 
1935
-        $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#';
1935
+        $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#';
1936 1936
         $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content);
1937 1937
 
1938 1938
         $pieces = explode('<@IF:', $content);
@@ -1943,7 +1943,7 @@  discard block
 block discarded – undo
1943 1943
             }
1944 1944
             list($cmd, $text) = explode('>', $split, 2);
1945 1945
             $cmd = str_replace("'", "\'", $cmd);
1946
-            $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1946
+            $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>";
1947 1947
             $content .= $text;
1948 1948
         }
1949 1949
         $pieces = explode('<@ELSEIF:', $content);
@@ -1954,13 +1954,13 @@  discard block
 block discarded – undo
1954 1954
             }
1955 1955
             list($cmd, $text) = explode('>', $split, 2);
1956 1956
             $cmd = str_replace("'", "\'", $cmd);
1957
-            $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1957
+            $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>";
1958 1958
             $content .= $text;
1959 1959
         }
1960 1960
 
1961 1961
         $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content);
1962 1962
         ob_start();
1963
-        $content = eval('?>' . $content);
1963
+        $content = eval('?>'.$content);
1964 1964
         $content = ob_get_clean();
1965 1965
         $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content);
1966 1966
 
@@ -2085,7 +2085,7 @@  discard block
 block discarded – undo
2085 2085
         $matches = $this->getTagsFromContent($content, $left, $right);
2086 2086
         if (!empty($matches)) {
2087 2087
             foreach ($matches[0] as $i => $v) {
2088
-                $addBreakMatches[$i] = $v . "\n";
2088
+                $addBreakMatches[$i] = $v."\n";
2089 2089
             }
2090 2090
             $content = str_replace($addBreakMatches, '', $content);
2091 2091
             if (strpos($content, $left) !== false) {
@@ -2118,8 +2118,8 @@  discard block
 block discarded – undo
2118 2118
             $s = &$matches[0][$i];
2119 2119
             if (strpos($content, $s) !== false) {
2120 2120
                 $content = str_replace($s, $v, $content);
2121
-            } elseif($this->debug) {
2122
-                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2121
+            } elseif ($this->debug) {
2122
+                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
2123 2123
             }
2124 2124
         }
2125 2125
         return $content;
@@ -2183,7 +2183,7 @@  discard block
 block discarded – undo
2183 2183
                 $msg = ($msg === false) ? 'ob_get_contents() error' : $msg;
2184 2184
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg);
2185 2185
                 if ($this->isBackend()) {
2186
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>');
2186
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>');
2187 2187
                 }
2188 2188
             }
2189 2189
         } else {
@@ -2232,7 +2232,7 @@  discard block
 block discarded – undo
2232 2232
                 $echo = ($echo === false) ? 'ob_get_contents() error' : $echo;
2233 2233
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo);
2234 2234
                 if ($this->isBackend()) {
2235
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>');
2235
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>');
2236 2236
                 }
2237 2237
             }
2238 2238
         }
@@ -2240,7 +2240,7 @@  discard block
 block discarded – undo
2240 2240
         if (is_array($return) || is_object($return)) {
2241 2241
             return $return;
2242 2242
         } else {
2243
-            return $echo . $return;
2243
+            return $echo.$return;
2244 2244
         }
2245 2245
     }
2246 2246
 
@@ -2278,8 +2278,8 @@  discard block
 block discarded – undo
2278 2278
                 }
2279 2279
                 if (strpos($content, $s) !== false) {
2280 2280
                     $content = str_replace($s, $value, $content);
2281
-                } elseif($this->debug) {
2282
-                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2281
+                } elseif ($this->debug) {
2282
+                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2);
2283 2283
                 }
2284 2284
                 continue;
2285 2285
             }
@@ -2290,8 +2290,8 @@  discard block
 block discarded – undo
2290 2290
 
2291 2291
             if (strpos($content, $s) !== false) {
2292 2292
                 $content = str_replace($s, $value, $content);
2293
-            } elseif($this->debug) {
2294
-                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2293
+            } elseif ($this->debug) {
2294
+                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2);
2295 2295
             }
2296 2296
         }
2297 2297
 
@@ -2382,7 +2382,7 @@  discard block
 block discarded – undo
2382 2382
             $eventtime = sprintf('%2.2f ms', $eventtime * 1000);
2383 2383
             $code = str_replace("\t", '  ', $this->getPhpCompat()->htmlspecialchars($value));
2384 2384
             $piece = str_replace("\t", '  ', $this->getPhpCompat()->htmlspecialchars($piece));
2385
-            $print_r_params = str_replace("\t", '  ', $this->getPhpCompat()->htmlspecialchars('$modx->event->params = ' . print_r($params, true)));
2385
+            $print_r_params = str_replace("\t", '  ', $this->getPhpCompat()->htmlspecialchars('$modx->event->params = '.print_r($params, true)));
2386 2386
             $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);
2387 2387
             $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime);
2388 2388
         }
@@ -2631,7 +2631,7 @@  discard block
 block discarded – undo
2631 2631
             );
2632 2632
             $count = $this->getDatabase()->getRecordCount($rs);
2633 2633
             if (1 < $count) {
2634
-                exit('Error $modx->_getSnippetObject()' . $snip_name);
2634
+                exit('Error $modx->_getSnippetObject()'.$snip_name);
2635 2635
             }
2636 2636
             if ($count) {
2637 2637
                 $row = $this->getDatabase()->getRow($rs);
@@ -2657,7 +2657,7 @@  discard block
 block discarded – undo
2657 2657
     public function toAlias($text)
2658 2658
     {
2659 2659
         $suff = $this->config['friendly_url_suffix'];
2660
-        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);
2660
+        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);
2661 2661
     }
2662 2662
 
2663 2663
     /**
@@ -2689,7 +2689,7 @@  discard block
 block discarded – undo
2689 2689
                 $suff = '/';
2690 2690
             }
2691 2691
 
2692
-            $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff;
2692
+            $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff;
2693 2693
         }
2694 2694
 
2695 2695
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -2726,7 +2726,7 @@  discard block
 block discarded – undo
2726 2726
                 preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match);
2727 2727
                 $ids = implode(',', array_unique($match['1']));
2728 2728
                 if ($ids) {
2729
-                    $res = $this->getDatabase()->select("id,alias,isfolder,parent,alias_visible", $this->getDatabase()->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'");
2729
+                    $res = $this->getDatabase()->select("id,alias,isfolder,parent,alias_visible", $this->getDatabase()->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'");
2730 2730
                     while ($row = $this->getDatabase()->getRow($res)) {
2731 2731
                         if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) {
2732 2732
                             $parent = $row['parent'];
@@ -2737,7 +2737,7 @@  discard block
 block discarded – undo
2737 2737
                                 $parent = $this->aliasListing[$parent]['parent'];
2738 2738
                             }
2739 2739
 
2740
-                            $aliases[$row['id']] = $path . '/' . $row['alias'];
2740
+                            $aliases[$row['id']] = $path.'/'.$row['alias'];
2741 2741
                         } else {
2742 2742
                             $aliases[$row['id']] = $row['alias'];
2743 2743
                         }
@@ -2749,7 +2749,7 @@  discard block
 block discarded – undo
2749 2749
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2750 2750
             $pref = $this->config['friendly_url_prefix'];
2751 2751
             $suff = $this->config['friendly_url_suffix'];
2752
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2752
+            $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2753 2753
                 global $modx;
2754 2754
                 $thealias = $aliases[$m[1]];
2755 2755
                 $thefolder = $isfolder[$m[1]];
@@ -2765,7 +2765,7 @@  discard block
 block discarded – undo
2765 2765
 
2766 2766
         } else {
2767 2767
             $in = '!\[\~([0-9]+)\~\]!is';
2768
-            $out = "index.php?id=" . '\1';
2768
+            $out = "index.php?id=".'\1';
2769 2769
             $documentSource = preg_replace($in, $out, $documentSource);
2770 2770
         }
2771 2771
 
@@ -2786,7 +2786,7 @@  discard block
 block discarded – undo
2786 2786
         $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
2787 2787
         $len_base_url = strlen($this->config['base_url']);
2788 2788
 
2789
-        $url_path = $q;//LANG
2789
+        $url_path = $q; //LANG
2790 2790
 
2791 2791
         if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) {
2792 2792
             $url_path = substr($url_path, $len_base_url);
@@ -2798,7 +2798,7 @@  discard block
 block discarded – undo
2798 2798
             $strictURL = substr($strictURL, $len_base_url);
2799 2799
         }
2800 2800
         $http_host = $_SERVER['HTTP_HOST'];
2801
-        $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG
2801
+        $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG
2802 2802
 
2803 2803
         $site_url = $this->config['site_url'];
2804 2804
         $url_query_string = explode('?', $_SERVER['REQUEST_URI']);
@@ -2816,7 +2816,7 @@  discard block
 block discarded – undo
2816 2816
                 }
2817 2817
                 if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) {
2818 2818
                     if (empty($_POST)) {
2819
-                        if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) {
2819
+                        if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) {
2820 2820
                             $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
2821 2821
                             exit(0);
2822 2822
                         }
@@ -2875,7 +2875,7 @@  discard block
 block discarded – undo
2875 2875
                 $docgrp = implode(",", $docgrp);
2876 2876
             }
2877 2877
             // get document
2878
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2878
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2879 2879
             $rs = $this->getDatabase()->select('sc.*', "{$tblsc} sc
2880 2880
                 LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1);
2881 2881
             if ($this->getDatabase()->getRecordCount($rs) < 1) {
@@ -2911,9 +2911,9 @@  discard block
 block discarded – undo
2911 2911
             }
2912 2912
             if ($documentObject['template']) {
2913 2913
                 // load TVs and merge with document - Orig by Apodigm - Docvars
2914
-                $rs = $this->getDatabase()->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getDatabase()->getFullTableName("site_tmplvars") . " tv
2915
-                INNER JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id
2916
-                LEFT JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2914
+                $rs = $this->getDatabase()->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getDatabase()->getFullTableName("site_tmplvars")." tv
2915
+                INNER JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id
2916
+                LEFT JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2917 2917
                 $tmplvars = array();
2918 2918
                 while ($row = $this->getDatabase()->getRow($rs)) {
2919 2919
                     $tmplvars[$row['name']] = array(
@@ -2959,7 +2959,7 @@  discard block
 block discarded – undo
2959 2959
                 $st = md5($source);
2960 2960
             }
2961 2961
             if ($this->dumpSnippets == 1) {
2962
-                $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>";
2962
+                $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>";
2963 2963
             }
2964 2964
 
2965 2965
             // invoke OnParseDocument event
@@ -3001,7 +3001,7 @@  discard block
 block discarded – undo
3001 3001
      */
3002 3002
     public function executeParser()
3003 3003
     {
3004
-        if(MODX_CLI) {
3004
+        if (MODX_CLI) {
3005 3005
             throw new \RuntimeException('Call DocumentParser::executeParser on CLI mode');
3006 3006
         }
3007 3007
 
@@ -3047,7 +3047,7 @@  discard block
 block discarded – undo
3047 3047
 
3048 3048
             // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path
3049 3049
             if ($this->config['use_alias_path'] == 1) {
3050
-                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier;
3050
+                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier;
3051 3051
                 if (isset($this->documentListing[$alias])) {
3052 3052
                     $this->documentIdentifier = $this->documentListing[$alias];
3053 3053
                 } else {
@@ -3108,7 +3108,7 @@  discard block
 block discarded – undo
3108 3108
                 } else {
3109 3109
                     $docAlias = $this->getDatabase()->escape($this->documentIdentifier);
3110 3110
                     $rs = $this->getDatabase()->select('id', $this->getDatabase()->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'");
3111
-                    $this->documentIdentifier = (int)$this->getDatabase()->getValue($rs);
3111
+                    $this->documentIdentifier = (int) $this->getDatabase()->getValue($rs);
3112 3112
                 }
3113 3113
             }
3114 3114
             $this->documentMethod = 'id';
@@ -3165,7 +3165,7 @@  discard block
 block discarded – undo
3165 3165
                 $_REQUEST[$n] = $_GET[$n] = $v;
3166 3166
             }
3167 3167
         }
3168
-        $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path'];
3168
+        $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path'];
3169 3169
         $this->q = $qp['path'];
3170 3170
         return $qp['path'];
3171 3171
     }
@@ -3315,7 +3315,7 @@  discard block
 block discarded – undo
3315 3315
         while ($id && $height--) {
3316 3316
             $thisid = $id;
3317 3317
             if ($this->config['aliaslistingfolder'] == 1) {
3318
-                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->getDatabase()->getValue("SELECT `parent` FROM " . $this->getDatabase()->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1");
3318
+                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->getDatabase()->getValue("SELECT `parent` FROM ".$this->getDatabase()->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1");
3319 3319
                 if (!$id || $id == '0') {
3320 3320
                     break;
3321 3321
                 }
@@ -3366,15 +3366,15 @@  discard block
 block discarded – undo
3366 3366
 
3367 3367
         if ($this->config['aliaslistingfolder'] == 1) {
3368 3368
 
3369
-            $res = $this->getDatabase()->select("id,alias,isfolder,parent", $this->getDatabase()->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'");
3369
+            $res = $this->getDatabase()->select("id,alias,isfolder,parent", $this->getDatabase()->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'");
3370 3370
             $idx = array();
3371 3371
             while ($row = $this->getDatabase()->getRow($res)) {
3372 3372
                 $pAlias = '';
3373 3373
                 if (isset($this->aliasListing[$row['parent']])) {
3374
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : '';
3375
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : '';
3374
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : '';
3375
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : '';
3376 3376
                 };
3377
-                $children[$pAlias . $row['alias']] = $row['id'];
3377
+                $children[$pAlias.$row['alias']] = $row['id'];
3378 3378
                 if ($row['isfolder'] == 1) {
3379 3379
                     $idx[] = $row['id'];
3380 3380
                 }
@@ -3406,7 +3406,7 @@  discard block
 block discarded – undo
3406 3406
                 $depth--;
3407 3407
 
3408 3408
                 foreach ($documentMap_cache[$id] as $childId) {
3409
-                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias'];
3409
+                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias'];
3410 3410
                     if (!strlen($pkey)) {
3411 3411
                         $pkey = "{$childId}";
3412 3412
                     }
@@ -3443,7 +3443,7 @@  discard block
 block discarded – undo
3443 3443
                 $fnc = 'history.back(-1);';
3444 3444
                 break;
3445 3445
             default:
3446
-                $fnc = "window.location.href='" . addslashes($url) . "';";
3446
+                $fnc = "window.location.href='".addslashes($url)."';";
3447 3447
         }
3448 3448
 
3449 3449
         echo "<html><head>
@@ -3475,9 +3475,9 @@  discard block
 block discarded – undo
3475 3475
         $state = 0;
3476 3476
         $pms = $_SESSION['mgrPermissions'];
3477 3477
         if ($pms) {
3478
-            $state = ((bool)$pms[$pm] === true);
3478
+            $state = ((bool) $pms[$pm] === true);
3479 3479
         }
3480
-        return (int)$state;
3480
+        return (int) $state;
3481 3481
     }
3482 3482
 
3483 3483
     /**
@@ -3490,8 +3490,8 @@  discard block
 block discarded – undo
3490 3490
      */
3491 3491
     public function elementIsLocked($type, $id, $includeThisUser = false)
3492 3492
     {
3493
-        $id = (int)$id;
3494
-        $type = (int)$type;
3493
+        $id = (int) $id;
3494
+        $type = (int) $type;
3495 3495
         if (!$type || !$id) {
3496 3496
             return null;
3497 3497
         }
@@ -3541,7 +3541,7 @@  discard block
 block discarded – undo
3541 3541
             return $lockedElements;
3542 3542
         }
3543 3543
 
3544
-        $type = (int)$type;
3544
+        $type = (int) $type;
3545 3545
         if (isset($lockedElements[$type])) {
3546 3546
             return $lockedElements[$type];
3547 3547
         } else {
@@ -3558,7 +3558,7 @@  discard block
 block discarded – undo
3558 3558
             $this->lockedElements = array();
3559 3559
             $this->cleanupExpiredLocks();
3560 3560
 
3561
-            $rs = $this->getDatabase()->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getDatabase()->getFullTableName('active_user_locks') . " ul
3561
+            $rs = $this->getDatabase()->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getDatabase()->getFullTableName('active_user_locks')." ul
3562 3562
                 LEFT JOIN {$this->getDatabase()->getFullTableName('manager_users')} mu on ul.internalKey = mu.id");
3563 3563
             while ($row = $this->getDatabase()->getRow($rs)) {
3564 3564
                 $this->lockedElements[$row['elementType']][$row['elementId']] = array(
@@ -3581,7 +3581,7 @@  discard block
 block discarded – undo
3581 3581
     public function cleanupExpiredLocks()
3582 3582
     {
3583 3583
         // Clean-up active_user_sessions first
3584
-        $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
3584
+        $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
3585 3585
         $validSessionTimeLimit = $this->time - $timeout;
3586 3586
         $this->getDatabase()->delete($this->getDatabase()->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}");
3587 3587
 
@@ -3594,7 +3594,7 @@  discard block
 block discarded – undo
3594 3594
             foreach ($rs as $row) {
3595 3595
                 $userSids[] = $row['sid'];
3596 3596
             }
3597
-            $userSids = "'" . implode("','", $userSids) . "'";
3597
+            $userSids = "'".implode("','", $userSids)."'";
3598 3598
             $this->getDatabase()->delete($this->getDatabase()->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})");
3599 3599
         } else {
3600 3600
             $this->getDatabase()->delete($this->getDatabase()->getFullTableName('active_user_locks'));
@@ -3678,8 +3678,8 @@  discard block
 block discarded – undo
3678 3678
     public function lockElement($type, $id)
3679 3679
     {
3680 3680
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3681
-        $type = (int)$type;
3682
-        $id = (int)$id;
3681
+        $type = (int) $type;
3682
+        $id = (int) $id;
3683 3683
         if (!$type || !$id || !$userId) {
3684 3684
             return false;
3685 3685
         }
@@ -3700,8 +3700,8 @@  discard block
 block discarded – undo
3700 3700
     public function unlockElement($type, $id, $includeAllUsers = false)
3701 3701
     {
3702 3702
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3703
-        $type = (int)$type;
3704
-        $id = (int)$id;
3703
+        $type = (int) $type;
3704
+        $id = (int) $id;
3705 3705
         if (!$type || !$id) {
3706 3706
             return false;
3707 3707
         }
@@ -3768,8 +3768,8 @@  discard block
 block discarded – undo
3768 3768
         }
3769 3769
 
3770 3770
         $usertype = $this->isFrontend() ? 1 : 0;
3771
-        $evtid = (int)$evtid;
3772
-        $type = (int)$type;
3771
+        $evtid = (int) $evtid;
3772
+        $type = (int) $type;
3773 3773
 
3774 3774
         // Types: 1 = information, 2 = warning, 3 = error
3775 3775
         if ($type < 1) {
@@ -3791,8 +3791,8 @@  discard block
 block discarded – undo
3791 3791
         if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') {
3792 3792
             if ($this->config['send_errormail'] <= $type) {
3793 3793
                 $this->sendmail(array(
3794
-                    'subject' => 'MODX System Error on ' . $this->config['site_name'],
3795
-                    'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.',
3794
+                    'subject' => 'MODX System Error on '.$this->config['site_name'],
3795
+                    'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.',
3796 3796
                     'type' => 'text'
3797 3797
                 ));
3798 3798
             }
@@ -3841,7 +3841,7 @@  discard block
 block discarded – undo
3841 3841
             $p['fromname'] = $userinfo['username'];
3842 3842
         }
3843 3843
         if ($msg === '' && !isset($p['body'])) {
3844
-            $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER'];
3844
+            $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER'];
3845 3845
         } elseif (is_string($msg) && 0 < strlen($msg)) {
3846 3846
             $p['body'] = $msg;
3847 3847
         }
@@ -3882,8 +3882,8 @@  discard block
 block discarded – undo
3882 3882
             $files = array();
3883 3883
         }
3884 3884
         foreach ($files as $f) {
3885
-            if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) {
3886
-                $this->getMail()->AddAttachment(MODX_BASE_PATH . $f);
3885
+            if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) {
3886
+                $this->getMail()->AddAttachment(MODX_BASE_PATH.$f);
3887 3887
             }
3888 3888
         }
3889 3889
         return $this->getMail()->send();
@@ -3927,7 +3927,7 @@  discard block
 block discarded – undo
3927 3927
      */
3928 3928
     public function isFrontend()
3929 3929
     {
3930
-        return ! $this->isBackend();
3930
+        return !$this->isBackend();
3931 3931
     }
3932 3932
 
3933 3933
     /**
@@ -3952,14 +3952,14 @@  discard block
 block discarded – undo
3952 3952
         $tblsc = $this->getDatabase()->getFullTableName("site_content");
3953 3953
         $tbldg = $this->getDatabase()->getFullTableName("document_groups");
3954 3954
         // modify field names to use sc. table reference
3955
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3956
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3955
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3956
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3957 3957
         // get document groups for current user
3958 3958
         if ($docgrp = $this->getUserDocGroups()) {
3959 3959
             $docgrp = implode(",", $docgrp);
3960 3960
         }
3961 3961
         // build query
3962
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3962
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3963 3963
         $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc
3964 3964
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3965 3965
         $resourceArray = $this->getDatabase()->makeArray($result);
@@ -3989,14 +3989,14 @@  discard block
 block discarded – undo
3989 3989
         $tbldg = $this->getDatabase()->getFullTableName("document_groups");
3990 3990
 
3991 3991
         // modify field names to use sc. table reference
3992
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3993
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3992
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3993
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3994 3994
         // get document groups for current user
3995 3995
         if ($docgrp = $this->getUserDocGroups()) {
3996 3996
             $docgrp = implode(",", $docgrp);
3997 3997
         }
3998 3998
         // build query
3999
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3999
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
4000 4000
         $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc
4001 4001
                 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}");
4002 4002
         $resourceArray = $this->getDatabase()->makeArray($result);
@@ -4031,16 +4031,16 @@  discard block
 block discarded – undo
4031 4031
             return $this->tmpCache[__FUNCTION__][$cacheKey];
4032 4032
         }
4033 4033
 
4034
-        $published = ($published !== 'all') ? 'AND sc.published = ' . $published : '';
4035
-        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : '';
4034
+        $published = ($published !== 'all') ? 'AND sc.published = '.$published : '';
4035
+        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : '';
4036 4036
 
4037 4037
         if ($where != '') {
4038
-            $where = 'AND ' . $where;
4038
+            $where = 'AND '.$where;
4039 4039
         }
4040 4040
 
4041 4041
         // modify field names to use sc. table reference
4042
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4043
-        $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
4042
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4043
+        $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
4044 4044
 
4045 4045
         // get document groups for current user
4046 4046
         if ($docgrp = $this->getUserDocGroups()) {
@@ -4048,7 +4048,7 @@  discard block
 block discarded – undo
4048 4048
         }
4049 4049
 
4050 4050
         // build query
4051
-        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
4051
+        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
4052 4052
 
4053 4053
         $tblsc = $this->getDatabase()->getFullTableName('site_content');
4054 4054
         $tbldg = $this->getDatabase()->getFullTableName('document_groups');
@@ -4100,10 +4100,10 @@  discard block
 block discarded – undo
4100 4100
             return false;
4101 4101
         } else {
4102 4102
             // modify field names to use sc. table reference
4103
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4104
-            $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
4103
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4104
+            $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
4105 4105
             if ($where != '') {
4106
-                $where = 'AND ' . $where;
4106
+                $where = 'AND '.$where;
4107 4107
             }
4108 4108
 
4109 4109
             $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : '';
@@ -4114,13 +4114,13 @@  discard block
 block discarded – undo
4114 4114
                 $docgrp = implode(',', $docgrp);
4115 4115
             }
4116 4116
 
4117
-            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
4117
+            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
4118 4118
 
4119 4119
             $tblsc = $this->getDatabase()->getFullTableName('site_content');
4120 4120
             $tbldg = $this->getDatabase()->getFullTableName('document_groups');
4121 4121
 
4122 4122
             $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc
4123
-                    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);
4123
+                    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);
4124 4124
 
4125 4125
             $resourceArray = $this->getDatabase()->makeArray($result);
4126 4126
 
@@ -4225,12 +4225,12 @@  discard block
 block discarded – undo
4225 4225
             $tbldg = $this->getDatabase()->getFullTableName("document_groups");
4226 4226
             $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : "";
4227 4227
             // modify field names to use sc. table reference
4228
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4228
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4229 4229
             // get document groups for current user
4230 4230
             if ($docgrp = $this->getUserDocGroups()) {
4231 4231
                 $docgrp = implode(",", $docgrp);
4232 4232
             }
4233
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
4233
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
4234 4234
             $result = $this->getDatabase()->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1);
4235 4235
             $pageInfo = $this->getDatabase()->getRow($result);
4236 4236
 
@@ -4277,7 +4277,7 @@  discard block
 block discarded – undo
4277 4277
     {
4278 4278
         if ($this->currentSnippet) {
4279 4279
             $tbl = $this->getDatabase()->getFullTableName("site_snippets");
4280
-            $rs = $this->getDatabase()->select('id', $tbl, "name='" . $this->getDatabase()->escape($this->currentSnippet) . "'", '', 1);
4280
+            $rs = $this->getDatabase()->select('id', $tbl, "name='".$this->getDatabase()->escape($this->currentSnippet)."'", '', 1);
4281 4281
             if ($snippetId = $this->getDatabase()->getValue($rs)) {
4282 4282
                 return $snippetId;
4283 4283
             }
@@ -4304,7 +4304,7 @@  discard block
 block discarded – undo
4304 4304
      */
4305 4305
     public function clearCache($type = '', $report = false)
4306 4306
     {
4307
-        $cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
4307
+        $cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
4308 4308
         if (is_array($type)) {
4309 4309
             foreach ($type as $_) {
4310 4310
                 $this->clearCache($_, $report);
@@ -4316,10 +4316,10 @@  discard block
 block discarded – undo
4316 4316
             $sync->emptyCache();
4317 4317
         } elseif (preg_match('@^[1-9][0-9]*$@', $type)) {
4318 4318
             $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type;
4319
-            $file_name = "docid_" . $key . "_*.pageCache.php";
4320
-            $cache_path = $cache_dir . $file_name;
4319
+            $file_name = "docid_".$key."_*.pageCache.php";
4320
+            $cache_path = $cache_dir.$file_name;
4321 4321
             $files = glob($cache_path);
4322
-            $files[] = $cache_dir . "docid_" . $key . ".pageCache.php";
4322
+            $files[] = $cache_dir."docid_".$key.".pageCache.php";
4323 4323
             foreach ($files as $file) {
4324 4324
                 if (!is_file($file)) {
4325 4325
                     continue;
@@ -4327,7 +4327,7 @@  discard block
 block discarded – undo
4327 4327
                 unlink($file);
4328 4328
             }
4329 4329
         } else {
4330
-            $files = glob($cache_dir . '*');
4330
+            $files = glob($cache_dir.'*');
4331 4331
             foreach ($files as $file) {
4332 4332
                 $name = basename($file);
4333 4333
                 if (strpos($name, '.pageCache.php') === false) {
@@ -4396,7 +4396,7 @@  discard block
 block discarded – undo
4396 4396
                         $f_url_suffix = '/';
4397 4397
                     }
4398 4398
 
4399
-                    $alPath = !empty ($al['path']) ? $al['path'] . '/' : '';
4399
+                    $alPath = !empty ($al['path']) ? $al['path'].'/' : '';
4400 4400
 
4401 4401
                     if ($al && $al['alias']) {
4402 4402
                         $alias = $al['alias'];
@@ -4404,7 +4404,7 @@  discard block
 block discarded – undo
4404 4404
 
4405 4405
                 }
4406 4406
 
4407
-                $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix;
4407
+                $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix;
4408 4408
                 $url = "{$alias}{$args}";
4409 4409
             } else {
4410 4410
                 $url = "index.php?id={$id}{$args}";
@@ -4423,7 +4423,7 @@  discard block
 block discarded – undo
4423 4423
             }
4424 4424
 
4425 4425
             //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080)
4426
-            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host;
4426
+            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host;
4427 4427
         }
4428 4428
 
4429 4429
         //fix strictUrl by Bumkaka
@@ -4432,9 +4432,9 @@  discard block
 block discarded – undo
4432 4432
         }
4433 4433
 
4434 4434
         if ($this->config['xhtml_urls']) {
4435
-            $url = preg_replace("/&(?!amp;)/", "&amp;", $host . $virtualDir . $url);
4435
+            $url = preg_replace("/&(?!amp;)/", "&amp;", $host.$virtualDir.$url);
4436 4436
         } else {
4437
-            $url = $host . $virtualDir . $url;
4437
+            $url = $host.$virtualDir.$url;
4438 4438
         }
4439 4439
 
4440 4440
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -4458,21 +4458,21 @@  discard block
 block discarded – undo
4458 4458
         if (isset($this->aliasListing[$id])) {
4459 4459
             $out = $this->aliasListing[$id];
4460 4460
         } else {
4461
-            $q = $this->getDatabase()->query("SELECT id,alias,isfolder,parent FROM " . $this->getDatabase()->getFullTableName("site_content") . " WHERE id=" . (int)$id);
4461
+            $q = $this->getDatabase()->query("SELECT id,alias,isfolder,parent FROM ".$this->getDatabase()->getFullTableName("site_content")." WHERE id=".(int) $id);
4462 4462
             if ($this->getDatabase()->getRecordCount($q) == '1') {
4463 4463
                 $q = $this->getDatabase()->getRow($q);
4464 4464
                 $this->aliasListing[$id] = array(
4465
-                    'id' => (int)$q['id'],
4465
+                    'id' => (int) $q['id'],
4466 4466
                     'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'],
4467
-                    'parent' => (int)$q['parent'],
4468
-                    'isfolder' => (int)$q['isfolder'],
4467
+                    'parent' => (int) $q['parent'],
4468
+                    'isfolder' => (int) $q['isfolder'],
4469 4469
                 );
4470 4470
                 if ($this->aliasListing[$id]['parent'] > 0) {
4471 4471
                     //fix alias_path_usage
4472 4472
                     if ($this->config['use_alias_path'] == '1') {
4473 4473
                         //&& $tmp['path'] != '' - fix error slash with epty path
4474 4474
                         $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']);
4475
-                        $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : '');
4475
+                        $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : '');
4476 4476
                     } else {
4477 4477
                         $this->aliasListing[$id]['path'] = '';
4478 4478
                     }
@@ -4510,7 +4510,7 @@  discard block
 block discarded – undo
4510 4510
         $out = array();
4511 4511
         if (empty($this->version) || !is_array($this->version)) {
4512 4512
             //include for compatibility modx version < 1.0.10
4513
-            include MODX_MANAGER_PATH . "includes/version.inc.php";
4513
+            include MODX_MANAGER_PATH."includes/version.inc.php";
4514 4514
             $this->version = array();
4515 4515
             $this->version['version'] = isset($modx_version) ? $modx_version : '';
4516 4516
             $this->version['branch'] = isset($modx_branch) ? $modx_branch : '';
@@ -4532,18 +4532,18 @@  discard block
 block discarded – undo
4532 4532
     {
4533 4533
         if (isset ($this->snippetCache[$snippetName])) {
4534 4534
             $snippet = $this->snippetCache[$snippetName];
4535
-            $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4535
+            $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : '';
4536 4536
         } else { // not in cache so let's check the db
4537
-            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getDatabase()->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getDatabase()->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->getDatabase()->escape($snippetName) . "'  AND ss.disabled=0;";
4537
+            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getDatabase()->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getDatabase()->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->getDatabase()->escape($snippetName)."'  AND ss.disabled=0;";
4538 4538
             $result = $this->getDatabase()->query($sql);
4539 4539
             if ($this->getDatabase()->getRecordCount($result) == 1) {
4540 4540
                 $row = $this->getDatabase()->getRow($result);
4541 4541
                 $snippet = $this->snippetCache[$snippetName] = $row['snippet'];
4542 4542
                 $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties']));
4543
-                $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties);
4543
+                $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties);
4544 4544
             } else {
4545 4545
                 $snippet = $this->snippetCache[$snippetName] = "return false;";
4546
-                $properties = $this->snippetCache[$snippetName . "Props"] = '';
4546
+                $properties = $this->snippetCache[$snippetName."Props"] = '';
4547 4547
             }
4548 4548
         }
4549 4549
         // load default params/properties
@@ -4647,8 +4647,8 @@  discard block
 block discarded – undo
4647 4647
             }
4648 4648
             if (strpos($tpl, $s) !== false) {
4649 4649
                 $tpl = str_replace($s, $value, $tpl);
4650
-            } elseif($this->debug) {
4651
-                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2);
4650
+            } elseif ($this->debug) {
4651
+                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2);
4652 4652
             }
4653 4653
         }
4654 4654
 
@@ -4697,7 +4697,7 @@  discard block
 block discarded – undo
4697 4697
             case 'CODE':
4698 4698
                 break;
4699 4699
             case 'FILE':
4700
-                $template = file_get_contents(MODX_BASE_PATH . $template);
4700
+                $template = file_get_contents(MODX_BASE_PATH.$template);
4701 4701
                 break;
4702 4702
             case 'CHUNK':
4703 4703
                 $template = $this->getChunk($template);
@@ -4730,7 +4730,7 @@  discard block
 block discarded – undo
4730 4730
         if ($mode !== 'formatOnly' && empty($timestamp)) {
4731 4731
             return '-';
4732 4732
         }
4733
-        $timestamp = (int)$timestamp;
4733
+        $timestamp = (int) $timestamp;
4734 4734
 
4735 4735
         switch ($this->config['datetime_format']) {
4736 4736
             case 'YYYY/mm/dd':
@@ -4750,7 +4750,7 @@  discard block
 block discarded – undo
4750 4750
         }
4751 4751
 
4752 4752
         if (empty($mode)) {
4753
-            $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp);
4753
+            $strTime = strftime($dateFormat." %H:%M:%S", $timestamp);
4754 4754
         } elseif ($mode == 'dateOnly') {
4755 4755
             $strTime = strftime($dateFormat, $timestamp);
4756 4756
         } elseif ($mode == 'formatOnly') {
@@ -4804,7 +4804,7 @@  discard block
 block discarded – undo
4804 4804
             $S = 0;
4805 4805
         }
4806 4806
         $timeStamp = mktime($H, $M, $S, $m, $d, $Y);
4807
-        $timeStamp = (int)$timeStamp;
4807
+        $timeStamp = (int) $timeStamp;
4808 4808
         return $timeStamp;
4809 4809
     }
4810 4810
 
@@ -4846,7 +4846,7 @@  discard block
 block discarded – undo
4846 4846
                     if ($v === 'value') {
4847 4847
                         unset($_[$i]);
4848 4848
                     } else {
4849
-                        $_[$i] = 'tv.' . $v;
4849
+                        $_[$i] = 'tv.'.$v;
4850 4850
                     }
4851 4851
                 }
4852 4852
                 $fields = implode(',', $_);
@@ -4855,12 +4855,12 @@  discard block
 block discarded – undo
4855 4855
             }
4856 4856
 
4857 4857
             if ($tvsort != '') {
4858
-                $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4858
+                $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4859 4859
             }
4860 4860
             if ($tvidnames == "*") {
4861 4861
                 $query = "tv.id<>0";
4862 4862
             } else {
4863
-                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')";
4863
+                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')";
4864 4864
             }
4865 4865
 
4866 4866
             $this->getUserDocGroups();
@@ -4872,10 +4872,10 @@  discard block
 block discarded – undo
4872 4872
                 $rs = $this->getDatabase()->select(
4873 4873
                     "{$fields}, IF(tvc.value!='',tvc.value,tv.default_text) as value ",
4874 4874
 
4875
-                    $this->getDatabase()->getFullTableName("site_tmplvars") .
4876
-                    " tv INNER JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_templates") .
4877
-                    " tvtpl ON tvtpl.tmplvarid = tv.id LEFT JOIN " .
4878
-                    $this->getDatabase()->getFullTableName("site_tmplvar_contentvalues") .
4875
+                    $this->getDatabase()->getFullTableName("site_tmplvars").
4876
+                    " tv INNER JOIN ".$this->getDatabase()->getFullTableName("site_tmplvar_templates").
4877
+                    " tvtpl ON tvtpl.tmplvarid = tv.id LEFT JOIN ".
4878
+                    $this->getDatabase()->getFullTableName("site_tmplvar_contentvalues").
4879 4879
                     " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid='{$docid}'",
4880 4880
 
4881 4881
                     "{$query} AND tvtpl.templateid = '{$doc['template']}'",
@@ -5013,7 +5013,7 @@  discard block
 block discarded – undo
5013 5013
             return $this->tmpCache[__FUNCTION__][$cacheKey];
5014 5014
         }
5015 5015
 
5016
-        if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) {
5016
+        if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) {
5017 5017
             return false;
5018 5018
         } else {
5019 5019
 
@@ -5031,23 +5031,23 @@  discard block
 block discarded – undo
5031 5031
             }
5032 5032
 
5033 5033
             // get user defined template variables
5034
-            $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
5035
-            $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
5034
+            $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
5035
+            $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
5036 5036
 
5037 5037
             if ($idnames == '*') {
5038 5038
                 $query = 'tv.id<>0';
5039 5039
             } else {
5040
-                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')";
5040
+                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')";
5041 5041
             }
5042 5042
 
5043
-            $rs = $this->getDatabase()->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getDatabase()->getFullTableName('site_tmplvars') . " tv
5044
-                    INNER JOIN " . $this->getDatabase()->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id
5045
-                    LEFT JOIN " . $this->getDatabase()->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
5043
+            $rs = $this->getDatabase()->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getDatabase()->getFullTableName('site_tmplvars')." tv
5044
+                    INNER JOIN " . $this->getDatabase()->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id
5045
+                    LEFT JOIN " . $this->getDatabase()->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
5046 5046
 
5047 5047
             $result = $this->getDatabase()->makeArray($rs);
5048 5048
 
5049 5049
             // get default/built-in template variables
5050
-            if(is_array($docRow)){
5050
+            if (is_array($docRow)) {
5051 5051
                 ksort($docRow);
5052 5052
 
5053 5053
                 foreach ($docRow as $key => $value) {
@@ -5085,13 +5085,13 @@  discard block
 block discarded – undo
5085 5085
      */
5086 5086
     public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '')
5087 5087
     {
5088
-        if (is_array($idnames) && empty($idnames) ) {
5088
+        if (is_array($idnames) && empty($idnames)) {
5089 5089
             return false;
5090 5090
         } else {
5091 5091
             $output = array();
5092 5092
             $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames);
5093 5093
 
5094
-            $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier;
5094
+            $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier;
5095 5095
             // remove sort for speed
5096 5096
             $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');
5097 5097
 
@@ -5201,7 +5201,7 @@  discard block
 block discarded – undo
5201 5201
     public function getCachePath()
5202 5202
     {
5203 5203
         global $base_url;
5204
-        $pth = $base_url . $this->getCacheFolder();
5204
+        $pth = $base_url.$this->getCacheFolder();
5205 5205
         return $pth;
5206 5206
     }
5207 5207
 
@@ -5253,8 +5253,8 @@  discard block
 block discarded – undo
5253 5253
         $out = false;
5254 5254
 
5255 5255
         if (!empty($context)) {
5256
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5257
-                $out = $_SESSION[$context . 'InternalKey'];
5256
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
5257
+                $out = $_SESSION[$context.'InternalKey'];
5258 5258
             }
5259 5259
         } else {
5260 5260
             switch (true) {
@@ -5282,8 +5282,8 @@  discard block
 block discarded – undo
5282 5282
         $out = false;
5283 5283
 
5284 5284
         if (!empty($context)) {
5285
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5286
-                $out = $_SESSION[$context . 'Shortname'];
5285
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
5286
+                $out = $_SESSION[$context.'Shortname'];
5287 5287
             }
5288 5288
         } else {
5289 5289
             switch (true) {
@@ -5328,8 +5328,8 @@  discard block
 block discarded – undo
5328 5328
             return $this->tmpCache[__FUNCTION__][$uid];
5329 5329
         }
5330 5330
 
5331
-        $from = $this->getDatabase()->getFullTableName('manager_users') . ' mu INNER JOIN ' .
5332
-            $this->getDatabase()->getFullTableName('user_attributes'). ' mua ON mua.internalkey=mu.id';
5331
+        $from = $this->getDatabase()->getFullTableName('manager_users').' mu INNER JOIN '.
5332
+            $this->getDatabase()->getFullTableName('user_attributes').' mua ON mua.internalkey=mu.id';
5333 5333
         $where = sprintf("mu.id='%s'", $this->getDatabase()->escape($uid));
5334 5334
         $rs = $this->getDatabase()->select('mu.username, mu.password, mua.*', $from, $where, '', 1);
5335 5335
 
@@ -5355,8 +5355,8 @@  discard block
 block discarded – undo
5355 5355
      */
5356 5356
     public function getWebUserInfo($uid)
5357 5357
     {
5358
-        $rs = $this->getDatabase()->select('wu.username, wu.password, wua.*', $this->getDatabase()->getFullTableName("web_users") . " wu
5359
-                INNER JOIN " . $this->getDatabase()->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5358
+        $rs = $this->getDatabase()->select('wu.username, wu.password, wua.*', $this->getDatabase()->getFullTableName("web_users")." wu
5359
+                INNER JOIN " . $this->getDatabase()->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5360 5360
         if ($row = $this->getDatabase()->getRow($rs)) {
5361 5361
             if (!isset($row['usertype']) or !$row["usertype"]) {
5362 5362
                 $row["usertype"] = "web";
@@ -5392,7 +5392,7 @@  discard block
 block discarded – undo
5392 5392
         } else if (is_array($dg)) {
5393 5393
             // resolve ids to names
5394 5394
             $dgn = array();
5395
-            $ds = $this->getDatabase()->select('name', $this->getDatabase()->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")");
5395
+            $ds = $this->getDatabase()->select('name', $this->getDatabase()->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")");
5396 5396
             while ($row = $this->getDatabase()->getRow($ds)) {
5397 5397
                 $dgn[] = $row['name'];
5398 5398
             }
@@ -5420,7 +5420,7 @@  discard block
 block discarded – undo
5420 5420
         $rt = false;
5421 5421
         if ($_SESSION["webValidated"] == 1) {
5422 5422
             $tbl = $this->getDatabase()->getFullTableName("web_users");
5423
-            $ds = $this->getDatabase()->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'");
5423
+            $ds = $this->getDatabase()->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'");
5424 5424
             if ($row = $this->getDatabase()->getRow($ds)) {
5425 5425
                 if ($row["password"] == md5($oldPwd)) {
5426 5426
                     if (strlen($newPwd) < 6) {
@@ -5430,7 +5430,7 @@  discard block
 block discarded – undo
5430 5430
                     } else {
5431 5431
                         $this->getDatabase()->update(array(
5432 5432
                             'password' => $this->getDatabase()->escape($newPwd),
5433
-                        ), $tbl, "id='" . $this->getLoginUserID() . "'");
5433
+                        ), $tbl, "id='".$this->getLoginUserID()."'");
5434 5434
                         // invoke OnWebChangePassword event
5435 5435
                         $this->invokeEvent("OnWebChangePassword", array(
5436 5436
                             "userid" => $row["id"],
@@ -5461,8 +5461,8 @@  discard block
 block discarded – undo
5461 5461
         // check cache
5462 5462
         $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false;
5463 5463
         if (!is_array($grpNames)) {
5464
-            $rs = $this->getDatabase()->select('wgn.name', $this->getDatabase()->getFullTableName("webgroup_names") . " wgn
5465
-                    INNER JOIN " . $this->getDatabase()->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'");
5464
+            $rs = $this->getDatabase()->select('wgn.name', $this->getDatabase()->getFullTableName("webgroup_names")." wgn
5465
+                    INNER JOIN " . $this->getDatabase()->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'");
5466 5466
             $grpNames = $this->getDatabase()->getColumn("name", $rs);
5467 5467
             // save to cache
5468 5468
             $_SESSION['webUserGroupNames'] = $grpNames;
@@ -5495,7 +5495,7 @@  discard block
 block discarded – undo
5495 5495
         if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) {
5496 5496
             $this->sjscripts[$nextpos] = $src;
5497 5497
         } else {
5498
-            $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>';
5498
+            $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>';
5499 5499
         }
5500 5500
     }
5501 5501
 
@@ -5574,7 +5574,7 @@  discard block
 block discarded – undo
5574 5574
         }
5575 5575
 
5576 5576
         if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) {
5577
-            $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>';
5577
+            $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>';
5578 5578
         }
5579 5579
         if ($startup) {
5580 5580
             $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1;
@@ -5721,7 +5721,7 @@  discard block
 block discarded – undo
5721 5721
                 $eventtime = $this->getMicroTime() - $eventtime;
5722 5722
                 $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000);
5723 5723
                 foreach ($parameter as $k => $v) {
5724
-                    $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>';
5724
+                    $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>';
5725 5725
                 }
5726 5726
                 $this->pluginsCode .= '</fieldset><br />';
5727 5727
                 $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime;
@@ -5749,13 +5749,13 @@  discard block
 block discarded – undo
5749 5749
         $plugin = array();
5750 5750
         if (isset ($this->pluginCache[$pluginName])) {
5751 5751
             $pluginCode = $this->pluginCache[$pluginName];
5752
-            $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : '';
5752
+            $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : '';
5753 5753
         } else {
5754 5754
             $pluginName = $this->getDatabase()->escape($pluginName);
5755 5755
             $result = $this->getDatabase()->select('name, plugincode, properties', $this->getDatabase()->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0");
5756 5756
             if ($row = $this->getDatabase()->getRow($result)) {
5757 5757
                 $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode'];
5758
-                $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties'];
5758
+                $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties'];
5759 5759
             } else {
5760 5760
                 $pluginCode = $this->pluginCache[$pluginName] = "return false;";
5761 5761
                 $pluginProperties = '';
@@ -5779,7 +5779,7 @@  discard block
 block discarded – undo
5779 5779
     {
5780 5780
         $property = array();
5781 5781
 
5782
-        if(\is_scalar($propertyString)) {
5782
+        if (\is_scalar($propertyString)) {
5783 5783
             $propertyString = trim($propertyString);
5784 5784
             $propertyString = str_replace('{}', '', $propertyString);
5785 5785
             $propertyString = str_replace('} {', ',', $propertyString);
@@ -5833,7 +5833,7 @@  discard block
 block discarded – undo
5833 5833
                 }
5834 5834
             }
5835 5835
         }
5836
-        elseif(\is_array($propertyString)) {
5836
+        elseif (\is_array($propertyString)) {
5837 5837
             $property = $propertyString;
5838 5838
         }
5839 5839
         if (!empty($elementName) && !empty($elementType)) {
@@ -5864,7 +5864,7 @@  discard block
 block discarded – undo
5864 5864
     public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)
5865 5865
     {
5866 5866
         $params = array();
5867
-        $fullpath = $element_dir . '/' . $filename;
5867
+        $fullpath = $element_dir.'/'.$filename;
5868 5868
         if (is_readable($fullpath)) {
5869 5869
             $tpl = @fopen($fullpath, "r");
5870 5870
             if ($tpl) {
@@ -6031,8 +6031,8 @@  discard block
 block discarded – undo
6031 6031
         $ph = array('site_url' => MODX_SITE_URL);
6032 6032
         $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";
6033 6033
         $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';
6034
-        $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';
6035
-        $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';
6034
+        $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';
6035
+        $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';
6036 6036
         foreach ($parsed as $key => $val) {
6037 6037
             if (is_array($val)) {
6038 6038
                 foreach ($val as $key2 => $val2) {
@@ -6041,7 +6041,7 @@  discard block
 block discarded – undo
6041 6041
                         $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2);
6042 6042
                     }
6043 6043
                     if (preg_match($regexEmail, $val2, $url)) {
6044
-                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);
6044
+                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);
6045 6045
                     }
6046 6046
                     $parsed[$key][$key2] = $val2;
6047 6047
                 }
@@ -6051,7 +6051,7 @@  discard block
 block discarded – undo
6051 6051
                     $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val);
6052 6052
                 }
6053 6053
                 if (preg_match($regexEmail, $val, $url)) {
6054
-                    $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);
6054
+                    $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);
6055 6055
                 }
6056 6056
                 $parsed[$key] = $val;
6057 6057
             }
@@ -6065,32 +6065,32 @@  discard block
 block discarded – undo
6065 6065
         );
6066 6066
 
6067 6067
         $nl = "\n";
6068
-        $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';
6069
-        $list .= '<p>' . $nl;
6070
-        $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';
6071
-        $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';
6072
-        $list .= '</p><br/>' . $nl;
6073
-        $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';
6074
-        $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';
6075
-        $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';
6076
-        $list .= '<br/>' . $nl;
6068
+        $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';
6069
+        $list .= '<p>'.$nl;
6070
+        $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';
6071
+        $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';
6072
+        $list .= '</p><br/>'.$nl;
6073
+        $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';
6074
+        $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';
6075
+        $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';
6076
+        $list .= '<br/>'.$nl;
6077 6077
         $first = true;
6078 6078
         foreach ($arrayParams as $param => $label) {
6079 6079
             if (isset($parsed[$param])) {
6080 6080
                 if ($first) {
6081
-                    $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;
6082
-                    $list .= '<ul class="docBlockList">' . $nl;
6081
+                    $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;
6082
+                    $list .= '<ul class="docBlockList">'.$nl;
6083 6083
                     $first = false;
6084 6084
                 }
6085
-                $list .= '    <li><strong>' . $label . '</strong>' . $nl;
6086
-                $list .= '        <ul>' . $nl;
6085
+                $list .= '    <li><strong>'.$label.'</strong>'.$nl;
6086
+                $list .= '        <ul>'.$nl;
6087 6087
                 foreach ($parsed[$param] as $val) {
6088
-                    $list .= '            <li>' . $val . '</li>' . $nl;
6088
+                    $list .= '            <li>'.$val.'</li>'.$nl;
6089 6089
                 }
6090
-                $list .= '        </ul></li>' . $nl;
6090
+                $list .= '        </ul></li>'.$nl;
6091 6091
             }
6092 6092
         }
6093
-        $list .= !$first ? '</ul>' . $nl : '';
6093
+        $list .= !$first ? '</ul>'.$nl : '';
6094 6094
 
6095 6095
         return $list;
6096 6096
     }
@@ -6165,8 +6165,8 @@  discard block
 block discarded – undo
6165 6165
      */
6166 6166
     public function addSnippet($name, $phpCode, $namespace = '#', array $defaultParams = array())
6167 6167
     {
6168
-        $this->snippetCache[$namespace . $name] = $phpCode;
6169
-        $this->snippetCache[$namespace . $name . 'Props'] = $defaultParams;
6168
+        $this->snippetCache[$namespace.$name] = $phpCode;
6169
+        $this->snippetCache[$namespace.$name.'Props'] = $defaultParams;
6170 6170
     }
6171 6171
 
6172 6172
     /**
@@ -6174,7 +6174,7 @@  discard block
 block discarded – undo
6174 6174
      */
6175 6175
     public function addChunk($name, $text, $namespace = '#')
6176 6176
     {
6177
-        $this->chunkCache[$namespace . $name] = $text;
6177
+        $this->chunkCache[$namespace.$name] = $text;
6178 6178
     }
6179 6179
 
6180 6180
     /**
@@ -6184,7 +6184,7 @@  discard block
 block discarded – undo
6184 6184
     {
6185 6185
         $out = array();
6186 6186
 
6187
-        if (! is_dir($scanPath) || empty($ext)) {
6187
+        if (!is_dir($scanPath) || empty($ext)) {
6188 6188
             return $out;
6189 6189
         }
6190 6190
         $iterator = new \RecursiveIteratorIterator(
@@ -6196,22 +6196,22 @@  discard block
 block discarded – undo
6196 6196
              * @var \SplFileInfo $item
6197 6197
              */
6198 6198
             if ($item->isFile() && $item->isReadable() && \in_array($item->getExtension(), $ext)) {
6199
-                $name = $item->getBasename('.' . $item->getExtension());
6199
+                $name = $item->getBasename('.'.$item->getExtension());
6200 6200
                 $path = ltrim(str_replace(
6201 6201
                     array(rtrim($scanPath, '//'), '/'),
6202 6202
                     array('', '\\'),
6203
-                    $item->getPath() . '/'
6203
+                    $item->getPath().'/'
6204 6204
                 ), '\\');
6205 6205
 
6206 6206
                 if (!empty($path)) {
6207
-                    $name = $path . $name;
6207
+                    $name = $path.$name;
6208 6208
                 }
6209 6209
                 switch ($type) {
6210 6210
                     case 'chunk':
6211 6211
                         $out[$name] = file_get_contents($item->getRealPath());
6212 6212
                         break;
6213 6213
                     case 'snippet':
6214
-                        $out[$name] = "return require '" . $item->getRealPath() . "';";
6214
+                        $out[$name] = "return require '".$item->getRealPath()."';";
6215 6215
                         break;
6216 6216
                     default:
6217 6217
                         throw new \Exception;
@@ -6255,7 +6255,7 @@  discard block
 block discarded – undo
6255 6255
         }
6256 6256
 
6257 6257
         if (!$isSafe) {
6258
-            $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);
6258
+            $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);
6259 6259
             $title = sprintf('Unknown eval was executed (%s)', $this->getPhpCompat()->htmlspecialchars(substr(trim($phpcode), 0, 50)));
6260 6260
             $this->messageQuit($title, '', true, '', '', 'Parser', $msg);
6261 6261
             return;
@@ -6269,7 +6269,7 @@  discard block
 block discarded – undo
6269 6269
             return 'array()';
6270 6270
         }
6271 6271
 
6272
-        $output = $echo . $return;
6272
+        $output = $echo.$return;
6273 6273
         modx_sanitize_gpc($output);
6274 6274
         return $this->getPhpCompat()->htmlspecialchars($output); // Maybe, all html tags are dangerous
6275 6275
     }
@@ -6287,8 +6287,8 @@  discard block
 block discarded – undo
6287 6287
 
6288 6288
         $safe = explode(',', $safe_functions);
6289 6289
 
6290
-        $phpcode = rtrim($phpcode, ';') . ';';
6291
-        $tokens = token_get_all('<?php ' . $phpcode);
6290
+        $phpcode = rtrim($phpcode, ';').';';
6291
+        $tokens = token_get_all('<?php '.$phpcode);
6292 6292
         foreach ($tokens as $i => $token) {
6293 6293
             if (!is_array($token)) {
6294 6294
                 continue;
@@ -6324,7 +6324,7 @@  discard block
 block discarded – undo
6324 6324
     public function atBindFileContent($str = '')
6325 6325
     {
6326 6326
 
6327
-        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', '');
6327
+        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', '');
6328 6328
 
6329 6329
         if (stripos($str, '@FILE') !== 0) {
6330 6330
             return $str;
@@ -6347,7 +6347,7 @@  discard block
 block discarded – undo
6347 6347
         $errorMsg = sprintf("Could not retrieve string '%s'.", $str);
6348 6348
 
6349 6349
         foreach ($search_path as $path) {
6350
-            $file_path = MODX_BASE_PATH . $path . $str;
6350
+            $file_path = MODX_BASE_PATH.$path.$str;
6351 6351
             if (strpos($file_path, MODX_MANAGER_PATH) === 0) {
6352 6352
                 return $errorMsg;
6353 6353
             } elseif (is_file($file_path)) {
@@ -6361,7 +6361,7 @@  discard block
 block discarded – undo
6361 6361
             return $errorMsg;
6362 6362
         }
6363 6363
 
6364
-        $content = (string)file_get_contents($file_path);
6364
+        $content = (string) file_get_contents($file_path);
6365 6365
         if ($content === false) {
6366 6366
             return $errorMsg;
6367 6367
         }
@@ -6470,22 +6470,22 @@  discard block
 block discarded – undo
6470 6470
 
6471 6471
         $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
6472 6472
         $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
6473
-        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI'];
6473
+        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI'];
6474 6474
         $request_uri = $this->getPhpCompat()->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);
6475 6475
         $ua = $this->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);
6476 6476
         $referer = $this->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);
6477 6477
         if ($is_error) {
6478 6478
             $str = '<h2 style="color:red">&laquo; Evo Parse Error &raquo;</h2>';
6479 6479
             if ($msg != 'PHP Parse Error') {
6480
-                $str .= '<h3 style="color:red">' . $msg . '</h3>';
6480
+                $str .= '<h3 style="color:red">'.$msg.'</h3>';
6481 6481
             }
6482 6482
         } else {
6483 6483
             $str = '<h2 style="color:#003399">&laquo; Evo Debug/ stop message &raquo;</h2>';
6484
-            $str .= '<h3 style="color:#003399">' . $msg . '</h3>';
6484
+            $str .= '<h3 style="color:#003399">'.$msg.'</h3>';
6485 6485
         }
6486 6486
 
6487 6487
         if (!empty ($query)) {
6488
-            $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>';
6488
+            $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>';
6489 6489
         }
6490 6490
 
6491 6491
         $errortype = array(
@@ -6508,13 +6508,13 @@  discard block
 block discarded – undo
6508 6508
 
6509 6509
         if (!empty($nr) || !empty($file)) {
6510 6510
             if ($text != '') {
6511
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';
6511
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';
6512 6512
             }
6513 6513
             if ($output != '') {
6514
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';
6514
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';
6515 6515
             }
6516 6516
             if ($nr !== '') {
6517
-                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]");
6517
+                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]");
6518 6518
             }
6519 6519
             if ($file) {
6520 6520
                 $table[] = array('File', $file);
@@ -6534,7 +6534,7 @@  discard block
 block discarded – undo
6534 6534
         }
6535 6535
 
6536 6536
         if (!empty($this->event->activePlugin)) {
6537
-            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')');
6537
+            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')');
6538 6538
         }
6539 6539
 
6540 6540
         $str .= $MakeTable->create($table, array('Error information', ''));
@@ -6544,17 +6544,17 @@  discard block
 block discarded – undo
6544 6544
         $table[] = array('REQUEST_URI', $request_uri);
6545 6545
 
6546 6546
         if ($this->getManagerApi()->action) {
6547
-            include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
6547
+            include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
6548 6548
             global $action_list;
6549 6549
             $actionName = (isset($action_list[$this->getManagerApi()->action])) ? " - {$action_list[$this->getManagerApi()->action]}" : '';
6550 6550
 
6551
-            $table[] = array('Manager action', $this->getManagerApi()->action . $actionName);
6551
+            $table[] = array('Manager action', $this->getManagerApi()->action.$actionName);
6552 6552
         }
6553 6553
 
6554 6554
         if (preg_match('@^[0-9]+@', $this->documentIdentifier)) {
6555 6555
             $resource = $this->getDocumentObject('id', $this->documentIdentifier);
6556 6556
             $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');
6557
-            $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>');
6557
+            $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>');
6558 6558
         }
6559 6559
         $table[] = array('Referer', $referer);
6560 6560
         $table[] = array('User Agent', $ua);
@@ -6575,7 +6575,7 @@  discard block
 block discarded – undo
6575 6575
 
6576 6576
         $mem = memory_get_peak_usage(true);
6577 6577
         $total_mem = $mem - $this->mstart;
6578
-        $total_mem = ($total_mem / 1024 / 1024) . ' mb';
6578
+        $total_mem = ($total_mem / 1024 / 1024).' mb';
6579 6579
 
6580 6580
         $queryTime = $this->queryTime;
6581 6581
         $phpTime = $totalTime - $queryTime;
@@ -6596,18 +6596,18 @@  discard block
 block discarded – undo
6596 6596
         $str .= $this->get_backtrace(debug_backtrace());
6597 6597
         // Log error
6598 6598
         if (!empty($this->currentSnippet)) {
6599
-            $source = 'Snippet - ' . $this->currentSnippet;
6599
+            $source = 'Snippet - '.$this->currentSnippet;
6600 6600
         } elseif (!empty($this->event->activePlugin)) {
6601
-            $source = 'Plugin - ' . $this->event->activePlugin;
6601
+            $source = 'Plugin - '.$this->event->activePlugin;
6602 6602
         } elseif ($source !== '') {
6603
-            $source = 'Parser - ' . $source;
6603
+            $source = 'Parser - '.$source;
6604 6604
         } elseif ($query !== '') {
6605 6605
             $source = 'SQL Query';
6606 6606
         } else {
6607 6607
             $source = 'Parser';
6608 6608
         }
6609 6609
         if ($msg) {
6610
-            $source .= ' / ' . $msg;
6610
+            $source .= ' / '.$msg;
6611 6611
         }
6612 6612
         if (isset($actionName) && !empty($actionName)) {
6613 6613
             $source .= $actionName;
@@ -6639,12 +6639,12 @@  discard block
 block discarded – undo
6639 6639
 
6640 6640
         // Display error
6641 6641
         if (isset($_SESSION['mgrValidated'])) {
6642
-            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>
6642
+            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>
6643 6643
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6644
-                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />
6644
+                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />
6645 6645
                  <style type="text/css">body { padding:10px; } td {font:inherit;}</style>
6646 6646
                  </head><body>
6647
-                 ' . $str . '</body></html>';
6647
+                 ' . $str.'</body></html>';
6648 6648
 
6649 6649
         } else {
6650 6650
             echo 'Error';
@@ -6679,7 +6679,7 @@  discard block
 block discarded – undo
6679 6679
             switch ($val['type']) {
6680 6680
                 case '->':
6681 6681
                 case '::':
6682
-                    $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];
6682
+                    $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];
6683 6683
                     break;
6684 6684
                 default:
6685 6685
                     $functionName = $val['function'];
@@ -6689,7 +6689,7 @@  discard block
 block discarded – undo
6689 6689
             $args = array_pad(array(), $_, '$var');
6690 6690
             $args = implode(", ", $args);
6691 6691
             $modx = &$this;
6692
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6692
+            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) {
6693 6693
                 $arg = $val['args'][$tmp - 1];
6694 6694
                 switch (true) {
6695 6695
                     case is_null($arg): {
@@ -6701,7 +6701,7 @@  discard block
 block discarded – undo
6701 6701
                         break;
6702 6702
                     }
6703 6703
                     case is_scalar($arg): {
6704
-                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->getPhpCompat()->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'");
6704
+                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->getPhpCompat()->htmlspecialchars(str_replace("'", "\\'", $arg))."'");
6705 6705
                         break;
6706 6706
                     }
6707 6707
                     case is_bool($arg): {
@@ -6709,23 +6709,23 @@  discard block
 block discarded – undo
6709 6709
                         break;
6710 6710
                     }
6711 6711
                     case is_array($arg): {
6712
-                        $out = 'array $var' . $tmp;
6712
+                        $out = 'array $var'.$tmp;
6713 6713
                         break;
6714 6714
                     }
6715 6715
                     case is_object($arg): {
6716
-                        $out = get_class($arg) . ' $var' . $tmp;
6716
+                        $out = get_class($arg).' $var'.$tmp;
6717 6717
                         break;
6718 6718
                     }
6719 6719
                     default: {
6720
-                        $out = '$var' . $tmp;
6720
+                        $out = '$var'.$tmp;
6721 6721
                     }
6722 6722
                 }
6723 6723
                 $tmp++;
6724 6724
                 return $out;
6725 6725
             }, $args);
6726 6726
             $line = array(
6727
-                "<strong>" . $functionName . "</strong>(" . $args . ")",
6728
-                $path . " on line " . $val['line']
6727
+                "<strong>".$functionName."</strong>(".$args.")",
6728
+                $path." on line ".$val['line']
6729 6729
             );
6730 6730
             $table[] = array(implode("<br />", $line));
6731 6731
         }
@@ -6766,7 +6766,7 @@  discard block
 block discarded – undo
6766 6766
             $alias = strip_tags($alias); // strip HTML
6767 6767
             $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters
6768 6768
             $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash
6769
-            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one
6769
+            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one
6770 6770
             $alias = trim($alias, '-'); // trim excess
6771 6771
             return $alias;
6772 6772
         }
@@ -6782,7 +6782,7 @@  discard block
 block discarded – undo
6782 6782
         $precisions = count($sizes) - 1;
6783 6783
         foreach ($sizes as $unit => $bytes) {
6784 6784
             if ($size >= $bytes) {
6785
-                return number_format($size / $bytes, $precisions) . ' ' . $unit;
6785
+                return number_format($size / $bytes, $precisions).' '.$unit;
6786 6786
             }
6787 6787
             $precisions--;
6788 6788
         }
@@ -6886,10 +6886,10 @@  discard block
 block discarded – undo
6886 6886
 
6887 6887
         if (strpos($str, MODX_MANAGER_PATH) === 0) {
6888 6888
             return false;
6889
-        } elseif (is_file(MODX_BASE_PATH . $str)) {
6890
-            $file_path = MODX_BASE_PATH . $str;
6891
-        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) {
6892
-            $file_path = MODX_BASE_PATH . $tpl_dir . $str;
6889
+        } elseif (is_file(MODX_BASE_PATH.$str)) {
6890
+            $file_path = MODX_BASE_PATH.$str;
6891
+        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) {
6892
+            $file_path = MODX_BASE_PATH.$tpl_dir.$str;
6893 6893
         } else {
6894 6894
             return false;
6895 6895
         }
@@ -7013,7 +7013,7 @@  discard block
 block discarded – undo
7013 7013
             $title = 'no title';
7014 7014
         }
7015 7015
         if (is_array($msg)) {
7016
-            $msg = '<pre>' . print_r($msg, true) . '</pre>';
7016
+            $msg = '<pre>'.print_r($msg, true).'</pre>';
7017 7017
         } elseif ($msg === '') {
7018 7018
             $msg = $_SERVER['REQUEST_URI'];
7019 7019
         }
Please login to merge, or discard this patch.
Braces   +62 added lines, -31 removed lines patch added patch discarded remove patch
@@ -281,7 +281,8 @@  discard block
 block discarded – undo
281 281
         return $service;
282 282
     }
283 283
 
284
-    private function checkServiceAlias($name){
284
+    private function checkServiceAlias($name)
285
+    {
285 286
         foreach ($this->providerAliases as $alias => $interface) {
286 287
             if($name === $interface) {
287 288
                 return $alias;
@@ -963,13 +964,15 @@  discard block
 block discarded – undo
963 964
             $this->virtualDir = '';
964 965
         }
965 966
 
966
-        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 */
967
+        if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) {
968
+/* we got an ID returned, check to make sure it's not an alias */
967 969
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
968 970
             if ($this->config['use_alias_path'] == 1) {
969 971
                 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))))) {
970 972
                     $this->documentMethod = 'id';
971 973
                     return $q;
972
-                } else { /* not a valid id in terms of virtualDir, treat as alias */
974
+                } else {
975
+/* not a valid id in terms of virtualDir, treat as alias */
973 976
                     $this->documentMethod = 'alias';
974 977
                     return $q;
975 978
                 }
@@ -977,7 +980,8 @@  discard block
 block discarded – undo
977 980
                 $this->documentMethod = 'id';
978 981
                 return $q;
979 982
             }
980
-        } else { /* we didn't get an ID back, so instead we assume it's an alias */
983
+        } else {
984
+/* we didn't get an ID back, so instead we assume it's an alias */
981 985
             if ($this->config['friendly_alias_urls'] != 1) {
982 986
                 $q = $qOrig;
983 987
             }
@@ -1007,13 +1011,14 @@  discard block
 block discarded – undo
1007 1011
      * @param $id
1008 1012
      * @return array|mixed|null|string
1009 1013
      */
1010
-    public function makePageCacheKey($id){
1014
+    public function makePageCacheKey($id)
1015
+    {
1011 1016
         $hash = $id;
1012 1017
         $tmp = null;
1013 1018
         $params = array();
1014
-        if(!empty($this->systemCacheKey)){
1019
+        if(!empty($this->systemCacheKey)) {
1015 1020
             $hash = $this->systemCacheKey;
1016
-        }else {
1021
+        } else {
1017 1022
             if (!empty($_GET)) {
1018 1023
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
1019 1024
                 $params = $_GET;
@@ -1022,7 +1027,7 @@  discard block
 block discarded – undo
1022 1027
             }
1023 1028
         }
1024 1029
         $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params));
1025
-        if (is_array($evtOut) && count($evtOut) > 0){
1030
+        if (is_array($evtOut) && count($evtOut) > 0) {
1026 1031
             $tmp = array_pop($evtOut);
1027 1032
         }
1028 1033
         return empty($tmp) ? $hash : $tmp;
@@ -1359,7 +1364,8 @@  discard block
 block discarded – undo
1359 1364
             $where
1360 1365
         );
1361 1366
         $this->getDatabase()->update($field, $this->getDatabase()->getFullTableName('site_content'), $where);
1362
-        if ($this->getDatabase()->getRecordCount($result_pub) >= 1) { //Event unPublished doc
1367
+        if ($this->getDatabase()->getRecordCount($result_pub) >= 1) {
1368
+//Event unPublished doc
1363 1369
             while ($row_pub = $this->getDatabase()->getRow($result_pub)) {
1364 1370
                 $this->invokeEvent("OnDocUnPublished", array(
1365 1371
                     "docid" => $row_pub['id']
@@ -1376,7 +1382,8 @@  discard block
 block discarded – undo
1376 1382
             $where
1377 1383
         );
1378 1384
         $this->getDatabase()->update($field, $this->getDatabase()->getFullTableName('site_content'), $where);
1379
-        if ($this->getDatabase()->getRecordCount($result_unpub) >= 1) { //Event unPublished doc
1385
+        if ($this->getDatabase()->getRecordCount($result_unpub) >= 1) {
1386
+//Event unPublished doc
1380 1387
             while ($row_unpub = $this->getDatabase()->getRow($result_unpub)) {
1381 1388
                 $this->invokeEvent("OnDocUnPublished", array(
1382 1389
                     "docid" => $row_unpub['id']
@@ -1467,10 +1474,18 @@  discard block
 block discarded – undo
1467 1474
             return array();
1468 1475
         }
1469 1476
         $spacer = md5('<<<EVO>>>');
1470
-        if($left==='{{' && strpos($content,';}}')!==false)  $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1471
-        if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1472
-        if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1473
-        if($left==='[[' && strpos($content,']]]')!==false)  $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1477
+        if($left==='{{' && strpos($content,';}}')!==false) {
1478
+            $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1479
+        }
1480
+        if($left==='{{' && strpos($content,'{{}}')!==false) {
1481
+            $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1482
+        }
1483
+        if($left==='[[' && strpos($content,']]]]')!==false) {
1484
+            $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1485
+        }
1486
+        if($left==='[[' && strpos($content,']]]')!==false) {
1487
+            $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1488
+        }
1474 1489
 
1475 1490
         $pos['<![CDATA['] = strpos($content, '<![CDATA[');
1476 1491
         $pos[']]>'] = strpos($content, ']]>');
@@ -1523,7 +1538,8 @@  discard block
 block discarded – undo
1523 1538
                         }
1524 1539
                     }
1525 1540
 
1526
-                    if (!in_array($fetch, $tags)) {  // Avoid double Matches
1541
+                    if (!in_array($fetch, $tags)) {
1542
+// Avoid double Matches
1527 1543
                         $tags[] = $fetch; // Fetch
1528 1544
                     };
1529 1545
                     $fetch = ''; // and reset
@@ -1541,7 +1557,9 @@  discard block
 block discarded – undo
1541 1557
             }
1542 1558
         }
1543 1559
         foreach($tags as $i=>$tag) {
1544
-            if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);
1560
+            if(strpos($tag,$spacer)!==false) {
1561
+                $tags[$i] = str_replace($spacer, '', $tag);
1562
+            }
1545 1563
         }
1546 1564
         return $tags;
1547 1565
     }
@@ -1581,7 +1599,10 @@  discard block
 block discarded – undo
1581 1599
         }
1582 1600
 
1583 1601
         foreach ($matches[1] as $i => $key) {
1584
-            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1602
+            if(strpos($key,'[+')!==false) {
1603
+                continue;
1604
+            }
1605
+            // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1585 1606
             if (substr($key, 0, 1) == '#') {
1586 1607
                 $key = substr($key, 1);
1587 1608
             } // remove # for QuickEdit format
@@ -2307,7 +2328,8 @@  discard block
 block discarded – undo
2307 2328
      * @return mixed|string
2308 2329
      */
2309 2330
     public function _getSGVar($value)
2310
-    { // Get super globals
2331
+    {
2332
+// Get super globals
2311 2333
         $key = $value;
2312 2334
         $_ = $this->config['enable_filter'];
2313 2335
         $this->config['enable_filter'] = 1;
@@ -2716,7 +2738,8 @@  discard block
 block discarded – undo
2716 2738
         if ($this->config['friendly_urls'] == 1) {
2717 2739
             $aliases = array();
2718 2740
             if (is_array($this->documentListing)) {
2719
-                foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site!
2741
+                foreach ($this->documentListing as $path => $docid) {
2742
+// This is big Loop on large site!
2720 2743
                     $aliases[$docid] = $path;
2721 2744
                     $isfolder[$docid] = $this->aliasListing[$docid]['isfolder'];
2722 2745
                 }
@@ -2749,7 +2772,7 @@  discard block
 block discarded – undo
2749 2772
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2750 2773
             $pref = $this->config['friendly_url_prefix'];
2751 2774
             $suff = $this->config['friendly_url_suffix'];
2752
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2775
+            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){
2753 2776
                 global $modx;
2754 2777
                 $thealias = $aliases[$m[1]];
2755 2778
                 $thefolder = $isfolder[$m[1]];
@@ -4533,7 +4556,8 @@  discard block
 block discarded – undo
4533 4556
         if (isset ($this->snippetCache[$snippetName])) {
4534 4557
             $snippet = $this->snippetCache[$snippetName];
4535 4558
             $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4536
-        } else { // not in cache so let's check the db
4559
+        } else {
4560
+// not in cache so let's check the db
4537 4561
             $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getDatabase()->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getDatabase()->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->getDatabase()->escape($snippetName) . "'  AND ss.disabled=0;";
4538 4562
             $result = $this->getDatabase()->query($sql);
4539 4563
             if ($this->getDatabase()->getRecordCount($result) == 1) {
@@ -5047,7 +5071,7 @@  discard block
 block discarded – undo
5047 5071
             $result = $this->getDatabase()->makeArray($rs);
5048 5072
 
5049 5073
             // get default/built-in template variables
5050
-            if(is_array($docRow)){
5074
+            if(is_array($docRow)) {
5051 5075
                 ksort($docRow);
5052 5076
 
5053 5077
                 foreach ($docRow as $key => $value) {
@@ -5524,12 +5548,16 @@  discard block
 block discarded – undo
5524 5548
             return '';
5525 5549
         } // nothing to register
5526 5550
         if (!is_array($options)) {
5527
-            if (is_bool($options))  // backward compatibility with old plaintext parameter
5551
+            if (is_bool($options)) {
5552
+                // backward compatibility with old plaintext parameter
5528 5553
             {
5529 5554
                 $options = array('plaintext' => $options);
5530
-            } elseif (is_string($options)) // Also allow script name as 2nd param
5555
+            }
5556
+            } elseif (is_string($options)) {
5557
+                // Also allow script name as 2nd param
5531 5558
             {
5532 5559
                 $options = array('name' => $options);
5560
+            }
5533 5561
             } else {
5534 5562
                 $options = array();
5535 5563
             }
@@ -5541,7 +5569,8 @@  discard block
 block discarded – undo
5541 5569
         unset($overwritepos); // probably unnecessary--just making sure
5542 5570
 
5543 5571
         $useThisVer = true;
5544
-        if (isset($this->loadedjscripts[$key])) { // a matching script was found
5572
+        if (isset($this->loadedjscripts[$key])) {
5573
+// a matching script was found
5545 5574
             // if existing script is a startup script, make sure the candidate is also a startup script
5546 5575
             if ($this->loadedjscripts[$key]['startup']) {
5547 5576
                 $startup = true;
@@ -5561,7 +5590,8 @@  discard block
 block discarded – undo
5561 5590
                     // overwrite the old script (the position may be important for dependent scripts)
5562 5591
                     $overwritepos = $this->loadedjscripts[$key]['pos'];
5563 5592
                 }
5564
-            } else { // Use the original version
5593
+            } else {
5594
+// Use the original version
5565 5595
                 if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) {
5566 5596
                     // need to move the exisiting script to the head
5567 5597
                     $version = $this->loadedjscripts[$key][$version];
@@ -5686,7 +5716,8 @@  discard block
 block discarded – undo
5686 5716
         }
5687 5717
 
5688 5718
         $results = null;
5689
-        foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop
5719
+        foreach ($this->pluginEvent[$evtName] as $pluginName) {
5720
+// start for loop
5690 5721
             if ($this->dumpPlugins) {
5691 5722
                 $eventtime = $this->getMicroTime();
5692 5723
             }
@@ -5832,8 +5863,7 @@  discard block
 block discarded – undo
5832 5863
                     }
5833 5864
                 }
5834 5865
             }
5835
-        }
5836
-        elseif(\is_array($propertyString)) {
5866
+        } elseif(\is_array($propertyString)) {
5837 5867
             $property = $propertyString;
5838 5868
         }
5839 5869
         if (!empty($elementName) && !empty($elementType)) {
@@ -6280,7 +6310,8 @@  discard block
 block discarded – undo
6280 6310
      * @return bool
6281 6311
      */
6282 6312
     public function isSafeCode($phpcode = '', $safe_functions = '')
6283
-    { // return true or false
6313
+    {
6314
+// return true or false
6284 6315
         if ($safe_functions == '') {
6285 6316
             return false;
6286 6317
         }
@@ -6689,7 +6720,7 @@  discard block
 block discarded – undo
6689 6720
             $args = array_pad(array(), $_, '$var');
6690 6721
             $args = implode(", ", $args);
6691 6722
             $modx = &$this;
6692
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6723
+            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){
6693 6724
                 $arg = $val['args'][$tmp - 1];
6694 6725
                 switch (true) {
6695 6726
                     case is_null($arg): {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2612,11 +2612,11 @@  discard block
 block discarded – undo
2612 2612
         if (isset($this->snippetCache[$snip_name])) {
2613 2613
             $snippetObject['name'] = $snip_name;
2614 2614
             $snippetObject['content'] = $this->snippetCache[$snip_name];
2615
-            if (isset($this->snippetCache["{$snip_name}Props"])) {
2616
-                if (!isset($this->snippetCache["{$snip_name}Props"])) {
2617
-                    $this->snippetCache["{$snip_name}Props"] = '';
2615
+            if (isset($this->snippetCache["{$snip_name}props"])) {
2616
+                if (!isset($this->snippetCache["{$snip_name}props"])) {
2617
+                    $this->snippetCache["{$snip_name}props"] = '';
2618 2618
                 }
2619
-                $snippetObject['properties'] = $this->snippetCache["{$snip_name}Props"];
2619
+                $snippetObject['properties'] = $this->snippetCache["{$snip_name}props"];
2620 2620
             }
2621 2621
         } elseif (substr($snip_name, 0, 1) === '@' && isset($this->pluginEvent[trim($snip_name, '@')])) {
2622 2622
             $snippetObject['name'] = trim($snip_name, '@');
@@ -2645,7 +2645,7 @@  discard block
 block discarded – undo
2645 2645
             $snippetObject['content'] = $snip_content;
2646 2646
             $snippetObject['properties'] = $snip_prop;
2647 2647
             $this->snippetCache[$snip_name] = $snip_content;
2648
-            $this->snippetCache["{$snip_name}Props"] = $snip_prop;
2648
+            $this->snippetCache["{$snip_name}props"] = $snip_prop;
2649 2649
         }
2650 2650
         return $snippetObject;
2651 2651
     }
@@ -3960,7 +3960,7 @@  discard block
 block discarded – undo
3960 3960
         }
3961 3961
         // build query
3962 3962
         $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3963
-        $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc
3963
+        $result = $this->getDatabase()->select("distinct {$fields}", "{$tblsc} sc
3964 3964
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3965 3965
         $resourceArray = $this->getDatabase()->makeArray($result);
3966 3966
         $this->tmpCache[__FUNCTION__][$cacheKey] = $resourceArray;
@@ -3997,7 +3997,7 @@  discard block
 block discarded – undo
3997 3997
         }
3998 3998
         // build query
3999 3999
         $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
4000
-        $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc
4000
+        $result = $this->getDatabase()->select("distinct {$fields}", "{$tblsc} sc
4001 4001
                 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}");
4002 4002
         $resourceArray = $this->getDatabase()->makeArray($result);
4003 4003
 
@@ -4053,7 +4053,7 @@  discard block
 block discarded – undo
4053 4053
         $tblsc = $this->getDatabase()->getFullTableName('site_content');
4054 4054
         $tbldg = $this->getDatabase()->getFullTableName('document_groups');
4055 4055
 
4056
-        $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc
4056
+        $result = $this->getDatabase()->select("distinct {$fields}", "{$tblsc} sc
4057 4057
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$parentid}' {$published} {$deleted} {$where} AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
4058 4058
 
4059 4059
         $resourceArray = $this->getDatabase()->makeArray($result);
@@ -4119,7 +4119,7 @@  discard block
 block discarded – undo
4119 4119
             $tblsc = $this->getDatabase()->getFullTableName('site_content');
4120 4120
             $tbldg = $this->getDatabase()->getFullTableName('document_groups');
4121 4121
 
4122
-            $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc
4122
+            $result = $this->getDatabase()->select("distinct {$fields}", "{$tblsc} sc
4123 4123
                     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);
4124 4124
 
4125 4125
             $resourceArray = $this->getDatabase()->makeArray($result);
@@ -4707,7 +4707,7 @@  discard block
 block discarded – undo
4707 4707
                 $template = $doc['content'];
4708 4708
                 break;
4709 4709
             case 'SELECT':
4710
-                $this->getDatabase()->getValue($this->getDatabase()->query("SELECT {$template}"));
4710
+                $this->getDatabase()->getValue($this->getDatabase()->query("select {$template}"));
4711 4711
                 break;
4712 4712
             default:
4713 4713
                 if (!($template = $this->getChunk($tpl))) {
Please login to merge, or discard this patch.
manager/includes/src/Cache.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         if (isset($this->aliases[$id])) {
101 101
             if ($this->aliasVisible[$id] == 1) {
102 102
                 if ($path != '') {
103
-                    $path = $this->aliases[$id] . '/' . $path;
103
+                    $path = $this->aliases[$id].'/'.$path;
104 104
                 } else {
105 105
                     $path = $this->aliases[$id];
106 106
                 }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             $modx->messageQuit("Cache path not set.");
125 125
         }
126 126
 
127
-        $files = glob(realpath($this->cachePath) . '/*.pageCache.php');
127
+        $files = glob(realpath($this->cachePath).'/*.pageCache.php');
128 128
         $filesincache = count($files);
129 129
         $deletedfiles = array();
130 130
         while ($file = array_shift($files)) {
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
                 if (isset($opcache)) {
160 160
                     echo '<p>Opcache empty.</p>';
161 161
                 }
162
-                echo '<p>' . $_lang['cache_files_deleted'] . '</p><ul>';
162
+                echo '<p>'.$_lang['cache_files_deleted'].'</p><ul>';
163 163
                 foreach ($deletedfiles as $deletedfile) {
164
-                    echo '<li>' . $deletedfile . '</li>';
164
+                    echo '<li>'.$deletedfile.'</li>';
165 165
                 }
166 166
                 echo '</ul>';
167 167
             }
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 
181 181
 
182 182
         // write the file
183
-        $content = '<?php' . "\n";
184
-        $content .= '$recent_update=\'' . $this->request_time . '\';' . "\n";
185
-        $content .= '$cacheRefreshTime=\'' . $cacheRefreshTime . '\';' . "\n";
183
+        $content = '<?php'."\n";
184
+        $content .= '$recent_update=\''.$this->request_time.'\';'."\n";
185
+        $content .= '$cacheRefreshTime=\''.$cacheRefreshTime.'\';'."\n";
186 186
 
187
-        $filename = $this->cachePath . '/sitePublishing.idx.php';
187
+        $filename = $this->cachePath.'/sitePublishing.idx.php';
188 188
         if (!$handle = fopen($filename, 'w')) {
189 189
             exit("Cannot open file ({$filename}");
190 190
         }
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         $result = $modx->getDatabase()->select(
211 211
             'MIN(pub_date) AS minpub',
212 212
             $modx->getDatabase()->getFullTableName('site_content'),
213
-            'pub_date>' . $this->request_time
213
+            'pub_date>'.$this->request_time
214 214
         );
215 215
         if (!$result) {
216 216
             echo "Couldn't determine next publish event!";
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         $result = $modx->getDatabase()->select(
225 225
             'MIN(unpub_date) AS minunpub',
226 226
             $modx->getDatabase()->getFullTableName('site_content'),
227
-            'unpub_date>' . $this->request_time
227
+            'unpub_date>'.$this->request_time
228 228
         );
229 229
         if (!$result) {
230 230
             echo "Couldn't determine next unpublish event!";
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         $config = array();
265 265
         $content .= '$c=&$this->config;';
266 266
         while (list($key, $value) = $modx->getDatabase()->getRow($rs, 'num')) {
267
-            $content .= '$c[\'' . $key . '\']="' . $this->escapeDoubleQuotes($value) . '";';
267
+            $content .= '$c[\''.$key.'\']="'.$this->escapeDoubleQuotes($value).'";';
268 268
             $config[$key] = $value;
269 269
         }
270 270
 
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
             $f['isfolder'] = 'c.isfolder';
286 286
             $f['alias_visible'] = 'c.alias_visible';
287 287
             $from = array();
288
-            $from[] = $modx->getDatabase()->getFullTableName('site_content') . ' c';
289
-            $from[] = 'LEFT JOIN ' . $modx->getDatabase()->getFullTableName('site_content') . ' p ON p.id=c.parent';
288
+            $from[] = $modx->getDatabase()->getFullTableName('site_content').' c';
289
+            $from[] = 'LEFT JOIN '.$modx->getDatabase()->getFullTableName('site_content').' p ON p.id=c.parent';
290 290
             $where = 'c.deleted=0 AND (c.isfolder=1 OR p.alias_visible=0)';
291 291
             $rs = $modx->getDatabase()->select($f, $from, $where, 'c.parent, c.menuindex');
292 292
         } else {
@@ -308,16 +308,16 @@  discard block
 block discarded – undo
308 308
             $docid = $doc['id'];
309 309
             if ($use_alias_path) {
310 310
                 $tmpPath = $this->getParents($doc['parent']);
311
-                $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '') . $doc['alias'];
311
+                $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '').$doc['alias'];
312 312
                 $key = $alias;
313 313
             } else {
314 314
                 $key = $doc['alias'];
315 315
             }
316 316
 
317 317
             $doc['path'] = $tmpPath;
318
-            $content .= '$a[' . $docid . ']=array(\'id\'=>' . $docid . ',\'alias\'=>\'' . $doc['alias'] . '\',\'path\'=>\'' . $doc['path'] . '\',\'parent\'=>' . $doc['parent'] . ',\'isfolder\'=>' . $doc['isfolder'] . ',\'alias_visible\'=>' . $doc['alias_visible'] . ');';
319
-            $content .= '$d[\'' . $key . '\']=' . $docid . ';';
320
-            $content .= '$m[]=array(' . $doc['parent'] . '=>' . $docid . ');';
318
+            $content .= '$a['.$docid.']=array(\'id\'=>'.$docid.',\'alias\'=>\''.$doc['alias'].'\',\'path\'=>\''.$doc['path'].'\',\'parent\'=>'.$doc['parent'].',\'isfolder\'=>'.$doc['isfolder'].',\'alias_visible\'=>'.$doc['alias_visible'].');';
319
+            $content .= '$d[\''.$key.'\']='.$docid.';';
320
+            $content .= '$m[]=array('.$doc['parent'].'=>'.$docid.');';
321 321
         }
322 322
 
323 323
         // get content types
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
         );
329 329
         $content .= '$c=&$this->contentTypes;';
330 330
         while ($doc = $modx->getDatabase()->getRow($rs)) {
331
-            $content .= '$c[\'' . $doc['id'] . '\']=\'' . $doc['contentType'] . '\';';
331
+            $content .= '$c[\''.$doc['id'].'\']=\''.$doc['contentType'].'\';';
332 332
         }
333 333
 
334 334
         // WRITE Chunks to cache file
@@ -338,30 +338,30 @@  discard block
 block discarded – undo
338 338
             if ($modx->config['minifyphp_incache']) {
339 339
                 $doc['snippet'] = $this->php_strip_whitespace($doc['snippet']);
340 340
             }
341
-            $content .= '$c[\'' . $doc['name'] . '\']=\'' . ($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])) . '\';';
341
+            $content .= '$c[\''.$doc['name'].'\']=\''.($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])).'\';';
342 342
         }
343 343
 
344 344
         // WRITE snippets to cache file
345 345
         $f = 'ss.*, sm.properties as sharedproperties';
346
-        $from = $modx->getDatabase()->getFullTableName('site_snippets') . ' ss LEFT JOIN ' .
347
-            $modx->getDatabase()->getFullTableName('site_modules') . ' sm on sm.guid=ss.moduleguid';
346
+        $from = $modx->getDatabase()->getFullTableName('site_snippets').' ss LEFT JOIN '.
347
+            $modx->getDatabase()->getFullTableName('site_modules').' sm on sm.guid=ss.moduleguid';
348 348
         $rs = $modx->getDatabase()->select($f, $from);
349 349
         $content .= '$s=&$this->snippetCache;';
350 350
         while ($row = $modx->getDatabase()->getRow($rs)) {
351 351
             $key = $row['name'];
352 352
             if ($row['disabled']) {
353
-                $content .= '$s[\'' . $key . '\']=\'return false;\';';
353
+                $content .= '$s[\''.$key.'\']=\'return false;\';';
354 354
             } else {
355 355
                 $value = trim($row['snippet']);
356 356
                 if ($modx->config['minifyphp_incache']) {
357 357
                     $value = $this->php_strip_whitespace($value);
358 358
                 }
359
-                $content .= '$s[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';';
359
+                $content .= '$s[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';';
360 360
                 $properties = $modx->parseProperties($row['properties']);
361 361
                 $sharedproperties = $modx->parseProperties($row['sharedproperties']);
362 362
                 $properties = array_merge($sharedproperties, $properties);
363 363
                 if (0 < count($properties)) {
364
-                    $content .= '$s[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';';
364
+                    $content .= '$s[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';';
365 365
                 }
366 366
             }
367 367
         }
@@ -369,8 +369,8 @@  discard block
 block discarded – undo
369 369
         // WRITE plugins to cache file
370 370
         $f = 'sp.*, sm.properties as sharedproperties';
371 371
         $from = array();
372
-        $from[] = $modx->getDatabase()->getFullTableName('site_plugins') . ' sp';
373
-        $from[] = 'LEFT JOIN ' . $modx->getDatabase()->getFullTableName('site_modules') . ' sm on sm.guid=sp.moduleguid';
372
+        $from[] = $modx->getDatabase()->getFullTableName('site_plugins').' sp';
373
+        $from[] = 'LEFT JOIN '.$modx->getDatabase()->getFullTableName('site_modules').' sm on sm.guid=sp.moduleguid';
374 374
         $rs = $modx->getDatabase()->select($f, $from, 'sp.disabled=0');
375 375
         $content .= '$p=&$this->pluginCache;';
376 376
         while ($row = $modx->getDatabase()->getRow($rs)) {
@@ -379,13 +379,13 @@  discard block
 block discarded – undo
379 379
             if ($modx->config['minifyphp_incache']) {
380 380
                 $value = $this->php_strip_whitespace($value);
381 381
             }
382
-            $content .= '$p[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';';
382
+            $content .= '$p[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';';
383 383
             if ($row['properties'] != '' || $row['sharedproperties'] != '') {
384 384
                 $properties = $modx->parseProperties($row['properties']);
385 385
                 $sharedproperties = $modx->parseProperties($row['sharedproperties']);
386 386
                 $properties = array_merge($sharedproperties, $properties);
387 387
                 if (0 < count($properties)) {
388
-                    $content .= '$p[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';';
388
+                    $content .= '$p[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';';
389 389
                 }
390 390
             }
391 391
         }
@@ -393,9 +393,9 @@  discard block
 block discarded – undo
393 393
         // WRITE system event triggers
394 394
         $f = 'sysevt.name as evtname, event.pluginid, plugin.name as pname';
395 395
         $from = array();
396
-        $from[] = $modx->getDatabase()->getFullTableName('system_eventnames') . ' sysevt';
397
-        $from[] = 'INNER JOIN ' . $modx->getDatabase()->getFullTableName('site_plugin_events') . ' event ON event.evtid=sysevt.id';
398
-        $from[] = 'INNER JOIN ' . $modx->getDatabase()->getFullTableName('site_plugins') . ' plugin ON plugin.id=event.pluginid';
396
+        $from[] = $modx->getDatabase()->getFullTableName('system_eventnames').' sysevt';
397
+        $from[] = 'INNER JOIN '.$modx->getDatabase()->getFullTableName('site_plugin_events').' event ON event.evtid=sysevt.id';
398
+        $from[] = 'INNER JOIN '.$modx->getDatabase()->getFullTableName('site_plugins').' plugin ON plugin.id=event.pluginid';
399 399
         $rs = $modx->getDatabase()->select($f, $from, 'plugin.disabled=0', 'sysevt.name, event.priority');
400 400
         $content .= '$e=&$this->pluginEvent;';
401 401
         $events = array();
@@ -408,14 +408,14 @@  discard block
 block discarded – undo
408 408
         }
409 409
         foreach ($events as $evtname => $pluginnames) {
410 410
             $events[$evtname] = $pluginnames;
411
-            $content .= '$e[\'' . $evtname . '\']=array(\'' . implode('\',\'',
412
-                    $this->escapeSingleQuotes($pluginnames)) . '\');';
411
+            $content .= '$e[\''.$evtname.'\']=array(\''.implode('\',\'',
412
+                    $this->escapeSingleQuotes($pluginnames)).'\');';
413 413
         }
414 414
 
415 415
         $content .= "\n";
416 416
 
417 417
         // close and write the file
418
-        $filename = $this->cachePath . 'siteCache.idx.php';
418
+        $filename = $this->cachePath.'siteCache.idx.php';
419 419
 
420 420
         // invoke OnBeforeCacheUpdate event
421 421
         if ($modx) {
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
             exit("Cannot write main MODX cache file! Make sure the assets/cache directory is writable!");
427 427
         }
428 428
 
429
-        if (!is_file($this->cachePath . '/.htaccess')) {
430
-            file_put_contents($this->cachePath . '/.htaccess', "order deny,allow\ndeny from all\n");
429
+        if (!is_file($this->cachePath.'/.htaccess')) {
430
+            file_put_contents($this->cachePath.'/.htaccess', "order deny,allow\ndeny from all\n");
431 431
         }
432 432
 
433 433
         // invoke OnCacheUpdate event
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 
450 450
         $source = trim($source);
451 451
         if (substr($source, 0, 5) !== '<?php') {
452
-            $source = '<?php ' . $source;
452
+            $source = '<?php '.$source;
453 453
         }
454 454
 
455 455
         $tokens = token_get_all($source);
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
             }
508 508
         }
509 509
         $source = preg_replace(array('@^<\?php@i', '|\s+|', '|<!--|', '|-->|', '|-->\s+<!--|'),
510
-            array('', ' ', "\n" . '<!--', '-->' . "\n", '-->' . "\n" . '<!--'), $_);
510
+            array('', ' ', "\n".'<!--', '-->'."\n", '-->'."\n".'<!--'), $_);
511 511
         $source = trim($source);
512 512
 
513 513
         return $source;
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,7 +82,8 @@  discard block
 block discarded – undo
82 82
      * @return string
83 83
      */
84 84
     public function getParents($id, $path = '')
85
-    { // modx:returns child's parent
85
+    {
86
+// modx:returns child's parent
86 87
         $modx = evolutionCMS();
87 88
         if (empty($this->aliases)) {
88 89
             $rs = $modx->getDatabase()->select(
@@ -481,7 +482,8 @@  discard block
 block discarded – undo
481 482
                         $_ = trim($_);
482 483
                     }
483 484
                     $lastChar = substr($_, -1);
484
-                    if (!in_array($lastChar, $chars)) {// ,320,327,288,284,289
485
+                    if (!in_array($lastChar, $chars)) {
486
+// ,320,327,288,284,289
485 487
                         if (!in_array($prev_token,
486 488
                             array(T_FOREACH, T_WHILE, T_FOR, T_BOOLEAN_AND, T_BOOLEAN_OR, T_DOUBLE_ARROW))) {
487 489
                             $_ .= ' ';
Please login to merge, or discard this patch.
manager/includes/src/Legacy/mgrResources.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php namespace EvolutionCMS\Legacy;
2 2
 
3
-class mgrResources {
3
+class mgrResources{
4 4
     /**
5 5
      * @var array
6 6
      */
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     /**
22 22
      * mgrResources constructor.
23 23
      */
24
-    public function __construct() {
24
+    public function __construct(){
25 25
         $this->setTypes();
26 26
         $this->queryItemsFromDB();
27 27
         $this->prepareCategoryArrays();
@@ -30,47 +30,47 @@  discard block
 block discarded – undo
30 30
     /**
31 31
      * @return void
32 32
      */
33
-    public function setTypes() {
33
+    public function setTypes(){
34 34
         global $_lang;
35
-        $this->types['site_templates']    = array(
35
+        $this->types['site_templates'] = array(
36 36
             'title'=>$_lang["manage_templates"],
37
-            'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ),
38
-            'permissions'=>array('new_template','edit_template'),
37
+            'actions'=>array('edit'=>array(16, 'edit_template'), 'duplicate'=>array(96, 'new_template'), 'remove'=>array(21, 'delete_template')),
38
+            'permissions'=>array('new_template', 'edit_template'),
39 39
             'name'=>'templatename'
40 40
         );
41
-        $this->types['site_tmplvars']     = array(
41
+        $this->types['site_tmplvars'] = array(
42 42
             'title'=>$_lang["tmplvars"],
43
-            'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')),
44
-            'permissions'=>array('new_template','edit_template'),
43
+            'actions'=>array('edit'=>array(301, 'edit_template'), 'duplicate'=>array(304, 'edit_template'), 'remove'=>array(303, 'edit_template')),
44
+            'permissions'=>array('new_template', 'edit_template'),
45 45
         );
46 46
         $this->types['site_htmlsnippets'] = array(
47 47
             'title'=>$_lang["manage_htmlsnippets"],
48
-            'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')),
49
-            'permissions'=>array('new_chunk','edit_chunk'),
48
+            'actions'=>array('edit'=>array(78, 'edit_chunk'), 'duplicate'=>array(97, 'new_chunk'), 'remove'=>array(80, 'delete_chunk')),
49
+            'permissions'=>array('new_chunk', 'edit_chunk'),
50 50
         );
51
-        $this->types['site_snippets']     = array(
51
+        $this->types['site_snippets'] = array(
52 52
             'title'=>$_lang["manage_snippets"],
53
-            'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')),
54
-            'permissions'=>array('new_snippet','edit_snippet'),
53
+            'actions'=>array('edit'=>array(22, 'edit_snippet'), 'duplicate'=>array(98, 'new_snippet'), 'remove'=>array(25, 'delete_snippet')),
54
+            'permissions'=>array('new_snippet', 'edit_snippet'),
55 55
         );
56
-        $this->types['site_plugins']      = array(
56
+        $this->types['site_plugins'] = array(
57 57
             'title'=>$_lang["manage_plugins"],
58
-            'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')),
59
-            'permissions'=>array('new_plugin','edit_plugin'),
58
+            'actions'=>array('edit'=>array(102, 'edit_plugin'), 'duplicate'=>array(105, 'new_plugin'), 'remove'=>array(104, 'delete_plugin')),
59
+            'permissions'=>array('new_plugin', 'edit_plugin'),
60 60
         );
61
-        $this->types['site_modules']      = array(
61
+        $this->types['site_modules'] = array(
62 62
             'title'=>$_lang["manage_modules"],
63
-            'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')),
64
-            'permissions'=>array('new_module','edit_module'),
63
+            'actions'=>array('edit'=>array(108, 'edit_module'), 'duplicate'=>array(111, 'new_module'), 'remove'=>array(110, 'delete_module')),
64
+            'permissions'=>array('new_module', 'edit_module'),
65 65
         );
66 66
     }
67 67
 
68 68
     /**
69 69
      * @return void
70 70
      */
71
-    public function queryItemsFromDB() {
72
-        foreach($this->types as $resourceTable=>$type) {
73
-            if($this->hasAnyPermissions($type['permissions'])) {
71
+    public function queryItemsFromDB(){
72
+        foreach ($this->types as $resourceTable=>$type) {
73
+            if ($this->hasAnyPermissions($type['permissions'])) {
74 74
                 $nameField = isset($type['name']) ? $type['name'] : 'name';
75 75
                 $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField);
76 76
             }
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
      * @param array $permissions
82 82
      * @return bool
83 83
      */
84
-    public function hasAnyPermissions($permissions) {
84
+    public function hasAnyPermissions($permissions){
85 85
         $modx = evolutionCMS();
86 86
 
87
-        foreach($permissions as $p)
88
-            if($modx->hasPermission($p)) return true;
87
+        foreach ($permissions as $p)
88
+            if ($modx->hasPermission($p)) return true;
89 89
 
90 90
         return false;
91 91
     }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      * @param string $nameField
96 96
      * @return array|bool
97 97
      */
98
-    public function queryResources($resourceTable, $nameField = 'name') {
98
+    public function queryResources($resourceTable, $nameField = 'name'){
99 99
         $modx = evolutionCMS(); global $_lang;
100 100
 
101 101
         $allowed = array(
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             'site_plugins',
105 105
             'site_modules'
106 106
         );
107
-        $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : '';
107
+        $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable.'.disabled, ' : '';
108 108
 
109 109
         $tvsql  = '';
110 110
         $tvjoin = '';
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 
120 120
         $rs = $modx->getDatabase()->select(
121 121
             "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid",
122
-            $modx->getDatabase()->getFullTableName($resourceTable) . " AS {$resourceTable}
123
-	            LEFT JOIN " . $modx->getDatabase()->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}",
122
+            $modx->getDatabase()->getFullTableName($resourceTable)." AS {$resourceTable}
123
+	            LEFT JOIN ".$modx->getDatabase()->getFullTableName('categories')." AS categories ON {$resourceTable}.category = categories.id {$tvjoin}",
124 124
             "",
125 125
             "category,name"
126 126
         );
127 127
         $limit = $modx->getDatabase()->getRecordCount($rs);
128 128
 
129
-        if($limit < 1) return false;
129
+        if ($limit < 1) return false;
130 130
 
131 131
         $result = array();
132 132
         while ($row = $modx->getDatabase()->getRow($rs)) {
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
     /**
139 139
      * @return void
140 140
      */
141
-    public function prepareCategoryArrays() {
142
-        foreach($this->items as $type=>$items) {
143
-            foreach((array)$items as $item) {
141
+    public function prepareCategoryArrays(){
142
+        foreach ($this->items as $type=>$items) {
143
+            foreach ((array) $items as $item) {
144 144
                 $catid = $item['catid'] ? $item['catid'] : 0;
145 145
                 $this->categories[$catid] = $item['category'];
146 146
 
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
         natcasesort($this->categories);
154 154
 
155 155
         // Now sort by name
156
-        foreach($this->itemsPerCategory as $catid=>$items) {
157
-            usort($this->itemsPerCategory[$catid], function ($a, $b) {
156
+        foreach ($this->itemsPerCategory as $catid=>$items) {
157
+            usort($this->itemsPerCategory[$catid], function($a, $b){
158 158
                 return strcasecmp($a['name'], $b['name']);
159 159
             });
160 160
         }
Please login to merge, or discard this patch.
Braces   +23 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php namespace EvolutionCMS\Legacy;
2 2
 
3
-class mgrResources {
3
+class mgrResources
4
+{
4 5
     /**
5 6
      * @var array
6 7
      */
@@ -21,7 +22,8 @@  discard block
 block discarded – undo
21 22
     /**
22 23
      * mgrResources constructor.
23 24
      */
24
-    public function __construct() {
25
+    public function __construct()
26
+    {
25 27
         $this->setTypes();
26 28
         $this->queryItemsFromDB();
27 29
         $this->prepareCategoryArrays();
@@ -30,7 +32,8 @@  discard block
 block discarded – undo
30 32
     /**
31 33
      * @return void
32 34
      */
33
-    public function setTypes() {
35
+    public function setTypes()
36
+    {
34 37
         global $_lang;
35 38
         $this->types['site_templates']    = array(
36 39
             'title'=>$_lang["manage_templates"],
@@ -68,7 +71,8 @@  discard block
 block discarded – undo
68 71
     /**
69 72
      * @return void
70 73
      */
71
-    public function queryItemsFromDB() {
74
+    public function queryItemsFromDB()
75
+    {
72 76
         foreach($this->types as $resourceTable=>$type) {
73 77
             if($this->hasAnyPermissions($type['permissions'])) {
74 78
                 $nameField = isset($type['name']) ? $type['name'] : 'name';
@@ -81,11 +85,13 @@  discard block
 block discarded – undo
81 85
      * @param array $permissions
82 86
      * @return bool
83 87
      */
84
-    public function hasAnyPermissions($permissions) {
88
+    public function hasAnyPermissions($permissions)
89
+    {
85 90
         $modx = evolutionCMS();
86 91
 
87
-        foreach($permissions as $p)
88
-            if($modx->hasPermission($p)) return true;
92
+        foreach($permissions as $p) {
93
+                    if($modx->hasPermission($p)) return true;
94
+        }
89 95
 
90 96
         return false;
91 97
     }
@@ -95,7 +101,8 @@  discard block
 block discarded – undo
95 101
      * @param string $nameField
96 102
      * @return array|bool
97 103
      */
98
-    public function queryResources($resourceTable, $nameField = 'name') {
104
+    public function queryResources($resourceTable, $nameField = 'name')
105
+    {
99 106
         $modx = evolutionCMS(); global $_lang;
100 107
 
101 108
         $allowed = array(
@@ -112,8 +119,9 @@  discard block
 block discarded – undo
112 119
             $tvsql    = 'site_tmplvars.caption, ';
113 120
             $tvjoin   = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getDatabase()->getFullTableName('site_tmplvar_templates'));
114 121
             $sttfield = 'IF(stt.templateid,1,0) AS reltpl,';
122
+        } else {
123
+            $sttfield = '';
115 124
         }
116
-        else $sttfield = '';
117 125
 
118 126
         $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : "";
119 127
 
@@ -126,7 +134,9 @@  discard block
 block discarded – undo
126 134
         );
127 135
         $limit = $modx->getDatabase()->getRecordCount($rs);
128 136
 
129
-        if($limit < 1) return false;
137
+        if($limit < 1) {
138
+            return false;
139
+        }
130 140
 
131 141
         $result = array();
132 142
         while ($row = $modx->getDatabase()->getRow($rs)) {
@@ -138,7 +148,8 @@  discard block
 block discarded – undo
138 148
     /**
139 149
      * @return void
140 150
      */
141
-    public function prepareCategoryArrays() {
151
+    public function prepareCategoryArrays()
152
+    {
142 153
         foreach($this->items as $type=>$items) {
143 154
             foreach((array)$items as $item) {
144 155
                 $catid = $item['catid'] ? $item['catid'] : 0;
@@ -154,7 +165,7 @@  discard block
 block discarded – undo
154 165
 
155 166
         // Now sort by name
156 167
         foreach($this->itemsPerCategory as $catid=>$items) {
157
-            usort($this->itemsPerCategory[$catid], function ($a, $b) {
168
+            usort($this->itemsPerCategory[$catid], function ($a, $b){
158 169
                 return strcasecmp($a['name'], $b['name']);
159 170
             });
160 171
         }
Please login to merge, or discard this patch.
manager/includes/src/Legacy/ManagerApi.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -146,33 +146,33 @@  discard block
 block discarded – undo
146 146
             $algorithm = 'UNCRYPT';
147 147
         }
148 148
 
149
-        $salt = md5($password . $seed);
149
+        $salt = md5($password.$seed);
150 150
 
151 151
         switch ($algorithm) {
152 152
             case 'BLOWFISH_Y':
153
-                $salt = '$2y$07$' . substr($salt, 0, 22);
153
+                $salt = '$2y$07$'.substr($salt, 0, 22);
154 154
                 break;
155 155
             case 'BLOWFISH_A':
156
-                $salt = '$2a$07$' . substr($salt, 0, 22);
156
+                $salt = '$2a$07$'.substr($salt, 0, 22);
157 157
                 break;
158 158
             case 'SHA512':
159
-                $salt = '$6$' . substr($salt, 0, 16);
159
+                $salt = '$6$'.substr($salt, 0, 16);
160 160
                 break;
161 161
             case 'SHA256':
162
-                $salt = '$5$' . substr($salt, 0, 16);
162
+                $salt = '$5$'.substr($salt, 0, 16);
163 163
                 break;
164 164
             case 'MD5':
165
-                $salt = '$1$' . substr($salt, 0, 8);
165
+                $salt = '$1$'.substr($salt, 0, 8);
166 166
                 break;
167 167
         }
168 168
 
169 169
         if ($algorithm !== 'UNCRYPT') {
170
-            $password = sha1($password) . crypt($password, $salt);
170
+            $password = sha1($password).crypt($password, $salt);
171 171
         } else {
172
-            $password = sha1($salt . $password);
172
+            $password = sha1($salt.$password);
173 173
         }
174 174
 
175
-        $result = strtolower($algorithm) . '>' . md5($salt . $password) . substr(md5($salt), 0, 8);
175
+        $result = strtolower($algorithm).'>'.md5($salt.$password).substr(md5($salt), 0, 8);
176 176
 
177 177
         return $result;
178 178
     }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         $check_files = explode("\n", $check_files);
255 255
         foreach ($check_files as $file) {
256 256
             $file = trim($file);
257
-            $file = MODX_BASE_PATH . $file;
257
+            $file = MODX_BASE_PATH.$file;
258 258
             if (!is_file($file)) {
259 259
                 continue;
260 260
             }
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
         $checksum = unserialize($checksum);
278 278
         foreach ($check_files as $file) {
279 279
             $file = trim($file);
280
-            $filePath = MODX_BASE_PATH . $file;
280
+            $filePath = MODX_BASE_PATH.$file;
281 281
             if (!is_file($filePath)) {
282 282
                 continue;
283 283
             }
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
     {
297 297
         $modx = evolutionCMS();
298 298
         $tbl_system_settings = $modx->getDatabase()->getFullTableName('system_settings');
299
-        $sql = "REPLACE INTO {$tbl_system_settings} (setting_name, setting_value) VALUES ('sys_files_checksum','" . $modx->getDatabase()->escape($checksum) . "')";
299
+        $sql = "REPLACE INTO {$tbl_system_settings} (setting_name, setting_value) VALUES ('sys_files_checksum','".$modx->getDatabase()->escape($checksum)."')";
300 300
         $modx->getDatabase()->query($sql);
301 301
     }
302 302
 
@@ -373,10 +373,10 @@  discard block
 block discarded – undo
373 373
             foreach ($settings as $key => $val) {
374 374
                 $f = array();
375 375
                 $f['user'] = $_SESSION['mgrInternalKey'];
376
-                $f['setting_name'] = '_LAST_' . $key;
376
+                $f['setting_name'] = '_LAST_'.$key;
377 377
                 $f['setting_value'] = $val;
378 378
                 $f = $modx->getDatabase()->escape($f);
379
-                $f = "(`" . implode("`, `", array_keys($f)) . "`) VALUES('" . implode("', '", array_values($f)) . "')";
379
+                $f = "(`".implode("`, `", array_keys($f))."`) VALUES('".implode("', '", array_values($f))."')";
380 380
                 $f .= " ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value)";
381 381
                 $modx->getDatabase()->insert($f, $modx->getDatabase()->getFullTableName('user_settings'));
382 382
             }
Please login to merge, or discard this patch.
manager/includes/src/Legacy/Categories.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
         $this->db_tbl['categories'] = $modx->getDatabase()->getFullTableName('categories');
18 18
 
19 19
         foreach ($this->elements as $element) {
20
-            $this->db_tbl[$element] = $modx->getDatabase()->getFullTableName('site_' . $element);
20
+            $this->db_tbl[$element] = $modx->getDatabase()->getFullTableName('site_'.$element);
21 21
         }
22 22
     }
23 23
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             $this->db->select(
52 52
                 '*',
53 53
                 $this->db_tbl['categories'],
54
-                "`" . $where . "` = '" . $this->db->escape($search) . "'"
54
+                "`".$where."` = '".$this->db->escape($search)."'"
55 55
             )
56 56
         );
57 57
 
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $_value = $this->db->getValue(
70 70
             $this->db->select(
71
-                '`' . $value . '`',
71
+                '`'.$value.'`',
72 72
                 $this->db_tbl['categories'],
73
-                "`" . $where . "` = '" . $this->db->escape($search) . "'"
73
+                "`".$where."` = '".$this->db->escape($search)."'"
74 74
             )
75 75
         );
76 76
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
                 $this->db->select(
90 90
                     '*',
91 91
                     $this->db_tbl[$element],
92
-                    "`category` = '" . (int)$category_id . "'"
92
+                    "`category` = '".(int) $category_id."'"
93 93
                 )
94 94
             );
95 95
 
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
             $this->db->update(
133 133
                 $_update,
134 134
                 $this->db_tbl[$element],
135
-                "`category` = '" . (int)$category_id . "'"
135
+                "`category` = '".(int) $category_id."'"
136 136
             );
137 137
         }
138 138
 
139 139
         $this->db->delete(
140 140
             $this->db_tbl['categories'],
141
-            "`id` = '" . (int)$category_id . "'"
141
+            "`id` = '".(int) $category_id."'"
142 142
         );
143 143
 
144 144
         return $this->db->getAffectedRows() === 1;
@@ -157,13 +157,13 @@  discard block
 block discarded – undo
157 157
 
158 158
         $_update = array(
159 159
             'category' => $this->db->escape($data['category']),
160
-            'rank'     => (int)$data['rank']
160
+            'rank'     => (int) $data['rank']
161 161
         );
162 162
 
163 163
         $this->db->update(
164 164
             $_update,
165 165
             $this->db_tbl['categories'],
166
-            "`id` = '" . (int)$category_id . "'"
166
+            "`id` = '".(int) $category_id."'"
167 167
         );
168 168
 
169 169
         if ($this->db->getAffectedRows() === 1) {
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
         $_insert = array(
188 188
             'category' => $this->db->escape($category_name),
189
-            'rank'     => (int)$category_rank
189
+            'rank'     => (int) $category_rank
190 190
         );
191 191
 
192 192
         $this->db->insert(
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             $this->db->select(
214 214
                 '`id`',
215 215
                 $this->db_tbl['categories'],
216
-                "`category` = '" . $category . "'"
216
+                "`category` = '".$category."'"
217 217
             )
218 218
         );
219 219
 
Please login to merge, or discard this patch.
manager/includes/src/Legacy/TemplateParser.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -8,46 +8,46 @@  discard block
 block discarded – undo
8 8
      * @param array $data
9 9
      * @return string
10 10
      */
11
-    public function output($config = array(), $data = array()) {
11
+    public function output($config = array(), $data = array()){
12 12
         $modx = evolutionCMS();
13 13
 
14 14
         $output = '';
15 15
         $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : '');
16
-        $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : '';
16
+        $tab = isset($config['tab']) ? ' AND tab IN('.$config['tab'].')' : '';
17 17
 
18
-        if($action) {
18
+        if ($action) {
19 19
             $sql = $modx->getDatabase()->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name
20
-			FROM ' . $modx->getDatabase()->getFullTableName('system_templates') . ' AS t1
21
-			INNER JOIN ' . $modx->getDatabase()->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category
22
-			WHERE t1.action IN(' . $action . ') ' . $tab . '
20
+			FROM ' . $modx->getDatabase()->getFullTableName('system_templates').' AS t1
21
+			INNER JOIN ' . $modx->getDatabase()->getFullTableName('categories').' AS t2 ON t2.id=t1.category
22
+			WHERE t1.action IN(' . $action.') '.$tab.'
23 23
 			ORDER BY t1.tab ASC, t1.rank ASC');
24 24
 
25
-            if($modx->getDatabase()->getRecordCount($sql)) {
25
+            if ($modx->getDatabase()->getRecordCount($sql)) {
26 26
                 $tabs = array();
27
-                while($row = $modx->getDatabase()->getRow($sql)) {
28
-                    if(!$row['value'] && !empty($data[$row['name']])) {
27
+                while ($row = $modx->getDatabase()->getRow($sql)) {
28
+                    if (!$row['value'] && !empty($data[$row['name']])) {
29 29
                         $row['value'] = $data[$row['name']];
30 30
                     }
31 31
                     $tabs[$row['tab']]['category_name'] = $row['category_name'];
32 32
                     $tabs[$row['tab']][$row['name']] = $this->render($row);
33 33
                 }
34 34
 
35
-                if(!empty($config['toArray'])) {
35
+                if (!empty($config['toArray'])) {
36 36
                     $output = $tabs;
37 37
                 } else {
38
-                    $output .= '<div class="tab-pane" id="pane_' . $action . '">';
38
+                    $output .= '<div class="tab-pane" id="pane_'.$action.'">';
39 39
                     $output .= '
40 40
 					<script type="text/javascript">
41
-						var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
41
+						var pane_' . $action.' = new WebFXTabPane(document.getElementById("pane_'.$action.'"), '.($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
42 42
 					</script>';
43 43
 
44
-                    foreach($tabs as $idTab => $tab) {
45
-                        $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">';
44
+                    foreach ($tabs as $idTab => $tab) {
45
+                        $output .= '<div class="tab-page" id="tab_'.$action.'_'.$idTab.'">';
46 46
                         $output .= '
47
-						<h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2>
48
-						<script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>';
47
+						<h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']).'</h2>
48
+						<script type="text/javascript">pane_' . $action.'.addTabPage(document.getElementById("tab_'.$action.'_'.$idTab.'"));</script>';
49 49
                         unset($tab['category_name']);
50
-                        foreach($tab as $item) {
50
+                        foreach ($tab as $item) {
51 51
                             $output .= $item;
52 52
                         }
53 53
                         $output .= '</div>';
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      * @param array $data
65 65
      * @return string
66 66
      */
67
-    private function render($data) {
67
+    private function render($data){
68 68
         $modx = evolutionCMS(); global $_lang, $_country_lang;
69 69
 
70 70
         $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $output = '';
75 75
         $output .= '<div class="form-group row">';
76 76
 
77
-        switch($data['type']) {
77
+        switch ($data['type']) {
78 78
 
79 79
             case 'text':
80 80
                 $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>
@@ -108,18 +108,18 @@  discard block
 block discarded – undo
108 108
                 $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>';
109 109
                 $output .= '<div class="col-sm-7">';
110 110
                 $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">';
111
-                if($data['name'] == 'country' && isset($_country_lang)) {
111
+                if ($data['name'] == 'country' && isset($_country_lang)) {
112 112
                     $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country'];
113
-                    $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '>&nbsp;</option>';
114
-                    foreach($_country_lang as $key => $value) {
115
-                        $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>';
113
+                    $output .= '<option value=""'.(!isset($chosenCountry) ? ' selected' : '').'>&nbsp;</option>';
114
+                    foreach ($_country_lang as $key => $value) {
115
+                        $output .= '<option value="'.$key.'"'.(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').'>'.$value.'</option>';
116 116
                     }
117 117
                 } else {
118
-                    if($data['elements']) {
118
+                    if ($data['elements']) {
119 119
                         $elements = explode('||', $data['elements']);
120
-                        foreach($elements as $key => $value) {
120
+                        foreach ($elements as $key => $value) {
121 121
                             $value = explode('==', $value);
122
-                            $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>';
122
+                            $output .= '<option value="'.$value[1].'">'.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]).'</option>';
123 123
                         }
124 124
                     }
125 125
                 }
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
                 $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>';
134 134
                 $output .= '<div class="col-sm-7">';
135 135
                 $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />';
136
-                if($data['elements']) {
136
+                if ($data['elements']) {
137 137
                     $elements = explode('||', $data['elements']);
138
-                    foreach($elements as $key => $value) {
138
+                    foreach ($elements as $key => $value) {
139 139
                         $value = explode('==', $value);
140
-                        $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]);
140
+                        $output .= '<br /><input type="checkbox" name="'.$value[0].'" class="form-control" id="'.$value[0].'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]);
141 141
                     }
142 142
                 }
143 143
                 $output .= $data['content'];
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
                 $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>';
150 150
                 $output .= '<div class="col-sm-7">';
151 151
                 $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />';
152
-                if($data['elements']) {
152
+                if ($data['elements']) {
153 153
                     $elements = explode('||', $data['elements']);
154
-                    foreach($elements as $key => $value) {
154
+                    foreach ($elements as $key => $value) {
155 155
                         $value = explode('==', $value);
156
-                        $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]);
156
+                        $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_'.$key.'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]);
157 157
                     }
158 158
                 }
159 159
                 $output .= $data['content'];
Please login to merge, or discard this patch.
manager/includes/src/Legacy/ExportSite.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $this->count = 0;
60 60
         $this->setUrlMode();
61 61
         $this->generate_mode = 'crawl';
62
-        $this->targetDir = $modx->config['base_path'] . 'temp/export';
62
+        $this->targetDir = $modx->config['base_path'].'temp/export';
63 63
         if (!isset($this->total)) {
64 64
             $this->getTotal();
65 65
         }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
         $ignore_ids = array_filter(array_map('intval', explode(',', $ignore_ids)));
116 116
         if (count($ignore_ids) > 0) {
117
-            $ignore_ids = "AND NOT id IN ('" . implode("','", $ignore_ids) . "')";
117
+            $ignore_ids = "AND NOT id IN ('".implode("','", $ignore_ids)."')";
118 118
         } else {
119 119
             $ignore_ids = '';
120 120
         }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $noncache = ($noncache == 1) ? '' : 'AND cacheable=1';
125 125
         $where = "deleted=0 AND ((published=1 AND type='document') OR (isfolder=1)) {$noncache} {$ignore_ids}";
126 126
         $rs = $modx->getDatabase()->select('count(id)', $tbl_site_content, $where);
127
-        $this->total = (int)$modx->getDatabase()->getValue($rs);
127
+        $this->total = (int) $modx->getDatabase()->getValue($rs);
128 128
 
129 129
         return $this->total;
130 130
     }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         } elseif (!is_readable($directory)) {
154 154
             return $rs;
155 155
         } else {
156
-            $files = glob($directory . '/*');
156
+            $files = glob($directory.'/*');
157 157
             if (!empty($files)) {
158 158
                 foreach ($files as $path) {
159 159
                     $rs = is_dir($path) ? $this->removeDirectoryAll($path) : unlink($path);
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
             $_lang = $back_lang;
184 184
         } else {
185
-            $src = $this->curl_get_contents(MODX_SITE_URL . "index.php?id={$docid}");
185
+            $src = $this->curl_get_contents(MODX_SITE_URL."index.php?id={$docid}");
186 186
         }
187 187
 
188 188
 
@@ -217,12 +217,12 @@  discard block
 block discarded – undo
217 217
         $modx = evolutionCMS();
218 218
 
219 219
         if ($alias === '') {
220
-            $filename = $prefix . $docid . $suffix;
220
+            $filename = $prefix.$docid.$suffix;
221 221
         } else {
222 222
             if ($modx->config['suffix_mode'] === '1' && strpos($alias, '.') !== false) {
223 223
                 $suffix = '';
224 224
             }
225
-            $filename = $prefix . $alias . $suffix;
225
+            $filename = $prefix.$alias.$suffix;
226 226
         }
227 227
 
228 228
         return $filename;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         $tbl_site_content = $modx->getDatabase()->getFullTableName('site_content');
241 241
 
242 242
         $ignore_ids = $this->ignore_ids;
243
-        $dirpath = $this->targetDir . '/';
243
+        $dirpath = $this->targetDir.'/';
244 244
 
245 245
         $prefix = $modx->config['friendly_url_prefix'];
246 246
         $suffix = $modx->config['friendly_url_suffix'];
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 
251 251
         $ph['status'] = 'fail';
252 252
         $ph['msg1'] = $_lang['export_site_failed'];
253
-        $ph['msg2'] = $_lang["export_site_failed_no_write"] . ' - ' . $dirpath;
253
+        $ph['msg2'] = $_lang["export_site_failed_no_write"].' - '.$dirpath;
254 254
         $msg_failed_no_write = $this->parsePlaceholder($tpl, $ph);
255 255
 
256 256
         $ph['msg2'] = $_lang["export_site_failed_no_retrieve"];
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
             if (!$row['wasNull']) { // needs writing a document
285 285
                 $docname = $this->getFileName($row['id'], $row['alias'], $prefix, $suffix);
286
-                $filename = $dirpath . $docname;
286
+                $filename = $dirpath.$docname;
287 287
                 if (!is_file($filename)) {
288 288
                     if ($row['published'] === '1') {
289 289
                         $status = $this->makeFile($row['id'], $filename);
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
             if ($row['isfolder'] === '1' && ($modx->config['suffix_mode'] !== '1' || strpos($row['alias'],
312 312
                         '.') === false)) { // needs making a folder
313 313
                 $end_dir = ($row['alias'] !== '') ? $row['alias'] : $row['id'];
314
-                $dir_path = $dirpath . $end_dir;
314
+                $dir_path = $dirpath.$end_dir;
315 315
                 if (strpos($dir_path, MODX_BASE_PATH) === false) {
316 316
                     return false;
317 317
                 }
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
                 if ($modx->config['make_folders'] === '1' && $row['published'] === '1') {
329 329
                     if (!empty($filename) && is_file($filename)) {
330
-                        rename($filename, $dir_path . '/index.html');
330
+                        rename($filename, $dir_path.'/index.html');
331 331
                     }
332 332
                 }
333 333
                 $this->targetDir = $dir_path;
@@ -351,8 +351,8 @@  discard block
 block discarded – undo
351 351
 
352 352
         $ch = curl_init();
353 353
         curl_setopt($ch, CURLOPT_URL, $url);
354
-        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);    // 0 = DO NOT VERIFY AUTHENTICITY OF SSL-CERT
355
-        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);    // 2 = CERT MUST INDICATE BEING CONNECTED TO RIGHT SERVER
354
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 0 = DO NOT VERIFY AUTHENTICITY OF SSL-CERT
355
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // 2 = CERT MUST INDICATE BEING CONNECTED TO RIGHT SERVER
356 356
         curl_setopt($ch, CURLOPT_HEADER, false);
357 357
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
358 358
         curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
Please login to merge, or discard this patch.