@@ -1,5 +1,5 @@ |
||
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 | ?> |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <!-- Template variables --> |
2 | 2 | <?php |
3 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
4 | 4 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
5 | 5 | } |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <!-- chunks --> |
2 | 2 | <?php |
3 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
4 | 4 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
5 | 5 | } |
6 | 6 |
@@ -1,5 +1,5 @@ |
||
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 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <!-- snippets --> |
2 | 2 | <?php |
3 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
4 | 4 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
5 | 5 | } |
6 | 6 |
@@ -1,23 +1,23 @@ 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 | |
6 | 6 | $tpl = array( |
7 | - 'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'), |
|
8 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
9 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
10 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
11 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
|
7 | + 'viewForm' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_viewForm.tpl'), |
|
8 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'), |
|
9 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'), |
|
10 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'), |
|
11 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl') |
|
12 | 12 | ); |
13 | 13 | |
14 | -function parsePh($tpl, $ph) { |
|
14 | +function parsePh($tpl, $ph){ |
|
15 | 15 | global $modx, $_lang; |
16 | 16 | $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
17 | 17 | return $modx->parseText($tpl, $ph); |
18 | 18 | } |
19 | 19 | |
20 | -function renderViewSwitchButtons($cssId) { |
|
20 | +function renderViewSwitchButtons($cssId){ |
|
21 | 21 | global $modx, $_lang, $tpl; |
22 | 22 | |
23 | 23 | return parsePh($tpl['viewForm'], array( |
@@ -25,19 +25,19 @@ discard block |
||
25 | 25 | )); |
26 | 26 | } |
27 | 27 | |
28 | -function createResourceList($resourceTable, $resources) { |
|
28 | +function createResourceList($resourceTable, $resources){ |
|
29 | 29 | global $modx, $_lang, $_style, $modx_textdir, $tpl; |
30 | 30 | |
31 | 31 | $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
32 | 32 | |
33 | - if( ! is_array($items) || empty($items)) { |
|
33 | + if (!is_array($items) || empty($items)) { |
|
34 | 34 | return $_lang['no_results']; |
35 | 35 | } |
36 | 36 | |
37 | 37 | // Prepare elements- and categories-list |
38 | 38 | $elements = array(); |
39 | 39 | $categories = array(); |
40 | - foreach($items as $row) { |
|
40 | + foreach ($items as $row) { |
|
41 | 41 | $catid = $row['catid'] ? $row['catid'] : 0; |
42 | 42 | $categories[$catid] = array('name' => stripslashes($row['category'])); |
43 | 43 | $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
@@ -45,18 +45,18 @@ discard block |
||
45 | 45 | |
46 | 46 | // Now render categories / panel-collapse |
47 | 47 | $panelGroup = ''; |
48 | - foreach($elements as $catid => $elList) { |
|
48 | + foreach ($elements as $catid => $elList) { |
|
49 | 49 | // Add panel-heading / category-collapse to output |
50 | 50 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
51 | 51 | 'tab' => $resourceTable, |
52 | 52 | 'category' => $categories[$catid]['name'], |
53 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
53 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '', |
|
54 | 54 | 'catid' => $catid, |
55 | 55 | )); |
56 | 56 | |
57 | 57 | // Prepare content for panel-collapse |
58 | 58 | $panelCollapse = ''; |
59 | - foreach($elList as $el) { |
|
59 | + foreach ($elList as $el) { |
|
60 | 60 | $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
61 | 61 | } |
62 | 62 | |
@@ -74,30 +74,30 @@ discard block |
||
74 | 74 | )); |
75 | 75 | } |
76 | 76 | |
77 | -function createCombinedView($resources) { |
|
77 | +function createCombinedView($resources){ |
|
78 | 78 | global $modx, $_lang, $_style, $modx_textdir; |
79 | 79 | |
80 | 80 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
81 | 81 | $types = isset($resources->types) ? $resources->types : false; |
82 | 82 | $categories = isset($resources->categories) ? $resources->categories : false; |
83 | 83 | |
84 | - if(!$itemsPerCategory) { |
|
84 | + if (!$itemsPerCategory) { |
|
85 | 85 | return $_lang['no_results']; |
86 | 86 | } |
87 | 87 | |
88 | 88 | $tpl = array( |
89 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
90 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
91 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
92 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
89 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'), |
|
90 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'), |
|
91 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'), |
|
92 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl'), |
|
93 | 93 | ); |
94 | 94 | |
95 | 95 | // Easily loop through $itemsPerCategory-Array |
96 | 96 | $panelGroup = ''; |
97 | - foreach($categories as $catid => $category) { |
|
97 | + foreach ($categories as $catid => $category) { |
|
98 | 98 | // Prepare collapse content / elements-list |
99 | 99 | $panelCollapse = ''; |
100 | - foreach($itemsPerCategory[$catid] as $el) { |
|
100 | + foreach ($itemsPerCategory[$catid] as $el) { |
|
101 | 101 | $resourceTable = $el['type']; |
102 | 102 | $ph = prepareElementRowPh($el, $resourceTable, $resources); |
103 | 103 | $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
108 | 108 | 'tab' => 'categories_list', |
109 | 109 | 'category' => $categories[$catid], |
110 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
110 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '', |
|
111 | 111 | 'catid' => $catid, |
112 | 112 | )); |
113 | 113 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | )); |
126 | 126 | } |
127 | 127 | |
128 | -function prepareElementRowPh($row, $resourceTable, $resources) { |
|
128 | +function prepareElementRowPh($row, $resourceTable, $resources){ |
|
129 | 129 | global $modx, $modx_textdir, $_style, $_lang; |
130 | 130 | |
131 | 131 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
@@ -133,32 +133,32 @@ discard block |
||
133 | 133 | $class = ''; |
134 | 134 | $_lang["confirm_delete"] = $_lang["delete"]; |
135 | 135 | |
136 | - if($resourceTable == 'site_templates') { |
|
136 | + if ($resourceTable == 'site_templates') { |
|
137 | 137 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
138 | 138 | $lockElementType = 1; |
139 | 139 | $_lang["confirm_delete"] = $_lang["confirm_delete_template"]; |
140 | 140 | } |
141 | - if($resourceTable == 'site_tmplvars') { |
|
141 | + if ($resourceTable == 'site_tmplvars') { |
|
142 | 142 | $class = $row['reltpl'] ? '' : 'disabledPlugin'; |
143 | 143 | $lockElementType = 2; |
144 | 144 | $_lang["confirm_delete"] = $_lang["confirm_delete_tmplvars"]; |
145 | 145 | } |
146 | - if($resourceTable == 'site_htmlsnippets') { |
|
146 | + if ($resourceTable == 'site_htmlsnippets') { |
|
147 | 147 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
148 | 148 | $lockElementType = 3; |
149 | 149 | $_lang["confirm_delete"] = $_lang["confirm_delete_htmlsnippet"]; |
150 | 150 | } |
151 | - if($resourceTable == 'site_snippets') { |
|
151 | + if ($resourceTable == 'site_snippets') { |
|
152 | 152 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
153 | 153 | $lockElementType = 4; |
154 | 154 | $_lang["confirm_delete"] = $_lang["confirm_delete_snippet"]; |
155 | 155 | } |
156 | - if($resourceTable == 'site_plugins') { |
|
156 | + if ($resourceTable == 'site_plugins') { |
|
157 | 157 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
158 | 158 | $lockElementType = 5; |
159 | 159 | $_lang["confirm_delete"] = $_lang["confirm_delete_plugin"]; |
160 | 160 | } |
161 | - if($resourceTable == 'site_modules') { |
|
161 | + if ($resourceTable == 'site_modules') { |
|
162 | 162 | $class = $row['disabled'] ? '' : 'disabledPlugin'; |
163 | 163 | $_lang["confirm_delete"] = $_lang["confirm_delete_module"]; |
164 | 164 | } |
@@ -166,65 +166,65 @@ discard block |
||
166 | 166 | // Prepare displaying user-locks |
167 | 167 | $lockedByUser = ''; |
168 | 168 | $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
169 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
170 | - if($rowLock['sid'] == $modx->sid) { |
|
169 | + if ($rowLock && $modx->hasPermission('display_locks')) { |
|
170 | + if ($rowLock['sid'] == $modx->sid) { |
|
171 | 171 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
172 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
172 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
173 | 173 | 'lasthit_df' => $rowLock['lasthit_df'] |
174 | 174 | )); |
175 | - $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
175 | + $lockedByUser = '<span title="'.$title.'" class="editResource" style="cursor:context-menu;">'.$_style['tree_preview_resource'].'</span> '; |
|
176 | 176 | } else { |
177 | 177 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
178 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
178 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
179 | 179 | 'username' => $rowLock['username'], |
180 | 180 | 'lasthit_df' => $rowLock['lasthit_df'] |
181 | 181 | )); |
182 | - if($modx->hasPermission('remove_locks')) { |
|
183 | - $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
|
182 | + if ($modx->hasPermission('remove_locks')) { |
|
183 | + $lockedByUser = '<a href="javascript:;" onclick="unlockElement('.$lockElementType.', '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource"><i class="'.$_style['icons_secured'].'"></i></a>'; |
|
184 | 184 | } else { |
185 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
185 | + $lockedByUser = '<span title="'.$title.'" class="lockedResource" style="cursor:context-menu;"><i class="'.$_style['icons_secured'].'"></i></span>'; |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | } |
189 | - if($lockedByUser) { |
|
190 | - $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
189 | + if ($lockedByUser) { |
|
190 | + $lockedByUser = '<div class="lockCell">'.$lockedByUser.'</div>'; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | // Caption |
194 | - if($resourceTable == 'site_tmplvars') { |
|
195 | - $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
|
194 | + if ($resourceTable == 'site_tmplvars') { |
|
195 | + $caption = !empty($row['description']) ? ' '.$row['caption'].' <small>('.$row['description'].')</small>' : ' '.$row['caption']; |
|
196 | 196 | } else { |
197 | - $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
197 | + $caption = !empty($row['description']) ? ' '.$row['description'] : ''; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | // Special marks |
201 | 201 | $tplInfo = array(); |
202 | - if($row['locked']) { |
|
202 | + if ($row['locked']) { |
|
203 | 203 | $tplInfo[] = $_lang['locked']; |
204 | 204 | } |
205 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
205 | + if ($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
206 | 206 | $tplInfo[] = $_lang['defaulttemplate_title']; |
207 | 207 | } |
208 | - $marks = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : ''; |
|
208 | + $marks = !empty($tplInfo) ? ' <em>('.join(', ', $tplInfo).')</em>' : ''; |
|
209 | 209 | |
210 | 210 | /* row buttons */ |
211 | 211 | $buttons = ''; |
212 | - if($modx->hasPermission($types['actions']['edit'][1])) { |
|
213 | - $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
212 | + if ($modx->hasPermission($types['actions']['edit'][1])) { |
|
213 | + $buttons .= '<li><a title="'.$_lang["edit_resource"].'" href="index.php?a='.$types['actions']['edit'][0].'&id='.$row['id'].'"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
214 | 214 | } |
215 | - if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
216 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
215 | + if ($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
216 | + $buttons .= '<li><a onclick="return confirm(\''.$_lang["confirm_duplicate_record"].'\')" title="'.$_lang["resource_duplicate"].'" href="index.php?a='.$types['actions']['duplicate'][0].'&id='.$row['id'].'"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
217 | 217 | } |
218 | - if($modx->hasPermission($types['actions']['remove'][1])) { |
|
219 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
218 | + if ($modx->hasPermission($types['actions']['remove'][1])) { |
|
219 | + $buttons .= '<li><a onclick="return confirm(\''.$_lang["confirm_delete"].'\')" title="'.$_lang["delete"].'" href="index.php?a='.$types['actions']['remove'][0].'&id='.$row['id'].'"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
220 | 220 | } |
221 | - $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
221 | + $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">'.$buttons.'</ul></div>' : ''; |
|
222 | 222 | |
223 | 223 | $catid = $row['catid'] ? $row['catid'] : 0; |
224 | 224 | |
225 | 225 | // Placeholders for elements-row |
226 | 226 | return array( |
227 | - 'class' => $class ? ' class="' . $class . '"' : '', |
|
227 | + 'class' => $class ? ' class="'.$class.'"' : '', |
|
228 | 228 | 'lockedByUser' => $lockedByUser, |
229 | 229 | 'name' => $row['name'], |
230 | 230 | 'caption' => $caption, |
@@ -1,77 +1,77 @@ 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 | |
6 | -class mgrResources { |
|
6 | +class mgrResources{ |
|
7 | 7 | var $types = array(); |
8 | 8 | var $items = array(); |
9 | 9 | var $categories = array(); |
10 | 10 | var $itemsPerCategory = array(); |
11 | 11 | |
12 | - function __construct() { |
|
12 | + function __construct(){ |
|
13 | 13 | $this->setTypes(); |
14 | 14 | $this->queryItemsFromDB(); |
15 | 15 | $this->prepareCategoryArrays(); |
16 | 16 | } |
17 | 17 | |
18 | - function setTypes() { |
|
18 | + function setTypes(){ |
|
19 | 19 | global $_lang; |
20 | - $this->types['site_templates'] = array( |
|
20 | + $this->types['site_templates'] = array( |
|
21 | 21 | 'title'=>$_lang["manage_templates"], |
22 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
23 | - 'permissions'=>array('new_template','edit_template'), |
|
22 | + 'actions'=>array('edit'=>array(16, 'edit_template'), 'duplicate'=>array(96, 'new_template'), 'remove'=>array(21, 'delete_template')), |
|
23 | + 'permissions'=>array('new_template', 'edit_template'), |
|
24 | 24 | 'name'=>'templatename' |
25 | 25 | ); |
26 | - $this->types['site_tmplvars'] = array( |
|
26 | + $this->types['site_tmplvars'] = array( |
|
27 | 27 | 'title'=>$_lang["tmplvars"], |
28 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
29 | - 'permissions'=>array('new_template','edit_template'), |
|
28 | + 'actions'=>array('edit'=>array(301, 'edit_template'), 'duplicate'=>array(304, 'edit_template'), 'remove'=>array(303, 'edit_template')), |
|
29 | + 'permissions'=>array('new_template', 'edit_template'), |
|
30 | 30 | ); |
31 | 31 | $this->types['site_htmlsnippets'] = array( |
32 | 32 | 'title'=>$_lang["manage_htmlsnippets"], |
33 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
34 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
33 | + 'actions'=>array('edit'=>array(78, 'edit_chunk'), 'duplicate'=>array(97, 'new_chunk'), 'remove'=>array(80, 'delete_chunk')), |
|
34 | + 'permissions'=>array('new_chunk', 'edit_chunk'), |
|
35 | 35 | ); |
36 | - $this->types['site_snippets'] = array( |
|
36 | + $this->types['site_snippets'] = array( |
|
37 | 37 | 'title'=>$_lang["manage_snippets"], |
38 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
39 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
38 | + 'actions'=>array('edit'=>array(22, 'edit_snippet'), 'duplicate'=>array(98, 'new_snippet'), 'remove'=>array(25, 'delete_snippet')), |
|
39 | + 'permissions'=>array('new_snippet', 'edit_snippet'), |
|
40 | 40 | ); |
41 | - $this->types['site_plugins'] = array( |
|
41 | + $this->types['site_plugins'] = array( |
|
42 | 42 | 'title'=>$_lang["manage_plugins"], |
43 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
44 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
43 | + 'actions'=>array('edit'=>array(102, 'edit_plugin'), 'duplicate'=>array(105, 'new_plugin'), 'remove'=>array(104, 'delete_plugin')), |
|
44 | + 'permissions'=>array('new_plugin', 'edit_plugin'), |
|
45 | 45 | ); |
46 | - $this->types['site_modules'] = array( |
|
46 | + $this->types['site_modules'] = array( |
|
47 | 47 | 'title'=>$_lang["manage_modules"], |
48 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
49 | - 'permissions'=>array('new_module','edit_module'), |
|
48 | + 'actions'=>array('edit'=>array(108, 'edit_module'), 'duplicate'=>array(111, 'new_module'), 'remove'=>array(110, 'delete_module')), |
|
49 | + 'permissions'=>array('new_module', 'edit_module'), |
|
50 | 50 | ); |
51 | 51 | } |
52 | 52 | |
53 | - function queryItemsFromDB() { |
|
54 | - foreach($this->types as $resourceTable=>$type) { |
|
55 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
53 | + function queryItemsFromDB(){ |
|
54 | + foreach ($this->types as $resourceTable=>$type) { |
|
55 | + if ($this->hasAnyPermissions($type['permissions'])) { |
|
56 | 56 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
57 | 57 | $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | - function hasAnyPermissions($permissions) { |
|
62 | + function hasAnyPermissions($permissions){ |
|
63 | 63 | global $modx; |
64 | 64 | |
65 | - foreach($permissions as $p) |
|
66 | - if($modx->hasPermission($p)) return true; |
|
65 | + foreach ($permissions as $p) |
|
66 | + if ($modx->hasPermission($p)) return true; |
|
67 | 67 | |
68 | 68 | return false; |
69 | 69 | } |
70 | 70 | |
71 | - function queryResources($resourceTable, $nameField = 'name') { |
|
71 | + function queryResources($resourceTable, $nameField = 'name'){ |
|
72 | 72 | global $modx, $_lang; |
73 | 73 | |
74 | - $pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable . '.disabled, ' : ''; |
|
74 | + $pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable.'.disabled, ' : ''; |
|
75 | 75 | |
76 | 76 | $tvsql = ''; |
77 | 77 | $tvjoin = ''; |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | |
87 | 87 | $rs = $modx->db->select( |
88 | 88 | "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
89 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
90 | - LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
89 | + $modx->getFullTableName($resourceTable)." AS {$resourceTable} |
|
90 | + LEFT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
91 | 91 | "", |
92 | 92 | "category,name" |
93 | 93 | ); |
94 | 94 | $limit = $modx->db->getRecordCount($rs); |
95 | 95 | |
96 | - if($limit < 1) return false; |
|
96 | + if ($limit < 1) return false; |
|
97 | 97 | |
98 | 98 | $result = array(); |
99 | 99 | while ($row = $modx->db->getRow($rs)) { |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | return $result; |
103 | 103 | } |
104 | 104 | |
105 | - function prepareCategoryArrays() { |
|
106 | - foreach($this->items as $type=>$items) { |
|
107 | - foreach((array)$items as $item) { |
|
105 | + function prepareCategoryArrays(){ |
|
106 | + foreach ($this->items as $type=>$items) { |
|
107 | + foreach ((array) $items as $item) { |
|
108 | 108 | $catid = $item['catid'] ? $item['catid'] : 0; |
109 | 109 | $this->categories[$catid] = $item['category']; |
110 | 110 | |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | natcasesort($this->categories); |
118 | 118 | |
119 | 119 | // Now sort by name |
120 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
121 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
120 | + foreach ($this->itemsPerCategory as $catid=>$items) { |
|
121 | + usort($this->itemsPerCategory[$catid], function($a, $b){ |
|
122 | 122 | return strcasecmp($a['name'], $b['name']); |
123 | 123 | }); |
124 | 124 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <!-- Templates --> |
2 | 2 | <?php |
3 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
4 | 4 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
5 | 5 | } |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <!-- plugins --> |
2 | 2 | <?php |
3 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
4 | 4 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
5 | 5 | } |
6 | 6 |