@@ -381,7 +381,7 @@ |
||
381 | 381 | } // end renderFormElement function |
382 | 382 | |
383 | 383 | /** |
384 | - * @param string|array|mysqli_result $v |
|
384 | + * @param string $v |
|
385 | 385 | * @return array |
386 | 386 | */ |
387 | 387 | function ParseIntputOptions($v) { |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | * @param array $tvsArray |
13 | 13 | * @return string |
14 | 14 | */ |
15 | -function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) { |
|
15 | +function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()){ |
|
16 | 16 | $modx = evolutionCMS(); |
17 | 17 | global $_style; |
18 | 18 | global $_lang; |
19 | 19 | global $content; |
20 | 20 | global $which_browser; |
21 | 21 | |
22 | - if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
22 | + if (substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
23 | 23 | $eval_str = trim(substr($default_text, 7)); |
24 | 24 | $default_text = eval($eval_str); |
25 | 25 | $field_value = $default_text; |
@@ -27,74 +27,74 @@ discard block |
||
27 | 27 | |
28 | 28 | $field_html = ''; |
29 | 29 | $cimode = strpos($field_type, ':'); |
30 | - if($cimode === false) { |
|
31 | - switch($field_type) { |
|
30 | + if ($cimode === false) { |
|
31 | + switch ($field_type) { |
|
32 | 32 | |
33 | 33 | case "text": // handler for regular text boxes |
34 | 34 | case "rawtext"; // non-htmlentity converted text boxes |
35 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />'; |
|
35 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" />'; |
|
36 | 36 | break; |
37 | 37 | case "email": // handles email input fields |
38 | - $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>'; |
|
38 | + $field_html .= '<input type="email" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%"/>'; |
|
39 | 39 | break; |
40 | 40 | case "number": // handles the input of numbers |
41 | - $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
41 | + $field_html .= '<input type="number" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
42 | 42 | break; |
43 | 43 | case "textareamini": // handler for textarea mini boxes |
44 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
44 | + $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>'; |
|
45 | 45 | break; |
46 | 46 | case "textarea": // handler for textarea boxes |
47 | 47 | case "rawtextarea": // non-htmlentity convertex textarea boxes |
48 | 48 | case "htmlarea": // handler for textarea boxes (deprecated) |
49 | 49 | case "richtext": // handler for textarea boxes |
50 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
50 | + $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>'; |
|
51 | 51 | break; |
52 | 52 | case "date": |
53 | 53 | $field_id = str_replace(array( |
54 | 54 | '-', |
55 | 55 | '.' |
56 | 56 | ), '_', urldecode($field_id)); |
57 | - if($field_value == '') { |
|
57 | + if ($field_value == '') { |
|
58 | 58 | $field_value = 0; |
59 | 59 | } |
60 | - $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />'; |
|
61 | - $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>'; |
|
60 | + $field_html .= '<input id="tv'.$field_id.'" name="tv'.$field_id.'" class="DatePicker" type="text" value="'.($field_value == 0 || !isset($field_value) ? "" : $field_value).'" onblur="documentDirty=true;" />'; |
|
61 | + $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].value=\'\';document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="'.$_style["actions_calendar_delete"].'"></i></a>'; |
|
62 | 62 | |
63 | 63 | break; |
64 | 64 | case "dropdown": // handler for select boxes |
65 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
65 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" size="1" onchange="documentDirty=true;">'; |
|
66 | 66 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
67 | - while(list($item, $itemvalue) = each($index_list)) { |
|
67 | + while (list($item, $itemvalue) = each($index_list)) { |
|
68 | 68 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
69 | - if(strlen($itemvalue) == 0) { |
|
69 | + if (strlen($itemvalue) == 0) { |
|
70 | 70 | $itemvalue = $item; |
71 | 71 | } |
72 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
72 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
73 | 73 | } |
74 | 74 | $field_html .= "</select>"; |
75 | 75 | break; |
76 | 76 | case "listbox": // handler for select boxes |
77 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
77 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" onchange="documentDirty=true;" size="8">'; |
|
78 | 78 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
79 | - while(list($item, $itemvalue) = each($index_list)) { |
|
79 | + while (list($item, $itemvalue) = each($index_list)) { |
|
80 | 80 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
81 | - if(strlen($itemvalue) == 0) { |
|
81 | + if (strlen($itemvalue) == 0) { |
|
82 | 82 | $itemvalue = $item; |
83 | 83 | } |
84 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
84 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
85 | 85 | } |
86 | 86 | $field_html .= "</select>"; |
87 | 87 | break; |
88 | 88 | case "listbox-multiple": // handler for select boxes where you can choose multiple items |
89 | 89 | $field_value = explode("||", $field_value); |
90 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
90 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
91 | 91 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
92 | - while(list($item, $itemvalue) = each($index_list)) { |
|
92 | + while (list($item, $itemvalue) = each($index_list)) { |
|
93 | 93 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
94 | - if(strlen($itemvalue) == 0) { |
|
94 | + if (strlen($itemvalue) == 0) { |
|
95 | 95 | $itemvalue = $item; |
96 | 96 | } |
97 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
97 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.(in_array($itemvalue, $field_value) ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
98 | 98 | } |
99 | 99 | $field_html .= "</select>"; |
100 | 100 | break; |
@@ -106,17 +106,17 @@ discard block |
||
106 | 106 | 'ftp://' => 'ftp://', |
107 | 107 | 'mailto:' => 'mailto:' |
108 | 108 | ); |
109 | - $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">'; |
|
110 | - foreach($urls as $k => $v) { |
|
111 | - if(strpos($field_value, $v) === false) { |
|
112 | - $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
109 | + $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv'.$field_id.'_prefix" name="tv'.$field_id.'_prefix" onchange="documentDirty=true;">'; |
|
110 | + foreach ($urls as $k => $v) { |
|
111 | + if (strpos($field_value, $v) === false) { |
|
112 | + $field_html .= '<option value="'.$v.'">'.$k.'</option>'; |
|
113 | 113 | } else { |
114 | 114 | $field_value = str_replace($v, '', $field_value); |
115 | - $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
115 | + $field_html .= '<option value="'.$v.'" selected="selected">'.$k.'</option>'; |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | $field_html .= '</select></td><td>'; |
119 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>'; |
|
119 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" width="100" '.$field_style.' onchange="documentDirty=true;" /></td></tr></table>'; |
|
120 | 120 | break; |
121 | 121 | case 'checkbox': // handles check boxes |
122 | 122 | $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />'; |
125 | 125 | static $i = 0; |
126 | 126 | $_ = array(); |
127 | - foreach($index_list as $c => $item) { |
|
128 | - if(is_array($item)) { |
|
127 | + foreach ($index_list as $c => $item) { |
|
128 | + if (is_array($item)) { |
|
129 | 129 | $name = trim($item[0]); |
130 | 130 | $value = isset($item[1]) ? $item[1] : $name; |
131 | 131 | } else { |
@@ -151,12 +151,12 @@ discard block |
||
151 | 151 | case "option": // handles radio buttons |
152 | 152 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
153 | 153 | static $i = 0; |
154 | - while(list($item, $itemvalue) = each($index_list)) { |
|
154 | + while (list($item, $itemvalue) = each($index_list)) { |
|
155 | 155 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
156 | - if(strlen($itemvalue) == 0) { |
|
156 | + if (strlen($itemvalue) == 0) { |
|
157 | 157 | $itemvalue = $item; |
158 | 158 | } |
159 | - $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />'; |
|
159 | + $field_html .= '<input type="radio" value="'.$modx->htmlspecialchars($itemvalue).'" id="tv_'.$i.'" name="tv'.$field_id.'" '.($itemvalue == $field_value ? 'checked="checked"' : '').' onchange="documentDirty=true;" /><label for="tv_'.$i.'" class="radio">'.$item.'</label><br />'; |
|
160 | 160 | $i++; |
161 | 161 | } |
162 | 162 | break; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | global $_lang; |
165 | 165 | global $ResourceManagerLoaded; |
166 | 166 | global $content, $use_editor, $which_editor; |
167 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
167 | + if (!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
168 | 168 | $field_html .= " |
169 | 169 | <script type=\"text/javascript\"> |
170 | 170 | /* <![CDATA[ */ |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | lastImageCtrl = ctrl; |
187 | 187 | var w = screen.width * 0.5; |
188 | 188 | var h = screen.height * 0.5; |
189 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
189 | + OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
190 | 190 | } |
191 | 191 | function BrowseFileServer(ctrl) { |
192 | 192 | lastFileCtrl = ctrl; |
193 | 193 | var w = screen.width * 0.5; |
194 | 194 | var h = screen.height * 0.5; |
195 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
195 | + OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
196 | 196 | } |
197 | 197 | function SetUrlChange(el) { |
198 | 198 | if ('createEvent' in document) { |
@@ -226,14 +226,14 @@ discard block |
||
226 | 226 | </script>"; |
227 | 227 | $ResourceManagerLoaded = true; |
228 | 228 | } |
229 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />'; |
|
229 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseServer(\'tv'.$field_id.'\')" />'; |
|
230 | 230 | break; |
231 | 231 | case "file": // handles the input of file uploads |
232 | 232 | /* Modified by Timon for use with resource browser */ |
233 | 233 | global $_lang; |
234 | 234 | global $ResourceManagerLoaded; |
235 | 235 | global $content, $use_editor, $which_editor; |
236 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
236 | + if (!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
237 | 237 | /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */ |
238 | 238 | $field_html .= " |
239 | 239 | <script type=\"text/javascript\"> |
@@ -256,13 +256,13 @@ discard block |
||
256 | 256 | lastImageCtrl = ctrl; |
257 | 257 | var w = screen.width * 0.5; |
258 | 258 | var h = screen.height * 0.5; |
259 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
259 | + OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
260 | 260 | } |
261 | 261 | function BrowseFileServer(ctrl) { |
262 | 262 | lastFileCtrl = ctrl; |
263 | 263 | var w = screen.width * 0.5; |
264 | 264 | var h = screen.height * 0.5; |
265 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
265 | + OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
266 | 266 | } |
267 | 267 | function SetUrlChange(el) { |
268 | 268 | if ('createEvent' in document) { |
@@ -296,39 +296,39 @@ discard block |
||
296 | 296 | </script>"; |
297 | 297 | $ResourceManagerLoaded = true; |
298 | 298 | } |
299 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />'; |
|
299 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseFileServer(\'tv'.$field_id.'\')" />'; |
|
300 | 300 | |
301 | 301 | break; |
302 | 302 | |
303 | 303 | case 'custom_tv': |
304 | 304 | $custom_output = ''; |
305 | 305 | /* If we are loading a file */ |
306 | - if(substr($field_elements, 0, 5) == "@FILE") { |
|
307 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
308 | - if(!file_exists($file_name)) { |
|
309 | - $custom_output = $file_name . ' does not exist'; |
|
306 | + if (substr($field_elements, 0, 5) == "@FILE") { |
|
307 | + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 6)); |
|
308 | + if (!file_exists($file_name)) { |
|
309 | + $custom_output = $file_name.' does not exist'; |
|
310 | 310 | } else { |
311 | 311 | $custom_output = file_get_contents($file_name); |
312 | 312 | } |
313 | - } elseif(substr($field_elements, 0, 8) == '@INCLUDE') { |
|
314 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
315 | - if(!file_exists($file_name)) { |
|
316 | - $custom_output = $file_name . ' does not exist'; |
|
313 | + } elseif (substr($field_elements, 0, 8) == '@INCLUDE') { |
|
314 | + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 9)); |
|
315 | + if (!file_exists($file_name)) { |
|
316 | + $custom_output = $file_name.' does not exist'; |
|
317 | 317 | } else { |
318 | 318 | ob_start(); |
319 | 319 | include $file_name; |
320 | 320 | $custom_output = ob_get_contents(); |
321 | 321 | ob_end_clean(); |
322 | 322 | } |
323 | - } elseif(substr($field_elements, 0, 6) == "@CHUNK") { |
|
323 | + } elseif (substr($field_elements, 0, 6) == "@CHUNK") { |
|
324 | 324 | $chunk_name = trim(substr($field_elements, 7)); |
325 | 325 | $chunk_body = $modx->getChunk($chunk_name); |
326 | - if($chunk_body == false) { |
|
327 | - $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
326 | + if ($chunk_body == false) { |
|
327 | + $custom_output = $_lang['chunk_no_exist'].'('.$_lang['htmlsnippet_name'].':'.$chunk_name.')'; |
|
328 | 328 | } else { |
329 | 329 | $custom_output = $chunk_body; |
330 | 330 | } |
331 | - } elseif(substr($field_elements, 0, 5) == "@EVAL") { |
|
331 | + } elseif (substr($field_elements, 0, 5) == "@EVAL") { |
|
332 | 332 | $eval_str = trim(substr($field_elements, 6)); |
333 | 333 | $custom_output = eval($eval_str); |
334 | 334 | } else { |
@@ -349,15 +349,15 @@ discard block |
||
349 | 349 | break; |
350 | 350 | |
351 | 351 | default: // the default handler -- for errors, mostly |
352 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
352 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' onchange="documentDirty=true;" />'; |
|
353 | 353 | |
354 | 354 | } // end switch statement |
355 | 355 | } else { |
356 | 356 | $custom = explode(":", $field_type); |
357 | 357 | $custom_output = ''; |
358 | - $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
359 | - if(!file_exists($file_name)) { |
|
360 | - $custom_output = $file_name . ' does not exist'; |
|
358 | + $file_name = MODX_BASE_PATH.'assets/tvs/'.$custom['1'].'/'.$custom['1'].'.customtv.php'; |
|
359 | + if (!file_exists($file_name)) { |
|
360 | + $custom_output = $file_name.' does not exist'; |
|
361 | 361 | } else { |
362 | 362 | ob_start(); |
363 | 363 | include $file_name; |
@@ -384,13 +384,13 @@ discard block |
||
384 | 384 | * @param string|array|mysqli_result $v |
385 | 385 | * @return array |
386 | 386 | */ |
387 | -function ParseIntputOptions($v) { |
|
387 | +function ParseIntputOptions($v){ |
|
388 | 388 | $modx = evolutionCMS(); |
389 | 389 | $a = array(); |
390 | - if(is_array($v)) { |
|
390 | + if (is_array($v)) { |
|
391 | 391 | return $v; |
392 | - } else if($modx->db->isResult($v)) { |
|
393 | - while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
392 | + } else if ($modx->db->isResult($v)) { |
|
393 | + while ($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
394 | 394 | } else { |
395 | 395 | $a = explode("||", $v); |
396 | 396 | } |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | * @param array $tvsArray |
13 | 13 | * @return string |
14 | 14 | */ |
15 | -function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) { |
|
15 | +function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) |
|
16 | +{ |
|
16 | 17 | $modx = evolutionCMS(); |
17 | 18 | global $_style; |
18 | 19 | global $_lang; |
@@ -384,13 +385,16 @@ discard block |
||
384 | 385 | * @param string|array|mysqli_result $v |
385 | 386 | * @return array |
386 | 387 | */ |
387 | -function ParseIntputOptions($v) { |
|
388 | +function ParseIntputOptions($v) |
|
389 | +{ |
|
388 | 390 | $modx = evolutionCMS(); |
389 | 391 | $a = array(); |
390 | 392 | if(is_array($v)) { |
391 | 393 | return $v; |
392 | 394 | } else if($modx->db->isResult($v)) { |
393 | - while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
395 | + while($cols = $modx->db->getRow($v, 'num')) { |
|
396 | + $a[] = $cols; |
|
397 | + } |
|
394 | 398 | } else { |
395 | 399 | $a = explode("||", $v); |
396 | 400 | } |
@@ -14,158 +14,158 @@ discard block |
||
14 | 14 | */ |
15 | 15 | function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) { |
16 | 16 | $modx = evolutionCMS(); |
17 | - global $_style; |
|
18 | - global $_lang; |
|
19 | - global $content; |
|
20 | - global $which_browser; |
|
17 | + global $_style; |
|
18 | + global $_lang; |
|
19 | + global $content; |
|
20 | + global $which_browser; |
|
21 | 21 | |
22 | - if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
23 | - $eval_str = trim(substr($default_text, 7)); |
|
24 | - $default_text = eval($eval_str); |
|
25 | - $field_value = $default_text; |
|
26 | - } |
|
22 | + if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
23 | + $eval_str = trim(substr($default_text, 7)); |
|
24 | + $default_text = eval($eval_str); |
|
25 | + $field_value = $default_text; |
|
26 | + } |
|
27 | 27 | |
28 | - $field_html = ''; |
|
29 | - $cimode = strpos($field_type, ':'); |
|
30 | - if($cimode === false) { |
|
31 | - switch($field_type) { |
|
28 | + $field_html = ''; |
|
29 | + $cimode = strpos($field_type, ':'); |
|
30 | + if($cimode === false) { |
|
31 | + switch($field_type) { |
|
32 | 32 | |
33 | - case "text": // handler for regular text boxes |
|
34 | - case "rawtext"; // non-htmlentity converted text boxes |
|
35 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />'; |
|
36 | - break; |
|
37 | - case "email": // handles email input fields |
|
38 | - $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>'; |
|
39 | - break; |
|
40 | - case "number": // handles the input of numbers |
|
41 | - $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
42 | - break; |
|
43 | - case "textareamini": // handler for textarea mini boxes |
|
44 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
45 | - break; |
|
46 | - case "textarea": // handler for textarea boxes |
|
47 | - case "rawtextarea": // non-htmlentity convertex textarea boxes |
|
48 | - case "htmlarea": // handler for textarea boxes (deprecated) |
|
49 | - case "richtext": // handler for textarea boxes |
|
50 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
51 | - break; |
|
52 | - case "date": |
|
53 | - $field_id = str_replace(array( |
|
54 | - '-', |
|
55 | - '.' |
|
56 | - ), '_', urldecode($field_id)); |
|
57 | - if($field_value == '') { |
|
58 | - $field_value = 0; |
|
59 | - } |
|
60 | - $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />'; |
|
61 | - $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>'; |
|
33 | + case "text": // handler for regular text boxes |
|
34 | + case "rawtext"; // non-htmlentity converted text boxes |
|
35 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />'; |
|
36 | + break; |
|
37 | + case "email": // handles email input fields |
|
38 | + $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>'; |
|
39 | + break; |
|
40 | + case "number": // handles the input of numbers |
|
41 | + $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
42 | + break; |
|
43 | + case "textareamini": // handler for textarea mini boxes |
|
44 | + $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
45 | + break; |
|
46 | + case "textarea": // handler for textarea boxes |
|
47 | + case "rawtextarea": // non-htmlentity convertex textarea boxes |
|
48 | + case "htmlarea": // handler for textarea boxes (deprecated) |
|
49 | + case "richtext": // handler for textarea boxes |
|
50 | + $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
51 | + break; |
|
52 | + case "date": |
|
53 | + $field_id = str_replace(array( |
|
54 | + '-', |
|
55 | + '.' |
|
56 | + ), '_', urldecode($field_id)); |
|
57 | + if($field_value == '') { |
|
58 | + $field_value = 0; |
|
59 | + } |
|
60 | + $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />'; |
|
61 | + $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>'; |
|
62 | 62 | |
63 | - break; |
|
64 | - case "dropdown": // handler for select boxes |
|
65 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
66 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
67 | - while(list($item, $itemvalue) = each($index_list)) { |
|
68 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
69 | - if(strlen($itemvalue) == 0) { |
|
70 | - $itemvalue = $item; |
|
71 | - } |
|
72 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
73 | - } |
|
74 | - $field_html .= "</select>"; |
|
75 | - break; |
|
76 | - case "listbox": // handler for select boxes |
|
77 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
78 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
79 | - while(list($item, $itemvalue) = each($index_list)) { |
|
80 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
81 | - if(strlen($itemvalue) == 0) { |
|
82 | - $itemvalue = $item; |
|
83 | - } |
|
84 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
85 | - } |
|
86 | - $field_html .= "</select>"; |
|
87 | - break; |
|
88 | - case "listbox-multiple": // handler for select boxes where you can choose multiple items |
|
89 | - $field_value = explode("||", $field_value); |
|
90 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
91 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
92 | - while(list($item, $itemvalue) = each($index_list)) { |
|
93 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
94 | - if(strlen($itemvalue) == 0) { |
|
95 | - $itemvalue = $item; |
|
96 | - } |
|
97 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
98 | - } |
|
99 | - $field_html .= "</select>"; |
|
100 | - break; |
|
101 | - case "url": // handles url input fields |
|
102 | - $urls = array( |
|
103 | - '' => '--', |
|
104 | - 'http://' => 'http://', |
|
105 | - 'https://' => 'https://', |
|
106 | - 'ftp://' => 'ftp://', |
|
107 | - 'mailto:' => 'mailto:' |
|
108 | - ); |
|
109 | - $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">'; |
|
110 | - foreach($urls as $k => $v) { |
|
111 | - if(strpos($field_value, $v) === false) { |
|
112 | - $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
113 | - } else { |
|
114 | - $field_value = str_replace($v, '', $field_value); |
|
115 | - $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
116 | - } |
|
117 | - } |
|
118 | - $field_html .= '</select></td><td>'; |
|
119 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>'; |
|
120 | - break; |
|
121 | - case 'checkbox': // handles check boxes |
|
122 | - $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
|
123 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
124 | - $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />'; |
|
125 | - static $i = 0; |
|
126 | - $_ = array(); |
|
127 | - foreach($index_list as $c => $item) { |
|
128 | - if(is_array($item)) { |
|
129 | - $name = trim($item[0]); |
|
130 | - $value = isset($item[1]) ? $item[1] : $name; |
|
131 | - } else { |
|
132 | - $item = trim($item); |
|
133 | - list($name, $value) = (strpos($item, '==') !== false) ? explode('==', $item, 2) : array( |
|
134 | - $item, |
|
135 | - $item |
|
136 | - ); |
|
137 | - } |
|
138 | - $checked = in_array($value, $values) ? ' checked="checked"' : ''; |
|
139 | - $param = array( |
|
140 | - $modx->htmlspecialchars($value), |
|
141 | - $i, |
|
142 | - $field_id, |
|
143 | - $checked, |
|
144 | - $name |
|
145 | - ); |
|
146 | - $_[] = vsprintf($tpl, $param); |
|
147 | - $i++; |
|
148 | - } |
|
149 | - $field_html = implode("\n", $_); |
|
150 | - break; |
|
151 | - case "option": // handles radio buttons |
|
152 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
153 | - static $i = 0; |
|
154 | - while(list($item, $itemvalue) = each($index_list)) { |
|
155 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
156 | - if(strlen($itemvalue) == 0) { |
|
157 | - $itemvalue = $item; |
|
158 | - } |
|
159 | - $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />'; |
|
160 | - $i++; |
|
161 | - } |
|
162 | - break; |
|
163 | - case "image": // handles image fields using htmlarea image manager |
|
164 | - global $_lang; |
|
165 | - global $ResourceManagerLoaded; |
|
166 | - global $content, $use_editor, $which_editor; |
|
167 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
168 | - $field_html .= " |
|
63 | + break; |
|
64 | + case "dropdown": // handler for select boxes |
|
65 | + $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
66 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
67 | + while(list($item, $itemvalue) = each($index_list)) { |
|
68 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
69 | + if(strlen($itemvalue) == 0) { |
|
70 | + $itemvalue = $item; |
|
71 | + } |
|
72 | + $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
73 | + } |
|
74 | + $field_html .= "</select>"; |
|
75 | + break; |
|
76 | + case "listbox": // handler for select boxes |
|
77 | + $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
78 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
79 | + while(list($item, $itemvalue) = each($index_list)) { |
|
80 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
81 | + if(strlen($itemvalue) == 0) { |
|
82 | + $itemvalue = $item; |
|
83 | + } |
|
84 | + $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
85 | + } |
|
86 | + $field_html .= "</select>"; |
|
87 | + break; |
|
88 | + case "listbox-multiple": // handler for select boxes where you can choose multiple items |
|
89 | + $field_value = explode("||", $field_value); |
|
90 | + $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
91 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
92 | + while(list($item, $itemvalue) = each($index_list)) { |
|
93 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
94 | + if(strlen($itemvalue) == 0) { |
|
95 | + $itemvalue = $item; |
|
96 | + } |
|
97 | + $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
98 | + } |
|
99 | + $field_html .= "</select>"; |
|
100 | + break; |
|
101 | + case "url": // handles url input fields |
|
102 | + $urls = array( |
|
103 | + '' => '--', |
|
104 | + 'http://' => 'http://', |
|
105 | + 'https://' => 'https://', |
|
106 | + 'ftp://' => 'ftp://', |
|
107 | + 'mailto:' => 'mailto:' |
|
108 | + ); |
|
109 | + $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">'; |
|
110 | + foreach($urls as $k => $v) { |
|
111 | + if(strpos($field_value, $v) === false) { |
|
112 | + $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
113 | + } else { |
|
114 | + $field_value = str_replace($v, '', $field_value); |
|
115 | + $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
116 | + } |
|
117 | + } |
|
118 | + $field_html .= '</select></td><td>'; |
|
119 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>'; |
|
120 | + break; |
|
121 | + case 'checkbox': // handles check boxes |
|
122 | + $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
|
123 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
124 | + $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />'; |
|
125 | + static $i = 0; |
|
126 | + $_ = array(); |
|
127 | + foreach($index_list as $c => $item) { |
|
128 | + if(is_array($item)) { |
|
129 | + $name = trim($item[0]); |
|
130 | + $value = isset($item[1]) ? $item[1] : $name; |
|
131 | + } else { |
|
132 | + $item = trim($item); |
|
133 | + list($name, $value) = (strpos($item, '==') !== false) ? explode('==', $item, 2) : array( |
|
134 | + $item, |
|
135 | + $item |
|
136 | + ); |
|
137 | + } |
|
138 | + $checked = in_array($value, $values) ? ' checked="checked"' : ''; |
|
139 | + $param = array( |
|
140 | + $modx->htmlspecialchars($value), |
|
141 | + $i, |
|
142 | + $field_id, |
|
143 | + $checked, |
|
144 | + $name |
|
145 | + ); |
|
146 | + $_[] = vsprintf($tpl, $param); |
|
147 | + $i++; |
|
148 | + } |
|
149 | + $field_html = implode("\n", $_); |
|
150 | + break; |
|
151 | + case "option": // handles radio buttons |
|
152 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
153 | + static $i = 0; |
|
154 | + while(list($item, $itemvalue) = each($index_list)) { |
|
155 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
156 | + if(strlen($itemvalue) == 0) { |
|
157 | + $itemvalue = $item; |
|
158 | + } |
|
159 | + $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />'; |
|
160 | + $i++; |
|
161 | + } |
|
162 | + break; |
|
163 | + case "image": // handles image fields using htmlarea image manager |
|
164 | + global $_lang; |
|
165 | + global $ResourceManagerLoaded; |
|
166 | + global $content, $use_editor, $which_editor; |
|
167 | + if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
168 | + $field_html .= " |
|
169 | 169 | <script type=\"text/javascript\"> |
170 | 170 | /* <![CDATA[ */ |
171 | 171 | var lastImageCtrl; |
@@ -224,18 +224,18 @@ discard block |
||
224 | 224 | } |
225 | 225 | /* ]]> */ |
226 | 226 | </script>"; |
227 | - $ResourceManagerLoaded = true; |
|
228 | - } |
|
229 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />'; |
|
230 | - break; |
|
231 | - case "file": // handles the input of file uploads |
|
232 | - /* Modified by Timon for use with resource browser */ |
|
233 | - global $_lang; |
|
234 | - global $ResourceManagerLoaded; |
|
235 | - global $content, $use_editor, $which_editor; |
|
236 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
237 | - /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */ |
|
238 | - $field_html .= " |
|
227 | + $ResourceManagerLoaded = true; |
|
228 | + } |
|
229 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />'; |
|
230 | + break; |
|
231 | + case "file": // handles the input of file uploads |
|
232 | + /* Modified by Timon for use with resource browser */ |
|
233 | + global $_lang; |
|
234 | + global $ResourceManagerLoaded; |
|
235 | + global $content, $use_editor, $which_editor; |
|
236 | + if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
237 | + /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */ |
|
238 | + $field_html .= " |
|
239 | 239 | <script type=\"text/javascript\"> |
240 | 240 | /* <![CDATA[ */ |
241 | 241 | var lastImageCtrl; |
@@ -294,90 +294,90 @@ discard block |
||
294 | 294 | } |
295 | 295 | /* ]]> */ |
296 | 296 | </script>"; |
297 | - $ResourceManagerLoaded = true; |
|
298 | - } |
|
299 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />'; |
|
297 | + $ResourceManagerLoaded = true; |
|
298 | + } |
|
299 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />'; |
|
300 | 300 | |
301 | - break; |
|
301 | + break; |
|
302 | 302 | |
303 | - case 'custom_tv': |
|
304 | - $custom_output = ''; |
|
305 | - /* If we are loading a file */ |
|
306 | - if(substr($field_elements, 0, 5) == "@FILE") { |
|
307 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
308 | - if(!file_exists($file_name)) { |
|
309 | - $custom_output = $file_name . ' does not exist'; |
|
310 | - } else { |
|
311 | - $custom_output = file_get_contents($file_name); |
|
312 | - } |
|
313 | - } elseif(substr($field_elements, 0, 8) == '@INCLUDE') { |
|
314 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
315 | - if(!file_exists($file_name)) { |
|
316 | - $custom_output = $file_name . ' does not exist'; |
|
317 | - } else { |
|
318 | - ob_start(); |
|
319 | - include $file_name; |
|
320 | - $custom_output = ob_get_contents(); |
|
321 | - ob_end_clean(); |
|
322 | - } |
|
323 | - } elseif(substr($field_elements, 0, 6) == "@CHUNK") { |
|
324 | - $chunk_name = trim(substr($field_elements, 7)); |
|
325 | - $chunk_body = $modx->getChunk($chunk_name); |
|
326 | - if($chunk_body == false) { |
|
327 | - $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
328 | - } else { |
|
329 | - $custom_output = $chunk_body; |
|
330 | - } |
|
331 | - } elseif(substr($field_elements, 0, 5) == "@EVAL") { |
|
332 | - $eval_str = trim(substr($field_elements, 6)); |
|
333 | - $custom_output = eval($eval_str); |
|
334 | - } else { |
|
335 | - $custom_output = $field_elements; |
|
336 | - } |
|
337 | - $replacements = array( |
|
338 | - '[+field_type+]' => $field_type, |
|
339 | - '[+field_id+]' => $field_id, |
|
340 | - '[+default_text+]' => $default_text, |
|
341 | - '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
342 | - '[+field_style+]' => $field_style, |
|
343 | - ); |
|
344 | - $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
345 | - $modx->documentObject = $content; |
|
346 | - $modx->documentIdentifier = $content['id']; |
|
347 | - $custom_output = $modx->parseDocumentSource($custom_output); |
|
348 | - $field_html .= $custom_output; |
|
349 | - break; |
|
303 | + case 'custom_tv': |
|
304 | + $custom_output = ''; |
|
305 | + /* If we are loading a file */ |
|
306 | + if(substr($field_elements, 0, 5) == "@FILE") { |
|
307 | + $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
308 | + if(!file_exists($file_name)) { |
|
309 | + $custom_output = $file_name . ' does not exist'; |
|
310 | + } else { |
|
311 | + $custom_output = file_get_contents($file_name); |
|
312 | + } |
|
313 | + } elseif(substr($field_elements, 0, 8) == '@INCLUDE') { |
|
314 | + $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
315 | + if(!file_exists($file_name)) { |
|
316 | + $custom_output = $file_name . ' does not exist'; |
|
317 | + } else { |
|
318 | + ob_start(); |
|
319 | + include $file_name; |
|
320 | + $custom_output = ob_get_contents(); |
|
321 | + ob_end_clean(); |
|
322 | + } |
|
323 | + } elseif(substr($field_elements, 0, 6) == "@CHUNK") { |
|
324 | + $chunk_name = trim(substr($field_elements, 7)); |
|
325 | + $chunk_body = $modx->getChunk($chunk_name); |
|
326 | + if($chunk_body == false) { |
|
327 | + $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
328 | + } else { |
|
329 | + $custom_output = $chunk_body; |
|
330 | + } |
|
331 | + } elseif(substr($field_elements, 0, 5) == "@EVAL") { |
|
332 | + $eval_str = trim(substr($field_elements, 6)); |
|
333 | + $custom_output = eval($eval_str); |
|
334 | + } else { |
|
335 | + $custom_output = $field_elements; |
|
336 | + } |
|
337 | + $replacements = array( |
|
338 | + '[+field_type+]' => $field_type, |
|
339 | + '[+field_id+]' => $field_id, |
|
340 | + '[+default_text+]' => $default_text, |
|
341 | + '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
342 | + '[+field_style+]' => $field_style, |
|
343 | + ); |
|
344 | + $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
345 | + $modx->documentObject = $content; |
|
346 | + $modx->documentIdentifier = $content['id']; |
|
347 | + $custom_output = $modx->parseDocumentSource($custom_output); |
|
348 | + $field_html .= $custom_output; |
|
349 | + break; |
|
350 | 350 | |
351 | - default: // the default handler -- for errors, mostly |
|
352 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
351 | + default: // the default handler -- for errors, mostly |
|
352 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
353 | 353 | |
354 | - } // end switch statement |
|
355 | - } else { |
|
356 | - $custom = explode(":", $field_type); |
|
357 | - $custom_output = ''; |
|
358 | - $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
359 | - if(!file_exists($file_name)) { |
|
360 | - $custom_output = $file_name . ' does not exist'; |
|
361 | - } else { |
|
362 | - ob_start(); |
|
363 | - include $file_name; |
|
364 | - $custom_output = ob_get_contents(); |
|
365 | - ob_end_clean(); |
|
366 | - } |
|
367 | - $replacements = array( |
|
368 | - '[+field_type+]' => $field_type, |
|
369 | - '[+field_id+]' => $field_id, |
|
370 | - '[+default_text+]' => $default_text, |
|
371 | - '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
372 | - '[+field_style+]' => $field_style, |
|
373 | - ); |
|
374 | - $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
375 | - $modx->documentObject = $content; |
|
376 | - $custom_output = $modx->parseDocumentSource($custom_output); |
|
377 | - $field_html .= $custom_output; |
|
378 | - } |
|
354 | + } // end switch statement |
|
355 | + } else { |
|
356 | + $custom = explode(":", $field_type); |
|
357 | + $custom_output = ''; |
|
358 | + $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
359 | + if(!file_exists($file_name)) { |
|
360 | + $custom_output = $file_name . ' does not exist'; |
|
361 | + } else { |
|
362 | + ob_start(); |
|
363 | + include $file_name; |
|
364 | + $custom_output = ob_get_contents(); |
|
365 | + ob_end_clean(); |
|
366 | + } |
|
367 | + $replacements = array( |
|
368 | + '[+field_type+]' => $field_type, |
|
369 | + '[+field_id+]' => $field_id, |
|
370 | + '[+default_text+]' => $default_text, |
|
371 | + '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
372 | + '[+field_style+]' => $field_style, |
|
373 | + ); |
|
374 | + $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
375 | + $modx->documentObject = $content; |
|
376 | + $custom_output = $modx->parseDocumentSource($custom_output); |
|
377 | + $field_html .= $custom_output; |
|
378 | + } |
|
379 | 379 | |
380 | - return $field_html; |
|
380 | + return $field_html; |
|
381 | 381 | } // end renderFormElement function |
382 | 382 | |
383 | 383 | /** |
@@ -386,13 +386,13 @@ discard block |
||
386 | 386 | */ |
387 | 387 | function ParseIntputOptions($v) { |
388 | 388 | $modx = evolutionCMS(); |
389 | - $a = array(); |
|
390 | - if(is_array($v)) { |
|
391 | - return $v; |
|
392 | - } else if($modx->db->isResult($v)) { |
|
393 | - while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
394 | - } else { |
|
395 | - $a = explode("||", $v); |
|
396 | - } |
|
397 | - return $a; |
|
389 | + $a = array(); |
|
390 | + if(is_array($v)) { |
|
391 | + return $v; |
|
392 | + } else if($modx->db->isResult($v)) { |
|
393 | + while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
394 | + } else { |
|
395 | + $a = explode("||", $v); |
|
396 | + } |
|
397 | + return $a; |
|
398 | 398 | } |
@@ -237,7 +237,7 @@ |
||
237 | 237 | /** |
238 | 238 | * build siteCache file |
239 | 239 | * @param DocumentParser $modx |
240 | - * @return boolean success |
|
240 | + * @return null|boolean success |
|
241 | 241 | */ |
242 | 242 | public function buildCache($modx) |
243 | 243 | { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | if (isset($this->aliases[$id])) { |
95 | 95 | if ($this->aliasVisible[$id] == 1) { |
96 | 96 | if ($path != '') { |
97 | - $path = $this->aliases[$id] . '/' . $path; |
|
97 | + $path = $this->aliases[$id].'/'.$path; |
|
98 | 98 | } else { |
99 | 99 | $path = $this->aliases[$id]; |
100 | 100 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $modx->messageQuit("Cache path not set."); |
119 | 119 | } |
120 | 120 | |
121 | - $files = glob(realpath($this->cachePath) . '/*.pageCache.php'); |
|
121 | + $files = glob(realpath($this->cachePath).'/*.pageCache.php'); |
|
122 | 122 | $filesincache = count($files); |
123 | 123 | $deletedfiles = array(); |
124 | 124 | while ($file = array_shift($files)) { |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | if (isset($opcache)) { |
152 | 152 | echo '<p>Opcache empty.</p>'; |
153 | 153 | } |
154 | - echo '<p>' . $_lang['cache_files_deleted'] . '</p><ul>'; |
|
154 | + echo '<p>'.$_lang['cache_files_deleted'].'</p><ul>'; |
|
155 | 155 | foreach ($deletedfiles as $deletedfile) { |
156 | - echo '<li>' . $deletedfile . '</li>'; |
|
156 | + echo '<li>'.$deletedfile.'</li>'; |
|
157 | 157 | } |
158 | 158 | echo '</ul>'; |
159 | 159 | } |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | |
173 | 173 | |
174 | 174 | // write the file |
175 | - $content = '<?php' . "\n"; |
|
176 | - $content .= '$recent_update=\'' . $this->request_time . '\';' . "\n"; |
|
177 | - $content .= '$cacheRefreshTime=\'' . $cacheRefreshTime . '\';' . "\n"; |
|
175 | + $content = '<?php'."\n"; |
|
176 | + $content .= '$recent_update=\''.$this->request_time.'\';'."\n"; |
|
177 | + $content .= '$cacheRefreshTime=\''.$cacheRefreshTime.'\';'."\n"; |
|
178 | 178 | |
179 | - $filename = $this->cachePath . '/sitePublishing.idx.php'; |
|
179 | + $filename = $this->cachePath.'/sitePublishing.idx.php'; |
|
180 | 180 | if (!$handle = fopen($filename, 'w')) { |
181 | 181 | exit("Cannot open file ({$filename}"); |
182 | 182 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $timesArr = array(); |
201 | 201 | |
202 | 202 | $result = $modx->db->select('MIN(pub_date) AS minpub', '[+prefix+]site_content', |
203 | - 'pub_date>' . $this->request_time); |
|
203 | + 'pub_date>'.$this->request_time); |
|
204 | 204 | if (!$result) { |
205 | 205 | echo "Couldn't determine next publish event!"; |
206 | 206 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | $result = $modx->db->select('MIN(unpub_date) AS minunpub', '[+prefix+]site_content', |
214 | - 'unpub_date>' . $this->request_time); |
|
214 | + 'unpub_date>'.$this->request_time); |
|
215 | 215 | if (!$result) { |
216 | 216 | echo "Couldn't determine next unpublish event!"; |
217 | 217 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $config = array(); |
251 | 251 | $content .= '$c=&$this->config;'; |
252 | 252 | while (list($key, $value) = $modx->db->getRow($rs, 'num')) { |
253 | - $content .= '$c[\'' . $key . '\']="' . $this->escapeDoubleQuotes($value) . '";'; |
|
253 | + $content .= '$c[\''.$key.'\']="'.$this->escapeDoubleQuotes($value).'";'; |
|
254 | 254 | $config[$key] = $value; |
255 | 255 | } |
256 | 256 | |
@@ -288,23 +288,23 @@ discard block |
||
288 | 288 | $docid = $doc['id']; |
289 | 289 | if ($use_alias_path) { |
290 | 290 | $tmpPath = $this->getParents($doc['parent']); |
291 | - $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '') . $doc['alias']; |
|
291 | + $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '').$doc['alias']; |
|
292 | 292 | $key = $alias; |
293 | 293 | } else { |
294 | 294 | $key = $doc['alias']; |
295 | 295 | } |
296 | 296 | |
297 | 297 | $doc['path'] = $tmpPath; |
298 | - $content .= '$a[' . $docid . ']=array(\'id\'=>' . $docid . ',\'alias\'=>\'' . $doc['alias'] . '\',\'path\'=>\'' . $doc['path'] . '\',\'parent\'=>' . $doc['parent'] . ',\'isfolder\'=>' . $doc['isfolder'] . ',\'alias_visible\'=>' . $doc['alias_visible'] . ');'; |
|
299 | - $content .= '$d[\'' . $key . '\']=' . $docid . ';'; |
|
300 | - $content .= '$m[]=array(' . $doc['parent'] . '=>' . $docid . ');'; |
|
298 | + $content .= '$a['.$docid.']=array(\'id\'=>'.$docid.',\'alias\'=>\''.$doc['alias'].'\',\'path\'=>\''.$doc['path'].'\',\'parent\'=>'.$doc['parent'].',\'isfolder\'=>'.$doc['isfolder'].',\'alias_visible\'=>'.$doc['alias_visible'].');'; |
|
299 | + $content .= '$d[\''.$key.'\']='.$docid.';'; |
|
300 | + $content .= '$m[]=array('.$doc['parent'].'=>'.$docid.');'; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | // get content types |
304 | 304 | $rs = $modx->db->select('id, contentType', '[+prefix+]site_content', "contentType!='text/html'"); |
305 | 305 | $content .= '$c=&$this->contentTypes;'; |
306 | 306 | while ($doc = $modx->db->getRow($rs)) { |
307 | - $content .= '$c[\'' . $doc['id'] . '\']=\'' . $doc['contentType'] . '\';'; |
|
307 | + $content .= '$c[\''.$doc['id'].'\']=\''.$doc['contentType'].'\';'; |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | // WRITE Chunks to cache file |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | if ($modx->config['minifyphp_incache']) { |
315 | 315 | $doc['snippet'] = $this->php_strip_whitespace($doc['snippet']); |
316 | 316 | } |
317 | - $content .= '$c[\'' . $doc['name'] . '\']=\'' . ($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])) . '\';'; |
|
317 | + $content .= '$c[\''.$doc['name'].'\']=\''.($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])).'\';'; |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | // WRITE snippets to cache file |
@@ -325,18 +325,18 @@ discard block |
||
325 | 325 | while ($row = $modx->db->getRow($rs)) { |
326 | 326 | $key = $row['name']; |
327 | 327 | if ($row['disabled']) { |
328 | - $content .= '$s[\'' . $key . '\']=\'return false;\';'; |
|
328 | + $content .= '$s[\''.$key.'\']=\'return false;\';'; |
|
329 | 329 | } else { |
330 | 330 | $value = trim($row['snippet']); |
331 | 331 | if ($modx->config['minifyphp_incache']) { |
332 | 332 | $value = $this->php_strip_whitespace($value); |
333 | 333 | } |
334 | - $content .= '$s[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';'; |
|
334 | + $content .= '$s[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';'; |
|
335 | 335 | $properties = $modx->parseProperties($row['properties']); |
336 | 336 | $sharedproperties = $modx->parseProperties($row['sharedproperties']); |
337 | 337 | $properties = array_merge($sharedproperties, $properties); |
338 | 338 | if (0 < count($properties)) { |
339 | - $content .= '$s[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';'; |
|
339 | + $content .= '$s[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';'; |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | } |
@@ -354,13 +354,13 @@ discard block |
||
354 | 354 | if ($modx->config['minifyphp_incache']) { |
355 | 355 | $value = $this->php_strip_whitespace($value); |
356 | 356 | } |
357 | - $content .= '$p[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';'; |
|
357 | + $content .= '$p[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';'; |
|
358 | 358 | if ($row['properties'] != '' || $row['sharedproperties'] != '') { |
359 | 359 | $properties = $modx->parseProperties($row['properties']); |
360 | 360 | $sharedproperties = $modx->parseProperties($row['sharedproperties']); |
361 | 361 | $properties = array_merge($sharedproperties, $properties); |
362 | 362 | if (0 < count($properties)) { |
363 | - $content .= '$p[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';'; |
|
363 | + $content .= '$p[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';'; |
|
364 | 364 | } |
365 | 365 | } |
366 | 366 | } |
@@ -383,14 +383,14 @@ discard block |
||
383 | 383 | } |
384 | 384 | foreach ($events as $evtname => $pluginnames) { |
385 | 385 | $events[$evtname] = $pluginnames; |
386 | - $content .= '$e[\'' . $evtname . '\']=array(\'' . implode('\',\'', |
|
387 | - $this->escapeSingleQuotes($pluginnames)) . '\');'; |
|
386 | + $content .= '$e[\''.$evtname.'\']=array(\''.implode('\',\'', |
|
387 | + $this->escapeSingleQuotes($pluginnames)).'\');'; |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | $content .= "\n"; |
391 | 391 | |
392 | 392 | // close and write the file |
393 | - $filename = $this->cachePath . 'siteCache.idx.php'; |
|
393 | + $filename = $this->cachePath.'siteCache.idx.php'; |
|
394 | 394 | |
395 | 395 | // invoke OnBeforeCacheUpdate event |
396 | 396 | if ($modx) { |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | exit("Cannot write main MODX cache file! Make sure the assets/cache directory is writable!"); |
402 | 402 | } |
403 | 403 | |
404 | - if (!is_file($this->cachePath . '/.htaccess')) { |
|
405 | - file_put_contents($this->cachePath . '/.htaccess', "order deny,allow\ndeny from all\n"); |
|
404 | + if (!is_file($this->cachePath.'/.htaccess')) { |
|
405 | + file_put_contents($this->cachePath.'/.htaccess', "order deny,allow\ndeny from all\n"); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | // invoke OnCacheUpdate event |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | |
425 | 425 | $source = trim($source); |
426 | 426 | if (substr($source, 0, 5) !== '<?php') { |
427 | - $source = '<?php ' . $source; |
|
427 | + $source = '<?php '.$source; |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | $tokens = token_get_all($source); |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | } |
483 | 483 | } |
484 | 484 | $source = preg_replace(array('@^<\?php@i', '|\s+|', '|<!--|', '|-->|', '|-->\s+<!--|'), |
485 | - array('', ' ', "\n" . '<!--', '-->' . "\n", '-->' . "\n" . '<!--'), $_); |
|
485 | + array('', ' ', "\n".'<!--', '-->'."\n", '-->'."\n".'<!--'), $_); |
|
486 | 486 | $source = trim($source); |
487 | 487 | |
488 | 488 | return $source; |
@@ -79,7 +79,8 @@ discard block |
||
79 | 79 | * @return string |
80 | 80 | */ |
81 | 81 | public function getParents($id, $path = '') |
82 | - { // modx:returns child's parent |
|
82 | + { |
|
83 | +// modx:returns child's parent |
|
83 | 84 | $modx = evolutionCMS(); |
84 | 85 | if (empty($this->aliases)) { |
85 | 86 | $f = "id, IF(alias='', id, alias) AS alias, parent, alias_visible"; |
@@ -456,7 +457,8 @@ discard block |
||
456 | 457 | $_ = trim($_); |
457 | 458 | } |
458 | 459 | $lastChar = substr($_, -1); |
459 | - if (!in_array($lastChar, $chars)) {// ,320,327,288,284,289 |
|
460 | + if (!in_array($lastChar, $chars)) { |
|
461 | +// ,320,327,288,284,289 |
|
460 | 462 | if (!in_array($prev_token, |
461 | 463 | array(T_FOREACH, T_WHILE, T_FOR, T_BOOLEAN_AND, T_BOOLEAN_OR, T_DOUBLE_ARROW))) { |
462 | 464 | $_ .= ' '; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! function_exists('install_sessionCheck')) { |
|
2 | +if (!function_exists('install_sessionCheck')) { |
|
3 | 3 | function install_sessionCheck() |
4 | 4 | { |
5 | 5 | global $_lang; |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | </head> |
22 | 22 | <body> |
23 | 23 | <div class="install"> |
24 | - <p>' . $_lang["session_problem"] . '</p> |
|
25 | - <p><a href="./">' . $_lang["session_problem_try_again"] . '</a></p> |
|
24 | + <p>' . $_lang["session_problem"].'</p> |
|
25 | + <p><a href="./">' . $_lang["session_problem_try_again"].'</a></p> |
|
26 | 26 | </div> |
27 | 27 | </body> |
28 | 28 | </html>'; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | -if( ! function_exists('parse')) { |
|
35 | +if (!function_exists('parse')) { |
|
36 | 36 | /** |
37 | 37 | * @param string $src |
38 | 38 | * @param array $ph |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | function parse($src, $ph, $left = '[+', $right = '+]') |
44 | 44 | { |
45 | 45 | foreach ($ph as $k => $v) { |
46 | - $k = $left . $k . $right; |
|
46 | + $k = $left.$k.$right; |
|
47 | 47 | $src = str_replace($k, $v, $src); |
48 | 48 | } |
49 | 49 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | -if( ! function_exists('ph')) { |
|
54 | +if (!function_exists('ph')) { |
|
55 | 55 | /** |
56 | 56 | * @return array |
57 | 57 | */ |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $ph['textdir'] = $modx_textdir ? ' id="rtl"' : ''; |
71 | 71 | $ph['help_link'] = $installmode == 0 ? $_lang['help_link_new'] : $_lang['help_link_upd']; |
72 | 72 | $ph['version'] = $moduleVersion; |
73 | - $ph['release_date'] = ($modx_textdir ? '‏' : '') . $modx_release_date; |
|
73 | + $ph['release_date'] = ($modx_textdir ? '‏' : '').$modx_release_date; |
|
74 | 74 | $ph['footer1'] = $_lang['modx_footer1']; |
75 | 75 | $ph['footer2'] = $_lang['modx_footer2']; |
76 | 76 | $ph['current_year'] = date('Y'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | -if( ! function_exists('get_installmode')) { |
|
82 | +if (!function_exists('get_installmode')) { |
|
83 | 83 | /** |
84 | 84 | * @return int |
85 | 85 | */ |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
144 | -if( ! function_exists('getLangs')) { |
|
144 | +if (!function_exists('getLangs')) { |
|
145 | 145 | /** |
146 | 146 | * @param string $install_language |
147 | 147 | * @return string |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | $langs = array(); |
158 | - if ($handle = opendir("../" . MGR_DIR . "/includes/lang")) { |
|
158 | + if ($handle = opendir("../".MGR_DIR."/includes/lang")) { |
|
159 | 159 | while (false !== ($file = readdir($handle))) { |
160 | 160 | if (strpos($file, '.inc.') !== false) { |
161 | 161 | $langs[] = $file; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | function get_lang_keys($filename) |
9 | 9 | { |
10 | - $file = MODX_MANAGER_PATH . 'includes/lang' . DIRECTORY_SEPARATOR . $filename; |
|
10 | + $file = MODX_MANAGER_PATH.'includes/lang'.DIRECTORY_SEPARATOR.$filename; |
|
11 | 11 | if (is_file($file) && is_readable($file)) { |
12 | 12 | include($file); |
13 | 13 | $out = isset($_lang) ? array_keys($_lang) : array(); |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | if (!empty($key)) { |
54 | 54 | $languages = get_langs_by_key($key); |
55 | 55 | sort($languages); |
56 | - $lang_options .= '<option value="">' . $_lang['language_title'] . '</option>'; |
|
56 | + $lang_options .= '<option value="">'.$_lang['language_title'].'</option>'; |
|
57 | 57 | |
58 | 58 | foreach ($languages as $language_name) { |
59 | 59 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
60 | - $lang_options .= '<option value="' . $language_name . '">' . $uclanguage_name . '</option>'; |
|
60 | + $lang_options .= '<option value="'.$language_name.'">'.$uclanguage_name.'</option>'; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $lang_options; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | foreach ($languages as $language_name) { |
68 | 68 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
69 | 69 | $sel = $language_name === $selected_lang ? ' selected="selected"' : ''; |
70 | - $lang_options .= '<option value="' . $language_name . '" ' . $sel . '>' . $uclanguage_name . '</option>'; |
|
70 | + $lang_options .= '<option value="'.$language_name.'" '.$sel.'>'.$uclanguage_name.'</option>'; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | return $lang_options; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $disabled = ''; |
93 | 93 | } |
94 | 94 | if ($add) { |
95 | - $add = ' ' . $add; |
|
95 | + $add = ' '.$add; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name, $value, |
@@ -5,13 +5,13 @@ discard block |
||
5 | 5 | * @param string $filename |
6 | 6 | * @return array of keys from a language file |
7 | 7 | */ |
8 | -function get_lang_keys($filename) |
|
9 | -{ |
|
8 | +function get_lang_keys($filename) |
|
9 | +{ |
|
10 | 10 | $file = MODX_MANAGER_PATH . 'includes/lang' . DIRECTORY_SEPARATOR . $filename; |
11 | - if (is_file($file) && is_readable($file)) { |
|
11 | + if (is_file($file) && is_readable($file)) { |
|
12 | 12 | include($file); |
13 | 13 | $out = isset($_lang) ? array_keys($_lang) : array(); |
14 | - } else { |
|
14 | + } else { |
|
15 | 15 | $out = array(); |
16 | 16 | } |
17 | 17 | |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | * @param string $key |
25 | 25 | * @return array of languages that define the key in their file |
26 | 26 | */ |
27 | -function get_langs_by_key($key) |
|
28 | -{ |
|
27 | +function get_langs_by_key($key) |
|
28 | +{ |
|
29 | 29 | global $lang_keys; |
30 | 30 | $lang_return = array(); |
31 | - foreach ($lang_keys as $lang => $keys) { |
|
32 | - if (in_array($key, $keys)) { |
|
31 | + foreach ($lang_keys as $lang => $keys) { |
|
32 | + if (in_array($key, $keys)) { |
|
33 | 33 | $lang_return[] = $lang; |
34 | 34 | } |
35 | 35 | } |
@@ -46,25 +46,25 @@ discard block |
||
46 | 46 | * @param string $selected_lang specify language to select in option list, default none |
47 | 47 | * @return string html option list |
48 | 48 | */ |
49 | -function get_lang_options($key = '', $selected_lang = '') |
|
50 | -{ |
|
49 | +function get_lang_options($key = '', $selected_lang = '') |
|
50 | +{ |
|
51 | 51 | global $lang_keys, $_lang; |
52 | 52 | $lang_options = ''; |
53 | - if (!empty($key)) { |
|
53 | + if (!empty($key)) { |
|
54 | 54 | $languages = get_langs_by_key($key); |
55 | 55 | sort($languages); |
56 | 56 | $lang_options .= '<option value="">' . $_lang['language_title'] . '</option>'; |
57 | 57 | |
58 | - foreach ($languages as $language_name) { |
|
58 | + foreach ($languages as $language_name) { |
|
59 | 59 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
60 | 60 | $lang_options .= '<option value="' . $language_name . '">' . $uclanguage_name . '</option>'; |
61 | 61 | } |
62 | 62 | |
63 | 63 | return $lang_options; |
64 | - } else { |
|
64 | + } else { |
|
65 | 65 | $languages = array_keys($lang_keys); |
66 | 66 | sort($languages); |
67 | - foreach ($languages as $language_name) { |
|
67 | + foreach ($languages as $language_name) { |
|
68 | 68 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
69 | 69 | $sel = $language_name === $selected_lang ? ' selected="selected"' : ''; |
70 | 70 | $lang_options .= '<option value="' . $language_name . '" ' . $sel . '>' . $uclanguage_name . '</option>'; |
@@ -81,17 +81,17 @@ discard block |
||
81 | 81 | * @param bool $disabled |
82 | 82 | * @return string |
83 | 83 | */ |
84 | -function form_radio($name, $value, $add = '', $disabled = false) |
|
85 | -{ |
|
84 | +function form_radio($name, $value, $add = '', $disabled = false) |
|
85 | +{ |
|
86 | 86 | global ${$name}; |
87 | 87 | $var = ${$name}; |
88 | 88 | $checked = ($var == $value) ? ' checked="checked"' : ''; |
89 | - if ($disabled) { |
|
89 | + if ($disabled) { |
|
90 | 90 | $disabled = ' disabled'; |
91 | - } else { |
|
91 | + } else { |
|
92 | 92 | $disabled = ''; |
93 | 93 | } |
94 | - if ($add) { |
|
94 | + if ($add) { |
|
95 | 95 | $add = ' ' . $add; |
96 | 96 | } |
97 | 97 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param string $object |
105 | 105 | * @return string |
106 | 106 | */ |
107 | -function wrap_label($str = '', $object) |
|
108 | -{ |
|
107 | +function wrap_label($str = '', $object) |
|
108 | +{ |
|
109 | 109 | return "<label>{$object}\n{$str}</label>"; |
110 | 110 | } |
111 | 111 | |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | * @param array $ph |
115 | 115 | * @return string |
116 | 116 | */ |
117 | -function parseText($tpl = '', $ph = array()) |
|
118 | -{ |
|
119 | - if (empty($ph) || empty($tpl)) { |
|
117 | +function parseText($tpl = '', $ph = array()) |
|
118 | +{ |
|
119 | + if (empty($ph) || empty($tpl)) { |
|
120 | 120 | return $tpl; |
121 | 121 | } |
122 | 122 | |
123 | - foreach ($ph as $k => $v) { |
|
123 | + foreach ($ph as $k => $v) { |
|
124 | 124 | $k = "[+{$k}+]"; |
125 | 125 | $tpl = str_replace($k, $v, $tpl); |
126 | 126 | } |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * @param bool $cond |
133 | 133 | * @return string |
134 | 134 | */ |
135 | -function showHide($cond = true) |
|
136 | -{ |
|
135 | +function showHide($cond = true) |
|
136 | +{ |
|
137 | 137 | global $displayStyle; |
138 | 138 | $showHide = $cond ? $displayStyle : 'none'; |
139 | 139 |
@@ -4,18 +4,18 @@ discard block |
||
4 | 4 | } |
5 | 5 | $logo= '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">'; |
6 | 6 | $downloadLinks = array( |
7 | - 0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'), |
|
8 | - 1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'), |
|
9 | - 2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'), |
|
10 | - 3=>array('title'=>$_lang["extras"],'link'=>array( |
|
11 | - 'http://extras.evolution-cms.com/', |
|
12 | - 'https://github.com/extras-evolution' |
|
13 | - )), |
|
7 | + 0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'), |
|
8 | + 1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'), |
|
9 | + 2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'), |
|
10 | + 3=>array('title'=>$_lang["extras"],'link'=>array( |
|
11 | + 'http://extras.evolution-cms.com/', |
|
12 | + 'https://github.com/extras-evolution' |
|
13 | + )), |
|
14 | 14 | ); |
15 | 15 | |
16 | 16 | $translationLinks = array( |
17 | - 0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'), |
|
18 | - 1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'), |
|
17 | + 0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'), |
|
18 | + 1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'), |
|
19 | 19 | ); |
20 | 20 | |
21 | 21 | /** |
@@ -24,23 +24,23 @@ discard block |
||
24 | 24 | * @return string |
25 | 25 | */ |
26 | 26 | function createList($sectionHeader, $linkArr) { |
27 | - $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n"; |
|
28 | - $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">'."\n"; |
|
29 | - $links = ''; |
|
30 | - foreach($linkArr as $row) { |
|
31 | - if (!is_array($row['link'])) $row['link'] = array($row['link']); |
|
32 | - foreach ($row['link'] as $link) { |
|
33 | - $links .= $links != '' ? '<br/>' : ''; |
|
34 | - $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>'; |
|
35 | - } |
|
36 | - $output .= ' |
|
27 | + $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n"; |
|
28 | + $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">'."\n"; |
|
29 | + $links = ''; |
|
30 | + foreach($linkArr as $row) { |
|
31 | + if (!is_array($row['link'])) $row['link'] = array($row['link']); |
|
32 | + foreach ($row['link'] as $link) { |
|
33 | + $links .= $links != '' ? '<br/>' : ''; |
|
34 | + $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>'; |
|
35 | + } |
|
36 | + $output .= ' |
|
37 | 37 | <tr> |
38 | 38 | <td align="left"><strong>' . $row["title"] . '</strong></td> |
39 | 39 | <td align="left">' . $links . '</td> |
40 | 40 | </tr>'; |
41 | - $links = ''; |
|
42 | - } |
|
43 | - $output .= '</table></div>'."\n"; |
|
41 | + $links = ''; |
|
42 | + } |
|
43 | + $output .= '</table></div>'."\n"; |
|
44 | 44 | return $output; |
45 | 45 | } |
46 | 46 | echo $logo; |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -$logo= '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">'; |
|
5 | +$logo = '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">'; |
|
6 | 6 | $downloadLinks = array( |
7 | - 0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'), |
|
8 | - 1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'), |
|
9 | - 2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'), |
|
10 | - 3=>array('title'=>$_lang["extras"],'link'=>array( |
|
7 | + 0=>array('title'=>$_lang["information"], 'link'=>'https://evo.im/'), |
|
8 | + 1=>array('title'=>$_lang["download"], 'link'=>'https://github.com/evolution-cms/evolution/releases'), |
|
9 | + 2=>array('title'=>$_lang["previous_releases"], 'link'=>'https://modx.com/download/evolution/previous-releases.html'), |
|
10 | + 3=>array('title'=>$_lang["extras"], 'link'=>array( |
|
11 | 11 | 'http://extras.evolution-cms.com/', |
12 | 12 | 'https://github.com/extras-evolution' |
13 | 13 | )), |
14 | 14 | ); |
15 | 15 | |
16 | 16 | $translationLinks = array( |
17 | - 0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'), |
|
18 | - 1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'), |
|
17 | + 0=>array('title'=>'Evolution CMS', 'link'=>'https://www.transifex.com/evolutioncms/evolution/'), |
|
18 | + 1=>array('title'=>$_lang["extras"], 'link'=>'https://www.transifex.com/evolutioncms/extras/'), |
|
19 | 19 | ); |
20 | 20 | |
21 | 21 | /** |
@@ -23,20 +23,20 @@ discard block |
||
23 | 23 | * @param array $linkArr |
24 | 24 | * @return string |
25 | 25 | */ |
26 | -function createList($sectionHeader, $linkArr) { |
|
26 | +function createList($sectionHeader, $linkArr){ |
|
27 | 27 | $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n"; |
28 | 28 | $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">'."\n"; |
29 | 29 | $links = ''; |
30 | - foreach($linkArr as $row) { |
|
30 | + foreach ($linkArr as $row) { |
|
31 | 31 | if (!is_array($row['link'])) $row['link'] = array($row['link']); |
32 | 32 | foreach ($row['link'] as $link) { |
33 | 33 | $links .= $links != '' ? '<br/>' : ''; |
34 | - $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>'; |
|
34 | + $links .= '<a href="'.$link.'" target="_blank">'.$link.'</a>'; |
|
35 | 35 | } |
36 | 36 | $output .= ' |
37 | 37 | <tr> |
38 | - <td align="left"><strong>' . $row["title"] . '</strong></td> |
|
39 | - <td align="left">' . $links . '</td> |
|
38 | + <td align="left"><strong>' . $row["title"].'</strong></td> |
|
39 | + <td align="left">' . $links.'</td> |
|
40 | 40 | </tr>'; |
41 | 41 | $links = ''; |
42 | 42 | } |
@@ -23,12 +23,15 @@ |
||
23 | 23 | * @param array $linkArr |
24 | 24 | * @return string |
25 | 25 | */ |
26 | -function createList($sectionHeader, $linkArr) { |
|
26 | +function createList($sectionHeader, $linkArr) |
|
27 | +{ |
|
27 | 28 | $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n"; |
28 | 29 | $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">'."\n"; |
29 | 30 | $links = ''; |
30 | 31 | foreach($linkArr as $row) { |
31 | - if (!is_array($row['link'])) $row['link'] = array($row['link']); |
|
32 | + if (!is_array($row['link'])) { |
|
33 | + $row['link'] = array($row['link']); |
|
34 | + } |
|
32 | 35 | foreach ($row['link'] as $link) { |
33 | 36 | $links .= $links != '' ? '<br/>' : ''; |
34 | 37 | $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>'; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | die('Please use the MODx Backend.'); |
8 | 8 | } |
9 | 9 | |
10 | -require_once realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'Categories.php'; |
|
10 | +require_once realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'Categories.php'; |
|
11 | 11 | |
12 | 12 | class Module_Categories_Manager extends Categories |
13 | 13 | { |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | { |
95 | 95 | global $_lang, $_style; |
96 | 96 | |
97 | - $filename = trim($view_name) . '.tpl.phtml'; |
|
98 | - $file = self::get('views_dir') . $filename; |
|
97 | + $filename = trim($view_name).'.tpl.phtml'; |
|
98 | + $file = self::get('views_dir').$filename; |
|
99 | 99 | $view = &$this; |
100 | 100 | |
101 | 101 | if (is_file($file) |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | { |
121 | 121 | |
122 | 122 | $_update = array( |
123 | - 'id' => (int)$element_id, |
|
124 | - 'category' => (int)$category_id |
|
123 | + 'id' => (int) $element_id, |
|
124 | + 'category' => (int) $category_id |
|
125 | 125 | ); |
126 | 126 | |
127 | 127 | $this->db->update( |
128 | 128 | $_update, |
129 | 129 | $this->db_tbl[$element], |
130 | - "`id` = '" . (int)$element_id . "'" |
|
130 | + "`id` = '".(int) $element_id."'" |
|
131 | 131 | ); |
132 | 132 | |
133 | 133 | return $this->db->getAffectedRows() === 1; |
@@ -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 |
@@ -20,14 +20,14 @@ |
||
20 | 20 | ($docid > 0 ? "id='$docid'" : "privatemgr = 1")); |
21 | 21 | $rs = $modx->db->select( |
22 | 22 | 'DISTINCT sc.id', |
23 | - $modx->getFullTableName("site_content") . " sc |
|
24 | - LEFT JOIN " . $modx->getFullTableName("document_groups") . " dg ON dg.document = sc.id |
|
25 | - LEFT JOIN " . $modx->getFullTableName("membergroup_access") . " mga ON mga.documentgroup = dg.document_group", |
|
26 | - ($docid > 0 ? " sc.id='{$docid}' AND " : "") . "mga.id>0" |
|
23 | + $modx->getFullTableName("site_content")." sc |
|
24 | + LEFT JOIN " . $modx->getFullTableName("document_groups")." dg ON dg.document = sc.id |
|
25 | + LEFT JOIN " . $modx->getFullTableName("membergroup_access")." mga ON mga.documentgroup = dg.document_group", |
|
26 | + ($docid > 0 ? " sc.id='{$docid}' AND " : "")."mga.id>0" |
|
27 | 27 | ); |
28 | 28 | $ids = $modx->db->getColumn("id", $rs); |
29 | 29 | if (count($ids) > 0) { |
30 | 30 | $modx->db->update('privatemgr = 1', $modx->getFullTableName("site_content"), |
31 | - "id IN (" . implode(", ", $ids) . ")"); |
|
31 | + "id IN (".implode(", ", $ids).")"); |
|
32 | 32 | } |
33 | 33 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | if (!empty($user_id)) { |
15 | 15 | // Raymond: grab the user settings from the database. |
16 | 16 | $rs = $modx->db->select('setting_name, setting_value', $modx->getFullTableName('user_settings'), |
17 | - "user=" . $modx->getLoginUserID()); |
|
17 | + "user=".$modx->getLoginUserID()); |
|
18 | 18 | |
19 | 19 | $which_browser_default = $which_browser; |
20 | 20 | while ($row = $modx->db->getRow($rs)) { |