@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!function_exists('import_sql')) { |
|
2 | +if (!function_exists('import_sql')) { |
|
3 | 3 | /** |
4 | 4 | * @param string $source |
5 | 5 | * @param string $result_code |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | -if(!function_exists('dumpSql')) { |
|
43 | +if (!function_exists('dumpSql')) { |
|
44 | 44 | /** |
45 | 45 | * @param string $dumpstring |
46 | 46 | * @return bool |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | -if(!function_exists('snapshot')) { |
|
69 | +if (!function_exists('snapshot')) { |
|
70 | 70 | /** |
71 | 71 | * @param string $dumpstring |
72 | 72 | * @return bool |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | -if(!function_exists('getSettings')) { |
|
83 | +if (!function_exists('getSettings')) { |
|
84 | 84 | /** |
85 | 85 | * @return array |
86 | 86 | */ |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | -if(!function_exists('restoreSettings')) { |
|
110 | +if (!function_exists('restoreSettings')) { |
|
111 | 111 | /** |
112 | 112 | * @param array $settings |
113 | 113 | */ |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
125 | -if(!function_exists('parsePlaceholder')) { |
|
125 | +if (!function_exists('parsePlaceholder')) { |
|
126 | 126 | /** |
127 | 127 | * @param string $tpl |
128 | 128 | * @param array $ph |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!function_exists('render_form')) { |
|
3 | +if (!function_exists('render_form')) { |
|
4 | 4 | /** |
5 | 5 | * @param string $name |
6 | 6 | * @param string $label |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!function_exists('array_unique_multi')) { |
|
2 | +if (!function_exists('array_unique_multi')) { |
|
3 | 3 | /** |
4 | 4 | * @param array $array |
5 | 5 | * @param string $checkKey |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | -if(!function_exists('record_sort')) { |
|
30 | +if (!function_exists('record_sort')) { |
|
31 | 31 | /** |
32 | 32 | * @param array $array |
33 | 33 | * @param string $key |
@@ -16,8 +16,8 @@ |
||
16 | 16 | { |
17 | 17 | echo '<div class="row form-row"> |
18 | 18 | <div class="col-sm-6 col-md-4 col-lg-3">' . |
19 | - implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames) . |
|
20 | - '</div>' . |
|
19 | + implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames). |
|
20 | + '</div>'. |
|
21 | 21 | '</div>'; |
22 | 22 | |
23 | 23 | $evtnames = array(); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!function_exists('get_lang_keys')) { |
|
2 | +if (!function_exists('get_lang_keys')) { |
|
3 | 3 | /** |
4 | 4 | * get_lang_keys |
5 | 5 | * |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | function get_lang_keys($filename) |
10 | 10 | { |
11 | - $file = MODX_MANAGER_PATH . 'includes/lang' . DIRECTORY_SEPARATOR . $filename; |
|
11 | + $file = MODX_MANAGER_PATH.'includes/lang'.DIRECTORY_SEPARATOR.$filename; |
|
12 | 12 | if (is_file($file) && is_readable($file)) { |
13 | 13 | include($file); |
14 | 14 | $out = isset($_lang) ? array_keys($_lang) : array(); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | -if(!function_exists('get_langs_by_key')) { |
|
23 | +if (!function_exists('get_langs_by_key')) { |
|
24 | 24 | /** |
25 | 25 | * get_langs_by_key |
26 | 26 | * |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | -if(!function_exists('get_lang_options')) { |
|
44 | +if (!function_exists('get_lang_options')) { |
|
45 | 45 | /** |
46 | 46 | * get_lang_options |
47 | 47 | * |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | if (!empty($key)) { |
58 | 58 | $languages = get_langs_by_key($key, $lang_keys); |
59 | 59 | sort($languages); |
60 | - $lang_options .= '<option value="">' . $_lang['language_title'] . '</option>'; |
|
60 | + $lang_options .= '<option value="">'.$_lang['language_title'].'</option>'; |
|
61 | 61 | |
62 | 62 | foreach ($languages as $language_name) { |
63 | 63 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
64 | - $lang_options .= '<option value="' . $language_name . '">' . $uclanguage_name . '</option>'; |
|
64 | + $lang_options .= '<option value="'.$language_name.'">'.$uclanguage_name.'</option>'; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | return $lang_options; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | foreach ($languages as $language_name) { |
72 | 72 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
73 | 73 | $sel = $language_name === $selected_lang ? ' selected="selected"' : ''; |
74 | - $lang_options .= '<option value="' . $language_name . '" ' . $sel . '>' . $uclanguage_name . '</option>'; |
|
74 | + $lang_options .= '<option value="'.$language_name.'" '.$sel.'>'.$uclanguage_name.'</option>'; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | return $lang_options; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | -if(!function_exists('form_radio')) { |
|
82 | +if (!function_exists('form_radio')) { |
|
83 | 83 | /** |
84 | 84 | * @param string $name |
85 | 85 | * @param string $value |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $disabled = ''; |
99 | 99 | } |
100 | 100 | if ($add) { |
101 | - $add = ' ' . $add; |
|
101 | + $add = ' '.$add; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name, |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | -if(!function_exists('wrap_label')) { |
|
110 | +if (!function_exists('wrap_label')) { |
|
111 | 111 | /** |
112 | 112 | * @param string $str |
113 | 113 | * @param string $object |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | } |
122 | 122 | |
123 | -if(!function_exists('parseText')) { |
|
123 | +if (!function_exists('parseText')) { |
|
124 | 124 | /** |
125 | 125 | * @param string $tpl |
126 | 126 | * @param array $ph |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
144 | -if(!function_exists('showHide')) { |
|
144 | +if (!function_exists('showHide')) { |
|
145 | 145 | /** |
146 | 146 | * @param bool $cond |
147 | 147 | * @return string |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (! function_exists('app_path')) { |
|
2 | +if (!function_exists('app_path')) { |
|
3 | 3 | /** |
4 | 4 | * Get the path to the application folder. |
5 | 5 | * |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | } |
13 | 13 | } |
14 | 14 | |
15 | -if (! function_exists('config_path')) { |
|
15 | +if (!function_exists('config_path')) { |
|
16 | 16 | /** |
17 | 17 | * Get the configuration path. |
18 | 18 | * |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | } |
26 | 26 | } |
27 | 27 | |
28 | -if (! function_exists('base_path')) { |
|
28 | +if (!function_exists('base_path')) { |
|
29 | 29 | /** |
30 | 30 | * Get the path to the base of the install. |
31 | 31 | * |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
41 | -if (! function_exists('config')) { |
|
41 | +if (!function_exists('config')) { |
|
42 | 42 | /** |
43 | 43 | * Get / set the specified configuration value. |
44 | 44 | * |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | -if (! function_exists('app')) { |
|
65 | +if (!function_exists('app')) { |
|
66 | 66 | /** |
67 | 67 | * Get the available container instance. |
68 | 68 | * |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if (! function_exists('var_debug')) { |
|
2 | +if (!function_exists('var_debug')) { |
|
3 | 3 | /** |
4 | 4 | * Dumps information about a variable in Tracy Debug Bar. |
5 | 5 | * @tracySkipLocation |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | -if(!function_exists('duplicateDocument')) { |
|
39 | +if (!function_exists('duplicateDocument')) { |
|
40 | 40 | /** |
41 | 41 | * @param int $docid |
42 | 42 | * @param null|int $parent |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('pagetitle', $modx->getDatabase()->getFullTableName('site_content'), |
91 | 91 | "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
92 | 92 | if ($count >= 1) { |
93 | - $count = ' ' . ($count + 1); |
|
93 | + $count = ' '.($count + 1); |
|
94 | 94 | } else { |
95 | 95 | $count = ''; |
96 | 96 | } |
97 | 97 | |
98 | - $content['pagetitle'] = $_lang['duplicated_el_suffix'] . $count . ' ' . $content['pagetitle']; |
|
98 | + $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
|
99 | 99 | $content['alias'] = null; |
100 | 100 | } elseif ($modx->getConfig('friendly_urls') == 0 || $modx->getConfig('allow_duplicate_alias') == 0) { |
101 | 101 | $content['alias'] = null; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | -if(!function_exists('duplicateTVs')) { |
|
156 | +if (!function_exists('duplicateTVs')) { |
|
157 | 157 | /** |
158 | 158 | * Duplicate Document TVs |
159 | 159 | * |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | |
167 | 167 | $tbltvc = $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues'); |
168 | 168 | |
169 | - $newid = (int)$newid; |
|
170 | - $oldid = (int)$oldid; |
|
169 | + $newid = (int) $newid; |
|
170 | + $oldid = (int) $oldid; |
|
171 | 171 | |
172 | 172 | $modx->getDatabase()->insert( |
173 | 173 | array('contentid' => '', 'tmplvarid' => '', 'value' => ''), $tbltvc, // Insert into |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | -if(!function_exists('duplicateAccess')) { |
|
179 | +if (!function_exists('duplicateAccess')) { |
|
180 | 180 | /** |
181 | 181 | * Duplicate Document Access Permissions |
182 | 182 | * |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | |
190 | 190 | $tbldg = $modx->getDatabase()->getFullTableName('document_groups'); |
191 | 191 | |
192 | - $newid = (int)$newid; |
|
193 | - $oldid = (int)$oldid; |
|
192 | + $newid = (int) $newid; |
|
193 | + $oldid = (int) $oldid; |
|
194 | 194 | |
195 | 195 | $modx->getDatabase()->insert( |
196 | 196 | array('document' => '', 'document_group' => ''), $tbldg, // Insert into |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | -if(!function_exists('evalModule')) { |
|
202 | +if (!function_exists('evalModule')) { |
|
203 | 203 | /** |
204 | 204 | * evalModule |
205 | 205 | * |
@@ -235,17 +235,17 @@ discard block |
||
235 | 235 | } |
236 | 236 | if ($modx->getConfig('error_reporting') === '99' || 2 < $error_level) { |
237 | 237 | $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], |
238 | - $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
238 | + $_SESSION['itemname'].' - Module', $error_info['message'], $error_info['line'], $msg); |
|
239 | 239 | $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
240 | 240 | } |
241 | 241 | } |
242 | 242 | unset($modx->event->params); |
243 | 243 | |
244 | - return $mod . $msg; |
|
244 | + return $mod.$msg; |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | |
248 | -if(!function_exists('allChildren')) { |
|
248 | +if (!function_exists('allChildren')) { |
|
249 | 249 | /** |
250 | 250 | * @param int $currDocID |
251 | 251 | * @return array |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | } |
270 | 270 | } |
271 | 271 | |
272 | -if(!function_exists('jsAlert')) { |
|
272 | +if (!function_exists('jsAlert')) { |
|
273 | 273 | /** |
274 | 274 | * show javascript alert |
275 | 275 | * |
@@ -279,14 +279,14 @@ discard block |
||
279 | 279 | { |
280 | 280 | $modx = evolutionCMS(); |
281 | 281 | if ($_POST['ajax'] != 1) { |
282 | - echo "<script>window.setTimeout(\"alert('" . addslashes($modx->getDatabase()->escape($msg)) . "')\",10);history.go(-1)</script>"; |
|
282 | + echo "<script>window.setTimeout(\"alert('".addslashes($modx->getDatabase()->escape($msg))."')\",10);history.go(-1)</script>"; |
|
283 | 283 | } else { |
284 | - echo $msg . "\n"; |
|
284 | + echo $msg."\n"; |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | } |
288 | 288 | |
289 | -if(!function_exists('login')) { |
|
289 | +if (!function_exists('login')) { |
|
290 | 290 | /** |
291 | 291 | * @param string $username |
292 | 292 | * @param string $givenPassword |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | } |
302 | 302 | } |
303 | 303 | |
304 | -if(!function_exists('loginV1')) { |
|
304 | +if (!function_exists('loginV1')) { |
|
305 | 305 | /** |
306 | 306 | * @param int $internalKey |
307 | 307 | * @param string $givenPassword |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | } |
335 | 335 | } |
336 | 336 | |
337 | -if(!function_exists('loginMD5')) { |
|
337 | +if (!function_exists('loginMD5')) { |
|
338 | 338 | /** |
339 | 339 | * @param int $internalKey |
340 | 340 | * @param string $givenPassword |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | } |
356 | 356 | } |
357 | 357 | |
358 | -if(!function_exists('updateNewHash')) { |
|
358 | +if (!function_exists('updateNewHash')) { |
|
359 | 359 | /** |
360 | 360 | * @param string $username |
361 | 361 | * @param string $password |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
377 | -if(!function_exists('incrementFailedLoginCount')) { |
|
377 | +if (!function_exists('incrementFailedLoginCount')) { |
|
378 | 378 | /** |
379 | 379 | * @param int $internalKey |
380 | 380 | * @param int $failedlogins |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | |
402 | 402 | if ($failedlogins < $failed_allowed) { |
403 | 403 | //sleep to help prevent brute force attacks |
404 | - $sleep = (int)$failedlogins / 2; |
|
404 | + $sleep = (int) $failedlogins / 2; |
|
405 | 405 | if ($sleep > 5) { |
406 | 406 | $sleep = 5; |
407 | 407 | } |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | } |
415 | 415 | } |
416 | 416 | |
417 | -if(!function_exists('saveUserGroupAccessPermissons')) { |
|
417 | +if (!function_exists('saveUserGroupAccessPermissons')) { |
|
418 | 418 | /** |
419 | 419 | * saves module user group access |
420 | 420 | */ |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | } |
446 | 446 | } |
447 | 447 | |
448 | -if(!function_exists('saveEventListeners')) { |
|
448 | +if (!function_exists('saveEventListeners')) { |
|
449 | 449 | # Save Plugin Event Listeners |
450 | 450 | function saveEventListeners($id, $sysevents, $mode) |
451 | 451 | { |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | } else { |
476 | 476 | $priority = isset($prevPriority) ? $prevPriority : 1; |
477 | 477 | } |
478 | - $priority = (int)$priority; |
|
478 | + $priority = (int) $priority; |
|
479 | 479 | $formEventList[] = array('pluginid' => $id, 'evtid' => $evtId, 'priority' => $priority); |
480 | 480 | } |
481 | 481 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | } |
517 | 517 | } |
518 | 518 | |
519 | -if(!function_exists('getEventIdByName')) { |
|
519 | +if (!function_exists('getEventIdByName')) { |
|
520 | 520 | /** |
521 | 521 | * @param string $name |
522 | 522 | * @return string|int |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | } |
543 | 543 | } |
544 | 544 | |
545 | -if(!function_exists('saveTemplateAccess')) { |
|
545 | +if (!function_exists('saveTemplateAccess')) { |
|
546 | 546 | /** |
547 | 547 | * @param int $id |
548 | 548 | */ |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | } |
581 | 581 | } |
582 | 582 | |
583 | -if(!function_exists('saveTemplateVarAccess')) { |
|
583 | +if (!function_exists('saveTemplateVarAccess')) { |
|
584 | 584 | /** |
585 | 585 | * @return void |
586 | 586 | */ |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | } |
611 | 611 | } |
612 | 612 | |
613 | -if(!function_exists('saveDocumentAccessPermissons')) { |
|
613 | +if (!function_exists('saveDocumentAccessPermissons')) { |
|
614 | 614 | function saveDocumentAccessPermissons($id) |
615 | 615 | { |
616 | 616 | $modx = evolutionCMS(); |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | $docgroups = isset($_POST['docgroups']) ? $_POST['docgroups'] : ''; |
619 | 619 | |
620 | 620 | // check for permission update access |
621 | - if($modx->getConfig('use_udperms') == 1) { |
|
621 | + if ($modx->getConfig('use_udperms') == 1) { |
|
622 | 622 | // delete old permissions on the tv |
623 | 623 | EvolutionCMS\Models\SiteTmplvarAccess::where('tmplvarid', '=', $id)->delete(); |
624 | 624 | if (is_array($docgroups)) { |
@@ -769,10 +769,10 @@ discard block |
||
769 | 769 | } |
770 | 770 | |
771 | 771 | foreach ($defaults as $k) { |
772 | - if (isset($settings['default_' . $k]) && $settings['default_' . $k] == '1') { |
|
772 | + if (isset($settings['default_'.$k]) && $settings['default_'.$k] == '1') { |
|
773 | 773 | unset($settings[$k]); |
774 | 774 | } |
775 | - unset($settings['default_' . $k]); |
|
775 | + unset($settings['default_'.$k]); |
|
776 | 776 | } |
777 | 777 | |
778 | 778 | $modx->getDatabase()->delete($tbl_user_settings, "user='{$id}'"); |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | global $id, $modx; |
805 | 805 | $mode = $_POST['mode']; |
806 | 806 | $modx->getManagerApi()->saveFormValues($mode); |
807 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode === $action ? "&id={$id}" : '')); |
|
807 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode === $action ? "&id={$id}" : '')); |
|
808 | 808 | } |
809 | 809 | } |
810 | 810 | |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | global $deltime; |
821 | 821 | |
822 | 822 | $rs = $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('site_content'), |
823 | - "parent='" . (int)$parent . "' AND deleted=1 AND deletedon='" . (int)$deltime . "'"); |
|
823 | + "parent='".(int) $parent."' AND deleted=1 AND deletedon='".(int) $deltime."'"); |
|
824 | 824 | // the document has children documents, we'll need to delete those too |
825 | 825 | while ($row = $modx->getDatabase()->getRow($rs)) { |
826 | 826 | $children[] = $row['id']; |
@@ -384,10 +384,12 @@ |
||
384 | 384 | $failedlogins += 1; |
385 | 385 | |
386 | 386 | $fields = array('failedlogincount' => $failedlogins); |
387 | - if ($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
387 | + if ($failedlogins >= $failed_allowed) { |
|
388 | + //block user for too many fail attempts |
|
388 | 389 | { |
389 | 390 | $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
390 | 391 | } |
392 | + } |
|
391 | 393 | |
392 | 394 | $modx->getDatabase()->update( |
393 | 395 | $fields, |
@@ -1,52 +1,52 @@ discard block |
||
1 | 1 | <?php |
2 | -if (! defined('HTTPS_PORT')) { |
|
2 | +if (!defined('HTTPS_PORT')) { |
|
3 | 3 | define('HTTPS_PORT', env('HTTPS_PORT', '443')); //$https_port |
4 | 4 | } |
5 | 5 | |
6 | -if (! defined('SESSION_COOKIE_PATH')) { |
|
6 | +if (!defined('SESSION_COOKIE_PATH')) { |
|
7 | 7 | define('SESSION_COOKIE_PATH', env('SESSION_COOKIE_PATH', '')); // $session_cookie_path |
8 | 8 | } |
9 | 9 | |
10 | -if (! defined('SESSION_COOKIE_DOMAIN')) { |
|
10 | +if (!defined('SESSION_COOKIE_DOMAIN')) { |
|
11 | 11 | define('SESSION_COOKIE_DOMAIN', env('SESSION_COOKIE_DOMAIN', '')); //$session_cookie_domain |
12 | 12 | } |
13 | 13 | |
14 | -if (! defined('SESSION_COOKIE_NAME')) { |
|
14 | +if (!defined('SESSION_COOKIE_NAME')) { |
|
15 | 15 | // For legacy extras not using startCMSSession |
16 | 16 | define('SESSION_COOKIE_NAME', env('SESSION_COOKIE_NAME', genEvoSessionName())); // $site_sessionname |
17 | 17 | } |
18 | 18 | |
19 | -if (! defined('MODX_CLASS')) { |
|
19 | +if (!defined('MODX_CLASS')) { |
|
20 | 20 | define('MODX_CLASS', env('MODX_CLASS', '\DocumentParser')); |
21 | 21 | } |
22 | 22 | |
23 | -if (! defined('MODX_SITE_HOSTNAMES')) { |
|
23 | +if (!defined('MODX_SITE_HOSTNAMES')) { |
|
24 | 24 | define('MODX_SITE_HOSTNAMES', env('MODX_SITE_HOSTNAMES', '')); |
25 | 25 | } |
26 | 26 | |
27 | -if (! defined('MGR_DIR')) { |
|
27 | +if (!defined('MGR_DIR')) { |
|
28 | 28 | define('MGR_DIR', env('MGR_DIR', 'manager')); |
29 | 29 | } |
30 | 30 | |
31 | -if (! defined('EVO_CORE_PATH')) { |
|
32 | - define('EVO_CORE_PATH', env('EVO_CORE_PATH', dirname(__DIR__) . '/')); |
|
31 | +if (!defined('EVO_CORE_PATH')) { |
|
32 | + define('EVO_CORE_PATH', env('EVO_CORE_PATH', dirname(__DIR__).'/')); |
|
33 | 33 | } |
34 | 34 | |
35 | -if (! defined('EVO_STORAGE_PATH')) { |
|
36 | - define('EVO_STORAGE_PATH', env('EVO_STORAGE_PATH', EVO_CORE_PATH . 'storage/')); |
|
35 | +if (!defined('EVO_STORAGE_PATH')) { |
|
36 | + define('EVO_STORAGE_PATH', env('EVO_STORAGE_PATH', EVO_CORE_PATH.'storage/')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | if (is_cli()) { |
40 | - if (! (defined('MODX_BASE_PATH') || defined('MODX_BASE_URL'))) { |
|
40 | + if (!(defined('MODX_BASE_PATH') || defined('MODX_BASE_URL'))) { |
|
41 | 41 | throw new RuntimeException('Please, define MODX_BASE_PATH and MODX_BASE_URL on cli mode'); |
42 | 42 | } |
43 | 43 | |
44 | - if (! defined('MODX_SITE_URL')) { |
|
44 | + if (!defined('MODX_SITE_URL')) { |
|
45 | 45 | throw new RuntimeException('Please, define MODX_SITE_URL on cli mode'); |
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | -if (! defined('MODX_BASE_PATH') || ! defined('MODX_BASE_URL')) { |
|
49 | +if (!defined('MODX_BASE_PATH') || !defined('MODX_BASE_URL')) { |
|
50 | 50 | // automatically assign base_path and base_url |
51 | 51 | $script_name = str_replace( |
52 | 52 | '\\', |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | ) |
61 | 61 | ); |
62 | 62 | |
63 | - if (substr($script_name, -1 - strlen(MGR_DIR)) === '/' . MGR_DIR || |
|
64 | - strpos($script_name, '/' . MGR_DIR . '/') !== false |
|
63 | + if (substr($script_name, -1 - strlen(MGR_DIR)) === '/'.MGR_DIR || |
|
64 | + strpos($script_name, '/'.MGR_DIR.'/') !== false |
|
65 | 65 | ) { |
66 | 66 | $separator = MGR_DIR; |
67 | 67 | } elseif (strpos($script_name, '/assets/') !== false) { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | if ($separator !== '') { |
74 | - $items = explode('/' . $separator, $script_name); |
|
74 | + $items = explode('/'.$separator, $script_name); |
|
75 | 75 | } else { |
76 | 76 | $items = array($script_name); |
77 | 77 | } |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | $pth = implode(MGR_DIR, $items); |
93 | 93 | unset($items); |
94 | 94 | |
95 | - $base_url = $url . (substr($url, -1) !== '/' ? '/' : ''); |
|
95 | + $base_url = $url.(substr($url, -1) !== '/' ? '/' : ''); |
|
96 | 96 | unset($url); |
97 | 97 | |
98 | - $base_path = $pth . (substr($pth, -1) !== '/' && substr($pth, -1) !== '\\' ? '/' : ''); |
|
98 | + $base_path = $pth.(substr($pth, -1) !== '/' && substr($pth, -1) !== '\\' ? '/' : ''); |
|
99 | 99 | unset($pth); |
100 | 100 | |
101 | 101 | if (!defined('MODX_BASE_PATH')) { |
@@ -109,30 +109,30 @@ discard block |
||
109 | 109 | unset($base_url); |
110 | 110 | } |
111 | 111 | |
112 | -if (! preg_match('/\/$/', MODX_BASE_PATH)) { |
|
112 | +if (!preg_match('/\/$/', MODX_BASE_PATH)) { |
|
113 | 113 | throw new RuntimeException('Please, use trailing slash at the end of MODX_BASE_PATH'); |
114 | 114 | } |
115 | 115 | |
116 | -if (! preg_match('/\/$/', MODX_BASE_URL)) { |
|
116 | +if (!preg_match('/\/$/', MODX_BASE_URL)) { |
|
117 | 117 | throw new RuntimeException('Please, use trailing slash at the end of MODX_BASE_URL'); |
118 | 118 | } |
119 | 119 | |
120 | -if (! defined('MODX_MANAGER_PATH')) { |
|
121 | - define('MODX_MANAGER_PATH', env('MODX_MANAGER_PATH', MODX_BASE_PATH . MGR_DIR . '/')); |
|
120 | +if (!defined('MODX_MANAGER_PATH')) { |
|
121 | + define('MODX_MANAGER_PATH', env('MODX_MANAGER_PATH', MODX_BASE_PATH.MGR_DIR.'/')); |
|
122 | 122 | } |
123 | 123 | |
124 | -if (! defined('MODX_SITE_URL')) { |
|
124 | +if (!defined('MODX_SITE_URL')) { |
|
125 | 125 | // check for valid hostnames |
126 | 126 | $site_hostname = 'localhost'; |
127 | - if (! is_cli()) { |
|
127 | + if (!is_cli()) { |
|
128 | 128 | $site_hostname = str_replace( |
129 | - ':' . $_SERVER['SERVER_PORT'], |
|
129 | + ':'.$_SERVER['SERVER_PORT'], |
|
130 | 130 | '', |
131 | 131 | get_by_key($_SERVER, 'HTTP_HOST', $site_hostname) |
132 | 132 | ); |
133 | 133 | } |
134 | 134 | $site_hostnames = explode(',', MODX_SITE_HOSTNAMES); |
135 | - if (! empty($site_hostnames[0]) && ! in_array($site_hostname, $site_hostnames)) { |
|
135 | + if (!empty($site_hostnames[0]) && !in_array($site_hostname, $site_hostnames)) { |
|
136 | 136 | $site_hostname = $site_hostnames[0]; |
137 | 137 | } |
138 | 138 | unset($site_hostnames); |
@@ -142,20 +142,20 @@ discard block |
||
142 | 142 | $_SERVER['SERVER_PORT'] == HTTPS_PORT || |
143 | 143 | (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') |
144 | 144 | ) { |
145 | - $site_url = 'https://' . $site_hostname; |
|
145 | + $site_url = 'https://'.$site_hostname; |
|
146 | 146 | } else { |
147 | - $site_url = 'http://' . $site_hostname; |
|
147 | + $site_url = 'http://'.$site_hostname; |
|
148 | 148 | } |
149 | 149 | unset($site_hostname); |
150 | 150 | |
151 | 151 | if ($_SERVER['SERVER_PORT'] !== 80) { // remove port from HTTP_HOST |
152 | - $site_url = str_replace(':' . $_SERVER['SERVER_PORT'], '', $site_url); |
|
152 | + $site_url = str_replace(':'.$_SERVER['SERVER_PORT'], '', $site_url); |
|
153 | 153 | } |
154 | 154 | |
155 | - if (! in_array((int)$_SERVER['SERVER_PORT'], [80, (int)HTTPS_PORT], true) && |
|
155 | + if (!in_array((int) $_SERVER['SERVER_PORT'], [80, (int) HTTPS_PORT], true) && |
|
156 | 156 | strtolower(get_by_key($_SERVER, 'HTTPS', 'off')) |
157 | 157 | ) { |
158 | - $site_url .= ':' . $_SERVER['SERVER_PORT']; |
|
158 | + $site_url .= ':'.$_SERVER['SERVER_PORT']; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | $site_url .= MODX_BASE_URL; |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | unset($site_url); |
165 | 165 | } |
166 | 166 | |
167 | -if (! preg_match('/\/$/', MODX_SITE_URL)) { |
|
167 | +if (!preg_match('/\/$/', MODX_SITE_URL)) { |
|
168 | 168 | throw new RuntimeException('Please, use trailing slash at the end of MODX_SITE_URL'); |
169 | 169 | } |
170 | 170 | |
171 | -if (! defined('MODX_MANAGER_URL')) { |
|
172 | - define('MODX_MANAGER_URL', env('MODX_MANAGER_URL', MODX_SITE_URL . MGR_DIR . '/')); |
|
171 | +if (!defined('MODX_MANAGER_URL')) { |
|
172 | + define('MODX_MANAGER_URL', env('MODX_MANAGER_URL', MODX_SITE_URL.MGR_DIR.'/')); |
|
173 | 173 | } |
174 | 174 | |
175 | -if (! defined('MODX_SANITIZE_SEED')) { |
|
176 | - define('MODX_SANITIZE_SEED', 'sanitize_seed_' . base_convert(md5(__FILE__), 16, 36)); |
|
175 | +if (!defined('MODX_SANITIZE_SEED')) { |
|
176 | + define('MODX_SANITIZE_SEED', 'sanitize_seed_'.base_convert(md5(__FILE__), 16, 36)); |
|
177 | 177 | } |
@@ -148,7 +148,8 @@ |
||
148 | 148 | } |
149 | 149 | unset($site_hostname); |
150 | 150 | |
151 | - if ($_SERVER['SERVER_PORT'] !== 80) { // remove port from HTTP_HOST |
|
151 | + if ($_SERVER['SERVER_PORT'] !== 80) { |
|
152 | +// remove port from HTTP_HOST |
|
152 | 153 | $site_url = str_replace(':' . $_SERVER['SERVER_PORT'], '', $site_url); |
153 | 154 | } |
154 | 155 |