PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 2.0.4
Adminify – White Label, Admin Menu Editor, Login Customizer v2.0.4
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
← All changes | Inc/Classes/Helper.php +78 -555 4.2.82.0.4 View file →
@@ -1,575 +1,98 @@
1 1 <?php
2 2
3 -namespace PXLBSAdminify\Inc\Classes;
3 +namespace WPAdminify\Inc\Classes;
4 4
5 5 // no direct access allowed
6 -if (!defined('ABSPATH')) {
7 - exit;
8 -}
6 +if (!defined('ABSPATH')) exit;
9 7
10 8 class Helper
11 9 {
12 10
13 - // Admin Path
14 - public static function pxlbsadminify_admin_path($path)
15 - {
16 - // Get custom filter path
17 - if (has_filter('pxlbsadminify_admin_path')) {
18 - return apply_filters('pxlbsadminify_admin_path', $path);
19 - }
11 + // Admin Path
12 + public static function jltwp_adminify_admin_path($path)
13 + {
14 + // Get custom filter path
15 + if (has_filter('jltwp_adminify_admin_path')) {
16 + return apply_filters('jltwp_adminify_admin_path', $path);
17 + }
20 18
21 - // Get plugin path
22 - return plugins_url($path, __DIR__);
23 - }
19 + // Get plugin path
20 + return plugins_url($path, __DIR__);
21 + }
24 22
25 - /**
26 - * Get the editor/ builder of the given post.
27 - *
28 - * @param int $post_id ID of the post being checked.
29 - * @return string The content editor name.
30 - */
31 - public static function get_content_editor($post_id)
32 - {
33 - $content_editor = 'default';
34 - $content_editor = apply_filters('udb_content_editor', $content_editor, $post_id);
23 + /**
24 + * Get the editor/ builder of the given post.
25 + *
26 + * @param int $post_id ID of the post being checked.
27 + * @return string The content editor name.
28 + */
29 + public static function get_content_editor($post_id)
30 + {
31 + $content_editor = 'default';
32 + $content_editor = apply_filters('udb_content_editor', $content_editor, $post_id);
35 33
36 - return $content_editor;
37 - }
34 + return $content_editor;
35 + }
38 36
39 - /**
40 - * Sanitize Checkbox.
41 - *
42 - * @param string|bool $checked Customizer option.
43 - */
44 - public function sanitize_checkbox($checked)
45 - {
46 - return ((isset($checked) && true === $checked) ? true : false);
47 - }
37 + /**
38 + * Sanitize Checkbox.
39 + *
40 + * @param string|bool $checked Customizer option.
41 + */
42 + public function sanitize_checkbox($checked)
43 + {
44 + return ((isset($checked) && true === $checked) ? true : false);
45 + }
48 46
49 47
48 + /**
49 + * Image sanitization callback.
50 + *
51 + * Checks the image's file extension and mime type against a whitelist. If they're allowed,
52 + * send back the filename, otherwise, return the setting default.
53 + *
54 + * - Sanitization: image file extension
55 + * - Control: text, WP_Customize_Image_Control
56 + *
57 + * @see wp_check_filetype() https://developer.wordpress.org/reference/functions/wp_check_filetype/
58 + *
59 + * @version 1.2.2
60 + *
61 + * @param string $image Image filename.
62 + * @param WP_Customize_Setting $setting Setting instance.
63 + *
64 + * @return string The image filename if the extension is allowed; otherwise, the setting default.
65 + */
66 + public static function sanitize_image($image, $setting)
67 + {
50 68
51 - /**
52 - * Check if Gutenberg Block Editor Page
53 - *
54 - * WordPress v5+
55 - *
56 - * @return boolean
57 - */
58 - public static function is_block_editor_page()
59 - {
60 - if (function_exists('is_gutenberg_page') && is_gutenberg_page()) {
61 - // The Gutenberg plugin is on.
62 - return true;
63 - }
69 + /**
70 + * Array of valid image file types.
71 + *
72 + * The array includes image mime types that are included in wp_get_mime_types()
73 + */
74 + $mimes = array(
75 + 'jpg|jpeg|jpe' => 'image/jpeg',
76 + 'gif' => 'image/gif',
77 + 'png' => 'image/png',
78 + 'bmp' => 'image/bmp',
79 + 'tif|tiff' => 'image/tiff',
80 + 'ico' => 'image/x-icon',
81 + );
64 82
65 - if (!function_exists('get_current_screen')) {
66 - require_once ABSPATH . '/wp-admin/includes/screen.php';
67 - $current_screen = get_current_screen();
68 - if (function_exists('get_current_screen')) {
69 - if (!is_null($current_screen) && $current_screen->is_block_editor) {
70 - // Gutenberg page on 5+.
71 - return true;
72 - }
73 - }
74 - }
75 - return false;
76 - }
83 + // Allowed svg mime type in version 1.2.2.
84 + $allowed_mime = get_allowed_mime_types();
85 + $svg_mime_check = isset($allowed_mime['svg']) ? true : false;
77 86
87 + if ($svg_mime_check) {
88 + $allow_mime = array('svg' => 'image/svg+xml');
89 + $mimes = array_merge($mimes, $allow_mime);
90 + }
78 91
79 - /**
80 - * Classic Editor Page
81 - *
82 - * @return boolean
83 - */
84 - public static function is_classic_editor_page()
85 - {
86 - if (function_exists('get_current_screen')) {
87 - $current_screen = get_current_screen();
88 - if ($current_screen->base == 'post' && empty($current_screen->is_block_editor)) {
89 - return true;
90 - }
91 - }
92 - return false;
93 - }
92 + // Return an array with file extension and mime_type.
93 + $file = wp_check_filetype($image, $mimes);
94 94
95 - /**
96 - * Check if Elementor Page
97 - *
98 - * @return boolean
99 - */
100 - public static function is_elementor_editor_page()
101 - {
102 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only check, no state change.
103 - return !empty($_GET['elementor-preview']);
104 - }
105 -
106 - /**
107 - * Image sanitization callback.
108 - *
109 - * Checks the image's file extension and mime type against a whitelist. If they're allowed,
110 - * send back the filename, otherwise, return the setting default.
111 - *
112 - * - Sanitization: image file extension
113 - * - Control: text, WP_Customize_Image_Control
114 - *
115 - * @see wp_check_filetype() https://developer.wordpress.org/reference/functions/wp_check_filetype/
116 - *
117 - * @version 1.2.2
118 - *
119 - * @param string $image Image filename.
120 - * @param WP_Customize_Setting $setting Setting instance.
121 - *
122 - * @return string The image filename if the extension is allowed; otherwise, the setting default.
123 - */
124 - public static function sanitize_image($image, $setting)
125 - {
126 -
127 - /**
128 - * Array of valid image file types.
129 - *
130 - * The array includes image mime types that are included in wp_get_mime_types()
131 - */
132 - $mimes = array(
133 - 'jpg|jpeg|jpe' => 'image/jpeg',
134 - 'gif' => 'image/gif',
135 - 'png' => 'image/png',
136 - 'bmp' => 'image/bmp',
137 - 'tif|tiff' => 'image/tiff',
138 - 'ico' => 'image/x-icon',
139 - );
140 -
141 - // Allowed svg mime type in version 1.2.2.
142 - $allowed_mime = get_allowed_mime_types();
143 - $svg_mime_check = isset($allowed_mime['svg']);
144 -
145 - if ($svg_mime_check) {
146 - $allow_mime = array('svg' => 'image/svg+xml');
147 - $mimes = array_merge($mimes, $allow_mime);
148 - }
149 -
150 - // Return an array with file extension and mime_type.
151 - $file = wp_check_filetype($image, $mimes);
152 -
153 - // If $image has a valid mime_type, return it; otherwise, return the default.
154 - return esc_url_raw(($file['ext'] ? $image : $setting->default));
155 - }
156 -
157 - /**
158 - * Get User Capabilities
159 - *
160 - * @param [type] $user
161 - *
162 - * @return void
163 - */
164 - public static function get_user_capabilities($user = null)
165 - {
166 - $user = $user ? new \WP_User($user) : wp_get_current_user();
167 -
168 - return array_keys($user->allcaps);
169 - }
170 -
171 - /**
172 - * Get User Roles
173 - *
174 - * @param [type] $user
175 - *
176 - * @return void
177 - */
178 - static function get_user_roles($user)
179 - {
180 - return $user->roles;
181 - }
182 -
183 - static function nocache_headers()
184 - {
185 - if (headers_sent()) {
186 - return;
187 - }
188 -
189 - $headers = wp_get_nocache_headers();
190 -
191 - unset($headers['Last-Modified']);
192 -
193 - header_remove('Last-Modified');
194 -
195 - foreach ($headers as $name => $field_value) {
196 - header("{$name}: {$field_value}");
197 - }
198 - }
199 -
200 -
201 - /**
202 - * Set allowed Hosts
203 - *
204 - * @param [type] $url
205 - *
206 - * @return void
207 - */
208 - public static function allowed_host($url)
209 - {
210 - $url_parsed = wp_parse_url($url);
211 - if (isset($url_parsed['host'])) {
212 - $allowed_hosts[] = $url_parsed['host'];
213 - add_filter('allowed_redirect_hosts', function ($hosts) use ($allowed_hosts) {
214 - return array_merge($hosts, $allowed_hosts);
215 - });
216 - }
217 - }
218 -
219 -
220 - /**
221 - * Get Capabilites
222 - *
223 - * @return void
224 - */
225 - public static function get_capabilities()
226 - {
227 - global $wp_roles;
228 -
229 - $caps = array();
230 -
231 - foreach ($wp_roles->roles as $wp_role) {
232 - if (isset($wp_role['capabilities']) && is_array($wp_role['capabilities'])) {
233 - $caps = array_merge($caps, array_keys($wp_role['capabilities']));
234 - }
235 - }
236 -
237 - $caps = array_unique($caps);
238 -
239 - $caps = (array) apply_filters('pxlbsadminify_capabilities', $caps);
240 -
241 - sort($caps);
242 -
243 - return array_combine($caps, $caps);
244 - }
245 -
246 - /**
247 - * Get User Capability Options
248 - *
249 - * @return void
250 - */
251 - public static function get_capability_options()
252 - {
253 - $capabilities = self::get_capabilities();
254 - $_capabilities = [];
255 -
256 - foreach ($capabilities as $capability) {
257 - $_capabilities[] = $capability;
258 - }
259 - return $_capabilities;
260 - }
261 -
262 -
263 - /**
264 - * Remove spaces from Plugin Slug
265 - */
266 - public static function slug_cleanup()
267 - {
268 - return str_replace('-', '_', strtolower(PXLBSADMINIFY_SLUG));
269 - }
270 -
271 - /**
272 - * Function current_datetime() compability for wp version < 5.3
273 - *
274 - * @return DateTimeImmutable
275 - */
276 - public static function custom_current_datetime()
277 - {
278 - if (function_exists('current_datetime')) {
279 - return current_datetime();
280 - }
281 -
282 - return new \DateTimeImmutable('now', self::custom_wp_timezone());
283 - }
284 -
285 - /**
286 - * Function custom_wp_timezone() compability for wp version < 5.3
287 - *
288 - * @return DateTimeZone
289 - */
290 - public static function custom_wp_timezone()
291 - {
292 - if (function_exists('wp_timezone')) {
293 - return wp_timezone();
294 - }
295 -
296 - return new \DateTimeZone(self::custom_wp_timezone_string());
297 - }
298 -
299 - /**
300 - * Public Jewel Theme API base URL.
301 - *
302 - * Single source of truth for the external host the plugin talks to;
303 - * the subscribe / survey endpoints are derived from this base via
304 - * crm_endpoint() and crm_survey_endpoint() so the host only ever
305 - * appears in one place.
306 - *
307 - * @return string
308 - */
309 - public static function api_endpoint()
310 - {
311 - $api_endpoint_url = 'https://pixarlabs.com';
312 - $api_endpoint = apply_filters('pxlbsadminify_endpoint', $api_endpoint_url);
313 -
314 - return trailingslashit($api_endpoint);
315 - }
316 -
317 - /**
318 - * CRM Endpoint
319 - *
320 - * @return string
321 - */
322 - public static function crm_endpoint()
323 - {
324 - $crm_endpoint_url = self::api_endpoint() . 'api/plugin/subscribe';
325 - $crm_endpoint = apply_filters('pxlbsadminify_subscribe_endpoint', $crm_endpoint_url);
326 -
327 - return trailingslashit($crm_endpoint);
328 - }
329 -
330 - /**
331 - * Function custom_wp_timezone_string() compability for wp version < 5.3
332 - *
333 - * @return string
334 - */
335 - public static function custom_wp_timezone_string()
336 - {
337 - $timezone_string = get_option('timezone_string');
338 -
339 - if ($timezone_string) {
340 - return $timezone_string;
341 - }
342 -
343 - $offset = (float) get_option('gmt_offset');
344 - $hours = (int) $offset;
345 - $minutes = ($offset - $hours);
346 -
347 - $sign = ($offset < 0) ? '-' : '+';
348 - $abs_hour = abs($hours);
349 - $abs_mins = abs($minutes * 60);
350 - $tz_offset = sprintf('%s%02d:%02d', $sign, $abs_hour, $abs_mins);
351 -
352 - return $tz_offset;
353 - }
354 -
355 - /**
356 - * Get Merged Data
357 - *
358 - * @param [type] $data .
359 - * @param string $start_date .
360 - * @param string $end_data .
361 - *
362 - * @author Jewel Theme <support@jeweltheme.com>
363 - */
364 - public static function get_merged_data($data, $start_date = '', $end_data = '')
365 - {
366 - $_data = shortcode_atts(
367 - array(
368 - 'image_url' => PXLBSADMINIFY_ASSETS_IMAGE . '/promo-image.png',
369 - 'start_date' => $start_date,
370 - 'end_date' => $end_data,
371 - 'counter_time' => '',
372 - 'is_live' => false,
373 - 'button_text' => 'Get Premium',
374 - 'button_url' => 'https://wpadminify.com/pricing',
375 - 'btn_color' => '#CC22FF',
376 - 'notice' => '',
377 - 'notice_timestamp' => '',
378 - 'show_for_premium' => 'false',
379 - ),
380 - $data
381 - );
382 -
383 - if (empty($_data['image_url'])) {
384 - $_data['image_url'] = PXLBSADMINIFY_ASSETS_IMAGE . '/promo-image.png';
385 - }
386 -
387 - return $_data;
388 - }
389 -
390 -
391 - /**
392 - * wp_kses attributes map
393 - *
394 - * @param array $attrs .
395 - *
396 - * @author Jewel Theme <support@jeweltheme.com>
397 - */
398 - public static function wp_kses_atts_map(array $attrs)
399 - {
400 - return array_fill_keys(array_values($attrs), true);
401 - }
402 -
403 - /**
404 - * Custom method
405 - *
406 - * @param [type] $content .
407 - *
408 - * @author Jewel Theme <support@jeweltheme.com>
409 - */
410 - public static function wp_kses_custom($content)
411 - {
412 - /**
413 - * the context can be different
414 - * The context for which to retrieve tags. Allowed values are 'post', 'strip', 'data', 'entities', or the name of a field filter such as 'pre_user_description', or an array of allowed HTML elements and attributes.
415 - * the post means here it will return all the tags that are allowed in post such as a, p, strong, em etc
416 - */
417 - $allowed_tags = wp_kses_allowed_html('post'); // Details : https://developer.wordpress.org/reference/functions/wp_kses_allowed_html/
418 - if( !is_array($allowed_tags) ) $allowed_tags = [];
419 -
420 - $custom_tags = array(
421 - 'select' => self::wp_kses_atts_map(array('class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'multiple', 'required', 'size')),
422 - 'input' => self::wp_kses_atts_map(array('class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'required', 'size', 'type', 'checked', 'readonly', 'placeholder', 'value', 'maxlength', 'min', 'max', 'multiple', 'pattern', 'step', 'autocomplete')),
423 - 'textarea' => self::wp_kses_atts_map(array('class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'required', 'rows', 'cols', 'wrap', 'maxlength')),
424 - 'option' => self::wp_kses_atts_map(array('class', 'id', 'label', 'disabled', 'label', 'selected', 'value')),
425 - 'optgroup' => self::wp_kses_atts_map(array('disabled', 'label', 'class', 'id')),
426 - 'form' => self::wp_kses_atts_map(array('class', 'id', 'data', 'style', 'width', 'height', 'accept-charset', 'action', 'autocomplete', 'enctype', 'method', 'name', 'novalidate', 'rel', 'target')),
427 - 'svg' => self::wp_kses_atts_map(array('class', 'xmlns', 'viewbox', 'width', 'height', 'fill', 'aria-hidden', 'aria-labelledby', 'role')),
428 - 'rect' => self::wp_kses_atts_map(array('rx', 'width', 'height', 'fill')),
429 - 'path' => self::wp_kses_atts_map(array('d', 'fill')),
430 - 'g' => self::wp_kses_atts_map(array('fill')),
431 - 'defs' => self::wp_kses_atts_map(array('fill')),
432 - 'linearGradient' => self::wp_kses_atts_map(array('id', 'x1', 'x2', 'y1', 'y2', 'gradientUnits')),
433 - 'stop' => self::wp_kses_atts_map(array('stop-color', 'offset', 'stop-opacity')),
434 - 'style' => self::wp_kses_atts_map(array('type')),
435 - 'div' => self::wp_kses_atts_map(array('class', 'id', 'style')),
436 - 'ul' => self::wp_kses_atts_map(array('class', 'id', 'style')),
437 - 'li' => self::wp_kses_atts_map(array('class', 'id', 'style')),
438 - 'label' => self::wp_kses_atts_map(array('class', 'for')),
439 - 'span' => self::wp_kses_atts_map(array('class', 'id', 'style')),
440 - 'h1' => self::wp_kses_atts_map(array('class', 'id', 'style')),
441 - 'h2' => self::wp_kses_atts_map(array('class', 'id', 'style')),
442 - 'h3' => self::wp_kses_atts_map(array('class', 'id', 'style')),
443 - 'h4' => self::wp_kses_atts_map(array('class', 'id', 'style')),
444 - 'h5' => self::wp_kses_atts_map(array('class', 'id', 'style')),
445 - 'h6' => self::wp_kses_atts_map(array('class', 'id', 'style')),
446 - 'a' => self::wp_kses_atts_map(array('class', 'href', 'target', 'rel')),
447 - 'p' => self::wp_kses_atts_map(array('class', 'id', 'style', 'data')),
448 - 'table' => self::wp_kses_atts_map(array('class', 'id', 'style')),
449 - 'thead' => self::wp_kses_atts_map(array('class', 'id', 'style')),
450 - 'tbody' => self::wp_kses_atts_map(array('class', 'id', 'style')),
451 - 'tr' => self::wp_kses_atts_map(array('class', 'id', 'style')),
452 - 'th' => self::wp_kses_atts_map(array('class', 'id', 'style')),
453 - 'td' => self::wp_kses_atts_map(array('class', 'id', 'style')),
454 - 'i' => self::wp_kses_atts_map(array('class', 'id', 'style')),
455 - 'button' => self::wp_kses_atts_map(array('class', 'id')),
456 - 'nav' => self::wp_kses_atts_map(array('class', 'id', 'style')),
457 - 'time' => self::wp_kses_atts_map(array('datetime')),
458 - 'br' => array(),
459 - 'strong' => array(),
460 - 'style' => array(),
461 - 'img' => self::wp_kses_atts_map(array('class', 'src', 'alt', 'height', 'width', 'srcset', 'id', 'loading')),
462 - );
463 -
464 - $allowed_tags = array_merge_recursive($allowed_tags, $custom_tags);
465 -
466 - return wp_kses(stripslashes_deep($content), $allowed_tags);
467 - }
468 -
469 -
470 - /**
471 - * Dashboard Icons
472 - *
473 - * @author Jewel Theme <support@jeweltheme.com>
474 - */
475 - public static function dashboard_icons($icon_name = '') {
476 -
477 - if($icon_name === 'dashboard' ){
478 - $icon = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
479 - <path d="M4.09 0H0.91C0.41 0 0 0.41 0 0.91V4.09C0 4.59 0.41 5 0.91 5H4.09C4.59 5 5 4.59 5 4.09V0.91C5 0.41 4.59 0 4.09 0ZM4.09 4.09H0.91V0.91H4.09V4.09Z" fill="#48455F"/>
480 - <path d="M11.09 0H7.91C7.41 0 7 0.41 7 0.91V4.09C7 4.59 7.41 5 7.91 5H11.09C11.59 5 12 4.59 12 4.09V0.91C12 0.41 11.59 0 11.09 0ZM11.09 4.09H7.91V0.91H11.09V4.09Z" fill="#48455F"/>
481 - <path d="M4.09 7H0.91C0.41 7 0 7.41 0 7.91V11.09C0 11.59 0.41 12 0.91 12H4.09C4.59 12 5 11.59 5 11.09V7.91C5 7.41 4.59 7 4.09 7ZM4.09 11.09H0.91V7.91H4.09V11.09Z" fill="#48455F"/>
482 - <path d="M11.09 7H7.91C7.41 7 7 7.41 7 7.91V11.09C7 11.59 7.41 12 7.91 12H11.09C11.59 12 12 11.59 12 11.09V7.91C12 7.41 11.59 7 11.09 7ZM11.09 11.09H7.91V7.91H11.09V11.09Z" fill="#48455F"/>
483 - </svg>';
484 - }
485 - if ($icon_name === 'post') {
486 - $icon = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
487 - <path d="M11 0.999971V11H1V0.999971H11ZM12 -6.10352e-05H6.34789e-06L0 11.9999H12V-6.10352e-05Z" fill="#48455F"/>
488 - <path d="M9 2.99997V4.99997H3V2.99997H9ZM10 1.99997H2V5.99997H10V1.99997Z" fill="#48455F"/>
489 - <path d="M10 8.99997H2V9.99997H10V8.99997Z" fill="#48455F"/>
490 - <path d="M10 6.99997H2V7.99997H10V6.99997Z" fill="#48455F"/>
491 - </svg>
492 - ';
493 - }
494 - if ($icon_name === 'database') {
495 - $icon = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
496 - <path d="M4.09 0H0.91C0.41 0 0 0.41 0 0.91V4.09C0 4.59 0.41 5 0.91 5H4.09C4.59 5 5 4.59 5 4.09V0.91C5 0.41 4.59 0 4.09 0ZM4.09 4.09H0.91V0.91H4.09V4.09Z" fill="#48455F"/>
497 - <path d="M11.09 0H7.91C7.41 0 7 0.41 7 0.91V4.09C7 4.59 7.41 5 7.91 5H11.09C11.59 5 12 4.59 12 4.09V0.91C12 0.41 11.59 0 11.09 0ZM11.09 4.09H7.91V0.91H11.09V4.09Z" fill="#48455F"/>
498 - <path d="M4.09 7H0.91C0.41 7 0 7.41 0 7.91V11.09C0 11.59 0.41 12 0.91 12H4.09C4.59 12 5 11.59 5 11.09V7.91C5 7.41 4.59 7 4.09 7ZM4.09 11.09H0.91V7.91H4.09V11.09Z" fill="#48455F"/>
499 - <path d="M11.09 7H7.91C7.41 7 7 7.41 7 7.91V11.09C7 11.59 7.41 12 7.91 12H11.09C11.59 12 12 11.59 12 11.09V7.91C12 7.41 11.59 7 11.09 7ZM11.09 11.09H7.91V7.91H11.09V11.09Z" fill="#48455F"/>
500 - </svg>';
501 - }
502 - if ($icon_name === 'media') {
503 - $icon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
504 - <path d="M4 2V3H13V12H14V2H4Z" fill="#48455F"/>
505 - <path d="M3 14H11C11.55 14 12 13.55 12 13V5C12 4.45 11.55 4 11 4H3C2.45 4 2 4.45 2 5V13C2 13.55 2.45 14 3 14ZM11 13H3.69L5.71 10.97L7.09 12.36L9.46 9.98L11 11.52V13ZM3 5H11V10.11L9.46 8.56L7.09 10.94L5.71 9.55L3 12.28V5Z" fill="#48455F"/>
506 - <path d="M7.35 8.64C7.90228 8.64 8.35 8.19228 8.35 7.64C8.35 7.08772 7.90228 6.64 7.35 6.64C6.79772 6.64 6.35 7.08772 6.35 7.64C6.35 8.19228 6.79772 8.64 7.35 8.64Z" fill="#48455F"/>
507 - </svg>
508 - ';
509 - }
510 - if ($icon_name === 'page') {
511 - $icon = '<svg width="10" height="12" viewBox="0 0 10 12" fill="none" xmlns="http://www.w3.org/2000/svg">
512 - <path d="M8 2V0H0V12H10V2H8ZM9 11H1V1H7V3H9V11Z" fill="#48455F"/>
513 - <path d="M8 5H2V6H8V5Z" fill="#48455F"/>
514 - <path d="M8 7H2V8H8V7Z" fill="#48455F"/>
515 - <path d="M8 9H2V10H8V9Z" fill="#48455F"/>
516 - </svg>
517 - ';
518 - }
519 - if ($icon_name === 'comments') {
520 - $icon = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
521 - <path d="M10 0V1H1V8H0V0H10Z" fill="#48455F"/>
522 - <path d="M11 3V10.13L9.56 9.17L9.31 9H3V3H11ZM11 2H2.99C2.44 2 1.99 2.45 1.99 3V9.01C1.99 9.56 2.44 10.01 2.99 10.01H9L12 12.01V2.99C12 2.44 11.55 1.99 11 1.99V2Z" fill="#48455F"/>
523 - </svg>
524 - ';
525 - }
526 - if ($icon_name === 'appearance') {
527 - $icon = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
528 - <path d="M6.0001 1C6.3301 1 6.6701 1.03 7.0001 1.1C8.7601 1.44 10.2401 2.79 10.7801 4.54C11.0301 5.36 11.0701 6.19 10.9001 7.01H9.0101C7.9001 7.01 7.0101 7.91 7.0101 9.01V10.9C6.6801 10.97 6.3401 11 6.0101 11C5.5201 11 5.0301 10.92 4.5401 10.78C2.7901 10.25 1.4401 8.77 1.1001 7C0.810101 5.47 1.1801 3.99 2.1501 2.82C3.1001 1.67 4.5101 1 6.0101 1M6.0101 0C2.3001 0 -0.619899 3.35 0.110101 7.19C0.520101 9.33 2.1501 11.1 4.2401 11.73C4.8401 11.91 5.4301 12 6.0001 12C6.7001 12 7.3701 11.87 8.0001 11.65V9C8.0001 8.45 8.4501 8 9.0001 8H11.6501C12.0501 6.87 12.1401 5.59 11.7301 4.24C11.1001 2.15 9.3301 0.53 7.1901 0.11C6.7901 0.03 6.3901 0 6.0001 0H6.0101Z" fill="#48455F"/>
529 - <path d="M3.58008 4.95001C4.13236 4.95001 4.58008 4.5023 4.58008 3.95001C4.58008 3.39773 4.13236 2.95001 3.58008 2.95001C3.02779 2.95001 2.58008 3.39773 2.58008 3.95001C2.58008 4.5023 3.02779 4.95001 3.58008 4.95001Z" fill="#48455F"/>
530 - <path d="M3.20996 7.94C3.76225 7.94 4.20996 7.49229 4.20996 6.94C4.20996 6.38772 3.76225 5.94 3.20996 5.94C2.65768 5.94 2.20996 6.38772 2.20996 6.94C2.20996 7.49229 2.65768 7.94 3.20996 7.94Z" fill="#48455F"/>
531 - <path d="M5.42993 9.94C5.98222 9.94 6.42993 9.49229 6.42993 8.94C6.42993 8.38772 5.98222 7.94 5.42993 7.94C4.87765 7.94 4.42993 8.38772 4.42993 8.94C4.42993 9.49229 4.87765 9.94 5.42993 9.94Z" fill="#48455F"/>
532 - </svg>
533 - ';
534 - }
535 - if ($icon_name === 'plugins') {
536 - $icon = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
537 - <path d="M10.17 12H6.42V11.5C6.42 11.28 6.34 10.17 5.09 10.17C3.84 10.17 3.76 11.37 3.76 11.5V12H0V8.25001H0.5C0.72 8.25001 1.83 8.17001 1.83 6.92001C1.83 5.67001 0.72 5.59001 0.49 5.59001H0V1.84001H2.8C2.98 0.97001 3.65 0.0100098 5.08 0.0100098C6.51 0.0100098 7.17 0.98001 7.36 1.84001H10.16V4.64001C11.03 4.82001 11.99 5.49001 11.99 6.92001C11.99 8.35001 11.02 9.02001 10.16 9.20001V12H10.17ZM7.37 11H9.17V8.25001H9.67C9.89 8.25001 11 8.17001 11 6.92001C11 5.67001 9.89 5.59001 9.66 5.59001H9.17V2.84001H6.42V2.34001C6.42 2.12001 6.34 1.01001 5.09 1.01001C3.84 1.01001 3.76 2.21001 3.76 2.34001V2.84001H1V4.64001C1.87 4.82001 2.83 5.49001 2.83 6.92001C2.83 8.35001 1.86 9.02001 1 9.20001V11H2.8C2.98 10.13 3.65 9.17001 5.08 9.17001C6.51 9.17001 7.17 10.14 7.36 11H7.37Z" fill="#48455F"/>
538 - </svg>
539 - ';
540 - }
541 - if ($icon_name === 'users') {
542 - $icon = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
543 - <path d="M4.5 5C3.4 5 2.5 4.1 2.5 3C2.5 1.9 3.4 1 4.5 1V0C2.84 0 1.5 1.34 1.5 3C1.5 4.66 2.84 6 4.5 6V5Z" fill="#48455F"/>
544 - <path d="M2.69 11H0.9V9.54L2.69 8.21V7.01L0 9V12H2.69V11Z" fill="#48455F"/>
545 - <path d="M7.5 6C9.16 6 10.5 4.66 10.5 3C10.5 1.34 9.16 0 7.5 0C5.84 0 4.5 1.34 4.5 3C4.5 4.66 5.84 6 7.5 6ZM7.5 1C8.6 1 9.5 1.9 9.5 3C9.5 4.1 8.6 5 7.5 5C6.4 5 5.5 4.1 5.5 3C5.5 1.9 6.4 1 7.5 1Z" fill="#48455F"/>
546 - <path d="M9.3 7L7.5 8L5.7 7L3 9V12H12V9L9.3 7ZM11.1 11H3.9V9.54L5.76 8.16L7.09 8.9L7.49 9.12L7.89 8.9L9.22 8.16L11.08 9.54V11H11.1Z" fill="#48455F"/>
547 - </svg>
548 - ';
549 - }
550 - if ($icon_name === 'tools') {
551 - $icon = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
552 - <path d="M4.37001 3.34001C4.37001 3.34001 4.40001 3.42001 4.37001 3.45001L3.45001 4.37001C3.45001 4.37001 3.37001 4.40001 3.34001 4.37001L1.16001 2.19001C1.04001 2.07001 0.880012 2.02001 0.720012 2.05001C0.560012 2.08001 0.420012 2.19001 0.350012 2.34001C-0.549988 4.34001 0.340012 6.69001 2.33001 7.60001C3.26001 8.02001 4.32001 8.07001 5.28001 7.73001L9.05001 11.5C9.39001 11.84 9.83001 12.01 10.27 12.01C10.71 12.01 11.15 11.84 11.49 11.5C12.16 10.83 12.16 9.73001 11.49 9.06001L7.72001 5.29001C8.39001 3.37001 7.50001 1.21001 5.61001 0.360007C4.57001 -0.109993 3.38001 -0.109993 2.33001 0.360007C2.18001 0.430007 2.07001 0.560007 2.04001 0.730007C2.01001 0.890007 2.06001 1.06001 2.18001 1.17001L4.36001 3.35001M1.03001 3.50001L2.63001 5.10001C3.05001 5.51001 3.73001 5.51001 4.14001 5.10001L5.07001 4.17001C5.48001 3.75001 5.48001 3.07001 5.07001 2.66001L3.47001 1.06001C3.63001 1.03001 3.80001 1.02001 3.96001 1.02001C4.38001 1.02001 4.80001 1.11001 5.19001 1.28001C6.68001 1.96001 7.35001 3.72001 6.67001 5.21001C6.58001 5.40001 6.63001 5.62001 6.77001 5.77001L10.77 9.77001C11.05 10.05 11.05 10.52 10.77 10.8C10.49 11.08 10.02 11.08 9.74001 10.8L5.76001 6.79001C5.61001 6.64001 5.39001 6.60001 5.20001 6.69001C4.42001 7.04001 3.53001 7.04001 2.75001 6.69001C1.50001 6.12001 0.830012 4.79001 1.04001 3.49001L1.03001 3.50001Z" fill="#48455F"/>
553 - </svg>
554 - ';
555 - }
556 - if ($icon_name === 'chart-bar') {
557 - $icon = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
558 - <path d="M4.09 0H0.91C0.41 0 0 0.41 0 0.91V4.09C0 4.59 0.41 5 0.91 5H4.09C4.59 5 5 4.59 5 4.09V0.91C5 0.41 4.59 0 4.09 0ZM4.09 4.09H0.91V0.91H4.09V4.09Z" fill="#48455F"/>
559 - <path d="M11.09 0H7.91C7.41 0 7 0.41 7 0.91V4.09C7 4.59 7.41 5 7.91 5H11.09C11.59 5 12 4.59 12 4.09V0.91C12 0.41 11.59 0 11.09 0ZM11.09 4.09H7.91V0.91H11.09V4.09Z" fill="#48455F"/>
560 - <path d="M4.09 7H0.91C0.41 7 0 7.41 0 7.91V11.09C0 11.59 0.41 12 0.91 12H4.09C4.59 12 5 11.59 5 11.09V7.91C5 7.41 4.59 7 4.09 7ZM4.09 11.09H0.91V7.91H4.09V11.09Z" fill="#48455F"/>
561 - <path d="M11.09 7H7.91C7.41 7 7 7.41 7 7.91V11.09C7 11.59 7.41 12 7.91 12H11.09C11.59 12 12 11.59 12 11.09V7.91C12 7.41 11.59 7 11.09 7ZM11.09 11.09H7.91V7.91H11.09V11.09Z" fill="#48455F"/>
562 - </svg>';
563 - }
564 - if ($icon_name === 'settings') {
565 - $icon = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
566 - <path d="M11.5 4.6H10.85C10.69 4.6 10.54 4.54 10.43 4.43C10.32 4.32 10.25 4.17 10.25 4.01C10.25 3.85 10.31 3.7 10.42 3.59L10.88 3.13C10.97 3.03 11.02 2.9 11.02 2.77C11.02 2.64 10.97 2.51 10.87 2.42L9.57 1.12C9.48 1.03 9.35 0.97 9.22 0.97C9.09 0.97 8.96 1.02 8.87 1.12L8.41 1.58C8.3 1.69 8.14 1.75 7.99 1.75C7.66 1.75 7.4 1.48 7.41 1.15V0.5C7.41 0.23 7.19 0 6.91 0H5.08C4.81 0 4.58 0.22 4.58 0.5V1.14C4.58 1.3 4.52 1.45 4.41 1.56C4.3 1.67 4.15 1.74 3.99 1.74C3.83 1.74 3.68 1.68 3.57 1.57L3.11 1.11C2.92 0.92 2.6 0.92 2.4 1.11L1.12 2.41C1.03 2.5 0.97 2.63 0.98 2.76C0.98 2.89 1.03 3.02 1.13 3.11L1.59 3.57C1.7 3.68 1.76 3.84 1.76 3.99C1.76 4.15 1.69 4.3 1.58 4.41C1.47 4.52 1.32 4.58 1.17 4.58H0.5C0.23 4.58 0 4.8 0 5.08V6.92C0 7.19 0.22 7.42 0.5 7.42H1.15C1.3 7.42 1.46 7.48 1.57 7.59C1.68 7.7 1.75 7.85 1.75 8.01C1.75 8.17 1.69 8.32 1.58 8.43L1.11 8.9C1.02 8.99 0.97 9.12 0.97 9.25C0.97 9.38 1.02 9.51 1.12 9.6L2.42 10.87C2.61 11.07 2.93 11.07 3.12 10.87L3.58 10.41C3.69 10.3 3.84 10.24 4 10.24C4.16 10.24 4.31 10.31 4.42 10.42C4.53 10.53 4.59 10.68 4.59 10.84V11.5C4.59 11.78 4.81 12 5.09 12H6.92C7.19 11.99 7.4 11.77 7.4 11.5V10.88C7.4 10.72 7.46 10.57 7.57 10.46C7.68 10.35 7.83 10.28 7.99 10.28C8.15 10.28 8.3 10.34 8.41 10.45L8.88 10.92C9.08 11.11 9.39 11.11 9.58 10.92L10.88 9.62C10.97 9.53 11.03 9.4 11.02 9.27C11.02 9.14 10.97 9.01 10.87 8.92L10.41 8.46C10.3 8.35 10.24 8.19 10.24 8.04C10.24 7.88 10.31 7.73 10.42 7.62C10.53 7.51 10.68 7.45 10.83 7.45H11.5C11.77 7.45 12 7.23 12 6.95V5.12C12 4.85 11.78 4.62 11.5 4.62V4.6ZM9.25 8.01C9.25 8.43 9.42 8.83 9.72 9.13L9.83 9.24L9.24 9.84L9.13 9.73C8.83 9.43 8.43 9.26 8.01 9.26C7.59 9.26 7.19 9.43 6.89 9.73C6.59 10.03 6.43 10.43 6.43 10.85V11.01H5.59V10.85C5.59 10.43 5.42 10.02 5.12 9.72C4.5 9.1 3.49 9.11 2.88 9.72L2.77 9.83L2.18 9.23L2.29 9.12C2.59 8.82 2.76 8.41 2.76 7.99C2.76 7.12 2.05 6.41 1.17 6.41H1.01V5.57H1.17C1.59 5.57 1.99 5.4 2.29 5.1C2.59 4.8 2.75 4.4 2.75 3.98C2.75 3.56 2.58 3.16 2.28 2.86L2.17 2.75L2.76 2.16L2.87 2.27C3.17 2.57 3.58 2.74 3.99 2.74C4.41 2.74 4.81 2.57 5.11 2.27C5.41 1.97 5.57 1.57 5.57 1.15V0.99H6.41V1.15C6.41 1.57 6.58 1.98 6.88 2.28C7.5 2.89 8.5 2.89 9.12 2.28L9.23 2.17L9.82 2.76L9.71 2.87C9.41 3.17 9.24 3.58 9.24 4C9.24 4.42 9.41 4.82 9.71 5.12C10.01 5.42 10.41 5.58 10.83 5.58H10.99V6.42H10.83C10.4 6.42 10.01 6.59 9.71 6.89C9.41 7.19 9.25 7.59 9.25 8.01Z" fill="#48455F"/>
567 - <path d="M6 8.5C4.62 8.5 3.5 7.38 3.5 6C3.5 4.62 4.62 3.5 6 3.5C7.38 3.5 8.5 4.62 8.5 6C8.5 7.38 7.38 8.5 6 8.5ZM6 4.5C5.17 4.5 4.5 5.17 4.5 6C4.5 6.83 5.17 7.5 6 7.5C6.83 7.5 7.5 6.83 7.5 6C7.5 5.17 6.83 4.5 6 4.5Z" fill="#48455F"/>
568 - </svg>
569 - ';
570 - }
571 - return $icon;
572 - }
573 -
574 -
95 + // If $image has a valid mime_type, return it; otherwise, return the default.
96 + return esc_url_raw(($file['ext'] ? $image : $setting->default));
97 + }
575 98 }