Total Complexity | 80 |
Total Lines | 748 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
Complex classes like MimetypesUtility often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use MimetypesUtility, and based on these observations, apply Extract Interface, too.
1 | <?php declare(strict_types=1); |
||
32 | class MimetypesUtility |
||
33 | { |
||
34 | public static function add(): void |
||
35 | { |
||
36 | $helper = Helper::getInstance(); |
||
37 | /** @var MimetypeHandler $mimetypeHandler */ |
||
38 | $mimetypeHandler = $helper->getHandler('Mimetype'); |
||
39 | global $limit, $start; |
||
40 | $error = []; |
||
41 | if (Request::getString('add_mime', '', 'POST')) { |
||
42 | $hasErrors = false; |
||
43 | $mimeExt = Request::getString('mime_ext', '', 'POST'); |
||
44 | $mimeName = Request::getString('mime_name', '', 'POST'); |
||
45 | $mimeTypes = Request::getText('mime_types', '', 'POST'); |
||
46 | $mimeAdmin = Request::getInt('mime_admin', 0, 'POST'); |
||
47 | $mimeUser = Request::getInt('mime_user', 0, 'POST'); |
||
48 | |||
49 | //Validate Mimetype entry |
||
50 | if ('' === \trim($mimeExt)) { |
||
51 | $hasErrors = true; |
||
52 | $error['mime_ext'][] = \_AM_PUBLISHER_VALID_ERR_MIME_EXT; |
||
53 | } |
||
54 | |||
55 | if ('' === \trim($mimeName)) { |
||
56 | $hasErrors = true; |
||
57 | $error['mime_name'][] = \_AM_PUBLISHER_VALID_ERR_MIME_NAME; |
||
58 | } |
||
59 | |||
60 | if ('' === \trim($mimeTypes)) { |
||
61 | $hasErrors = true; |
||
62 | $error['mime_types'][] = \_AM_PUBLISHER_VALID_ERR_MIME_TYPES; |
||
63 | } |
||
64 | |||
65 | if ($hasErrors) { |
||
66 | $session = Session::getInstance(); |
||
67 | $mime = []; |
||
68 | $mime['mime_ext'] = $mimeExt; |
||
69 | $mime['mime_name'] = $mimeName; |
||
70 | $mime['mime_types'] = $mimeTypes; |
||
71 | $mime['mime_admin'] = $mimeAdmin; |
||
72 | $mime['mime_user'] = $mimeUser; |
||
73 | $session->set('publisher_addMime', $mime); |
||
74 | $session->set('publisher_addMimeErr', $error); |
||
75 | \header('Location: ' . Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'add'], false)); |
||
|
|||
76 | } |
||
77 | |||
78 | $mimeType = $mimetypeHandler->create(); |
||
79 | $mimeType->setVar('mime_ext', $mimeExt); |
||
80 | $mimeType->setVar('mime_name', $mimeName); |
||
81 | $mimeType->setVar('mime_types', $mimeTypes); |
||
82 | $mimeType->setVar('mime_admin', $mimeAdmin); |
||
83 | $mimeType->setVar('mime_user', $mimeUser); |
||
84 | |||
85 | if ($mimetypeHandler->insert($mimeType)) { |
||
86 | self::clearAddSessionVars(); |
||
87 | \header('Location: ' . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&limit=$limit&start=$start"); |
||
88 | } else { |
||
89 | \redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&limit=$limit&start=$start", 3, \_AM_PUBLISHER_MESSAGE_ADD_MIME_ERROR); |
||
90 | } |
||
91 | } else { |
||
92 | Utility::cpHeader(); |
||
93 | //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES); |
||
94 | |||
95 | Utility::openCollapsableBar('mimemaddtable', 'mimeaddicon', \_AM_PUBLISHER_MIME_ADD_TITLE); |
||
96 | |||
97 | $session = Session::getInstance(); |
||
98 | $mimeType = $session->get('publisher_addMime'); |
||
99 | $mimeErrors = $session->get('publisher_addMimeErr'); |
||
100 | |||
101 | //Display any form errors |
||
102 | if (false === !$mimeErrors) { |
||
103 | Utility::renderErrors($mimeErrors, Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'clearAddSession'])); |
||
104 | } |
||
105 | |||
106 | if (false === $mimeType) { |
||
107 | $mimeExt = ''; |
||
108 | $mimeName = ''; |
||
109 | $mimeTypes = ''; |
||
110 | $mimeAdmin = 1; |
||
111 | $mimeUser = 1; |
||
112 | } else { |
||
113 | $mimeExt = $mimeType['mime_ext']; |
||
114 | $mimeName = $mimeType['mime_name']; |
||
115 | $mimeTypes = $mimeType['mime_types']; |
||
116 | $mimeAdmin = $mimeType['mime_admin']; |
||
117 | $mimeUser = $mimeType['mime_user']; |
||
118 | } |
||
119 | |||
120 | // Display add form |
||
121 | echo "<form action='mimetypes.php?op=add' method='post'>"; |
||
122 | echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
||
123 | echo "<table width='100%' cellspacing='1' class='outer'>"; |
||
124 | echo "<tr><th colspan='2'>" . \_AM_PUBLISHER_MIME_CREATEF . '</th></tr>'; |
||
125 | echo "<tr valign='top'> |
||
126 | <td class='head'>" . \_AM_PUBLISHER_MIME_EXTF . "</td> |
||
127 | <td class='even'><input type='text' name='mime_ext' id='mime_ext' value='$mimeExt' size='5'></td> |
||
128 | </tr>"; |
||
129 | echo "<tr valign='top'> |
||
130 | <td class='head'>" . \_AM_PUBLISHER_MIME_NAMEF . "</td> |
||
131 | <td class='even'><input type='text' name='mime_name' id='mime_name' value='$mimeName'></td> |
||
132 | </tr>"; |
||
133 | echo "<tr valign='top'> |
||
134 | <td class='head'>" . \_AM_PUBLISHER_MIME_TYPEF . "</td> |
||
135 | <td class='even'><textarea name='mime_types' id='mime_types' cols='60' rows='5'>$mimeTypes</textarea></td> |
||
136 | </tr>"; |
||
137 | echo "<tr valign='top'> |
||
138 | <td class='head'>" . \_AM_PUBLISHER_MIME_ADMINF . "</td> |
||
139 | <td class='even'>"; |
||
140 | echo "<input type='radio' name='mime_admin' value='1' " . (1 == $mimeAdmin ? 'checked' : '') . '>' . \_YES; |
||
141 | echo "<input type='radio' name='mime_admin' value='0' " . (0 == $mimeAdmin ? 'checked' : '') . '>' . \_NO . ' |
||
142 | </td> |
||
143 | </tr>'; |
||
144 | echo "<tr valign='top'> |
||
145 | <td class='head'>" . \_AM_PUBLISHER_MIME_USERF . "</td> |
||
146 | <td class='even'>"; |
||
147 | echo "<input type='radio' name='mime_user' value='1'" . (1 == $mimeUser ? 'checked' : '') . '>' . \_YES; |
||
148 | echo "<input type='radio' name='mime_user' value='0'" . (0 == $mimeUser ? 'checked' : '') . '>' . \_NO . ' |
||
149 | </td> |
||
150 | </tr>'; |
||
151 | echo "<tr valign='top'> |
||
152 | <td class='head'>" . \_AM_PUBLISHER_MIME_MANDATORY_FIELD . "</td> |
||
153 | <td class='even'> |
||
154 | <input type='submit' name='add_mime' id='add_mime' value='" . \_AM_PUBLISHER_BUTTON_SUBMIT . "' class='formButton'> |
||
155 | <input type='button' name='cancel' value='" . \_AM_PUBLISHER_BUTTON_CANCEL . "' onclick='history.go(-1)' class='formButton'> |
||
156 | </td> |
||
157 | </tr>"; |
||
158 | echo '</table></form>'; |
||
159 | // end of add form |
||
160 | |||
161 | // Find new mimetypes table |
||
162 | echo "<form action='https://www.filext.com' method='post'>"; |
||
163 | echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
||
164 | echo "<table width='100%' cellspacing='1' class='outer'>"; |
||
165 | echo "<tr><th colspan='2'>" . \_AM_PUBLISHER_MIME_FINDMIMETYPE . '</th></tr>'; |
||
166 | |||
167 | echo "<tr class='foot'> |
||
168 | <td colspan='2'><input type='submit' name='find_mime' id='find_mime' value='" . \_AM_PUBLISHER_MIME_FINDIT . "' class='formButton'></td> |
||
169 | </tr>"; |
||
170 | |||
171 | echo '</table></form>'; |
||
172 | |||
173 | Utility::closeCollapsableBar('mimeaddtable', 'mimeaddicon'); |
||
174 | |||
175 | \xoops_cp_footer(); |
||
176 | } |
||
177 | } |
||
178 | |||
179 | public static function delete(): void |
||
180 | { |
||
181 | $helper = Helper::getInstance(); |
||
182 | /** @var MimetypeHandler $mimetypeHandler */ |
||
183 | $mimetypeHandler = $helper->getHandler('Mimetype'); |
||
184 | global $start, $limit; |
||
185 | $mimeId = 0; |
||
186 | if (0 == Request::getInt('id', 0, 'GET')) { |
||
187 | \redirect_header(PUBLISHER_ADMIN_URL . '/mimetypes.php', 3, \_AM_PUBLISHER_MESSAGE_NO_ID); |
||
188 | } else { |
||
189 | $mimeId = Request::getInt('id', 0, 'GET'); |
||
190 | } |
||
191 | $mimeType = $mimetypeHandler->get($mimeId); // Retrieve mimetype object |
||
192 | if ($mimetypeHandler->delete($mimeType, true)) { |
||
193 | \header('Location: ' . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&limit=$limit&start=$start"); |
||
194 | } else { |
||
195 | \redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&id=$mimeId&limit=$limit&start=$start", 3, \_AM_PUBLISHER_MESSAGE_DELETE_MIME_ERROR); |
||
196 | } |
||
197 | } |
||
198 | |||
199 | public static function edit(): void |
||
200 | { |
||
201 | $helper = Helper::getInstance(); |
||
202 | /** @var MimetypeHandler $mimetypeHandler */ |
||
203 | $mimetypeHandler = $helper->getHandler('Mimetype'); |
||
204 | global $start, $limit; |
||
205 | $mimeId = 0; |
||
206 | $error = []; |
||
207 | $hasErrors = false; |
||
208 | if (0 == Request::getInt('id', 0, 'GET')) { |
||
209 | \redirect_header(PUBLISHER_ADMIN_URL . '/mimetypes.php', 3, \_AM_PUBLISHER_MESSAGE_NO_ID); |
||
210 | } else { |
||
211 | $mimeId = Request::getInt('id', 0, 'GET'); |
||
212 | } |
||
213 | $mimeTypeObj = $mimetypeHandler->get($mimeId); // Retrieve mimetype object |
||
214 | |||
215 | if (Request::getString('edit_mime', '', 'POST')) { |
||
216 | $mimeAdmin = 0; |
||
217 | $mimeUser = 0; |
||
218 | if (1 == Request::getInt('mime_admin', 0, 'POST')) { |
||
219 | $mimeAdmin = 1; |
||
220 | } |
||
221 | if (1 == Request::getInt('mime_user', 0, 'POST')) { |
||
222 | $mimeUser = 1; |
||
223 | } |
||
224 | |||
225 | //Validate Mimetype entry |
||
226 | if ('' === Request::getString('mime_ext', '', 'POST')) { |
||
227 | $hasErrors = true; |
||
228 | $error['mime_ext'][] = \_AM_PUBLISHER_VALID_ERR_MIME_EXT; |
||
229 | } |
||
230 | |||
231 | if ('' === Request::getString('mime_name', '', 'POST')) { |
||
232 | $hasErrors = true; |
||
233 | $error['mime_name'][] = \_AM_PUBLISHER_VALID_ERR_MIME_NAME; |
||
234 | } |
||
235 | |||
236 | if ('' === Request::getString('mime_types', '', 'POST')) { |
||
237 | $hasErrors = true; |
||
238 | $error['mime_types'][] = \_AM_PUBLISHER_VALID_ERR_MIME_TYPES; |
||
239 | } |
||
240 | |||
241 | if ($hasErrors) { |
||
242 | $session = Session::getInstance(); |
||
243 | $mime = []; |
||
244 | $mime['mime_ext'] = Request::getString('mime_ext', '', 'POST'); |
||
245 | $mime['mime_name'] = Request::getString('mime_name', '', 'POST'); |
||
246 | $mime['mime_types'] = Request::getText('mime_types', '', 'POST'); |
||
247 | $mime['mime_admin'] = $mimeAdmin; |
||
248 | $mime['mime_user'] = $mimeUser; |
||
249 | $session->set('publisher_editMime_' . $mimeId, $mime); |
||
250 | $session->set('publisher_editMimeErr_' . $mimeId, $error); |
||
251 | \header('Location: ' . Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'edit', 'id' => $mimeId], false)); |
||
252 | } |
||
253 | |||
254 | $mimeTypeObj->setVar('mime_ext', Request::getString('mime_ext', '', 'POST')); |
||
255 | $mimeTypeObj->setVar('mime_name', Request::getString('mime_name', '', 'POST')); |
||
256 | $mimeTypeObj->setVar('mime_types', Request::getText('mime_types', '', 'POST')); |
||
257 | $mimeTypeObj->setVar('mime_admin', $mimeAdmin); |
||
258 | $mimeTypeObj->setVar('mime_user', $mimeUser); |
||
259 | |||
260 | if ($mimetypeHandler->insert($mimeTypeObj, true)) { |
||
261 | self::clearEditSessionVars($mimeId); |
||
262 | \header('Location: ' . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=manage&limit=$limit&start=$start"); |
||
263 | } else { |
||
264 | \redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?op=edit&id=$mimeId", 3, \_AM_PUBLISHER_MESSAGE_EDIT_MIME_ERROR); |
||
265 | } |
||
266 | } else { |
||
267 | $session = Session::getInstance(); |
||
268 | $mimeType = $session->get('publisher_editMime_' . $mimeId); |
||
269 | $mimeErrors = $session->get('publisher_editMimeErr_' . $mimeId); |
||
270 | |||
271 | // Display header |
||
272 | Utility::cpHeader(); |
||
273 | //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES . " > " . _AM_PUBLISHER_BUTTON_EDIT); |
||
274 | |||
275 | Utility::openCollapsableBar('mimemedittable', 'mimeediticon', \_AM_PUBLISHER_MIME_EDIT_TITLE); |
||
276 | |||
277 | //Display any form errors |
||
278 | if (false === !$mimeErrors) { |
||
279 | Utility::renderErrors($mimeErrors, Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'clearEditSession', 'id' => $mimeId])); |
||
280 | } |
||
281 | |||
282 | if (false === $mimeType) { |
||
283 | $mimeExt = $mimeTypeObj->getVar('mime_ext'); |
||
284 | $mimeName = $mimeTypeObj->getVar('mime_name', 'e'); |
||
285 | $mimeTypes = $mimeTypeObj->getVar('mime_types', 'e'); |
||
286 | $mimeAdmin = $mimeTypeObj->getVar('mime_admin'); |
||
287 | $mimeUser = $mimeTypeObj->getVar('mime_user'); |
||
288 | } else { |
||
289 | $mimeExt = $mimeType['mime_ext']; |
||
290 | $mimeName = $mimeType['mime_name']; |
||
291 | $mimeTypes = $mimeType['mime_types']; |
||
292 | $mimeAdmin = $mimeType['mime_admin']; |
||
293 | $mimeUser = $mimeType['mime_user']; |
||
294 | } |
||
295 | |||
296 | // Display edit form |
||
297 | echo "<form action='mimetypes.php?op=edit&id=" . $mimeId . "' method='post'>"; |
||
298 | echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
||
299 | echo "<input type='hidden' name='limit' value='" . $limit . "'>"; |
||
300 | echo "<input type='hidden' name='start' value='" . $start . "'>"; |
||
301 | echo "<table width='100%' cellspacing='1' class='outer'>"; |
||
302 | echo "<tr><th colspan='2'>" . \_AM_PUBLISHER_MIME_MODIFYF . '</th></tr>'; |
||
303 | echo "<tr valign='top'> |
||
304 | <td class='head'>" . \_AM_PUBLISHER_MIME_EXTF . "</td> |
||
305 | <td class='even'><input type='text' name='mime_ext' id='mime_ext' value='$mimeExt' size='5'></td> |
||
306 | </tr>"; |
||
307 | echo "<tr valign='top'> |
||
308 | <td class='head'>" . \_AM_PUBLISHER_MIME_NAMEF . "</td> |
||
309 | <td class='even'><input type='text' name='mime_name' id='mime_name' value='$mimeName'></td> |
||
310 | </tr>"; |
||
311 | echo "<tr valign='top'> |
||
312 | <td class='head'>" . \_AM_PUBLISHER_MIME_TYPEF . "</td> |
||
313 | <td class='even'><textarea name='mime_types' id='mime_types' cols='60' rows='5'>$mimeTypes</textarea></td> |
||
314 | </tr>"; |
||
315 | echo "<tr valign='top'> |
||
316 | <td class='head'>" . \_AM_PUBLISHER_MIME_ADMINF . "</td> |
||
317 | <td class='even'> |
||
318 | <input type='radio' name='mime_admin' value='1' " . (1 == $mimeAdmin ? 'checked' : '') . '>' . \_YES . " |
||
319 | <input type='radio' name='mime_admin' value='0' " . (0 == $mimeAdmin ? 'checked' : '') . '>' . \_NO . ' |
||
320 | </td> |
||
321 | </tr>'; |
||
322 | echo "<tr valign='top'> |
||
323 | <td class='head'>" . \_AM_PUBLISHER_MIME_USERF . "</td> |
||
324 | <td class='even'> |
||
325 | <input type='radio' name='mime_user' value='1' " . (1 == $mimeUser ? 'checked' : '') . '>' . \_YES . " |
||
326 | <input type='radio' name='mime_user' value='0' " . (0 == $mimeUser ? 'checked' : '') . '>' . \_NO . ' |
||
327 | </td> |
||
328 | </tr>'; |
||
329 | echo "<tr valign='top'> |
||
330 | <td class='head'></td> |
||
331 | <td class='even'> |
||
332 | <input type='submit' name='edit_mime' id='edit_mime' value='" . \_AM_PUBLISHER_BUTTON_UPDATE . "' class='formButton'> |
||
333 | <input type='button' name='cancel' value='" . \_AM_PUBLISHER_BUTTON_CANCEL . "' onclick='history.go(-1)' class='formButton'> |
||
334 | </td> |
||
335 | </tr>"; |
||
336 | echo '</table></form>'; |
||
337 | // end of edit form |
||
338 | Utility::closeCollapsableBar('mimeedittable', 'mimeediticon'); |
||
339 | // xoops_cp_footer(); |
||
340 | require_once \dirname(__DIR__) . '/admin/admin_footer.php'; |
||
341 | } |
||
342 | } |
||
343 | |||
344 | /** |
||
345 | * @param $icons |
||
346 | */ |
||
347 | public static function manage($icons): void |
||
488 | } |
||
489 | |||
490 | /** |
||
491 | * @param array $icons |
||
492 | */ |
||
493 | public static function search($icons): void |
||
673 | } |
||
674 | |||
675 | /** |
||
676 | * confirm update to mime access, resubmit as POST, including TOKEN |
||
677 | */ |
||
678 | public static function updateMimeValue(): void |
||
679 | { |
||
680 | // op=updateMimeValue&id=65&mime_admin=0&limit=15&start=0 |
||
681 | Utility::cpHeader(); |
||
682 | $hiddens = [ |
||
683 | 'id' => Request::getInt('id', 0, 'GET'), |
||
684 | 'start' => Request::getInt('start', 0, 'GET'), |
||
685 | 'limit' => Request::getInt('limit', 15, 'GET'), |
||
686 | ]; |
||
687 | |||
688 | $helper = Helper::getInstance(); |
||
689 | /** @var MimetypeHandler $mimetypeHandler */ |
||
690 | $mimeTypeObj = $helper->getHandler('Mimetype') |
||
691 | ->get($hiddens['id']); |
||
692 | if (Request::hasVar('mime_admin')) { |
||
693 | $hiddens['mime_admin'] = Request::getInt('mime_admin', 0, 'GET'); |
||
694 | $msg = \sprintf(\_AM_PUBLISHER_MIME_ACCESS_CONFIRM_ADMIN, $mimeTypeObj->getVar('mime_name')); |
||
695 | } else { |
||
696 | $hiddens['mime_user'] = Request::getInt('mime_user', 0, 'GET'); |
||
697 | $msg = \sprintf(\_AM_PUBLISHER_MIME_ACCESS_CONFIRM_USER, $mimeTypeObj->getVar('mime_name')); |
||
698 | } |
||
699 | |||
700 | $action = PUBLISHER_ADMIN_URL . '/mimetypes.php?op=confirmUpdateMimeValue'; |
||
701 | $submit = \_AM_PUBLISHER_MIME_ACCESS_CONFIRM; |
||
702 | |||
703 | \xoops_confirm($hiddens, $action, $msg, $submit, true); |
||
704 | \xoops_cp_footer(); |
||
705 | } |
||
706 | |||
707 | public static function confirmUpdateMimeValue(): void |
||
708 | { |
||
709 | $helper = Helper::getInstance(); |
||
710 | /** @var MimetypeHandler $mimetypeHandler */ |
||
711 | $mimetypeHandler = $helper->getHandler('Mimetype'); |
||
712 | $limit = Request::getInt('limit', 0, 'POST'); |
||
713 | $start = Request::getInt('start', 0, 'POST'); |
||
714 | $mimeId = Request::getInt('id', 0, 'POST'); |
||
715 | if (0 === $mimeId) { |
||
716 | \redirect_header(PUBLISHER_ADMIN_URL . '/mimetypes.php', 3, \_AM_PUBLISHER_MESSAGE_NO_ID); |
||
717 | } |
||
718 | |||
719 | $mimeTypeObj = $mimetypeHandler->get($mimeId); |
||
720 | |||
721 | if (-1 !== ($mimeAdmin = Request::getInt('mime_admin', -1, 'POST'))) { |
||
722 | $mimeAdmin = self::changeMimeValue($mimeAdmin); |
||
723 | $mimeTypeObj->setVar('mime_admin', $mimeAdmin); |
||
724 | } elseif (-1 !== ($mimeUser = Request::getInt('mime_user', -1, 'POST'))) { |
||
725 | $mimeUser = self::changeMimeValue($mimeUser); |
||
726 | $mimeTypeObj->setVar('mime_user', $mimeUser); |
||
727 | } |
||
728 | if ($mimetypeHandler->insert($mimeTypeObj, true)) { |
||
729 | \header('Location: ' . PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start"); |
||
730 | } else { |
||
731 | \redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?limit=$limit&start=$start", 3); |
||
732 | } |
||
733 | } |
||
734 | |||
735 | /** |
||
736 | * @param $mimeValue |
||
737 | * |
||
738 | * @return int |
||
739 | */ |
||
740 | protected static function changeMimeValue($mimeValue) |
||
741 | { |
||
742 | if (1 === (int)$mimeValue) { |
||
743 | $mimeValue = 0; |
||
744 | } else { |
||
745 | $mimeValue = 1; |
||
746 | } |
||
747 | |||
748 | return $mimeValue; |
||
749 | } |
||
750 | |||
751 | protected static function clearAddSessionVars(): void |
||
756 | } |
||
757 | |||
758 | public static function clearAddSession(): void |
||
759 | { |
||
760 | self::clearAddSessionVars(); |
||
761 | \header('Location: ' . Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'add'], false)); |
||
762 | } |
||
763 | |||
764 | /** |
||
765 | * @param int $id |
||
766 | */ |
||
767 | public static function clearEditSessionVars($id): void |
||
773 | } |
||
774 | |||
775 | public static function clearEditSession(): void |
||
782 |