Completed
Push — develop ( d0bb9b...5613ed )
by Maxim
05:28
created
install/connection.collation.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
     foreach ($_ as $collation=>$selected) {
51 51
         $collation = htmlentities($collation);
52 52
         // if(substr($collation,0,4)!=='utf8') continue;
53
-        if (strpos($collation, 'sjis')===0) {
53
+        if (strpos($collation, 'sjis') === 0) {
54 54
             continue;
55 55
         }
56
-        if ($collation=='recommend') {
56
+        if ($collation == 'recommend') {
57 57
             $output .= '<optgroup label="recommend">';
58
-        } elseif ($collation=='unrecommend') {
58
+        } elseif ($collation == 'unrecommend') {
59 59
             $output .= '</optgroup><optgroup label="unrecommend">';
60 60
         } else {
61 61
             $output .= sprintf('<option value="%s" %s>%s</option>', $collation, $selected, $collation);
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
 echo $output;
68 68
 exit;
69 69
 
70
-function sortItem($array=array(), $order='utf8mb4,utf8')
70
+function sortItem($array = array(), $order = 'utf8mb4,utf8')
71 71
 {
72 72
     $rs = array('recommend'=>'');
73 73
     $order = explode(',', $order);
74 74
     foreach ($order as $v) {
75 75
         foreach ($array as $name=>$sel) {
76
-            if (strpos($name, $v)!==false) {
76
+            if (strpos($name, $v) !== false) {
77 77
                 $rs[$name] = $array[$name];
78 78
                 unset($array[$name]);
79 79
             }
80 80
         }
81 81
     }
82
-    $rs['unrecommend']='';
82
+    $rs['unrecommend'] = '';
83 83
     return $rs + $array;
84 84
 }
Please login to merge, or discard this patch.
index.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -50,16 +50,16 @@  discard block
 block discarded – undo
50 50
 	include_once($autoloader);
51 51
 }
52 52
 
53
-if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true);
53
+if (!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true);
54 54
 
55
-$base_path = str_replace('\\','/',dirname(__FILE__)) . '/';
56
-if(is_file($base_path . 'assets/cache/siteManager.php'))
57
-    include_once($base_path . 'assets/cache/siteManager.php');
58
-if(!defined('MGR_DIR') && is_dir("{$base_path}manager"))
55
+$base_path = str_replace('\\', '/', dirname(__FILE__)).'/';
56
+if (is_file($base_path.'assets/cache/siteManager.php'))
57
+    include_once($base_path.'assets/cache/siteManager.php');
58
+if (!defined('MGR_DIR') && is_dir("{$base_path}manager"))
59 59
 	define('MGR_DIR', 'manager');
60
-if(is_file($base_path . 'assets/cache/siteHostnames.php'))
61
-    include_once($base_path . 'assets/cache/siteHostnames.php');
62
-if(!defined('MODX_SITE_HOSTNAMES'))
60
+if (is_file($base_path.'assets/cache/siteHostnames.php'))
61
+    include_once($base_path.'assets/cache/siteHostnames.php');
62
+if (!defined('MODX_SITE_HOSTNAMES'))
63 63
 	define('MODX_SITE_HOSTNAMES', '');
64 64
 
65 65
 // get start time
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 // set some settings, and address some IE issues
72 72
 @ini_set('url_rewriter.tags', '');
73 73
 @ini_set('session.use_trans_sid', 0);
74
-@ini_set('session.use_only_cookies',1);
74
+@ini_set('session.use_only_cookies', 1);
75 75
 session_cache_limiter('');
76 76
 header('P3P: CP="NOI NID ADMa OUR IND UNI COM NAV"'); // header for weird cookie stuff. Blame IE.
77 77
 header('Cache-Control: private, must-revalidate');
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
  */
84 84
 
85 85
 define('IN_PARSER_MODE', true);
86
-if ( ! defined('IN_MANAGER_MODE')) {
86
+if (!defined('IN_MANAGER_MODE')) {
87 87
 	define('IN_MANAGER_MODE', false);
88 88
 }
89 89
 if (!defined('MODX_API_MODE')) {
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
 }
92 92
 
93 93
 // get the required includes
94
-if(!isset($database_user) || $database_user=="") {
94
+if (!isset($database_user) || $database_user == "") {
95 95
 	$rt = @include_once(dirname(__FILE__).'/'.MGR_DIR.'/includes/config.inc.php');
96 96
 	// Be sure config.inc.php is there and that it contains some important values
97
-	if(!$rt || !$database_type || !$database_server || !$database_user || !$dbase) {
97
+	if (!$rt || !$database_type || !$database_server || !$database_user || !$dbase) {
98 98
 		readfile('install/not_installed.tpl');
99 99
 		exit;
100 100
 	}
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
 $modx->stopOnNotice = false;
126 126
 
127 127
 // Don't show PHP errors to the public
128
-if(!isset($_SESSION['mgrValidated']) || !$_SESSION['mgrValidated']) {
129
-    @ini_set("display_errors","0");
128
+if (!isset($_SESSION['mgrValidated']) || !$_SESSION['mgrValidated']) {
129
+    @ini_set("display_errors", "0");
130 130
 }
131 131
 
132
-if(MODX_CLI){
132
+if (MODX_CLI) {
133 133
     @set_time_limit(0);
134
-    @ini_set('max_execution_time',0);
134
+    @ini_set('max_execution_time', 0);
135 135
 }
136 136
 
137 137
 // execute the parser if index.php was not included
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,17 +50,23 @@  discard block
 block discarded – undo
50 50
 	include_once($autoloader);
51 51
 }
52 52
 
53
-if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true);
53
+if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) {
54
+    $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true);
55
+}
54 56
 
55 57
 $base_path = str_replace('\\','/',dirname(__FILE__)) . '/';
56
-if(is_file($base_path . 'assets/cache/siteManager.php'))
58
+if(is_file($base_path . 'assets/cache/siteManager.php')) {
57 59
     include_once($base_path . 'assets/cache/siteManager.php');
58
-if(!defined('MGR_DIR') && is_dir("{$base_path}manager"))
60
+}
61
+if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) {
59 62
 	define('MGR_DIR', 'manager');
60
-if(is_file($base_path . 'assets/cache/siteHostnames.php'))
63
+}
64
+if(is_file($base_path . 'assets/cache/siteHostnames.php')) {
61 65
     include_once($base_path . 'assets/cache/siteHostnames.php');
62
-if(!defined('MODX_SITE_HOSTNAMES'))
66
+}
67
+if(!defined('MODX_SITE_HOSTNAMES')) {
63 68
 	define('MODX_SITE_HOSTNAMES', '');
69
+}
64 70
 
65 71
 // get start time
66 72
 $mstart = memory_get_usage();
@@ -129,7 +135,7 @@  discard block
 block discarded – undo
129 135
     @ini_set("display_errors","0");
130 136
 }
131 137
 
132
-if(MODX_CLI){
138
+if(MODX_CLI) {
133 139
     @set_time_limit(0);
134 140
     @ini_set('max_execution_time',0);
135 141
 }
Please login to merge, or discard this patch.
manager/includes/document.parser.class.inc.php 2 patches
Doc Comments   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
      * MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"
281 281
      * $extname - extension name in lowercase
282 282
      *
283
-     * @param $extname
283
+     * @param string $extname
284 284
      * @param bool $reload
285 285
      * @return bool
286 286
      */
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
      * @param int $count_attempts
326 326
      * @param string $type $type
327 327
      * @param string $responseCode
328
-     * @return bool|null
328
+     * @return false|null
329 329
      * @global string $base_url
330 330
      * @global string $site_url
331 331
      */
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
     }
1043 1043
 
1044 1044
     /**
1045
-     * @param $contents
1045
+     * @param string $contents
1046 1046
      * @return mixed
1047 1047
      */
1048 1048
     public function RecoveryEscapedTags($contents)
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
     }
1069 1069
 
1070 1070
     /**
1071
-     * @param $tstart
1071
+     * @param double $tstart
1072 1072
      * @return array
1073 1073
      */
1074 1074
     public function getTimerStats($tstart)
@@ -1851,7 +1851,7 @@  discard block
 block discarded – undo
1851 1851
 
1852 1852
     /**
1853 1853
      * Remove Comment-Tags from output like <!--@- Comment -@-->
1854
-     * @param $content
1854
+     * @param string $content
1855 1855
      * @param string $left
1856 1856
      * @param string $right
1857 1857
      * @return mixed
@@ -2029,7 +2029,7 @@  discard block
 block discarded – undo
2029 2029
     /**
2030 2030
      * Run snippets as per the tags in $documentSource and replace the tags with the returned values.
2031 2031
      *
2032
-     * @param $content
2032
+     * @param string $content
2033 2033
      * @return string
2034 2034
      * @internal param string $documentSource
2035 2035
      */
@@ -3098,7 +3098,7 @@  discard block
 block discarded – undo
3098 3098
 
3099 3099
     /**
3100 3100
      * @param $templateID
3101
-     * @return mixed
3101
+     * @return string
3102 3102
      */
3103 3103
     public function _getTemplateCodeFromDB($templateID)
3104 3104
     {
@@ -3142,7 +3142,7 @@  discard block
 block discarded – undo
3142 3142
     /**
3143 3143
      * @param $id
3144 3144
      * @param int $top
3145
-     * @return mixed
3145
+     * @return string
3146 3146
      */
3147 3147
     public function getUltimateParentId($id, $top = 0)
3148 3148
     {
@@ -3482,7 +3482,7 @@  discard block
 block discarded – undo
3482 3482
      *
3483 3483
      * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role
3484 3484
      * @param int $id Element- / Resource-id
3485
-     * @return bool
3485
+     * @return false|null
3486 3486
      */
3487 3487
     public function lockElement($type, $id)
3488 3488
     {
@@ -3505,7 +3505,7 @@  discard block
 block discarded – undo
3505 3505
      * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role
3506 3506
      * @param int $id Element- / Resource-id
3507 3507
      * @param bool $includeAllUsers true = Deletes not only own user-locks
3508
-     * @return bool
3508
+     * @return false|null
3509 3509
      */
3510 3510
     public function unlockElement($type, $id, $includeAllUsers = false)
3511 3511
     {
@@ -3616,7 +3616,7 @@  discard block
 block discarded – undo
3616 3616
      * @param array $params
3617 3617
      * @param string $msg
3618 3618
      * @param array $files
3619
-     * @return mixed
3619
+     * @return boolean
3620 3620
      */
3621 3621
     public function sendmail($params = array(), $msg = '', $files = array())
3622 3622
     {
@@ -4053,7 +4053,7 @@  discard block
 block discarded – undo
4053 4053
      *                     Default: 1
4054 4054
      * @param string $fields List of fields
4055 4055
      *                       Default: id, pagetitle, description, alias
4056
-     * @return boolean|array
4056
+     * @return string
4057 4057
      */
4058 4058
     public function getPageInfo($pageid = -1, $active = 1, $fields = 'id, pagetitle, description, alias')
4059 4059
     {
@@ -4151,7 +4151,7 @@  discard block
 block discarded – undo
4151 4151
      *
4152 4152
      * @param string $type
4153 4153
      * @param bool $report
4154
-     * @return bool
4154
+     * @return boolean|null
4155 4155
      */
4156 4156
     public function clearCache($type = '', $report = false)
4157 4157
     {
@@ -4524,7 +4524,7 @@  discard block
 block discarded – undo
4524 4524
      * - Placeholders prefix. Default: '{'.
4525 4525
      * @param string $suffix {string}
4526 4526
      * - Placeholders suffix. Default: '}'.
4527
-     * @return bool|mixed|string {string; false} - Parsed chunk or false if $chunkArr is not array.
4527
+     * @return false|string {string; false} - Parsed chunk or false if $chunkArr is not array.
4528 4528
      * - Parsed chunk or false if $chunkArr is not array.
4529 4529
      */
4530 4530
     public function parseChunk($chunkName, $chunkArr, $prefix = '{', $suffix = '}')
@@ -5558,7 +5558,7 @@  discard block
 block discarded – undo
5558 5558
      * Remove event listener - only for use within the current execution cycle
5559 5559
      *
5560 5560
      * @param string $evtName
5561
-     * @return boolean
5561
+     * @return false|null
5562 5562
      */
5563 5563
     public function removeEventListener($evtName)
5564 5564
     {
@@ -5582,7 +5582,7 @@  discard block
 block discarded – undo
5582 5582
      *
5583 5583
      * @param string $evtName
5584 5584
      * @param array $extParams Parameters available to plugins. Each array key will be the PHP variable name, and the array value will be the variable value.
5585
-     * @return boolean|array
5585
+     * @return false|null
5586 5586
      */
5587 5587
     public function invokeEvent($evtName, $extParams = array())
5588 5588
     {
@@ -6204,7 +6204,7 @@  discard block
 block discarded – undo
6204 6204
 
6205 6205
     /**
6206 6206
      * @param string $str
6207
-     * @return bool|mixed|string
6207
+     * @return string
6208 6208
      */
6209 6209
     public function atBindFileContent($str = '')
6210 6210
     {
@@ -6261,8 +6261,8 @@  discard block
 block discarded – undo
6261 6261
     }
6262 6262
 
6263 6263
     /**
6264
-     * @param $str
6265
-     * @return bool|string
6264
+     * @param string $str
6265
+     * @return false|string
6266 6266
      */
6267 6267
     public function getExtFromFilename($str)
6268 6268
     {
@@ -6290,7 +6290,7 @@  discard block
 block discarded – undo
6290 6290
      * @param string $text Error message
6291 6291
      * @param string $file File where the error was detected
6292 6292
      * @param string $line Line number within $file
6293
-     * @return boolean
6293
+     * @return boolean|null
6294 6294
      */
6295 6295
     public function phpError($nr, $text, $file, $line)
6296 6296
     {
@@ -6342,7 +6342,7 @@  discard block
 block discarded – undo
6342 6342
      * @param string $text
6343 6343
      * @param string $line
6344 6344
      * @param string $output
6345
-     * @return bool
6345
+     * @return null|boolean
6346 6346
      */
6347 6347
     public function messageQuit(
6348 6348
         $msg = 'unspecified error',
@@ -6785,7 +6785,7 @@  discard block
 block discarded – undo
6785 6785
 
6786 6786
     /**
6787 6787
      * @param string $str
6788
-     * @return bool|mixed|string
6788
+     * @return string
6789 6789
      */
6790 6790
     public function atBindInclude($str = '')
6791 6791
     {
@@ -6837,7 +6837,7 @@  discard block
 block discarded – undo
6837 6837
      * @param $str
6838 6838
      * @param int $flags
6839 6839
      * @param string $encode
6840
-     * @return mixed
6840
+     * @return string
6841 6841
      */
6842 6842
     public function htmlspecialchars($str, $flags = ENT_COMPAT, $encode = '')
6843 6843
     {
@@ -6847,7 +6847,7 @@  discard block
 block discarded – undo
6847 6847
     }
6848 6848
 
6849 6849
     /**
6850
-     * @param $string
6850
+     * @param string $string
6851 6851
      * @param bool $returnData
6852 6852
      * @return bool|mixed
6853 6853
      */
Please login to merge, or discard this patch.
Spacing   +269 added lines, -269 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
      */
229 229
     function __call($method_name, $arguments)
230 230
     {
231
-        include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php');
231
+        include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php');
232 232
         if (method_exists($this->old, $method_name)) {
233 233
             $error_type = 1;
234 234
         } else {
@@ -246,12 +246,12 @@  discard block
 block discarded – undo
246 246
             $info = debug_backtrace();
247 247
             $m[] = $msg;
248 248
             if (!empty($this->currentSnippet)) {
249
-                $m[] = 'Snippet - ' . $this->currentSnippet;
249
+                $m[] = 'Snippet - '.$this->currentSnippet;
250 250
             } elseif (!empty($this->event->activePlugin)) {
251
-                $m[] = 'Plugin - ' . $this->event->activePlugin;
251
+                $m[] = 'Plugin - '.$this->event->activePlugin;
252 252
             }
253 253
             $m[] = $this->decoded_request_uri;
254
-            $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')';
254
+            $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')';
255 255
             $msg = implode('<br />', $m);
256 256
             $this->logEvent(0, $error_type, $msg, $title);
257 257
         }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     {
269 269
         $flag = false;
270 270
         if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) {
271
-            $flag = (bool)$this->{$connector}->conn;
271
+            $flag = (bool) $this->{$connector}->conn;
272 272
         }
273 273
 
274 274
         return $flag;
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         }
297 297
         if (!$out && $flag) {
298 298
             $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname)));
299
-            $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php";
299
+            $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php";
300 300
             $out = is_file($filename) ? include $filename : false;
301 301
         }
302 302
         if ($out && !in_array($extname, $this->extensions)) {
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
     {
316 316
         list ($usec, $sec) = explode(' ', microtime());
317 317
 
318
-        return ((float)$usec + (float)$sec);
318
+        return ((float) $usec + (float) $sec);
319 319
     }
320 320
 
321 321
     /**
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
             // append the redirect count string to the url
340 340
             $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0;
341 341
             if ($currentNumberOfRedirects > 3) {
342
-                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>');
342
+                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>');
343 343
             } else {
344 344
                 $currentNumberOfRedirects += 1;
345 345
                 if (strpos($url, "?") > 0) {
@@ -350,9 +350,9 @@  discard block
 block discarded – undo
350 350
             }
351 351
         }
352 352
         if ($type == 'REDIRECT_REFRESH') {
353
-            $header = 'Refresh: 0;URL=' . $url;
353
+            $header = 'Refresh: 0;URL='.$url;
354 354
         } elseif ($type == 'REDIRECT_META') {
355
-            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />';
355
+            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />';
356 356
             echo $header;
357 357
             exit;
358 358
         } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) {
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
             global $base_url, $site_url;
361 361
             if (substr($url, 0, strlen($base_url)) == $base_url) {
362 362
                 // append $site_url to make it work with Location:
363
-                $url = $site_url . substr($url, strlen($base_url));
363
+                $url = $site_url.substr($url, strlen($base_url));
364 364
             }
365 365
             if (strpos($url, "\n") === false) {
366
-                $header = 'Location: ' . $url;
366
+                $header = 'Location: '.$url;
367 367
             } else {
368 368
                 $this->messageQuit('No newline allowed in redirect url.');
369 369
             }
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
 
479 479
     private function recoverySiteCache()
480 480
     {
481
-        $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
482
-        $site_cache_path = $site_cache_dir . 'siteCache.idx.php';
481
+        $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
482
+        $site_cache_path = $site_cache_dir.'siteCache.idx.php';
483 483
 
484 484
         if (is_file($site_cache_path)) {
485 485
             include($site_cache_path);
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
             return;
489 489
         }
490 490
 
491
-        include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
491
+        include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
492 492
         $cache = new synccache();
493 493
         $cache->setCachepath($site_cache_dir);
494 494
         $cache->setReport(false);
@@ -540,8 +540,8 @@  discard block
 block discarded – undo
540 540
                 $this->invokeEvent("OnBeforeManagerPageInit");
541 541
             }
542 542
 
543
-            if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) {
544
-                $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet'];
543
+            if (isset ($_SESSION[$usrType.'UsrConfigSet'])) {
544
+                $usrSettings = &$_SESSION[$usrType.'UsrConfigSet'];
545 545
             } else {
546 546
                 if ($usrType == 'web') {
547 547
                     $from = $tbl_web_user_settings;
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
                     $usrSettings[$row['setting_name']] = $row['setting_value'];
562 562
                 }
563 563
                 if (isset ($usrType)) {
564
-                    $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
564
+                    $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings;
565 565
                 } // store user settings in session
566 566
             }
567 567
         }
@@ -707,10 +707,10 @@  discard block
 block discarded – undo
707 707
         $suf = $this->config['friendly_url_suffix'];
708 708
         $pre = preg_quote($pre, '/');
709 709
         $suf = preg_quote($suf, '/');
710
-        if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) {
710
+        if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) {
711 711
             $q = $_[1];
712 712
         }
713
-        if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) {
713
+        if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) {
714 714
             $q = $_[1];
715 715
         }
716 716
 
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
                 $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */
734 734
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
735 735
             if ($this->config['use_alias_path'] == 1) {
736
-                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,
736
+                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,
737 737
                                 $this->getChildIds($this->documentListing[$this->virtualDir],
738 738
                                     1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
739 739
                     $this->documentMethod = 'id';
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
      */
774 774
     public function getHashFile($key)
775 775
     {
776
-        return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php";
776
+        return $this->getCacheFolder()."docid_".$key.".pageCache.php";
777 777
     }
778 778
 
779 779
     /**
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
793 793
                 $params = $_GET;
794 794
                 ksort($params);
795
-                $hash .= '_' . md5(http_build_query($params));
795
+                $hash .= '_'.md5(http_build_query($params));
796 796
             }
797 797
         }
798 798
         $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params));
@@ -941,12 +941,12 @@  discard block
 block discarded – undo
941 941
         if ($js = $this->getRegisteredClientStartupScripts()) {
942 942
             // change to just before closing </head>
943 943
             // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent);
944
-            $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput);
944
+            $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput);
945 945
         }
946 946
 
947 947
         // Insert jscripts & html block into template - template must have a </body> tag
948 948
         if ($js = $this->getRegisteredClientScripts()) {
949
-            $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput);
949
+            $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput);
950 950
         }
951 951
         // End fix by sirlancelot
952 952
 
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
         // send out content-type and content-disposition headers
958 958
         if (IN_PARSER_MODE == "true") {
959 959
             $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html";
960
-            header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']);
960
+            header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']);
961 961
             //            if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error)
962 962
             //                header('HTTP/1.0 404 Not Found');
963 963
             if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) {
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
                     $name = preg_replace('|-+|', '-', $name);
976 976
                     $name = trim($name, '-');
977 977
                 }
978
-                $header = 'Content-Disposition: attachment; filename=' . $name;
978
+                $header = 'Content-Disposition: attachment; filename='.$name;
979 979
                 header($header);
980 980
             }
981 981
         }
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
 
984 984
         $stats = $this->getTimerStats($this->tstart);
985 985
 
986
-        $out =& $this->documentOutput;
986
+        $out = & $this->documentOutput;
987 987
         $out = str_replace("[^q^]", $stats['queries'], $out);
988 988
         $out = str_replace("[^qt^]", $stats['queryTime'], $out);
989 989
         $out = str_replace("[^p^]", $stats['phpTime'], $out);
@@ -1022,19 +1022,19 @@  discard block
 block discarded – undo
1022 1022
                 $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet
1023 1023
                 $tt += $t;
1024 1024
             }
1025
-            echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms",
1026
-                    $tt) . ")</legend>{$sc}</fieldset><br />";
1025
+            echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms",
1026
+                    $tt).")</legend>{$sc}</fieldset><br />";
1027 1027
             echo $this->snippetsCode;
1028 1028
         }
1029 1029
         if ($this->dumpPlugins) {
1030 1030
             $ps = "";
1031 1031
             $tt = 0;
1032 1032
             foreach ($this->pluginsTime as $s => $t) {
1033
-                $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>";
1033
+                $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>";
1034 1034
                 $tt += $t;
1035 1035
             }
1036
-            echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms",
1037
-                    $tt * 1000) . ")</legend>{$ps}</fieldset><br />";
1036
+            echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms",
1037
+                    $tt * 1000).")</legend>{$ps}</fieldset><br />";
1038 1038
             echo $this->pluginsCode;
1039 1039
         }
1040 1040
 
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
         $srcTags = explode(',', $tags);
1062 1062
         $repTags = array();
1063 1063
         foreach ($srcTags as $tag) {
1064
-            $repTags[] = '\\' . $tag[0] . '\\' . $tag[1];
1064
+            $repTags[] = '\\'.$tag[0].'\\'.$tag[1];
1065 1065
         }
1066 1066
 
1067 1067
         return array($srcTags, $repTags);
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
         $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']);
1085 1085
         $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache";
1086 1086
         $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0;
1087
-        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb";
1087
+        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb";
1088 1088
 
1089 1089
         return $stats;
1090 1090
     }
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
     {
1118 1118
         $cacheRefreshTime = 0;
1119 1119
         $recent_update = 0;
1120
-        @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php');
1120
+        @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php');
1121 1121
         $this->recentUpdate = $recent_update;
1122 1122
 
1123 1123
         $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time'];
@@ -1171,8 +1171,8 @@  discard block
 block discarded – undo
1171 1171
                 }
1172 1172
 
1173 1173
                 $docObjSerial = serialize($this->documentObject);
1174
-                $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;
1175
-                $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey);
1174
+                $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent;
1175
+                $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey);
1176 1176
                 file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent");
1177 1177
             }
1178 1178
         }
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
         $pos[']]>'] = strpos($content, ']]>');
1233 1233
 
1234 1234
         if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) {
1235
-            $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3);
1235
+            $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3);
1236 1236
         }
1237 1237
 
1238 1238
         $lp = explode($left, $content);
@@ -1362,8 +1362,8 @@  discard block
 block discarded – undo
1362 1362
             }
1363 1363
 
1364 1364
             if (is_array($value)) {
1365
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php');
1366
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php');
1365
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php');
1366
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php');
1367 1367
                 $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]);
1368 1368
             }
1369 1369
 
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
             if (strpos($content, $s) !== false) {
1376 1376
                 $content = str_replace($s, $value, $content);
1377 1377
             } elseif ($this->debug) {
1378
-                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1378
+                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1379 1379
             }
1380 1380
         }
1381 1381
 
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
             if (strpos($content, $s) !== false) {
1545 1545
                 $content = str_replace($s, $value, $content);
1546 1546
             } elseif ($this->debug) {
1547
-                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1547
+                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1548 1548
             }
1549 1549
         }
1550 1550
 
@@ -1598,7 +1598,7 @@  discard block
 block discarded – undo
1598 1598
             }
1599 1599
 
1600 1600
             $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags
1601
-            $value = $this->mergePlaceholderContent($value, $params);  // parse page global placeholers
1601
+            $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers
1602 1602
             if ($this->config['enable_at_syntax']) {
1603 1603
                 $value = $this->mergeConditionalTagsContent($value);
1604 1604
             }
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
             if (strpos($content, $s) !== false) {
1615 1615
                 $content = str_replace($s, $value, $content);
1616 1616
             } elseif ($this->debug) {
1617
-                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1617
+                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1618 1618
             }
1619 1619
         }
1620 1620
 
@@ -1674,7 +1674,7 @@  discard block
 block discarded – undo
1674 1674
             if (strpos($content, $s) !== false) {
1675 1675
                 $content = str_replace($s, $value, $content);
1676 1676
             } elseif ($this->debug) {
1677
-                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1677
+                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1678 1678
             }
1679 1679
         }
1680 1680
 
@@ -1695,7 +1695,7 @@  discard block
 block discarded – undo
1695 1695
         $elseiftag = '<@ELSEIF:',
1696 1696
         $elsetag = '<@ELSE>',
1697 1697
         $endiftag = '<@ENDIF>'
1698
-    ) {
1698
+    ){
1699 1699
         if (strpos($content, '@IF') !== false) {
1700 1700
             $content = $this->_prepareCTag($content, $iftag, $elseiftag, $elsetag, $endiftag);
1701 1701
         }
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
             return $content;
1705 1705
         }
1706 1706
 
1707
-        $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#';
1707
+        $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#';
1708 1708
         $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"),
1709 1709
             $content);
1710 1710
 
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
             }
1717 1717
             list($cmd, $text) = explode('>', $split, 2);
1718 1718
             $cmd = str_replace("'", "\'", $cmd);
1719
-            $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1719
+            $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>";
1720 1720
             $content .= $text;
1721 1721
         }
1722 1722
         $pieces = explode('<@ELSEIF:', $content);
@@ -1727,13 +1727,13 @@  discard block
 block discarded – undo
1727 1727
             }
1728 1728
             list($cmd, $text) = explode('>', $split, 2);
1729 1729
             $cmd = str_replace("'", "\'", $cmd);
1730
-            $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1730
+            $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>";
1731 1731
             $content .= $text;
1732 1732
         }
1733 1733
 
1734 1734
         $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content);
1735 1735
         ob_start();
1736
-        $content = eval('?>' . $content);
1736
+        $content = eval('?>'.$content);
1737 1737
         $content = ob_get_clean();
1738 1738
         $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'),
1739 1739
             $content);
@@ -1755,7 +1755,7 @@  discard block
 block discarded – undo
1755 1755
         $elseiftag = '<@ELSEIF:',
1756 1756
         $elsetag = '<@ELSE>',
1757 1757
         $endiftag = '<@ENDIF>'
1758
-    ) {
1758
+    ){
1759 1759
         if (strpos($content, '<!--@IF ') !== false) {
1760 1760
             $content = str_replace('<!--@IF ', $iftag, $content);
1761 1761
         } // for jp
@@ -1865,7 +1865,7 @@  discard block
 block discarded – undo
1865 1865
         $matches = $this->getTagsFromContent($content, $left, $right);
1866 1866
         if (!empty($matches)) {
1867 1867
             foreach ($matches[0] as $i => $v) {
1868
-                $addBreakMatches[$i] = $v . "\n";
1868
+                $addBreakMatches[$i] = $v."\n";
1869 1869
             }
1870 1870
             $content = str_replace($addBreakMatches, '', $content);
1871 1871
             if (strpos($content, $left) !== false) {
@@ -1900,7 +1900,7 @@  discard block
 block discarded – undo
1900 1900
             if (strpos($content, $s) !== false) {
1901 1901
                 $content = str_replace($s, $v, $content);
1902 1902
             } elseif ($this->debug) {
1903
-                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1903
+                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1904 1904
             }
1905 1905
         }
1906 1906
 
@@ -1967,7 +1967,7 @@  discard block
 block discarded – undo
1967 1967
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin',
1968 1968
                     $error_info['message'], $error_info['line'], $msg);
1969 1969
                 if ($this->isBackend()) {
1970
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>');
1970
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>');
1971 1971
                 }
1972 1972
             }
1973 1973
         } else {
@@ -2014,7 +2014,7 @@  discard block
 block discarded – undo
2014 2014
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet',
2015 2015
                     $error_info['message'], $error_info['line'], $echo);
2016 2016
                 if ($this->isBackend()) {
2017
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>');
2017
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>');
2018 2018
                 }
2019 2019
             }
2020 2020
         }
@@ -2022,7 +2022,7 @@  discard block
 block discarded – undo
2022 2022
         if (is_array($return) || is_object($return)) {
2023 2023
             return $return;
2024 2024
         } else {
2025
-            return $echo . $return;
2025
+            return $echo.$return;
2026 2026
         }
2027 2027
     }
2028 2028
 
@@ -2062,7 +2062,7 @@  discard block
 block discarded – undo
2062 2062
                 if (strpos($content, $s) !== false) {
2063 2063
                     $content = str_replace($s, $value, $content);
2064 2064
                 } elseif ($this->debug) {
2065
-                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2065
+                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2);
2066 2066
                 }
2067 2067
                 continue;
2068 2068
             }
@@ -2074,7 +2074,7 @@  discard block
 block discarded – undo
2074 2074
             if (strpos($content, $s) !== false) {
2075 2075
                 $content = str_replace($s, $value, $content);
2076 2076
             } elseif ($this->debug) {
2077
-                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2077
+                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2);
2078 2078
             }
2079 2079
         }
2080 2080
 
@@ -2167,7 +2167,7 @@  discard block
 block discarded – undo
2167 2167
             $code = str_replace("\t", '  ', $this->htmlspecialchars($value));
2168 2168
             $piece = str_replace("\t", '  ', $this->htmlspecialchars($piece));
2169 2169
             $print_r_params = str_replace("\t", '  ',
2170
-                $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true)));
2170
+                $this->htmlspecialchars('$modx->event->params = '.print_r($params, true)));
2171 2171
             $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>',
2172 2172
                 $snippetObject['name'], $eventtime, $piece, $print_r_params, $code);
2173 2173
             $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime);
@@ -2416,7 +2416,7 @@  discard block
 block discarded – undo
2416 2416
             $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where);
2417 2417
             $count = $this->db->getRecordCount($rs);
2418 2418
             if (1 < $count) {
2419
-                exit('Error $modx->_getSnippetObject()' . $snip_name);
2419
+                exit('Error $modx->_getSnippetObject()'.$snip_name);
2420 2420
             }
2421 2421
             if ($count) {
2422 2422
                 $row = $this->db->getRow($rs);
@@ -2445,13 +2445,13 @@  discard block
 block discarded – undo
2445 2445
         $suff = $this->config['friendly_url_suffix'];
2446 2446
 
2447 2447
         return str_replace(array(
2448
-            '.xml' . $suff,
2449
-            '.rss' . $suff,
2450
-            '.js' . $suff,
2451
-            '.css' . $suff,
2452
-            '.txt' . $suff,
2453
-            '.json' . $suff,
2454
-            '.pdf' . $suff
2448
+            '.xml'.$suff,
2449
+            '.rss'.$suff,
2450
+            '.js'.$suff,
2451
+            '.css'.$suff,
2452
+            '.txt'.$suff,
2453
+            '.json'.$suff,
2454
+            '.pdf'.$suff
2455 2455
         ), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2456 2456
     }
2457 2457
 
@@ -2484,7 +2484,7 @@  discard block
 block discarded – undo
2484 2484
                 $suff = '/';
2485 2485
             }
2486 2486
 
2487
-            $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff;
2487
+            $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff;
2488 2488
         }
2489 2489
 
2490 2490
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -2522,7 +2522,7 @@  discard block
 block discarded – undo
2522 2522
                 $ids = implode(',', array_unique($match['1']));
2523 2523
                 if ($ids) {
2524 2524
                     $res = $this->db->select("id,alias,isfolder,parent,alias_visible",
2525
-                        $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'");
2525
+                        $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'");
2526 2526
                     while ($row = $this->db->getRow($res)) {
2527 2527
                         if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) {
2528 2528
                             $parent = $row['parent'];
@@ -2533,7 +2533,7 @@  discard block
 block discarded – undo
2533 2533
                                 $parent = $this->aliasListing[$parent]['parent'];
2534 2534
                             }
2535 2535
 
2536
-                            $aliases[$row['id']] = $path . '/' . $row['alias'];
2536
+                            $aliases[$row['id']] = $path.'/'.$row['alias'];
2537 2537
                         } else {
2538 2538
                             $aliases[$row['id']] = $row['alias'];
2539 2539
                         }
@@ -2546,7 +2546,7 @@  discard block
 block discarded – undo
2546 2546
             $pref = $this->config['friendly_url_prefix'];
2547 2547
             $suff = $this->config['friendly_url_suffix'];
2548 2548
             $documentSource = preg_replace_callback($in,
2549
-                function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2549
+                function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2550 2550
                     $modx = evolutionCMS();
2551 2551
                     $thealias = $aliases[$m[1]];
2552 2552
                     $thefolder = $isfolder[$m[1]];
@@ -2565,7 +2565,7 @@  discard block
 block discarded – undo
2565 2565
 
2566 2566
         } else {
2567 2567
             $in = '!\[\~([0-9]+)\~\]!is';
2568
-            $out = "index.php?id=" . '\1';
2568
+            $out = "index.php?id=".'\1';
2569 2569
             $documentSource = preg_replace($in, $out, $documentSource);
2570 2570
         }
2571 2571
 
@@ -2586,7 +2586,7 @@  discard block
 block discarded – undo
2586 2586
         $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
2587 2587
         $len_base_url = strlen($this->config['base_url']);
2588 2588
 
2589
-        $url_path = $q;//LANG
2589
+        $url_path = $q; //LANG
2590 2590
 
2591 2591
         if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) {
2592 2592
             $url_path = substr($url_path, $len_base_url);
@@ -2598,7 +2598,7 @@  discard block
 block discarded – undo
2598 2598
             $strictURL = substr($strictURL, $len_base_url);
2599 2599
         }
2600 2600
         $http_host = $_SERVER['HTTP_HOST'];
2601
-        $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG
2601
+        $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG
2602 2602
 
2603 2603
         $site_url = $this->config['site_url'];
2604 2604
 
@@ -2615,7 +2615,7 @@  discard block
 block discarded – undo
2615 2615
                 }
2616 2616
                 if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) {
2617 2617
                     if (empty($_POST)) {
2618
-                        if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) {
2618
+                        if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) {
2619 2619
                             $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
2620 2620
                             exit(0);
2621 2621
                         }
@@ -2680,7 +2680,7 @@  discard block
 block discarded – undo
2680 2680
                 $docgrp = implode(",", $docgrp);
2681 2681
             }
2682 2682
             // get document
2683
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2683
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2684 2684
             $rs = $this->db->select('sc.*', "{$tblsc} sc
2685 2685
                 LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1);
2686 2686
             if ($this->db->getRecordCount($rs) < 1) {
@@ -2718,9 +2718,9 @@  discard block
 block discarded – undo
2718 2718
             if ($documentObject['template']) {
2719 2719
                 // load TVs and merge with document - Orig by Apodigm - Docvars
2720 2720
                 $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value",
2721
-                    $this->getFullTableName("site_tmplvars") . " tv
2722
-                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id
2723
-                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'",
2721
+                    $this->getFullTableName("site_tmplvars")." tv
2722
+                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id
2723
+                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'",
2724 2724
                     "tvtpl.templateid = '{$documentObject['template']}'");
2725 2725
                 $tmplvars = array();
2726 2726
                 while ($row = $this->db->getRow($rs)) {
@@ -2767,7 +2767,7 @@  discard block
 block discarded – undo
2767 2767
                 $st = md5($source);
2768 2768
             }
2769 2769
             if ($this->dumpSnippets == 1) {
2770
-                $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>";
2770
+                $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>";
2771 2771
             }
2772 2772
 
2773 2773
             // invoke OnParseDocument event
@@ -2810,7 +2810,7 @@  discard block
 block discarded – undo
2810 2810
      */
2811 2811
     public function executeParser()
2812 2812
     {
2813
-        if(MODX_CLI) {
2813
+        if (MODX_CLI) {
2814 2814
             throw new RuntimeException('Call DocumentParser::executeParser on CLI mode');
2815 2815
         }
2816 2816
 
@@ -2856,7 +2856,7 @@  discard block
 block discarded – undo
2856 2856
 
2857 2857
             // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path
2858 2858
             if ($this->config['use_alias_path'] == 1) {
2859
-                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier;
2859
+                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier;
2860 2860
                 if (isset($this->documentListing[$alias])) {
2861 2861
                     $this->documentIdentifier = $this->documentListing[$alias];
2862 2862
                 } else {
@@ -2919,7 +2919,7 @@  discard block
 block discarded – undo
2919 2919
                     $docAlias = $this->db->escape($this->documentIdentifier);
2920 2920
                     $rs = $this->db->select('id', $this->getFullTableName('site_content'),
2921 2921
                         "deleted=0 and alias='{$docAlias}'");
2922
-                    $this->documentIdentifier = (int)$this->db->getValue($rs);
2922
+                    $this->documentIdentifier = (int) $this->db->getValue($rs);
2923 2923
                 }
2924 2924
             }
2925 2925
             $this->documentMethod = 'id';
@@ -2973,7 +2973,7 @@  discard block
 block discarded – undo
2973 2973
                 $_REQUEST[$n] = $_GET[$n] = $v;
2974 2974
             }
2975 2975
         }
2976
-        $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path'];
2976
+        $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path'];
2977 2977
         $this->q = $qp['path'];
2978 2978
 
2979 2979
         return $qp['path'];
@@ -3069,7 +3069,7 @@  discard block
 block discarded – undo
3069 3069
             $this->sendErrorPage();
3070 3070
         } else {
3071 3071
             // Inculde the necessary files to check document permissions
3072
-            include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
3072
+            include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
3073 3073
             $udperms = new udperms();
3074 3074
             $udperms->user = $this->getLoginUserID();
3075 3075
             $udperms->document = $this->documentIdentifier;
@@ -3123,7 +3123,7 @@  discard block
 block discarded – undo
3123 3123
         while ($id && $height--) {
3124 3124
             $thisid = $id;
3125 3125
             if ($this->config['aliaslistingfolder'] == 1) {
3126
-                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1");
3126
+                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1");
3127 3127
                 if (!$id || $id == '0') {
3128 3128
                     break;
3129 3129
                 }
@@ -3177,15 +3177,15 @@  discard block
 block discarded – undo
3177 3177
         if ($this->config['aliaslistingfolder'] == 1) {
3178 3178
 
3179 3179
             $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'),
3180
-                "parent IN (" . $id . ") AND deleted = '0'");
3180
+                "parent IN (".$id.") AND deleted = '0'");
3181 3181
             $idx = array();
3182 3182
             while ($row = $this->db->getRow($res)) {
3183 3183
                 $pAlias = '';
3184 3184
                 if (isset($this->aliasListing[$row['parent']])) {
3185
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : '';
3186
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : '';
3185
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : '';
3186
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : '';
3187 3187
                 };
3188
-                $children[$pAlias . $row['alias']] = $row['id'];
3188
+                $children[$pAlias.$row['alias']] = $row['id'];
3189 3189
                 if ($row['isfolder'] == 1) {
3190 3190
                     $idx[] = $row['id'];
3191 3191
                 }
@@ -3218,7 +3218,7 @@  discard block
 block discarded – undo
3218 3218
                 $depth--;
3219 3219
 
3220 3220
                 foreach ($documentMap_cache[$id] as $childId) {
3221
-                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias'];
3221
+                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias'];
3222 3222
                     if (!strlen($pkey)) {
3223 3223
                         $pkey = "{$childId}";
3224 3224
                     }
@@ -3248,7 +3248,7 @@  discard block
 block discarded – undo
3248 3248
         if (substr(strtolower($url), 0, 11) == "javascript:") {
3249 3249
             $fnc = substr($url, 11);
3250 3250
         } elseif ($url) {
3251
-            $fnc = "window.location.href='" . addslashes($url) . "';";
3251
+            $fnc = "window.location.href='".addslashes($url)."';";
3252 3252
         } else {
3253 3253
             $fnc = "history.back(-1);";
3254 3254
         }
@@ -3257,7 +3257,7 @@  discard block
 block discarded – undo
3257 3257
             <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\">
3258 3258
             <script>
3259 3259
                 function __alertQuit() {
3260
-                    alert('" . addslashes($msg) . "');
3260
+                    alert('".addslashes($msg)."');
3261 3261
                     {$fnc}
3262 3262
                 }
3263 3263
                 window.setTimeout('__alertQuit();',100);
@@ -3279,10 +3279,10 @@  discard block
 block discarded – undo
3279 3279
         $state = 0;
3280 3280
         $pms = $_SESSION['mgrPermissions'];
3281 3281
         if ($pms) {
3282
-            $state = ((bool)$pms[$pm] === true);
3282
+            $state = ((bool) $pms[$pm] === true);
3283 3283
         }
3284 3284
 
3285
-        return (int)$state;
3285
+        return (int) $state;
3286 3286
     }
3287 3287
 
3288 3288
     /**
@@ -3295,8 +3295,8 @@  discard block
 block discarded – undo
3295 3295
      */
3296 3296
     public function elementIsLocked($type, $id, $includeThisUser = false)
3297 3297
     {
3298
-        $id = (int)$id;
3299
-        $type = (int)$type;
3298
+        $id = (int) $id;
3299
+        $type = (int) $type;
3300 3300
         if (!$type || !$id) {
3301 3301
             return null;
3302 3302
         }
@@ -3346,7 +3346,7 @@  discard block
 block discarded – undo
3346 3346
             return $lockedElements;
3347 3347
         }
3348 3348
 
3349
-        $type = (int)$type;
3349
+        $type = (int) $type;
3350 3350
         if (isset($lockedElements[$type])) {
3351 3351
             return $lockedElements[$type];
3352 3352
         } else {
@@ -3364,7 +3364,7 @@  discard block
 block discarded – undo
3364 3364
             $this->cleanupExpiredLocks();
3365 3365
 
3366 3366
             $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username',
3367
-                $this->getFullTableName('active_user_locks') . " ul
3367
+                $this->getFullTableName('active_user_locks')." ul
3368 3368
                 LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id");
3369 3369
             while ($row = $this->db->getRow($rs)) {
3370 3370
                 $this->lockedElements[$row['elementType']][$row['elementId']] = array(
@@ -3387,7 +3387,7 @@  discard block
 block discarded – undo
3387 3387
     public function cleanupExpiredLocks()
3388 3388
     {
3389 3389
         // Clean-up active_user_sessions first
3390
-        $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
3390
+        $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
3391 3391
         $validSessionTimeLimit = $this->time - $timeout;
3392 3392
         $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}");
3393 3393
 
@@ -3400,7 +3400,7 @@  discard block
 block discarded – undo
3400 3400
             foreach ($rs as $row) {
3401 3401
                 $userSids[] = $row['sid'];
3402 3402
             }
3403
-            $userSids = "'" . implode("','", $userSids) . "'";
3403
+            $userSids = "'".implode("','", $userSids)."'";
3404 3404
             $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})");
3405 3405
         } else {
3406 3406
             $this->db->delete($this->getFullTableName('active_user_locks'));
@@ -3487,8 +3487,8 @@  discard block
 block discarded – undo
3487 3487
     public function lockElement($type, $id)
3488 3488
     {
3489 3489
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3490
-        $type = (int)$type;
3491
-        $id = (int)$id;
3490
+        $type = (int) $type;
3491
+        $id = (int) $id;
3492 3492
         if (!$type || !$id || !$userId) {
3493 3493
             return false;
3494 3494
         }
@@ -3510,8 +3510,8 @@  discard block
 block discarded – undo
3510 3510
     public function unlockElement($type, $id, $includeAllUsers = false)
3511 3511
     {
3512 3512
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3513
-        $type = (int)$type;
3514
-        $id = (int)$id;
3513
+        $type = (int) $type;
3514
+        $id = (int) $id;
3515 3515
         if (!$type || !$id) {
3516 3516
             return false;
3517 3517
         }
@@ -3581,8 +3581,8 @@  discard block
 block discarded – undo
3581 3581
         }
3582 3582
 
3583 3583
         $usertype = $this->isFrontend() ? 1 : 0;
3584
-        $evtid = (int)$evtid;
3585
-        $type = (int)$type;
3584
+        $evtid = (int) $evtid;
3585
+        $type = (int) $type;
3586 3586
 
3587 3587
         // Types: 1 = information, 2 = warning, 3 = error
3588 3588
         if ($type < 1) {
@@ -3604,8 +3604,8 @@  discard block
 block discarded – undo
3604 3604
         if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') {
3605 3605
             if ($this->config['send_errormail'] <= $type) {
3606 3606
                 $this->sendmail(array(
3607
-                    'subject' => 'MODX System Error on ' . $this->config['site_name'],
3608
-                    'body'    => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.',
3607
+                    'subject' => 'MODX System Error on '.$this->config['site_name'],
3608
+                    'body'    => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.',
3609 3609
                     'type'    => 'text'
3610 3610
                 ));
3611 3611
             }
@@ -3653,7 +3653,7 @@  discard block
 block discarded – undo
3653 3653
             $p['fromname'] = $userinfo['username'];
3654 3654
         }
3655 3655
         if ($msg === '' && !isset($p['body'])) {
3656
-            $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER'];
3656
+            $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER'];
3657 3657
         } elseif (is_string($msg) && 0 < strlen($msg)) {
3658 3658
             $p['body'] = $msg;
3659 3659
         }
@@ -3693,8 +3693,8 @@  discard block
 block discarded – undo
3693 3693
             $files = array();
3694 3694
         }
3695 3695
         foreach ($files as $f) {
3696
-            if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) {
3697
-                $this->mail->AddAttachment(MODX_BASE_PATH . $f);
3696
+            if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) {
3697
+                $this->mail->AddAttachment(MODX_BASE_PATH.$f);
3698 3698
             }
3699 3699
         }
3700 3700
         $rs = $this->mail->send();
@@ -3759,7 +3759,7 @@  discard block
 block discarded – undo
3759 3759
         $sort = 'menuindex',
3760 3760
         $dir = 'ASC',
3761 3761
         $fields = 'id, pagetitle, description, parent, alias, menutitle'
3762
-    ) {
3762
+    ){
3763 3763
 
3764 3764
         $cacheKey = md5(print_r(func_get_args(), true));
3765 3765
         if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) {
@@ -3769,14 +3769,14 @@  discard block
 block discarded – undo
3769 3769
         $tblsc = $this->getFullTableName("site_content");
3770 3770
         $tbldg = $this->getFullTableName("document_groups");
3771 3771
         // modify field names to use sc. table reference
3772
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3773
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3772
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3773
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3774 3774
         // get document groups for current user
3775 3775
         if ($docgrp = $this->getUserDocGroups()) {
3776 3776
             $docgrp = implode(",", $docgrp);
3777 3777
         }
3778 3778
         // build query
3779
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3779
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3780 3780
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3781 3781
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id",
3782 3782
             "{$sort} {$dir}");
@@ -3802,7 +3802,7 @@  discard block
 block discarded – undo
3802 3802
         $sort = 'menuindex',
3803 3803
         $dir = 'ASC',
3804 3804
         $fields = 'id, pagetitle, description, parent, alias, menutitle'
3805
-    ) {
3805
+    ){
3806 3806
         $cacheKey = md5(print_r(func_get_args(), true));
3807 3807
         if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) {
3808 3808
             return $this->tmpCache[__FUNCTION__][$cacheKey];
@@ -3812,14 +3812,14 @@  discard block
 block discarded – undo
3812 3812
         $tbldg = $this->getFullTableName("document_groups");
3813 3813
 
3814 3814
         // modify field names to use sc. table reference
3815
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3816
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3815
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3816
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3817 3817
         // get document groups for current user
3818 3818
         if ($docgrp = $this->getUserDocGroups()) {
3819 3819
             $docgrp = implode(",", $docgrp);
3820 3820
         }
3821 3821
         // build query
3822
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3822
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3823 3823
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3824 3824
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id",
3825 3825
             "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
@@ -3856,23 +3856,23 @@  discard block
 block discarded – undo
3856 3856
         $sort = 'menuindex',
3857 3857
         $dir = 'ASC',
3858 3858
         $limit = ''
3859
-    ) {
3859
+    ){
3860 3860
 
3861 3861
         $cacheKey = md5(print_r(func_get_args(), true));
3862 3862
         if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) {
3863 3863
             return $this->tmpCache[__FUNCTION__][$cacheKey];
3864 3864
         }
3865 3865
 
3866
-        $published = ($published !== 'all') ? 'AND sc.published = ' . $published : '';
3867
-        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : '';
3866
+        $published = ($published !== 'all') ? 'AND sc.published = '.$published : '';
3867
+        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : '';
3868 3868
 
3869 3869
         if ($where != '') {
3870
-            $where = 'AND ' . $where;
3870
+            $where = 'AND '.$where;
3871 3871
         }
3872 3872
 
3873 3873
         // modify field names to use sc. table reference
3874
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3875
-        $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3874
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3875
+        $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3876 3876
 
3877 3877
         // get document groups for current user
3878 3878
         if ($docgrp = $this->getUserDocGroups()) {
@@ -3880,7 +3880,7 @@  discard block
 block discarded – undo
3880 3880
         }
3881 3881
 
3882 3882
         // build query
3883
-        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3883
+        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3884 3884
 
3885 3885
         $tblsc = $this->getFullTableName('site_content');
3886 3886
         $tbldg = $this->getFullTableName('document_groups');
@@ -3923,7 +3923,7 @@  discard block
 block discarded – undo
3923 3923
         $sort = 'menuindex',
3924 3924
         $dir = 'ASC',
3925 3925
         $limit = ''
3926
-    ) {
3926
+    ){
3927 3927
 
3928 3928
         $cacheKey = md5(print_r(func_get_args(), true));
3929 3929
         if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) {
@@ -3943,10 +3943,10 @@  discard block
 block discarded – undo
3943 3943
             return false;
3944 3944
         } else {
3945 3945
             // modify field names to use sc. table reference
3946
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3947
-            $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3946
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3947
+            $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3948 3948
             if ($where != '') {
3949
-                $where = 'AND ' . $where;
3949
+                $where = 'AND '.$where;
3950 3950
             }
3951 3951
 
3952 3952
             $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : '';
@@ -3957,14 +3957,14 @@  discard block
 block discarded – undo
3957 3957
                 $docgrp = implode(',', $docgrp);
3958 3958
             }
3959 3959
 
3960
-            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3960
+            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3961 3961
 
3962 3962
             $tblsc = $this->getFullTableName('site_content');
3963 3963
             $tbldg = $this->getFullTableName('document_groups');
3964 3964
 
3965 3965
             $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3966
-                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',',
3967
-                    $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id",
3966
+                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',',
3967
+                    $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id",
3968 3968
                 ($sort ? "{$sort} {$dir}" : ""), $limit);
3969 3969
 
3970 3970
             $resourceArray = $this->db->makeArray($result);
@@ -4070,12 +4070,12 @@  discard block
 block discarded – undo
4070 4070
             $tbldg = $this->getFullTableName("document_groups");
4071 4071
             $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : "";
4072 4072
             // modify field names to use sc. table reference
4073
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4073
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4074 4074
             // get document groups for current user
4075 4075
             if ($docgrp = $this->getUserDocGroups()) {
4076 4076
                 $docgrp = implode(",", $docgrp);
4077 4077
             }
4078
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
4078
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
4079 4079
             $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id",
4080 4080
                 "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1);
4081 4081
             $pageInfo = $this->db->getRow($result);
@@ -4127,7 +4127,7 @@  discard block
 block discarded – undo
4127 4127
     {
4128 4128
         if ($this->currentSnippet) {
4129 4129
             $tbl = $this->getFullTableName("site_snippets");
4130
-            $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1);
4130
+            $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1);
4131 4131
             if ($snippetId = $this->db->getValue($rs)) {
4132 4132
                 return $snippetId;
4133 4133
             }
@@ -4155,23 +4155,23 @@  discard block
 block discarded – undo
4155 4155
      */
4156 4156
     public function clearCache($type = '', $report = false)
4157 4157
     {
4158
-        $cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
4158
+        $cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
4159 4159
         if (is_array($type)) {
4160 4160
             foreach ($type as $_) {
4161 4161
                 $this->clearCache($_, $report);
4162 4162
             }
4163 4163
         } elseif ($type == 'full') {
4164
-            include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
4164
+            include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
4165 4165
             $sync = new synccache();
4166 4166
             $sync->setCachepath($cache_dir);
4167 4167
             $sync->setReport($report);
4168 4168
             $sync->emptyCache();
4169 4169
         } elseif (preg_match('@^[1-9][0-9]*$@', $type)) {
4170 4170
             $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type;
4171
-            $file_name = "docid_" . $key . "_*.pageCache.php";
4172
-            $cache_path = $cache_dir . $file_name;
4171
+            $file_name = "docid_".$key."_*.pageCache.php";
4172
+            $cache_path = $cache_dir.$file_name;
4173 4173
             $files = glob($cache_path);
4174
-            $files[] = $cache_dir . "docid_" . $key . ".pageCache.php";
4174
+            $files[] = $cache_dir."docid_".$key.".pageCache.php";
4175 4175
             foreach ($files as $file) {
4176 4176
                 if (!is_file($file)) {
4177 4177
                     continue;
@@ -4179,7 +4179,7 @@  discard block
 block discarded – undo
4179 4179
                 unlink($file);
4180 4180
             }
4181 4181
         } else {
4182
-            $files = glob($cache_dir . '*');
4182
+            $files = glob($cache_dir.'*');
4183 4183
             foreach ($files as $file) {
4184 4184
                 $name = basename($file);
4185 4185
                 if (strpos($name, '.pageCache.php') === false) {
@@ -4248,7 +4248,7 @@  discard block
 block discarded – undo
4248 4248
                         $f_url_suffix = '/';
4249 4249
                     }
4250 4250
 
4251
-                    $alPath = !empty ($al['path']) ? $al['path'] . '/' : '';
4251
+                    $alPath = !empty ($al['path']) ? $al['path'].'/' : '';
4252 4252
 
4253 4253
                     if ($al && $al['alias']) {
4254 4254
                         $alias = $al['alias'];
@@ -4256,7 +4256,7 @@  discard block
 block discarded – undo
4256 4256
 
4257 4257
                 }
4258 4258
 
4259
-                $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix;
4259
+                $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix;
4260 4260
                 $url = "{$alias}{$args}";
4261 4261
             } else {
4262 4262
                 $url = "index.php?id={$id}{$args}";
@@ -4275,7 +4275,7 @@  discard block
 block discarded – undo
4275 4275
             }
4276 4276
 
4277 4277
             //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080)
4278
-            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host;
4278
+            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host;
4279 4279
         }
4280 4280
 
4281 4281
         //fix strictUrl by Bumkaka
@@ -4284,9 +4284,9 @@  discard block
 block discarded – undo
4284 4284
         }
4285 4285
 
4286 4286
         if ($this->config['xhtml_urls']) {
4287
-            $url = preg_replace("/&(?!amp;)/", "&amp;", $host . $virtualDir . $url);
4287
+            $url = preg_replace("/&(?!amp;)/", "&amp;", $host.$virtualDir.$url);
4288 4288
         } else {
4289
-            $url = $host . $virtualDir . $url;
4289
+            $url = $host.$virtualDir.$url;
4290 4290
         }
4291 4291
 
4292 4292
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -4310,21 +4310,21 @@  discard block
 block discarded – undo
4310 4310
         if (isset($this->aliasListing[$id])) {
4311 4311
             $out = $this->aliasListing[$id];
4312 4312
         } else {
4313
-            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id);
4313
+            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id);
4314 4314
             if ($this->db->getRecordCount($q) == '1') {
4315 4315
                 $q = $this->db->getRow($q);
4316 4316
                 $this->aliasListing[$id] = array(
4317
-                    'id'       => (int)$q['id'],
4317
+                    'id'       => (int) $q['id'],
4318 4318
                     'alias'    => $q['alias'] == '' ? $q['id'] : $q['alias'],
4319
-                    'parent'   => (int)$q['parent'],
4320
-                    'isfolder' => (int)$q['isfolder'],
4319
+                    'parent'   => (int) $q['parent'],
4320
+                    'isfolder' => (int) $q['isfolder'],
4321 4321
                 );
4322 4322
                 if ($this->aliasListing[$id]['parent'] > 0) {
4323 4323
                     //fix alias_path_usage
4324 4324
                     if ($this->config['use_alias_path'] == '1') {
4325 4325
                         //&& $tmp['path'] != '' - fix error slash with epty path
4326 4326
                         $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']);
4327
-                        $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : '');
4327
+                        $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : '');
4328 4328
                     } else {
4329 4329
                         $this->aliasListing[$id]['path'] = '';
4330 4330
                     }
@@ -4366,7 +4366,7 @@  discard block
 block discarded – undo
4366 4366
         $out = array();
4367 4367
         if (empty($this->version) || !is_array($this->version)) {
4368 4368
             //include for compatibility modx version < 1.0.10
4369
-            include MODX_MANAGER_PATH . "includes/version.inc.php";
4369
+            include MODX_MANAGER_PATH."includes/version.inc.php";
4370 4370
             $this->version = array();
4371 4371
             $this->version['version'] = isset($modx_version) ? $modx_version : '';
4372 4372
             $this->version['branch'] = isset($modx_branch) ? $modx_branch : '';
@@ -4389,19 +4389,19 @@  discard block
 block discarded – undo
4389 4389
     {
4390 4390
         if (isset ($this->snippetCache[$snippetName])) {
4391 4391
             $snippet = $this->snippetCache[$snippetName];
4392
-            $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4392
+            $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : '';
4393 4393
         } else { // not in cache so let's check the db
4394
-            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "'  AND ss.disabled=0;";
4394
+            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->db->escape($snippetName)."'  AND ss.disabled=0;";
4395 4395
             $result = $this->db->query($sql);
4396 4396
             if ($this->db->getRecordCount($result) == 1) {
4397 4397
                 $row = $this->db->getRow($result);
4398 4398
                 $snippet = $this->snippetCache[$snippetName] = $row['snippet'];
4399 4399
                 $mergedProperties = array_merge($this->parseProperties($row['properties']),
4400 4400
                     $this->parseProperties($row['sharedproperties']));
4401
-                $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties);
4401
+                $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties);
4402 4402
             } else {
4403 4403
                 $snippet = $this->snippetCache[$snippetName] = "return false;";
4404
-                $properties = $this->snippetCache[$snippetName . "Props"] = '';
4404
+                $properties = $this->snippetCache[$snippetName."Props"] = '';
4405 4405
             }
4406 4406
         }
4407 4407
         // load default params/properties
@@ -4505,7 +4505,7 @@  discard block
 block discarded – undo
4505 4505
             if (strpos($tpl, $s) !== false) {
4506 4506
                 $tpl = str_replace($s, $value, $tpl);
4507 4507
             } elseif ($this->debug) {
4508
-                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2);
4508
+                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2);
4509 4509
             }
4510 4510
         }
4511 4511
 
@@ -4554,7 +4554,7 @@  discard block
 block discarded – undo
4554 4554
             case 'CODE':
4555 4555
                 break;
4556 4556
             case 'FILE':
4557
-                $template = file_get_contents(MODX_BASE_PATH . $template);
4557
+                $template = file_get_contents(MODX_BASE_PATH.$template);
4558 4558
                 break;
4559 4559
             case 'CHUNK':
4560 4560
                 $template = $this->getChunk($template);
@@ -4588,7 +4588,7 @@  discard block
 block discarded – undo
4588 4588
         if ($mode !== 'formatOnly' && empty($timestamp)) {
4589 4589
             return '-';
4590 4590
         }
4591
-        $timestamp = (int)$timestamp;
4591
+        $timestamp = (int) $timestamp;
4592 4592
 
4593 4593
         switch ($this->config['datetime_format']) {
4594 4594
             case 'YYYY/mm/dd':
@@ -4608,7 +4608,7 @@  discard block
 block discarded – undo
4608 4608
         }
4609 4609
 
4610 4610
         if (empty($mode)) {
4611
-            $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp);
4611
+            $strTime = strftime($dateFormat." %H:%M:%S", $timestamp);
4612 4612
         } elseif ($mode == 'dateOnly') {
4613 4613
             $strTime = strftime($dateFormat, $timestamp);
4614 4614
         } elseif ($mode == 'formatOnly') {
@@ -4663,7 +4663,7 @@  discard block
 block discarded – undo
4663 4663
             $S = 0;
4664 4664
         }
4665 4665
         $timeStamp = mktime($H, $M, $S, $m, $d, $Y);
4666
-        $timeStamp = (int)$timeStamp;
4666
+        $timeStamp = (int) $timeStamp;
4667 4667
 
4668 4668
         return $timeStamp;
4669 4669
     }
@@ -4701,7 +4701,7 @@  discard block
 block discarded – undo
4701 4701
         $tvfields = "*",
4702 4702
         $tvsort = "rank",
4703 4703
         $tvsortdir = "ASC"
4704
-    ) {
4704
+    ){
4705 4705
         $docs = $this->getDocumentChildren($parentid, $published, 0, '*', '', $docsort, $docsortdir);
4706 4706
         if (!$docs) {
4707 4707
             return false;
@@ -4714,7 +4714,7 @@  discard block
 block discarded – undo
4714 4714
                     if ($v === 'value') {
4715 4715
                         unset($_[$i]);
4716 4716
                     } else {
4717
-                        $_[$i] = 'tv.' . $v;
4717
+                        $_[$i] = 'tv.'.$v;
4718 4718
                     }
4719 4719
                 }
4720 4720
                 $fields = implode(',', $_);
@@ -4723,13 +4723,13 @@  discard block
 block discarded – undo
4723 4723
             }
4724 4724
 
4725 4725
             if ($tvsort != '') {
4726
-                $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4726
+                $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4727 4727
             }
4728 4728
             if ($tvidnames == "*") {
4729 4729
                 $query = "tv.id<>0";
4730 4730
             } else {
4731
-                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','",
4732
-                        $tvidnames) . "')";
4731
+                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','",
4732
+                        $tvidnames)."')";
4733 4733
             }
4734 4734
 
4735 4735
             $this->getUserDocGroups();
@@ -4791,7 +4791,7 @@  discard block
 block discarded – undo
4791 4791
         $sortDir = 'ASC',
4792 4792
         $where = '',
4793 4793
         $resultKey = 'id'
4794
-    ) {
4794
+    ){
4795 4795
         $docs = $this->getDocumentChildren($parentid, $published, 0, 'id', $where, $sortBy, $sortDir);
4796 4796
 
4797 4797
         if (!$docs) {
@@ -4886,7 +4886,7 @@  discard block
 block discarded – undo
4886 4886
         $published = 1,
4887 4887
         $sort = 'rank',
4888 4888
         $dir = 'ASC'
4889
-    ) {
4889
+    ){
4890 4890
         $cacheKey = md5(print_r(func_get_args(), true));
4891 4891
         if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) {
4892 4892
             return $this->tmpCache[__FUNCTION__][$cacheKey];
@@ -4911,20 +4911,20 @@  discard block
 block discarded – undo
4911 4911
             }
4912 4912
 
4913 4913
             // get user defined template variables
4914
-            $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.',
4914
+            $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.',
4915 4915
                     array_filter(array_map('trim', explode(',', $fields))));
4916
-            $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4916
+            $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4917 4917
 
4918 4918
             if ($idnames == '*') {
4919 4919
                 $query = 'tv.id<>0';
4920 4920
             } else {
4921
-                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')";
4921
+                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')";
4922 4922
             }
4923 4923
 
4924 4924
             $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value",
4925
-                $this->getFullTableName('site_tmplvars') . " tv
4926
-                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id
4927
-                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'",
4925
+                $this->getFullTableName('site_tmplvars')." tv
4926
+                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id
4927
+                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'",
4928 4928
                 "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
4929 4929
 
4930 4930
             $result = $this->db->makeArray($rs);
@@ -4974,16 +4974,16 @@  discard block
 block discarded – undo
4974 4974
             $output = array();
4975 4975
             $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames);
4976 4976
 
4977
-            $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier;
4977
+            $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier;
4978 4978
             // remove sort for speed
4979 4979
             $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');
4980 4980
 
4981 4981
             if ($result == false) {
4982 4982
                 return false;
4983 4983
             } else {
4984
-                $baspath = MODX_MANAGER_PATH . 'includes';
4985
-                include_once $baspath . '/tmplvars.format.inc.php';
4986
-                include_once $baspath . '/tmplvars.commands.inc.php';
4984
+                $baspath = MODX_MANAGER_PATH.'includes';
4985
+                include_once $baspath.'/tmplvars.format.inc.php';
4986
+                include_once $baspath.'/tmplvars.commands.inc.php';
4987 4987
 
4988 4988
                 for ($i = 0; $i < count($result); $i++) {
4989 4989
                     $row = $result[$i];
@@ -5009,7 +5009,7 @@  discard block
 block discarded – undo
5009 5009
      */
5010 5010
     public function getFullTableName($tbl)
5011 5011
     {
5012
-        return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`";
5012
+        return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`";
5013 5013
     }
5014 5014
 
5015 5015
     /**
@@ -5088,7 +5088,7 @@  discard block
 block discarded – undo
5088 5088
     public function getCachePath()
5089 5089
     {
5090 5090
         global $base_url;
5091
-        $pth = $base_url . $this->getCacheFolder();
5091
+        $pth = $base_url.$this->getCacheFolder();
5092 5092
 
5093 5093
         return $pth;
5094 5094
     }
@@ -5141,8 +5141,8 @@  discard block
 block discarded – undo
5141 5141
         $out = false;
5142 5142
 
5143 5143
         if (!empty($context)) {
5144
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5145
-                $out = $_SESSION[$context . 'InternalKey'];
5144
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
5145
+                $out = $_SESSION[$context.'InternalKey'];
5146 5146
             }
5147 5147
         } else {
5148 5148
             switch (true) {
@@ -5171,8 +5171,8 @@  discard block
 block discarded – undo
5171 5171
         $out = false;
5172 5172
 
5173 5173
         if (!empty($context)) {
5174
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5175
-                $out = $_SESSION[$context . 'Shortname'];
5174
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
5175
+                $out = $_SESSION[$context.'Shortname'];
5176 5176
             }
5177 5177
         } else {
5178 5178
             switch (true) {
@@ -5244,8 +5244,8 @@  discard block
 block discarded – undo
5244 5244
      */
5245 5245
     public function getWebUserInfo($uid)
5246 5246
     {
5247
-        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu
5248
-                INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id",
5247
+        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu
5248
+                INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id",
5249 5249
             "wu.id='{$uid}'");
5250 5250
         if ($row = $this->db->getRow($rs)) {
5251 5251
             if (!isset($row['usertype']) or !$row["usertype"]) {
@@ -5288,7 +5288,7 @@  discard block
 block discarded – undo
5288 5288
                     // resolve ids to names
5289 5289
                     $dgn = array();
5290 5290
                     $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"),
5291
-                        "id IN (" . implode(",", $dg) . ")");
5291
+                        "id IN (".implode(",", $dg).")");
5292 5292
                     while ($row = $this->db->getRow($ds)) {
5293 5293
                         $dgn[] = $row['name'];
5294 5294
                     }
@@ -5319,7 +5319,7 @@  discard block
 block discarded – undo
5319 5319
         $rt = false;
5320 5320
         if ($_SESSION["webValidated"] == 1) {
5321 5321
             $tbl = $this->getFullTableName("web_users");
5322
-            $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'");
5322
+            $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'");
5323 5323
             if ($row = $this->db->getRow($ds)) {
5324 5324
                 if ($row["password"] == md5($oldPwd)) {
5325 5325
                     if (strlen($newPwd) < 6) {
@@ -5329,7 +5329,7 @@  discard block
 block discarded – undo
5329 5329
                     } else {
5330 5330
                         $this->db->update(array(
5331 5331
                             'password' => $this->db->escape($newPwd),
5332
-                        ), $tbl, "id='" . $this->getLoginUserID() . "'");
5332
+                        ), $tbl, "id='".$this->getLoginUserID()."'");
5333 5333
                         // invoke OnWebChangePassword event
5334 5334
                         $this->invokeEvent("OnWebChangePassword", array(
5335 5335
                             "userid"       => $row["id"],
@@ -5362,8 +5362,8 @@  discard block
 block discarded – undo
5362 5362
         // check cache
5363 5363
         $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false;
5364 5364
         if (!is_array($grpNames)) {
5365
-            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn
5366
-                    INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'");
5365
+            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn
5366
+                    INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'");
5367 5367
             $grpNames = $this->db->getColumn("name", $rs);
5368 5368
             // save to cache
5369 5369
             $_SESSION['webUserGroupNames'] = $grpNames;
@@ -5397,7 +5397,7 @@  discard block
 block discarded – undo
5397 5397
         if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) {
5398 5398
             $this->sjscripts[$nextpos] = $src;
5399 5399
         } else {
5400
-            $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>';
5400
+            $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>';
5401 5401
         }
5402 5402
     }
5403 5403
 
@@ -5424,7 +5424,7 @@  discard block
 block discarded – undo
5424 5424
         $src,
5425 5425
         $options = array('name' => '', 'version' => '0', 'plaintext' => false),
5426 5426
         $startup = false
5427
-    ) {
5427
+    ){
5428 5428
         if (empty($src)) {
5429 5429
             return '';
5430 5430
         } // nothing to register
@@ -5479,7 +5479,7 @@  discard block
 block discarded – undo
5479 5479
         }
5480 5480
 
5481 5481
         if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) {
5482
-            $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>';
5482
+            $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>';
5483 5483
         }
5484 5484
         if ($startup) {
5485 5485
             $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1;
@@ -5630,7 +5630,7 @@  discard block
 block discarded – undo
5630 5630
                 $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName,
5631 5631
                     $pluginName, $eventtime * 1000);
5632 5632
                 foreach ($parameter as $k => $v) {
5633
-                    $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>';
5633
+                    $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>';
5634 5634
                 }
5635 5635
                 $this->pluginsCode .= '</fieldset><br />';
5636 5636
                 $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime;
@@ -5659,14 +5659,14 @@  discard block
 block discarded – undo
5659 5659
         $plugin = array();
5660 5660
         if (isset ($this->pluginCache[$pluginName])) {
5661 5661
             $pluginCode = $this->pluginCache[$pluginName];
5662
-            $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : '';
5662
+            $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : '';
5663 5663
         } else {
5664 5664
             $pluginName = $this->db->escape($pluginName);
5665 5665
             $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"),
5666 5666
                 "name='{$pluginName}' AND disabled=0");
5667 5667
             if ($row = $this->db->getRow($result)) {
5668 5668
                 $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode'];
5669
-                $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties'];
5669
+                $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties'];
5670 5670
             } else {
5671 5671
                 $pluginCode = $this->pluginCache[$pluginName] = "return false;";
5672 5672
                 $pluginProperties = '';
@@ -5776,7 +5776,7 @@  discard block
 block discarded – undo
5776 5776
     public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)
5777 5777
     {
5778 5778
         $params = array();
5779
-        $fullpath = $element_dir . '/' . $filename;
5779
+        $fullpath = $element_dir.'/'.$filename;
5780 5780
         if (is_readable($fullpath)) {
5781 5781
             $tpl = @fopen($fullpath, "r");
5782 5782
             if ($tpl) {
@@ -5888,7 +5888,7 @@  discard block
 block discarded – undo
5888 5888
         $name_found,
5889 5889
         $description_found,
5890 5890
         $docblock_end_found
5891
-    ) {
5891
+    ){
5892 5892
         $param = '';
5893 5893
         $val = '';
5894 5894
         $ma = null;
@@ -5953,8 +5953,8 @@  discard block
 block discarded – undo
5953 5953
         $ph = array('site_url' => MODX_SITE_URL);
5954 5954
         $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";
5955 5955
         $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';
5956
-        $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';
5957
-        $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';
5956
+        $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';
5957
+        $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';
5958 5958
         foreach ($parsed as $key => $val) {
5959 5959
             if (is_array($val)) {
5960 5960
                 foreach ($val as $key2 => $val2) {
@@ -5964,7 +5964,7 @@  discard block
 block discarded – undo
5964 5964
                             $val2);
5965 5965
                     }
5966 5966
                     if (preg_match($regexEmail, $val2, $url)) {
5967
-                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);
5967
+                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);
5968 5968
                     }
5969 5969
                     $parsed[$key][$key2] = $val2;
5970 5970
                 }
@@ -5974,7 +5974,7 @@  discard block
 block discarded – undo
5974 5974
                     $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val);
5975 5975
                 }
5976 5976
                 if (preg_match($regexEmail, $val, $url)) {
5977
-                    $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);
5977
+                    $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);
5978 5978
                 }
5979 5979
                 $parsed[$key] = $val;
5980 5980
             }
@@ -5988,33 +5988,33 @@  discard block
 block discarded – undo
5988 5988
         );
5989 5989
 
5990 5990
         $nl = "\n";
5991
-        $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'],
5992
-                "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';
5993
-        $list .= '<p>' . $nl;
5994
-        $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';
5995
-        $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';
5996
-        $list .= '</p><br/>' . $nl;
5997
-        $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';
5998
-        $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';
5999
-        $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';
6000
-        $list .= '<br/>' . $nl;
5991
+        $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'],
5992
+                "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';
5993
+        $list .= '<p>'.$nl;
5994
+        $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';
5995
+        $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';
5996
+        $list .= '</p><br/>'.$nl;
5997
+        $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';
5998
+        $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';
5999
+        $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';
6000
+        $list .= '<br/>'.$nl;
6001 6001
         $first = true;
6002 6002
         foreach ($arrayParams as $param => $label) {
6003 6003
             if (isset($parsed[$param])) {
6004 6004
                 if ($first) {
6005
-                    $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;
6006
-                    $list .= '<ul class="docBlockList">' . $nl;
6005
+                    $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;
6006
+                    $list .= '<ul class="docBlockList">'.$nl;
6007 6007
                     $first = false;
6008 6008
                 }
6009
-                $list .= '    <li><strong>' . $label . '</strong>' . $nl;
6010
-                $list .= '        <ul>' . $nl;
6009
+                $list .= '    <li><strong>'.$label.'</strong>'.$nl;
6010
+                $list .= '        <ul>'.$nl;
6011 6011
                 foreach ($parsed[$param] as $val) {
6012
-                    $list .= '            <li>' . $val . '</li>' . $nl;
6012
+                    $list .= '            <li>'.$val.'</li>'.$nl;
6013 6013
                 }
6014
-                $list .= '        </ul></li>' . $nl;
6014
+                $list .= '        </ul></li>'.$nl;
6015 6015
             }
6016 6016
         }
6017
-        $list .= !$first ? '</ul>' . $nl : '';
6017
+        $list .= !$first ? '</ul>'.$nl : '';
6018 6018
 
6019 6019
         return $list;
6020 6020
     }
@@ -6092,7 +6092,7 @@  discard block
 block discarded – undo
6092 6092
      */
6093 6093
     public function addSnippet($name, $phpCode)
6094 6094
     {
6095
-        $this->snippetCache['#' . $name] = $phpCode;
6095
+        $this->snippetCache['#'.$name] = $phpCode;
6096 6096
     }
6097 6097
 
6098 6098
     /**
@@ -6101,7 +6101,7 @@  discard block
 block discarded – undo
6101 6101
      */
6102 6102
     public function addChunk($name, $text)
6103 6103
     {
6104
-        $this->chunkCache['#' . $name] = $text;
6104
+        $this->chunkCache['#'.$name] = $text;
6105 6105
     }
6106 6106
 
6107 6107
     /**
@@ -6137,7 +6137,7 @@  discard block
 block discarded – undo
6137 6137
         }
6138 6138
 
6139 6139
         if (!$isSafe) {
6140
-            $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);
6140
+            $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);
6141 6141
             $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50)));
6142 6142
             $this->messageQuit($title, '', true, '', '', 'Parser', $msg);
6143 6143
 
@@ -6152,7 +6152,7 @@  discard block
 block discarded – undo
6152 6152
             return 'array()';
6153 6153
         }
6154 6154
 
6155
-        $output = $echo . $return;
6155
+        $output = $echo.$return;
6156 6156
         modx_sanitize_gpc($output);
6157 6157
 
6158 6158
         return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous
@@ -6171,8 +6171,8 @@  discard block
 block discarded – undo
6171 6171
 
6172 6172
         $safe = explode(',', $safe_functions);
6173 6173
 
6174
-        $phpcode = rtrim($phpcode, ';') . ';';
6175
-        $tokens = token_get_all('<?php ' . $phpcode);
6174
+        $phpcode = rtrim($phpcode, ';').';';
6175
+        $tokens = token_get_all('<?php '.$phpcode);
6176 6176
         foreach ($tokens as $i => $token) {
6177 6177
             if (!is_array($token)) {
6178 6178
                 continue;
@@ -6213,7 +6213,7 @@  discard block
 block discarded – undo
6213 6213
             'assets/tvs/',
6214 6214
             'assets/chunks/',
6215 6215
             'assets/templates/',
6216
-            $this->config['rb_base_url'] . 'files/',
6216
+            $this->config['rb_base_url'].'files/',
6217 6217
             ''
6218 6218
         );
6219 6219
 
@@ -6238,7 +6238,7 @@  discard block
 block discarded – undo
6238 6238
         $errorMsg = sprintf("Could not retrieve string '%s'.", $str);
6239 6239
 
6240 6240
         foreach ($search_path as $path) {
6241
-            $file_path = MODX_BASE_PATH . $path . $str;
6241
+            $file_path = MODX_BASE_PATH.$path.$str;
6242 6242
             if (strpos($file_path, MODX_MANAGER_PATH) === 0) {
6243 6243
                 return $errorMsg;
6244 6244
             } elseif (is_file($file_path)) {
@@ -6252,7 +6252,7 @@  discard block
 block discarded – undo
6252 6252
             return $errorMsg;
6253 6253
         }
6254 6254
 
6255
-        $content = (string)file_get_contents($file_path);
6255
+        $content = (string) file_get_contents($file_path);
6256 6256
         if ($content === false) {
6257 6257
             return $errorMsg;
6258 6258
         }
@@ -6354,7 +6354,7 @@  discard block
 block discarded – undo
6354 6354
         $text = '',
6355 6355
         $line = '',
6356 6356
         $output = ''
6357
-    ) {
6357
+    ){
6358 6358
 
6359 6359
         if (0 < $this->messageQuitCount) {
6360 6360
             return;
@@ -6374,22 +6374,22 @@  discard block
 block discarded – undo
6374 6374
 
6375 6375
         $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
6376 6376
         $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
6377
-        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI'];
6377
+        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI'];
6378 6378
         $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);
6379 6379
         $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);
6380 6380
         $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);
6381 6381
         if ($is_error) {
6382 6382
             $str = '<h2 style="color:red">&laquo; Evo Parse Error &raquo;</h2>';
6383 6383
             if ($msg != 'PHP Parse Error') {
6384
-                $str .= '<h3 style="color:red">' . $msg . '</h3>';
6384
+                $str .= '<h3 style="color:red">'.$msg.'</h3>';
6385 6385
             }
6386 6386
         } else {
6387 6387
             $str = '<h2 style="color:#003399">&laquo; Evo Debug/ stop message &raquo;</h2>';
6388
-            $str .= '<h3 style="color:#003399">' . $msg . '</h3>';
6388
+            $str .= '<h3 style="color:#003399">'.$msg.'</h3>';
6389 6389
         }
6390 6390
 
6391 6391
         if (!empty ($query)) {
6392
-            $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>';
6392
+            $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>';
6393 6393
         }
6394 6394
 
6395 6395
         $errortype = array(
@@ -6412,13 +6412,13 @@  discard block
 block discarded – undo
6412 6412
 
6413 6413
         if (!empty($nr) || !empty($file)) {
6414 6414
             if ($text != '') {
6415
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';
6415
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';
6416 6416
             }
6417 6417
             if ($output != '') {
6418
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';
6418
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';
6419 6419
             }
6420 6420
             if ($nr !== '') {
6421
-                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]");
6421
+                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]");
6422 6422
             }
6423 6423
             if ($file) {
6424 6424
                 $table[] = array('File', $file);
@@ -6438,7 +6438,7 @@  discard block
 block discarded – undo
6438 6438
         }
6439 6439
 
6440 6440
         if (!empty($this->event->activePlugin)) {
6441
-            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')');
6441
+            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')');
6442 6442
         }
6443 6443
 
6444 6444
         $str .= $MakeTable->create($table, array('Error information', ''));
@@ -6448,11 +6448,11 @@  discard block
 block discarded – undo
6448 6448
         $table[] = array('REQUEST_URI', $request_uri);
6449 6449
 
6450 6450
         if ($this->manager->action) {
6451
-            include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
6451
+            include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
6452 6452
             global $action_list;
6453 6453
             $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : '';
6454 6454
 
6455
-            $table[] = array('Manager action', $this->manager->action . $actionName);
6455
+            $table[] = array('Manager action', $this->manager->action.$actionName);
6456 6456
         }
6457 6457
 
6458 6458
         if (preg_match('@^[0-9]+@', $this->documentIdentifier)) {
@@ -6460,7 +6460,7 @@  discard block
 block discarded – undo
6460 6460
             $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');
6461 6461
             $table[] = array(
6462 6462
                 'Resource',
6463
-                '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>'
6463
+                '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>'
6464 6464
             );
6465 6465
         }
6466 6466
         $table[] = array('Referer', $referer);
@@ -6485,7 +6485,7 @@  discard block
 block discarded – undo
6485 6485
 
6486 6486
         $mem = memory_get_peak_usage(true);
6487 6487
         $total_mem = $mem - $this->mstart;
6488
-        $total_mem = ($total_mem / 1024 / 1024) . ' mb';
6488
+        $total_mem = ($total_mem / 1024 / 1024).' mb';
6489 6489
 
6490 6490
         $queryTime = $this->queryTime;
6491 6491
         $phpTime = $totalTime - $queryTime;
@@ -6506,18 +6506,18 @@  discard block
 block discarded – undo
6506 6506
         $str .= $this->get_backtrace(debug_backtrace());
6507 6507
         // Log error
6508 6508
         if (!empty($this->currentSnippet)) {
6509
-            $source = 'Snippet - ' . $this->currentSnippet;
6509
+            $source = 'Snippet - '.$this->currentSnippet;
6510 6510
         } elseif (!empty($this->event->activePlugin)) {
6511
-            $source = 'Plugin - ' . $this->event->activePlugin;
6511
+            $source = 'Plugin - '.$this->event->activePlugin;
6512 6512
         } elseif ($source !== '') {
6513
-            $source = 'Parser - ' . $source;
6513
+            $source = 'Parser - '.$source;
6514 6514
         } elseif ($query !== '') {
6515 6515
             $source = 'SQL Query';
6516 6516
         } else {
6517 6517
             $source = 'Parser';
6518 6518
         }
6519 6519
         if ($msg) {
6520
-            $source .= ' / ' . $msg;
6520
+            $source .= ' / '.$msg;
6521 6521
         }
6522 6522
         if (isset($actionName) && !empty($actionName)) {
6523 6523
             $source .= $actionName;
@@ -6549,12 +6549,12 @@  discard block
 block discarded – undo
6549 6549
 
6550 6550
         // Display error
6551 6551
         if (isset($_SESSION['mgrValidated'])) {
6552
-            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>
6552
+            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>
6553 6553
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6554
-                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />
6554
+                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />
6555 6555
                  <style type="text/css">body { padding:10px; } td {font:inherit;}</style>
6556 6556
                  </head><body>
6557
-                 ' . $str . '</body></html>';
6557
+                 ' . $str.'</body></html>';
6558 6558
 
6559 6559
         } else {
6560 6560
             echo 'Error';
@@ -6592,7 +6592,7 @@  discard block
 block discarded – undo
6592 6592
             switch ($val['type']) {
6593 6593
                 case '->':
6594 6594
                 case '::':
6595
-                    $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];
6595
+                    $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];
6596 6596
                     break;
6597 6597
                 default:
6598 6598
                     $functionName = $val['function'];
@@ -6602,7 +6602,7 @@  discard block
 block discarded – undo
6602 6602
             $args = array_pad(array(), $_, '$var');
6603 6603
             $args = implode(", ", $args);
6604 6604
             $modx = &$this;
6605
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6605
+            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) {
6606 6606
                 $arg = $val['args'][$tmp - 1];
6607 6607
                 switch (true) {
6608 6608
                     case is_null($arg): {
@@ -6614,8 +6614,8 @@  discard block
 block discarded – undo
6614 6614
                         break;
6615 6615
                     }
6616 6616
                     case is_scalar($arg): {
6617
-                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'",
6618
-                                "\\'", $arg)) . "'");
6617
+                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'",
6618
+                                "\\'", $arg))."'");
6619 6619
                         break;
6620 6620
                     }
6621 6621
                     case is_bool($arg): {
@@ -6623,15 +6623,15 @@  discard block
 block discarded – undo
6623 6623
                         break;
6624 6624
                     }
6625 6625
                     case is_array($arg): {
6626
-                        $out = 'array $var' . $tmp;
6626
+                        $out = 'array $var'.$tmp;
6627 6627
                         break;
6628 6628
                     }
6629 6629
                     case is_object($arg): {
6630
-                        $out = get_class($arg) . ' $var' . $tmp;
6630
+                        $out = get_class($arg).' $var'.$tmp;
6631 6631
                         break;
6632 6632
                     }
6633 6633
                     default: {
6634
-                        $out = '$var' . $tmp;
6634
+                        $out = '$var'.$tmp;
6635 6635
                     }
6636 6636
                 }
6637 6637
                 $tmp++;
@@ -6639,8 +6639,8 @@  discard block
 block discarded – undo
6639 6639
                 return $out;
6640 6640
             }, $args);
6641 6641
             $line = array(
6642
-                "<strong>" . $functionName . "</strong>(" . $args . ")",
6643
-                $path . " on line " . $val['line']
6642
+                "<strong>".$functionName."</strong>(".$args.")",
6643
+                $path." on line ".$val['line']
6644 6644
             );
6645 6645
             $table[] = array(implode("<br />", $line));
6646 6646
         }
@@ -6682,7 +6682,7 @@  discard block
 block discarded – undo
6682 6682
             $alias = strip_tags($alias); // strip HTML
6683 6683
             $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters
6684 6684
             $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash
6685
-            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one
6685
+            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one
6686 6686
             $alias = trim($alias, '-'); // trim excess
6687 6687
 
6688 6688
             return $alias;
@@ -6699,7 +6699,7 @@  discard block
 block discarded – undo
6699 6699
         $precisions = count($sizes) - 1;
6700 6700
         foreach ($sizes as $unit => $bytes) {
6701 6701
             if ($size >= $bytes) {
6702
-                return number_format($size / $bytes, $precisions) . ' ' . $unit;
6702
+                return number_format($size / $bytes, $precisions).' '.$unit;
6703 6703
             }
6704 6704
             $precisions--;
6705 6705
         }
@@ -6805,10 +6805,10 @@  discard block
 block discarded – undo
6805 6805
 
6806 6806
         if (strpos($str, MODX_MANAGER_PATH) === 0) {
6807 6807
             return false;
6808
-        } elseif (is_file(MODX_BASE_PATH . $str)) {
6809
-            $file_path = MODX_BASE_PATH . $str;
6810
-        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) {
6811
-            $file_path = MODX_BASE_PATH . $tpl_dir . $str;
6808
+        } elseif (is_file(MODX_BASE_PATH.$str)) {
6809
+            $file_path = MODX_BASE_PATH.$str;
6810
+        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) {
6811
+            $file_path = MODX_BASE_PATH.$tpl_dir.$str;
6812 6812
         } else {
6813 6813
             return false;
6814 6814
         }
@@ -6938,7 +6938,7 @@  discard block
 block discarded – undo
6938 6938
             $title = 'no title';
6939 6939
         }
6940 6940
         if (is_array($msg)) {
6941
-            $msg = '<pre>' . print_r($msg, true) . '</pre>';
6941
+            $msg = '<pre>'.print_r($msg, true).'</pre>';
6942 6942
         } elseif ($msg === '') {
6943 6943
             $msg = $_SERVER['REQUEST_URI'];
6944 6944
         }
@@ -6983,7 +6983,7 @@  discard block
 block discarded – undo
6983 6983
         if (is_array($SystemAlertMsgQueque)) {
6984 6984
             $title = '';
6985 6985
             if ($this->name && $this->activePlugin) {
6986
-                $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>";
6986
+                $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>";
6987 6987
             }
6988 6988
             $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>";
6989 6989
         }
Please login to merge, or discard this patch.
manager/includes/preload.functions.inc.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@  discard block
 block discarded – undo
4 4
 $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession
5 5
 
6 6
 
7
-if( ! function_exists('evolutionCMS')) {
7
+if (!function_exists('evolutionCMS')) {
8 8
     /**
9 9
      * @return DocumentParser
10 10
      */
11 11
     function evolutionCMS()
12 12
     {
13
-        if( ! defined('MODX_CLASS')) {
14
-            if( ! class_exists('DocumentParser')) {
13
+        if (!defined('MODX_CLASS')) {
14
+            if (!class_exists('DocumentParser')) {
15 15
                 throw new RuntimeException('MODX_CLASS not defined and DocumentParser class not exists');
16 16
             }
17 17
             define('MODX_CLASS', 'DocumentParser');
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     $_ = crc32(__FILE__);
30 30
     $_ = sprintf('%u', $_);
31 31
 
32
-    return 'evo' . base_convert($_, 10, 36);
32
+    return 'evo'.base_convert($_, 10, 36);
33 33
 }
34 34
 
35 35
 /**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 function startCMSSession()
39 39
 {
40 40
     global $site_sessionname, $https_port, $session_cookie_path, $session_cookie_domain;
41
-    if(MODX_CLI) return;
41
+    if (MODX_CLI) return;
42 42
 
43 43
     session_name($site_sessionname);
44 44
     removeInvalidCmsSessionIds($site_sessionname);
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     session_start();
51 51
     $key = "modx.mgr.session.cookie.lifetime";
52 52
     if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
53
-        $cookieLifetime = (int)$_SESSION[$key];
53
+        $cookieLifetime = (int) $_SESSION[$key];
54 54
         if ($cookieLifetime) {
55 55
             $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime;
56 56
         }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
  */
80 80
 function removeInvalidCmsSessionIds($session_name)
81 81
 {
82
-    if(MODX_CLI) return;
82
+    if (MODX_CLI) return;
83 83
     // session ids is invalid iff it is empty string
84 84
     // storage priorioty can see in PHP source ext/session/session.c
85 85
     removeInvalidCmsSessionFromStorage($_COOKIE, $session_name);
Please login to merge, or discard this patch.
Braces   +23 added lines, -19 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@  discard block
 block discarded – undo
4 4
 $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession
5 5
 
6 6
 
7
-if( ! function_exists('evolutionCMS')) {
7
+if( ! function_exists('evolutionCMS')) {
8 8
     /**
9 9
      * @return DocumentParser
10 10
      */
11
-    function evolutionCMS()
12
-    {
13
-        if( ! defined('MODX_CLASS')) {
14
-            if( ! class_exists('DocumentParser')) {
11
+    function evolutionCMS()
12
+    {
13
+        if( ! defined('MODX_CLASS')) {
14
+            if( ! class_exists('DocumentParser')) {
15 15
                 throw new RuntimeException('MODX_CLASS not defined and DocumentParser class not exists');
16 16
             }
17 17
             define('MODX_CLASS', 'DocumentParser');
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 /**
25 25
  * @return string
26 26
  */
27
-function genEvoSessionName()
28
-{
27
+function genEvoSessionName()
28
+{
29 29
     $_ = crc32(__FILE__);
30 30
     $_ = sprintf('%u', $_);
31 31
 
@@ -35,10 +35,12 @@  discard block
 block discarded – undo
35 35
 /**
36 36
  * @return void
37 37
  */
38
-function startCMSSession()
39
-{
38
+function startCMSSession()
39
+{
40 40
     global $site_sessionname, $https_port, $session_cookie_path, $session_cookie_domain;
41
-    if(MODX_CLI) return;
41
+    if(MODX_CLI) {
42
+        return;
43
+    }
42 44
 
43 45
     session_name($site_sessionname);
44 46
     removeInvalidCmsSessionIds($site_sessionname);
@@ -49,14 +51,14 @@  discard block
 block discarded – undo
49 51
     session_set_cookie_params($cookieExpiration, $cookiePath, $cookieDomain, $secure, true);
50 52
     session_start();
51 53
     $key = "modx.mgr.session.cookie.lifetime";
52
-    if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
54
+    if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
53 55
         $cookieLifetime = (int)$_SESSION[$key];
54
-        if ($cookieLifetime) {
56
+        if ($cookieLifetime) {
55 57
             $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime;
56 58
         }
57 59
         setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true);
58 60
     }
59
-    if (!isset($_SESSION['modx.session.created.time'])) {
61
+    if (!isset($_SESSION['modx.session.created.time'])) {
60 62
         $_SESSION['modx.session.created.time'] = $_SERVER['REQUEST_TIME'];
61 63
     }
62 64
 }
@@ -66,9 +68,9 @@  discard block
 block discarded – undo
66 68
  * @param $session_name
67 69
  * @return void
68 70
  */
69
-function removeInvalidCmsSessionFromStorage(&$storage, $session_name)
70
-{
71
-    if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) {
71
+function removeInvalidCmsSessionFromStorage(&$storage, $session_name)
72
+{
73
+    if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) {
72 74
         unset($storage[$session_name]);
73 75
     }
74 76
 }
@@ -77,9 +79,11 @@  discard block
 block discarded – undo
77 79
  * @param $session_name
78 80
  * @return void
79 81
  */
80
-function removeInvalidCmsSessionIds($session_name)
81
-{
82
-    if(MODX_CLI) return;
82
+function removeInvalidCmsSessionIds($session_name)
83
+{
84
+    if(MODX_CLI) {
85
+        return;
86
+    }
83 87
     // session ids is invalid iff it is empty string
84 88
     // storage priorioty can see in PHP source ext/session/session.c
85 89
     removeInvalidCmsSessionFromStorage($_COOKIE, $session_name);
Please login to merge, or discard this patch.