@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * Build and return document tree view nodes |
5 | 5 | * |
6 | 6 | */ |
7 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
7 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
8 | 8 | die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.'); |
9 | 9 | } |
10 | 10 | |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | exit('send some data'); |
19 | 19 | } //?? |
20 | 20 | |
21 | -$indent = (int)$_REQUEST['indent']; |
|
22 | -$parent = (int)$_REQUEST['parent']; |
|
23 | -$expandAll = (int)$_REQUEST['expandAll']; |
|
21 | +$indent = (int) $_REQUEST['indent']; |
|
22 | +$parent = (int) $_REQUEST['parent']; |
|
23 | +$expandAll = (int) $_REQUEST['expandAll']; |
|
24 | 24 | $output = ''; |
25 | -$theme = $manager_theme . "/"; |
|
25 | +$theme = $manager_theme."/"; |
|
26 | 26 | $hereid = isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) ? $_REQUEST['id'] : ''; |
27 | 27 | |
28 | 28 | if (isset($_REQUEST['showonlyfolders'])) { |
@@ -1,5 +1,5 @@ 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 | 5 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @param string $hereid |
12 | 12 | * @return string |
13 | 13 | */ |
14 | -function makeHTML($indent, $parent, $expandAll, $theme, $hereid = '') { |
|
14 | +function makeHTML($indent, $parent, $expandAll, $theme, $hereid = ''){ |
|
15 | 15 | global $modx; |
16 | 16 | global $icons, $iconsPrivate, $_style; |
17 | 17 | global $_lang, $opened, $opened2, $closed2; //added global vars |
@@ -22,35 +22,35 @@ discard block |
||
22 | 22 | // setup spacer |
23 | 23 | $level = 0; |
24 | 24 | $spacer = '<span class="indent">'; |
25 | - for($i = 2; $i <= $indent; $i++) { |
|
25 | + for ($i = 2; $i <= $indent; $i++) { |
|
26 | 26 | $spacer .= '<i></i>'; |
27 | 27 | $level++; |
28 | 28 | } |
29 | 29 | $spacer .= '</span>'; |
30 | 30 | |
31 | 31 | // manage order-by |
32 | - if(!isset($_SESSION['tree_sortby']) && !isset($_SESSION['tree_sortdir'])) { |
|
32 | + if (!isset($_SESSION['tree_sortby']) && !isset($_SESSION['tree_sortdir'])) { |
|
33 | 33 | // This is the first startup, set default sort order |
34 | 34 | $_SESSION['tree_sortby'] = 'menuindex'; |
35 | 35 | $_SESSION['tree_sortdir'] = 'ASC'; |
36 | 36 | } |
37 | 37 | |
38 | - switch($_SESSION['tree_sortby']) { |
|
38 | + switch ($_SESSION['tree_sortby']) { |
|
39 | 39 | case 'createdon': |
40 | 40 | case 'editedon': |
41 | 41 | case 'publishedon': |
42 | 42 | case 'pub_date': |
43 | 43 | case 'unpub_date': |
44 | - $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'], 'sc.' . $_SESSION['tree_sortby']); |
|
44 | + $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.'.$_SESSION['tree_sortby'], 'sc.'.$_SESSION['tree_sortby']); |
|
45 | 45 | break; |
46 | 46 | default: |
47 | - $sortby = 'sc.' . $_SESSION['tree_sortby']; |
|
47 | + $sortby = 'sc.'.$_SESSION['tree_sortby']; |
|
48 | 48 | }; |
49 | 49 | |
50 | - $orderby = $modx->db->escape($sortby . ' ' . $_SESSION['tree_sortdir']); |
|
50 | + $orderby = $modx->db->escape($sortby.' '.$_SESSION['tree_sortdir']); |
|
51 | 51 | |
52 | 52 | // Folder sorting gets special setup ;) Add menuindex and pagetitle |
53 | - if($_SESSION['tree_sortby'] == 'isfolder') { |
|
53 | + if ($_SESSION['tree_sortby'] == 'isfolder') { |
|
54 | 54 | $orderby .= ', menuindex ASC, pagetitle'; |
55 | 55 | } |
56 | 56 | |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | // get document groups for current user |
61 | 61 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
62 | 62 | $showProtected = false; |
63 | - if(isset ($modx->config['tree_show_protected'])) { |
|
63 | + if (isset ($modx->config['tree_show_protected'])) { |
|
64 | 64 | $showProtected = (boolean) $modx->config['tree_show_protected']; |
65 | 65 | } |
66 | 66 | $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0'; |
67 | - if($showProtected == false) { |
|
68 | - $access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
67 | + if ($showProtected == false) { |
|
68 | + $access = "AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
69 | 69 | } else { |
70 | 70 | $access = ''; |
71 | 71 | } |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | $from = "{$tblsc} AS sc LEFT JOIN {$tbldg} dg on dg.document = sc.id LEFT JOIN {$tblst} st on st.id = sc.template"; |
76 | 76 | $where = "(parent={$parent}) {$access} GROUP BY sc.id"; |
77 | 77 | $result = $modx->db->select($field, $from, $where, $orderby); |
78 | - if($modx->db->getRecordCount($result) == 0) { |
|
78 | + if ($modx->db->getRecordCount($result) == 0) { |
|
79 | 79 | $output .= sprintf('<div><a class="empty">%s%s <span class="empty">%s</span></a></div>', $spacer, $_style['tree_deletedpage'], $_lang['empty_folder']); |
80 | 80 | } |
81 | 81 | |
82 | 82 | $nodeNameSource = $_SESSION['tree_nodename'] == 'default' ? $modx->config['resource_tree_node_name'] : $_SESSION['tree_nodename']; |
83 | 83 | |
84 | - while($row = $modx->db->getRow($result)) { |
|
84 | + while ($row = $modx->db->getRow($result)) { |
|
85 | 85 | $node = ''; |
86 | 86 | |
87 | 87 | $nodetitle = getNodeTitle($nodeNameSource, $row); |
@@ -90,46 +90,46 @@ discard block |
||
90 | 90 | $treeNodeClass = 'node'; |
91 | 91 | $treeNodeClass .= $row['hasAccess'] == 0 ? ' protected' : ''; |
92 | 92 | |
93 | - if($row['deleted'] == 1) { |
|
93 | + if ($row['deleted'] == 1) { |
|
94 | 94 | $treeNodeClass .= ' deleted'; |
95 | 95 | //$nodetitleDisplay = sprintf('<span class="deletedNode">%s</span>', $nodetitle); |
96 | - } elseif($row['published'] == 0) { |
|
96 | + } elseif ($row['published'] == 0) { |
|
97 | 97 | $treeNodeClass .= ' unpublished'; |
98 | 98 | //$nodetitleDisplay = sprintf('<span class="unpublishedNode">%s</span>', $nodetitle); |
99 | - } elseif($row['hidemenu'] == 1) { |
|
99 | + } elseif ($row['hidemenu'] == 1) { |
|
100 | 100 | $treeNodeClass .= ' hidemenu'; |
101 | 101 | //$nodetitleDisplay = sprintf('<span class="notInMenuNode%s">%s</span>', $protectedClass, $nodetitle); |
102 | 102 | } else { |
103 | 103 | //$nodetitleDisplay = sprintf('<span class="publishedNode%s">%s</span>', $protectedClass, $nodetitle); |
104 | 104 | } |
105 | 105 | |
106 | - if($row['id'] == $hereid) { |
|
106 | + if ($row['id'] == $hereid) { |
|
107 | 107 | $treeNodeClass .= ' current'; |
108 | 108 | } |
109 | 109 | |
110 | 110 | $weblinkDisplay = $row['type'] == 'reference' ? sprintf(' %s', $_style['tree_linkgo']) : ''; |
111 | - $pageIdDisplay = '<small>(' . ($modx_textdir ? '‏' : '') . $row['id'] . ')</small>'; |
|
111 | + $pageIdDisplay = '<small>('.($modx_textdir ? '‏' : '').$row['id'].')</small>'; |
|
112 | 112 | |
113 | 113 | // Prepare displaying user-locks |
114 | 114 | $lockedByUser = ''; |
115 | 115 | $rowLock = $modx->elementIsLocked(7, $row['id'], true); |
116 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
117 | - if($rowLock['sid'] == $modx->sid) { |
|
116 | + if ($rowLock && $modx->hasPermission('display_locks')) { |
|
117 | + if ($rowLock['sid'] == $modx->sid) { |
|
118 | 118 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
119 | 119 | 'element_type' => $_lang["lock_element_type_7"], |
120 | 120 | 'lasthit_df' => $rowLock['lasthit_df'] |
121 | 121 | )); |
122 | - $lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>'; |
|
122 | + $lockedByUser = '<span title="'.$title.'" class="editResource">'.$_style['tree_preview_resource'].'</span>'; |
|
123 | 123 | } else { |
124 | 124 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
125 | 125 | 'element_type' => $_lang["lock_element_type_7"], |
126 | 126 | 'username' => $rowLock['username'], |
127 | 127 | 'lasthit_df' => $rowLock['lasthit_df'] |
128 | 128 | )); |
129 | - if($modx->hasPermission('remove_locks')) { |
|
130 | - $lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
129 | + if ($modx->hasPermission('remove_locks')) { |
|
130 | + $lockedByUser = '<span onclick="modx.tree.unlockElement(7, '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>'; |
|
131 | 131 | } else { |
132 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
132 | + $lockedByUser = '<span title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>'; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | } |
@@ -137,23 +137,23 @@ discard block |
||
137 | 137 | $url = $modx->makeUrl($row['id']); |
138 | 138 | |
139 | 139 | $title = ''; |
140 | - if(isDateNode($nodeNameSource)) { |
|
141 | - $title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]'; |
|
140 | + if (isDateNode($nodeNameSource)) { |
|
141 | + $title = $_lang['pagetitle'].': '.$row['pagetitle'].'[+lf+]'; |
|
142 | 142 | } |
143 | - $title .= $_lang['id'] . ': ' . $row['id']; |
|
144 | - $title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle']; |
|
145 | - $title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex']; |
|
146 | - $title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-'); |
|
147 | - $title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename']; |
|
148 | - $title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']); |
|
149 | - $title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']); |
|
150 | - $title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
|
151 | - $title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
|
152 | - $title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
153 | - $title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
154 | - $title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
143 | + $title .= $_lang['id'].': '.$row['id']; |
|
144 | + $title .= '[+lf+]'.$_lang['resource_opt_menu_title'].': '.$row['menutitle']; |
|
145 | + $title .= '[+lf+]'.$_lang['resource_opt_menu_index'].': '.$row['menuindex']; |
|
146 | + $title .= '[+lf+]'.$_lang['alias'].': '.(!empty($row['alias']) ? $row['alias'] : '-'); |
|
147 | + $title .= '[+lf+]'.$_lang['template'].': '.$row['templatename']; |
|
148 | + $title .= '[+lf+]'.$_lang['publish_date'].': '.$modx->toDateFormat($row['pub_date']); |
|
149 | + $title .= '[+lf+]'.$_lang['unpublish_date'].': '.$modx->toDateFormat($row['unpub_date']); |
|
150 | + $title .= '[+lf+]'.$_lang['page_data_web_access'].': '.($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
|
151 | + $title .= '[+lf+]'.$_lang['page_data_mgr_access'].': '.($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
|
152 | + $title .= '[+lf+]'.$_lang['resource_opt_richtext'].': '.($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
153 | + $title .= '[+lf+]'.$_lang['page_data_searchable'].': '.($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
154 | + $title .= '[+lf+]'.$_lang['page_data_cacheable'].': '.($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
155 | 155 | $title = $modx->htmlspecialchars($title); |
156 | - $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
|
156 | + $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
|
157 | 157 | |
158 | 158 | $data = array( |
159 | 159 | 'id' => $row['id'], |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | $ph['expandAll'] = $expandAll; |
203 | 203 | $ph['isPrivate'] = ($row['privateweb'] || $row['privatemgr']) ? 1 : 0; |
204 | 204 | |
205 | - if(!$row['isfolder']) { |
|
205 | + if (!$row['isfolder']) { |
|
206 | 206 | $tpl = getTplSingleNode(); |
207 | - switch($row['id']) { |
|
207 | + switch ($row['id']) { |
|
208 | 208 | case $modx->config['site_start'] : |
209 | 209 | $icon = $_style['tree_page_home']; |
210 | 210 | break; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $icon = $_style['tree_page_info']; |
219 | 219 | break; |
220 | 220 | default: |
221 | - if(isset($icons[$row['contentType']])) { |
|
221 | + if (isset($icons[$row['contentType']])) { |
|
222 | 222 | $icon = $icons[$row['contentType']]; |
223 | 223 | } else { |
224 | 224 | $icon = $_style['tree_page']; |
@@ -228,20 +228,20 @@ discard block |
||
228 | 228 | |
229 | 229 | // invoke OnManagerNodePrerender event |
230 | 230 | $prenode = $modx->invokeEvent("OnManagerNodePrerender", array('ph' => $ph)); |
231 | - if(is_array($prenode)) { |
|
231 | + if (is_array($prenode)) { |
|
232 | 232 | $phnew = array(); |
233 | - foreach($prenode as $pnode) { |
|
233 | + foreach ($prenode as $pnode) { |
|
234 | 234 | $phnew = array_merge($phnew, unserialize($pnode)); |
235 | 235 | } |
236 | 236 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
237 | 237 | } |
238 | 238 | |
239 | - if($ph['contextmenu']) { |
|
240 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
239 | + if ($ph['contextmenu']) { |
|
240 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
241 | 241 | } |
242 | 242 | |
243 | - if($_SESSION['tree_show_only_folders']) { |
|
244 | - if($row['parent'] == 0) { |
|
243 | + if ($_SESSION['tree_show_only_folders']) { |
|
244 | + if ($row['parent'] == 0) { |
|
245 | 245 | $node .= $modx->parseText($tpl, $ph); |
246 | 246 | } else { |
247 | 247 | $node .= ''; |
@@ -254,15 +254,15 @@ discard block |
||
254 | 254 | $ph['icon_folder_open'] = $_style['tree_folderopen_new']; |
255 | 255 | $ph['icon_folder_close'] = $_style['tree_folder_new']; |
256 | 256 | |
257 | - if($_SESSION['tree_show_only_folders']) { |
|
257 | + if ($_SESSION['tree_show_only_folders']) { |
|
258 | 258 | $tpl = getTplFolderNodeNotChildren(); |
259 | 259 | $checkFolders = checkIsFolder($row['id'], 1) ? 1 : 0; // folders |
260 | 260 | $checkDocs = checkIsFolder($row['id'], 0) ? 1 : 0; // no folders |
261 | 261 | $ph['tree_page_click'] = 3; |
262 | 262 | |
263 | 263 | // expandAll: two type for partial expansion |
264 | - if($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
|
265 | - if($expandAll == 1) { |
|
264 | + if ($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
|
265 | + if ($expandAll == 1) { |
|
266 | 266 | $opened2[] = $row['id']; |
267 | 267 | } |
268 | 268 | $ph['icon'] = $ph['icon_folder_open']; |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | $ph['node_toggle'] = 1; |
271 | 271 | $ph['subMenuState'] = ' open'; |
272 | 272 | |
273 | - if(($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
|
273 | + if (($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
|
274 | 274 | $ph['showChildren'] = 1; |
275 | 275 | $ph['icon_node_toggle'] = ''; |
276 | 276 | $ph['icon'] = $ph['icon_folder_close']; |
277 | - } elseif(!$checkDocs && $checkFolders) { |
|
277 | + } elseif (!$checkDocs && $checkFolders) { |
|
278 | 278 | $ph['showChildren'] = 0; |
279 | 279 | $ph['openFolder'] = 2; |
280 | 280 | } else { |
@@ -286,20 +286,20 @@ discard block |
||
286 | 286 | 'ph' => $ph, |
287 | 287 | 'opened' => '1' |
288 | 288 | )); |
289 | - if(is_array($prenode)) { |
|
289 | + if (is_array($prenode)) { |
|
290 | 290 | $phnew = array(); |
291 | - foreach($prenode as $pnode) { |
|
291 | + foreach ($prenode as $pnode) { |
|
292 | 292 | $phnew = array_merge($phnew, unserialize($pnode)); |
293 | 293 | } |
294 | 294 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
295 | 295 | } |
296 | 296 | |
297 | - if($ph['contextmenu']) { |
|
298 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
297 | + if ($ph['contextmenu']) { |
|
298 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | $node .= $modx->parseText($tpl, $ph); |
302 | - if($checkFolders) { |
|
302 | + if ($checkFolders) { |
|
303 | 303 | $node .= makeHTML($indent + 1, $row['id'], $expandAll, $theme, $hereid); |
304 | 304 | } |
305 | 305 | $node .= '</div></div>'; |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | $ph['icon_node_toggle'] = $ph['tree_plusnode']; |
310 | 310 | $ph['node_toggle'] = 0; |
311 | 311 | |
312 | - if(($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
|
312 | + if (($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
|
313 | 313 | $ph['showChildren'] = 1; |
314 | 314 | $ph['icon_node_toggle'] = ''; |
315 | - } elseif(!$checkDocs && $checkFolders) { |
|
315 | + } elseif (!$checkDocs && $checkFolders) { |
|
316 | 316 | $ph['showChildren'] = 0; |
317 | 317 | $ph['openFolder'] = 2; |
318 | 318 | } else { |
@@ -324,16 +324,16 @@ discard block |
||
324 | 324 | 'ph' => $ph, |
325 | 325 | 'opened' => '0' |
326 | 326 | )); |
327 | - if(is_array($prenode)) { |
|
327 | + if (is_array($prenode)) { |
|
328 | 328 | $phnew = array(); |
329 | - foreach($prenode as $pnode) { |
|
329 | + foreach ($prenode as $pnode) { |
|
330 | 330 | $phnew = array_merge($phnew, unserialize($pnode)); |
331 | 331 | } |
332 | 332 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
333 | 333 | } |
334 | 334 | |
335 | - if($ph['contextmenu']) { |
|
336 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
335 | + if ($ph['contextmenu']) { |
|
336 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | $node .= $modx->parseText($tpl, $ph); |
@@ -342,8 +342,8 @@ discard block |
||
342 | 342 | } else { |
343 | 343 | $tpl = getTplFolderNode(); |
344 | 344 | // expandAll: two type for partial expansion |
345 | - if($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
|
346 | - if($expandAll == 1) { |
|
345 | + if ($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
|
346 | + if ($expandAll == 1) { |
|
347 | 347 | $opened2[] = $row['id']; |
348 | 348 | } |
349 | 349 | $ph['icon'] = $ph['icon_folder_open']; |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $ph['node_toggle'] = 1; |
352 | 352 | $ph['subMenuState'] = ' open'; |
353 | 353 | |
354 | - if($ph['donthit'] == 1) { |
|
354 | + if ($ph['donthit'] == 1) { |
|
355 | 355 | $ph['tree_page_click'] = 3; |
356 | 356 | $ph['icon_node_toggle'] = ''; |
357 | 357 | $ph['icon'] = $ph['icon_folder_close']; |
@@ -363,32 +363,32 @@ discard block |
||
363 | 363 | 'ph' => $ph, |
364 | 364 | 'opened' => '1' |
365 | 365 | )); |
366 | - if(is_array($prenode)) { |
|
366 | + if (is_array($prenode)) { |
|
367 | 367 | $phnew = array(); |
368 | - foreach($prenode as $pnode) { |
|
368 | + foreach ($prenode as $pnode) { |
|
369 | 369 | $phnew = array_merge($phnew, unserialize($pnode)); |
370 | 370 | } |
371 | 371 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
372 | - if($ph['showChildren'] == 0) { |
|
372 | + if ($ph['showChildren'] == 0) { |
|
373 | 373 | unset($opened2[$row['id']]); |
374 | 374 | $ph['node_toggle'] = 0; |
375 | 375 | $ph['subMenuState'] = ''; |
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
379 | - if($ph['showChildren'] == 0) { |
|
379 | + if ($ph['showChildren'] == 0) { |
|
380 | 380 | $ph['icon_node_toggle'] = ''; |
381 | 381 | $ph['donthit'] = 1; |
382 | 382 | $ph['icon'] = $ph['icon_folder_close']; |
383 | 383 | $tpl = getTplFolderNodeNotChildren(); |
384 | 384 | } |
385 | 385 | |
386 | - if($ph['contextmenu']) { |
|
387 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
386 | + if ($ph['contextmenu']) { |
|
387 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | $node .= $modx->parseText($tpl, $ph); |
391 | - if($ph['donthit'] == 0) { |
|
391 | + if ($ph['donthit'] == 0) { |
|
392 | 392 | $node .= makeHTML($indent + 1, $row['id'], $expandAll, $theme, $hereid); |
393 | 393 | } |
394 | 394 | $node .= '</div></div>'; |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | $ph['icon_node_toggle'] = $ph['tree_plusnode']; |
399 | 399 | $ph['node_toggle'] = 0; |
400 | 400 | |
401 | - if($ph['donthit'] == 1) { |
|
401 | + if ($ph['donthit'] == 1) { |
|
402 | 402 | $ph['tree_page_click'] = 3; |
403 | 403 | $ph['icon_node_toggle'] = ''; |
404 | 404 | $ph['icon'] = $ph['icon_folder_close']; |
@@ -410,23 +410,23 @@ discard block |
||
410 | 410 | 'ph' => $ph, |
411 | 411 | 'opened' => '0' |
412 | 412 | )); |
413 | - if(is_array($prenode)) { |
|
413 | + if (is_array($prenode)) { |
|
414 | 414 | $phnew = array(); |
415 | - foreach($prenode as $pnode) { |
|
415 | + foreach ($prenode as $pnode) { |
|
416 | 416 | $phnew = array_merge($phnew, unserialize($pnode)); |
417 | 417 | } |
418 | 418 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
419 | 419 | } |
420 | 420 | |
421 | - if($ph['showChildren'] == 0) { |
|
421 | + if ($ph['showChildren'] == 0) { |
|
422 | 422 | $ph['icon_node_toggle'] = ''; |
423 | 423 | $ph['donthit'] = 1; |
424 | 424 | $ph['icon'] = $ph['icon_folder_close']; |
425 | 425 | $tpl = getTplFolderNodeNotChildren(); |
426 | 426 | } |
427 | 427 | |
428 | - if($ph['contextmenu']) { |
|
429 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
428 | + if ($ph['contextmenu']) { |
|
429 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | $node .= $modx->parseText($tpl, $ph); |
@@ -438,10 +438,10 @@ discard block |
||
438 | 438 | // invoke OnManagerNodeRender event |
439 | 439 | $data['node'] = $node; |
440 | 440 | $evtOut = $modx->invokeEvent('OnManagerNodeRender', $data); |
441 | - if(is_array($evtOut)) { |
|
441 | + if (is_array($evtOut)) { |
|
442 | 442 | $evtOut = implode("\n", $evtOut); |
443 | 443 | } |
444 | - if($evtOut != '') { |
|
444 | + if ($evtOut != '') { |
|
445 | 445 | $node = trim($evtOut); |
446 | 446 | } |
447 | 447 | |
@@ -455,14 +455,14 @@ discard block |
||
455 | 455 | * @param array $_style |
456 | 456 | * @return array |
457 | 457 | */ |
458 | -function getIconInfo($_style) { |
|
459 | - if(!isset($_style['tree_page_gif'])) { |
|
458 | +function getIconInfo($_style){ |
|
459 | + if (!isset($_style['tree_page_gif'])) { |
|
460 | 460 | $_style['tree_page_gif'] = $_style['tree_page']; |
461 | 461 | } |
462 | - if(!isset($_style['tree_page_jpg'])) { |
|
462 | + if (!isset($_style['tree_page_jpg'])) { |
|
463 | 463 | $_style['tree_page_jpg'] = $_style['tree_page']; |
464 | 464 | } |
465 | - if(!isset($_style['tree_page_png'])) { |
|
465 | + if (!isset($_style['tree_page_png'])) { |
|
466 | 466 | $_style['tree_page_png'] = $_style['tree_page']; |
467 | 467 | } |
468 | 468 | $icons = array( |
@@ -486,14 +486,14 @@ discard block |
||
486 | 486 | * @param array $_style |
487 | 487 | * @return array |
488 | 488 | */ |
489 | -function getPrivateIconInfo($_style) { |
|
490 | - if(!isset($_style['tree_page_gif_secure'])) { |
|
489 | +function getPrivateIconInfo($_style){ |
|
490 | + if (!isset($_style['tree_page_gif_secure'])) { |
|
491 | 491 | $_style['tree_page_gif_secure'] = $_style['tree_page_secure']; |
492 | 492 | } |
493 | - if(!isset($_style['tree_page_jpg_secure'])) { |
|
493 | + if (!isset($_style['tree_page_jpg_secure'])) { |
|
494 | 494 | $_style['tree_page_jpg_secure'] = $_style['tree_page_secure']; |
495 | 495 | } |
496 | - if(!isset($_style['tree_page_png_secure'])) { |
|
496 | + if (!isset($_style['tree_page_png_secure'])) { |
|
497 | 497 | $_style['tree_page_png_secure'] = $_style['tree_page_secure']; |
498 | 498 | } |
499 | 499 | $iconsPrivate = array( |
@@ -518,21 +518,21 @@ discard block |
||
518 | 518 | * @param array $row |
519 | 519 | * @return string |
520 | 520 | */ |
521 | -function getNodeTitle($nodeNameSource, $row) { |
|
521 | +function getNodeTitle($nodeNameSource, $row){ |
|
522 | 522 | global $modx; |
523 | 523 | |
524 | - switch($nodeNameSource) { |
|
524 | + switch ($nodeNameSource) { |
|
525 | 525 | case 'menutitle': |
526 | 526 | $nodetitle = $row['menutitle'] ? $row['menutitle'] : $row['pagetitle']; |
527 | 527 | break; |
528 | 528 | case 'alias': |
529 | 529 | $nodetitle = $row['alias'] ? $row['alias'] : $row['id']; |
530 | - if(strpos($row['alias'], '.') === false) { |
|
531 | - if($row['isfolder'] != 1 || $modx->config['make_folders'] != 1) { |
|
530 | + if (strpos($row['alias'], '.') === false) { |
|
531 | + if ($row['isfolder'] != 1 || $modx->config['make_folders'] != 1) { |
|
532 | 532 | $nodetitle .= $modx->config['friendly_url_suffix']; |
533 | 533 | } |
534 | 534 | } |
535 | - $nodetitle = $modx->config['friendly_url_prefix'] . $nodetitle; |
|
535 | + $nodetitle = $modx->config['friendly_url_prefix'].$nodetitle; |
|
536 | 536 | break; |
537 | 537 | case 'pagetitle': |
538 | 538 | $nodetitle = $row['pagetitle']; |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | case 'unpub_date': |
548 | 548 | $doc = $modx->getDocumentObject('id', $row['id']); |
549 | 549 | $date = $doc[$nodeNameSource]; |
550 | - if(!empty($date)) { |
|
550 | + if (!empty($date)) { |
|
551 | 551 | $nodetitle = $modx->toDateFormat($date); |
552 | 552 | } else { |
553 | 553 | $nodetitle = '- - -'; |
@@ -568,8 +568,8 @@ discard block |
||
568 | 568 | * @param string $nodeNameSource |
569 | 569 | * @return bool |
570 | 570 | */ |
571 | -function isDateNode($nodeNameSource) { |
|
572 | - switch($nodeNameSource) { |
|
571 | +function isDateNode($nodeNameSource){ |
|
572 | + switch ($nodeNameSource) { |
|
573 | 573 | case 'createdon': |
574 | 574 | case 'editedon': |
575 | 575 | case 'publishedon': |
@@ -586,17 +586,17 @@ discard block |
||
586 | 586 | * @param int $isfolder |
587 | 587 | * @return int |
588 | 588 | */ |
589 | -function checkIsFolder($parent = 0, $isfolder = 1) { |
|
589 | +function checkIsFolder($parent = 0, $isfolder = 1){ |
|
590 | 590 | global $modx; |
591 | 591 | |
592 | - return (int) $modx->db->getValue($modx->db->query('SELECT count(*) FROM ' . $modx->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' ')); |
|
592 | + return (int) $modx->db->getValue($modx->db->query('SELECT count(*) FROM '.$modx->getFullTableName('site_content').' WHERE parent='.$parent.' AND isfolder='.$isfolder.' ')); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | /** |
596 | 596 | * @param mixed $array |
597 | 597 | * @return string |
598 | 598 | */ |
599 | -function _htmlentities($array) { |
|
599 | +function _htmlentities($array){ |
|
600 | 600 | global $modx; |
601 | 601 | |
602 | 602 | $array = json_encode($array, JSON_UNESCAPED_UNICODE); |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | /** |
609 | 609 | * @return string |
610 | 610 | */ |
611 | -function getTplSingleNode() { |
|
611 | +function getTplSingleNode(){ |
|
612 | 612 | return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
613 | 613 | onclick="modx.tree.treeAction(event,[+id+]);" |
614 | 614 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | /** |
636 | 636 | * @return string |
637 | 637 | */ |
638 | -function getTplFolderNode() { |
|
638 | +function getTplFolderNode(){ |
|
639 | 639 | return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
640 | 640 | onclick="modx.tree.treeAction(event,[+id+]);" |
641 | 641 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | /** |
675 | 675 | * @return string |
676 | 676 | */ |
677 | -function getTplFolderNodeNotChildren() { |
|
677 | +function getTplFolderNodeNotChildren(){ |
|
678 | 678 | return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
679 | 679 | onclick="modx.tree.treeAction(event,[+id+]);" |
680 | 680 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
@@ -710,11 +710,11 @@ discard block |
||
710 | 710 | * @param int|string|array $str |
711 | 711 | * @param bool $flag |
712 | 712 | */ |
713 | -function dbug($str, $flag = false) { |
|
713 | +function dbug($str, $flag = false){ |
|
714 | 714 | print('<pre>'); |
715 | 715 | print_r($str); |
716 | 716 | print('</pre>'); |
717 | - if($flag) { |
|
717 | + if ($flag) { |
|
718 | 718 | exit; |
719 | 719 | } |
720 | 720 | } |