@@ -10,60 +10,60 @@ discard block |
||
10 | 10 | $xoops_url = parse_url(XOOPS_URL); |
11 | 11 | |
12 | 12 | $modversion = [ |
13 | - 'version' => 1.07, |
|
14 | - 'module_status' => 'RC1', |
|
15 | - 'release_date' => '2017/10/04', |
|
16 | - 'name' => _MI_INSTRUCTION_NAME, |
|
17 | - 'description' => _MI_INSTRUCTION_DESC, |
|
18 | - 'credits' => 'radio-hobby.org, www.shmel.org', |
|
19 | - 'author' => 'andrey3761, Mamba, Aerograf', |
|
20 | - 'nickname' => '', |
|
21 | - 'help' => 'page=help', |
|
22 | - 'license' => 'GNU GPL 2.0', |
|
23 | - 'license_url' => 'www.gnu.org/licenses/gpl-2.0.html/', |
|
24 | - 'official' => 0, |
|
25 | - 'image' => 'assets/images/logoModule.png', |
|
26 | - 'dirname' => $moduleDirName, |
|
27 | - 'modicons16' => 'assets/images/icons/16', |
|
28 | - 'modicons32' => 'assets/images/icons/32', |
|
29 | - // О модуле |
|
30 | - 'module_website_url' => 'radio-hobby.org', |
|
31 | - 'module_website_name' => 'radio-hobby.org', |
|
13 | + 'version' => 1.07, |
|
14 | + 'module_status' => 'RC1', |
|
15 | + 'release_date' => '2017/10/04', |
|
16 | + 'name' => _MI_INSTRUCTION_NAME, |
|
17 | + 'description' => _MI_INSTRUCTION_DESC, |
|
18 | + 'credits' => 'radio-hobby.org, www.shmel.org', |
|
19 | + 'author' => 'andrey3761, Mamba, Aerograf', |
|
20 | + 'nickname' => '', |
|
21 | + 'help' => 'page=help', |
|
22 | + 'license' => 'GNU GPL 2.0', |
|
23 | + 'license_url' => 'www.gnu.org/licenses/gpl-2.0.html/', |
|
24 | + 'official' => 0, |
|
25 | + 'image' => 'assets/images/logoModule.png', |
|
26 | + 'dirname' => $moduleDirName, |
|
27 | + 'modicons16' => 'assets/images/icons/16', |
|
28 | + 'modicons32' => 'assets/images/icons/32', |
|
29 | + // О модуле |
|
30 | + 'module_website_url' => 'radio-hobby.org', |
|
31 | + 'module_website_name' => 'radio-hobby.org', |
|
32 | 32 | |
33 | - 'author_website_url' => 'radio-hobby.org', |
|
34 | - 'author_website_name' => 'andrey3761', |
|
35 | - 'min_php' => '5.5', |
|
36 | - 'min_xoops' => '2.5.8', |
|
37 | - 'min_admin' => '1.1', |
|
38 | - 'min_db' => ['mysql' => '5.5'], |
|
39 | - // Файл базы данных |
|
40 | - 'sqlfile' => ['mysql' => 'sql/mysql.sql'], |
|
41 | - // Таблицы |
|
42 | - 'tables' => [ |
|
43 | - $moduleDirName . '_cat', |
|
44 | - $moduleDirName . '_instr', |
|
45 | - $moduleDirName . '_page' |
|
46 | - ], |
|
47 | - // Имеет админку |
|
48 | - 'hasAdmin' => 1, |
|
49 | - 'adminindex' => 'admin/index.php', |
|
50 | - 'adminmenu' => 'admin/menu.php', |
|
51 | - 'system_menu' => 1, |
|
52 | - // Меню |
|
53 | - 'hasMain' => 1, |
|
54 | - // Search |
|
55 | - 'hasSearch' => 1, |
|
56 | - 'search' => [ |
|
57 | - 'file' => 'include/search.inc.php', |
|
58 | - 'func' => $moduleDirName . '_search', |
|
59 | - ], |
|
33 | + 'author_website_url' => 'radio-hobby.org', |
|
34 | + 'author_website_name' => 'andrey3761', |
|
35 | + 'min_php' => '5.5', |
|
36 | + 'min_xoops' => '2.5.8', |
|
37 | + 'min_admin' => '1.1', |
|
38 | + 'min_db' => ['mysql' => '5.5'], |
|
39 | + // Файл базы данных |
|
40 | + 'sqlfile' => ['mysql' => 'sql/mysql.sql'], |
|
41 | + // Таблицы |
|
42 | + 'tables' => [ |
|
43 | + $moduleDirName . '_cat', |
|
44 | + $moduleDirName . '_instr', |
|
45 | + $moduleDirName . '_page' |
|
46 | + ], |
|
47 | + // Имеет админку |
|
48 | + 'hasAdmin' => 1, |
|
49 | + 'adminindex' => 'admin/index.php', |
|
50 | + 'adminmenu' => 'admin/menu.php', |
|
51 | + 'system_menu' => 1, |
|
52 | + // Меню |
|
53 | + 'hasMain' => 1, |
|
54 | + // Search |
|
55 | + 'hasSearch' => 1, |
|
56 | + 'search' => [ |
|
57 | + 'file' => 'include/search.inc.php', |
|
58 | + 'func' => $moduleDirName . '_search', |
|
59 | + ], |
|
60 | 60 | ]; |
61 | 61 | // Help files |
62 | 62 | $modversion['helpsection'] = [ |
63 | - ['name' => _MI_INSTRUCTION_HELP_OVERVIEW, 'link' => 'page=help'], |
|
64 | - ['name' => _MI_INSTRUCTION_DISCLAIMER, 'link' => 'page=disclaimer'], |
|
65 | - ['name' => _MI_INSTRUCTION_LICENSE, 'link' => 'page=license'], |
|
66 | - ['name' => _MI_INSTRUCTION_SUPPORT, 'link' => 'page=support'], |
|
63 | + ['name' => _MI_INSTRUCTION_HELP_OVERVIEW, 'link' => 'page=help'], |
|
64 | + ['name' => _MI_INSTRUCTION_DISCLAIMER, 'link' => 'page=disclaimer'], |
|
65 | + ['name' => _MI_INSTRUCTION_LICENSE, 'link' => 'page=license'], |
|
66 | + ['name' => _MI_INSTRUCTION_SUPPORT, 'link' => 'page=support'], |
|
67 | 67 | ]; |
68 | 68 | |
69 | 69 | // Comments |
@@ -76,144 +76,144 @@ discard block |
||
76 | 76 | |
77 | 77 | // Templates |
78 | 78 | $modversion['templates'] = [ |
79 | - [ |
|
80 | - 'file' => 'admin/' . $moduleDirName . '_admin_index.tpl', |
|
81 | - 'description' => '' |
|
82 | - ], |
|
83 | - [ |
|
84 | - 'file' => 'admin/' . $moduleDirName . '_admin_cat.tpl', |
|
85 | - 'description' => '' |
|
86 | - ], |
|
87 | - [ |
|
88 | - 'file' => 'admin/' . $moduleDirName . '_admin_editcat.tpl', |
|
89 | - 'description' => '' |
|
90 | - ], |
|
91 | - [ |
|
92 | - 'file' => 'admin/' . $moduleDirName . '_admin_savecat.tpl', |
|
93 | - 'description' => '' |
|
94 | - ], |
|
95 | - [ |
|
96 | - 'file' => 'admin/' . $moduleDirName . '_admin_viewcat.tpl', |
|
97 | - 'description' => '' |
|
98 | - ], |
|
99 | - [ |
|
100 | - 'file' => 'admin/' . $moduleDirName . '_admin_instr.tpl', |
|
101 | - 'description' => '' |
|
102 | - ], |
|
103 | - [ |
|
104 | - 'file' => 'admin/' . $moduleDirName . '_admin_editinstr.tpl', |
|
105 | - 'description' => '' |
|
106 | - ], |
|
107 | - [ |
|
108 | - 'file' => 'admin/' . $moduleDirName . '_admin_saveinstr.tpl', |
|
109 | - 'description' => '' |
|
110 | - ], |
|
111 | - [ |
|
112 | - 'file' => 'admin/' . $moduleDirName . '_admin_viewinstr.tpl', |
|
113 | - 'description' => '' |
|
114 | - ], |
|
115 | - [ |
|
116 | - 'file' => 'admin/' . $moduleDirName . '_admin_editpage.tpl', |
|
117 | - 'description' => '' |
|
118 | - ], |
|
119 | - [ |
|
120 | - 'file' => 'admin/' . $moduleDirName . '_admin_savepage.tpl', |
|
121 | - 'description' => '' |
|
122 | - ], |
|
123 | - [ |
|
124 | - 'file' => 'admin/' . $moduleDirName . '_admin_perm.tpl', |
|
125 | - 'description' => '' |
|
126 | - ], |
|
127 | - [ |
|
128 | - 'file' => 'admin/' . $moduleDirName . '_admin_about.tpl', |
|
129 | - 'description' => '' |
|
130 | - ], |
|
131 | - [ |
|
132 | - 'file' => $moduleDirName . '_page.tpl', |
|
133 | - 'description' => '' |
|
134 | - ], |
|
135 | - [ |
|
136 | - 'file' => $moduleDirName . '_instr.tpl', |
|
137 | - 'description' => '' |
|
138 | - ], |
|
139 | - [ |
|
140 | - 'file' => $moduleDirName . '_index.tpl', |
|
141 | - 'description' => '' |
|
142 | - ], |
|
143 | - [ |
|
144 | - 'file' => $moduleDirName . '_editpage.tpl', |
|
145 | - 'description' => '' |
|
146 | - ], |
|
147 | - [ |
|
148 | - 'file' => $moduleDirName . '_savepage.tpl', |
|
149 | - 'description' => '' |
|
150 | - ], |
|
79 | + [ |
|
80 | + 'file' => 'admin/' . $moduleDirName . '_admin_index.tpl', |
|
81 | + 'description' => '' |
|
82 | + ], |
|
83 | + [ |
|
84 | + 'file' => 'admin/' . $moduleDirName . '_admin_cat.tpl', |
|
85 | + 'description' => '' |
|
86 | + ], |
|
87 | + [ |
|
88 | + 'file' => 'admin/' . $moduleDirName . '_admin_editcat.tpl', |
|
89 | + 'description' => '' |
|
90 | + ], |
|
91 | + [ |
|
92 | + 'file' => 'admin/' . $moduleDirName . '_admin_savecat.tpl', |
|
93 | + 'description' => '' |
|
94 | + ], |
|
95 | + [ |
|
96 | + 'file' => 'admin/' . $moduleDirName . '_admin_viewcat.tpl', |
|
97 | + 'description' => '' |
|
98 | + ], |
|
99 | + [ |
|
100 | + 'file' => 'admin/' . $moduleDirName . '_admin_instr.tpl', |
|
101 | + 'description' => '' |
|
102 | + ], |
|
103 | + [ |
|
104 | + 'file' => 'admin/' . $moduleDirName . '_admin_editinstr.tpl', |
|
105 | + 'description' => '' |
|
106 | + ], |
|
107 | + [ |
|
108 | + 'file' => 'admin/' . $moduleDirName . '_admin_saveinstr.tpl', |
|
109 | + 'description' => '' |
|
110 | + ], |
|
111 | + [ |
|
112 | + 'file' => 'admin/' . $moduleDirName . '_admin_viewinstr.tpl', |
|
113 | + 'description' => '' |
|
114 | + ], |
|
115 | + [ |
|
116 | + 'file' => 'admin/' . $moduleDirName . '_admin_editpage.tpl', |
|
117 | + 'description' => '' |
|
118 | + ], |
|
119 | + [ |
|
120 | + 'file' => 'admin/' . $moduleDirName . '_admin_savepage.tpl', |
|
121 | + 'description' => '' |
|
122 | + ], |
|
123 | + [ |
|
124 | + 'file' => 'admin/' . $moduleDirName . '_admin_perm.tpl', |
|
125 | + 'description' => '' |
|
126 | + ], |
|
127 | + [ |
|
128 | + 'file' => 'admin/' . $moduleDirName . '_admin_about.tpl', |
|
129 | + 'description' => '' |
|
130 | + ], |
|
131 | + [ |
|
132 | + 'file' => $moduleDirName . '_page.tpl', |
|
133 | + 'description' => '' |
|
134 | + ], |
|
135 | + [ |
|
136 | + 'file' => $moduleDirName . '_instr.tpl', |
|
137 | + 'description' => '' |
|
138 | + ], |
|
139 | + [ |
|
140 | + 'file' => $moduleDirName . '_index.tpl', |
|
141 | + 'description' => '' |
|
142 | + ], |
|
143 | + [ |
|
144 | + 'file' => $moduleDirName . '_editpage.tpl', |
|
145 | + 'description' => '' |
|
146 | + ], |
|
147 | + [ |
|
148 | + 'file' => $moduleDirName . '_savepage.tpl', |
|
149 | + 'description' => '' |
|
150 | + ], |
|
151 | 151 | ]; |
152 | 152 | // Конфигурация |
153 | 153 | $modversion['config'][] = [ |
154 | - 'name' => 'form_options', |
|
155 | - 'title' => '_MI_INSTRUCTION_FORM_OPTIONS', |
|
156 | - 'description' => '_MI_INSTRUCTION_FORM_OPTIONS_DESC', |
|
157 | - 'formtype' => 'select', |
|
158 | - 'valuetype' => 'text', |
|
159 | - 'default' => 'dhtml', |
|
160 | - 'options' => array_flip($editorHandler->getList()) |
|
154 | + 'name' => 'form_options', |
|
155 | + 'title' => '_MI_INSTRUCTION_FORM_OPTIONS', |
|
156 | + 'description' => '_MI_INSTRUCTION_FORM_OPTIONS_DESC', |
|
157 | + 'formtype' => 'select', |
|
158 | + 'valuetype' => 'text', |
|
159 | + 'default' => 'dhtml', |
|
160 | + 'options' => array_flip($editorHandler->getList()) |
|
161 | 161 | ]; |
162 | 162 | $modversion['config'][] = [ |
163 | - 'name' => 'perpageadmin', |
|
164 | - 'title' => '_MI_INSTRUCTION_PERPAGEADMIN', |
|
165 | - 'description' => '_MI_INSTRUCTION_PERPAGEADMINDSC', |
|
166 | - 'formtype' => 'textbox', |
|
167 | - 'valuetype' => 'int', |
|
168 | - 'default' => 20 |
|
163 | + 'name' => 'perpageadmin', |
|
164 | + 'title' => '_MI_INSTRUCTION_PERPAGEADMIN', |
|
165 | + 'description' => '_MI_INSTRUCTION_PERPAGEADMINDSC', |
|
166 | + 'formtype' => 'textbox', |
|
167 | + 'valuetype' => 'int', |
|
168 | + 'default' => 20 |
|
169 | 169 | ]; |
170 | 170 | $modversion['config'][] = [ |
171 | - 'name' => 'perpagemain', |
|
172 | - 'title' => '_MI_INSTRUCTION_PERPAGEMAIN', |
|
173 | - 'description' => '_MI_INSTRUCTION_PERPAGEMAINDSC', |
|
174 | - 'formtype' => 'textbox', |
|
175 | - 'valuetype' => 'int', |
|
176 | - 'default' => 20 |
|
171 | + 'name' => 'perpagemain', |
|
172 | + 'title' => '_MI_INSTRUCTION_PERPAGEMAIN', |
|
173 | + 'description' => '_MI_INSTRUCTION_PERPAGEMAINDSC', |
|
174 | + 'formtype' => 'textbox', |
|
175 | + 'valuetype' => 'int', |
|
176 | + 'default' => 20 |
|
177 | 177 | ]; |
178 | 178 | // Теги |
179 | 179 | $modversion['config'][] = [ |
180 | - 'name' => 'usetag', |
|
181 | - 'title' => '_MI_INSTRUCTION_USETAG', |
|
182 | - 'description' => '_MI_INSTRUCTION_USETAGDSC', |
|
183 | - 'formtype' => 'yesno', |
|
184 | - 'valuetype' => 'int', |
|
185 | - 'default' => 0 |
|
180 | + 'name' => 'usetag', |
|
181 | + 'title' => '_MI_INSTRUCTION_USETAG', |
|
182 | + 'description' => '_MI_INSTRUCTION_USETAGDSC', |
|
183 | + 'formtype' => 'yesno', |
|
184 | + 'valuetype' => 'int', |
|
185 | + 'default' => 0 |
|
186 | 186 | ]; |
187 | 187 | // Оценки |
188 | 188 | $modversion['config'][] = [ |
189 | - 'name' => 'userat', |
|
190 | - 'title' => '_MI_INSTRUCTION_USERAT', |
|
191 | - 'description' => '_MI_INSTRUCTION_USERATDSC', |
|
192 | - 'formtype' => 'yesno', |
|
193 | - 'valuetype' => 'int', |
|
194 | - 'default' => 0 |
|
189 | + 'name' => 'userat', |
|
190 | + 'title' => '_MI_INSTRUCTION_USERAT', |
|
191 | + 'description' => '_MI_INSTRUCTION_USERATDSC', |
|
192 | + 'formtype' => 'yesno', |
|
193 | + 'valuetype' => 'int', |
|
194 | + 'default' => 0 |
|
195 | 195 | ]; |
196 | 196 | |
197 | 197 | // Блоки |
198 | 198 | // Блок последних страниц |
199 | 199 | $modversion['blocks'][] = [ |
200 | - 'file' => 'instr_lastpage.php', |
|
201 | - 'name' => _MI_INSTR_BLOCK_LASTPAGE, |
|
202 | - 'description' => _MI_INSTR_BLOCK_LASTPAGE_DESC, |
|
203 | - 'show_func' => 'b_instr_lastpage_show', |
|
204 | - 'edit_func' => 'b_instr_lastpage_edit', |
|
205 | - 'options' => '10|20', |
|
206 | - 'template' => $moduleDirName . '_block_lastpage.tpl' |
|
200 | + 'file' => 'instr_lastpage.php', |
|
201 | + 'name' => _MI_INSTR_BLOCK_LASTPAGE, |
|
202 | + 'description' => _MI_INSTR_BLOCK_LASTPAGE_DESC, |
|
203 | + 'show_func' => 'b_instr_lastpage_show', |
|
204 | + 'edit_func' => 'b_instr_lastpage_edit', |
|
205 | + 'options' => '10|20', |
|
206 | + 'template' => $moduleDirName . '_block_lastpage.tpl' |
|
207 | 207 | ]; |
208 | 208 | // Блок последних инструкций |
209 | 209 | $modversion['blocks'][] = [ |
210 | - 'file' => 'instr_lastinstr.php', |
|
211 | - 'name' => _MI_INSTR_BLOCK_LASTINSTR, |
|
212 | - 'description' => _MI_INSTR_BLOCK_LASTINSTR_DESC, |
|
213 | - 'show_func' => 'b_instr_lastinstr_show', |
|
214 | - 'edit_func' => 'b_instr_lastinstr_edit', |
|
215 | - 'options' => '10|20', |
|
216 | - 'template' => $moduleDirName . '_block_lastinstr.tpl' |
|
210 | + 'file' => 'instr_lastinstr.php', |
|
211 | + 'name' => _MI_INSTR_BLOCK_LASTINSTR, |
|
212 | + 'description' => _MI_INSTR_BLOCK_LASTINSTR_DESC, |
|
213 | + 'show_func' => 'b_instr_lastinstr_show', |
|
214 | + 'edit_func' => 'b_instr_lastinstr_edit', |
|
215 | + 'options' => '10|20', |
|
216 | + 'template' => $moduleDirName . '_block_lastinstr.tpl' |
|
217 | 217 | ]; |
218 | 218 | |
219 | 219 | // Notification |
@@ -11,8 +11,8 @@ |
||
11 | 11 | |
12 | 12 | $configurator = include __DIR__ . '/../include/config.php'; |
13 | 13 | foreach (array_keys($configurator->uploadFolders) as $i) { |
14 | - $utility::createFolder($configurator->uploadFolders[$i]); |
|
15 | - $adminObject->addConfigBoxLine($configurator->uploadFolders[$i], 'folder'); |
|
14 | + $utility::createFolder($configurator->uploadFolders[$i]); |
|
15 | + $adminObject->addConfigBoxLine($configurator->uploadFolders[$i], 'folder'); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | //$instructionHandler = xoops_getModuleHandler('instruction', 'instruction'); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use Xoopsmodules\instruction; |
4 | 4 | |
5 | 5 | if (!isset($moduleDirName)) { |
6 | - $moduleDirName = basename(dirname(__DIR__)); |
|
6 | + $moduleDirName = basename(dirname(__DIR__)); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | /** @var Xmf\Module\Helper $moduleHelper */ |
@@ -17,34 +17,34 @@ discard block |
||
17 | 17 | |
18 | 18 | // Административное меню |
19 | 19 | $adminmenu = [ |
20 | - [ |
|
21 | - 'title' => _MI_INSTRUCTION_ADMIN_HOME, |
|
22 | - 'link' => 'admin/index.php', |
|
23 | - 'desc' => _MI_INSTRUCTION_ADMIN_HOME_DESC, |
|
24 | - 'icon' => $pathIcon32 . '/home.png' |
|
25 | - ], |
|
26 | - [ |
|
27 | - 'title' => _MI_INSTRUCTION_ADMIN_CAT, |
|
28 | - 'link' => 'admin/cat.php', |
|
29 | - 'desc' => _MI_INSTRUCTION_ADMIN_CAT_DESC, |
|
30 | - 'icon' => $pathIcon32 . '/category.png' |
|
31 | - ], |
|
32 | - [ |
|
33 | - 'title' => _MI_INSTRUCTION_ADMIN_INSTR, |
|
34 | - 'link' => 'admin/instr.php', |
|
35 | - 'desc' => _MI_INSTRUCTION_ADMIN_INSTR_DESC, |
|
36 | - 'icon' => $pathModIcon32 . '/nav_book.png' |
|
37 | - ], |
|
38 | - [ |
|
39 | - 'title' => _MI_INSTRUCTION_ADMIN_PERM, |
|
40 | - 'link' => 'admin/perm.php', |
|
41 | - 'desc' => _MI_INSTRUCTION_ADMIN_PERM_DESC, |
|
42 | - 'icon' => $pathIcon32 . '/permissions.png' |
|
43 | - ], |
|
44 | - [ |
|
45 | - 'title' => _MI_INSTRUCTION_ADMIN_ABOUT, |
|
46 | - 'link' => 'admin/about.php', |
|
47 | - 'desc' => _MI_INSTRUCTION_ADMIN_ABOUT_DESC, |
|
48 | - 'icon' => $pathIcon32 . '/about.png' |
|
49 | - ] |
|
20 | + [ |
|
21 | + 'title' => _MI_INSTRUCTION_ADMIN_HOME, |
|
22 | + 'link' => 'admin/index.php', |
|
23 | + 'desc' => _MI_INSTRUCTION_ADMIN_HOME_DESC, |
|
24 | + 'icon' => $pathIcon32 . '/home.png' |
|
25 | + ], |
|
26 | + [ |
|
27 | + 'title' => _MI_INSTRUCTION_ADMIN_CAT, |
|
28 | + 'link' => 'admin/cat.php', |
|
29 | + 'desc' => _MI_INSTRUCTION_ADMIN_CAT_DESC, |
|
30 | + 'icon' => $pathIcon32 . '/category.png' |
|
31 | + ], |
|
32 | + [ |
|
33 | + 'title' => _MI_INSTRUCTION_ADMIN_INSTR, |
|
34 | + 'link' => 'admin/instr.php', |
|
35 | + 'desc' => _MI_INSTRUCTION_ADMIN_INSTR_DESC, |
|
36 | + 'icon' => $pathModIcon32 . '/nav_book.png' |
|
37 | + ], |
|
38 | + [ |
|
39 | + 'title' => _MI_INSTRUCTION_ADMIN_PERM, |
|
40 | + 'link' => 'admin/perm.php', |
|
41 | + 'desc' => _MI_INSTRUCTION_ADMIN_PERM_DESC, |
|
42 | + 'icon' => $pathIcon32 . '/permissions.png' |
|
43 | + ], |
|
44 | + [ |
|
45 | + 'title' => _MI_INSTRUCTION_ADMIN_ABOUT, |
|
46 | + 'link' => 'admin/about.php', |
|
47 | + 'desc' => _MI_INSTRUCTION_ADMIN_ABOUT_DESC, |
|
48 | + 'icon' => $pathIcon32 . '/about.png' |
|
49 | + ] |
|
50 | 50 | ]; |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | use Xoopsmodules\instruction; |
4 | 4 | |
5 | -if (!isset($moduleDirName)) { |
|
5 | +if ( ! isset($moduleDirName)) { |
|
6 | 6 | $moduleDirName = basename(dirname(__DIR__)); |
7 | 7 | } |
8 | 8 |
@@ -22,12 +22,12 @@ |
||
22 | 22 | */ |
23 | 23 | class InstructionCorePreload extends XoopsPreloadItem |
24 | 24 | { |
25 | - // to add PSR-4 autoloader |
|
26 | - /** |
|
27 | - * @param $args |
|
28 | - */ |
|
29 | - public static function eventCoreIncludeCommonEnd($args) |
|
30 | - { |
|
31 | - include __DIR__ . '/autoloader.php'; |
|
32 | - } |
|
25 | + // to add PSR-4 autoloader |
|
26 | + /** |
|
27 | + * @param $args |
|
28 | + */ |
|
29 | + public static function eventCoreIncludeCommonEnd($args) |
|
30 | + { |
|
31 | + include __DIR__ . '/autoloader.php'; |
|
32 | + } |
|
33 | 33 | } |
@@ -4,29 +4,29 @@ |
||
4 | 4 | * @see http://www.php-fig.org/psr/psr-4/examples/ |
5 | 5 | */ |
6 | 6 | spl_autoload_register(function ($class) { |
7 | - // project-specific namespace prefix |
|
8 | - $prefix = 'Xoopsmodules\\instruction\\'; |
|
7 | + // project-specific namespace prefix |
|
8 | + $prefix = 'Xoopsmodules\\instruction\\'; |
|
9 | 9 | |
10 | - // base directory for the namespace prefix |
|
11 | - $base_dir = __DIR__ . '/../class/'; |
|
10 | + // base directory for the namespace prefix |
|
11 | + $base_dir = __DIR__ . '/../class/'; |
|
12 | 12 | |
13 | - // does the class use the namespace prefix? |
|
14 | - $len = strlen($prefix); |
|
13 | + // does the class use the namespace prefix? |
|
14 | + $len = strlen($prefix); |
|
15 | 15 | |
16 | - if (0 !== strncmp($prefix, $class, $len)) { |
|
17 | - return; |
|
18 | - } |
|
16 | + if (0 !== strncmp($prefix, $class, $len)) { |
|
17 | + return; |
|
18 | + } |
|
19 | 19 | |
20 | - // get the relative class name |
|
21 | - $relative_class = substr($class, $len); |
|
20 | + // get the relative class name |
|
21 | + $relative_class = substr($class, $len); |
|
22 | 22 | |
23 | - // replace the namespace prefix with the base directory, replace namespace |
|
24 | - // separators with directory separators in the relative class name, append |
|
25 | - // with .php |
|
26 | - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
23 | + // replace the namespace prefix with the base directory, replace namespace |
|
24 | + // separators with directory separators in the relative class name, append |
|
25 | + // with .php |
|
26 | + $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
27 | 27 | |
28 | - // if the file exists, require it |
|
29 | - if (file_exists($file)) { |
|
30 | - require $file; |
|
31 | - } |
|
28 | + // if the file exists, require it |
|
29 | + if (file_exists($file)) { |
|
30 | + require $file; |
|
31 | + } |
|
32 | 32 | }); |
@@ -3,7 +3,7 @@ |
||
3 | 3 | /** |
4 | 4 | * @see http://www.php-fig.org/psr/psr-4/examples/ |
5 | 5 | */ |
6 | -spl_autoload_register(function ($class) { |
|
6 | +spl_autoload_register(function($class) { |
|
7 | 7 | // project-specific namespace prefix |
8 | 8 | $prefix = 'Xoopsmodules\\instruction\\'; |
9 | 9 |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | $module = $helper->getModule(); |
49 | 49 | |
50 | 50 | if (Xoopsmodules\instruction\Utility::checkVerXoops($module, '2.5.9')) { |
51 | - $cat_select = $mytree->makeSelectElement('cid', 'title', '--', $cid, true, 0, "onChange='javascript: document.insformselcat.submit()'", ''); |
|
52 | - $GLOBALS['xoopsTpl']->assign('insFormSelCat', $cat_select->render()); |
|
51 | + $cat_select = $mytree->makeSelectElement('cid', 'title', '--', $cid, true, 0, "onChange='javascript: document.insformselcat.submit()'", ''); |
|
52 | + $GLOBALS['xoopsTpl']->assign('insFormSelCat', $cat_select->render()); |
|
53 | 53 | } else { |
54 | - $cat_select = $mytree->makeSelBox('cid', 'title', '--', $cid, true, 0, "onChange='javascript: document.insformselcat.submit()'"); |
|
55 | - $GLOBALS['xoopsTpl']->assign('insFormSelCat', $cat_select); |
|
54 | + $cat_select = $mytree->makeSelBox('cid', 'title', '--', $cid, true, 0, "onChange='javascript: document.insformselcat.submit()'"); |
|
55 | + $GLOBALS['xoopsTpl']->assign('insFormSelCat', $cat_select); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | // Находим список всех инструкций |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | $criteria->add(new \Criteria('status', '0', '>')); |
63 | 63 | // Если есть категория |
64 | 64 | if ($cid) { |
65 | - // Если нельзя просматривать эту категорию |
|
66 | - if (!in_array($cid, $categories)) { |
|
67 | - redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_CAT); |
|
68 | - } |
|
69 | - $criteria->add(new \Criteria('cid', $cid, '=')); |
|
70 | - // Иначе находим список всех |
|
65 | + // Если нельзя просматривать эту категорию |
|
66 | + if (!in_array($cid, $categories)) { |
|
67 | + redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_CAT); |
|
68 | + } |
|
69 | + $criteria->add(new \Criteria('cid', $cid, '=')); |
|
70 | + // Иначе находим список всех |
|
71 | 71 | } else { |
72 | - $criteria->add(new \Criteria('cid', '( ' . implode(', ', $categories) . ' )', 'IN')); |
|
72 | + $criteria->add(new \Criteria('cid', '( ' . implode(', ', $categories) . ' )', 'IN')); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | // Число инструкций, удовлетворяющих данному условию |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | $instr_arr = $instructionHandler->getall($criteria); |
87 | 87 | // Если записей больше чем $limit, то выводим пагинатор |
88 | 88 | if ($numrows > $limit) { |
89 | - $pagenav = new \XoopsPageNav($numrows, $limit, $start, 'start', 'cid=' . $cid); |
|
90 | - $pagenav = $pagenav->renderNav(4); |
|
89 | + $pagenav = new \XoopsPageNav($numrows, $limit, $start, 'start', 'cid=' . $cid); |
|
90 | + $pagenav = $pagenav->renderNav(4); |
|
91 | 91 | } else { |
92 | - $pagenav = ''; |
|
92 | + $pagenav = ''; |
|
93 | 93 | } |
94 | 94 | // Выводим пагинатор в шаблон |
95 | 95 | $GLOBALS['xoopsTpl']->assign('insPagenav', $pagenav); |
@@ -100,53 +100,53 @@ discard block |
||
100 | 100 | |
101 | 101 | // Если есть записи |
102 | 102 | if ($numrows > 0) { |
103 | - $class = 'odd'; |
|
104 | - foreach (array_keys($instr_arr) as $i) { |
|
105 | - |
|
106 | - // |
|
107 | - $class = ('even' === $class) ? 'odd' : 'even'; |
|
108 | - // ID |
|
109 | - $insinstr_instrid = $instr_arr[$i]->getVar('instrid'); |
|
110 | - // Название |
|
111 | - $insinstr_title = $instr_arr[$i]->getVar('title'); |
|
112 | - // Статус |
|
113 | - $insinstr_status = $instr_arr[$i]->getVar('status'); |
|
114 | - // Количество страниц |
|
115 | - $insinstr_pages = $instr_arr[$i]->getVar('pages'); |
|
116 | - // Категория |
|
117 | - $insinstr_cid = $instr_arr[$i]->getVar('cid'); |
|
118 | - $insinstr_cat = $categoryHandler->get($insinstr_cid); |
|
119 | - // Права на добавление |
|
120 | - $perm_submit = in_array($insinstr_cid, $cat_submit) ? true : false; |
|
121 | - // Права на редактирование |
|
122 | - $perm_edit = in_array($insinstr_cid, $cat_edit) ? true : false; |
|
123 | - //Мета-теги ключевых слов |
|
124 | - $insinstr_metakeywords = $instr_arr[$i]->getVar('metakeywords'); |
|
125 | - // Если есть - добавляем в мета-теги страницы |
|
126 | - if ($insinstr_metakeywords) { |
|
127 | - $index_metakeywords[] = $insinstr_metakeywords; |
|
128 | - } |
|
129 | - // Мета-теги описания |
|
130 | - $insinstr_metadescript = $instr_arr[$i]->getVar('metadescription'); |
|
131 | - // Если есть - добавляем в мета-теги страницы |
|
132 | - if ($insinstr_metadescript) { |
|
133 | - $index_metadescript[] = $insinstr_metadescript; |
|
134 | - } |
|
135 | - |
|
136 | - // Выводим в шаблон |
|
137 | - $GLOBALS['xoopsTpl']->append('insListInstr', |
|
138 | - ['instrid' => $insinstr_instrid, 'title' => $insinstr_title, 'status' => $insinstr_status, 'pages' => $insinstr_pages, 'ctitle' => $insinstr_cat->getVar('title'), 'cid' => $insinstr_cid, 'permsubmit' => $perm_submit, 'permedit' => $perm_edit, 'class' => $class]); |
|
139 | - } |
|
140 | - |
|
141 | - // Языковые константы |
|
103 | + $class = 'odd'; |
|
104 | + foreach (array_keys($instr_arr) as $i) { |
|
105 | + |
|
106 | + // |
|
107 | + $class = ('even' === $class) ? 'odd' : 'even'; |
|
108 | + // ID |
|
109 | + $insinstr_instrid = $instr_arr[$i]->getVar('instrid'); |
|
110 | + // Название |
|
111 | + $insinstr_title = $instr_arr[$i]->getVar('title'); |
|
112 | + // Статус |
|
113 | + $insinstr_status = $instr_arr[$i]->getVar('status'); |
|
114 | + // Количество страниц |
|
115 | + $insinstr_pages = $instr_arr[$i]->getVar('pages'); |
|
116 | + // Категория |
|
117 | + $insinstr_cid = $instr_arr[$i]->getVar('cid'); |
|
118 | + $insinstr_cat = $categoryHandler->get($insinstr_cid); |
|
119 | + // Права на добавление |
|
120 | + $perm_submit = in_array($insinstr_cid, $cat_submit) ? true : false; |
|
121 | + // Права на редактирование |
|
122 | + $perm_edit = in_array($insinstr_cid, $cat_edit) ? true : false; |
|
123 | + //Мета-теги ключевых слов |
|
124 | + $insinstr_metakeywords = $instr_arr[$i]->getVar('metakeywords'); |
|
125 | + // Если есть - добавляем в мета-теги страницы |
|
126 | + if ($insinstr_metakeywords) { |
|
127 | + $index_metakeywords[] = $insinstr_metakeywords; |
|
128 | + } |
|
129 | + // Мета-теги описания |
|
130 | + $insinstr_metadescript = $instr_arr[$i]->getVar('metadescription'); |
|
131 | + // Если есть - добавляем в мета-теги страницы |
|
132 | + if ($insinstr_metadescript) { |
|
133 | + $index_metadescript[] = $insinstr_metadescript; |
|
134 | + } |
|
135 | + |
|
136 | + // Выводим в шаблон |
|
137 | + $GLOBALS['xoopsTpl']->append('insListInstr', |
|
138 | + ['instrid' => $insinstr_instrid, 'title' => $insinstr_title, 'status' => $insinstr_status, 'pages' => $insinstr_pages, 'ctitle' => $insinstr_cat->getVar('title'), 'cid' => $insinstr_cid, 'permsubmit' => $perm_submit, 'permedit' => $perm_edit, 'class' => $class]); |
|
139 | + } |
|
140 | + |
|
141 | + // Языковые константы |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | // Если есть мета-теги |
145 | 145 | if (count($index_metakeywords)) { |
146 | - $xoTheme->addMeta('meta', 'keywords', implode(', ', $index_metakeywords)); |
|
146 | + $xoTheme->addMeta('meta', 'keywords', implode(', ', $index_metakeywords)); |
|
147 | 147 | } |
148 | 148 | if (count($index_metadescript)) { |
149 | - $xoTheme->addMeta('meta', 'description', implode(', ', $index_metadescript)); |
|
149 | + $xoTheme->addMeta('meta', 'description', implode(', ', $index_metadescript)); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | // Подвал |
@@ -63,7 +63,7 @@ |
||
63 | 63 | // Если есть категория |
64 | 64 | if ($cid) { |
65 | 65 | // Если нельзя просматривать эту категорию |
66 | - if (!in_array($cid, $categories)) { |
|
66 | + if ( ! in_array($cid, $categories)) { |
|
67 | 67 | redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_CAT); |
68 | 68 | } |
69 | 69 | $criteria->add(new \Criteria('cid', $cid, '=')); |
@@ -17,77 +17,77 @@ |
||
17 | 17 | */ |
18 | 18 | trait VersionChecks |
19 | 19 | { |
20 | - /** |
|
21 | - * |
|
22 | - * Verifies XOOPS version meets minimum requirements for this module |
|
23 | - * @static |
|
24 | - * @param \XoopsModule|null $module |
|
25 | - * |
|
26 | - * @param null|string $requiredVer |
|
27 | - * @return bool true if meets requirements, false if not |
|
28 | - */ |
|
29 | - public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) |
|
30 | - { |
|
31 | - $moduleDirName = basename(dirname(dirname(__DIR__))); |
|
32 | - if (null === $module) { |
|
33 | - $module = \XoopsModule::getByDirname($moduleDirName); |
|
34 | - } |
|
35 | - xoops_loadLanguage('admin', $moduleDirName); |
|
36 | - //check for minimum XOOPS version |
|
37 | - $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string |
|
38 | - $currArray = explode('.', $currentVer); |
|
39 | - if (null === $requiredVer) { |
|
40 | - $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string |
|
41 | - } |
|
42 | - $reqArray = explode('.', $requiredVer); |
|
43 | - $success = true; |
|
44 | - foreach ($reqArray as $k => $v) { |
|
45 | - if (isset($currArray[$k])) { |
|
46 | - if ($currArray[$k] > $v) { |
|
47 | - break; |
|
48 | - } elseif ($currArray[$k] == $v) { |
|
49 | - continue; |
|
50 | - } else { |
|
51 | - $success = false; |
|
52 | - break; |
|
53 | - } |
|
54 | - } else { |
|
55 | - if ((int)$v > 0) { // handles versions like x.x.x.0_RC2 |
|
56 | - $success = false; |
|
57 | - break; |
|
58 | - } |
|
59 | - } |
|
60 | - } |
|
20 | + /** |
|
21 | + * |
|
22 | + * Verifies XOOPS version meets minimum requirements for this module |
|
23 | + * @static |
|
24 | + * @param \XoopsModule|null $module |
|
25 | + * |
|
26 | + * @param null|string $requiredVer |
|
27 | + * @return bool true if meets requirements, false if not |
|
28 | + */ |
|
29 | + public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) |
|
30 | + { |
|
31 | + $moduleDirName = basename(dirname(dirname(__DIR__))); |
|
32 | + if (null === $module) { |
|
33 | + $module = \XoopsModule::getByDirname($moduleDirName); |
|
34 | + } |
|
35 | + xoops_loadLanguage('admin', $moduleDirName); |
|
36 | + //check for minimum XOOPS version |
|
37 | + $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string |
|
38 | + $currArray = explode('.', $currentVer); |
|
39 | + if (null === $requiredVer) { |
|
40 | + $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string |
|
41 | + } |
|
42 | + $reqArray = explode('.', $requiredVer); |
|
43 | + $success = true; |
|
44 | + foreach ($reqArray as $k => $v) { |
|
45 | + if (isset($currArray[$k])) { |
|
46 | + if ($currArray[$k] > $v) { |
|
47 | + break; |
|
48 | + } elseif ($currArray[$k] == $v) { |
|
49 | + continue; |
|
50 | + } else { |
|
51 | + $success = false; |
|
52 | + break; |
|
53 | + } |
|
54 | + } else { |
|
55 | + if ((int)$v > 0) { // handles versions like x.x.x.0_RC2 |
|
56 | + $success = false; |
|
57 | + break; |
|
58 | + } |
|
59 | + } |
|
60 | + } |
|
61 | 61 | |
62 | - if (false === $success) { |
|
63 | - $module->setErrors(sprintf(_AM_WFL_ERROR_BAD_XOOPS, $requiredVer, $currentVer)); |
|
64 | - } |
|
62 | + if (false === $success) { |
|
63 | + $module->setErrors(sprintf(_AM_WFL_ERROR_BAD_XOOPS, $requiredVer, $currentVer)); |
|
64 | + } |
|
65 | 65 | |
66 | - return $success; |
|
67 | - } |
|
66 | + return $success; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * |
|
71 | - * Verifies PHP version meets minimum requirements for this module |
|
72 | - * @static |
|
73 | - * @param \XoopsModule $module |
|
74 | - * |
|
75 | - * @return bool true if meets requirements, false if not |
|
76 | - */ |
|
77 | - public static function checkVerPhp(\XoopsModule $module) |
|
78 | - { |
|
79 | - xoops_loadLanguage('admin', $module->dirname()); |
|
80 | - // check for minimum PHP version |
|
81 | - $success = true; |
|
82 | - $verNum = PHP_VERSION; |
|
83 | - $reqVer = $module->getInfo('min_php'); |
|
84 | - if (false !== $reqVer && '' !== $reqVer) { |
|
85 | - if (version_compare($verNum, $reqVer, '<')) { |
|
86 | - $module->setErrors(sprintf(_AM_WFL_ERROR_BAD_PHP, $reqVer, $verNum)); |
|
87 | - $success = false; |
|
88 | - } |
|
89 | - } |
|
69 | + /** |
|
70 | + * |
|
71 | + * Verifies PHP version meets minimum requirements for this module |
|
72 | + * @static |
|
73 | + * @param \XoopsModule $module |
|
74 | + * |
|
75 | + * @return bool true if meets requirements, false if not |
|
76 | + */ |
|
77 | + public static function checkVerPhp(\XoopsModule $module) |
|
78 | + { |
|
79 | + xoops_loadLanguage('admin', $module->dirname()); |
|
80 | + // check for minimum PHP version |
|
81 | + $success = true; |
|
82 | + $verNum = PHP_VERSION; |
|
83 | + $reqVer = $module->getInfo('min_php'); |
|
84 | + if (false !== $reqVer && '' !== $reqVer) { |
|
85 | + if (version_compare($verNum, $reqVer, '<')) { |
|
86 | + $module->setErrors(sprintf(_AM_WFL_ERROR_BAD_PHP, $reqVer, $verNum)); |
|
87 | + $success = false; |
|
88 | + } |
|
89 | + } |
|
90 | 90 | |
91 | - return $success; |
|
92 | - } |
|
91 | + return $success; |
|
92 | + } |
|
93 | 93 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | break; |
52 | 52 | } |
53 | 53 | } else { |
54 | - if ((int)$v > 0) { // handles versions like x.x.x.0_RC2 |
|
54 | + if ((int) $v > 0) { // handles versions like x.x.x.0_RC2 |
|
55 | 55 | $success = false; |
56 | 56 | break; |
57 | 57 | } |
@@ -35,8 +35,7 @@ |
||
35 | 35 | |
36 | 36 | file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
37 | 37 | } |
38 | - } |
|
39 | - catch (\Exception $e) { |
|
38 | + } catch (\Exception $e) { |
|
40 | 39 | echo 'Caught exception: ', $e->getMessage(), "\n", '<br>'; |
41 | 40 | } |
42 | 41 | } |
@@ -17,231 +17,231 @@ |
||
17 | 17 | */ |
18 | 18 | trait FilesManagement |
19 | 19 | { |
20 | - /** |
|
21 | - * Function responsible for checking if a directory exists, we can also write in and create an index.html file |
|
22 | - * |
|
23 | - * @param string $folder The full path of the directory to check |
|
24 | - * |
|
25 | - * @return void |
|
26 | - * @throws \RuntimeException |
|
27 | - */ |
|
28 | - public static function createFolder($folder) |
|
29 | - { |
|
30 | - try { |
|
31 | - if (!file_exists($folder)) { |
|
32 | - if (!mkdir($folder) && !is_dir($folder)) { |
|
33 | - throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
|
34 | - } |
|
35 | - |
|
36 | - file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
|
37 | - } |
|
38 | - } |
|
39 | - catch (\Exception $e) { |
|
40 | - echo 'Caught exception: ', $e->getMessage(), "\n", '<br>'; |
|
41 | - } |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * @param $file |
|
46 | - * @param $folder |
|
47 | - * @return bool |
|
48 | - */ |
|
49 | - public static function copyFile($file, $folder) |
|
50 | - { |
|
51 | - return copy($file, $folder); |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * @param $src |
|
56 | - * @param $dst |
|
57 | - * @throws \RuntimeException |
|
58 | - */ |
|
59 | - public static function recurseCopy($src, $dst) |
|
60 | - { |
|
61 | - $dir = opendir($src); |
|
62 | - if (!mkdir($dst) && !is_dir($dst)) { |
|
63 | - throw new \RuntimeException('The directory ' . $dst . ' could not be created.'); |
|
64 | - } |
|
65 | - while (false !== ($file = readdir($dir))) { |
|
66 | - if (('.' !== $file) && ('..' !== $file)) { |
|
67 | - if (is_dir($src . '/' . $file)) { |
|
68 | - self::recurseCopy($src . '/' . $file, $dst . '/' . $file); |
|
69 | - } else { |
|
70 | - copy($src . '/' . $file, $dst . '/' . $file); |
|
71 | - } |
|
72 | - } |
|
73 | - } |
|
74 | - closedir($dir); |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * |
|
79 | - * Remove files and (sub)directories |
|
80 | - * |
|
81 | - * @param string $src source directory to delete |
|
82 | - * |
|
83 | - * @uses \Xmf\Module\Helper::getHelper() |
|
84 | - * @uses \Xmf\Module\Helper::isUserAdmin() |
|
85 | - * |
|
86 | - * @return bool true on success |
|
87 | - */ |
|
88 | - public static function deleteDirectory($src) |
|
89 | - { |
|
90 | - // Only continue if user is a 'global' Admin |
|
91 | - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
92 | - return false; |
|
93 | - } |
|
94 | - |
|
95 | - $success = true; |
|
96 | - // remove old files |
|
97 | - $dirInfo = new \SplFileInfo($src); |
|
98 | - // validate is a directory |
|
99 | - if ($dirInfo->isDir()) { |
|
100 | - $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']); |
|
101 | - foreach ($fileList as $k => $v) { |
|
102 | - $fileInfo = new \SplFileInfo("{$src}/{$v}"); |
|
103 | - if ($fileInfo->isDir()) { |
|
104 | - // recursively handle subdirectories |
|
105 | - if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { |
|
106 | - break; |
|
107 | - } |
|
108 | - } else { |
|
109 | - // delete the file |
|
110 | - if (!($success = unlink($fileInfo->getRealPath()))) { |
|
111 | - break; |
|
112 | - } |
|
113 | - } |
|
114 | - } |
|
115 | - // now delete this (sub)directory if all the files are gone |
|
116 | - if ($success) { |
|
117 | - $success = rmdir($dirInfo->getRealPath()); |
|
118 | - } |
|
119 | - } else { |
|
120 | - // input is not a valid directory |
|
121 | - $success = false; |
|
122 | - } |
|
123 | - return $success; |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * |
|
128 | - * Recursively remove directory |
|
129 | - * |
|
130 | - * @todo currently won't remove directories with hidden files, should it? |
|
131 | - * |
|
132 | - * @param string $src directory to remove (delete) |
|
133 | - * |
|
134 | - * @return bool true on success |
|
135 | - */ |
|
136 | - public static function rrmdir($src) |
|
137 | - { |
|
138 | - // Only continue if user is a 'global' Admin |
|
139 | - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
140 | - return false; |
|
141 | - } |
|
142 | - |
|
143 | - // If source is not a directory stop processing |
|
144 | - if (!is_dir($src)) { |
|
145 | - return false; |
|
146 | - } |
|
147 | - |
|
148 | - $success = true; |
|
149 | - |
|
150 | - // Open the source directory to read in files |
|
151 | - $iterator = new \DirectoryIterator($src); |
|
152 | - foreach ($iterator as $fObj) { |
|
153 | - if ($fObj->isFile()) { |
|
154 | - $filename = $fObj->getPathname(); |
|
155 | - $fObj = null; // clear this iterator object to close the file |
|
156 | - if (!unlink($filename)) { |
|
157 | - return false; // couldn't delete the file |
|
158 | - } |
|
159 | - } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
160 | - // Try recursively on directory |
|
161 | - self::rrmdir($fObj->getPathname()); |
|
162 | - } |
|
163 | - } |
|
164 | - $iterator = null; // clear iterator Obj to close file/directory |
|
165 | - return rmdir($src); // remove the directory & return results |
|
166 | - } |
|
167 | - |
|
168 | - /** |
|
169 | - * Recursively move files from one directory to another |
|
170 | - * |
|
171 | - * @param string $src - Source of files being moved |
|
172 | - * @param string $dest - Destination of files being moved |
|
173 | - * |
|
174 | - * @return bool true on success |
|
175 | - */ |
|
176 | - public static function rmove($src, $dest) |
|
177 | - { |
|
178 | - // Only continue if user is a 'global' Admin |
|
179 | - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
180 | - return false; |
|
181 | - } |
|
182 | - |
|
183 | - // If source is not a directory stop processing |
|
184 | - if (!is_dir($src)) { |
|
185 | - return false; |
|
186 | - } |
|
187 | - |
|
188 | - // If the destination directory does not exist and could not be created stop processing |
|
189 | - if (!is_dir($dest) && !mkdir($dest, 0755)) { |
|
190 | - return false; |
|
191 | - } |
|
192 | - |
|
193 | - // Open the source directory to read in files |
|
194 | - $iterator = new \DirectoryIterator($src); |
|
195 | - foreach ($iterator as $fObj) { |
|
196 | - if ($fObj->isFile()) { |
|
197 | - rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
198 | - } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
199 | - // Try recursively on directory |
|
200 | - self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
201 | - // rmdir($fObj->getPath()); // now delete the directory |
|
202 | - } |
|
203 | - } |
|
204 | - $iterator = null; // clear iterator Obj to close file/directory |
|
205 | - return rmdir($src); // remove the directory & return results |
|
206 | - } |
|
207 | - |
|
208 | - /** |
|
209 | - * Recursively copy directories and files from one directory to another |
|
210 | - * |
|
211 | - * @param string $src - Source of files being moved |
|
212 | - * @param string $dest - Destination of files being moved |
|
213 | - * |
|
214 | - * @uses \Xmf\Module\Helper::getHelper() |
|
215 | - * @uses \Xmf\Module\Helper::isUserAdmin() |
|
216 | - * |
|
217 | - * @return bool true on success |
|
218 | - */ |
|
219 | - public static function rcopy($src, $dest) |
|
220 | - { |
|
221 | - // Only continue if user is a 'global' Admin |
|
222 | - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
223 | - return false; |
|
224 | - } |
|
225 | - |
|
226 | - // If source is not a directory stop processing |
|
227 | - if (!is_dir($src)) { |
|
228 | - return false; |
|
229 | - } |
|
230 | - |
|
231 | - // If the destination directory does not exist and could not be created stop processing |
|
232 | - if (!is_dir($dest) && !mkdir($dest, 0755)) { |
|
233 | - return false; |
|
234 | - } |
|
235 | - |
|
236 | - // Open the source directory to read in files |
|
237 | - $iterator = new \DirectoryIterator($src); |
|
238 | - foreach ($iterator as $fObj) { |
|
239 | - if ($fObj->isFile()) { |
|
240 | - copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
241 | - } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
242 | - self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
243 | - } |
|
244 | - } |
|
245 | - return true; |
|
246 | - } |
|
20 | + /** |
|
21 | + * Function responsible for checking if a directory exists, we can also write in and create an index.html file |
|
22 | + * |
|
23 | + * @param string $folder The full path of the directory to check |
|
24 | + * |
|
25 | + * @return void |
|
26 | + * @throws \RuntimeException |
|
27 | + */ |
|
28 | + public static function createFolder($folder) |
|
29 | + { |
|
30 | + try { |
|
31 | + if (!file_exists($folder)) { |
|
32 | + if (!mkdir($folder) && !is_dir($folder)) { |
|
33 | + throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
|
34 | + } |
|
35 | + |
|
36 | + file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
|
37 | + } |
|
38 | + } |
|
39 | + catch (\Exception $e) { |
|
40 | + echo 'Caught exception: ', $e->getMessage(), "\n", '<br>'; |
|
41 | + } |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * @param $file |
|
46 | + * @param $folder |
|
47 | + * @return bool |
|
48 | + */ |
|
49 | + public static function copyFile($file, $folder) |
|
50 | + { |
|
51 | + return copy($file, $folder); |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * @param $src |
|
56 | + * @param $dst |
|
57 | + * @throws \RuntimeException |
|
58 | + */ |
|
59 | + public static function recurseCopy($src, $dst) |
|
60 | + { |
|
61 | + $dir = opendir($src); |
|
62 | + if (!mkdir($dst) && !is_dir($dst)) { |
|
63 | + throw new \RuntimeException('The directory ' . $dst . ' could not be created.'); |
|
64 | + } |
|
65 | + while (false !== ($file = readdir($dir))) { |
|
66 | + if (('.' !== $file) && ('..' !== $file)) { |
|
67 | + if (is_dir($src . '/' . $file)) { |
|
68 | + self::recurseCopy($src . '/' . $file, $dst . '/' . $file); |
|
69 | + } else { |
|
70 | + copy($src . '/' . $file, $dst . '/' . $file); |
|
71 | + } |
|
72 | + } |
|
73 | + } |
|
74 | + closedir($dir); |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * |
|
79 | + * Remove files and (sub)directories |
|
80 | + * |
|
81 | + * @param string $src source directory to delete |
|
82 | + * |
|
83 | + * @uses \Xmf\Module\Helper::getHelper() |
|
84 | + * @uses \Xmf\Module\Helper::isUserAdmin() |
|
85 | + * |
|
86 | + * @return bool true on success |
|
87 | + */ |
|
88 | + public static function deleteDirectory($src) |
|
89 | + { |
|
90 | + // Only continue if user is a 'global' Admin |
|
91 | + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
92 | + return false; |
|
93 | + } |
|
94 | + |
|
95 | + $success = true; |
|
96 | + // remove old files |
|
97 | + $dirInfo = new \SplFileInfo($src); |
|
98 | + // validate is a directory |
|
99 | + if ($dirInfo->isDir()) { |
|
100 | + $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']); |
|
101 | + foreach ($fileList as $k => $v) { |
|
102 | + $fileInfo = new \SplFileInfo("{$src}/{$v}"); |
|
103 | + if ($fileInfo->isDir()) { |
|
104 | + // recursively handle subdirectories |
|
105 | + if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { |
|
106 | + break; |
|
107 | + } |
|
108 | + } else { |
|
109 | + // delete the file |
|
110 | + if (!($success = unlink($fileInfo->getRealPath()))) { |
|
111 | + break; |
|
112 | + } |
|
113 | + } |
|
114 | + } |
|
115 | + // now delete this (sub)directory if all the files are gone |
|
116 | + if ($success) { |
|
117 | + $success = rmdir($dirInfo->getRealPath()); |
|
118 | + } |
|
119 | + } else { |
|
120 | + // input is not a valid directory |
|
121 | + $success = false; |
|
122 | + } |
|
123 | + return $success; |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * |
|
128 | + * Recursively remove directory |
|
129 | + * |
|
130 | + * @todo currently won't remove directories with hidden files, should it? |
|
131 | + * |
|
132 | + * @param string $src directory to remove (delete) |
|
133 | + * |
|
134 | + * @return bool true on success |
|
135 | + */ |
|
136 | + public static function rrmdir($src) |
|
137 | + { |
|
138 | + // Only continue if user is a 'global' Admin |
|
139 | + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
140 | + return false; |
|
141 | + } |
|
142 | + |
|
143 | + // If source is not a directory stop processing |
|
144 | + if (!is_dir($src)) { |
|
145 | + return false; |
|
146 | + } |
|
147 | + |
|
148 | + $success = true; |
|
149 | + |
|
150 | + // Open the source directory to read in files |
|
151 | + $iterator = new \DirectoryIterator($src); |
|
152 | + foreach ($iterator as $fObj) { |
|
153 | + if ($fObj->isFile()) { |
|
154 | + $filename = $fObj->getPathname(); |
|
155 | + $fObj = null; // clear this iterator object to close the file |
|
156 | + if (!unlink($filename)) { |
|
157 | + return false; // couldn't delete the file |
|
158 | + } |
|
159 | + } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
160 | + // Try recursively on directory |
|
161 | + self::rrmdir($fObj->getPathname()); |
|
162 | + } |
|
163 | + } |
|
164 | + $iterator = null; // clear iterator Obj to close file/directory |
|
165 | + return rmdir($src); // remove the directory & return results |
|
166 | + } |
|
167 | + |
|
168 | + /** |
|
169 | + * Recursively move files from one directory to another |
|
170 | + * |
|
171 | + * @param string $src - Source of files being moved |
|
172 | + * @param string $dest - Destination of files being moved |
|
173 | + * |
|
174 | + * @return bool true on success |
|
175 | + */ |
|
176 | + public static function rmove($src, $dest) |
|
177 | + { |
|
178 | + // Only continue if user is a 'global' Admin |
|
179 | + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
180 | + return false; |
|
181 | + } |
|
182 | + |
|
183 | + // If source is not a directory stop processing |
|
184 | + if (!is_dir($src)) { |
|
185 | + return false; |
|
186 | + } |
|
187 | + |
|
188 | + // If the destination directory does not exist and could not be created stop processing |
|
189 | + if (!is_dir($dest) && !mkdir($dest, 0755)) { |
|
190 | + return false; |
|
191 | + } |
|
192 | + |
|
193 | + // Open the source directory to read in files |
|
194 | + $iterator = new \DirectoryIterator($src); |
|
195 | + foreach ($iterator as $fObj) { |
|
196 | + if ($fObj->isFile()) { |
|
197 | + rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
198 | + } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
199 | + // Try recursively on directory |
|
200 | + self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
201 | + // rmdir($fObj->getPath()); // now delete the directory |
|
202 | + } |
|
203 | + } |
|
204 | + $iterator = null; // clear iterator Obj to close file/directory |
|
205 | + return rmdir($src); // remove the directory & return results |
|
206 | + } |
|
207 | + |
|
208 | + /** |
|
209 | + * Recursively copy directories and files from one directory to another |
|
210 | + * |
|
211 | + * @param string $src - Source of files being moved |
|
212 | + * @param string $dest - Destination of files being moved |
|
213 | + * |
|
214 | + * @uses \Xmf\Module\Helper::getHelper() |
|
215 | + * @uses \Xmf\Module\Helper::isUserAdmin() |
|
216 | + * |
|
217 | + * @return bool true on success |
|
218 | + */ |
|
219 | + public static function rcopy($src, $dest) |
|
220 | + { |
|
221 | + // Only continue if user is a 'global' Admin |
|
222 | + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
223 | + return false; |
|
224 | + } |
|
225 | + |
|
226 | + // If source is not a directory stop processing |
|
227 | + if (!is_dir($src)) { |
|
228 | + return false; |
|
229 | + } |
|
230 | + |
|
231 | + // If the destination directory does not exist and could not be created stop processing |
|
232 | + if (!is_dir($dest) && !mkdir($dest, 0755)) { |
|
233 | + return false; |
|
234 | + } |
|
235 | + |
|
236 | + // Open the source directory to read in files |
|
237 | + $iterator = new \DirectoryIterator($src); |
|
238 | + foreach ($iterator as $fObj) { |
|
239 | + if ($fObj->isFile()) { |
|
240 | + copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
241 | + } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
242 | + self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
243 | + } |
|
244 | + } |
|
245 | + return true; |
|
246 | + } |
|
247 | 247 | } |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | public static function createFolder($folder) |
29 | 29 | { |
30 | 30 | try { |
31 | - if (!file_exists($folder)) { |
|
32 | - if (!mkdir($folder) && !is_dir($folder)) { |
|
31 | + if ( ! file_exists($folder)) { |
|
32 | + if ( ! mkdir($folder) && ! is_dir($folder)) { |
|
33 | 33 | throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
34 | 34 | } |
35 | 35 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public static function recurseCopy($src, $dst) |
60 | 60 | { |
61 | 61 | $dir = opendir($src); |
62 | - if (!mkdir($dst) && !is_dir($dst)) { |
|
62 | + if ( ! mkdir($dst) && ! is_dir($dst)) { |
|
63 | 63 | throw new \RuntimeException('The directory ' . $dst . ' could not be created.'); |
64 | 64 | } |
65 | 65 | while (false !== ($file = readdir($dir))) { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | public static function deleteDirectory($src) |
89 | 89 | { |
90 | 90 | // Only continue if user is a 'global' Admin |
91 | - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
91 | + if ( ! ($GLOBALS['xoopsUser'] instanceof \XoopsUser) || ! $GLOBALS['xoopsUser']->isAdmin()) { |
|
92 | 92 | return false; |
93 | 93 | } |
94 | 94 | |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | $fileInfo = new \SplFileInfo("{$src}/{$v}"); |
103 | 103 | if ($fileInfo->isDir()) { |
104 | 104 | // recursively handle subdirectories |
105 | - if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { |
|
105 | + if ( ! $success = self::deleteDirectory($fileInfo->getRealPath())) { |
|
106 | 106 | break; |
107 | 107 | } |
108 | 108 | } else { |
109 | 109 | // delete the file |
110 | - if (!($success = unlink($fileInfo->getRealPath()))) { |
|
110 | + if ( ! ($success = unlink($fileInfo->getRealPath()))) { |
|
111 | 111 | break; |
112 | 112 | } |
113 | 113 | } |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | public static function rrmdir($src) |
137 | 137 | { |
138 | 138 | // Only continue if user is a 'global' Admin |
139 | - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
139 | + if ( ! ($GLOBALS['xoopsUser'] instanceof \XoopsUser) || ! $GLOBALS['xoopsUser']->isAdmin()) { |
|
140 | 140 | return false; |
141 | 141 | } |
142 | 142 | |
143 | 143 | // If source is not a directory stop processing |
144 | - if (!is_dir($src)) { |
|
144 | + if ( ! is_dir($src)) { |
|
145 | 145 | return false; |
146 | 146 | } |
147 | 147 | |
@@ -153,15 +153,15 @@ discard block |
||
153 | 153 | if ($fObj->isFile()) { |
154 | 154 | $filename = $fObj->getPathname(); |
155 | 155 | $fObj = null; // clear this iterator object to close the file |
156 | - if (!unlink($filename)) { |
|
156 | + if ( ! unlink($filename)) { |
|
157 | 157 | return false; // couldn't delete the file |
158 | 158 | } |
159 | - } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
159 | + } elseif ( ! $fObj->isDot() && $fObj->isDir()) { |
|
160 | 160 | // Try recursively on directory |
161 | 161 | self::rrmdir($fObj->getPathname()); |
162 | 162 | } |
163 | 163 | } |
164 | - $iterator = null; // clear iterator Obj to close file/directory |
|
164 | + $iterator = null; // clear iterator Obj to close file/directory |
|
165 | 165 | return rmdir($src); // remove the directory & return results |
166 | 166 | } |
167 | 167 | |
@@ -176,17 +176,17 @@ discard block |
||
176 | 176 | public static function rmove($src, $dest) |
177 | 177 | { |
178 | 178 | // Only continue if user is a 'global' Admin |
179 | - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
179 | + if ( ! ($GLOBALS['xoopsUser'] instanceof \XoopsUser) || ! $GLOBALS['xoopsUser']->isAdmin()) { |
|
180 | 180 | return false; |
181 | 181 | } |
182 | 182 | |
183 | 183 | // If source is not a directory stop processing |
184 | - if (!is_dir($src)) { |
|
184 | + if ( ! is_dir($src)) { |
|
185 | 185 | return false; |
186 | 186 | } |
187 | 187 | |
188 | 188 | // If the destination directory does not exist and could not be created stop processing |
189 | - if (!is_dir($dest) && !mkdir($dest, 0755)) { |
|
189 | + if ( ! is_dir($dest) && ! mkdir($dest, 0755)) { |
|
190 | 190 | return false; |
191 | 191 | } |
192 | 192 | |
@@ -195,13 +195,13 @@ discard block |
||
195 | 195 | foreach ($iterator as $fObj) { |
196 | 196 | if ($fObj->isFile()) { |
197 | 197 | rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
198 | - } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
198 | + } elseif ( ! $fObj->isDot() && $fObj->isDir()) { |
|
199 | 199 | // Try recursively on directory |
200 | 200 | self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
201 | 201 | // rmdir($fObj->getPath()); // now delete the directory |
202 | 202 | } |
203 | 203 | } |
204 | - $iterator = null; // clear iterator Obj to close file/directory |
|
204 | + $iterator = null; // clear iterator Obj to close file/directory |
|
205 | 205 | return rmdir($src); // remove the directory & return results |
206 | 206 | } |
207 | 207 | |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | public static function rcopy($src, $dest) |
220 | 220 | { |
221 | 221 | // Only continue if user is a 'global' Admin |
222 | - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
222 | + if ( ! ($GLOBALS['xoopsUser'] instanceof \XoopsUser) || ! $GLOBALS['xoopsUser']->isAdmin()) { |
|
223 | 223 | return false; |
224 | 224 | } |
225 | 225 | |
226 | 226 | // If source is not a directory stop processing |
227 | - if (!is_dir($src)) { |
|
227 | + if ( ! is_dir($src)) { |
|
228 | 228 | return false; |
229 | 229 | } |
230 | 230 | |
231 | 231 | // If the destination directory does not exist and could not be created stop processing |
232 | - if (!is_dir($dest) && !mkdir($dest, 0755)) { |
|
232 | + if ( ! is_dir($dest) && ! mkdir($dest, 0755)) { |
|
233 | 233 | return false; |
234 | 234 | } |
235 | 235 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | foreach ($iterator as $fObj) { |
239 | 239 | if ($fObj->isFile()) { |
240 | 240 | copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
241 | - } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
241 | + } elseif ( ! $fObj->isDot() && $fObj->isDir()) { |
|
242 | 242 | self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
243 | 243 | } |
244 | 244 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | */ |
64 | 64 | public function render() |
65 | 65 | { |
66 | - if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { |
|
66 | + if ( ! isset($GLOBALS['xoTheme']) || ! is_object($GLOBALS['xoTheme'])) { |
|
67 | 67 | require_once $GLOBALS['xoops']->path('class/theme.php'); |
68 | 68 | $GLOBALS['xoTheme'] = new xos_opal_Theme(); |
69 | 69 | } |
@@ -33,48 +33,48 @@ |
||
33 | 33 | */ |
34 | 34 | class Breadcrumb |
35 | 35 | { |
36 | - public $dirname; |
|
37 | - private $bread = []; |
|
36 | + public $dirname; |
|
37 | + private $bread = []; |
|
38 | 38 | |
39 | - /** |
|
40 | - * |
|
41 | - */ |
|
42 | - public function __construct() |
|
43 | - { |
|
44 | - $this->dirname = basename(dirname(dirname(__DIR__))); |
|
45 | - } |
|
39 | + /** |
|
40 | + * |
|
41 | + */ |
|
42 | + public function __construct() |
|
43 | + { |
|
44 | + $this->dirname = basename(dirname(dirname(__DIR__))); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Add link to breadcrumb |
|
49 | - * |
|
50 | - * @param string $title |
|
51 | - * @param string $link |
|
52 | - */ |
|
53 | - public function addLink($title = '', $link = '') |
|
54 | - { |
|
55 | - $this->bread[] = [ |
|
56 | - 'link' => $link, |
|
57 | - 'title' => $title |
|
58 | - ]; |
|
59 | - } |
|
47 | + /** |
|
48 | + * Add link to breadcrumb |
|
49 | + * |
|
50 | + * @param string $title |
|
51 | + * @param string $link |
|
52 | + */ |
|
53 | + public function addLink($title = '', $link = '') |
|
54 | + { |
|
55 | + $this->bread[] = [ |
|
56 | + 'link' => $link, |
|
57 | + 'title' => $title |
|
58 | + ]; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Render BreadCrumb |
|
63 | - * |
|
64 | - */ |
|
65 | - public function render() |
|
66 | - { |
|
67 | - if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { |
|
68 | - require_once $GLOBALS['xoops']->path('class/theme.php'); |
|
69 | - $GLOBALS['xoTheme'] = new xos_opal_Theme(); |
|
70 | - } |
|
61 | + /** |
|
62 | + * Render BreadCrumb |
|
63 | + * |
|
64 | + */ |
|
65 | + public function render() |
|
66 | + { |
|
67 | + if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { |
|
68 | + require_once $GLOBALS['xoops']->path('class/theme.php'); |
|
69 | + $GLOBALS['xoTheme'] = new xos_opal_Theme(); |
|
70 | + } |
|
71 | 71 | |
72 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
73 | - $breadcrumbTpl = new \XoopsTpl(); |
|
74 | - $breadcrumbTpl->assign('breadcrumb', $this->bread); |
|
75 | - $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); |
|
76 | - unset($breadcrumbTpl); |
|
72 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
73 | + $breadcrumbTpl = new \XoopsTpl(); |
|
74 | + $breadcrumbTpl->assign('breadcrumb', $this->bread); |
|
75 | + $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); |
|
76 | + unset($breadcrumbTpl); |
|
77 | 77 | |
78 | - return $html; |
|
79 | - } |
|
78 | + return $html; |
|
79 | + } |
|
80 | 80 | } |