Completed
Push — develop ( cb7ecf...5e631f )
by Dmytro
17s
created
manager/includes/src/Legacy/Permissions.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $role = $this->role;
40 40
 
41 41
         if ($role == 1) {
42
-            return true;  // administrator - grant all document permissions
42
+            return true; // administrator - grant all document permissions
43 43
         }
44 44
 
45 45
         if ($modx->config['use_udperms'] == 0 || $modx->config['use_udperms'] == "" || !isset($modx->config['use_udperms'])) {
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
             are private to the manager users will not be private to web users if the
67 67
             document group is not assigned to a web user group and visa versa.
68 68
          */
69
-        $permissionsok = false;  // set permissions to false
69
+        $permissionsok = false; // set permissions to false
70 70
 
71 71
         $rs = $modx->getDatabase()->select(
72 72
             'count(DISTINCT sc.id)',
73 73
             "{$tblsc} AS sc 
74 74
 				LEFT JOIN {$tbldg} AS dg on dg.document = sc.id 
75 75
 				LEFT JOIN {$tbldgn} dgn ON dgn.id = dg.document_group",
76
-            "sc.id='{$this->document}' AND (" . (empty($docgrp) ? '' : "dg.document_group = " . $docgrp . " ||") . " sc.privatemgr = 0)"
76
+            "sc.id='{$this->document}' AND (".(empty($docgrp) ? '' : "dg.document_group = ".$docgrp." ||")." sc.privatemgr = 0)"
77 77
         );
78 78
         $limit = $modx->getDatabase()->getValue($rs);
79 79
         if ($limit == 1) {
Please login to merge, or discard this patch.
manager/includes/src/Legacy/LogHandler.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -36,16 +36,16 @@  discard block
 block discarded – undo
36 36
         $action = "",
37 37
         $itemid = "",
38 38
         $itemname = ""
39
-    ) {
39
+    ){
40 40
         $modx = evolutionCMS();
41 41
         $this->entry['msg'] = $msg; // writes testmessage to the object
42
-        $this->entry['action'] = empty($action) ? $modx->getManagerApi()->action : $action;    // writes the action to the object
42
+        $this->entry['action'] = empty($action) ? $modx->getManagerApi()->action : $action; // writes the action to the object
43 43
 
44 44
         // User Credentials
45 45
         $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey;
46 46
         $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username;
47 47
 
48
-        $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid;  // writes the id to the object
48
+        $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object
49 49
         if ($this->entry['itemId'] == 0) {
50 50
             $this->entry['itemId'] = "-";
51 51
         } // to stop items having id 0
@@ -96,20 +96,20 @@  discard block
 block discarded – undo
96 96
 
97 97
         $insert_id = $modx->getDatabase()->insert($fields, $tbl_manager_log);
98 98
         if (!$insert_id) {
99
-            $modx->messageQuit("Logging error: couldn't save log to table! Error code: " . $modx->getDatabase()->getLastError());
99
+            $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->getDatabase()->getLastError());
100 100
         } else {
101
-            $limit = (isset($modx->config['manager_log_limit'])) ? (int)$modx->config['manager_log_limit'] : 3000;
102
-            $trim = (isset($modx->config['manager_log_trim'])) ? (int)$modx->config['manager_log_trim'] : 100;
101
+            $limit = (isset($modx->config['manager_log_limit'])) ? (int) $modx->config['manager_log_limit'] : 3000;
102
+            $trim = (isset($modx->config['manager_log_trim'])) ? (int) $modx->config['manager_log_trim'] : 100;
103 103
             if (($insert_id % $trim) === 0) {
104 104
                 $modx->rotate_log('manager_log', $limit, $trim);
105 105
             }
106 106
         }
107 107
     }
108 108
 
109
-    private function getUserIP() {
110
-        if( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) {
111
-            if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')>0) {
112
-                $addr = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']);
109
+    private function getUserIP(){
110
+        if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
111
+            if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',') > 0) {
112
+                $addr = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']);
113 113
                 return trim($addr[0]);
114 114
             } else {
115 115
                 return $_SERVER['HTTP_X_FORWARDED_FOR'];
Please login to merge, or discard this patch.
manager/includes/src/Legacy/mgrResources.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php namespace EvolutionCMS\Legacy;
2 2
 
3
-class mgrResources {
3
+class mgrResources{
4 4
     /**
5 5
      * @var array
6 6
      */
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     /**
22 22
      * mgrResources constructor.
23 23
      */
24
-    public function __construct() {
24
+    public function __construct(){
25 25
         $this->setTypes();
26 26
         $this->queryItemsFromDB();
27 27
         $this->prepareCategoryArrays();
@@ -30,47 +30,47 @@  discard block
 block discarded – undo
30 30
     /**
31 31
      * @return void
32 32
      */
33
-    public function setTypes() {
33
+    public function setTypes(){
34 34
         global $_lang;
35
-        $this->types['site_templates']    = array(
35
+        $this->types['site_templates'] = array(
36 36
             'title'=>$_lang["manage_templates"],
37
-            'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ),
38
-            'permissions'=>array('new_template','edit_template'),
37
+            'actions'=>array('edit'=>array(16, 'edit_template'), 'duplicate'=>array(96, 'new_template'), 'remove'=>array(21, 'delete_template')),
38
+            'permissions'=>array('new_template', 'edit_template'),
39 39
             'name'=>'templatename'
40 40
         );
41
-        $this->types['site_tmplvars']     = array(
41
+        $this->types['site_tmplvars'] = array(
42 42
             'title'=>$_lang["tmplvars"],
43
-            'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')),
44
-            'permissions'=>array('new_template','edit_template'),
43
+            'actions'=>array('edit'=>array(301, 'edit_template'), 'duplicate'=>array(304, 'edit_template'), 'remove'=>array(303, 'edit_template')),
44
+            'permissions'=>array('new_template', 'edit_template'),
45 45
         );
46 46
         $this->types['site_htmlsnippets'] = array(
47 47
             'title'=>$_lang["manage_htmlsnippets"],
48
-            'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')),
49
-            'permissions'=>array('new_chunk','edit_chunk'),
48
+            'actions'=>array('edit'=>array(78, 'edit_chunk'), 'duplicate'=>array(97, 'new_chunk'), 'remove'=>array(80, 'delete_chunk')),
49
+            'permissions'=>array('new_chunk', 'edit_chunk'),
50 50
         );
51
-        $this->types['site_snippets']     = array(
51
+        $this->types['site_snippets'] = array(
52 52
             'title'=>$_lang["manage_snippets"],
53
-            'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')),
54
-            'permissions'=>array('new_snippet','edit_snippet'),
53
+            'actions'=>array('edit'=>array(22, 'edit_snippet'), 'duplicate'=>array(98, 'new_snippet'), 'remove'=>array(25, 'delete_snippet')),
54
+            'permissions'=>array('new_snippet', 'edit_snippet'),
55 55
         );
56
-        $this->types['site_plugins']      = array(
56
+        $this->types['site_plugins'] = array(
57 57
             'title'=>$_lang["manage_plugins"],
58
-            'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')),
59
-            'permissions'=>array('new_plugin','edit_plugin'),
58
+            'actions'=>array('edit'=>array(102, 'edit_plugin'), 'duplicate'=>array(105, 'new_plugin'), 'remove'=>array(104, 'delete_plugin')),
59
+            'permissions'=>array('new_plugin', 'edit_plugin'),
60 60
         );
61
-        $this->types['site_modules']      = array(
61
+        $this->types['site_modules'] = array(
62 62
             'title'=>$_lang["manage_modules"],
63
-            'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')),
64
-            'permissions'=>array('new_module','edit_module'),
63
+            'actions'=>array('edit'=>array(108, 'edit_module'), 'duplicate'=>array(111, 'new_module'), 'remove'=>array(110, 'delete_module')),
64
+            'permissions'=>array('new_module', 'edit_module'),
65 65
         );
66 66
     }
67 67
 
68 68
     /**
69 69
      * @return void
70 70
      */
71
-    public function queryItemsFromDB() {
72
-        foreach($this->types as $resourceTable=>$type) {
73
-            if($this->hasAnyPermissions($type['permissions'])) {
71
+    public function queryItemsFromDB(){
72
+        foreach ($this->types as $resourceTable=>$type) {
73
+            if ($this->hasAnyPermissions($type['permissions'])) {
74 74
                 $nameField = isset($type['name']) ? $type['name'] : 'name';
75 75
                 $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField);
76 76
             }
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
      * @param array $permissions
82 82
      * @return bool
83 83
      */
84
-    public function hasAnyPermissions($permissions) {
84
+    public function hasAnyPermissions($permissions){
85 85
         $modx = evolutionCMS();
86 86
 
87
-        foreach($permissions as $p)
88
-            if($modx->hasPermission($p)) return true;
87
+        foreach ($permissions as $p)
88
+            if ($modx->hasPermission($p)) return true;
89 89
 
90 90
         return false;
91 91
     }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      * @param string $nameField
96 96
      * @return array|bool
97 97
      */
98
-    public function queryResources($resourceTable, $nameField = 'name') {
98
+    public function queryResources($resourceTable, $nameField = 'name'){
99 99
         $modx = evolutionCMS(); global $_lang;
100 100
 
101 101
         $allowed = array(
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             'site_plugins',
105 105
             'site_modules'
106 106
         );
107
-        $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : '';
107
+        $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable.'.disabled, ' : '';
108 108
 
109 109
         $tvsql  = '';
110 110
         $tvjoin = '';
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 
120 120
         $rs = $modx->getDatabase()->select(
121 121
             "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid",
122
-            $modx->getFullTableName($resourceTable) . " AS {$resourceTable}
123
-	            LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}",
122
+            $modx->getFullTableName($resourceTable)." AS {$resourceTable}
123
+	            LEFT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$resourceTable}.category = categories.id {$tvjoin}",
124 124
             "",
125 125
             "category,name"
126 126
         );
127 127
         $limit = $modx->getDatabase()->getRecordCount($rs);
128 128
 
129
-        if($limit < 1) return false;
129
+        if ($limit < 1) return false;
130 130
 
131 131
         $result = array();
132 132
         while ($row = $modx->getDatabase()->getRow($rs)) {
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
     /**
139 139
      * @return void
140 140
      */
141
-    public function prepareCategoryArrays() {
142
-        foreach($this->items as $type=>$items) {
143
-            foreach((array)$items as $item) {
141
+    public function prepareCategoryArrays(){
142
+        foreach ($this->items as $type=>$items) {
143
+            foreach ((array) $items as $item) {
144 144
                 $catid = $item['catid'] ? $item['catid'] : 0;
145 145
                 $this->categories[$catid] = $item['category'];
146 146
 
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
         natcasesort($this->categories);
154 154
 
155 155
         // Now sort by name
156
-        foreach($this->itemsPerCategory as $catid=>$items) {
157
-            usort($this->itemsPerCategory[$catid], function ($a, $b) {
156
+        foreach ($this->itemsPerCategory as $catid=>$items) {
157
+            usort($this->itemsPerCategory[$catid], function($a, $b){
158 158
                 return strcasecmp($a['name'], $b['name']);
159 159
             });
160 160
         }
Please login to merge, or discard this patch.
manager/includes/src/Legacy/DeprecatedCore.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -119,16 +119,16 @@  discard block
 block discarded – undo
119 119
         for ($i = 0; $i < $tablevel; $i++) {
120 120
             $tabs .= "\t";
121 121
         }
122
-        $listhtml = $ordered == true ? $tabs . "<ol class='$ulroot'$typestr>\n" : $tabs . "<ul class='$ulroot'$typestr>\n";
122
+        $listhtml = $ordered == true ? $tabs."<ol class='$ulroot'$typestr>\n" : $tabs."<ul class='$ulroot'$typestr>\n";
123 123
         foreach ($array as $key => $value) {
124 124
             if (is_array($value)) {
125
-                $listhtml .= $tabs . "\t<li>" . $key . "\n" . $this->makeList($value, $ulprefix . $ulroot, $ulprefix,
126
-                        $type, $ordered, $tablevel + 2) . $tabs . "\t</li>\n";
125
+                $listhtml .= $tabs."\t<li>".$key."\n".$this->makeList($value, $ulprefix.$ulroot, $ulprefix,
126
+                        $type, $ordered, $tablevel + 2).$tabs."\t</li>\n";
127 127
             } else {
128
-                $listhtml .= $tabs . "\t<li>" . $value . "</li>\n";
128
+                $listhtml .= $tabs."\t<li>".$value."</li>\n";
129 129
             }
130 130
         }
131
-        $listhtml .= $ordered == true ? $tabs . "</ol>\n" : $tabs . "</ul>\n";
131
+        $listhtml .= $ordered == true ? $tabs."</ol>\n" : $tabs."</ul>\n";
132 132
 
133 133
         return $listhtml;
134 134
     }
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
         $msg = addslashes($modx->getDatabase()->escape($msg));
300 300
         if (substr(strtolower($url), 0, 11) == "javascript:") {
301 301
             $act = "__WebAlert();";
302
-            $fnc = "function __WebAlert(){" . substr($url, 11) . "};";
302
+            $fnc = "function __WebAlert(){".substr($url, 11)."};";
303 303
         } else {
304
-            $act = ($url ? "window.location.href='" . addslashes($url) . "';" : "");
304
+            $act = ($url ? "window.location.href='".addslashes($url)."';" : "");
305 305
         }
306 306
         $html = "<script>$fnc window.setTimeout(\"alert('$msg');$act\",100);</script>";
307 307
         if ($modx->isFrontend()) {
Please login to merge, or discard this patch.
manager/includes/src/Legacy/TemplateParser.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -8,46 +8,46 @@  discard block
 block discarded – undo
8 8
      * @param array $data
9 9
      * @return string
10 10
      */
11
-    public function output($config = array(), $data = array()) {
11
+    public function output($config = array(), $data = array()){
12 12
         $modx = evolutionCMS();
13 13
 
14 14
         $output = '';
15 15
         $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : '');
16
-        $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : '';
16
+        $tab = isset($config['tab']) ? ' AND tab IN('.$config['tab'].')' : '';
17 17
 
18
-        if($action) {
18
+        if ($action) {
19 19
             $sql = $modx->getDatabase()->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name
20
-			FROM ' . $modx->getFullTableName('system_templates') . ' AS t1
21
-			INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category
22
-			WHERE t1.action IN(' . $action . ') ' . $tab . '
20
+			FROM ' . $modx->getFullTableName('system_templates').' AS t1
21
+			INNER JOIN ' . $modx->getFullTableName('categories').' AS t2 ON t2.id=t1.category
22
+			WHERE t1.action IN(' . $action.') '.$tab.'
23 23
 			ORDER BY t1.tab ASC, t1.rank ASC');
24 24
 
25
-            if($modx->getDatabase()->getRecordCount($sql)) {
25
+            if ($modx->getDatabase()->getRecordCount($sql)) {
26 26
                 $tabs = array();
27
-                while($row = $modx->getDatabase()->getRow($sql)) {
28
-                    if(!$row['value'] && !empty($data[$row['name']])) {
27
+                while ($row = $modx->getDatabase()->getRow($sql)) {
28
+                    if (!$row['value'] && !empty($data[$row['name']])) {
29 29
                         $row['value'] = $data[$row['name']];
30 30
                     }
31 31
                     $tabs[$row['tab']]['category_name'] = $row['category_name'];
32 32
                     $tabs[$row['tab']][$row['name']] = $this->render($row);
33 33
                 }
34 34
 
35
-                if(!empty($config['toArray'])) {
35
+                if (!empty($config['toArray'])) {
36 36
                     $output = $tabs;
37 37
                 } else {
38
-                    $output .= '<div class="tab-pane" id="pane_' . $action . '">';
38
+                    $output .= '<div class="tab-pane" id="pane_'.$action.'">';
39 39
                     $output .= '
40 40
 					<script type="text/javascript">
41
-						var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
41
+						var pane_' . $action.' = new WebFXTabPane(document.getElementById("pane_'.$action.'"), '.($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
42 42
 					</script>';
43 43
 
44
-                    foreach($tabs as $idTab => $tab) {
45
-                        $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">';
44
+                    foreach ($tabs as $idTab => $tab) {
45
+                        $output .= '<div class="tab-page" id="tab_'.$action.'_'.$idTab.'">';
46 46
                         $output .= '
47
-						<h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2>
48
-						<script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>';
47
+						<h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']).'</h2>
48
+						<script type="text/javascript">pane_' . $action.'.addTabPage(document.getElementById("tab_'.$action.'_'.$idTab.'"));</script>';
49 49
                         unset($tab['category_name']);
50
-                        foreach($tab as $item) {
50
+                        foreach ($tab as $item) {
51 51
                             $output .= $item;
52 52
                         }
53 53
                         $output .= '</div>';
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      * @param array $data
65 65
      * @return string
66 66
      */
67
-    private function render($data) {
67
+    private function render($data){
68 68
         $modx = evolutionCMS(); global $_lang, $_country_lang;
69 69
 
70 70
         $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $output = '';
75 75
         $output .= '<div class="form-group row">';
76 76
 
77
-        switch($data['type']) {
77
+        switch ($data['type']) {
78 78
 
79 79
             case 'text':
80 80
                 $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>
@@ -108,18 +108,18 @@  discard block
 block discarded – undo
108 108
                 $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>';
109 109
                 $output .= '<div class="col-sm-7">';
110 110
                 $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">';
111
-                if($data['name'] == 'country' && isset($_country_lang)) {
111
+                if ($data['name'] == 'country' && isset($_country_lang)) {
112 112
                     $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country'];
113
-                    $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '>&nbsp;</option>';
114
-                    foreach($_country_lang as $key => $value) {
115
-                        $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>';
113
+                    $output .= '<option value=""'.(!isset($chosenCountry) ? ' selected' : '').'>&nbsp;</option>';
114
+                    foreach ($_country_lang as $key => $value) {
115
+                        $output .= '<option value="'.$key.'"'.(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').'>'.$value.'</option>';
116 116
                     }
117 117
                 } else {
118
-                    if($data['elements']) {
118
+                    if ($data['elements']) {
119 119
                         $elements = explode('||', $data['elements']);
120
-                        foreach($elements as $key => $value) {
120
+                        foreach ($elements as $key => $value) {
121 121
                             $value = explode('==', $value);
122
-                            $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>';
122
+                            $output .= '<option value="'.$value[1].'">'.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]).'</option>';
123 123
                         }
124 124
                     }
125 125
                 }
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
                 $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>';
134 134
                 $output .= '<div class="col-sm-7">';
135 135
                 $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />';
136
-                if($data['elements']) {
136
+                if ($data['elements']) {
137 137
                     $elements = explode('||', $data['elements']);
138
-                    foreach($elements as $key => $value) {
138
+                    foreach ($elements as $key => $value) {
139 139
                         $value = explode('==', $value);
140
-                        $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]);
140
+                        $output .= '<br /><input type="checkbox" name="'.$value[0].'" class="form-control" id="'.$value[0].'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]);
141 141
                     }
142 142
                 }
143 143
                 $output .= $data['content'];
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
                 $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>';
150 150
                 $output .= '<div class="col-sm-7">';
151 151
                 $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />';
152
-                if($data['elements']) {
152
+                if ($data['elements']) {
153 153
                     $elements = explode('||', $data['elements']);
154
-                    foreach($elements as $key => $value) {
154
+                    foreach ($elements as $key => $value) {
155 155
                         $value = explode('==', $value);
156
-                        $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]);
156
+                        $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_'.$key.'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]);
157 157
                     }
158 158
                 }
159 159
                 $output .= $data['content'];
Please login to merge, or discard this patch.
manager/includes/src/Legacy/ModuleCategoriesManager.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
     {
86 86
         global $_lang, $_style;
87 87
 
88
-        $filename = trim($view_name) . '.tpl.phtml';
89
-        $file = self::get('views_dir') . $filename;
88
+        $filename = trim($view_name).'.tpl.phtml';
89
+        $file = self::get('views_dir').$filename;
90 90
         $view = &$this;
91 91
 
92 92
         if (is_file($file)
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
     {
112 112
 
113 113
         $_update = array(
114
-            'id'       => (int)$element_id,
115
-            'category' => (int)$category_id
114
+            'id'       => (int) $element_id,
115
+            'category' => (int) $category_id
116 116
         );
117 117
 
118 118
         $this->getDatabase()->update(
119 119
             $_update,
120 120
             $this->db_tbl[$element],
121
-            "`id` = '" . (int)$element_id . "'"
121
+            "`id` = '".(int) $element_id."'"
122 122
         );
123 123
 
124 124
         return $this->getDatabase()->getAffectedRows() === 1;
Please login to merge, or discard this patch.
manager/includes/src/Database.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $pre = null,
34 34
         $charset = '',
35 35
         $connection_method = 'SET CHARACTER SET'
36
-    ) {
36
+    ){
37 37
         $this->config['host'] = $host ? $host : $GLOBALS['database_server'];
38 38
         $this->config['dbase'] = $dbase ? $dbase : $GLOBALS['dbase'];
39 39
         $this->config['user'] = $uid ? $uid : $GLOBALS['database_user'];
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                         $ua = $modx->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_USER_AGENT']);
74 74
                         $referer = $modx->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_REFERER']);
75 75
                         $modx->sendmail(array(
76
-                            'subject' => 'Missing to create the database connection! from ' . $modx->config['site_name'],
76
+                            'subject' => 'Missing to create the database connection! from '.$modx->config['site_name'],
77 77
                             'body'    => "{$logtitle}\n{$request_uri}\n{$ua}\n{$referer}",
78 78
                             'type'    => 'text'
79 79
                         ));
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
             $tend = $modx->getMicroTime();
89 89
             $totaltime = $tend - $tstart;
90 90
             if ($modx->dumpSQL) {
91
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>" . sprintf("Database connection was created in %2.4f s",
92
-                        $totaltime) . "</fieldset><br />";
91
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>".sprintf("Database connection was created in %2.4f s",
92
+                        $totaltime)."</fieldset><br />";
93 93
             }
94 94
             $this->conn->set_charset($this->config['charset']);
95 95
             $this->isConnected = true;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         if (1000 < $safeCount) {
123 123
             exit("Too many loops '{$safeCount}'");
124 124
         }
125
-        if ( ! ($this->conn instanceof mysqli)) {
125
+        if (!($this->conn instanceof mysqli)) {
126 126
             $this->connect();
127 127
         }
128 128
         if (is_array($s)) {
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     public function query($sql, $watchError = true)
149 149
     {
150 150
         $modx = evolutionCMS();
151
-        if ( ! ($this->conn instanceof mysqli)) {
151
+        if (!($this->conn instanceof mysqli)) {
152 152
             $this->connect();
153 153
         }
154 154
         $tStart = $modx->getMicroTime();
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
                 case 1091:
169 169
                     break;
170 170
                 default:
171
-                    $modx->messageQuit('Execution of a query to the database failed - ' . $this->getLastError(), $sql);
171
+                    $modx->messageQuit('Execution of a query to the database failed - '.$this->getLastError(), $sql);
172 172
             }
173 173
         } else {
174 174
             $tend = $modx->getMicroTime();
@@ -182,24 +182,24 @@  discard block
 block discarded – undo
182 182
                     $debug_path[] = $line['function'];
183 183
                 }
184 184
                 $debug_path = implode(' > ', array_reverse($debug_path));
185
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query " . ($modx->executedQueries + 1) . " - " . sprintf("%2.2f ms",
186
-                        $totalTime * 1000) . "</legend>";
187
-                $modx->queryCode .= $sql . '<br><br>';
185
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query ".($modx->executedQueries + 1)." - ".sprintf("%2.2f ms",
186
+                        $totalTime * 1000)."</legend>";
187
+                $modx->queryCode .= $sql.'<br><br>';
188 188
                 if ($modx->event->name) {
189
-                    $modx->queryCode .= 'Current Event  => ' . $modx->event->name . '<br>';
189
+                    $modx->queryCode .= 'Current Event  => '.$modx->event->name.'<br>';
190 190
                 }
191 191
                 if ($modx->event->activePlugin) {
192
-                    $modx->queryCode .= 'Current Plugin => ' . $modx->event->activePlugin . '<br>';
192
+                    $modx->queryCode .= 'Current Plugin => '.$modx->event->activePlugin.'<br>';
193 193
                 }
194 194
                 if ($modx->currentSnippet) {
195
-                    $modx->queryCode .= 'Current Snippet => ' . $modx->currentSnippet . '<br>';
195
+                    $modx->queryCode .= 'Current Snippet => '.$modx->currentSnippet.'<br>';
196 196
                 }
197 197
                 if (stripos($sql, 'select') === 0) {
198
-                    $modx->queryCode .= 'Record Count => ' . $this->getRecordCount($result) . '<br>';
198
+                    $modx->queryCode .= 'Record Count => '.$this->getRecordCount($result).'<br>';
199 199
                 } else {
200
-                    $modx->queryCode .= 'Affected Rows => ' . $this->getAffectedRows() . '<br>';
200
+                    $modx->queryCode .= 'Affected Rows => '.$this->getAffectedRows().'<br>';
201 201
                 }
202
-                $modx->queryCode .= 'Functions Path => ' . $debug_path . '<br>';
202
+                $modx->queryCode .= 'Functions Path => '.$debug_path.'<br>';
203 203
                 $modx->queryCode .= "</fieldset><br />";
204 204
             }
205 205
             $modx->executedQueries++;
@@ -306,9 +306,9 @@  discard block
 block discarded – undo
306 306
                     if ($value === null || strtolower($value) === 'null') {
307 307
                         $f = 'NULL';
308 308
                     } else {
309
-                        $f = "'" . $value . "'";
309
+                        $f = "'".$value."'";
310 310
                     }
311
-                    $fields[$key] = "`{$key}` = " . $f;
311
+                    $fields[$key] = "`{$key}` = ".$f;
312 312
                 }
313 313
                 $fields = implode(',', $fields);
314 314
             }
@@ -343,12 +343,12 @@  discard block
 block discarded – undo
343 343
                 $this->query("INSERT INTO {$intotable} {$fields}");
344 344
             } else {
345 345
                 if (empty($fromtable)) {
346
-                    $fields = "(`" . implode("`, `", array_keys($fields)) . "`) VALUES('" . implode("', '",
347
-                            array_values($fields)) . "')";
346
+                    $fields = "(`".implode("`, `", array_keys($fields))."`) VALUES('".implode("', '",
347
+                            array_values($fields))."')";
348 348
                     $this->query("INSERT INTO {$intotable} {$fields}");
349 349
                 } else {
350 350
                     $fromtable = $this->replaceFullTableName($fromtable);
351
-                    $fields = "(" . implode(",", array_keys($fields)) . ")";
351
+                    $fields = "(".implode(",", array_keys($fields)).")";
352 352
                     $where = trim($where);
353 353
                     $limit = trim($limit);
354 354
                     if ($where !== '' && stripos($where, 'WHERE') !== 0) {
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
      */
443 443
     public function getInsertId($conn = null)
444 444
     {
445
-        if (! ($conn instanceof mysqli)) {
446
-            $conn =& $this->conn;
445
+        if (!($conn instanceof mysqli)) {
446
+            $conn = & $this->conn;
447 447
         }
448 448
 
449 449
         return $conn->insert_id;
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
      */
456 456
     public function getAffectedRows($conn = null)
457 457
     {
458
-        if (! ($conn instanceof mysqli)) {
459
-            $conn =& $this->conn;
458
+        if (!($conn instanceof mysqli)) {
459
+            $conn = & $this->conn;
460 460
         }
461 461
 
462 462
         return $conn->affected_rows;
@@ -468,8 +468,8 @@  discard block
 block discarded – undo
468 468
      */
469 469
     public function getLastError($conn = null)
470 470
     {
471
-        if (! ($conn instanceof mysqli)) {
472
-            $conn =& $this->conn;
471
+        if (!($conn instanceof mysqli)) {
472
+            $conn = & $this->conn;
473 473
         }
474 474
 
475 475
         return $conn->error;
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
     {
494 494
         $out = false;
495 495
         if ($ds instanceof mysqli_result) {
496
-            switch($mode){
496
+            switch ($mode) {
497 497
                 case 'assoc':
498 498
                     $out = $ds->fetch_assoc();
499 499
                     break;
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
     public function getColumn($name, $dsq)
524 524
     {
525 525
         $col = array();
526
-        if ( ! ($dsq instanceof mysqli_result)) {
526
+        if (!($dsq instanceof mysqli_result)) {
527 527
             $dsq = $this->query($dsq);
528 528
         }
529 529
         if ($dsq) {
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
     public function getColumnNames($dsq)
543 543
     {
544 544
         $names = array();
545
-        if ( ! ($dsq instanceof mysqli_result)) {
545
+        if (!($dsq instanceof mysqli_result)) {
546 546
             $dsq = $this->query($dsq);
547 547
         }
548 548
         if ($dsq) {
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
     public function getValue($dsq)
563 563
     {
564 564
         $out = false;
565
-        if ( ! ($dsq instanceof mysqli_result)) {
565
+        if (!($dsq instanceof mysqli_result)) {
566 566
             $dsq = $this->query($dsq);
567 567
         }
568 568
         if ($dsq) {
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
         $tableName = trim($tableName);
661 661
         $dbase = trim($this->config['dbase'], '`');
662 662
         $prefix = $this->config['table_prefix'];
663
-        if ((bool)$force === true) {
663
+        if ((bool) $force === true) {
664 664
             $result = "`{$dbase}`.`{$prefix}{$tableName}`";
665 665
         } elseif (strpos($tableName, '[+prefix+]') !== false) {
666 666
             $result = preg_replace('@\[\+prefix\+\]([0-9a-zA-Z_]+)@', "`{$dbase}`.`{$prefix}$1`", $tableName);
Please login to merge, or discard this patch.
manager/includes/src/Core.php 1 patch
Spacing   +269 added lines, -269 removed lines patch added patch discarded remove patch
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
         if (empty($services)) {
221 221
             $services   = include EVO_SERVICES_FILE;
222 222
         }
223
-        $this->services     =  $services;
223
+        $this->services = $services;
224 224
 
225 225
         $this->initialize();
226 226
     }
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 
285 285
     private function checkServiceAlias($name){
286 286
         foreach ($this->providerAliases as $alias => $interface) {
287
-            if($name === $interface) {
287
+            if ($name === $interface) {
288 288
                 return $alias;
289 289
             }
290 290
         }
@@ -480,12 +480,12 @@  discard block
 block discarded – undo
480 480
             $info = debug_backtrace();
481 481
             $m[] = $msg;
482 482
             if (!empty($this->currentSnippet)) {
483
-                $m[] = 'Snippet - ' . $this->currentSnippet;
483
+                $m[] = 'Snippet - '.$this->currentSnippet;
484 484
             } elseif (!empty($this->event->activePlugin)) {
485
-                $m[] = 'Plugin - ' . $this->event->activePlugin;
485
+                $m[] = 'Plugin - '.$this->event->activePlugin;
486 486
             }
487 487
             $m[] = $this->decoded_request_uri;
488
-            $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')';
488
+            $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')';
489 489
             $msg = implode('<br />', $m);
490 490
             $this->logEvent(0, $error_type, $msg, $title);
491 491
         }
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
     {
503 503
         $flag = false;
504 504
         if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof Interfaces\DatabaseInterface) {
505
-            $flag = (bool)$this->{$connector}->conn;
505
+            $flag = (bool) $this->{$connector}->conn;
506 506
         }
507 507
         return $flag;
508 508
     }
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
             }
534 534
             if (!$out && $flag) {
535 535
                 $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname)));
536
-                $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php";
536
+                $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php";
537 537
                 $out = is_file($filename) ? include $filename : false;
538 538
             }
539 539
             if ($out && !in_array($extname, $this->extensions)) {
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
     public function getMicroTime()
552 552
     {
553 553
         list ($usec, $sec) = explode(' ', microtime());
554
-        return ((float)$usec + (float)$sec);
554
+        return ((float) $usec + (float) $sec);
555 555
     }
556 556
 
557 557
     /**
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
             // append the redirect count string to the url
576 576
             $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0;
577 577
             if ($currentNumberOfRedirects > 3) {
578
-                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>');
578
+                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>');
579 579
             } else {
580 580
                 $currentNumberOfRedirects += 1;
581 581
                 if (strpos($url, "?") > 0) {
@@ -586,9 +586,9 @@  discard block
 block discarded – undo
586 586
             }
587 587
         }
588 588
         if ($type == 'REDIRECT_REFRESH') {
589
-            $header = 'Refresh: 0;URL=' . $url;
589
+            $header = 'Refresh: 0;URL='.$url;
590 590
         } elseif ($type == 'REDIRECT_META') {
591
-            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />';
591
+            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />';
592 592
             echo $header;
593 593
             exit;
594 594
         } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) {
@@ -596,10 +596,10 @@  discard block
 block discarded – undo
596 596
             global $base_url, $site_url;
597 597
             if (substr($url, 0, strlen($base_url)) == $base_url) {
598 598
                 // append $site_url to make it work with Location:
599
-                $url = $site_url . substr($url, strlen($base_url));
599
+                $url = $site_url.substr($url, strlen($base_url));
600 600
             }
601 601
             if (strpos($url, "\n") === false) {
602
-                $header = 'Location: ' . $url;
602
+                $header = 'Location: '.$url;
603 603
             } else {
604 604
                 $this->messageQuit('No newline allowed in redirect url.');
605 605
             }
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
             header($responseCode);
609 609
         }
610 610
 
611
-        if(!empty($header)) {
611
+        if (!empty($header)) {
612 612
             header($header);
613 613
         }
614 614
 
@@ -713,8 +713,8 @@  discard block
 block discarded – undo
713 713
 
714 714
     private function recoverySiteCache()
715 715
     {
716
-        $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
717
-        $site_cache_path = $site_cache_dir . 'siteCache.idx.php';
716
+        $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
717
+        $site_cache_path = $site_cache_dir.'siteCache.idx.php';
718 718
 
719 719
         if (is_file($site_cache_path)) {
720 720
             include($site_cache_path);
@@ -774,8 +774,8 @@  discard block
 block discarded – undo
774 774
                 $this->invokeEvent("OnBeforeManagerPageInit");
775 775
             }
776 776
 
777
-            if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) {
778
-                $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet'];
777
+            if (isset ($_SESSION[$usrType.'UsrConfigSet'])) {
778
+                $usrSettings = &$_SESSION[$usrType.'UsrConfigSet'];
779 779
             } else {
780 780
                 if ($usrType == 'web') {
781 781
                     $from = $tbl_web_user_settings;
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
                     $usrSettings[$row['setting_name']] = $row['setting_value'];
796 796
                 }
797 797
                 if (isset ($usrType)) {
798
-                    $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
798
+                    $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings;
799 799
                 } // store user settings in session
800 800
             }
801 801
         }
@@ -940,10 +940,10 @@  discard block
 block discarded – undo
940 940
         $suf = $this->config['friendly_url_suffix'];
941 941
         $pre = preg_quote($pre, '/');
942 942
         $suf = preg_quote($suf, '/');
943
-        if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) {
943
+        if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) {
944 944
             $q = $_[1];
945 945
         }
946
-        if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) {
946
+        if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) {
947 947
             $q = $_[1];
948 948
         }
949 949
 
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
         if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */
966 966
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
967 967
             if ($this->config['use_alias_path'] == 1) {
968
-                if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
968
+                if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir.'/'.$q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
969 969
                     $this->documentMethod = 'id';
970 970
                     return $q;
971 971
                 } else { /* not a valid id in terms of virtualDir, treat as alias */
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
      */
1000 1000
     public function getHashFile($key)
1001 1001
     {
1002
-        return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php";
1002
+        return $this->getCacheFolder()."docid_".$key.".pageCache.php";
1003 1003
     }
1004 1004
 
1005 1005
     /**
@@ -1010,9 +1010,9 @@  discard block
 block discarded – undo
1010 1010
         $hash = $id;
1011 1011
         $tmp = null;
1012 1012
         $params = array();
1013
-        if(!empty($this->systemCacheKey)){
1013
+        if (!empty($this->systemCacheKey)) {
1014 1014
             $hash = $this->systemCacheKey;
1015
-        }else {
1015
+        } else {
1016 1016
             if (!empty($_GET)) {
1017 1017
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
1018 1018
                 $params = $_GET;
@@ -1020,8 +1020,8 @@  discard block
 block discarded – undo
1020 1020
                 $hash .= '_'.md5(http_build_query($params));
1021 1021
             }
1022 1022
         }
1023
-        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params));
1024
-        if (is_array($evtOut) && count($evtOut) > 0){
1023
+        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params));
1024
+        if (is_array($evtOut) && count($evtOut) > 0) {
1025 1025
             $tmp = array_pop($evtOut);
1026 1026
         }
1027 1027
         return empty($tmp) ? $hash : $tmp;
@@ -1163,12 +1163,12 @@  discard block
 block discarded – undo
1163 1163
         if ($js = $this->getRegisteredClientStartupScripts()) {
1164 1164
             // change to just before closing </head>
1165 1165
             // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent);
1166
-            $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput);
1166
+            $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput);
1167 1167
         }
1168 1168
 
1169 1169
         // Insert jscripts & html block into template - template must have a </body> tag
1170 1170
         if ($js = $this->getRegisteredClientScripts()) {
1171
-            $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput);
1171
+            $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput);
1172 1172
         }
1173 1173
         // End fix by sirlancelot
1174 1174
 
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
         // send out content-type and content-disposition headers
1180 1180
         if (IN_PARSER_MODE == "true") {
1181 1181
             $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html";
1182
-            header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']);
1182
+            header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']);
1183 1183
             //            if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error)
1184 1184
             //                header('HTTP/1.0 404 Not Found');
1185 1185
             if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) {
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
                     $name = preg_replace('|-+|', '-', $name);
1198 1198
                     $name = trim($name, '-');
1199 1199
                 }
1200
-                $header = 'Content-Disposition: attachment; filename=' . $name;
1200
+                $header = 'Content-Disposition: attachment; filename='.$name;
1201 1201
                 header($header);
1202 1202
             }
1203 1203
         }
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
 
1206 1206
         $stats = $this->getTimerStats($this->tstart);
1207 1207
 
1208
-        $out =& $this->documentOutput;
1208
+        $out = & $this->documentOutput;
1209 1209
         $out = str_replace("[^q^]", $stats['queries'], $out);
1210 1210
         $out = str_replace("[^qt^]", $stats['queryTime'], $out);
1211 1211
         $out = str_replace("[^p^]", $stats['phpTime'], $out);
@@ -1244,17 +1244,17 @@  discard block
 block discarded – undo
1244 1244
                 $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet
1245 1245
                 $tt += $t;
1246 1246
             }
1247
-            echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />";
1247
+            echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />";
1248 1248
             echo $this->snippetsCode;
1249 1249
         }
1250 1250
         if ($this->dumpPlugins) {
1251 1251
             $ps = "";
1252 1252
             $tt = 0;
1253 1253
             foreach ($this->pluginsTime as $s => $t) {
1254
-                $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>";
1254
+                $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>";
1255 1255
                 $tt += $t;
1256 1256
             }
1257
-            echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />";
1257
+            echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />";
1258 1258
             echo $this->pluginsCode;
1259 1259
         }
1260 1260
 
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
         $srcTags = explode(',', $tags);
1281 1281
         $repTags = array();
1282 1282
         foreach ($srcTags as $tag) {
1283
-            $repTags[] = '\\' . $tag[0] . '\\' . $tag[1];
1283
+            $repTags[] = '\\'.$tag[0].'\\'.$tag[1];
1284 1284
         }
1285 1285
         return array($srcTags, $repTags);
1286 1286
     }
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
         $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']);
1303 1303
         $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache";
1304 1304
         $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0;
1305
-        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb";
1305
+        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb";
1306 1306
 
1307 1307
         return $stats;
1308 1308
     }
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
     {
1336 1336
         $cacheRefreshTime = 0;
1337 1337
         $recent_update = 0;
1338
-        @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php');
1338
+        @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php');
1339 1339
         $this->recentUpdate = $recent_update;
1340 1340
 
1341 1341
         $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time'];
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
         // now, check for documents that need publishing
1347 1347
         $field = array('published' => 1, 'publishedon' => $timeNow);
1348 1348
         $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0";
1349
-        $result_pub = $this->getDatabase()->select( 'id', '[+prefix+]site_content',  $where);
1349
+        $result_pub = $this->getDatabase()->select('id', '[+prefix+]site_content', $where);
1350 1350
         $this->getDatabase()->update($field, '[+prefix+]site_content', $where);
1351 1351
         if ($this->getDatabase()->getRecordCount($result_pub) >= 1) { //Event unPublished doc
1352 1352
             while ($row_pub = $this->getDatabase()->getRow($result_pub)) {
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
         // now, check for documents that need un-publishing
1360 1360
         $field = array('published' => 0, 'publishedon' => 0);
1361 1361
         $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1";
1362
-        $result_unpub = $this->getDatabase()->select( 'id', '[+prefix+]site_content',  $where);
1362
+        $result_unpub = $this->getDatabase()->select('id', '[+prefix+]site_content', $where);
1363 1363
         $this->getDatabase()->update($field, '[+prefix+]site_content', $where);
1364 1364
         if ($this->getDatabase()->getRecordCount($result_unpub) >= 1) { //Event unPublished doc
1365 1365
             while ($row_unpub = $this->getDatabase()->getRow($result_unpub)) {
@@ -1405,8 +1405,8 @@  discard block
 block discarded – undo
1405 1405
                 }
1406 1406
 
1407 1407
                 $docObjSerial = serialize($this->documentObject);
1408
-                $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;
1409
-                $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey);
1408
+                $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent;
1409
+                $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey);
1410 1410
                 file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent");
1411 1411
             }
1412 1412
         }
@@ -1448,16 +1448,16 @@  discard block
 block discarded – undo
1448 1448
             return array();
1449 1449
         }
1450 1450
         $spacer = md5('<<<EVO>>>');
1451
-        if($left==='{{' && strpos($content,';}}')!==false)  $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1452
-        if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1453
-        if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1454
-        if($left==='[[' && strpos($content,']]]')!==false)  $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1451
+        if ($left === '{{' && strpos($content, ';}}') !== false)  $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content);
1452
+        if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content);
1453
+        if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content);
1454
+        if ($left === '[[' && strpos($content, ']]]') !== false)  $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content);
1455 1455
 
1456 1456
         $pos['<![CDATA['] = strpos($content, '<![CDATA[');
1457 1457
         $pos[']]>'] = strpos($content, ']]>');
1458 1458
 
1459 1459
         if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) {
1460
-            $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3);
1460
+            $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3);
1461 1461
         }
1462 1462
 
1463 1463
         $lp = explode($left, $content);
@@ -1521,8 +1521,8 @@  discard block
 block discarded – undo
1521 1521
                 }
1522 1522
             }
1523 1523
         }
1524
-        foreach($tags as $i=>$tag) {
1525
-            if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);
1524
+        foreach ($tags as $i=>$tag) {
1525
+            if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag);
1526 1526
         }
1527 1527
         return $tags;
1528 1528
     }
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
         }
1563 1563
 
1564 1564
         foreach ($matches[1] as $i => $key) {
1565
-            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1565
+            if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1566 1566
             if (substr($key, 0, 1) == '#') {
1567 1567
                 $key = substr($key, 1);
1568 1568
             } // remove # for QuickEdit format
@@ -1592,8 +1592,8 @@  discard block
 block discarded – undo
1592 1592
 
1593 1593
             if (strpos($content, $s) !== false) {
1594 1594
                 $content = str_replace($s, $value, $content);
1595
-            } elseif($this->debug) {
1596
-                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1595
+            } elseif ($this->debug) {
1596
+                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1597 1597
             }
1598 1598
         }
1599 1599
 
@@ -1760,8 +1760,8 @@  discard block
 block discarded – undo
1760 1760
             $s = &$matches[0][$i];
1761 1761
             if (strpos($content, $s) !== false) {
1762 1762
                 $content = str_replace($s, $value, $content);
1763
-            } elseif($this->debug) {
1764
-                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1763
+            } elseif ($this->debug) {
1764
+                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1765 1765
             }
1766 1766
         }
1767 1767
         return $content;
@@ -1814,7 +1814,7 @@  discard block
 block discarded – undo
1814 1814
             }
1815 1815
 
1816 1816
             $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags
1817
-            $value = $this->mergePlaceholderContent($value, $params);  // parse page global placeholers
1817
+            $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers
1818 1818
             if ($this->config['enable_at_syntax']) {
1819 1819
                 $value = $this->mergeConditionalTagsContent($value);
1820 1820
             }
@@ -1829,8 +1829,8 @@  discard block
 block discarded – undo
1829 1829
             $s = &$matches[0][$i];
1830 1830
             if (strpos($content, $s) !== false) {
1831 1831
                 $content = str_replace($s, $value, $content);
1832
-            } elseif($this->debug) {
1833
-                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1832
+            } elseif ($this->debug) {
1833
+                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1834 1834
             }
1835 1835
         }
1836 1836
         return $content;
@@ -1888,8 +1888,8 @@  discard block
 block discarded – undo
1888 1888
             $s = &$matches[0][$i];
1889 1889
             if (strpos($content, $s) !== false) {
1890 1890
                 $content = str_replace($s, $value, $content);
1891
-            } elseif($this->debug) {
1892
-                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1891
+            } elseif ($this->debug) {
1892
+                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1893 1893
             }
1894 1894
         }
1895 1895
         return $content;
@@ -1913,7 +1913,7 @@  discard block
 block discarded – undo
1913 1913
             return $content;
1914 1914
         }
1915 1915
 
1916
-        $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#';
1916
+        $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#';
1917 1917
         $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content);
1918 1918
 
1919 1919
         $pieces = explode('<@IF:', $content);
@@ -1924,7 +1924,7 @@  discard block
 block discarded – undo
1924 1924
             }
1925 1925
             list($cmd, $text) = explode('>', $split, 2);
1926 1926
             $cmd = str_replace("'", "\'", $cmd);
1927
-            $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1927
+            $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>";
1928 1928
             $content .= $text;
1929 1929
         }
1930 1930
         $pieces = explode('<@ELSEIF:', $content);
@@ -1935,13 +1935,13 @@  discard block
 block discarded – undo
1935 1935
             }
1936 1936
             list($cmd, $text) = explode('>', $split, 2);
1937 1937
             $cmd = str_replace("'", "\'", $cmd);
1938
-            $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1938
+            $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>";
1939 1939
             $content .= $text;
1940 1940
         }
1941 1941
 
1942 1942
         $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content);
1943 1943
         ob_start();
1944
-        $content = eval('?>' . $content);
1944
+        $content = eval('?>'.$content);
1945 1945
         $content = ob_get_clean();
1946 1946
         $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content);
1947 1947
 
@@ -2066,7 +2066,7 @@  discard block
 block discarded – undo
2066 2066
         $matches = $this->getTagsFromContent($content, $left, $right);
2067 2067
         if (!empty($matches)) {
2068 2068
             foreach ($matches[0] as $i => $v) {
2069
-                $addBreakMatches[$i] = $v . "\n";
2069
+                $addBreakMatches[$i] = $v."\n";
2070 2070
             }
2071 2071
             $content = str_replace($addBreakMatches, '', $content);
2072 2072
             if (strpos($content, $left) !== false) {
@@ -2099,8 +2099,8 @@  discard block
 block discarded – undo
2099 2099
             $s = &$matches[0][$i];
2100 2100
             if (strpos($content, $s) !== false) {
2101 2101
                 $content = str_replace($s, $v, $content);
2102
-            } elseif($this->debug) {
2103
-                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2102
+            } elseif ($this->debug) {
2103
+                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
2104 2104
             }
2105 2105
         }
2106 2106
         return $content;
@@ -2164,7 +2164,7 @@  discard block
 block discarded – undo
2164 2164
                 $msg = ($msg === false) ? 'ob_get_contents() error' : $msg;
2165 2165
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg);
2166 2166
                 if ($this->isBackend()) {
2167
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>');
2167
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>');
2168 2168
                 }
2169 2169
             }
2170 2170
         } else {
@@ -2213,7 +2213,7 @@  discard block
 block discarded – undo
2213 2213
                 $echo = ($echo === false) ? 'ob_get_contents() error' : $echo;
2214 2214
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo);
2215 2215
                 if ($this->isBackend()) {
2216
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>');
2216
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>');
2217 2217
                 }
2218 2218
             }
2219 2219
         }
@@ -2221,7 +2221,7 @@  discard block
 block discarded – undo
2221 2221
         if (is_array($return) || is_object($return)) {
2222 2222
             return $return;
2223 2223
         } else {
2224
-            return $echo . $return;
2224
+            return $echo.$return;
2225 2225
         }
2226 2226
     }
2227 2227
 
@@ -2259,8 +2259,8 @@  discard block
 block discarded – undo
2259 2259
                 }
2260 2260
                 if (strpos($content, $s) !== false) {
2261 2261
                     $content = str_replace($s, $value, $content);
2262
-                } elseif($this->debug) {
2263
-                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2262
+                } elseif ($this->debug) {
2263
+                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2);
2264 2264
                 }
2265 2265
                 continue;
2266 2266
             }
@@ -2271,8 +2271,8 @@  discard block
 block discarded – undo
2271 2271
 
2272 2272
             if (strpos($content, $s) !== false) {
2273 2273
                 $content = str_replace($s, $value, $content);
2274
-            } elseif($this->debug) {
2275
-                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2274
+            } elseif ($this->debug) {
2275
+                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2);
2276 2276
             }
2277 2277
         }
2278 2278
 
@@ -2363,7 +2363,7 @@  discard block
 block discarded – undo
2363 2363
             $eventtime = sprintf('%2.2f ms', $eventtime * 1000);
2364 2364
             $code = str_replace("\t", '  ', $this->getPhpCompat()->htmlspecialchars($value));
2365 2365
             $piece = str_replace("\t", '  ', $this->getPhpCompat()->htmlspecialchars($piece));
2366
-            $print_r_params = str_replace("\t", '  ', $this->getPhpCompat()->htmlspecialchars('$modx->event->params = ' . print_r($params, true)));
2366
+            $print_r_params = str_replace("\t", '  ', $this->getPhpCompat()->htmlspecialchars('$modx->event->params = '.print_r($params, true)));
2367 2367
             $this->snippetsCode .= sprintf('<fieldset style="margin:1em;"><legend><b>%s</b>(%s)</legend><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">[[%s]]</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre></fieldset>', $snippetObject['name'], $eventtime, $piece, $print_r_params, $code);
2368 2368
             $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime);
2369 2369
         }
@@ -2608,7 +2608,7 @@  discard block
 block discarded – undo
2608 2608
             $rs = $this->getDatabase()->select('name,snippet,properties', '[+prefix+]site_snippets', $where);
2609 2609
             $count = $this->getDatabase()->getRecordCount($rs);
2610 2610
             if (1 < $count) {
2611
-                exit('Error $modx->_getSnippetObject()' . $snip_name);
2611
+                exit('Error $modx->_getSnippetObject()'.$snip_name);
2612 2612
             }
2613 2613
             if ($count) {
2614 2614
                 $row = $this->getDatabase()->getRow($rs);
@@ -2634,7 +2634,7 @@  discard block
 block discarded – undo
2634 2634
     public function toAlias($text)
2635 2635
     {
2636 2636
         $suff = $this->config['friendly_url_suffix'];
2637
-        return str_replace(array('.xml' . $suff, '.rss' . $suff, '.js' . $suff, '.css' . $suff, '.txt' . $suff, '.json' . $suff, '.pdf' . $suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2637
+        return str_replace(array('.xml'.$suff, '.rss'.$suff, '.js'.$suff, '.css'.$suff, '.txt'.$suff, '.json'.$suff, '.pdf'.$suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2638 2638
     }
2639 2639
 
2640 2640
     /**
@@ -2666,7 +2666,7 @@  discard block
 block discarded – undo
2666 2666
                 $suff = '/';
2667 2667
             }
2668 2668
 
2669
-            $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff;
2669
+            $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff;
2670 2670
         }
2671 2671
 
2672 2672
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -2703,7 +2703,7 @@  discard block
 block discarded – undo
2703 2703
                 preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match);
2704 2704
                 $ids = implode(',', array_unique($match['1']));
2705 2705
                 if ($ids) {
2706
-                    $res = $this->getDatabase()->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'");
2706
+                    $res = $this->getDatabase()->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'");
2707 2707
                     while ($row = $this->getDatabase()->getRow($res)) {
2708 2708
                         if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) {
2709 2709
                             $parent = $row['parent'];
@@ -2714,7 +2714,7 @@  discard block
 block discarded – undo
2714 2714
                                 $parent = $this->aliasListing[$parent]['parent'];
2715 2715
                             }
2716 2716
 
2717
-                            $aliases[$row['id']] = $path . '/' . $row['alias'];
2717
+                            $aliases[$row['id']] = $path.'/'.$row['alias'];
2718 2718
                         } else {
2719 2719
                             $aliases[$row['id']] = $row['alias'];
2720 2720
                         }
@@ -2726,7 +2726,7 @@  discard block
 block discarded – undo
2726 2726
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2727 2727
             $pref = $this->config['friendly_url_prefix'];
2728 2728
             $suff = $this->config['friendly_url_suffix'];
2729
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2729
+            $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2730 2730
                 global $modx;
2731 2731
                 $thealias = $aliases[$m[1]];
2732 2732
                 $thefolder = $isfolder[$m[1]];
@@ -2742,7 +2742,7 @@  discard block
 block discarded – undo
2742 2742
 
2743 2743
         } else {
2744 2744
             $in = '!\[\~([0-9]+)\~\]!is';
2745
-            $out = "index.php?id=" . '\1';
2745
+            $out = "index.php?id=".'\1';
2746 2746
             $documentSource = preg_replace($in, $out, $documentSource);
2747 2747
         }
2748 2748
 
@@ -2763,7 +2763,7 @@  discard block
 block discarded – undo
2763 2763
         $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
2764 2764
         $len_base_url = strlen($this->config['base_url']);
2765 2765
 
2766
-        $url_path = $q;//LANG
2766
+        $url_path = $q; //LANG
2767 2767
 
2768 2768
         if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) {
2769 2769
             $url_path = substr($url_path, $len_base_url);
@@ -2775,7 +2775,7 @@  discard block
 block discarded – undo
2775 2775
             $strictURL = substr($strictURL, $len_base_url);
2776 2776
         }
2777 2777
         $http_host = $_SERVER['HTTP_HOST'];
2778
-        $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG
2778
+        $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG
2779 2779
 
2780 2780
         $site_url = $this->config['site_url'];
2781 2781
         $url_query_string = explode('?', $_SERVER['REQUEST_URI']);
@@ -2793,7 +2793,7 @@  discard block
 block discarded – undo
2793 2793
                 }
2794 2794
                 if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) {
2795 2795
                     if (empty($_POST)) {
2796
-                        if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) {
2796
+                        if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) {
2797 2797
                             $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
2798 2798
                             exit(0);
2799 2799
                         }
@@ -2852,7 +2852,7 @@  discard block
 block discarded – undo
2852 2852
                 $docgrp = implode(",", $docgrp);
2853 2853
             }
2854 2854
             // get document
2855
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2855
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2856 2856
             $rs = $this->getDatabase()->select('sc.*', "{$tblsc} sc
2857 2857
                 LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1);
2858 2858
             if ($this->getDatabase()->getRecordCount($rs) < 1) {
@@ -2888,9 +2888,9 @@  discard block
 block discarded – undo
2888 2888
             }
2889 2889
             if ($documentObject['template']) {
2890 2890
                 // load TVs and merge with document - Orig by Apodigm - Docvars
2891
-                $rs = $this->getDatabase()->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv
2892
-                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id
2893
-                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2891
+                $rs = $this->getDatabase()->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv
2892
+                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id
2893
+                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2894 2894
                 $tmplvars = array();
2895 2895
                 while ($row = $this->getDatabase()->getRow($rs)) {
2896 2896
                     $tmplvars[$row['name']] = array(
@@ -2936,7 +2936,7 @@  discard block
 block discarded – undo
2936 2936
                 $st = md5($source);
2937 2937
             }
2938 2938
             if ($this->dumpSnippets == 1) {
2939
-                $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>";
2939
+                $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>";
2940 2940
             }
2941 2941
 
2942 2942
             // invoke OnParseDocument event
@@ -2978,7 +2978,7 @@  discard block
 block discarded – undo
2978 2978
      */
2979 2979
     public function executeParser()
2980 2980
     {
2981
-        if(MODX_CLI) {
2981
+        if (MODX_CLI) {
2982 2982
             throw new \RuntimeException('Call DocumentParser::executeParser on CLI mode');
2983 2983
         }
2984 2984
 
@@ -3024,7 +3024,7 @@  discard block
 block discarded – undo
3024 3024
 
3025 3025
             // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path
3026 3026
             if ($this->config['use_alias_path'] == 1) {
3027
-                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier;
3027
+                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier;
3028 3028
                 if (isset($this->documentListing[$alias])) {
3029 3029
                     $this->documentIdentifier = $this->documentListing[$alias];
3030 3030
                 } else {
@@ -3085,7 +3085,7 @@  discard block
 block discarded – undo
3085 3085
                 } else {
3086 3086
                     $docAlias = $this->getDatabase()->escape($this->documentIdentifier);
3087 3087
                     $rs = $this->getDatabase()->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'");
3088
-                    $this->documentIdentifier = (int)$this->getDatabase()->getValue($rs);
3088
+                    $this->documentIdentifier = (int) $this->getDatabase()->getValue($rs);
3089 3089
                 }
3090 3090
             }
3091 3091
             $this->documentMethod = 'id';
@@ -3142,7 +3142,7 @@  discard block
 block discarded – undo
3142 3142
                 $_REQUEST[$n] = $_GET[$n] = $v;
3143 3143
             }
3144 3144
         }
3145
-        $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path'];
3145
+        $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path'];
3146 3146
         $this->q = $qp['path'];
3147 3147
         return $qp['path'];
3148 3148
     }
@@ -3288,7 +3288,7 @@  discard block
 block discarded – undo
3288 3288
         while ($id && $height--) {
3289 3289
             $thisid = $id;
3290 3290
             if ($this->config['aliaslistingfolder'] == 1) {
3291
-                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->getDatabase()->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1");
3291
+                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->getDatabase()->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1");
3292 3292
                 if (!$id || $id == '0') {
3293 3293
                     break;
3294 3294
                 }
@@ -3339,15 +3339,15 @@  discard block
 block discarded – undo
3339 3339
 
3340 3340
         if ($this->config['aliaslistingfolder'] == 1) {
3341 3341
 
3342
-            $res = $this->getDatabase()->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'");
3342
+            $res = $this->getDatabase()->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'");
3343 3343
             $idx = array();
3344 3344
             while ($row = $this->getDatabase()->getRow($res)) {
3345 3345
                 $pAlias = '';
3346 3346
                 if (isset($this->aliasListing[$row['parent']])) {
3347
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : '';
3348
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : '';
3347
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : '';
3348
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : '';
3349 3349
                 };
3350
-                $children[$pAlias . $row['alias']] = $row['id'];
3350
+                $children[$pAlias.$row['alias']] = $row['id'];
3351 3351
                 if ($row['isfolder'] == 1) {
3352 3352
                     $idx[] = $row['id'];
3353 3353
                 }
@@ -3379,7 +3379,7 @@  discard block
 block discarded – undo
3379 3379
                 $depth--;
3380 3380
 
3381 3381
                 foreach ($documentMap_cache[$id] as $childId) {
3382
-                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias'];
3382
+                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias'];
3383 3383
                     if (!strlen($pkey)) {
3384 3384
                         $pkey = "{$childId}";
3385 3385
                     }
@@ -3416,7 +3416,7 @@  discard block
 block discarded – undo
3416 3416
                 $fnc = 'history.back(-1);';
3417 3417
                 break;
3418 3418
             default:
3419
-                $fnc = "window.location.href='" . addslashes($url) . "';";
3419
+                $fnc = "window.location.href='".addslashes($url)."';";
3420 3420
         }
3421 3421
 
3422 3422
         echo "<html><head>
@@ -3448,9 +3448,9 @@  discard block
 block discarded – undo
3448 3448
         $state = 0;
3449 3449
         $pms = $_SESSION['mgrPermissions'];
3450 3450
         if ($pms) {
3451
-            $state = ((bool)$pms[$pm] === true);
3451
+            $state = ((bool) $pms[$pm] === true);
3452 3452
         }
3453
-        return (int)$state;
3453
+        return (int) $state;
3454 3454
     }
3455 3455
 
3456 3456
     /**
@@ -3463,8 +3463,8 @@  discard block
 block discarded – undo
3463 3463
      */
3464 3464
     public function elementIsLocked($type, $id, $includeThisUser = false)
3465 3465
     {
3466
-        $id = (int)$id;
3467
-        $type = (int)$type;
3466
+        $id = (int) $id;
3467
+        $type = (int) $type;
3468 3468
         if (!$type || !$id) {
3469 3469
             return null;
3470 3470
         }
@@ -3514,7 +3514,7 @@  discard block
 block discarded – undo
3514 3514
             return $lockedElements;
3515 3515
         }
3516 3516
 
3517
-        $type = (int)$type;
3517
+        $type = (int) $type;
3518 3518
         if (isset($lockedElements[$type])) {
3519 3519
             return $lockedElements[$type];
3520 3520
         } else {
@@ -3531,7 +3531,7 @@  discard block
 block discarded – undo
3531 3531
             $this->lockedElements = array();
3532 3532
             $this->cleanupExpiredLocks();
3533 3533
 
3534
-            $rs = $this->getDatabase()->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul
3534
+            $rs = $this->getDatabase()->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul
3535 3535
                 LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id");
3536 3536
             while ($row = $this->getDatabase()->getRow($rs)) {
3537 3537
                 $this->lockedElements[$row['elementType']][$row['elementId']] = array(
@@ -3554,7 +3554,7 @@  discard block
 block discarded – undo
3554 3554
     public function cleanupExpiredLocks()
3555 3555
     {
3556 3556
         // Clean-up active_user_sessions first
3557
-        $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
3557
+        $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
3558 3558
         $validSessionTimeLimit = $this->time - $timeout;
3559 3559
         $this->getDatabase()->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}");
3560 3560
 
@@ -3567,7 +3567,7 @@  discard block
 block discarded – undo
3567 3567
             foreach ($rs as $row) {
3568 3568
                 $userSids[] = $row['sid'];
3569 3569
             }
3570
-            $userSids = "'" . implode("','", $userSids) . "'";
3570
+            $userSids = "'".implode("','", $userSids)."'";
3571 3571
             $this->getDatabase()->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})");
3572 3572
         } else {
3573 3573
             $this->getDatabase()->delete($this->getFullTableName('active_user_locks'));
@@ -3651,8 +3651,8 @@  discard block
 block discarded – undo
3651 3651
     public function lockElement($type, $id)
3652 3652
     {
3653 3653
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3654
-        $type = (int)$type;
3655
-        $id = (int)$id;
3654
+        $type = (int) $type;
3655
+        $id = (int) $id;
3656 3656
         if (!$type || !$id || !$userId) {
3657 3657
             return false;
3658 3658
         }
@@ -3673,8 +3673,8 @@  discard block
 block discarded – undo
3673 3673
     public function unlockElement($type, $id, $includeAllUsers = false)
3674 3674
     {
3675 3675
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3676
-        $type = (int)$type;
3677
-        $id = (int)$id;
3676
+        $type = (int) $type;
3677
+        $id = (int) $id;
3678 3678
         if (!$type || !$id) {
3679 3679
             return false;
3680 3680
         }
@@ -3741,8 +3741,8 @@  discard block
 block discarded – undo
3741 3741
         }
3742 3742
 
3743 3743
         $usertype = $this->isFrontend() ? 1 : 0;
3744
-        $evtid = (int)$evtid;
3745
-        $type = (int)$type;
3744
+        $evtid = (int) $evtid;
3745
+        $type = (int) $type;
3746 3746
 
3747 3747
         // Types: 1 = information, 2 = warning, 3 = error
3748 3748
         if ($type < 1) {
@@ -3764,8 +3764,8 @@  discard block
 block discarded – undo
3764 3764
         if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') {
3765 3765
             if ($this->config['send_errormail'] <= $type) {
3766 3766
                 $this->sendmail(array(
3767
-                    'subject' => 'MODX System Error on ' . $this->config['site_name'],
3768
-                    'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.',
3767
+                    'subject' => 'MODX System Error on '.$this->config['site_name'],
3768
+                    'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.',
3769 3769
                     'type' => 'text'
3770 3770
                 ));
3771 3771
             }
@@ -3814,7 +3814,7 @@  discard block
 block discarded – undo
3814 3814
             $p['fromname'] = $userinfo['username'];
3815 3815
         }
3816 3816
         if ($msg === '' && !isset($p['body'])) {
3817
-            $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER'];
3817
+            $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER'];
3818 3818
         } elseif (is_string($msg) && 0 < strlen($msg)) {
3819 3819
             $p['body'] = $msg;
3820 3820
         }
@@ -3855,8 +3855,8 @@  discard block
 block discarded – undo
3855 3855
             $files = array();
3856 3856
         }
3857 3857
         foreach ($files as $f) {
3858
-            if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) {
3859
-                $this->getMail()->AddAttachment(MODX_BASE_PATH . $f);
3858
+            if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) {
3859
+                $this->getMail()->AddAttachment(MODX_BASE_PATH.$f);
3860 3860
             }
3861 3861
         }
3862 3862
         return $this->getMail()->send();
@@ -3900,7 +3900,7 @@  discard block
 block discarded – undo
3900 3900
      */
3901 3901
     public function isFrontend()
3902 3902
     {
3903
-        return ! $this->isBackend();
3903
+        return !$this->isBackend();
3904 3904
     }
3905 3905
 
3906 3906
     /**
@@ -3925,14 +3925,14 @@  discard block
 block discarded – undo
3925 3925
         $tblsc = $this->getFullTableName("site_content");
3926 3926
         $tbldg = $this->getFullTableName("document_groups");
3927 3927
         // modify field names to use sc. table reference
3928
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3929
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3928
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3929
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3930 3930
         // get document groups for current user
3931 3931
         if ($docgrp = $this->getUserDocGroups()) {
3932 3932
             $docgrp = implode(",", $docgrp);
3933 3933
         }
3934 3934
         // build query
3935
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3935
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3936 3936
         $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc
3937 3937
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3938 3938
         $resourceArray = $this->getDatabase()->makeArray($result);
@@ -3962,14 +3962,14 @@  discard block
 block discarded – undo
3962 3962
         $tbldg = $this->getFullTableName("document_groups");
3963 3963
 
3964 3964
         // modify field names to use sc. table reference
3965
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3966
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3965
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3966
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3967 3967
         // get document groups for current user
3968 3968
         if ($docgrp = $this->getUserDocGroups()) {
3969 3969
             $docgrp = implode(",", $docgrp);
3970 3970
         }
3971 3971
         // build query
3972
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3972
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3973 3973
         $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc
3974 3974
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3975 3975
         $resourceArray = $this->getDatabase()->makeArray($result);
@@ -4004,16 +4004,16 @@  discard block
 block discarded – undo
4004 4004
             return $this->tmpCache[__FUNCTION__][$cacheKey];
4005 4005
         }
4006 4006
 
4007
-        $published = ($published !== 'all') ? 'AND sc.published = ' . $published : '';
4008
-        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : '';
4007
+        $published = ($published !== 'all') ? 'AND sc.published = '.$published : '';
4008
+        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : '';
4009 4009
 
4010 4010
         if ($where != '') {
4011
-            $where = 'AND ' . $where;
4011
+            $where = 'AND '.$where;
4012 4012
         }
4013 4013
 
4014 4014
         // modify field names to use sc. table reference
4015
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4016
-        $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
4015
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4016
+        $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
4017 4017
 
4018 4018
         // get document groups for current user
4019 4019
         if ($docgrp = $this->getUserDocGroups()) {
@@ -4021,7 +4021,7 @@  discard block
 block discarded – undo
4021 4021
         }
4022 4022
 
4023 4023
         // build query
4024
-        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
4024
+        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
4025 4025
 
4026 4026
         $tblsc = $this->getFullTableName('site_content');
4027 4027
         $tbldg = $this->getFullTableName('document_groups');
@@ -4073,10 +4073,10 @@  discard block
 block discarded – undo
4073 4073
             return false;
4074 4074
         } else {
4075 4075
             // modify field names to use sc. table reference
4076
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4077
-            $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
4076
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4077
+            $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
4078 4078
             if ($where != '') {
4079
-                $where = 'AND ' . $where;
4079
+                $where = 'AND '.$where;
4080 4080
             }
4081 4081
 
4082 4082
             $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : '';
@@ -4087,13 +4087,13 @@  discard block
 block discarded – undo
4087 4087
                 $docgrp = implode(',', $docgrp);
4088 4088
             }
4089 4089
 
4090
-            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
4090
+            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
4091 4091
 
4092 4092
             $tblsc = $this->getFullTableName('site_content');
4093 4093
             $tbldg = $this->getFullTableName('document_groups');
4094 4094
 
4095 4095
             $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc
4096
-                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
4096
+                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',', $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
4097 4097
 
4098 4098
             $resourceArray = $this->getDatabase()->makeArray($result);
4099 4099
 
@@ -4198,12 +4198,12 @@  discard block
 block discarded – undo
4198 4198
             $tbldg = $this->getFullTableName("document_groups");
4199 4199
             $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : "";
4200 4200
             // modify field names to use sc. table reference
4201
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4201
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4202 4202
             // get document groups for current user
4203 4203
             if ($docgrp = $this->getUserDocGroups()) {
4204 4204
                 $docgrp = implode(",", $docgrp);
4205 4205
             }
4206
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
4206
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
4207 4207
             $result = $this->getDatabase()->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1);
4208 4208
             $pageInfo = $this->getDatabase()->getRow($result);
4209 4209
 
@@ -4250,7 +4250,7 @@  discard block
 block discarded – undo
4250 4250
     {
4251 4251
         if ($this->currentSnippet) {
4252 4252
             $tbl = $this->getFullTableName("site_snippets");
4253
-            $rs = $this->getDatabase()->select('id', $tbl, "name='" . $this->getDatabase()->escape($this->currentSnippet) . "'", '', 1);
4253
+            $rs = $this->getDatabase()->select('id', $tbl, "name='".$this->getDatabase()->escape($this->currentSnippet)."'", '', 1);
4254 4254
             if ($snippetId = $this->getDatabase()->getValue($rs)) {
4255 4255
                 return $snippetId;
4256 4256
             }
@@ -4277,7 +4277,7 @@  discard block
 block discarded – undo
4277 4277
      */
4278 4278
     public function clearCache($type = '', $report = false)
4279 4279
     {
4280
-        $cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
4280
+        $cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
4281 4281
         if (is_array($type)) {
4282 4282
             foreach ($type as $_) {
4283 4283
                 $this->clearCache($_, $report);
@@ -4289,10 +4289,10 @@  discard block
 block discarded – undo
4289 4289
             $sync->emptyCache();
4290 4290
         } elseif (preg_match('@^[1-9][0-9]*$@', $type)) {
4291 4291
             $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type;
4292
-            $file_name = "docid_" . $key . "_*.pageCache.php";
4293
-            $cache_path = $cache_dir . $file_name;
4292
+            $file_name = "docid_".$key."_*.pageCache.php";
4293
+            $cache_path = $cache_dir.$file_name;
4294 4294
             $files = glob($cache_path);
4295
-            $files[] = $cache_dir . "docid_" . $key . ".pageCache.php";
4295
+            $files[] = $cache_dir."docid_".$key.".pageCache.php";
4296 4296
             foreach ($files as $file) {
4297 4297
                 if (!is_file($file)) {
4298 4298
                     continue;
@@ -4300,7 +4300,7 @@  discard block
 block discarded – undo
4300 4300
                 unlink($file);
4301 4301
             }
4302 4302
         } else {
4303
-            $files = glob($cache_dir . '*');
4303
+            $files = glob($cache_dir.'*');
4304 4304
             foreach ($files as $file) {
4305 4305
                 $name = basename($file);
4306 4306
                 if (strpos($name, '.pageCache.php') === false) {
@@ -4369,7 +4369,7 @@  discard block
 block discarded – undo
4369 4369
                         $f_url_suffix = '/';
4370 4370
                     }
4371 4371
 
4372
-                    $alPath = !empty ($al['path']) ? $al['path'] . '/' : '';
4372
+                    $alPath = !empty ($al['path']) ? $al['path'].'/' : '';
4373 4373
 
4374 4374
                     if ($al && $al['alias']) {
4375 4375
                         $alias = $al['alias'];
@@ -4377,7 +4377,7 @@  discard block
 block discarded – undo
4377 4377
 
4378 4378
                 }
4379 4379
 
4380
-                $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix;
4380
+                $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix;
4381 4381
                 $url = "{$alias}{$args}";
4382 4382
             } else {
4383 4383
                 $url = "index.php?id={$id}{$args}";
@@ -4396,7 +4396,7 @@  discard block
 block discarded – undo
4396 4396
             }
4397 4397
 
4398 4398
             //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080)
4399
-            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host;
4399
+            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host;
4400 4400
         }
4401 4401
 
4402 4402
         //fix strictUrl by Bumkaka
@@ -4405,9 +4405,9 @@  discard block
 block discarded – undo
4405 4405
         }
4406 4406
 
4407 4407
         if ($this->config['xhtml_urls']) {
4408
-            $url = preg_replace("/&(?!amp;)/", "&amp;", $host . $virtualDir . $url);
4408
+            $url = preg_replace("/&(?!amp;)/", "&amp;", $host.$virtualDir.$url);
4409 4409
         } else {
4410
-            $url = $host . $virtualDir . $url;
4410
+            $url = $host.$virtualDir.$url;
4411 4411
         }
4412 4412
 
4413 4413
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -4431,21 +4431,21 @@  discard block
 block discarded – undo
4431 4431
         if (isset($this->aliasListing[$id])) {
4432 4432
             $out = $this->aliasListing[$id];
4433 4433
         } else {
4434
-            $q = $this->getDatabase()->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id);
4434
+            $q = $this->getDatabase()->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id);
4435 4435
             if ($this->getDatabase()->getRecordCount($q) == '1') {
4436 4436
                 $q = $this->getDatabase()->getRow($q);
4437 4437
                 $this->aliasListing[$id] = array(
4438
-                    'id' => (int)$q['id'],
4438
+                    'id' => (int) $q['id'],
4439 4439
                     'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'],
4440
-                    'parent' => (int)$q['parent'],
4441
-                    'isfolder' => (int)$q['isfolder'],
4440
+                    'parent' => (int) $q['parent'],
4441
+                    'isfolder' => (int) $q['isfolder'],
4442 4442
                 );
4443 4443
                 if ($this->aliasListing[$id]['parent'] > 0) {
4444 4444
                     //fix alias_path_usage
4445 4445
                     if ($this->config['use_alias_path'] == '1') {
4446 4446
                         //&& $tmp['path'] != '' - fix error slash with epty path
4447 4447
                         $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']);
4448
-                        $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : '');
4448
+                        $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : '');
4449 4449
                     } else {
4450 4450
                         $this->aliasListing[$id]['path'] = '';
4451 4451
                     }
@@ -4486,7 +4486,7 @@  discard block
 block discarded – undo
4486 4486
         $out = array();
4487 4487
         if (empty($this->version) || !is_array($this->version)) {
4488 4488
             //include for compatibility modx version < 1.0.10
4489
-            include MODX_MANAGER_PATH . "includes/version.inc.php";
4489
+            include MODX_MANAGER_PATH."includes/version.inc.php";
4490 4490
             $this->version = array();
4491 4491
             $this->version['version'] = isset($modx_version) ? $modx_version : '';
4492 4492
             $this->version['branch'] = isset($modx_branch) ? $modx_branch : '';
@@ -4508,18 +4508,18 @@  discard block
 block discarded – undo
4508 4508
     {
4509 4509
         if (isset ($this->snippetCache[$snippetName])) {
4510 4510
             $snippet = $this->snippetCache[$snippetName];
4511
-            $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4511
+            $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : '';
4512 4512
         } else { // not in cache so let's check the db
4513
-            $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->getDatabase()->escape($snippetName) . "'  AND ss.disabled=0;";
4513
+            $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->getDatabase()->escape($snippetName)."'  AND ss.disabled=0;";
4514 4514
             $result = $this->getDatabase()->query($sql);
4515 4515
             if ($this->getDatabase()->getRecordCount($result) == 1) {
4516 4516
                 $row = $this->getDatabase()->getRow($result);
4517 4517
                 $snippet = $this->snippetCache[$snippetName] = $row['snippet'];
4518 4518
                 $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties']));
4519
-                $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties);
4519
+                $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties);
4520 4520
             } else {
4521 4521
                 $snippet = $this->snippetCache[$snippetName] = "return false;";
4522
-                $properties = $this->snippetCache[$snippetName . "Props"] = '';
4522
+                $properties = $this->snippetCache[$snippetName."Props"] = '';
4523 4523
             }
4524 4524
         }
4525 4525
         // load default params/properties
@@ -4619,8 +4619,8 @@  discard block
 block discarded – undo
4619 4619
             }
4620 4620
             if (strpos($tpl, $s) !== false) {
4621 4621
                 $tpl = str_replace($s, $value, $tpl);
4622
-            } elseif($this->debug) {
4623
-                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2);
4622
+            } elseif ($this->debug) {
4623
+                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2);
4624 4624
             }
4625 4625
         }
4626 4626
 
@@ -4669,7 +4669,7 @@  discard block
 block discarded – undo
4669 4669
             case 'CODE':
4670 4670
                 break;
4671 4671
             case 'FILE':
4672
-                $template = file_get_contents(MODX_BASE_PATH . $template);
4672
+                $template = file_get_contents(MODX_BASE_PATH.$template);
4673 4673
                 break;
4674 4674
             case 'CHUNK':
4675 4675
                 $template = $this->getChunk($template);
@@ -4702,7 +4702,7 @@  discard block
 block discarded – undo
4702 4702
         if ($mode !== 'formatOnly' && empty($timestamp)) {
4703 4703
             return '-';
4704 4704
         }
4705
-        $timestamp = (int)$timestamp;
4705
+        $timestamp = (int) $timestamp;
4706 4706
 
4707 4707
         switch ($this->config['datetime_format']) {
4708 4708
             case 'YYYY/mm/dd':
@@ -4722,7 +4722,7 @@  discard block
 block discarded – undo
4722 4722
         }
4723 4723
 
4724 4724
         if (empty($mode)) {
4725
-            $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp);
4725
+            $strTime = strftime($dateFormat." %H:%M:%S", $timestamp);
4726 4726
         } elseif ($mode == 'dateOnly') {
4727 4727
             $strTime = strftime($dateFormat, $timestamp);
4728 4728
         } elseif ($mode == 'formatOnly') {
@@ -4776,7 +4776,7 @@  discard block
 block discarded – undo
4776 4776
             $S = 0;
4777 4777
         }
4778 4778
         $timeStamp = mktime($H, $M, $S, $m, $d, $Y);
4779
-        $timeStamp = (int)$timeStamp;
4779
+        $timeStamp = (int) $timeStamp;
4780 4780
         return $timeStamp;
4781 4781
     }
4782 4782
 
@@ -4818,7 +4818,7 @@  discard block
 block discarded – undo
4818 4818
                     if ($v === 'value') {
4819 4819
                         unset($_[$i]);
4820 4820
                     } else {
4821
-                        $_[$i] = 'tv.' . $v;
4821
+                        $_[$i] = 'tv.'.$v;
4822 4822
                     }
4823 4823
                 }
4824 4824
                 $fields = implode(',', $_);
@@ -4827,12 +4827,12 @@  discard block
 block discarded – undo
4827 4827
             }
4828 4828
 
4829 4829
             if ($tvsort != '') {
4830
-                $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4830
+                $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4831 4831
             }
4832 4832
             if ($tvidnames == "*") {
4833 4833
                 $query = "tv.id<>0";
4834 4834
             } else {
4835
-                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')";
4835
+                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')";
4836 4836
             }
4837 4837
 
4838 4838
             $this->getUserDocGroups();
@@ -4976,7 +4976,7 @@  discard block
 block discarded – undo
4976 4976
             return $this->tmpCache[__FUNCTION__][$cacheKey];
4977 4977
         }
4978 4978
 
4979
-        if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) {
4979
+        if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) {
4980 4980
             return false;
4981 4981
         } else {
4982 4982
 
@@ -4994,23 +4994,23 @@  discard block
 block discarded – undo
4994 4994
             }
4995 4995
 
4996 4996
             // get user defined template variables
4997
-            $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4998
-            $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4997
+            $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4998
+            $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4999 4999
 
5000 5000
             if ($idnames == '*') {
5001 5001
                 $query = 'tv.id<>0';
5002 5002
             } else {
5003
-                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')";
5003
+                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')";
5004 5004
             }
5005 5005
 
5006
-            $rs = $this->getDatabase()->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv
5007
-                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id
5008
-                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
5006
+            $rs = $this->getDatabase()->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv
5007
+                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id
5008
+                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
5009 5009
 
5010 5010
             $result = $this->getDatabase()->makeArray($rs);
5011 5011
 
5012 5012
             // get default/built-in template variables
5013
-            if(is_array($docRow)){
5013
+            if (is_array($docRow)) {
5014 5014
                 ksort($docRow);
5015 5015
 
5016 5016
                 foreach ($docRow as $key => $value) {
@@ -5048,13 +5048,13 @@  discard block
 block discarded – undo
5048 5048
      */
5049 5049
     public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '')
5050 5050
     {
5051
-        if (is_array($idnames) && empty($idnames) ) {
5051
+        if (is_array($idnames) && empty($idnames)) {
5052 5052
             return false;
5053 5053
         } else {
5054 5054
             $output = array();
5055 5055
             $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames);
5056 5056
 
5057
-            $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier;
5057
+            $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier;
5058 5058
             // remove sort for speed
5059 5059
             $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');
5060 5060
 
@@ -5084,7 +5084,7 @@  discard block
 block discarded – undo
5084 5084
      */
5085 5085
     public function getFullTableName($tbl)
5086 5086
     {
5087
-        return $this->getDatabase()->config['dbase'] . ".`" . $this->getDatabase()->config['table_prefix'] . $tbl . "`";
5087
+        return $this->getDatabase()->config['dbase'].".`".$this->getDatabase()->config['table_prefix'].$tbl."`";
5088 5088
     }
5089 5089
 
5090 5090
     /**
@@ -5163,7 +5163,7 @@  discard block
 block discarded – undo
5163 5163
     public function getCachePath()
5164 5164
     {
5165 5165
         global $base_url;
5166
-        $pth = $base_url . $this->getCacheFolder();
5166
+        $pth = $base_url.$this->getCacheFolder();
5167 5167
         return $pth;
5168 5168
     }
5169 5169
 
@@ -5215,8 +5215,8 @@  discard block
 block discarded – undo
5215 5215
         $out = false;
5216 5216
 
5217 5217
         if (!empty($context)) {
5218
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5219
-                $out = $_SESSION[$context . 'InternalKey'];
5218
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
5219
+                $out = $_SESSION[$context.'InternalKey'];
5220 5220
             }
5221 5221
         } else {
5222 5222
             switch (true) {
@@ -5244,8 +5244,8 @@  discard block
 block discarded – undo
5244 5244
         $out = false;
5245 5245
 
5246 5246
         if (!empty($context)) {
5247
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5248
-                $out = $_SESSION[$context . 'Shortname'];
5247
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
5248
+                $out = $_SESSION[$context.'Shortname'];
5249 5249
             }
5250 5250
         } else {
5251 5251
             switch (true) {
@@ -5316,8 +5316,8 @@  discard block
 block discarded – undo
5316 5316
      */
5317 5317
     public function getWebUserInfo($uid)
5318 5318
     {
5319
-        $rs = $this->getDatabase()->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu
5320
-                INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5319
+        $rs = $this->getDatabase()->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu
5320
+                INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5321 5321
         if ($row = $this->getDatabase()->getRow($rs)) {
5322 5322
             if (!isset($row['usertype']) or !$row["usertype"]) {
5323 5323
                 $row["usertype"] = "web";
@@ -5353,7 +5353,7 @@  discard block
 block discarded – undo
5353 5353
         } else if (is_array($dg)) {
5354 5354
             // resolve ids to names
5355 5355
             $dgn = array();
5356
-            $ds = $this->getDatabase()->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")");
5356
+            $ds = $this->getDatabase()->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")");
5357 5357
             while ($row = $this->getDatabase()->getRow($ds)) {
5358 5358
                 $dgn[] = $row['name'];
5359 5359
             }
@@ -5381,7 +5381,7 @@  discard block
 block discarded – undo
5381 5381
         $rt = false;
5382 5382
         if ($_SESSION["webValidated"] == 1) {
5383 5383
             $tbl = $this->getFullTableName("web_users");
5384
-            $ds = $this->getDatabase()->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'");
5384
+            $ds = $this->getDatabase()->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'");
5385 5385
             if ($row = $this->getDatabase()->getRow($ds)) {
5386 5386
                 if ($row["password"] == md5($oldPwd)) {
5387 5387
                     if (strlen($newPwd) < 6) {
@@ -5391,7 +5391,7 @@  discard block
 block discarded – undo
5391 5391
                     } else {
5392 5392
                         $this->getDatabase()->update(array(
5393 5393
                             'password' => $this->getDatabase()->escape($newPwd),
5394
-                        ), $tbl, "id='" . $this->getLoginUserID() . "'");
5394
+                        ), $tbl, "id='".$this->getLoginUserID()."'");
5395 5395
                         // invoke OnWebChangePassword event
5396 5396
                         $this->invokeEvent("OnWebChangePassword", array(
5397 5397
                             "userid" => $row["id"],
@@ -5422,8 +5422,8 @@  discard block
 block discarded – undo
5422 5422
         // check cache
5423 5423
         $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false;
5424 5424
         if (!is_array($grpNames)) {
5425
-            $rs = $this->getDatabase()->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn
5426
-                    INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'");
5425
+            $rs = $this->getDatabase()->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn
5426
+                    INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'");
5427 5427
             $grpNames = $this->getDatabase()->getColumn("name", $rs);
5428 5428
             // save to cache
5429 5429
             $_SESSION['webUserGroupNames'] = $grpNames;
@@ -5456,7 +5456,7 @@  discard block
 block discarded – undo
5456 5456
         if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) {
5457 5457
             $this->sjscripts[$nextpos] = $src;
5458 5458
         } else {
5459
-            $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>';
5459
+            $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>';
5460 5460
         }
5461 5461
     }
5462 5462
 
@@ -5535,7 +5535,7 @@  discard block
 block discarded – undo
5535 5535
         }
5536 5536
 
5537 5537
         if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) {
5538
-            $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>';
5538
+            $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>';
5539 5539
         }
5540 5540
         if ($startup) {
5541 5541
             $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1;
@@ -5682,7 +5682,7 @@  discard block
 block discarded – undo
5682 5682
                 $eventtime = $this->getMicroTime() - $eventtime;
5683 5683
                 $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000);
5684 5684
                 foreach ($parameter as $k => $v) {
5685
-                    $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>';
5685
+                    $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>';
5686 5686
                 }
5687 5687
                 $this->pluginsCode .= '</fieldset><br />';
5688 5688
                 $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime;
@@ -5710,13 +5710,13 @@  discard block
 block discarded – undo
5710 5710
         $plugin = array();
5711 5711
         if (isset ($this->pluginCache[$pluginName])) {
5712 5712
             $pluginCode = $this->pluginCache[$pluginName];
5713
-            $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : '';
5713
+            $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : '';
5714 5714
         } else {
5715 5715
             $pluginName = $this->getDatabase()->escape($pluginName);
5716 5716
             $result = $this->getDatabase()->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0");
5717 5717
             if ($row = $this->getDatabase()->getRow($result)) {
5718 5718
                 $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode'];
5719
-                $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties'];
5719
+                $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties'];
5720 5720
             } else {
5721 5721
                 $pluginCode = $this->pluginCache[$pluginName] = "return false;";
5722 5722
                 $pluginProperties = '';
@@ -5740,7 +5740,7 @@  discard block
 block discarded – undo
5740 5740
     {
5741 5741
         $property = array();
5742 5742
 
5743
-        if(\is_scalar($propertyString)) {
5743
+        if (\is_scalar($propertyString)) {
5744 5744
             $propertyString = trim($propertyString);
5745 5745
             $propertyString = str_replace('{}', '', $propertyString);
5746 5746
             $propertyString = str_replace('} {', ',', $propertyString);
@@ -5794,7 +5794,7 @@  discard block
 block discarded – undo
5794 5794
                 }
5795 5795
             }
5796 5796
         }
5797
-        elseif(\is_array($propertyString)) {
5797
+        elseif (\is_array($propertyString)) {
5798 5798
             $property = $propertyString;
5799 5799
         }
5800 5800
         if (!empty($elementName) && !empty($elementType)) {
@@ -5825,7 +5825,7 @@  discard block
 block discarded – undo
5825 5825
     public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)
5826 5826
     {
5827 5827
         $params = array();
5828
-        $fullpath = $element_dir . '/' . $filename;
5828
+        $fullpath = $element_dir.'/'.$filename;
5829 5829
         if (is_readable($fullpath)) {
5830 5830
             $tpl = @fopen($fullpath, "r");
5831 5831
             if ($tpl) {
@@ -5992,8 +5992,8 @@  discard block
 block discarded – undo
5992 5992
         $ph = array('site_url' => MODX_SITE_URL);
5993 5993
         $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";
5994 5994
         $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';
5995
-        $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';
5996
-        $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';
5995
+        $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';
5996
+        $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';
5997 5997
         foreach ($parsed as $key => $val) {
5998 5998
             if (is_array($val)) {
5999 5999
                 foreach ($val as $key2 => $val2) {
@@ -6002,7 +6002,7 @@  discard block
 block discarded – undo
6002 6002
                         $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2);
6003 6003
                     }
6004 6004
                     if (preg_match($regexEmail, $val2, $url)) {
6005
-                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);
6005
+                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);
6006 6006
                     }
6007 6007
                     $parsed[$key][$key2] = $val2;
6008 6008
                 }
@@ -6012,7 +6012,7 @@  discard block
 block discarded – undo
6012 6012
                     $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val);
6013 6013
                 }
6014 6014
                 if (preg_match($regexEmail, $val, $url)) {
6015
-                    $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);
6015
+                    $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);
6016 6016
                 }
6017 6017
                 $parsed[$key] = $val;
6018 6018
             }
@@ -6026,32 +6026,32 @@  discard block
 block discarded – undo
6026 6026
         );
6027 6027
 
6028 6028
         $nl = "\n";
6029
-        $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';
6030
-        $list .= '<p>' . $nl;
6031
-        $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';
6032
-        $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';
6033
-        $list .= '</p><br/>' . $nl;
6034
-        $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';
6035
-        $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';
6036
-        $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';
6037
-        $list .= '<br/>' . $nl;
6029
+        $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';
6030
+        $list .= '<p>'.$nl;
6031
+        $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';
6032
+        $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';
6033
+        $list .= '</p><br/>'.$nl;
6034
+        $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';
6035
+        $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';
6036
+        $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';
6037
+        $list .= '<br/>'.$nl;
6038 6038
         $first = true;
6039 6039
         foreach ($arrayParams as $param => $label) {
6040 6040
             if (isset($parsed[$param])) {
6041 6041
                 if ($first) {
6042
-                    $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;
6043
-                    $list .= '<ul class="docBlockList">' . $nl;
6042
+                    $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;
6043
+                    $list .= '<ul class="docBlockList">'.$nl;
6044 6044
                     $first = false;
6045 6045
                 }
6046
-                $list .= '    <li><strong>' . $label . '</strong>' . $nl;
6047
-                $list .= '        <ul>' . $nl;
6046
+                $list .= '    <li><strong>'.$label.'</strong>'.$nl;
6047
+                $list .= '        <ul>'.$nl;
6048 6048
                 foreach ($parsed[$param] as $val) {
6049
-                    $list .= '            <li>' . $val . '</li>' . $nl;
6049
+                    $list .= '            <li>'.$val.'</li>'.$nl;
6050 6050
                 }
6051
-                $list .= '        </ul></li>' . $nl;
6051
+                $list .= '        </ul></li>'.$nl;
6052 6052
             }
6053 6053
         }
6054
-        $list .= !$first ? '</ul>' . $nl : '';
6054
+        $list .= !$first ? '</ul>'.$nl : '';
6055 6055
 
6056 6056
         return $list;
6057 6057
     }
@@ -6126,8 +6126,8 @@  discard block
 block discarded – undo
6126 6126
      */
6127 6127
     public function addSnippet($name, $phpCode, $namespace = '#', array $defaultParams = array())
6128 6128
     {
6129
-        $this->snippetCache[$namespace . $name] = $phpCode;
6130
-        $this->snippetCache[$namespace . $name . 'Props'] = $defaultParams;
6129
+        $this->snippetCache[$namespace.$name] = $phpCode;
6130
+        $this->snippetCache[$namespace.$name.'Props'] = $defaultParams;
6131 6131
     }
6132 6132
 
6133 6133
     /**
@@ -6135,7 +6135,7 @@  discard block
 block discarded – undo
6135 6135
      */
6136 6136
     public function addChunk($name, $text, $namespace = '#')
6137 6137
     {
6138
-        $this->chunkCache[$namespace . $name] = $text;
6138
+        $this->chunkCache[$namespace.$name] = $text;
6139 6139
     }
6140 6140
 
6141 6141
     /**
@@ -6145,7 +6145,7 @@  discard block
 block discarded – undo
6145 6145
     {
6146 6146
         $out = array();
6147 6147
 
6148
-        if (! is_dir($scanPath) || empty($ext)) {
6148
+        if (!is_dir($scanPath) || empty($ext)) {
6149 6149
             return $out;
6150 6150
         }
6151 6151
         $iterator = new \RecursiveIteratorIterator(
@@ -6157,22 +6157,22 @@  discard block
 block discarded – undo
6157 6157
              * @var \SplFileInfo $item
6158 6158
              */
6159 6159
             if ($item->isFile() && $item->isReadable() && \in_array($item->getExtension(), $ext)) {
6160
-                $name = $item->getBasename('.' . $item->getExtension());
6160
+                $name = $item->getBasename('.'.$item->getExtension());
6161 6161
                 $path = ltrim(str_replace(
6162 6162
                     array(rtrim($scanPath, '//'), '/'),
6163 6163
                     array('', '\\'),
6164
-                    $item->getPath() . '/'
6164
+                    $item->getPath().'/'
6165 6165
                 ), '\\');
6166 6166
 
6167 6167
                 if (!empty($path)) {
6168
-                    $name = $path . $name;
6168
+                    $name = $path.$name;
6169 6169
                 }
6170 6170
                 switch ($type) {
6171 6171
                     case 'chunk':
6172 6172
                         $out[$name] = file_get_contents($item->getRealPath());
6173 6173
                         break;
6174 6174
                     case 'snippet':
6175
-                        $out[$name] = "return require '" . $item->getRealPath() . "';";
6175
+                        $out[$name] = "return require '".$item->getRealPath()."';";
6176 6176
                         break;
6177 6177
                     default:
6178 6178
                         throw new \Exception;
@@ -6216,7 +6216,7 @@  discard block
 block discarded – undo
6216 6216
         }
6217 6217
 
6218 6218
         if (!$isSafe) {
6219
-            $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);
6219
+            $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);
6220 6220
             $title = sprintf('Unknown eval was executed (%s)', $this->getPhpCompat()->htmlspecialchars(substr(trim($phpcode), 0, 50)));
6221 6221
             $this->messageQuit($title, '', true, '', '', 'Parser', $msg);
6222 6222
             return;
@@ -6230,7 +6230,7 @@  discard block
 block discarded – undo
6230 6230
             return 'array()';
6231 6231
         }
6232 6232
 
6233
-        $output = $echo . $return;
6233
+        $output = $echo.$return;
6234 6234
         modx_sanitize_gpc($output);
6235 6235
         return $this->getPhpCompat()->htmlspecialchars($output); // Maybe, all html tags are dangerous
6236 6236
     }
@@ -6248,8 +6248,8 @@  discard block
 block discarded – undo
6248 6248
 
6249 6249
         $safe = explode(',', $safe_functions);
6250 6250
 
6251
-        $phpcode = rtrim($phpcode, ';') . ';';
6252
-        $tokens = token_get_all('<?php ' . $phpcode);
6251
+        $phpcode = rtrim($phpcode, ';').';';
6252
+        $tokens = token_get_all('<?php '.$phpcode);
6253 6253
         foreach ($tokens as $i => $token) {
6254 6254
             if (!is_array($token)) {
6255 6255
                 continue;
@@ -6285,7 +6285,7 @@  discard block
 block discarded – undo
6285 6285
     public function atBindFileContent($str = '')
6286 6286
     {
6287 6287
 
6288
-        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', '');
6288
+        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', '');
6289 6289
 
6290 6290
         if (stripos($str, '@FILE') !== 0) {
6291 6291
             return $str;
@@ -6308,7 +6308,7 @@  discard block
 block discarded – undo
6308 6308
         $errorMsg = sprintf("Could not retrieve string '%s'.", $str);
6309 6309
 
6310 6310
         foreach ($search_path as $path) {
6311
-            $file_path = MODX_BASE_PATH . $path . $str;
6311
+            $file_path = MODX_BASE_PATH.$path.$str;
6312 6312
             if (strpos($file_path, MODX_MANAGER_PATH) === 0) {
6313 6313
                 return $errorMsg;
6314 6314
             } elseif (is_file($file_path)) {
@@ -6322,7 +6322,7 @@  discard block
 block discarded – undo
6322 6322
             return $errorMsg;
6323 6323
         }
6324 6324
 
6325
-        $content = (string)file_get_contents($file_path);
6325
+        $content = (string) file_get_contents($file_path);
6326 6326
         if ($content === false) {
6327 6327
             return $errorMsg;
6328 6328
         }
@@ -6431,22 +6431,22 @@  discard block
 block discarded – undo
6431 6431
 
6432 6432
         $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
6433 6433
         $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
6434
-        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI'];
6434
+        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI'];
6435 6435
         $request_uri = $this->getPhpCompat()->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);
6436 6436
         $ua = $this->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);
6437 6437
         $referer = $this->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);
6438 6438
         if ($is_error) {
6439 6439
             $str = '<h2 style="color:red">&laquo; Evo Parse Error &raquo;</h2>';
6440 6440
             if ($msg != 'PHP Parse Error') {
6441
-                $str .= '<h3 style="color:red">' . $msg . '</h3>';
6441
+                $str .= '<h3 style="color:red">'.$msg.'</h3>';
6442 6442
             }
6443 6443
         } else {
6444 6444
             $str = '<h2 style="color:#003399">&laquo; Evo Debug/ stop message &raquo;</h2>';
6445
-            $str .= '<h3 style="color:#003399">' . $msg . '</h3>';
6445
+            $str .= '<h3 style="color:#003399">'.$msg.'</h3>';
6446 6446
         }
6447 6447
 
6448 6448
         if (!empty ($query)) {
6449
-            $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>';
6449
+            $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>';
6450 6450
         }
6451 6451
 
6452 6452
         $errortype = array(
@@ -6469,13 +6469,13 @@  discard block
 block discarded – undo
6469 6469
 
6470 6470
         if (!empty($nr) || !empty($file)) {
6471 6471
             if ($text != '') {
6472
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';
6472
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';
6473 6473
             }
6474 6474
             if ($output != '') {
6475
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';
6475
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';
6476 6476
             }
6477 6477
             if ($nr !== '') {
6478
-                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]");
6478
+                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]");
6479 6479
             }
6480 6480
             if ($file) {
6481 6481
                 $table[] = array('File', $file);
@@ -6495,7 +6495,7 @@  discard block
 block discarded – undo
6495 6495
         }
6496 6496
 
6497 6497
         if (!empty($this->event->activePlugin)) {
6498
-            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')');
6498
+            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')');
6499 6499
         }
6500 6500
 
6501 6501
         $str .= $MakeTable->create($table, array('Error information', ''));
@@ -6505,17 +6505,17 @@  discard block
 block discarded – undo
6505 6505
         $table[] = array('REQUEST_URI', $request_uri);
6506 6506
 
6507 6507
         if ($this->getManagerApi()->action) {
6508
-            include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
6508
+            include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
6509 6509
             global $action_list;
6510 6510
             $actionName = (isset($action_list[$this->getManagerApi()->action])) ? " - {$action_list[$this->getManagerApi()->action]}" : '';
6511 6511
 
6512
-            $table[] = array('Manager action', $this->getManagerApi()->action . $actionName);
6512
+            $table[] = array('Manager action', $this->getManagerApi()->action.$actionName);
6513 6513
         }
6514 6514
 
6515 6515
         if (preg_match('@^[0-9]+@', $this->documentIdentifier)) {
6516 6516
             $resource = $this->getDocumentObject('id', $this->documentIdentifier);
6517 6517
             $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');
6518
-            $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>');
6518
+            $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>');
6519 6519
         }
6520 6520
         $table[] = array('Referer', $referer);
6521 6521
         $table[] = array('User Agent', $ua);
@@ -6536,7 +6536,7 @@  discard block
 block discarded – undo
6536 6536
 
6537 6537
         $mem = memory_get_peak_usage(true);
6538 6538
         $total_mem = $mem - $this->mstart;
6539
-        $total_mem = ($total_mem / 1024 / 1024) . ' mb';
6539
+        $total_mem = ($total_mem / 1024 / 1024).' mb';
6540 6540
 
6541 6541
         $queryTime = $this->queryTime;
6542 6542
         $phpTime = $totalTime - $queryTime;
@@ -6557,18 +6557,18 @@  discard block
 block discarded – undo
6557 6557
         $str .= $this->get_backtrace(debug_backtrace());
6558 6558
         // Log error
6559 6559
         if (!empty($this->currentSnippet)) {
6560
-            $source = 'Snippet - ' . $this->currentSnippet;
6560
+            $source = 'Snippet - '.$this->currentSnippet;
6561 6561
         } elseif (!empty($this->event->activePlugin)) {
6562
-            $source = 'Plugin - ' . $this->event->activePlugin;
6562
+            $source = 'Plugin - '.$this->event->activePlugin;
6563 6563
         } elseif ($source !== '') {
6564
-            $source = 'Parser - ' . $source;
6564
+            $source = 'Parser - '.$source;
6565 6565
         } elseif ($query !== '') {
6566 6566
             $source = 'SQL Query';
6567 6567
         } else {
6568 6568
             $source = 'Parser';
6569 6569
         }
6570 6570
         if ($msg) {
6571
-            $source .= ' / ' . $msg;
6571
+            $source .= ' / '.$msg;
6572 6572
         }
6573 6573
         if (isset($actionName) && !empty($actionName)) {
6574 6574
             $source .= $actionName;
@@ -6600,12 +6600,12 @@  discard block
 block discarded – undo
6600 6600
 
6601 6601
         // Display error
6602 6602
         if (isset($_SESSION['mgrValidated'])) {
6603
-            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>
6603
+            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>
6604 6604
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6605
-                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />
6605
+                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />
6606 6606
                  <style type="text/css">body { padding:10px; } td {font:inherit;}</style>
6607 6607
                  </head><body>
6608
-                 ' . $str . '</body></html>';
6608
+                 ' . $str.'</body></html>';
6609 6609
 
6610 6610
         } else {
6611 6611
             echo 'Error';
@@ -6640,7 +6640,7 @@  discard block
 block discarded – undo
6640 6640
             switch ($val['type']) {
6641 6641
                 case '->':
6642 6642
                 case '::':
6643
-                    $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];
6643
+                    $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];
6644 6644
                     break;
6645 6645
                 default:
6646 6646
                     $functionName = $val['function'];
@@ -6650,7 +6650,7 @@  discard block
 block discarded – undo
6650 6650
             $args = array_pad(array(), $_, '$var');
6651 6651
             $args = implode(", ", $args);
6652 6652
             $modx = &$this;
6653
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6653
+            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) {
6654 6654
                 $arg = $val['args'][$tmp - 1];
6655 6655
                 switch (true) {
6656 6656
                     case is_null($arg): {
@@ -6662,7 +6662,7 @@  discard block
 block discarded – undo
6662 6662
                         break;
6663 6663
                     }
6664 6664
                     case is_scalar($arg): {
6665
-                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->getPhpCompat()->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'");
6665
+                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->getPhpCompat()->htmlspecialchars(str_replace("'", "\\'", $arg))."'");
6666 6666
                         break;
6667 6667
                     }
6668 6668
                     case is_bool($arg): {
@@ -6670,23 +6670,23 @@  discard block
 block discarded – undo
6670 6670
                         break;
6671 6671
                     }
6672 6672
                     case is_array($arg): {
6673
-                        $out = 'array $var' . $tmp;
6673
+                        $out = 'array $var'.$tmp;
6674 6674
                         break;
6675 6675
                     }
6676 6676
                     case is_object($arg): {
6677
-                        $out = get_class($arg) . ' $var' . $tmp;
6677
+                        $out = get_class($arg).' $var'.$tmp;
6678 6678
                         break;
6679 6679
                     }
6680 6680
                     default: {
6681
-                        $out = '$var' . $tmp;
6681
+                        $out = '$var'.$tmp;
6682 6682
                     }
6683 6683
                 }
6684 6684
                 $tmp++;
6685 6685
                 return $out;
6686 6686
             }, $args);
6687 6687
             $line = array(
6688
-                "<strong>" . $functionName . "</strong>(" . $args . ")",
6689
-                $path . " on line " . $val['line']
6688
+                "<strong>".$functionName."</strong>(".$args.")",
6689
+                $path." on line ".$val['line']
6690 6690
             );
6691 6691
             $table[] = array(implode("<br />", $line));
6692 6692
         }
@@ -6727,7 +6727,7 @@  discard block
 block discarded – undo
6727 6727
             $alias = strip_tags($alias); // strip HTML
6728 6728
             $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters
6729 6729
             $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash
6730
-            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one
6730
+            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one
6731 6731
             $alias = trim($alias, '-'); // trim excess
6732 6732
             return $alias;
6733 6733
         }
@@ -6743,7 +6743,7 @@  discard block
 block discarded – undo
6743 6743
         $precisions = count($sizes) - 1;
6744 6744
         foreach ($sizes as $unit => $bytes) {
6745 6745
             if ($size >= $bytes) {
6746
-                return number_format($size / $bytes, $precisions) . ' ' . $unit;
6746
+                return number_format($size / $bytes, $precisions).' '.$unit;
6747 6747
             }
6748 6748
             $precisions--;
6749 6749
         }
@@ -6847,10 +6847,10 @@  discard block
 block discarded – undo
6847 6847
 
6848 6848
         if (strpos($str, MODX_MANAGER_PATH) === 0) {
6849 6849
             return false;
6850
-        } elseif (is_file(MODX_BASE_PATH . $str)) {
6851
-            $file_path = MODX_BASE_PATH . $str;
6852
-        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) {
6853
-            $file_path = MODX_BASE_PATH . $tpl_dir . $str;
6850
+        } elseif (is_file(MODX_BASE_PATH.$str)) {
6851
+            $file_path = MODX_BASE_PATH.$str;
6852
+        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) {
6853
+            $file_path = MODX_BASE_PATH.$tpl_dir.$str;
6854 6854
         } else {
6855 6855
             return false;
6856 6856
         }
@@ -6974,7 +6974,7 @@  discard block
 block discarded – undo
6974 6974
             $title = 'no title';
6975 6975
         }
6976 6976
         if (is_array($msg)) {
6977
-            $msg = '<pre>' . print_r($msg, true) . '</pre>';
6977
+            $msg = '<pre>'.print_r($msg, true).'</pre>';
6978 6978
         } elseif ($msg === '') {
6979 6979
             $msg = $_SERVER['REQUEST_URI'];
6980 6980
         }
Please login to merge, or discard this patch.
manager/includes/src/Cache.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         if (isset($this->aliases[$id])) {
98 98
             if ($this->aliasVisible[$id] == 1) {
99 99
                 if ($path != '') {
100
-                    $path = $this->aliases[$id] . '/' . $path;
100
+                    $path = $this->aliases[$id].'/'.$path;
101 101
                 } else {
102 102
                     $path = $this->aliases[$id];
103 103
                 }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
             $modx->messageQuit("Cache path not set.");
122 122
         }
123 123
 
124
-        $files = glob(realpath($this->cachePath) . '/*.pageCache.php');
124
+        $files = glob(realpath($this->cachePath).'/*.pageCache.php');
125 125
         $filesincache = count($files);
126 126
         $deletedfiles = array();
127 127
         while ($file = array_shift($files)) {
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
                 if (isset($opcache)) {
157 157
                     echo '<p>Opcache empty.</p>';
158 158
                 }
159
-                echo '<p>' . $_lang['cache_files_deleted'] . '</p><ul>';
159
+                echo '<p>'.$_lang['cache_files_deleted'].'</p><ul>';
160 160
                 foreach ($deletedfiles as $deletedfile) {
161
-                    echo '<li>' . $deletedfile . '</li>';
161
+                    echo '<li>'.$deletedfile.'</li>';
162 162
                 }
163 163
                 echo '</ul>';
164 164
             }
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 
178 178
 
179 179
         // write the file
180
-        $content = '<?php' . "\n";
181
-        $content .= '$recent_update=\'' . $this->request_time . '\';' . "\n";
182
-        $content .= '$cacheRefreshTime=\'' . $cacheRefreshTime . '\';' . "\n";
180
+        $content = '<?php'."\n";
181
+        $content .= '$recent_update=\''.$this->request_time.'\';'."\n";
182
+        $content .= '$cacheRefreshTime=\''.$cacheRefreshTime.'\';'."\n";
183 183
 
184
-        $filename = $this->cachePath . '/sitePublishing.idx.php';
184
+        $filename = $this->cachePath.'/sitePublishing.idx.php';
185 185
         if (!$handle = fopen($filename, 'w')) {
186 186
             exit("Cannot open file ({$filename}");
187 187
         }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         $timesArr = array();
206 206
 
207 207
         $result = $modx->getDatabase()->select('MIN(pub_date) AS minpub', '[+prefix+]site_content',
208
-            'pub_date>' . $this->request_time);
208
+            'pub_date>'.$this->request_time);
209 209
         if (!$result) {
210 210
             echo "Couldn't determine next publish event!";
211 211
         }
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
         }
217 217
 
218 218
         $result = $modx->getDatabase()->select('MIN(unpub_date) AS minunpub', '[+prefix+]site_content',
219
-            'unpub_date>' . $this->request_time);
219
+            'unpub_date>'.$this->request_time);
220 220
         if (!$result) {
221 221
             echo "Couldn't determine next unpublish event!";
222 222
         }
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
         $config = array();
256 256
         $content .= '$c=&$this->config;';
257 257
         while (list($key, $value) = $modx->getDatabase()->getRow($rs, 'num')) {
258
-            $content .= '$c[\'' . $key . '\']="' . $this->escapeDoubleQuotes($value) . '";';
258
+            $content .= '$c[\''.$key.'\']="'.$this->escapeDoubleQuotes($value).'";';
259 259
             $config[$key] = $value;
260 260
         }
261 261
 
@@ -293,23 +293,23 @@  discard block
 block discarded – undo
293 293
             $docid = $doc['id'];
294 294
             if ($use_alias_path) {
295 295
                 $tmpPath = $this->getParents($doc['parent']);
296
-                $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '') . $doc['alias'];
296
+                $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '').$doc['alias'];
297 297
                 $key = $alias;
298 298
             } else {
299 299
                 $key = $doc['alias'];
300 300
             }
301 301
 
302 302
             $doc['path'] = $tmpPath;
303
-            $content .= '$a[' . $docid . ']=array(\'id\'=>' . $docid . ',\'alias\'=>\'' . $doc['alias'] . '\',\'path\'=>\'' . $doc['path'] . '\',\'parent\'=>' . $doc['parent'] . ',\'isfolder\'=>' . $doc['isfolder'] . ',\'alias_visible\'=>' . $doc['alias_visible'] . ');';
304
-            $content .= '$d[\'' . $key . '\']=' . $docid . ';';
305
-            $content .= '$m[]=array(' . $doc['parent'] . '=>' . $docid . ');';
303
+            $content .= '$a['.$docid.']=array(\'id\'=>'.$docid.',\'alias\'=>\''.$doc['alias'].'\',\'path\'=>\''.$doc['path'].'\',\'parent\'=>'.$doc['parent'].',\'isfolder\'=>'.$doc['isfolder'].',\'alias_visible\'=>'.$doc['alias_visible'].');';
304
+            $content .= '$d[\''.$key.'\']='.$docid.';';
305
+            $content .= '$m[]=array('.$doc['parent'].'=>'.$docid.');';
306 306
         }
307 307
 
308 308
         // get content types
309 309
         $rs = $modx->getDatabase()->select('id, contentType', '[+prefix+]site_content', "contentType!='text/html'");
310 310
         $content .= '$c=&$this->contentTypes;';
311 311
         while ($doc = $modx->getDatabase()->getRow($rs)) {
312
-            $content .= '$c[\'' . $doc['id'] . '\']=\'' . $doc['contentType'] . '\';';
312
+            $content .= '$c[\''.$doc['id'].'\']=\''.$doc['contentType'].'\';';
313 313
         }
314 314
 
315 315
         // WRITE Chunks to cache file
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
             if ($modx->config['minifyphp_incache']) {
320 320
                 $doc['snippet'] = $this->php_strip_whitespace($doc['snippet']);
321 321
             }
322
-            $content .= '$c[\'' . $doc['name'] . '\']=\'' . ($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])) . '\';';
322
+            $content .= '$c[\''.$doc['name'].'\']=\''.($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])).'\';';
323 323
         }
324 324
 
325 325
         // WRITE snippets to cache file
@@ -330,18 +330,18 @@  discard block
 block discarded – undo
330 330
         while ($row = $modx->getDatabase()->getRow($rs)) {
331 331
             $key = $row['name'];
332 332
             if ($row['disabled']) {
333
-                $content .= '$s[\'' . $key . '\']=\'return false;\';';
333
+                $content .= '$s[\''.$key.'\']=\'return false;\';';
334 334
             } else {
335 335
                 $value = trim($row['snippet']);
336 336
                 if ($modx->config['minifyphp_incache']) {
337 337
                     $value = $this->php_strip_whitespace($value);
338 338
                 }
339
-                $content .= '$s[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';';
339
+                $content .= '$s[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';';
340 340
                 $properties = $modx->parseProperties($row['properties']);
341 341
                 $sharedproperties = $modx->parseProperties($row['sharedproperties']);
342 342
                 $properties = array_merge($sharedproperties, $properties);
343 343
                 if (0 < count($properties)) {
344
-                    $content .= '$s[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';';
344
+                    $content .= '$s[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';';
345 345
                 }
346 346
             }
347 347
         }
@@ -359,13 +359,13 @@  discard block
 block discarded – undo
359 359
             if ($modx->config['minifyphp_incache']) {
360 360
                 $value = $this->php_strip_whitespace($value);
361 361
             }
362
-            $content .= '$p[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';';
362
+            $content .= '$p[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';';
363 363
             if ($row['properties'] != '' || $row['sharedproperties'] != '') {
364 364
                 $properties = $modx->parseProperties($row['properties']);
365 365
                 $sharedproperties = $modx->parseProperties($row['sharedproperties']);
366 366
                 $properties = array_merge($sharedproperties, $properties);
367 367
                 if (0 < count($properties)) {
368
-                    $content .= '$p[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';';
368
+                    $content .= '$p[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';';
369 369
                 }
370 370
             }
371 371
         }
@@ -388,14 +388,14 @@  discard block
 block discarded – undo
388 388
         }
389 389
         foreach ($events as $evtname => $pluginnames) {
390 390
             $events[$evtname] = $pluginnames;
391
-            $content .= '$e[\'' . $evtname . '\']=array(\'' . implode('\',\'',
392
-                    $this->escapeSingleQuotes($pluginnames)) . '\');';
391
+            $content .= '$e[\''.$evtname.'\']=array(\''.implode('\',\'',
392
+                    $this->escapeSingleQuotes($pluginnames)).'\');';
393 393
         }
394 394
 
395 395
         $content .= "\n";
396 396
 
397 397
         // close and write the file
398
-        $filename = $this->cachePath . 'siteCache.idx.php';
398
+        $filename = $this->cachePath.'siteCache.idx.php';
399 399
 
400 400
         // invoke OnBeforeCacheUpdate event
401 401
         if ($modx) {
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
             exit("Cannot write main MODX cache file! Make sure the assets/cache directory is writable!");
407 407
         }
408 408
 
409
-        if (!is_file($this->cachePath . '/.htaccess')) {
410
-            file_put_contents($this->cachePath . '/.htaccess', "order deny,allow\ndeny from all\n");
409
+        if (!is_file($this->cachePath.'/.htaccess')) {
410
+            file_put_contents($this->cachePath.'/.htaccess', "order deny,allow\ndeny from all\n");
411 411
         }
412 412
 
413 413
         // invoke OnCacheUpdate event
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 
430 430
         $source = trim($source);
431 431
         if (substr($source, 0, 5) !== '<?php') {
432
-            $source = '<?php ' . $source;
432
+            $source = '<?php '.$source;
433 433
         }
434 434
 
435 435
         $tokens = token_get_all($source);
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
             }
488 488
         }
489 489
         $source = preg_replace(array('@^<\?php@i', '|\s+|', '|<!--|', '|-->|', '|-->\s+<!--|'),
490
-            array('', ' ', "\n" . '<!--', '-->' . "\n", '-->' . "\n" . '<!--'), $_);
490
+            array('', ' ', "\n".'<!--', '-->'."\n", '-->'."\n".'<!--'), $_);
491 491
         $source = trim($source);
492 492
 
493 493
         return $source;
Please login to merge, or discard this patch.