@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | <select name="manager_theme" size="1" class="inputBox" onChange="documentDirty=true; document.forms['settings'].theme_refresher.value = Date.parse(new Date());"> |
50 | 50 | <?php |
51 | 51 | $dir = dir("media/style/"); |
52 | - while ($file = $dir->read()) { |
|
53 | - if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
54 | - if ($file === 'common') { |
|
52 | + while ($file = $dir->read()) { |
|
53 | + if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
54 | + if ($file === 'common') { |
|
55 | 55 | continue; |
56 | 56 | } |
57 | 57 | $themename = $file; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $tpl = '<option value="[+value+]" [+selected+]>[+title+]</option>' . "\n"; |
210 | 210 | $option = explode(',', $_lang['settings_group_tv_options']); |
211 | 211 | $output = array(); |
212 | - foreach ($option as $k => $v) { |
|
212 | + foreach ($option as $k => $v) { |
|
213 | 213 | $selected = ($k == $group_tvs) ? 'selected' : ''; |
214 | 214 | $s = array('[+value+]', '[+selected+]', '[+title+]'); |
215 | 215 | $r = array($k, $selected, $v); |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $tpl = '<option value="[+value+]" [+selected+]>[*[+value+]*]</option>' . "\n"; |
283 | 283 | $option = array('pagetitle', 'longtitle', 'menutitle', 'alias', 'createdon', 'editedon', 'publishedon'); |
284 | 284 | $output = array(); |
285 | - foreach ($option as $v) { |
|
285 | + foreach ($option as $v) { |
|
286 | 286 | $selected = ($v == $resource_tree_node_name) ? 'selected' : ''; |
287 | 287 | $s = array('[+value+]', '[+selected+]'); |
288 | 288 | $r = array($v, $selected); |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | <?php |
364 | 364 | $datetime_format_list = array('dd-mm-YYYY', 'mm/dd/YYYY', 'YYYY/mm/dd'); |
365 | 365 | $str = ''; |
366 | - foreach ($datetime_format_list as $value) { |
|
366 | + foreach ($datetime_format_list as $value) { |
|
367 | 367 | $selectedtext = ($datetime_format == $value) ? ' selected' : ''; |
368 | 368 | $str .= '<option value="' . $value . '"' . $selectedtext . '>'; |
369 | 369 | $str .= $value . '</option>' . PHP_EOL; |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | <?php |
446 | 446 | // invoke OnRichTextEditorRegister event |
447 | 447 | $evtOut = $modx->invokeEvent('OnRichTextEditorRegister'); |
448 | - if (!is_array($evtOut)) { |
|
448 | + if (!is_array($evtOut)) { |
|
449 | 449 | $evtOut = array(); |
450 | 450 | $use_editor = 0; |
451 | 451 | } |
@@ -477,8 +477,8 @@ discard block |
||
477 | 477 | <?php |
478 | 478 | // invoke OnRichTextEditorRegister event |
479 | 479 | echo "<option value='none'" . ($which_editor == 'none' ? " selected='selected'" : "") . ">" . $_lang['none'] . "</option>\n"; |
480 | - if (is_array($evtOut)) { |
|
481 | - foreach ($evtOut as $editor) { |
|
480 | + if (is_array($evtOut)) { |
|
481 | + foreach ($evtOut as $editor) { |
|
482 | 482 | echo "<option value='$editor'" . ($which_editor == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
483 | 483 | } |
484 | 484 | } |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | <?php |
535 | 535 | // invoke OnInterfaceSettingsRender event |
536 | 536 | $evtOut = $modx->invokeEvent('OnInterfaceSettingsRender'); |
537 | - if (is_array($evtOut)) { |
|
537 | + if (is_array($evtOut)) { |
|
538 | 538 | echo implode("", $evtOut); |
539 | 539 | } |
540 | 540 | ?> |
@@ -82,23 +82,23 @@ discard block |
||
82 | 82 | <?php |
83 | 83 | |
84 | 84 | $currentCategory = ''; |
85 | - while ($row = $modx->db->getRow($rs)) { |
|
85 | + while ($row = $modx->db->getRow($rs)) { |
|
86 | 86 | $thisCategory = $row['category']; |
87 | - if($thisCategory == null) { |
|
87 | + if($thisCategory == null) { |
|
88 | 88 | $thisCategory = $_lang['no_category']; |
89 | 89 | } |
90 | - if($thisCategory != $currentCategory) { |
|
91 | - if($closeOptGroup) { |
|
90 | + if($thisCategory != $currentCategory) { |
|
91 | + if($closeOptGroup) { |
|
92 | 92 | echo "\t\t\t\t\t</optgroup>\n"; |
93 | 93 | } |
94 | 94 | echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
95 | 95 | $closeOptGroup = true; |
96 | - } else { |
|
96 | + } else { |
|
97 | 97 | $closeOptGroup = false; |
98 | 98 | } |
99 | 99 | |
100 | 100 | $selectedtext = $row['id'] == $default_template ? ' selected="selected"' : ''; |
101 | - if ($selectedtext) { |
|
101 | + if ($selectedtext) { |
|
102 | 102 | $oldTmpId = $row['id']; |
103 | 103 | $oldTmpName = $row['templatename']; |
104 | 104 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n"; |
107 | 107 | $currentCategory = $thisCategory; |
108 | 108 | } |
109 | - if($thisCategory != '') { |
|
109 | + if($thisCategory != '') { |
|
110 | 110 | echo "\t\t\t\t\t</optgroup>\n"; |
111 | 111 | } |
112 | 112 | ?> |
@@ -138,11 +138,12 @@ discard block |
||
138 | 138 | $modx->db->select('id', '[+prefix+]site_plugins', |
139 | 139 | "plugincode LIKE '%phx.parser.class.inc.php%OnParseDocument();%' AND disabled != 1") |
140 | 140 | ); |
141 | - if($count) { |
|
141 | + if($count) { |
|
142 | 142 | $disabledFilters = 1; |
143 | 143 | echo '<b>'.$_lang['enable_filter_phx_warning'].'</b><br/>'; |
144 | - } |
|
145 | - else $disabledFilters = false; |
|
144 | + } else { |
|
145 | + $disabledFilters = false; |
|
146 | + } |
|
146 | 147 | ?> |
147 | 148 | <?php echo wrap_label($_lang['yes'],form_radio('enable_filter', 1, '', $disabledFilters));?><br /> |
148 | 149 | <?php echo wrap_label($_lang['no'], form_radio('enable_filter', 0, '', $disabledFilters));?> |
@@ -204,7 +205,7 @@ discard block |
||
204 | 205 | <select name="lst_custom_contenttype" style="width:200px;height:100px;" size="5"> |
205 | 206 | <?php |
206 | 207 | $ct = explode(",",$custom_contenttype); |
207 | - for($i=0;$i<count($ct);$i++) { |
|
208 | + for($i=0;$i<count($ct);$i++) { |
|
208 | 209 | echo "<option value=\"".$ct[$i]."\">".$ct[$i]."</option>"; |
209 | 210 | } |
210 | 211 | ?> |
@@ -259,7 +260,7 @@ discard block |
||
259 | 260 | <th><?php echo $_lang['serveroffset_title'] ?><br><small>[(server_offset_time)]</small></th> |
260 | 261 | <td> <select name="server_offset_time" size="1" class="inputBox"> |
261 | 262 | <?php |
262 | - for($i=-24; $i<25; $i++) { |
|
263 | + for($i=-24; $i<25; $i++) { |
|
263 | 264 | $seconds = $i*60*60; |
264 | 265 | $selectedtext = $seconds==$server_offset_time ? "selected='selected'" : "" ; |
265 | 266 | ?> |
@@ -296,7 +297,9 @@ discard block |
||
296 | 297 | <?php |
297 | 298 | // invoke OnSiteSettingsRender event |
298 | 299 | $evtOut = $modx->invokeEvent('OnSiteSettingsRender'); |
299 | - if(is_array($evtOut)) echo implode("",$evtOut); |
|
300 | + if(is_array($evtOut)) { |
|
301 | + echo implode("",$evtOut); |
|
302 | + } |
|
300 | 303 | ?> |
301 | 304 | </td> |
302 | 305 | </tr> |
@@ -4,12 +4,13 @@ discard block |
||
4 | 4 | * |
5 | 5 | * @return array of keys from a language file |
6 | 6 | */ |
7 | -function get_lang_keys($filename) { |
|
7 | +function get_lang_keys($filename) |
|
8 | +{ |
|
8 | 9 | $file = MODX_MANAGER_PATH.'includes/lang' . DIRECTORY_SEPARATOR . $filename; |
9 | - if(is_file($file) && is_readable($file)) { |
|
10 | + if(is_file($file) && is_readable($file)) { |
|
10 | 11 | include($file); |
11 | 12 | return array_keys($_lang); |
12 | - } else { |
|
13 | + } else { |
|
13 | 14 | return array(); |
14 | 15 | } |
15 | 16 | } |
@@ -18,11 +19,12 @@ discard block |
||
18 | 19 | * |
19 | 20 | * @return array of languages that define the key in their file |
20 | 21 | */ |
21 | -function get_langs_by_key($key) { |
|
22 | +function get_langs_by_key($key) |
|
23 | +{ |
|
22 | 24 | global $lang_keys; |
23 | 25 | $lang_return = array(); |
24 | - foreach($lang_keys as $lang=>$keys) { |
|
25 | - if(in_array($key, $keys)) { |
|
26 | + foreach($lang_keys as $lang=>$keys) { |
|
27 | + if(in_array($key, $keys)) { |
|
26 | 28 | $lang_return[] = $lang; |
27 | 29 | } |
28 | 30 | } |
@@ -38,23 +40,24 @@ discard block |
||
38 | 40 | * @param string $selected_lang specify language to select in option list, default none |
39 | 41 | * @return html option list |
40 | 42 | */ |
41 | -function get_lang_options($key=null, $selected_lang=null) { |
|
43 | +function get_lang_options($key=null, $selected_lang=null) |
|
44 | +{ |
|
42 | 45 | global $lang_keys, $_lang; |
43 | 46 | $lang_options = ''; |
44 | - if($key) { |
|
47 | + if($key) { |
|
45 | 48 | $languages = get_langs_by_key($key); |
46 | 49 | sort($languages); |
47 | 50 | $lang_options .= '<option value="">'.$_lang['language_title'].'</option>'; |
48 | 51 | |
49 | - foreach($languages as $language_name) { |
|
52 | + foreach($languages as $language_name) { |
|
50 | 53 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
51 | 54 | $lang_options .= '<option value="'.$language_name.'">'.$uclanguage_name.'</option>'; |
52 | 55 | } |
53 | 56 | return $lang_options; |
54 | - } else { |
|
57 | + } else { |
|
55 | 58 | $languages = array_keys($lang_keys); |
56 | 59 | sort($languages); |
57 | - foreach($languages as $language_name) { |
|
60 | + foreach($languages as $language_name) { |
|
58 | 61 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
59 | 62 | $sel = $language_name == $selected_lang ? ' selected="selected"' : ''; |
60 | 63 | $lang_options .= '<option value="'.$language_name.'" '.$sel.'>'.$uclanguage_name.'</option>'; |
@@ -63,31 +66,42 @@ discard block |
||
63 | 66 | } |
64 | 67 | } |
65 | 68 | |
66 | -function form_radio($name,$value,$add='',$disabled=false) { |
|
69 | +function form_radio($name,$value,$add='',$disabled=false) |
|
70 | +{ |
|
67 | 71 | global ${$name}; |
68 | 72 | $var = ${$name}; |
69 | 73 | $checked = ($var==$value) ? ' checked="checked"' : ''; |
70 | - if($disabled) $disabled = ' disabled'; else $disabled = ''; |
|
71 | - if($add) $add = ' ' . $add; |
|
74 | + if($disabled) { |
|
75 | + $disabled = ' disabled'; |
|
76 | + } else { |
|
77 | + $disabled = ''; |
|
78 | + } |
|
79 | + if($add) { |
|
80 | + $add = ' ' . $add; |
|
81 | + } |
|
72 | 82 | return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name, $value, $checked, $disabled, $add); |
73 | 83 | } |
74 | 84 | |
75 | -function wrap_label($str='',$object) { |
|
85 | +function wrap_label($str='',$object) |
|
86 | +{ |
|
76 | 87 | return "<label>{$object}\n{$str}</label>"; |
77 | 88 | } |
78 | 89 | |
79 | -function parseText($tpl='', $ph=array()) { |
|
80 | - if(empty($ph) || empty($tpl)) return $tpl; |
|
90 | +function parseText($tpl='', $ph=array()) |
|
91 | +{ |
|
92 | + if(empty($ph) || empty($tpl)) { |
|
93 | + return $tpl; |
|
94 | + } |
|
81 | 95 | |
82 | - foreach($ph as $k=>$v) |
|
83 | - { |
|
96 | + foreach($ph as $k=>$v) { |
|
84 | 97 | $k = "[+{$k}+]"; |
85 | 98 | $tpl = str_replace($k, $v, $tpl); |
86 | 99 | } |
87 | 100 | return $tpl; |
88 | 101 | } |
89 | 102 | |
90 | -function showHide($cond=true) { |
|
103 | +function showHide($cond=true) |
|
104 | +{ |
|
91 | 105 | global $displayStyle; |
92 | 106 | $showHide = $cond ? $displayStyle : 'none'; |
93 | 107 | return sprintf('style="display:%s"', $showHide); |
@@ -15,8 +15,14 @@ |
||
15 | 15 | <td > |
16 | 16 | <select name="smtp_secure" size="1" class="inputBox"> |
17 | 17 | <option value="none" ><?php echo $_lang['no'] ?></option> |
18 | - <option value="ssl" <?php if($smtp_secure == 'ssl') echo "selected='selected'"; ?> >SSL</option> |
|
19 | - <option value="tls" <?php if($smtp_secure == 'tls') echo "selected='selected'"; ?> >TLS</option> |
|
18 | + <option value="ssl" <?php if($smtp_secure == 'ssl') { |
|
19 | + echo "selected='selected'"; |
|
20 | +} |
|
21 | +?> >SSL</option> |
|
22 | + <option value="tls" <?php if($smtp_secure == 'tls') { |
|
23 | + echo "selected='selected'"; |
|
24 | +} |
|
25 | +?> >TLS</option> |
|
20 | 26 | </select> |
21 | 27 | <br /> |
22 | 28 | </td> |
@@ -159,7 +159,9 @@ |
||
159 | 159 | <?php |
160 | 160 | // invoke OnFriendlyURLSettingsRender event |
161 | 161 | $evtOut = $modx->invokeEvent('OnFriendlyURLSettingsRender'); |
162 | - if(is_array($evtOut)) echo implode("",$evtOut); |
|
162 | + if(is_array($evtOut)) { |
|
163 | + echo implode("",$evtOut); |
|
164 | + } |
|
163 | 165 | ?> |
164 | 166 | </td> |
165 | 167 | </tr> |
@@ -733,7 +733,8 @@ |
||
733 | 733 | } |
734 | 734 | |
735 | 735 | function mkdirs($strPath, $mode) |
736 | -{ // recursive mkdir function |
|
736 | +{ |
|
737 | +// recursive mkdir function |
|
737 | 738 | if (is_dir($strPath)) { |
738 | 739 | return true; |
739 | 740 | } |
@@ -293,7 +293,8 @@ |
||
293 | 293 | </form> |
294 | 294 | |
295 | 295 | <?php |
296 | -function render_form($name, $label, $status = '') { |
|
296 | +function render_form($name, $label, $status = '') |
|
297 | +{ |
|
297 | 298 | global $modx, $roledata; |
298 | 299 | |
299 | 300 | $tpl = '<label class="d-block" for="[+name+]check"> |
@@ -29,10 +29,12 @@ |
||
29 | 29 | |
30 | 30 | <div class="tab-page"> |
31 | 31 | <div class="container container-body"> |
32 | - <?php if($num_rows_pub) printf('<p>' . $_lang["refresh_published"] . '</p>', $num_rows_pub) ?> |
|
32 | + <?php if($num_rows_pub) { |
|
33 | + printf('<p>' . $_lang["refresh_published"] . '</p>', $num_rows_pub) ?> |
|
33 | 34 | <?php if($num_rows_unpub) printf('<p>' . $_lang["refresh_unpublished"] . '</p>', $num_rows_unpub) ?> |
34 | 35 | <?php |
35 | 36 | $modx->clearCache('full', true); |
37 | +} |
|
36 | 38 | // invoke OnSiteRefresh event |
37 | 39 | $modx->invokeEvent("OnSiteRefresh"); |
38 | 40 | ?> |
@@ -177,7 +177,9 @@ discard block |
||
177 | 177 | // save selected system events |
178 | 178 | $formEventList = array(); |
179 | 179 | foreach ($sysevents as $evtId) { |
180 | - if(!preg_match('@^[1-9][0-9]*$@',$evtId)) $evtId = getEventIdByName($evtId); |
|
180 | + if(!preg_match('@^[1-9][0-9]*$@',$evtId)) { |
|
181 | + $evtId = getEventIdByName($evtId); |
|
182 | + } |
|
181 | 183 | if ($mode == '101') { |
182 | 184 | $rs = $modx->db->select('max(priority) as priority', '[+prefix+]site_plugin_events', "evtid='{$evtId}'"); |
183 | 185 | } else { |
@@ -203,10 +205,14 @@ discard block |
||
203 | 205 | $dbEventList = array(); |
204 | 206 | $del = array(); |
205 | 207 | while($row = $modx->db->getRow($rs)) { |
206 | - if(!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
208 | + if(!in_array($row['evtid'], $evtids)) { |
|
209 | + $del[] = $row['evtid']; |
|
210 | + } |
|
207 | 211 | } |
208 | 212 | |
209 | - if(!$del) return; |
|
213 | + if(!$del) { |
|
214 | + return; |
|
215 | + } |
|
210 | 216 | |
211 | 217 | foreach($del as $delid) { |
212 | 218 | $modx->db->delete('[+prefix+]site_plugin_events', sprintf("evtid='%s' AND pluginid='%s'", $delid, $id)); |
@@ -218,7 +224,9 @@ discard block |
||
218 | 224 | global $modx; |
219 | 225 | static $eventIds=array(); |
220 | 226 | |
221 | - if(isset($eventIds[$name])) return $eventIds[$name]; |
|
227 | + if(isset($eventIds[$name])) { |
|
228 | + return $eventIds[$name]; |
|
229 | + } |
|
222 | 230 | |
223 | 231 | $rs = $modx->db->select('id, name', '[+prefix+]system_eventnames'); |
224 | 232 | while ($row = $modx->db->getRow($rs)) { |