@@ -3,4 +3,6 @@ |
||
3 | 3 | /** |
4 | 4 | * @deprecated use EvolutionCMS\Legacy\LogHandler |
5 | 5 | */ |
6 | -class logHandler extends EvolutionCMS\Legacy\LogHandler{} |
|
6 | +class logHandler extends EvolutionCMS\Legacy\LogHandler |
|
7 | +{ |
|
8 | +} |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $role = $this->role; |
37 | 37 | |
38 | 38 | if ($role == 1) { |
39 | - return true; // administrator - grant all document permissions |
|
39 | + return true; // administrator - grant all document permissions |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | if ($modx->config['use_udperms'] == 0 || $modx->config['use_udperms'] == "" || !isset($modx->config['use_udperms'])) { |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | are private to the manager users will not be private to web users if the |
64 | 64 | document group is not assigned to a web user group and visa versa. |
65 | 65 | */ |
66 | - $permissionsok = false; // set permissions to false |
|
66 | + $permissionsok = false; // set permissions to false |
|
67 | 67 | |
68 | 68 | $rs = $modx->db->select( |
69 | 69 | 'count(DISTINCT sc.id)', |
70 | 70 | "{$tblsc} AS sc |
71 | 71 | LEFT JOIN {$tbldg} AS dg on dg.document = sc.id |
72 | 72 | LEFT JOIN {$tbldgn} dgn ON dgn.id = dg.document_group", |
73 | - "sc.id='{$this->document}' AND (" . (empty($docgrp) ? '' : "dg.document_group = " . $docgrp . " ||") . " sc.privatemgr = 0)" |
|
73 | + "sc.id='{$this->document}' AND (".(empty($docgrp) ? '' : "dg.document_group = ".$docgrp." ||")." sc.privatemgr = 0)" |
|
74 | 74 | ); |
75 | 75 | $limit = $modx->db->getValue($rs); |
76 | 76 | if ($limit == 1) { |
@@ -71,11 +71,11 @@ |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | if ($context === 'common') { |
74 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
74 | + $lang_path = MODX_MANAGER_PATH.'includes/lang/'; |
|
75 | 75 | } else { |
76 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
76 | + $lang_path = MODX_MANAGER_PATH."includes/lang/{$context}/"; |
|
77 | 77 | } |
78 | - include_once($lang_path . 'english.inc.php'); |
|
78 | + include_once($lang_path.'english.inc.php'); |
|
79 | 79 | $manager_language = $modx->config['manager_language']; |
80 | 80 | if (is_file("{$lang_path}{$manager_language}.inc.php")) { |
81 | 81 | include_once("{$lang_path}{$manager_language}.inc.php"); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $this->db_tbl['categories'] = $modx->getFullTableName('categories'); |
21 | 21 | |
22 | 22 | foreach ($this->elements as $element) { |
23 | - $this->db_tbl[$element] = $modx->getFullTableName('site_' . $element); |
|
23 | + $this->db_tbl[$element] = $modx->getFullTableName('site_'.$element); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $this->db->select( |
55 | 55 | '*', |
56 | 56 | $this->db_tbl['categories'], |
57 | - "`" . $where . "` = '" . $this->db->escape($search) . "'" |
|
57 | + "`".$where."` = '".$this->db->escape($search)."'" |
|
58 | 58 | ) |
59 | 59 | ); |
60 | 60 | |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | { |
72 | 72 | $_value = $this->db->getValue( |
73 | 73 | $this->db->select( |
74 | - '`' . $value . '`', |
|
74 | + '`'.$value.'`', |
|
75 | 75 | $this->db_tbl['categories'], |
76 | - "`" . $where . "` = '" . $this->db->escape($search) . "'" |
|
76 | + "`".$where."` = '".$this->db->escape($search)."'" |
|
77 | 77 | ) |
78 | 78 | ); |
79 | 79 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $this->db->select( |
93 | 93 | '*', |
94 | 94 | $this->db_tbl[$element], |
95 | - "`category` = '" . (int)$category_id . "'" |
|
95 | + "`category` = '".(int) $category_id."'" |
|
96 | 96 | ) |
97 | 97 | ); |
98 | 98 | |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | $this->db->update( |
136 | 136 | $_update, |
137 | 137 | $this->db_tbl[$element], |
138 | - "`category` = '" . (int)$category_id . "'" |
|
138 | + "`category` = '".(int) $category_id."'" |
|
139 | 139 | ); |
140 | 140 | } |
141 | 141 | |
142 | 142 | $this->db->delete( |
143 | 143 | $this->db_tbl['categories'], |
144 | - "`id` = '" . (int)$category_id . "'" |
|
144 | + "`id` = '".(int) $category_id."'" |
|
145 | 145 | ); |
146 | 146 | |
147 | 147 | return $this->db->getAffectedRows() === 1; |
@@ -160,13 +160,13 @@ discard block |
||
160 | 160 | |
161 | 161 | $_update = array( |
162 | 162 | 'category' => $this->db->escape($data['category']), |
163 | - 'rank' => (int)$data['rank'] |
|
163 | + 'rank' => (int) $data['rank'] |
|
164 | 164 | ); |
165 | 165 | |
166 | 166 | $this->db->update( |
167 | 167 | $_update, |
168 | 168 | $this->db_tbl['categories'], |
169 | - "`id` = '" . (int)$category_id . "'" |
|
169 | + "`id` = '".(int) $category_id."'" |
|
170 | 170 | ); |
171 | 171 | |
172 | 172 | if ($this->db->getAffectedRows() === 1) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | $_insert = array( |
191 | 191 | 'category' => $this->db->escape($category_name), |
192 | - 'rank' => (int)$category_rank |
|
192 | + 'rank' => (int) $category_rank |
|
193 | 193 | ); |
194 | 194 | |
195 | 195 | $this->db->insert( |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $this->db->select( |
217 | 217 | '`id`', |
218 | 218 | $this->db_tbl['categories'], |
219 | - "`category` = '" . $category . "'" |
|
219 | + "`category` = '".$category."'" |
|
220 | 220 | ) |
221 | 221 | ); |
222 | 222 |
@@ -36,16 +36,16 @@ discard block |
||
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->manager->action : $action; // writes the action to the object |
|
42 | + $this->entry['action'] = empty($action) ? $modx->manager->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 |
||
96 | 96 | |
97 | 97 | $insert_id = $modx->db->insert($fields, $tbl_manager_log); |
98 | 98 | if (!$insert_id) { |
99 | - $modx->messageQuit("Logging error: couldn't save log to table! Error code: " . $modx->db->getLastError()); |
|
99 | + $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->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']; |
@@ -105,7 +105,8 @@ discard block |
||
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - private function getUserIP() { |
|
108 | + private function getUserIP() |
|
109 | + { |
|
109 | 110 | if( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) { |
110 | 111 | if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')>0) { |
111 | 112 | $addr = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']); |
@@ -113,8 +114,7 @@ discard block |
||
113 | 114 | } else { |
114 | 115 | return $_SERVER['HTTP_X_FORWARDED_FOR']; |
115 | 116 | } |
116 | - } |
|
117 | - else { |
|
117 | + } else { |
|
118 | 118 | return $_SERVER['REMOTE_ADDR']; |
119 | 119 | } |
120 | 120 | } |
@@ -1,6 +1,6 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
119 | 119 | |
120 | 120 | $rs = $modx->db->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->db->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->db->getRow($rs)) { |
@@ -138,9 +138,9 @@ discard block |
||
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 |
||
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 | } |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php namespace EvolutionCMS\Legacy; |
2 | 2 | |
3 | -class mgrResources { |
|
3 | +class mgrResources |
|
4 | +{ |
|
4 | 5 | /** |
5 | 6 | * @var array |
6 | 7 | */ |
@@ -21,7 +22,8 @@ discard block |
||
21 | 22 | /** |
22 | 23 | * mgrResources constructor. |
23 | 24 | */ |
24 | - public function __construct() { |
|
25 | + public function __construct() |
|
26 | + { |
|
25 | 27 | $this->setTypes(); |
26 | 28 | $this->queryItemsFromDB(); |
27 | 29 | $this->prepareCategoryArrays(); |
@@ -30,7 +32,8 @@ discard block |
||
30 | 32 | /** |
31 | 33 | * @return void |
32 | 34 | */ |
33 | - public function setTypes() { |
|
35 | + public function setTypes() |
|
36 | + { |
|
34 | 37 | global $_lang; |
35 | 38 | $this->types['site_templates'] = array( |
36 | 39 | 'title'=>$_lang["manage_templates"], |
@@ -68,7 +71,8 @@ discard block |
||
68 | 71 | /** |
69 | 72 | * @return void |
70 | 73 | */ |
71 | - public function queryItemsFromDB() { |
|
74 | + public function queryItemsFromDB() |
|
75 | + { |
|
72 | 76 | foreach($this->types as $resourceTable=>$type) { |
73 | 77 | if($this->hasAnyPermissions($type['permissions'])) { |
74 | 78 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
@@ -81,11 +85,13 @@ discard block |
||
81 | 85 | * @param array $permissions |
82 | 86 | * @return bool |
83 | 87 | */ |
84 | - public function hasAnyPermissions($permissions) { |
|
88 | + public function hasAnyPermissions($permissions) |
|
89 | + { |
|
85 | 90 | $modx = evolutionCMS(); |
86 | 91 | |
87 | - foreach($permissions as $p) |
|
88 | - if($modx->hasPermission($p)) return true; |
|
92 | + foreach($permissions as $p) { |
|
93 | + if($modx->hasPermission($p)) return true; |
|
94 | + } |
|
89 | 95 | |
90 | 96 | return false; |
91 | 97 | } |
@@ -95,7 +101,8 @@ discard block |
||
95 | 101 | * @param string $nameField |
96 | 102 | * @return array|bool |
97 | 103 | */ |
98 | - public function queryResources($resourceTable, $nameField = 'name') { |
|
104 | + public function queryResources($resourceTable, $nameField = 'name') |
|
105 | + { |
|
99 | 106 | $modx = evolutionCMS(); global $_lang; |
100 | 107 | |
101 | 108 | $allowed = array( |
@@ -112,8 +119,9 @@ discard block |
||
112 | 119 | $tvsql = 'site_tmplvars.caption, '; |
113 | 120 | $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
114 | 121 | $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
122 | + } else { |
|
123 | + $sttfield = ''; |
|
115 | 124 | } |
116 | - else $sttfield = ''; |
|
117 | 125 | |
118 | 126 | $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
119 | 127 | |
@@ -126,7 +134,9 @@ discard block |
||
126 | 134 | ); |
127 | 135 | $limit = $modx->db->getRecordCount($rs); |
128 | 136 | |
129 | - if($limit < 1) return false; |
|
137 | + if($limit < 1) { |
|
138 | + return false; |
|
139 | + } |
|
130 | 140 | |
131 | 141 | $result = array(); |
132 | 142 | while ($row = $modx->db->getRow($rs)) { |
@@ -138,7 +148,8 @@ discard block |
||
138 | 148 | /** |
139 | 149 | * @return void |
140 | 150 | */ |
141 | - public function prepareCategoryArrays() { |
|
151 | + public function prepareCategoryArrays() |
|
152 | + { |
|
142 | 153 | foreach($this->items as $type=>$items) { |
143 | 154 | foreach((array)$items as $item) { |
144 | 155 | $catid = $item['catid'] ? $item['catid'] : 0; |
@@ -154,7 +165,7 @@ discard block |
||
154 | 165 | |
155 | 166 | // Now sort by name |
156 | 167 | foreach($this->itemsPerCategory as $catid=>$items) { |
157 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
168 | + usort($this->itemsPerCategory[$catid], function ($a, $b){ |
|
158 | 169 | return strcasecmp($a['name'], $b['name']); |
159 | 170 | }); |
160 | 171 | } |
@@ -8,46 +8,46 @@ discard block |
||
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->db->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->db->getRecordCount($sql)) { |
|
25 | + if ($modx->db->getRecordCount($sql)) { |
|
26 | 26 | $tabs = array(); |
27 | - while($row = $modx->db->getRow($sql)) { |
|
28 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
27 | + while ($row = $modx->db->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 |
||
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 |
||
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 |
||
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' : '') . '> </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' : '').'> </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 |
||
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 |
||
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']; |
@@ -8,7 +8,8 @@ discard block |
||
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 | 13 | $modx = evolutionCMS(); |
13 | 14 | |
14 | 15 | $output = ''; |
@@ -64,7 +65,8 @@ discard block |
||
64 | 65 | * @param array $data |
65 | 66 | * @return string |
66 | 67 | */ |
67 | - private function render($data) { |
|
68 | + private function render($data) |
|
69 | + { |
|
68 | 70 | $modx = evolutionCMS(); global $_lang, $_country_lang; |
69 | 71 | |
70 | 72 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php namespace EvolutionCMS\Legacy; |
2 | 2 | |
3 | -Class TemplateParser |
|
3 | +class TemplateParser |
|
4 | 4 | { |
5 | 5 | |
6 | 6 | /** |
@@ -85,8 +85,8 @@ discard block |
||
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 |
||
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->db->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->db->getAffectedRows() === 1; |
@@ -2224,11 +2224,11 @@ discard block |
||
2224 | 2224 | if (isset($this->snippetCache[$snip_name])) { |
2225 | 2225 | $snippetObject['name'] = $snip_name; |
2226 | 2226 | $snippetObject['content'] = $this->snippetCache[$snip_name]; |
2227 | - if (isset($this->snippetCache["{$snip_name}Props"])) { |
|
2228 | - if (!isset($this->snippetCache["{$snip_name}Props"])) { |
|
2229 | - $this->snippetCache["{$snip_name}Props"] = ''; |
|
2227 | + if (isset($this->snippetCache["{$snip_name}props"])) { |
|
2228 | + if (!isset($this->snippetCache["{$snip_name}props"])) { |
|
2229 | + $this->snippetCache["{$snip_name}props"] = ''; |
|
2230 | 2230 | } |
2231 | - $snippetObject['properties'] = $this->snippetCache["{$snip_name}Props"]; |
|
2231 | + $snippetObject['properties'] = $this->snippetCache["{$snip_name}props"]; |
|
2232 | 2232 | } |
2233 | 2233 | } elseif (substr($snip_name, 0, 1) === '@' && isset($this->pluginEvent[trim($snip_name, '@')])) { |
2234 | 2234 | $snippetObject['name'] = trim($snip_name, '@'); |
@@ -2253,7 +2253,7 @@ discard block |
||
2253 | 2253 | $snippetObject['content'] = $snip_content; |
2254 | 2254 | $snippetObject['properties'] = $snip_prop; |
2255 | 2255 | $this->snippetCache[$snip_name] = $snip_content; |
2256 | - $this->snippetCache["{$snip_name}Props"] = $snip_prop; |
|
2256 | + $this->snippetCache["{$snip_name}props"] = $snip_prop; |
|
2257 | 2257 | } |
2258 | 2258 | return $snippetObject; |
2259 | 2259 | } |
@@ -3569,7 +3569,7 @@ discard block |
||
3569 | 3569 | } |
3570 | 3570 | // build query |
3571 | 3571 | $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
3572 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3572 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
3573 | 3573 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3574 | 3574 | $resourceArray = $this->db->makeArray($result); |
3575 | 3575 | $this->tmpCache[__FUNCTION__][$cacheKey] = $resourceArray; |
@@ -3606,7 +3606,7 @@ discard block |
||
3606 | 3606 | } |
3607 | 3607 | // build query |
3608 | 3608 | $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
3609 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3609 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
3610 | 3610 | 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}"); |
3611 | 3611 | $resourceArray = $this->db->makeArray($result); |
3612 | 3612 | |
@@ -3662,7 +3662,7 @@ discard block |
||
3662 | 3662 | $tblsc = $this->getFullTableName('site_content'); |
3663 | 3663 | $tbldg = $this->getFullTableName('document_groups'); |
3664 | 3664 | |
3665 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3665 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
3666 | 3666 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$parentid}' {$published} {$deleted} {$where} AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit); |
3667 | 3667 | |
3668 | 3668 | $resourceArray = $this->db->makeArray($result); |
@@ -3728,7 +3728,7 @@ discard block |
||
3728 | 3728 | $tblsc = $this->getFullTableName('site_content'); |
3729 | 3729 | $tbldg = $this->getFullTableName('document_groups'); |
3730 | 3730 | |
3731 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3731 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
3732 | 3732 | 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); |
3733 | 3733 | |
3734 | 3734 | $resourceArray = $this->db->makeArray($result); |
@@ -4320,7 +4320,7 @@ discard block |
||
4320 | 4320 | $template = $doc['content']; |
4321 | 4321 | break; |
4322 | 4322 | case 'SELECT': |
4323 | - $this->db->getValue($this->db->query("SELECT {$template}")); |
|
4323 | + $this->db->getValue($this->db->query("select {$template}")); |
|
4324 | 4324 | break; |
4325 | 4325 | default: |
4326 | 4326 | if (!($template = $this->getChunk($tpl))) { |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php" |
267 | 267 | * $extname - extension name in lowercase |
268 | 268 | * |
269 | - * @param $extname |
|
269 | + * @param string $extname |
|
270 | 270 | * @param bool $reload |
271 | 271 | * @return bool |
272 | 272 | */ |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @param int $count_attempts |
310 | 310 | * @param string $type $type |
311 | 311 | * @param string $responseCode |
312 | - * @return bool|null |
|
312 | + * @return false|null |
|
313 | 313 | * @global string $base_url |
314 | 314 | * @global string $site_url |
315 | 315 | */ |
@@ -1010,7 +1010,7 @@ discard block |
||
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | /** |
1013 | - * @param $contents |
|
1013 | + * @param string $contents |
|
1014 | 1014 | * @return mixed |
1015 | 1015 | */ |
1016 | 1016 | public function RecoveryEscapedTags($contents) |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | /** |
1037 | - * @param $tstart |
|
1037 | + * @param double $tstart |
|
1038 | 1038 | * @return array |
1039 | 1039 | */ |
1040 | 1040 | public function getTimerStats($tstart) |
@@ -1800,7 +1800,7 @@ discard block |
||
1800 | 1800 | |
1801 | 1801 | /** |
1802 | 1802 | * Remove Comment-Tags from output like <!--@- Comment -@--> |
1803 | - * @param $content |
|
1803 | + * @param string $content |
|
1804 | 1804 | * @param string $left |
1805 | 1805 | * @param string $right |
1806 | 1806 | * @return mixed |
@@ -1973,7 +1973,7 @@ discard block |
||
1973 | 1973 | /** |
1974 | 1974 | * Run snippets as per the tags in $documentSource and replace the tags with the returned values. |
1975 | 1975 | * |
1976 | - * @param $content |
|
1976 | + * @param string $content |
|
1977 | 1977 | * @return string |
1978 | 1978 | * @internal param string $documentSource |
1979 | 1979 | */ |
@@ -3008,7 +3008,7 @@ discard block |
||
3008 | 3008 | |
3009 | 3009 | /** |
3010 | 3010 | * @param $templateID |
3011 | - * @return mixed |
|
3011 | + * @return string |
|
3012 | 3012 | */ |
3013 | 3013 | public function _getTemplateCodeFromDB($templateID) |
3014 | 3014 | { |
@@ -3051,7 +3051,7 @@ discard block |
||
3051 | 3051 | /** |
3052 | 3052 | * @param $id |
3053 | 3053 | * @param int $top |
3054 | - * @return mixed |
|
3054 | + * @return string |
|
3055 | 3055 | */ |
3056 | 3056 | public function getUltimateParentId($id, $top = 0) |
3057 | 3057 | { |
@@ -3391,7 +3391,7 @@ discard block |
||
3391 | 3391 | * |
3392 | 3392 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3393 | 3393 | * @param int $id Element- / Resource-id |
3394 | - * @return bool |
|
3394 | + * @return false|null |
|
3395 | 3395 | */ |
3396 | 3396 | public function lockElement($type, $id) |
3397 | 3397 | { |
@@ -3413,7 +3413,7 @@ discard block |
||
3413 | 3413 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3414 | 3414 | * @param int $id Element- / Resource-id |
3415 | 3415 | * @param bool $includeAllUsers true = Deletes not only own user-locks |
3416 | - * @return bool |
|
3416 | + * @return false|null |
|
3417 | 3417 | */ |
3418 | 3418 | public function unlockElement($type, $id, $includeAllUsers = false) |
3419 | 3419 | { |
@@ -3927,7 +3927,7 @@ discard block |
||
3927 | 3927 | * Default: 1 |
3928 | 3928 | * @param string $fields List of fields |
3929 | 3929 | * Default: id, pagetitle, description, alias |
3930 | - * @return boolean|array |
|
3930 | + * @return string |
|
3931 | 3931 | */ |
3932 | 3932 | public function getPageInfo($pageid = -1, $active = 1, $fields = 'id, pagetitle, description, alias') |
3933 | 3933 | { |
@@ -4019,7 +4019,7 @@ discard block |
||
4019 | 4019 | * |
4020 | 4020 | * @param string $type |
4021 | 4021 | * @param bool $report |
4022 | - * @return bool |
|
4022 | + * @return boolean|null |
|
4023 | 4023 | */ |
4024 | 4024 | public function clearCache($type = '', $report = false) |
4025 | 4025 | { |
@@ -4385,7 +4385,7 @@ discard block |
||
4385 | 4385 | * - Placeholders prefix. Default: '{'. |
4386 | 4386 | * @param string $suffix {string} |
4387 | 4387 | * - Placeholders suffix. Default: '}'. |
4388 | - * @return bool|mixed|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
4388 | + * @return false|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
4389 | 4389 | * - Parsed chunk or false if $chunkArr is not array. |
4390 | 4390 | */ |
4391 | 4391 | public function parseChunk($chunkName, $chunkArr, $prefix = '{', $suffix = '}') |
@@ -5357,7 +5357,7 @@ discard block |
||
5357 | 5357 | * Remove event listener - only for use within the current execution cycle |
5358 | 5358 | * |
5359 | 5359 | * @param string $evtName |
5360 | - * @return boolean |
|
5360 | + * @return false|null |
|
5361 | 5361 | */ |
5362 | 5362 | public function removeEventListener($evtName) |
5363 | 5363 | { |
@@ -5381,7 +5381,7 @@ discard block |
||
5381 | 5381 | * |
5382 | 5382 | * @param string $evtName |
5383 | 5383 | * @param array $extParams Parameters available to plugins. Each array key will be the PHP variable name, and the array value will be the variable value. |
5384 | - * @return boolean|array |
|
5384 | + * @return false|null |
|
5385 | 5385 | */ |
5386 | 5386 | public function invokeEvent($evtName, $extParams = array()) |
5387 | 5387 | { |
@@ -5976,7 +5976,7 @@ discard block |
||
5976 | 5976 | |
5977 | 5977 | /** |
5978 | 5978 | * @param string $str |
5979 | - * @return bool|mixed|string |
|
5979 | + * @return string |
|
5980 | 5980 | */ |
5981 | 5981 | public function atBindFileContent($str = '') |
5982 | 5982 | { |
@@ -6027,8 +6027,8 @@ discard block |
||
6027 | 6027 | } |
6028 | 6028 | |
6029 | 6029 | /** |
6030 | - * @param $str |
|
6031 | - * @return bool|string |
|
6030 | + * @param string $str |
|
6031 | + * @return false|string |
|
6032 | 6032 | */ |
6033 | 6033 | public function getExtFromFilename($str) |
6034 | 6034 | { |
@@ -6056,7 +6056,7 @@ discard block |
||
6056 | 6056 | * @param string $text Error message |
6057 | 6057 | * @param string $file File where the error was detected |
6058 | 6058 | * @param string $line Line number within $file |
6059 | - * @return boolean |
|
6059 | + * @return boolean|null |
|
6060 | 6060 | */ |
6061 | 6061 | public function phpError($nr, $text, $file, $line) |
6062 | 6062 | { |
@@ -6108,7 +6108,7 @@ discard block |
||
6108 | 6108 | * @param string $text |
6109 | 6109 | * @param string $line |
6110 | 6110 | * @param string $output |
6111 | - * @return bool |
|
6111 | + * @return null|boolean |
|
6112 | 6112 | */ |
6113 | 6113 | public function messageQuit($msg = 'unspecified error', $query = '', $is_error = true, $nr = '', $file = '', $source = '', $text = '', $line = '', $output = '') |
6114 | 6114 | { |
@@ -6523,7 +6523,7 @@ discard block |
||
6523 | 6523 | |
6524 | 6524 | /** |
6525 | 6525 | * @param string $str |
6526 | - * @return bool|mixed|string |
|
6526 | + * @return string |
|
6527 | 6527 | */ |
6528 | 6528 | public function atBindInclude($str = '') |
6529 | 6529 | { |
@@ -6574,7 +6574,7 @@ discard block |
||
6574 | 6574 | * @param $str |
6575 | 6575 | * @param int $flags |
6576 | 6576 | * @param string $encode |
6577 | - * @return mixed |
|
6577 | + * @return null|string |
|
6578 | 6578 | */ |
6579 | 6579 | public function htmlspecialchars($str, $flags = ENT_COMPAT, $encode = '') |
6580 | 6580 | { |
@@ -6583,7 +6583,7 @@ discard block |
||
6583 | 6583 | } |
6584 | 6584 | |
6585 | 6585 | /** |
6586 | - * @param $string |
|
6586 | + * @param string $string |
|
6587 | 6587 | * @param bool $returnData |
6588 | 6588 | * @return bool|mixed |
6589 | 6589 | */ |
@@ -710,13 +710,15 @@ discard block |
||
710 | 710 | $this->virtualDir = ''; |
711 | 711 | } |
712 | 712 | |
713 | - 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 */ |
|
713 | + if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { |
|
714 | +/* we got an ID returned, check to make sure it's not an alias */ |
|
714 | 715 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
715 | 716 | if ($this->config['use_alias_path'] == 1) { |
716 | 717 | 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))))) { |
717 | 718 | $this->documentMethod = 'id'; |
718 | 719 | return $q; |
719 | - } else { /* not a valid id in terms of virtualDir, treat as alias */ |
|
720 | + } else { |
|
721 | +/* not a valid id in terms of virtualDir, treat as alias */ |
|
720 | 722 | $this->documentMethod = 'alias'; |
721 | 723 | return $q; |
722 | 724 | } |
@@ -724,7 +726,8 @@ discard block |
||
724 | 726 | $this->documentMethod = 'id'; |
725 | 727 | return $q; |
726 | 728 | } |
727 | - } else { /* we didn't get an ID back, so instead we assume it's an alias */ |
|
729 | + } else { |
|
730 | +/* we didn't get an ID back, so instead we assume it's an alias */ |
|
728 | 731 | if ($this->config['friendly_alias_urls'] != 1) { |
729 | 732 | $q = $qOrig; |
730 | 733 | } |
@@ -754,13 +757,14 @@ discard block |
||
754 | 757 | * @param $id |
755 | 758 | * @return array|mixed|null|string |
756 | 759 | */ |
757 | - public function makePageCacheKey($id){ |
|
760 | + public function makePageCacheKey($id) |
|
761 | + { |
|
758 | 762 | $hash = $id; |
759 | 763 | $tmp = null; |
760 | 764 | $params = array(); |
761 | - if(!empty($this->systemCacheKey)){ |
|
765 | + if(!empty($this->systemCacheKey)) { |
|
762 | 766 | $hash = $this->systemCacheKey; |
763 | - }else { |
|
767 | + } else { |
|
764 | 768 | if (!empty($_GET)) { |
765 | 769 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
766 | 770 | $params = $_GET; |
@@ -769,7 +773,7 @@ discard block |
||
769 | 773 | } |
770 | 774 | } |
771 | 775 | $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
772 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
776 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
773 | 777 | $tmp = array_pop($evtOut); |
774 | 778 | } |
775 | 779 | return empty($tmp) ? $hash : $tmp; |
@@ -1096,7 +1100,8 @@ discard block |
||
1096 | 1100 | $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0"; |
1097 | 1101 | $result_pub = $this->db->select( 'id', '[+prefix+]site_content', $where); |
1098 | 1102 | $this->db->update($field, '[+prefix+]site_content', $where); |
1099 | - if ($this->db->getRecordCount($result_pub) >= 1) { //Event unPublished doc |
|
1103 | + if ($this->db->getRecordCount($result_pub) >= 1) { |
|
1104 | +//Event unPublished doc |
|
1100 | 1105 | while ($row_pub = $this->db->getRow($result_pub)) { |
1101 | 1106 | $this->invokeEvent("OnDocUnPublished", array( |
1102 | 1107 | "docid" => $row_pub['id'] |
@@ -1109,7 +1114,8 @@ discard block |
||
1109 | 1114 | $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1"; |
1110 | 1115 | $result_unpub = $this->db->select( 'id', '[+prefix+]site_content', $where); |
1111 | 1116 | $this->db->update($field, '[+prefix+]site_content', $where); |
1112 | - if ($this->db->getRecordCount($result_unpub) >= 1) { //Event unPublished doc |
|
1117 | + if ($this->db->getRecordCount($result_unpub) >= 1) { |
|
1118 | +//Event unPublished doc |
|
1113 | 1119 | while ($row_unpub = $this->db->getRow($result_unpub)) { |
1114 | 1120 | $this->invokeEvent("OnDocUnPublished", array( |
1115 | 1121 | "docid" => $row_unpub['id'] |
@@ -1196,10 +1202,18 @@ discard block |
||
1196 | 1202 | return array(); |
1197 | 1203 | } |
1198 | 1204 | $spacer = md5('<<<EVO>>>'); |
1199 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
1200 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
1201 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
1202 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
1205 | + if($left==='{{' && strpos($content,';}}')!==false) { |
|
1206 | + $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
1207 | + } |
|
1208 | + if($left==='{{' && strpos($content,'{{}}')!==false) { |
|
1209 | + $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
1210 | + } |
|
1211 | + if($left==='[[' && strpos($content,']]]]')!==false) { |
|
1212 | + $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
1213 | + } |
|
1214 | + if($left==='[[' && strpos($content,']]]')!==false) { |
|
1215 | + $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
1216 | + } |
|
1203 | 1217 | |
1204 | 1218 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
1205 | 1219 | $pos[']]>'] = strpos($content, ']]>'); |
@@ -1252,7 +1266,8 @@ discard block |
||
1252 | 1266 | } |
1253 | 1267 | } |
1254 | 1268 | |
1255 | - if (!in_array($fetch, $tags)) { // Avoid double Matches |
|
1269 | + if (!in_array($fetch, $tags)) { |
|
1270 | +// Avoid double Matches |
|
1256 | 1271 | $tags[] = $fetch; // Fetch |
1257 | 1272 | }; |
1258 | 1273 | $fetch = ''; // and reset |
@@ -1270,7 +1285,9 @@ discard block |
||
1270 | 1285 | } |
1271 | 1286 | } |
1272 | 1287 | foreach($tags as $i=>$tag) { |
1273 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1288 | + if(strpos($tag,$spacer)!==false) { |
|
1289 | + $tags[$i] = str_replace($spacer, '', $tag); |
|
1290 | + } |
|
1274 | 1291 | } |
1275 | 1292 | return $tags; |
1276 | 1293 | } |
@@ -1310,7 +1327,10 @@ discard block |
||
1310 | 1327 | } |
1311 | 1328 | |
1312 | 1329 | foreach ($matches[1] as $i => $key) { |
1313 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1330 | + if(strpos($key,'[+')!==false) { |
|
1331 | + continue; |
|
1332 | + } |
|
1333 | + // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1314 | 1334 | if (substr($key, 0, 1) == '#') { |
1315 | 1335 | $key = substr($key, 1); |
1316 | 1336 | } // remove # for QuickEdit format |
@@ -2033,7 +2053,8 @@ discard block |
||
2033 | 2053 | * @return mixed|string |
2034 | 2054 | */ |
2035 | 2055 | public function _getSGVar($value) |
2036 | - { // Get super globals |
|
2056 | + { |
|
2057 | +// Get super globals |
|
2037 | 2058 | $key = $value; |
2038 | 2059 | $_ = $this->config['enable_filter']; |
2039 | 2060 | $this->config['enable_filter'] = 1; |
@@ -2438,7 +2459,8 @@ discard block |
||
2438 | 2459 | if ($this->config['friendly_urls'] == 1) { |
2439 | 2460 | $aliases = array(); |
2440 | 2461 | if (is_array($this->documentListing)) { |
2441 | - foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site! |
|
2462 | + foreach ($this->documentListing as $path => $docid) { |
|
2463 | +// This is big Loop on large site! |
|
2442 | 2464 | $aliases[$docid] = $path; |
2443 | 2465 | $isfolder[$docid] = $this->aliasListing[$docid]['isfolder']; |
2444 | 2466 | } |
@@ -2471,7 +2493,7 @@ discard block |
||
2471 | 2493 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
2472 | 2494 | $pref = $this->config['friendly_url_prefix']; |
2473 | 2495 | $suff = $this->config['friendly_url_suffix']; |
2474 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2496 | + $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){ |
|
2475 | 2497 | global $modx; |
2476 | 2498 | $thealias = $aliases[$m[1]]; |
2477 | 2499 | $thefolder = $isfolder[$m[1]]; |
@@ -4255,7 +4277,8 @@ discard block |
||
4255 | 4277 | if (isset ($this->snippetCache[$snippetName])) { |
4256 | 4278 | $snippet = $this->snippetCache[$snippetName]; |
4257 | 4279 | $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
4258 | - } else { // not in cache so let's check the db |
|
4280 | + } else { |
|
4281 | +// not in cache so let's check the db |
|
4259 | 4282 | $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "' AND ss.disabled=0;"; |
4260 | 4283 | $result = $this->db->query($sql); |
4261 | 4284 | if ($this->db->getRecordCount($result) == 1) { |
@@ -4756,7 +4779,7 @@ discard block |
||
4756 | 4779 | $result = $this->db->makeArray($rs); |
4757 | 4780 | |
4758 | 4781 | // get default/built-in template variables |
4759 | - if(is_array($docRow)){ |
|
4782 | + if(is_array($docRow)) { |
|
4760 | 4783 | ksort($docRow); |
4761 | 4784 | |
4762 | 4785 | foreach ($docRow as $key => $value) { |
@@ -5231,12 +5254,16 @@ discard block |
||
5231 | 5254 | return ''; |
5232 | 5255 | } // nothing to register |
5233 | 5256 | if (!is_array($options)) { |
5234 | - if (is_bool($options)) // backward compatibility with old plaintext parameter |
|
5257 | + if (is_bool($options)) { |
|
5258 | + // backward compatibility with old plaintext parameter |
|
5235 | 5259 | { |
5236 | 5260 | $options = array('plaintext' => $options); |
5237 | - } elseif (is_string($options)) // Also allow script name as 2nd param |
|
5261 | + } |
|
5262 | + } elseif (is_string($options)) { |
|
5263 | + // Also allow script name as 2nd param |
|
5238 | 5264 | { |
5239 | 5265 | $options = array('name' => $options); |
5266 | + } |
|
5240 | 5267 | } else { |
5241 | 5268 | $options = array(); |
5242 | 5269 | } |
@@ -5248,7 +5275,8 @@ discard block |
||
5248 | 5275 | unset($overwritepos); // probably unnecessary--just making sure |
5249 | 5276 | |
5250 | 5277 | $useThisVer = true; |
5251 | - if (isset($this->loadedjscripts[$key])) { // a matching script was found |
|
5278 | + if (isset($this->loadedjscripts[$key])) { |
|
5279 | +// a matching script was found |
|
5252 | 5280 | // if existing script is a startup script, make sure the candidate is also a startup script |
5253 | 5281 | if ($this->loadedjscripts[$key]['startup']) { |
5254 | 5282 | $startup = true; |
@@ -5268,7 +5296,8 @@ discard block |
||
5268 | 5296 | // overwrite the old script (the position may be important for dependent scripts) |
5269 | 5297 | $overwritepos = $this->loadedjscripts[$key]['pos']; |
5270 | 5298 | } |
5271 | - } else { // Use the original version |
|
5299 | + } else { |
|
5300 | +// Use the original version |
|
5272 | 5301 | if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) { |
5273 | 5302 | // need to move the exisiting script to the head |
5274 | 5303 | $version = $this->loadedjscripts[$key][$version]; |
@@ -5393,7 +5422,8 @@ discard block |
||
5393 | 5422 | } |
5394 | 5423 | |
5395 | 5424 | $results = null; |
5396 | - foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop |
|
5425 | + foreach ($this->pluginEvent[$evtName] as $pluginName) { |
|
5426 | +// start for loop |
|
5397 | 5427 | if ($this->dumpPlugins) { |
5398 | 5428 | $eventtime = $this->getMicroTime(); |
5399 | 5429 | } |
@@ -5538,8 +5568,7 @@ discard block |
||
5538 | 5568 | } |
5539 | 5569 | } |
5540 | 5570 | } |
5541 | - } |
|
5542 | - elseif(\is_array($propertyString)) { |
|
5571 | + } elseif(\is_array($propertyString)) { |
|
5543 | 5572 | $property = $propertyString; |
5544 | 5573 | } |
5545 | 5574 | if (!empty($elementName) && !empty($elementType)) { |
@@ -5946,7 +5975,8 @@ discard block |
||
5946 | 5975 | * @return bool |
5947 | 5976 | */ |
5948 | 5977 | public function isSafeCode($phpcode = '', $safe_functions = '') |
5949 | - { // return true or false |
|
5978 | + { |
|
5979 | +// return true or false |
|
5950 | 5980 | if ($safe_functions == '') { |
5951 | 5981 | return false; |
5952 | 5982 | } |
@@ -6355,7 +6385,7 @@ discard block |
||
6355 | 6385 | $args = array_pad(array(), $_, '$var'); |
6356 | 6386 | $args = implode(", ", $args); |
6357 | 6387 | $modx = &$this; |
6358 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6388 | + $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){ |
|
6359 | 6389 | $arg = $val['args'][$tmp - 1]; |
6360 | 6390 | switch (true) { |
6361 | 6391 | case is_null($arg): { |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | function __call($method_name, $arguments) |
217 | 217 | { |
218 | - include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php'); |
|
218 | + include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php'); |
|
219 | 219 | if (method_exists($this->old, $method_name)) { |
220 | 220 | $error_type = 1; |
221 | 221 | } else { |
@@ -233,12 +233,12 @@ discard block |
||
233 | 233 | $info = debug_backtrace(); |
234 | 234 | $m[] = $msg; |
235 | 235 | if (!empty($this->currentSnippet)) { |
236 | - $m[] = 'Snippet - ' . $this->currentSnippet; |
|
236 | + $m[] = 'Snippet - '.$this->currentSnippet; |
|
237 | 237 | } elseif (!empty($this->event->activePlugin)) { |
238 | - $m[] = 'Plugin - ' . $this->event->activePlugin; |
|
238 | + $m[] = 'Plugin - '.$this->event->activePlugin; |
|
239 | 239 | } |
240 | 240 | $m[] = $this->decoded_request_uri; |
241 | - $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; |
|
241 | + $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; |
|
242 | 242 | $msg = implode('<br />', $m); |
243 | 243 | $this->logEvent(0, $error_type, $msg, $title); |
244 | 244 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | { |
256 | 256 | $flag = false; |
257 | 257 | if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) { |
258 | - $flag = (bool)$this->{$connector}->conn; |
|
258 | + $flag = (bool) $this->{$connector}->conn; |
|
259 | 259 | } |
260 | 260 | return $flag; |
261 | 261 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | } |
283 | 283 | if (!$out && $flag) { |
284 | 284 | $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); |
285 | - $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; |
|
285 | + $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; |
|
286 | 286 | $out = is_file($filename) ? include $filename : false; |
287 | 287 | } |
288 | 288 | if ($out && !in_array($extname, $this->extensions)) { |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | public function getMicroTime() |
300 | 300 | { |
301 | 301 | list ($usec, $sec) = explode(' ', microtime()); |
302 | - return ((float)$usec + (float)$sec); |
|
302 | + return ((float) $usec + (float) $sec); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | /** |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | // append the redirect count string to the url |
324 | 324 | $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0; |
325 | 325 | if ($currentNumberOfRedirects > 3) { |
326 | - $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>'); |
|
326 | + $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>'); |
|
327 | 327 | } else { |
328 | 328 | $currentNumberOfRedirects += 1; |
329 | 329 | if (strpos($url, "?") > 0) { |
@@ -334,9 +334,9 @@ discard block |
||
334 | 334 | } |
335 | 335 | } |
336 | 336 | if ($type == 'REDIRECT_REFRESH') { |
337 | - $header = 'Refresh: 0;URL=' . $url; |
|
337 | + $header = 'Refresh: 0;URL='.$url; |
|
338 | 338 | } elseif ($type == 'REDIRECT_META') { |
339 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />'; |
|
339 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />'; |
|
340 | 340 | echo $header; |
341 | 341 | exit; |
342 | 342 | } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) { |
@@ -344,10 +344,10 @@ discard block |
||
344 | 344 | global $base_url, $site_url; |
345 | 345 | if (substr($url, 0, strlen($base_url)) == $base_url) { |
346 | 346 | // append $site_url to make it work with Location: |
347 | - $url = $site_url . substr($url, strlen($base_url)); |
|
347 | + $url = $site_url.substr($url, strlen($base_url)); |
|
348 | 348 | } |
349 | 349 | if (strpos($url, "\n") === false) { |
350 | - $header = 'Location: ' . $url; |
|
350 | + $header = 'Location: '.$url; |
|
351 | 351 | } else { |
352 | 352 | $this->messageQuit('No newline allowed in redirect url.'); |
353 | 353 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | header($responseCode); |
357 | 357 | } |
358 | 358 | |
359 | - if(!empty($header)) { |
|
359 | + if (!empty($header)) { |
|
360 | 360 | header($header); |
361 | 361 | } |
362 | 362 | |
@@ -461,8 +461,8 @@ discard block |
||
461 | 461 | |
462 | 462 | private function recoverySiteCache() |
463 | 463 | { |
464 | - $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
465 | - $site_cache_path = $site_cache_dir . 'siteCache.idx.php'; |
|
464 | + $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
465 | + $site_cache_path = $site_cache_dir.'siteCache.idx.php'; |
|
466 | 466 | |
467 | 467 | if (is_file($site_cache_path)) { |
468 | 468 | include($site_cache_path); |
@@ -522,8 +522,8 @@ discard block |
||
522 | 522 | $this->invokeEvent("OnBeforeManagerPageInit"); |
523 | 523 | } |
524 | 524 | |
525 | - if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) { |
|
526 | - $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet']; |
|
525 | + if (isset ($_SESSION[$usrType.'UsrConfigSet'])) { |
|
526 | + $usrSettings = &$_SESSION[$usrType.'UsrConfigSet']; |
|
527 | 527 | } else { |
528 | 528 | if ($usrType == 'web') { |
529 | 529 | $from = $tbl_web_user_settings; |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | $usrSettings[$row['setting_name']] = $row['setting_value']; |
544 | 544 | } |
545 | 545 | if (isset ($usrType)) { |
546 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; |
|
546 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings; |
|
547 | 547 | } // store user settings in session |
548 | 548 | } |
549 | 549 | } |
@@ -688,10 +688,10 @@ discard block |
||
688 | 688 | $suf = $this->config['friendly_url_suffix']; |
689 | 689 | $pre = preg_quote($pre, '/'); |
690 | 690 | $suf = preg_quote($suf, '/'); |
691 | - if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) { |
|
691 | + if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) { |
|
692 | 692 | $q = $_[1]; |
693 | 693 | } |
694 | - if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) { |
|
694 | + if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) { |
|
695 | 695 | $q = $_[1]; |
696 | 696 | } |
697 | 697 | |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | 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 */ |
714 | 714 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
715 | 715 | if ($this->config['use_alias_path'] == 1) { |
716 | - 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))))) { |
|
716 | + 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))))) { |
|
717 | 717 | $this->documentMethod = 'id'; |
718 | 718 | return $q; |
719 | 719 | } else { /* not a valid id in terms of virtualDir, treat as alias */ |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | */ |
748 | 748 | public function getHashFile($key) |
749 | 749 | { |
750 | - return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php"; |
|
750 | + return $this->getCacheFolder()."docid_".$key.".pageCache.php"; |
|
751 | 751 | } |
752 | 752 | |
753 | 753 | /** |
@@ -758,9 +758,9 @@ discard block |
||
758 | 758 | $hash = $id; |
759 | 759 | $tmp = null; |
760 | 760 | $params = array(); |
761 | - if(!empty($this->systemCacheKey)){ |
|
761 | + if (!empty($this->systemCacheKey)) { |
|
762 | 762 | $hash = $this->systemCacheKey; |
763 | - }else { |
|
763 | + } else { |
|
764 | 764 | if (!empty($_GET)) { |
765 | 765 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
766 | 766 | $params = $_GET; |
@@ -768,8 +768,8 @@ discard block |
||
768 | 768 | $hash .= '_'.md5(http_build_query($params)); |
769 | 769 | } |
770 | 770 | } |
771 | - $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
|
772 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
771 | + $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); |
|
772 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
773 | 773 | $tmp = array_pop($evtOut); |
774 | 774 | } |
775 | 775 | return empty($tmp) ? $hash : $tmp; |
@@ -911,12 +911,12 @@ discard block |
||
911 | 911 | if ($js = $this->getRegisteredClientStartupScripts()) { |
912 | 912 | // change to just before closing </head> |
913 | 913 | // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); |
914 | - $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); |
|
914 | + $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | // Insert jscripts & html block into template - template must have a </body> tag |
918 | 918 | if ($js = $this->getRegisteredClientScripts()) { |
919 | - $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); |
|
919 | + $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); |
|
920 | 920 | } |
921 | 921 | // End fix by sirlancelot |
922 | 922 | |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | // send out content-type and content-disposition headers |
928 | 928 | if (IN_PARSER_MODE == "true") { |
929 | 929 | $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html"; |
930 | - header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']); |
|
930 | + header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']); |
|
931 | 931 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error) |
932 | 932 | // header('HTTP/1.0 404 Not Found'); |
933 | 933 | if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | $name = preg_replace('|-+|', '-', $name); |
946 | 946 | $name = trim($name, '-'); |
947 | 947 | } |
948 | - $header = 'Content-Disposition: attachment; filename=' . $name; |
|
948 | + $header = 'Content-Disposition: attachment; filename='.$name; |
|
949 | 949 | header($header); |
950 | 950 | } |
951 | 951 | } |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | |
954 | 954 | $stats = $this->getTimerStats($this->tstart); |
955 | 955 | |
956 | - $out =& $this->documentOutput; |
|
956 | + $out = & $this->documentOutput; |
|
957 | 957 | $out = str_replace("[^q^]", $stats['queries'], $out); |
958 | 958 | $out = str_replace("[^qt^]", $stats['queryTime'], $out); |
959 | 959 | $out = str_replace("[^p^]", $stats['phpTime'], $out); |
@@ -992,17 +992,17 @@ discard block |
||
992 | 992 | $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet |
993 | 993 | $tt += $t; |
994 | 994 | } |
995 | - echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />"; |
|
995 | + echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />"; |
|
996 | 996 | echo $this->snippetsCode; |
997 | 997 | } |
998 | 998 | if ($this->dumpPlugins) { |
999 | 999 | $ps = ""; |
1000 | 1000 | $tt = 0; |
1001 | 1001 | foreach ($this->pluginsTime as $s => $t) { |
1002 | - $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; |
|
1002 | + $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; |
|
1003 | 1003 | $tt += $t; |
1004 | 1004 | } |
1005 | - echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; |
|
1005 | + echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />"; |
|
1006 | 1006 | echo $this->pluginsCode; |
1007 | 1007 | } |
1008 | 1008 | |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | $srcTags = explode(',', $tags); |
1029 | 1029 | $repTags = array(); |
1030 | 1030 | foreach ($srcTags as $tag) { |
1031 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1]; |
|
1031 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1]; |
|
1032 | 1032 | } |
1033 | 1033 | return array($srcTags, $repTags); |
1034 | 1034 | } |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); |
1051 | 1051 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache"; |
1052 | 1052 | $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0; |
1053 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb"; |
|
1053 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb"; |
|
1054 | 1054 | |
1055 | 1055 | return $stats; |
1056 | 1056 | } |
@@ -1083,7 +1083,7 @@ discard block |
||
1083 | 1083 | { |
1084 | 1084 | $cacheRefreshTime = 0; |
1085 | 1085 | $recent_update = 0; |
1086 | - @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php'); |
|
1086 | + @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php'); |
|
1087 | 1087 | $this->recentUpdate = $recent_update; |
1088 | 1088 | |
1089 | 1089 | $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time']; |
@@ -1094,7 +1094,7 @@ discard block |
||
1094 | 1094 | // now, check for documents that need publishing |
1095 | 1095 | $field = array('published' => 1, 'publishedon' => $timeNow); |
1096 | 1096 | $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0"; |
1097 | - $result_pub = $this->db->select( 'id', '[+prefix+]site_content', $where); |
|
1097 | + $result_pub = $this->db->select('id', '[+prefix+]site_content', $where); |
|
1098 | 1098 | $this->db->update($field, '[+prefix+]site_content', $where); |
1099 | 1099 | if ($this->db->getRecordCount($result_pub) >= 1) { //Event unPublished doc |
1100 | 1100 | while ($row_pub = $this->db->getRow($result_pub)) { |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | // now, check for documents that need un-publishing |
1108 | 1108 | $field = array('published' => 0, 'publishedon' => 0); |
1109 | 1109 | $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1"; |
1110 | - $result_unpub = $this->db->select( 'id', '[+prefix+]site_content', $where); |
|
1110 | + $result_unpub = $this->db->select('id', '[+prefix+]site_content', $where); |
|
1111 | 1111 | $this->db->update($field, '[+prefix+]site_content', $where); |
1112 | 1112 | if ($this->db->getRecordCount($result_unpub) >= 1) { //Event unPublished doc |
1113 | 1113 | while ($row_unpub = $this->db->getRow($result_unpub)) { |
@@ -1153,8 +1153,8 @@ discard block |
||
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | $docObjSerial = serialize($this->documentObject); |
1156 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent; |
|
1157 | - $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey); |
|
1156 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent; |
|
1157 | + $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey); |
|
1158 | 1158 | file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); |
1159 | 1159 | } |
1160 | 1160 | } |
@@ -1196,16 +1196,16 @@ discard block |
||
1196 | 1196 | return array(); |
1197 | 1197 | } |
1198 | 1198 | $spacer = md5('<<<EVO>>>'); |
1199 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
1200 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
1201 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
1202 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
1199 | + if ($left === '{{' && strpos($content, ';}}') !== false) $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content); |
|
1200 | + if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content); |
|
1201 | + if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content); |
|
1202 | + if ($left === '[[' && strpos($content, ']]]') !== false) $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content); |
|
1203 | 1203 | |
1204 | 1204 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
1205 | 1205 | $pos[']]>'] = strpos($content, ']]>'); |
1206 | 1206 | |
1207 | 1207 | if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { |
1208 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3); |
|
1208 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3); |
|
1209 | 1209 | } |
1210 | 1210 | |
1211 | 1211 | $lp = explode($left, $content); |
@@ -1269,8 +1269,8 @@ discard block |
||
1269 | 1269 | } |
1270 | 1270 | } |
1271 | 1271 | } |
1272 | - foreach($tags as $i=>$tag) { |
|
1273 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1272 | + foreach ($tags as $i=>$tag) { |
|
1273 | + if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1274 | 1274 | } |
1275 | 1275 | return $tags; |
1276 | 1276 | } |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | } |
1311 | 1311 | |
1312 | 1312 | foreach ($matches[1] as $i => $key) { |
1313 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1313 | + if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1314 | 1314 | if (substr($key, 0, 1) == '#') { |
1315 | 1315 | $key = substr($key, 1); |
1316 | 1316 | } // remove # for QuickEdit format |
@@ -1340,8 +1340,8 @@ discard block |
||
1340 | 1340 | |
1341 | 1341 | if (strpos($content, $s) !== false) { |
1342 | 1342 | $content = str_replace($s, $value, $content); |
1343 | - } elseif($this->debug) { |
|
1344 | - $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1343 | + } elseif ($this->debug) { |
|
1344 | + $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1345 | 1345 | } |
1346 | 1346 | } |
1347 | 1347 | |
@@ -1508,8 +1508,8 @@ discard block |
||
1508 | 1508 | $s = &$matches[0][$i]; |
1509 | 1509 | if (strpos($content, $s) !== false) { |
1510 | 1510 | $content = str_replace($s, $value, $content); |
1511 | - } elseif($this->debug) { |
|
1512 | - $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1511 | + } elseif ($this->debug) { |
|
1512 | + $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1513 | 1513 | } |
1514 | 1514 | } |
1515 | 1515 | return $content; |
@@ -1562,7 +1562,7 @@ discard block |
||
1562 | 1562 | } |
1563 | 1563 | |
1564 | 1564 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags |
1565 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1565 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1566 | 1566 | if ($this->config['enable_at_syntax']) { |
1567 | 1567 | $value = $this->mergeConditionalTagsContent($value); |
1568 | 1568 | } |
@@ -1577,8 +1577,8 @@ discard block |
||
1577 | 1577 | $s = &$matches[0][$i]; |
1578 | 1578 | if (strpos($content, $s) !== false) { |
1579 | 1579 | $content = str_replace($s, $value, $content); |
1580 | - } elseif($this->debug) { |
|
1581 | - $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1580 | + } elseif ($this->debug) { |
|
1581 | + $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1582 | 1582 | } |
1583 | 1583 | } |
1584 | 1584 | return $content; |
@@ -1636,8 +1636,8 @@ discard block |
||
1636 | 1636 | $s = &$matches[0][$i]; |
1637 | 1637 | if (strpos($content, $s) !== false) { |
1638 | 1638 | $content = str_replace($s, $value, $content); |
1639 | - } elseif($this->debug) { |
|
1640 | - $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1639 | + } elseif ($this->debug) { |
|
1640 | + $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1641 | 1641 | } |
1642 | 1642 | } |
1643 | 1643 | return $content; |
@@ -1661,7 +1661,7 @@ discard block |
||
1661 | 1661 | return $content; |
1662 | 1662 | } |
1663 | 1663 | |
1664 | - $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; |
|
1664 | + $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; |
|
1665 | 1665 | $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content); |
1666 | 1666 | |
1667 | 1667 | $pieces = explode('<@IF:', $content); |
@@ -1672,7 +1672,7 @@ discard block |
||
1672 | 1672 | } |
1673 | 1673 | list($cmd, $text) = explode('>', $split, 2); |
1674 | 1674 | $cmd = str_replace("'", "\'", $cmd); |
1675 | - $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1675 | + $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1676 | 1676 | $content .= $text; |
1677 | 1677 | } |
1678 | 1678 | $pieces = explode('<@ELSEIF:', $content); |
@@ -1683,13 +1683,13 @@ discard block |
||
1683 | 1683 | } |
1684 | 1684 | list($cmd, $text) = explode('>', $split, 2); |
1685 | 1685 | $cmd = str_replace("'", "\'", $cmd); |
1686 | - $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1686 | + $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1687 | 1687 | $content .= $text; |
1688 | 1688 | } |
1689 | 1689 | |
1690 | 1690 | $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); |
1691 | 1691 | ob_start(); |
1692 | - $content = eval('?>' . $content); |
|
1692 | + $content = eval('?>'.$content); |
|
1693 | 1693 | $content = ob_get_clean(); |
1694 | 1694 | $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content); |
1695 | 1695 | |
@@ -1814,7 +1814,7 @@ discard block |
||
1814 | 1814 | $matches = $this->getTagsFromContent($content, $left, $right); |
1815 | 1815 | if (!empty($matches)) { |
1816 | 1816 | foreach ($matches[0] as $i => $v) { |
1817 | - $addBreakMatches[$i] = $v . "\n"; |
|
1817 | + $addBreakMatches[$i] = $v."\n"; |
|
1818 | 1818 | } |
1819 | 1819 | $content = str_replace($addBreakMatches, '', $content); |
1820 | 1820 | if (strpos($content, $left) !== false) { |
@@ -1847,8 +1847,8 @@ discard block |
||
1847 | 1847 | $s = &$matches[0][$i]; |
1848 | 1848 | if (strpos($content, $s) !== false) { |
1849 | 1849 | $content = str_replace($s, $v, $content); |
1850 | - } elseif($this->debug) { |
|
1851 | - $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1850 | + } elseif ($this->debug) { |
|
1851 | + $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1852 | 1852 | } |
1853 | 1853 | } |
1854 | 1854 | return $content; |
@@ -1912,7 +1912,7 @@ discard block |
||
1912 | 1912 | $msg = ($msg === false) ? 'ob_get_contents() error' : $msg; |
1913 | 1913 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg); |
1914 | 1914 | if ($this->isBackend()) { |
1915 | - $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>'); |
|
1915 | + $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>'); |
|
1916 | 1916 | } |
1917 | 1917 | } |
1918 | 1918 | } else { |
@@ -1958,7 +1958,7 @@ discard block |
||
1958 | 1958 | $echo = ($echo === false) ? 'ob_get_contents() error' : $echo; |
1959 | 1959 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo); |
1960 | 1960 | if ($this->isBackend()) { |
1961 | - $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>'); |
|
1961 | + $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>'); |
|
1962 | 1962 | } |
1963 | 1963 | } |
1964 | 1964 | } |
@@ -1966,7 +1966,7 @@ discard block |
||
1966 | 1966 | if (is_array($return) || is_object($return)) { |
1967 | 1967 | return $return; |
1968 | 1968 | } else { |
1969 | - return $echo . $return; |
|
1969 | + return $echo.$return; |
|
1970 | 1970 | } |
1971 | 1971 | } |
1972 | 1972 | |
@@ -2004,8 +2004,8 @@ discard block |
||
2004 | 2004 | } |
2005 | 2005 | if (strpos($content, $s) !== false) { |
2006 | 2006 | $content = str_replace($s, $value, $content); |
2007 | - } elseif($this->debug) { |
|
2008 | - $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
2007 | + } elseif ($this->debug) { |
|
2008 | + $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
2009 | 2009 | } |
2010 | 2010 | continue; |
2011 | 2011 | } |
@@ -2016,8 +2016,8 @@ discard block |
||
2016 | 2016 | |
2017 | 2017 | if (strpos($content, $s) !== false) { |
2018 | 2018 | $content = str_replace($s, $value, $content); |
2019 | - } elseif($this->debug) { |
|
2020 | - $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
2019 | + } elseif ($this->debug) { |
|
2020 | + $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
2021 | 2021 | } |
2022 | 2022 | } |
2023 | 2023 | |
@@ -2108,7 +2108,7 @@ discard block |
||
2108 | 2108 | $eventtime = sprintf('%2.2f ms', $eventtime * 1000); |
2109 | 2109 | $code = str_replace("\t", ' ', $this->htmlspecialchars($value)); |
2110 | 2110 | $piece = str_replace("\t", ' ', $this->htmlspecialchars($piece)); |
2111 | - $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); |
|
2111 | + $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true))); |
|
2112 | 2112 | $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); |
2113 | 2113 | $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); |
2114 | 2114 | } |
@@ -2353,7 +2353,7 @@ discard block |
||
2353 | 2353 | $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where); |
2354 | 2354 | $count = $this->db->getRecordCount($rs); |
2355 | 2355 | if (1 < $count) { |
2356 | - exit('Error $modx->_getSnippetObject()' . $snip_name); |
|
2356 | + exit('Error $modx->_getSnippetObject()'.$snip_name); |
|
2357 | 2357 | } |
2358 | 2358 | if ($count) { |
2359 | 2359 | $row = $this->db->getRow($rs); |
@@ -2379,7 +2379,7 @@ discard block |
||
2379 | 2379 | public function toAlias($text) |
2380 | 2380 | { |
2381 | 2381 | $suff = $this->config['friendly_url_suffix']; |
2382 | - 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); |
|
2382 | + 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); |
|
2383 | 2383 | } |
2384 | 2384 | |
2385 | 2385 | /** |
@@ -2411,7 +2411,7 @@ discard block |
||
2411 | 2411 | $suff = '/'; |
2412 | 2412 | } |
2413 | 2413 | |
2414 | - $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff; |
|
2414 | + $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff; |
|
2415 | 2415 | } |
2416 | 2416 | |
2417 | 2417 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -2448,7 +2448,7 @@ discard block |
||
2448 | 2448 | preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match); |
2449 | 2449 | $ids = implode(',', array_unique($match['1'])); |
2450 | 2450 | if ($ids) { |
2451 | - $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'"); |
|
2451 | + $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'"); |
|
2452 | 2452 | while ($row = $this->db->getRow($res)) { |
2453 | 2453 | if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) { |
2454 | 2454 | $parent = $row['parent']; |
@@ -2459,7 +2459,7 @@ discard block |
||
2459 | 2459 | $parent = $this->aliasListing[$parent]['parent']; |
2460 | 2460 | } |
2461 | 2461 | |
2462 | - $aliases[$row['id']] = $path . '/' . $row['alias']; |
|
2462 | + $aliases[$row['id']] = $path.'/'.$row['alias']; |
|
2463 | 2463 | } else { |
2464 | 2464 | $aliases[$row['id']] = $row['alias']; |
2465 | 2465 | } |
@@ -2471,7 +2471,7 @@ discard block |
||
2471 | 2471 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
2472 | 2472 | $pref = $this->config['friendly_url_prefix']; |
2473 | 2473 | $suff = $this->config['friendly_url_suffix']; |
2474 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2474 | + $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2475 | 2475 | global $modx; |
2476 | 2476 | $thealias = $aliases[$m[1]]; |
2477 | 2477 | $thefolder = $isfolder[$m[1]]; |
@@ -2487,7 +2487,7 @@ discard block |
||
2487 | 2487 | |
2488 | 2488 | } else { |
2489 | 2489 | $in = '!\[\~([0-9]+)\~\]!is'; |
2490 | - $out = "index.php?id=" . '\1'; |
|
2490 | + $out = "index.php?id=".'\1'; |
|
2491 | 2491 | $documentSource = preg_replace($in, $out, $documentSource); |
2492 | 2492 | } |
2493 | 2493 | |
@@ -2508,7 +2508,7 @@ discard block |
||
2508 | 2508 | $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; |
2509 | 2509 | $len_base_url = strlen($this->config['base_url']); |
2510 | 2510 | |
2511 | - $url_path = $q;//LANG |
|
2511 | + $url_path = $q; //LANG |
|
2512 | 2512 | |
2513 | 2513 | if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) { |
2514 | 2514 | $url_path = substr($url_path, $len_base_url); |
@@ -2520,7 +2520,7 @@ discard block |
||
2520 | 2520 | $strictURL = substr($strictURL, $len_base_url); |
2521 | 2521 | } |
2522 | 2522 | $http_host = $_SERVER['HTTP_HOST']; |
2523 | - $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG |
|
2523 | + $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG |
|
2524 | 2524 | |
2525 | 2525 | $site_url = $this->config['site_url']; |
2526 | 2526 | $url_query_string = explode('?', $_SERVER['REQUEST_URI']); |
@@ -2538,7 +2538,7 @@ discard block |
||
2538 | 2538 | } |
2539 | 2539 | if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) { |
2540 | 2540 | if (empty($_POST)) { |
2541 | - if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) { |
|
2541 | + if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) { |
|
2542 | 2542 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently'); |
2543 | 2543 | exit(0); |
2544 | 2544 | } |
@@ -2597,7 +2597,7 @@ discard block |
||
2597 | 2597 | $docgrp = implode(",", $docgrp); |
2598 | 2598 | } |
2599 | 2599 | // get document |
2600 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2600 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2601 | 2601 | $rs = $this->db->select('sc.*', "{$tblsc} sc |
2602 | 2602 | LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); |
2603 | 2603 | if ($this->db->getRecordCount($rs) < 1) { |
@@ -2633,9 +2633,9 @@ discard block |
||
2633 | 2633 | } |
2634 | 2634 | if ($documentObject['template']) { |
2635 | 2635 | // load TVs and merge with document - Orig by Apodigm - Docvars |
2636 | - $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv |
|
2637 | - INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
2638 | - LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2636 | + $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv |
|
2637 | + INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id |
|
2638 | + LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2639 | 2639 | $tmplvars = array(); |
2640 | 2640 | while ($row = $this->db->getRow($rs)) { |
2641 | 2641 | $tmplvars[$row['name']] = array( |
@@ -2681,7 +2681,7 @@ discard block |
||
2681 | 2681 | $st = md5($source); |
2682 | 2682 | } |
2683 | 2683 | if ($this->dumpSnippets == 1) { |
2684 | - $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>"; |
|
2684 | + $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>"; |
|
2685 | 2685 | } |
2686 | 2686 | |
2687 | 2687 | // invoke OnParseDocument event |
@@ -2723,7 +2723,7 @@ discard block |
||
2723 | 2723 | */ |
2724 | 2724 | public function executeParser() |
2725 | 2725 | { |
2726 | - if(MODX_CLI) { |
|
2726 | + if (MODX_CLI) { |
|
2727 | 2727 | throw new \RuntimeException('Call DocumentParser::executeParser on CLI mode'); |
2728 | 2728 | } |
2729 | 2729 | |
@@ -2769,7 +2769,7 @@ discard block |
||
2769 | 2769 | |
2770 | 2770 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path |
2771 | 2771 | if ($this->config['use_alias_path'] == 1) { |
2772 | - $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier; |
|
2772 | + $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier; |
|
2773 | 2773 | if (isset($this->documentListing[$alias])) { |
2774 | 2774 | $this->documentIdentifier = $this->documentListing[$alias]; |
2775 | 2775 | } else { |
@@ -2830,7 +2830,7 @@ discard block |
||
2830 | 2830 | } else { |
2831 | 2831 | $docAlias = $this->db->escape($this->documentIdentifier); |
2832 | 2832 | $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'"); |
2833 | - $this->documentIdentifier = (int)$this->db->getValue($rs); |
|
2833 | + $this->documentIdentifier = (int) $this->db->getValue($rs); |
|
2834 | 2834 | } |
2835 | 2835 | } |
2836 | 2836 | $this->documentMethod = 'id'; |
@@ -2887,7 +2887,7 @@ discard block |
||
2887 | 2887 | $_REQUEST[$n] = $_GET[$n] = $v; |
2888 | 2888 | } |
2889 | 2889 | } |
2890 | - $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path']; |
|
2890 | + $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path']; |
|
2891 | 2891 | $this->q = $qp['path']; |
2892 | 2892 | return $qp['path']; |
2893 | 2893 | } |
@@ -3033,7 +3033,7 @@ discard block |
||
3033 | 3033 | while ($id && $height--) { |
3034 | 3034 | $thisid = $id; |
3035 | 3035 | if ($this->config['aliaslistingfolder'] == 1) { |
3036 | - $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1"); |
|
3036 | + $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1"); |
|
3037 | 3037 | if (!$id || $id == '0') { |
3038 | 3038 | break; |
3039 | 3039 | } |
@@ -3084,15 +3084,15 @@ discard block |
||
3084 | 3084 | |
3085 | 3085 | if ($this->config['aliaslistingfolder'] == 1) { |
3086 | 3086 | |
3087 | - $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'"); |
|
3087 | + $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'"); |
|
3088 | 3088 | $idx = array(); |
3089 | 3089 | while ($row = $this->db->getRow($res)) { |
3090 | 3090 | $pAlias = ''; |
3091 | 3091 | if (isset($this->aliasListing[$row['parent']])) { |
3092 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : ''; |
|
3093 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : ''; |
|
3092 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : ''; |
|
3093 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : ''; |
|
3094 | 3094 | }; |
3095 | - $children[$pAlias . $row['alias']] = $row['id']; |
|
3095 | + $children[$pAlias.$row['alias']] = $row['id']; |
|
3096 | 3096 | if ($row['isfolder'] == 1) { |
3097 | 3097 | $idx[] = $row['id']; |
3098 | 3098 | } |
@@ -3124,7 +3124,7 @@ discard block |
||
3124 | 3124 | $depth--; |
3125 | 3125 | |
3126 | 3126 | foreach ($documentMap_cache[$id] as $childId) { |
3127 | - $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias']; |
|
3127 | + $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias']; |
|
3128 | 3128 | if (!strlen($pkey)) { |
3129 | 3129 | $pkey = "{$childId}"; |
3130 | 3130 | } |
@@ -3161,7 +3161,7 @@ discard block |
||
3161 | 3161 | $fnc = 'history.back(-1);'; |
3162 | 3162 | break; |
3163 | 3163 | default: |
3164 | - $fnc = "window.location.href='" . addslashes($url) . "';"; |
|
3164 | + $fnc = "window.location.href='".addslashes($url)."';"; |
|
3165 | 3165 | } |
3166 | 3166 | |
3167 | 3167 | echo "<html><head> |
@@ -3193,9 +3193,9 @@ discard block |
||
3193 | 3193 | $state = 0; |
3194 | 3194 | $pms = $_SESSION['mgrPermissions']; |
3195 | 3195 | if ($pms) { |
3196 | - $state = ((bool)$pms[$pm] === true); |
|
3196 | + $state = ((bool) $pms[$pm] === true); |
|
3197 | 3197 | } |
3198 | - return (int)$state; |
|
3198 | + return (int) $state; |
|
3199 | 3199 | } |
3200 | 3200 | |
3201 | 3201 | /** |
@@ -3208,8 +3208,8 @@ discard block |
||
3208 | 3208 | */ |
3209 | 3209 | public function elementIsLocked($type, $id, $includeThisUser = false) |
3210 | 3210 | { |
3211 | - $id = (int)$id; |
|
3212 | - $type = (int)$type; |
|
3211 | + $id = (int) $id; |
|
3212 | + $type = (int) $type; |
|
3213 | 3213 | if (!$type || !$id) { |
3214 | 3214 | return null; |
3215 | 3215 | } |
@@ -3259,7 +3259,7 @@ discard block |
||
3259 | 3259 | return $lockedElements; |
3260 | 3260 | } |
3261 | 3261 | |
3262 | - $type = (int)$type; |
|
3262 | + $type = (int) $type; |
|
3263 | 3263 | if (isset($lockedElements[$type])) { |
3264 | 3264 | return $lockedElements[$type]; |
3265 | 3265 | } else { |
@@ -3276,7 +3276,7 @@ discard block |
||
3276 | 3276 | $this->lockedElements = array(); |
3277 | 3277 | $this->cleanupExpiredLocks(); |
3278 | 3278 | |
3279 | - $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul |
|
3279 | + $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul |
|
3280 | 3280 | LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); |
3281 | 3281 | while ($row = $this->db->getRow($rs)) { |
3282 | 3282 | $this->lockedElements[$row['elementType']][$row['elementId']] = array( |
@@ -3299,7 +3299,7 @@ discard block |
||
3299 | 3299 | public function cleanupExpiredLocks() |
3300 | 3300 | { |
3301 | 3301 | // Clean-up active_user_sessions first |
3302 | - $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 |
|
3302 | + $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 |
|
3303 | 3303 | $validSessionTimeLimit = $this->time - $timeout; |
3304 | 3304 | $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}"); |
3305 | 3305 | |
@@ -3312,7 +3312,7 @@ discard block |
||
3312 | 3312 | foreach ($rs as $row) { |
3313 | 3313 | $userSids[] = $row['sid']; |
3314 | 3314 | } |
3315 | - $userSids = "'" . implode("','", $userSids) . "'"; |
|
3315 | + $userSids = "'".implode("','", $userSids)."'"; |
|
3316 | 3316 | $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})"); |
3317 | 3317 | } else { |
3318 | 3318 | $this->db->delete($this->getFullTableName('active_user_locks')); |
@@ -3396,8 +3396,8 @@ discard block |
||
3396 | 3396 | public function lockElement($type, $id) |
3397 | 3397 | { |
3398 | 3398 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3399 | - $type = (int)$type; |
|
3400 | - $id = (int)$id; |
|
3399 | + $type = (int) $type; |
|
3400 | + $id = (int) $id; |
|
3401 | 3401 | if (!$type || !$id || !$userId) { |
3402 | 3402 | return false; |
3403 | 3403 | } |
@@ -3418,8 +3418,8 @@ discard block |
||
3418 | 3418 | public function unlockElement($type, $id, $includeAllUsers = false) |
3419 | 3419 | { |
3420 | 3420 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3421 | - $type = (int)$type; |
|
3422 | - $id = (int)$id; |
|
3421 | + $type = (int) $type; |
|
3422 | + $id = (int) $id; |
|
3423 | 3423 | if (!$type || !$id) { |
3424 | 3424 | return false; |
3425 | 3425 | } |
@@ -3486,8 +3486,8 @@ discard block |
||
3486 | 3486 | } |
3487 | 3487 | |
3488 | 3488 | $usertype = $this->isFrontend() ? 1 : 0; |
3489 | - $evtid = (int)$evtid; |
|
3490 | - $type = (int)$type; |
|
3489 | + $evtid = (int) $evtid; |
|
3490 | + $type = (int) $type; |
|
3491 | 3491 | |
3492 | 3492 | // Types: 1 = information, 2 = warning, 3 = error |
3493 | 3493 | if ($type < 1) { |
@@ -3509,8 +3509,8 @@ discard block |
||
3509 | 3509 | if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') { |
3510 | 3510 | if ($this->config['send_errormail'] <= $type) { |
3511 | 3511 | $this->sendmail(array( |
3512 | - 'subject' => 'MODX System Error on ' . $this->config['site_name'], |
|
3513 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.', |
|
3512 | + 'subject' => 'MODX System Error on '.$this->config['site_name'], |
|
3513 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.', |
|
3514 | 3514 | 'type' => 'text' |
3515 | 3515 | )); |
3516 | 3516 | } |
@@ -3559,7 +3559,7 @@ discard block |
||
3559 | 3559 | $p['fromname'] = $userinfo['username']; |
3560 | 3560 | } |
3561 | 3561 | if ($msg === '' && !isset($p['body'])) { |
3562 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER']; |
|
3562 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER']; |
|
3563 | 3563 | } elseif (is_string($msg) && 0 < strlen($msg)) { |
3564 | 3564 | $p['body'] = $msg; |
3565 | 3565 | } |
@@ -3601,8 +3601,8 @@ discard block |
||
3601 | 3601 | $files = array(); |
3602 | 3602 | } |
3603 | 3603 | foreach ($files as $f) { |
3604 | - if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { |
|
3605 | - $this->mail->AddAttachment(MODX_BASE_PATH . $f); |
|
3604 | + if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { |
|
3605 | + $this->mail->AddAttachment(MODX_BASE_PATH.$f); |
|
3606 | 3606 | } |
3607 | 3607 | } |
3608 | 3608 | return $this->mail->send(); |
@@ -3646,7 +3646,7 @@ discard block |
||
3646 | 3646 | */ |
3647 | 3647 | public function isFrontend() |
3648 | 3648 | { |
3649 | - return ! $this->isBackend(); |
|
3649 | + return !$this->isBackend(); |
|
3650 | 3650 | } |
3651 | 3651 | |
3652 | 3652 | /** |
@@ -3671,14 +3671,14 @@ discard block |
||
3671 | 3671 | $tblsc = $this->getFullTableName("site_content"); |
3672 | 3672 | $tbldg = $this->getFullTableName("document_groups"); |
3673 | 3673 | // modify field names to use sc. table reference |
3674 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3675 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3674 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3675 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3676 | 3676 | // get document groups for current user |
3677 | 3677 | if ($docgrp = $this->getUserDocGroups()) { |
3678 | 3678 | $docgrp = implode(",", $docgrp); |
3679 | 3679 | } |
3680 | 3680 | // build query |
3681 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3681 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3682 | 3682 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3683 | 3683 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3684 | 3684 | $resourceArray = $this->db->makeArray($result); |
@@ -3708,14 +3708,14 @@ discard block |
||
3708 | 3708 | $tbldg = $this->getFullTableName("document_groups"); |
3709 | 3709 | |
3710 | 3710 | // modify field names to use sc. table reference |
3711 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3712 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3711 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3712 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3713 | 3713 | // get document groups for current user |
3714 | 3714 | if ($docgrp = $this->getUserDocGroups()) { |
3715 | 3715 | $docgrp = implode(",", $docgrp); |
3716 | 3716 | } |
3717 | 3717 | // build query |
3718 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3718 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3719 | 3719 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3720 | 3720 | 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}"); |
3721 | 3721 | $resourceArray = $this->db->makeArray($result); |
@@ -3750,16 +3750,16 @@ discard block |
||
3750 | 3750 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
3751 | 3751 | } |
3752 | 3752 | |
3753 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : ''; |
|
3754 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : ''; |
|
3753 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : ''; |
|
3754 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : ''; |
|
3755 | 3755 | |
3756 | 3756 | if ($where != '') { |
3757 | - $where = 'AND ' . $where; |
|
3757 | + $where = 'AND '.$where; |
|
3758 | 3758 | } |
3759 | 3759 | |
3760 | 3760 | // modify field names to use sc. table reference |
3761 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3762 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3761 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3762 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3763 | 3763 | |
3764 | 3764 | // get document groups for current user |
3765 | 3765 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -3767,7 +3767,7 @@ discard block |
||
3767 | 3767 | } |
3768 | 3768 | |
3769 | 3769 | // build query |
3770 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3770 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3771 | 3771 | |
3772 | 3772 | $tblsc = $this->getFullTableName('site_content'); |
3773 | 3773 | $tbldg = $this->getFullTableName('document_groups'); |
@@ -3819,10 +3819,10 @@ discard block |
||
3819 | 3819 | return false; |
3820 | 3820 | } else { |
3821 | 3821 | // modify field names to use sc. table reference |
3822 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3823 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3822 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3823 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3824 | 3824 | if ($where != '') { |
3825 | - $where = 'AND ' . $where; |
|
3825 | + $where = 'AND '.$where; |
|
3826 | 3826 | } |
3827 | 3827 | |
3828 | 3828 | $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; |
@@ -3833,13 +3833,13 @@ discard block |
||
3833 | 3833 | $docgrp = implode(',', $docgrp); |
3834 | 3834 | } |
3835 | 3835 | |
3836 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3836 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3837 | 3837 | |
3838 | 3838 | $tblsc = $this->getFullTableName('site_content'); |
3839 | 3839 | $tbldg = $this->getFullTableName('document_groups'); |
3840 | 3840 | |
3841 | 3841 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3842 | - 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); |
|
3842 | + 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); |
|
3843 | 3843 | |
3844 | 3844 | $resourceArray = $this->db->makeArray($result); |
3845 | 3845 | |
@@ -3944,12 +3944,12 @@ discard block |
||
3944 | 3944 | $tbldg = $this->getFullTableName("document_groups"); |
3945 | 3945 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : ""; |
3946 | 3946 | // modify field names to use sc. table reference |
3947 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3947 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3948 | 3948 | // get document groups for current user |
3949 | 3949 | if ($docgrp = $this->getUserDocGroups()) { |
3950 | 3950 | $docgrp = implode(",", $docgrp); |
3951 | 3951 | } |
3952 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3952 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3953 | 3953 | $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); |
3954 | 3954 | $pageInfo = $this->db->getRow($result); |
3955 | 3955 | |
@@ -3996,7 +3996,7 @@ discard block |
||
3996 | 3996 | { |
3997 | 3997 | if ($this->currentSnippet) { |
3998 | 3998 | $tbl = $this->getFullTableName("site_snippets"); |
3999 | - $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1); |
|
3999 | + $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1); |
|
4000 | 4000 | if ($snippetId = $this->db->getValue($rs)) { |
4001 | 4001 | return $snippetId; |
4002 | 4002 | } |
@@ -4023,7 +4023,7 @@ discard block |
||
4023 | 4023 | */ |
4024 | 4024 | public function clearCache($type = '', $report = false) |
4025 | 4025 | { |
4026 | - $cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
4026 | + $cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
4027 | 4027 | if (is_array($type)) { |
4028 | 4028 | foreach ($type as $_) { |
4029 | 4029 | $this->clearCache($_, $report); |
@@ -4035,10 +4035,10 @@ discard block |
||
4035 | 4035 | $sync->emptyCache(); |
4036 | 4036 | } elseif (preg_match('@^[1-9][0-9]*$@', $type)) { |
4037 | 4037 | $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type; |
4038 | - $file_name = "docid_" . $key . "_*.pageCache.php"; |
|
4039 | - $cache_path = $cache_dir . $file_name; |
|
4038 | + $file_name = "docid_".$key."_*.pageCache.php"; |
|
4039 | + $cache_path = $cache_dir.$file_name; |
|
4040 | 4040 | $files = glob($cache_path); |
4041 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php"; |
|
4041 | + $files[] = $cache_dir."docid_".$key.".pageCache.php"; |
|
4042 | 4042 | foreach ($files as $file) { |
4043 | 4043 | if (!is_file($file)) { |
4044 | 4044 | continue; |
@@ -4046,7 +4046,7 @@ discard block |
||
4046 | 4046 | unlink($file); |
4047 | 4047 | } |
4048 | 4048 | } else { |
4049 | - $files = glob($cache_dir . '*'); |
|
4049 | + $files = glob($cache_dir.'*'); |
|
4050 | 4050 | foreach ($files as $file) { |
4051 | 4051 | $name = basename($file); |
4052 | 4052 | if (strpos($name, '.pageCache.php') === false) { |
@@ -4115,7 +4115,7 @@ discard block |
||
4115 | 4115 | $f_url_suffix = '/'; |
4116 | 4116 | } |
4117 | 4117 | |
4118 | - $alPath = !empty ($al['path']) ? $al['path'] . '/' : ''; |
|
4118 | + $alPath = !empty ($al['path']) ? $al['path'].'/' : ''; |
|
4119 | 4119 | |
4120 | 4120 | if ($al && $al['alias']) { |
4121 | 4121 | $alias = $al['alias']; |
@@ -4123,7 +4123,7 @@ discard block |
||
4123 | 4123 | |
4124 | 4124 | } |
4125 | 4125 | |
4126 | - $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix; |
|
4126 | + $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix; |
|
4127 | 4127 | $url = "{$alias}{$args}"; |
4128 | 4128 | } else { |
4129 | 4129 | $url = "index.php?id={$id}{$args}"; |
@@ -4142,7 +4142,7 @@ discard block |
||
4142 | 4142 | } |
4143 | 4143 | |
4144 | 4144 | //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080) |
4145 | - $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host; |
|
4145 | + $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host; |
|
4146 | 4146 | } |
4147 | 4147 | |
4148 | 4148 | //fix strictUrl by Bumkaka |
@@ -4151,9 +4151,9 @@ discard block |
||
4151 | 4151 | } |
4152 | 4152 | |
4153 | 4153 | if ($this->config['xhtml_urls']) { |
4154 | - $url = preg_replace("/&(?!amp;)/", "&", $host . $virtualDir . $url); |
|
4154 | + $url = preg_replace("/&(?!amp;)/", "&", $host.$virtualDir.$url); |
|
4155 | 4155 | } else { |
4156 | - $url = $host . $virtualDir . $url; |
|
4156 | + $url = $host.$virtualDir.$url; |
|
4157 | 4157 | } |
4158 | 4158 | |
4159 | 4159 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -4177,21 +4177,21 @@ discard block |
||
4177 | 4177 | if (isset($this->aliasListing[$id])) { |
4178 | 4178 | $out = $this->aliasListing[$id]; |
4179 | 4179 | } else { |
4180 | - $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id); |
|
4180 | + $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id); |
|
4181 | 4181 | if ($this->db->getRecordCount($q) == '1') { |
4182 | 4182 | $q = $this->db->getRow($q); |
4183 | 4183 | $this->aliasListing[$id] = array( |
4184 | - 'id' => (int)$q['id'], |
|
4184 | + 'id' => (int) $q['id'], |
|
4185 | 4185 | 'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'], |
4186 | - 'parent' => (int)$q['parent'], |
|
4187 | - 'isfolder' => (int)$q['isfolder'], |
|
4186 | + 'parent' => (int) $q['parent'], |
|
4187 | + 'isfolder' => (int) $q['isfolder'], |
|
4188 | 4188 | ); |
4189 | 4189 | if ($this->aliasListing[$id]['parent'] > 0) { |
4190 | 4190 | //fix alias_path_usage |
4191 | 4191 | if ($this->config['use_alias_path'] == '1') { |
4192 | 4192 | //&& $tmp['path'] != '' - fix error slash with epty path |
4193 | 4193 | $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']); |
4194 | - $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : ''); |
|
4194 | + $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : ''); |
|
4195 | 4195 | } else { |
4196 | 4196 | $this->aliasListing[$id]['path'] = ''; |
4197 | 4197 | } |
@@ -4232,7 +4232,7 @@ discard block |
||
4232 | 4232 | $out = array(); |
4233 | 4233 | if (empty($this->version) || !is_array($this->version)) { |
4234 | 4234 | //include for compatibility modx version < 1.0.10 |
4235 | - include MODX_MANAGER_PATH . "includes/version.inc.php"; |
|
4235 | + include MODX_MANAGER_PATH."includes/version.inc.php"; |
|
4236 | 4236 | $this->version = array(); |
4237 | 4237 | $this->version['version'] = isset($modx_version) ? $modx_version : ''; |
4238 | 4238 | $this->version['branch'] = isset($modx_branch) ? $modx_branch : ''; |
@@ -4254,18 +4254,18 @@ discard block |
||
4254 | 4254 | { |
4255 | 4255 | if (isset ($this->snippetCache[$snippetName])) { |
4256 | 4256 | $snippet = $this->snippetCache[$snippetName]; |
4257 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
|
4257 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : ''; |
|
4258 | 4258 | } else { // not in cache so let's check the db |
4259 | - $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "' AND ss.disabled=0;"; |
|
4259 | + $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->db->escape($snippetName)."' AND ss.disabled=0;"; |
|
4260 | 4260 | $result = $this->db->query($sql); |
4261 | 4261 | if ($this->db->getRecordCount($result) == 1) { |
4262 | 4262 | $row = $this->db->getRow($result); |
4263 | 4263 | $snippet = $this->snippetCache[$snippetName] = $row['snippet']; |
4264 | 4264 | $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties'])); |
4265 | - $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties); |
|
4265 | + $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties); |
|
4266 | 4266 | } else { |
4267 | 4267 | $snippet = $this->snippetCache[$snippetName] = "return false;"; |
4268 | - $properties = $this->snippetCache[$snippetName . "Props"] = ''; |
|
4268 | + $properties = $this->snippetCache[$snippetName."Props"] = ''; |
|
4269 | 4269 | } |
4270 | 4270 | } |
4271 | 4271 | // load default params/properties |
@@ -4365,8 +4365,8 @@ discard block |
||
4365 | 4365 | } |
4366 | 4366 | if (strpos($tpl, $s) !== false) { |
4367 | 4367 | $tpl = str_replace($s, $value, $tpl); |
4368 | - } elseif($this->debug) { |
|
4369 | - $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
4368 | + } elseif ($this->debug) { |
|
4369 | + $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
4370 | 4370 | } |
4371 | 4371 | } |
4372 | 4372 | |
@@ -4415,7 +4415,7 @@ discard block |
||
4415 | 4415 | case 'CODE': |
4416 | 4416 | break; |
4417 | 4417 | case 'FILE': |
4418 | - $template = file_get_contents(MODX_BASE_PATH . $template); |
|
4418 | + $template = file_get_contents(MODX_BASE_PATH.$template); |
|
4419 | 4419 | break; |
4420 | 4420 | case 'CHUNK': |
4421 | 4421 | $template = $this->getChunk($template); |
@@ -4448,7 +4448,7 @@ discard block |
||
4448 | 4448 | if ($mode !== 'formatOnly' && empty($timestamp)) { |
4449 | 4449 | return '-'; |
4450 | 4450 | } |
4451 | - $timestamp = (int)$timestamp; |
|
4451 | + $timestamp = (int) $timestamp; |
|
4452 | 4452 | |
4453 | 4453 | switch ($this->config['datetime_format']) { |
4454 | 4454 | case 'YYYY/mm/dd': |
@@ -4468,7 +4468,7 @@ discard block |
||
4468 | 4468 | } |
4469 | 4469 | |
4470 | 4470 | if (empty($mode)) { |
4471 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp); |
|
4471 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp); |
|
4472 | 4472 | } elseif ($mode == 'dateOnly') { |
4473 | 4473 | $strTime = strftime($dateFormat, $timestamp); |
4474 | 4474 | } elseif ($mode == 'formatOnly') { |
@@ -4522,7 +4522,7 @@ discard block |
||
4522 | 4522 | $S = 0; |
4523 | 4523 | } |
4524 | 4524 | $timeStamp = mktime($H, $M, $S, $m, $d, $Y); |
4525 | - $timeStamp = (int)$timeStamp; |
|
4525 | + $timeStamp = (int) $timeStamp; |
|
4526 | 4526 | return $timeStamp; |
4527 | 4527 | } |
4528 | 4528 | |
@@ -4564,7 +4564,7 @@ discard block |
||
4564 | 4564 | if ($v === 'value') { |
4565 | 4565 | unset($_[$i]); |
4566 | 4566 | } else { |
4567 | - $_[$i] = 'tv.' . $v; |
|
4567 | + $_[$i] = 'tv.'.$v; |
|
4568 | 4568 | } |
4569 | 4569 | } |
4570 | 4570 | $fields = implode(',', $_); |
@@ -4573,12 +4573,12 @@ discard block |
||
4573 | 4573 | } |
4574 | 4574 | |
4575 | 4575 | if ($tvsort != '') { |
4576 | - $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4576 | + $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4577 | 4577 | } |
4578 | 4578 | if ($tvidnames == "*") { |
4579 | 4579 | $query = "tv.id<>0"; |
4580 | 4580 | } else { |
4581 | - $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')"; |
|
4581 | + $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')"; |
|
4582 | 4582 | } |
4583 | 4583 | |
4584 | 4584 | $this->getUserDocGroups(); |
@@ -4722,7 +4722,7 @@ discard block |
||
4722 | 4722 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
4723 | 4723 | } |
4724 | 4724 | |
4725 | - if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) { |
|
4725 | + if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) { |
|
4726 | 4726 | return false; |
4727 | 4727 | } else { |
4728 | 4728 | |
@@ -4740,23 +4740,23 @@ discard block |
||
4740 | 4740 | } |
4741 | 4741 | |
4742 | 4742 | // get user defined template variables |
4743 | - $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4744 | - $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4743 | + $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4744 | + $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4745 | 4745 | |
4746 | 4746 | if ($idnames == '*') { |
4747 | 4747 | $query = 'tv.id<>0'; |
4748 | 4748 | } else { |
4749 | - $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; |
|
4749 | + $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; |
|
4750 | 4750 | } |
4751 | 4751 | |
4752 | - $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv |
|
4753 | - INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
4754 | - 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}" : "")); |
|
4752 | + $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv |
|
4753 | + INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id |
|
4754 | + 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}" : "")); |
|
4755 | 4755 | |
4756 | 4756 | $result = $this->db->makeArray($rs); |
4757 | 4757 | |
4758 | 4758 | // get default/built-in template variables |
4759 | - if(is_array($docRow)){ |
|
4759 | + if (is_array($docRow)) { |
|
4760 | 4760 | ksort($docRow); |
4761 | 4761 | |
4762 | 4762 | foreach ($docRow as $key => $value) { |
@@ -4794,13 +4794,13 @@ discard block |
||
4794 | 4794 | */ |
4795 | 4795 | public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '') |
4796 | 4796 | { |
4797 | - if (is_array($idnames) && empty($idnames) ) { |
|
4797 | + if (is_array($idnames) && empty($idnames)) { |
|
4798 | 4798 | return false; |
4799 | 4799 | } else { |
4800 | 4800 | $output = array(); |
4801 | 4801 | $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames); |
4802 | 4802 | |
4803 | - $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier; |
|
4803 | + $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier; |
|
4804 | 4804 | // remove sort for speed |
4805 | 4805 | $result = $this->getTemplateVars($vars, '*', $docid, $published, '', ''); |
4806 | 4806 | |
@@ -4830,7 +4830,7 @@ discard block |
||
4830 | 4830 | */ |
4831 | 4831 | public function getFullTableName($tbl) |
4832 | 4832 | { |
4833 | - return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`"; |
|
4833 | + return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`"; |
|
4834 | 4834 | } |
4835 | 4835 | |
4836 | 4836 | /** |
@@ -4909,7 +4909,7 @@ discard block |
||
4909 | 4909 | public function getCachePath() |
4910 | 4910 | { |
4911 | 4911 | global $base_url; |
4912 | - $pth = $base_url . $this->getCacheFolder(); |
|
4912 | + $pth = $base_url.$this->getCacheFolder(); |
|
4913 | 4913 | return $pth; |
4914 | 4914 | } |
4915 | 4915 | |
@@ -4961,8 +4961,8 @@ discard block |
||
4961 | 4961 | $out = false; |
4962 | 4962 | |
4963 | 4963 | if (!empty($context)) { |
4964 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4965 | - $out = $_SESSION[$context . 'InternalKey']; |
|
4964 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4965 | + $out = $_SESSION[$context.'InternalKey']; |
|
4966 | 4966 | } |
4967 | 4967 | } else { |
4968 | 4968 | switch (true) { |
@@ -4990,8 +4990,8 @@ discard block |
||
4990 | 4990 | $out = false; |
4991 | 4991 | |
4992 | 4992 | if (!empty($context)) { |
4993 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4994 | - $out = $_SESSION[$context . 'Shortname']; |
|
4993 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4994 | + $out = $_SESSION[$context.'Shortname']; |
|
4995 | 4995 | } |
4996 | 4996 | } else { |
4997 | 4997 | switch (true) { |
@@ -5062,8 +5062,8 @@ discard block |
||
5062 | 5062 | */ |
5063 | 5063 | public function getWebUserInfo($uid) |
5064 | 5064 | { |
5065 | - $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu |
|
5066 | - INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5065 | + $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu |
|
5066 | + INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5067 | 5067 | if ($row = $this->db->getRow($rs)) { |
5068 | 5068 | if (!isset($row['usertype']) or !$row["usertype"]) { |
5069 | 5069 | $row["usertype"] = "web"; |
@@ -5099,7 +5099,7 @@ discard block |
||
5099 | 5099 | } else if (is_array($dg)) { |
5100 | 5100 | // resolve ids to names |
5101 | 5101 | $dgn = array(); |
5102 | - $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")"); |
|
5102 | + $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")"); |
|
5103 | 5103 | while ($row = $this->db->getRow($ds)) { |
5104 | 5104 | $dgn[] = $row['name']; |
5105 | 5105 | } |
@@ -5127,7 +5127,7 @@ discard block |
||
5127 | 5127 | $rt = false; |
5128 | 5128 | if ($_SESSION["webValidated"] == 1) { |
5129 | 5129 | $tbl = $this->getFullTableName("web_users"); |
5130 | - $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5130 | + $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); |
|
5131 | 5131 | if ($row = $this->db->getRow($ds)) { |
5132 | 5132 | if ($row["password"] == md5($oldPwd)) { |
5133 | 5133 | if (strlen($newPwd) < 6) { |
@@ -5137,7 +5137,7 @@ discard block |
||
5137 | 5137 | } else { |
5138 | 5138 | $this->db->update(array( |
5139 | 5139 | 'password' => $this->db->escape($newPwd), |
5140 | - ), $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5140 | + ), $tbl, "id='".$this->getLoginUserID()."'"); |
|
5141 | 5141 | // invoke OnWebChangePassword event |
5142 | 5142 | $this->invokeEvent("OnWebChangePassword", array( |
5143 | 5143 | "userid" => $row["id"], |
@@ -5168,8 +5168,8 @@ discard block |
||
5168 | 5168 | // check cache |
5169 | 5169 | $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false; |
5170 | 5170 | if (!is_array($grpNames)) { |
5171 | - $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn |
|
5172 | - INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'"); |
|
5171 | + $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn |
|
5172 | + INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'"); |
|
5173 | 5173 | $grpNames = $this->db->getColumn("name", $rs); |
5174 | 5174 | // save to cache |
5175 | 5175 | $_SESSION['webUserGroupNames'] = $grpNames; |
@@ -5202,7 +5202,7 @@ discard block |
||
5202 | 5202 | if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { |
5203 | 5203 | $this->sjscripts[$nextpos] = $src; |
5204 | 5204 | } else { |
5205 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>'; |
|
5205 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>'; |
|
5206 | 5206 | } |
5207 | 5207 | } |
5208 | 5208 | |
@@ -5281,7 +5281,7 @@ discard block |
||
5281 | 5281 | } |
5282 | 5282 | |
5283 | 5283 | if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { |
5284 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>'; |
|
5284 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>'; |
|
5285 | 5285 | } |
5286 | 5286 | if ($startup) { |
5287 | 5287 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1; |
@@ -5428,7 +5428,7 @@ discard block |
||
5428 | 5428 | $eventtime = $this->getMicroTime() - $eventtime; |
5429 | 5429 | $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000); |
5430 | 5430 | foreach ($parameter as $k => $v) { |
5431 | - $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; |
|
5431 | + $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; |
|
5432 | 5432 | } |
5433 | 5433 | $this->pluginsCode .= '</fieldset><br />'; |
5434 | 5434 | $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; |
@@ -5456,13 +5456,13 @@ discard block |
||
5456 | 5456 | $plugin = array(); |
5457 | 5457 | if (isset ($this->pluginCache[$pluginName])) { |
5458 | 5458 | $pluginCode = $this->pluginCache[$pluginName]; |
5459 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : ''; |
|
5459 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : ''; |
|
5460 | 5460 | } else { |
5461 | 5461 | $pluginName = $this->db->escape($pluginName); |
5462 | 5462 | $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0"); |
5463 | 5463 | if ($row = $this->db->getRow($result)) { |
5464 | 5464 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode']; |
5465 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties']; |
|
5465 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties']; |
|
5466 | 5466 | } else { |
5467 | 5467 | $pluginCode = $this->pluginCache[$pluginName] = "return false;"; |
5468 | 5468 | $pluginProperties = ''; |
@@ -5486,7 +5486,7 @@ discard block |
||
5486 | 5486 | { |
5487 | 5487 | $property = array(); |
5488 | 5488 | |
5489 | - if(\is_scalar($propertyString)) { |
|
5489 | + if (\is_scalar($propertyString)) { |
|
5490 | 5490 | $propertyString = trim($propertyString); |
5491 | 5491 | $propertyString = str_replace('{}', '', $propertyString); |
5492 | 5492 | $propertyString = str_replace('} {', ',', $propertyString); |
@@ -5540,7 +5540,7 @@ discard block |
||
5540 | 5540 | } |
5541 | 5541 | } |
5542 | 5542 | } |
5543 | - elseif(\is_array($propertyString)) { |
|
5543 | + elseif (\is_array($propertyString)) { |
|
5544 | 5544 | $property = $propertyString; |
5545 | 5545 | } |
5546 | 5546 | if (!empty($elementName) && !empty($elementType)) { |
@@ -5571,7 +5571,7 @@ discard block |
||
5571 | 5571 | public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) |
5572 | 5572 | { |
5573 | 5573 | $params = array(); |
5574 | - $fullpath = $element_dir . '/' . $filename; |
|
5574 | + $fullpath = $element_dir.'/'.$filename; |
|
5575 | 5575 | if (is_readable($fullpath)) { |
5576 | 5576 | $tpl = @fopen($fullpath, "r"); |
5577 | 5577 | if ($tpl) { |
@@ -5738,8 +5738,8 @@ discard block |
||
5738 | 5738 | $ph = array('site_url' => MODX_SITE_URL); |
5739 | 5739 | $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/"; |
5740 | 5740 | $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'; |
5741 | - $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : ''; |
|
5742 | - $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : ''; |
|
5741 | + $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : ''; |
|
5742 | + $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : ''; |
|
5743 | 5743 | foreach ($parsed as $key => $val) { |
5744 | 5744 | if (is_array($val)) { |
5745 | 5745 | foreach ($val as $key2 => $val2) { |
@@ -5748,7 +5748,7 @@ discard block |
||
5748 | 5748 | $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2); |
5749 | 5749 | } |
5750 | 5750 | if (preg_match($regexEmail, $val2, $url)) { |
5751 | - $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2); |
|
5751 | + $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2); |
|
5752 | 5752 | } |
5753 | 5753 | $parsed[$key][$key2] = $val2; |
5754 | 5754 | } |
@@ -5758,7 +5758,7 @@ discard block |
||
5758 | 5758 | $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val); |
5759 | 5759 | } |
5760 | 5760 | if (preg_match($regexEmail, $val, $url)) { |
5761 | - $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val); |
|
5761 | + $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val); |
|
5762 | 5762 | } |
5763 | 5763 | $parsed[$key] = $val; |
5764 | 5764 | } |
@@ -5772,32 +5772,32 @@ discard block |
||
5772 | 5772 | ); |
5773 | 5773 | |
5774 | 5774 | $nl = "\n"; |
5775 | - $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : ''; |
|
5776 | - $list .= '<p>' . $nl; |
|
5777 | - $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : ''; |
|
5778 | - $list .= isset($parsed['description']) ? $parsed['description'] . $nl : ''; |
|
5779 | - $list .= '</p><br/>' . $nl; |
|
5780 | - $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : ''; |
|
5781 | - $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : ''; |
|
5782 | - $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : ''; |
|
5783 | - $list .= '<br/>' . $nl; |
|
5775 | + $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : ''; |
|
5776 | + $list .= '<p>'.$nl; |
|
5777 | + $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : ''; |
|
5778 | + $list .= isset($parsed['description']) ? $parsed['description'].$nl : ''; |
|
5779 | + $list .= '</p><br/>'.$nl; |
|
5780 | + $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : ''; |
|
5781 | + $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : ''; |
|
5782 | + $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : ''; |
|
5783 | + $list .= '<br/>'.$nl; |
|
5784 | 5784 | $first = true; |
5785 | 5785 | foreach ($arrayParams as $param => $label) { |
5786 | 5786 | if (isset($parsed[$param])) { |
5787 | 5787 | if ($first) { |
5788 | - $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl; |
|
5789 | - $list .= '<ul class="docBlockList">' . $nl; |
|
5788 | + $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl; |
|
5789 | + $list .= '<ul class="docBlockList">'.$nl; |
|
5790 | 5790 | $first = false; |
5791 | 5791 | } |
5792 | - $list .= ' <li><strong>' . $label . '</strong>' . $nl; |
|
5793 | - $list .= ' <ul>' . $nl; |
|
5792 | + $list .= ' <li><strong>'.$label.'</strong>'.$nl; |
|
5793 | + $list .= ' <ul>'.$nl; |
|
5794 | 5794 | foreach ($parsed[$param] as $val) { |
5795 | - $list .= ' <li>' . $val . '</li>' . $nl; |
|
5795 | + $list .= ' <li>'.$val.'</li>'.$nl; |
|
5796 | 5796 | } |
5797 | - $list .= ' </ul></li>' . $nl; |
|
5797 | + $list .= ' </ul></li>'.$nl; |
|
5798 | 5798 | } |
5799 | 5799 | } |
5800 | - $list .= !$first ? '</ul>' . $nl : ''; |
|
5800 | + $list .= !$first ? '</ul>'.$nl : ''; |
|
5801 | 5801 | |
5802 | 5802 | return $list; |
5803 | 5803 | } |
@@ -5872,8 +5872,8 @@ discard block |
||
5872 | 5872 | */ |
5873 | 5873 | public function addSnippet($name, $phpCode, $namespace = '#', array $defaultParams = array()) |
5874 | 5874 | { |
5875 | - $this->snippetCache[$namespace . $name] = $phpCode; |
|
5876 | - $this->snippetCache[$namespace . $name . 'Props'] = $defaultParams; |
|
5875 | + $this->snippetCache[$namespace.$name] = $phpCode; |
|
5876 | + $this->snippetCache[$namespace.$name.'Props'] = $defaultParams; |
|
5877 | 5877 | } |
5878 | 5878 | |
5879 | 5879 | /** |
@@ -5881,7 +5881,7 @@ discard block |
||
5881 | 5881 | */ |
5882 | 5882 | public function addChunk($name, $text, $namespace = '#') |
5883 | 5883 | { |
5884 | - $this->chunkCache[$namespace . $name] = $text; |
|
5884 | + $this->chunkCache[$namespace.$name] = $text; |
|
5885 | 5885 | } |
5886 | 5886 | |
5887 | 5887 | /** |
@@ -5891,7 +5891,7 @@ discard block |
||
5891 | 5891 | { |
5892 | 5892 | $out = array(); |
5893 | 5893 | |
5894 | - if (! is_dir($scanPath) || empty($ext)) { |
|
5894 | + if (!is_dir($scanPath) || empty($ext)) { |
|
5895 | 5895 | return $out; |
5896 | 5896 | } |
5897 | 5897 | $iterator = new \RecursiveIteratorIterator( |
@@ -5903,22 +5903,22 @@ discard block |
||
5903 | 5903 | * @var \SplFileInfo $item |
5904 | 5904 | */ |
5905 | 5905 | if ($item->isFile() && $item->isReadable() && \in_array($item->getExtension(), $ext)) { |
5906 | - $name = $item->getBasename('.' . $item->getExtension()); |
|
5906 | + $name = $item->getBasename('.'.$item->getExtension()); |
|
5907 | 5907 | $path = ltrim(str_replace( |
5908 | 5908 | array(rtrim($scanPath, '//'), '/'), |
5909 | 5909 | array('', '\\'), |
5910 | - $item->getPath() . '/' |
|
5910 | + $item->getPath().'/' |
|
5911 | 5911 | ), '\\'); |
5912 | 5912 | |
5913 | 5913 | if (!empty($path)) { |
5914 | - $name = $path . $name; |
|
5914 | + $name = $path.$name; |
|
5915 | 5915 | } |
5916 | 5916 | switch ($type) { |
5917 | 5917 | case 'chunk': |
5918 | 5918 | $out[$name] = file_get_contents($item->getRealPath()); |
5919 | 5919 | break; |
5920 | 5920 | case 'snippet': |
5921 | - $out[$name] = "return require '" . $item->getRealPath() . "';"; |
|
5921 | + $out[$name] = "return require '".$item->getRealPath()."';"; |
|
5922 | 5922 | break; |
5923 | 5923 | default: |
5924 | 5924 | throw new \Exception; |
@@ -5962,7 +5962,7 @@ discard block |
||
5962 | 5962 | } |
5963 | 5963 | |
5964 | 5964 | if (!$isSafe) { |
5965 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true); |
|
5965 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true); |
|
5966 | 5966 | $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50))); |
5967 | 5967 | $this->messageQuit($title, '', true, '', '', 'Parser', $msg); |
5968 | 5968 | return; |
@@ -5976,7 +5976,7 @@ discard block |
||
5976 | 5976 | return 'array()'; |
5977 | 5977 | } |
5978 | 5978 | |
5979 | - $output = $echo . $return; |
|
5979 | + $output = $echo.$return; |
|
5980 | 5980 | modx_sanitize_gpc($output); |
5981 | 5981 | return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous |
5982 | 5982 | } |
@@ -5994,8 +5994,8 @@ discard block |
||
5994 | 5994 | |
5995 | 5995 | $safe = explode(',', $safe_functions); |
5996 | 5996 | |
5997 | - $phpcode = rtrim($phpcode, ';') . ';'; |
|
5998 | - $tokens = token_get_all('<?php ' . $phpcode); |
|
5997 | + $phpcode = rtrim($phpcode, ';').';'; |
|
5998 | + $tokens = token_get_all('<?php '.$phpcode); |
|
5999 | 5999 | foreach ($tokens as $i => $token) { |
6000 | 6000 | if (!is_array($token)) { |
6001 | 6001 | continue; |
@@ -6031,7 +6031,7 @@ discard block |
||
6031 | 6031 | public function atBindFileContent($str = '') |
6032 | 6032 | { |
6033 | 6033 | |
6034 | - $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', ''); |
|
6034 | + $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', ''); |
|
6035 | 6035 | |
6036 | 6036 | if (stripos($str, '@FILE') !== 0) { |
6037 | 6037 | return $str; |
@@ -6054,7 +6054,7 @@ discard block |
||
6054 | 6054 | $errorMsg = sprintf("Could not retrieve string '%s'.", $str); |
6055 | 6055 | |
6056 | 6056 | foreach ($search_path as $path) { |
6057 | - $file_path = MODX_BASE_PATH . $path . $str; |
|
6057 | + $file_path = MODX_BASE_PATH.$path.$str; |
|
6058 | 6058 | if (strpos($file_path, MODX_MANAGER_PATH) === 0) { |
6059 | 6059 | return $errorMsg; |
6060 | 6060 | } elseif (is_file($file_path)) { |
@@ -6068,7 +6068,7 @@ discard block |
||
6068 | 6068 | return $errorMsg; |
6069 | 6069 | } |
6070 | 6070 | |
6071 | - $content = (string)file_get_contents($file_path); |
|
6071 | + $content = (string) file_get_contents($file_path); |
|
6072 | 6072 | if ($content === false) { |
6073 | 6073 | return $errorMsg; |
6074 | 6074 | } |
@@ -6177,22 +6177,22 @@ discard block |
||
6177 | 6177 | |
6178 | 6178 | $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : ''; |
6179 | 6179 | $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : ''; |
6180 | - $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; |
|
6180 | + $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; |
|
6181 | 6181 | $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']); |
6182 | 6182 | $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']); |
6183 | 6183 | $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']); |
6184 | 6184 | if ($is_error) { |
6185 | 6185 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>'; |
6186 | 6186 | if ($msg != 'PHP Parse Error') { |
6187 | - $str .= '<h3 style="color:red">' . $msg . '</h3>'; |
|
6187 | + $str .= '<h3 style="color:red">'.$msg.'</h3>'; |
|
6188 | 6188 | } |
6189 | 6189 | } else { |
6190 | 6190 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>'; |
6191 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>'; |
|
6191 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>'; |
|
6192 | 6192 | } |
6193 | 6193 | |
6194 | 6194 | if (!empty ($query)) { |
6195 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">' . $query . '</span></div>'; |
|
6195 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">'.$query.'</span></div>'; |
|
6196 | 6196 | } |
6197 | 6197 | |
6198 | 6198 | $errortype = array( |
@@ -6215,13 +6215,13 @@ discard block |
||
6215 | 6215 | |
6216 | 6216 | if (!empty($nr) || !empty($file)) { |
6217 | 6217 | if ($text != '') { |
6218 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>'; |
|
6218 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>'; |
|
6219 | 6219 | } |
6220 | 6220 | if ($output != '') { |
6221 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>'; |
|
6221 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>'; |
|
6222 | 6222 | } |
6223 | 6223 | if ($nr !== '') { |
6224 | - $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); |
|
6224 | + $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); |
|
6225 | 6225 | } |
6226 | 6226 | if ($file) { |
6227 | 6227 | $table[] = array('File', $file); |
@@ -6241,7 +6241,7 @@ discard block |
||
6241 | 6241 | } |
6242 | 6242 | |
6243 | 6243 | if (!empty($this->event->activePlugin)) { |
6244 | - $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); |
|
6244 | + $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); |
|
6245 | 6245 | } |
6246 | 6246 | |
6247 | 6247 | $str .= $MakeTable->create($table, array('Error information', '')); |
@@ -6251,17 +6251,17 @@ discard block |
||
6251 | 6251 | $table[] = array('REQUEST_URI', $request_uri); |
6252 | 6252 | |
6253 | 6253 | if ($this->manager->action) { |
6254 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
6254 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
6255 | 6255 | global $action_list; |
6256 | 6256 | $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : ''; |
6257 | 6257 | |
6258 | - $table[] = array('Manager action', $this->manager->action . $actionName); |
|
6258 | + $table[] = array('Manager action', $this->manager->action.$actionName); |
|
6259 | 6259 | } |
6260 | 6260 | |
6261 | 6261 | if (preg_match('@^[0-9]+@', $this->documentIdentifier)) { |
6262 | 6262 | $resource = $this->getDocumentObject('id', $this->documentIdentifier); |
6263 | 6263 | $url = $this->makeUrl($this->documentIdentifier, '', '', 'full'); |
6264 | - $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>'); |
|
6264 | + $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>'); |
|
6265 | 6265 | } |
6266 | 6266 | $table[] = array('Referer', $referer); |
6267 | 6267 | $table[] = array('User Agent', $ua); |
@@ -6282,7 +6282,7 @@ discard block |
||
6282 | 6282 | |
6283 | 6283 | $mem = memory_get_peak_usage(true); |
6284 | 6284 | $total_mem = $mem - $this->mstart; |
6285 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb'; |
|
6285 | + $total_mem = ($total_mem / 1024 / 1024).' mb'; |
|
6286 | 6286 | |
6287 | 6287 | $queryTime = $this->queryTime; |
6288 | 6288 | $phpTime = $totalTime - $queryTime; |
@@ -6303,18 +6303,18 @@ discard block |
||
6303 | 6303 | $str .= $this->get_backtrace(debug_backtrace()); |
6304 | 6304 | // Log error |
6305 | 6305 | if (!empty($this->currentSnippet)) { |
6306 | - $source = 'Snippet - ' . $this->currentSnippet; |
|
6306 | + $source = 'Snippet - '.$this->currentSnippet; |
|
6307 | 6307 | } elseif (!empty($this->event->activePlugin)) { |
6308 | - $source = 'Plugin - ' . $this->event->activePlugin; |
|
6308 | + $source = 'Plugin - '.$this->event->activePlugin; |
|
6309 | 6309 | } elseif ($source !== '') { |
6310 | - $source = 'Parser - ' . $source; |
|
6310 | + $source = 'Parser - '.$source; |
|
6311 | 6311 | } elseif ($query !== '') { |
6312 | 6312 | $source = 'SQL Query'; |
6313 | 6313 | } else { |
6314 | 6314 | $source = 'Parser'; |
6315 | 6315 | } |
6316 | 6316 | if ($msg) { |
6317 | - $source .= ' / ' . $msg; |
|
6317 | + $source .= ' / '.$msg; |
|
6318 | 6318 | } |
6319 | 6319 | if (isset($actionName) && !empty($actionName)) { |
6320 | 6320 | $source .= $actionName; |
@@ -6346,12 +6346,12 @@ discard block |
||
6346 | 6346 | |
6347 | 6347 | // Display error |
6348 | 6348 | if (isset($_SESSION['mgrValidated'])) { |
6349 | - 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 . ' » ' . $release_date . '</title> |
|
6349 | + 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.' » '.$release_date.'</title> |
|
6350 | 6350 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
6351 | - <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" /> |
|
6351 | + <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" /> |
|
6352 | 6352 | <style type="text/css">body { padding:10px; } td {font:inherit;}</style> |
6353 | 6353 | </head><body> |
6354 | - ' . $str . '</body></html>'; |
|
6354 | + ' . $str.'</body></html>'; |
|
6355 | 6355 | |
6356 | 6356 | } else { |
6357 | 6357 | echo 'Error'; |
@@ -6386,7 +6386,7 @@ discard block |
||
6386 | 6386 | switch ($val['type']) { |
6387 | 6387 | case '->': |
6388 | 6388 | case '::': |
6389 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function']; |
|
6389 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function']; |
|
6390 | 6390 | break; |
6391 | 6391 | default: |
6392 | 6392 | $functionName = $val['function']; |
@@ -6396,7 +6396,7 @@ discard block |
||
6396 | 6396 | $args = array_pad(array(), $_, '$var'); |
6397 | 6397 | $args = implode(", ", $args); |
6398 | 6398 | $modx = &$this; |
6399 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6399 | + $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { |
|
6400 | 6400 | $arg = $val['args'][$tmp - 1]; |
6401 | 6401 | switch (true) { |
6402 | 6402 | case is_null($arg): { |
@@ -6408,7 +6408,7 @@ discard block |
||
6408 | 6408 | break; |
6409 | 6409 | } |
6410 | 6410 | case is_scalar($arg): { |
6411 | - $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'"); |
|
6411 | + $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'"); |
|
6412 | 6412 | break; |
6413 | 6413 | } |
6414 | 6414 | case is_bool($arg): { |
@@ -6416,23 +6416,23 @@ discard block |
||
6416 | 6416 | break; |
6417 | 6417 | } |
6418 | 6418 | case is_array($arg): { |
6419 | - $out = 'array $var' . $tmp; |
|
6419 | + $out = 'array $var'.$tmp; |
|
6420 | 6420 | break; |
6421 | 6421 | } |
6422 | 6422 | case is_object($arg): { |
6423 | - $out = get_class($arg) . ' $var' . $tmp; |
|
6423 | + $out = get_class($arg).' $var'.$tmp; |
|
6424 | 6424 | break; |
6425 | 6425 | } |
6426 | 6426 | default: { |
6427 | - $out = '$var' . $tmp; |
|
6427 | + $out = '$var'.$tmp; |
|
6428 | 6428 | } |
6429 | 6429 | } |
6430 | 6430 | $tmp++; |
6431 | 6431 | return $out; |
6432 | 6432 | }, $args); |
6433 | 6433 | $line = array( |
6434 | - "<strong>" . $functionName . "</strong>(" . $args . ")", |
|
6435 | - $path . " on line " . $val['line'] |
|
6434 | + "<strong>".$functionName."</strong>(".$args.")", |
|
6435 | + $path." on line ".$val['line'] |
|
6436 | 6436 | ); |
6437 | 6437 | $table[] = array(implode("<br />", $line)); |
6438 | 6438 | } |
@@ -6473,7 +6473,7 @@ discard block |
||
6473 | 6473 | $alias = strip_tags($alias); // strip HTML |
6474 | 6474 | $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters |
6475 | 6475 | $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash |
6476 | - $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6476 | + $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6477 | 6477 | $alias = trim($alias, '-'); // trim excess |
6478 | 6478 | return $alias; |
6479 | 6479 | } |
@@ -6489,7 +6489,7 @@ discard block |
||
6489 | 6489 | $precisions = count($sizes) - 1; |
6490 | 6490 | foreach ($sizes as $unit => $bytes) { |
6491 | 6491 | if ($size >= $bytes) { |
6492 | - return number_format($size / $bytes, $precisions) . ' ' . $unit; |
|
6492 | + return number_format($size / $bytes, $precisions).' '.$unit; |
|
6493 | 6493 | } |
6494 | 6494 | $precisions--; |
6495 | 6495 | } |
@@ -6593,10 +6593,10 @@ discard block |
||
6593 | 6593 | |
6594 | 6594 | if (strpos($str, MODX_MANAGER_PATH) === 0) { |
6595 | 6595 | return false; |
6596 | - } elseif (is_file(MODX_BASE_PATH . $str)) { |
|
6597 | - $file_path = MODX_BASE_PATH . $str; |
|
6598 | - } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { |
|
6599 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str; |
|
6596 | + } elseif (is_file(MODX_BASE_PATH.$str)) { |
|
6597 | + $file_path = MODX_BASE_PATH.$str; |
|
6598 | + } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { |
|
6599 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str; |
|
6600 | 6600 | } else { |
6601 | 6601 | return false; |
6602 | 6602 | } |
@@ -6722,7 +6722,7 @@ discard block |
||
6722 | 6722 | $title = 'no title'; |
6723 | 6723 | } |
6724 | 6724 | if (is_array($msg)) { |
6725 | - $msg = '<pre>' . print_r($msg, true) . '</pre>'; |
|
6725 | + $msg = '<pre>'.print_r($msg, true).'</pre>'; |
|
6726 | 6726 | } elseif ($msg === '') { |
6727 | 6727 | $msg = $_SERVER['REQUEST_URI']; |
6728 | 6728 | } |