PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.0.2.5
Adminify – White Label, Admin Menu Editor, Login Customizer v4.0.2.5
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/utils.php +143 -283 4.2.64.0.2.5 View file →
@@ -1,8 +1,10 @@
1 1 <?php
2 2
3 -namespace PXLBSAdminify\Inc;
3 +namespace WPAdminify\Inc;
4 4
5 +use ReturnTypeWillChange;
6 +use WPAdminify\Inc\Classes\Helper;
5 7 // no direct access allowed
6 8 if (!defined('ABSPATH')) {
7 9 exit;
8 10 }
@@ -41,9 +43,9 @@
41 43 }
42 44
43 45
44 46 /**
45 - * Check hidden for roles or not
47 + * Check hidden for rules or not
46 48 *
47 49 * @param [type] $value
48 50 *
49 51 * @return bool
@@ -53,15 +55,10 @@
53 55 if (empty($disabled_for)) {
54 56 return false;
55 57 }
56 58
57 - // wp_get_current_user() lives in wp-includes/pluggable.php and is
58 - // always available in normal plugin execution. If it is somehow
59 - // unavailable (e.g. very early bootstrap), bail out instead of
60 - // manually loading core files, which is disallowed by the
61 - // WordPress.org plugin guidelines.
62 59 if (!function_exists('wp_get_current_user')) {
63 - return false;
60 + include ABSPATH . 'wp-includes/pluggable.php';
64 61 }
65 62
66 63 $restrict_for = array();
67 64
@@ -75,17 +72,17 @@
75 72 $current_user = wp_get_current_user();
76 73 $current_name = $current_user->display_name;
77 74 $current_roles = $current_user->roles;
78 75 // $all_roles = wp_roles()->get_names();
79 -
76 +
80 77 if (in_array($current_name, $restrict_for)) {
81 78 return true;
82 79 }
83 -
84 - // if (in_array('Super Admin', $restrict_for) || in_array('administrator', $restrict_for)) {
85 - // return true;
86 - // }
87 80
81 + if (in_array('Super Admin', $restrict_for) || in_array('administrator', $restrict_for)) {
82 + return true;
83 + }
84 +
88 85 // Super Admin for Multisite
89 86 if (is_super_admin() && is_multisite()) {
90 87 if (in_array('Super Admin', $restrict_for) || in_array('administrator', $restrict_for)) {
91 88 return true;
@@ -160,16 +157,13 @@
160 157 if (!is_array($disabled_for)) {
161 158 return false;
162 159 }
163 160
164 - // wp_get_current_user() is provided by wp-includes/pluggable.php and
165 - // is loaded by core early in normal plugin execution. Manually
166 - // loading core files is disallowed by the plugin guidelines, so we
167 - // simply bail out if it is unavailable for any reason.
161 + require_once ABSPATH . '/wp-includes/pluggable.php';
162 +
168 163 if (!function_exists('wp_get_current_user')) {
169 164 return false;
170 165 }
171 -
172 166 $current_user = wp_get_current_user();
173 167 $current_name = $current_user->display_name;
174 168 $current_roles = $current_user->roles;
175 169
@@ -227,9 +221,9 @@
227 221 }
228 222
229 223
230 224 // verfiy current page id
231 - public static function currentpage_id($id)
225 + public static function jltwp_adminify_currentpage_id($id)
232 226 {
233 227 if (!function_exists('get_current_screen')) {
234 228 return true;
235 229 }
@@ -246,14 +240,14 @@
246 240 * @return void
247 241 */
248 242 public static function admin_page_title($title = '')
249 243 {
250 - $title = isset($title) && !empty($title) ? $title : PXLBSADMINIFY;
244 + $title = isset($title) && !empty($title) ? $title : WP_ADMINIFY;
251 245 echo esc_html($title);
252 246
253 247 if (is_multisite()) {
254 248 $text = ' | ' . esc_html__('Current Blog ID', 'adminify') . ': ' . get_current_blog_id(); ?>
255 - <?php echo self::kses_custom(self::admin_page_subtitle($text)); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- kses_custom() is a wp_kses() wrapper; output already escaped. ?>
249 + <?php echo self::wp_kses_custom(self::admin_page_subtitle($text)); ?>
256 250 <?php } ?>
257 251 <?php
258 252 }
259 253
@@ -280,9 +274,9 @@
280 274 $class = str_replace([' ', ',', '.', '"', "'", '/', '\\', '+', '=', ')', '(', '*', '&', '^', '%', '$', '#', '@', '!', '~', '`', '<', '>', '?', '[', ']', '{', '}', '|', ':'], '', $name);
281 275 return $class;
282 276 }
283 277
284 - public static function class_cleanup($string)
278 + public static function jltwp_adminify_class_cleanup($string)
285 279 {
286 280 // Lower case everything
287 281 $string = strtolower($string);
288 282 // Make alphanumeric (removes all other characters)
@@ -356,11 +350,9 @@
356 350 * @return boolean
357 351 */
358 352 public static function is_plugin_active( $plugin_path )
359 353 {
360 - if (!function_exists('is_plugin_active')) {
361 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
362 - }
354 + include_once ABSPATH . 'wp-admin/includes/plugin.php';
363 355 return is_plugin_active( $plugin_path );
364 356 }
365 357
366 358 /**
@@ -400,9 +392,9 @@
400 392 $installed_plugins = get_plugins();
401 393 return isset($installed_plugins[$plugin_file]);
402 394 }
403 395
404 - public static function notification_bar()
396 + public static function jltwp_adminify_notification_bar()
405 397 {
406 398 $plugin_slug = 'adminify-notification-bar';
407 399 $plugin_file = 'adminify-notification-bar/adminify-notification-bar.php';
408 400 $addons_page_url = network_admin_url('admin.php?page=wp-adminify-settings-addons');
@@ -447,9 +439,9 @@
447 439
448 440 public static function get_user_preference($key)
449 441 {
450 442 $userid = get_current_user_id();
451 - $current = get_user_meta($userid, 'pxlbsadminify_preferences', true);
443 + $current = get_user_meta($userid, '_wpadminify_preferences', true);
452 444 $value = false;
453 445
454 446 if (is_array($current)) {
455 447 if (isset($current[$key])) {
@@ -472,13 +464,13 @@
472 464 foreach ($values as $index => $in) {
473 465 if (is_array($in)) {
474 466 $values[$index] = self::clean_ajax_input($in);
475 467 } else {
476 - $values[$index] = wp_strip_all_tags($in);
468 + $values[$index] = strip_tags($in);
477 469 }
478 470 }
479 471 } else {
480 - $values = wp_strip_all_tags($values);
472 + $values = strip_tags($values);
481 473 }
482 474
483 475 return $values;
484 476 }
@@ -494,9 +486,9 @@
494 486 {
495 487 $returndata = [];
496 488 $returndata['error'] = true;
497 489 $returndata['error_message'] = $message;
498 - return wp_json_encode($returndata);
490 + return json_encode($returndata);
499 491 }
500 492
501 493 /**
502 494 * Get All Updates
@@ -547,15 +539,51 @@
547 539 }
548 540 return $allupdates;
549 541 }
550 542
543 + public static function adminfiy_help_urls($module_name = '', $docs = '', $youtube = '', $facebook_grp = '', $support = '')
544 + {
545 + $help_content = '';
551 546
547 + // Modules
548 + if (empty($module_name)) {
549 + $module_name = '';
550 + } else {
551 + $module_name = $module_name;
552 + }
553 +
554 + $help_content_urls = '';
555 +
556 + // Docs
557 + if (!empty($docs)) {
558 + $help_content_urls .= '<a class="adminify-tag adminify-tag-purple adminify-docs-url" href="' . esc_url( $docs ) . '" target="_blank"> ' . self::docs_icon() . ' Docs</a>';
559 + }
560 +
561 + // youtube
562 + if (!empty($youtube)) {
563 + $help_content_urls .= '<a class="adminify-tag adminify-tag-danger adminify-video-url" href="' . esc_url( $youtube ) . '" target="_blank">' . self::video_tutorials_icon() . ' Video Tutorial</a>';
564 + }
565 +
566 + // facebook_grp
567 + if (!empty($facebook_grp)) {
568 + $help_content_urls .= '<a class="adminify-tag adminify-tag-primary adminify-fbgroup-url" href="' . esc_url($facebook_grp) . '" target="_blank">' . self::fbgroup_icon() . ' Facebook Group</a>';
569 + }
570 +
571 + // Support
572 + if ( !empty($support)) {
573 + $help_content_urls .= '<a class="adminify-tag adminify-tag-secondary adminify-support-url" href="' . esc_url($support) . '" target="_blank">' . self::support_icon() . ' Support</a>';
574 + }
575 +
576 + $help_content = sprintf( __('%1$s <div class="adminify-helps">%2$s</div>', 'adminify' ), $module_name, $help_content_urls );
577 + return $help_content;
578 + }
579 +
552 580 /**
553 581 * Upgrade Pro Icon
554 582 *
555 - * @return string
583 + * @return void
556 584 */
557 - public static function upgrade_pro_icon()
585 + public static function jltwp_adminify_upgrade_pro_icon()
558 586 {
559 587 return '<svg class="adminify-pro-notice-icon is-pulled-left mr-2" width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
560 588 <path fill-rule="evenodd" clip-rule="evenodd" d="M21.8233 0.18318C21.8541 0.215042 21.8753 0.255055 21.8843 0.298527C22.5767 3.32046 20.085 9.8239 16.4731 13.4209C15.8343 14.064 15.1407 14.6502 14.4002 15.1727C14.4955 16.2787 14.411 17.3846 13.9985 18.3318C12.8302 21.0043 9.75855 21.7824 8.44197 21.9937C8.36979 22.0059 8.29577 22.0012 8.22571 21.9799C8.15566 21.9587 8.09147 21.9215 8.03819 21.8713C7.9849 21.821 7.94397 21.7591 7.9186 21.6904C7.89323 21.6217 7.88411 21.548 7.89196 21.4751L8.36241 17.189C8.04096 17.1858 7.71987 17.1663 7.40039 17.1305C7.17735 17.1087 6.96893 17.0096 6.81109 16.8503L5.15076 15.1924C4.99146 15.0346 4.89242 14.8259 4.87084 14.6026C4.83497 14.281 4.81547 13.9578 4.8124 13.6343L0.524795 14.1076C0.451994 14.1156 0.378341 14.1065 0.309629 14.0811C0.240917 14.0558 0.17902 14.0148 0.128806 13.9615C0.0785915 13.9081 0.0414297 13.8438 0.0202432 13.7736C-0.000943262 13.7035 -0.0055768 13.6293 0.00670721 13.5571C0.223273 12.2368 1.00065 9.16771 3.67065 7.99148C4.61695 7.57859 5.72728 7.4965 6.83761 7.59481C7.35968 6.85546 7.94513 6.16306 8.58733 5.52547C12.1879 1.92304 18.8337 -0.585245 21.7099 0.118627C21.7531 0.128924 21.7924 0.151317 21.8233 0.18318ZM12.224 7.92186C12.3151 8.37957 12.5397 8.79996 12.8695 9.12986C13.0882 9.34908 13.348 9.52298 13.6339 9.64164C13.9198 9.7603 14.2263 9.82137 14.5358 9.82137C14.8453 9.82137 15.1517 9.7603 15.4377 9.64164C15.7236 9.52298 15.9833 9.34908 16.202 9.12986C16.5318 8.79996 16.7565 8.37957 16.8475 7.92186C16.9386 7.46415 16.892 6.98968 16.7137 6.55848C16.5353 6.12727 16.2332 5.7587 15.8455 5.49939C15.4578 5.24007 15.002 5.10166 14.5358 5.10166C14.0695 5.10166 13.6137 5.24007 13.226 5.49939C12.8384 5.7587 12.5362 6.12727 12.3579 6.55848C12.1795 6.98968 12.1329 7.46415 12.224 7.92186ZM5.47798 18.5161C5.99754 18.4262 6.4292 18.321 6.69831 18.0511C6.83974 17.9032 7.0897 18.0256 7.07153 18.2311C6.99299 18.8853 6.69667 19.4941 6.23032 19.9593C5.07579 21.1158 0.785726 21.225 0.785726 21.225C0.785726 21.225 0.894746 16.9334 2.04927 15.7768C2.51439 15.3115 3.12167 15.0153 3.77443 14.9353C3.81912 14.9292 3.86459 14.9374 3.90439 14.9586C3.94419 14.9799 3.97629 15.0131 3.99613 15.0537C4.01597 15.0942 4.02255 15.14 4.01493 15.1845C4.00731 15.229 3.98588 15.2699 3.95368 15.3015C3.80635 15.449 3.56965 16.0767 3.48961 16.5245C3.27991 17.7056 4.31069 18.7152 5.47798 18.5161Z" fill="#000"/>
561 589 </svg>';
@@ -562,29 +590,29 @@
562 590 }
563 591
564 592
565 593 // Upgrade to Pro Notice
566 - public static function upgrade_pro_img_notice( $image ){
594 + public static function adminify_upgrade_pro_img_notice( $image ){
567 595 return '<div class="adminify-pro-notice"><img src="' . esc_url_raw($image ) . '" /></div>';
568 596 }
569 597
570 598 // Upgrade to Pro Notice Class
571 - public static function upgrade_pro_notice_class($notice = '')
599 + public static function upgrade_pro_class($classname = '')
572 600 {
573 - if(empty($notice)){
601 + if(empty($classname)){
574 602 // return ' adminify-depend-visible adminify-depend-on adminify-pro-notice ';
575 603 return ' adminify-pro-feature adminify-pro-notice';
576 604 } else {
577 - echo esc_attr($notice);
605 + echo esc_attr($classname);
578 606 }
579 607 }
580 608
581 609 // Upgrade to Pro Notice
582 - public static function upgrade_pro_notice($custom_message = '', $style='')
610 + public static function adminify_upgrade_pro($custom_message = '', $style='')
583 611 {
584 612
585 613 if (empty($custom_message)) {
586 - $pro_content = '<strong>' . __('(Upgrade to Pro)', 'adminify') . '</strong>';
614 + $pro_content = sprintf(__('<strong>(Upgrade to Pro)</strong>', 'adminify'));
587 615 } else {
588 616 $pro_content = $custom_message;
589 617 }
590 618
@@ -592,13 +620,13 @@
592 620 return '<strong style="font-size:16px;">' . $pro_content . '</strong>';
593 621 }
594 622
595 623 $upgrade_notice_msg = sprintf(
596 - '<div class="adminify-pro-notice adminify-missing-addons"> %1$s %2$s </div>',
597 - self::upgrade_pro_icon(),
598 - self::kses_custom($pro_content)
624 + __('<div class="adminify-pro-notice adminify-missing-addons"> %1$s %2$s </div>', 'adminify'),
625 + self::jltwp_adminify_upgrade_pro_icon(),
626 + self::wp_kses_custom($pro_content)
599 627 );
600 - return self::kses_custom($upgrade_notice_msg);
628 + return self::wp_kses_custom($upgrade_notice_msg);
601 629 }
602 630
603 631
604 632
@@ -641,22 +669,21 @@
641 669 </svg>';
642 670 }
643 671
644 672 /* White Label Upgrade Pro */
645 - public static function white_label_upgrade()
673 + public static function jltwp_adminify_white_label_upgrade()
646 674 {
647 675 ?>
648 676 <div class="wp-adminify-white-label-notice-content">
649 677 <div class="wp-adminify-white-label-notice-logo">
650 - <img src="<?php echo esc_url(PXLBSADMINIFY_ASSETS_IMAGE) . 'logos/logo-text-light.svg'; ?>" alt="<?php echo esc_attr(PXLBSADMINIFY); ?>">
678 + <img src="<?php echo esc_url(WP_ADMINIFY_ASSETS_IMAGE) . 'logos/logo-text-light.svg'; ?>" alt="<?php echo esc_attr(WP_ADMINIFY); ?>">
651 679 </div>
652 680 <h2>
653 - <?php echo wp_kses_post( sprintf(__('Upgrade <span>Pro</span> for White Labeling', 'adminify')) ); ?>
681 + <?php echo sprintf(__('Upgrade <span>Pro</span> for White Labeling', 'adminify')); ?>
654 682 </h2>
655 683 <p>
656 684 <?php
657 - /* translators: %s: Plugin name */
658 - echo wp_kses_post( sprintf(__('<strong>%1$s</strong> can be completely re-branded with your own brand Logo, Name and Author Details. Your clients will never know what tools you are using to build their website and will think that this is your own tool set. White-labeling works as long as your license is active. ', 'adminify'), esc_html(PXLBSADMINIFY)) );
685 + echo sprintf(__('<strong>%1$s</strong> can be completely re-branded with your own brand Logo, Name and Author Details. Your clients will never know what tools you are using to build their website and will think that this is your own tool set. White-labeling works as long as your license is active. ', 'adminify'), esc_html(WP_ADMINIFY));
659 686 ?>
660 687 <br>
661 688 <em><?php esc_html_e('Note: Agency or Higher Plans Only', 'adminify'); ?></em>
662 689 </p>
@@ -670,9 +697,9 @@
670 697
671 698 public static function get_widget_template_options()
672 699 {
673 700 $type = 'widget';
674 - $page_templates = self::get_page_templates($type);
701 + $page_templates = self::jltwp_adminify_get_page_templates($type);
675 702
676 703 $options[-1] = __('Select', 'adminify');
677 704
678 705 if (count($page_templates)) {
@@ -688,9 +715,9 @@
688 715
689 716 public static function get_section_template_options()
690 717 {
691 718 $type = 'section';
692 - $page_templates = self::get_page_templates($type);
719 + $page_templates = self::jltwp_adminify_get_page_templates($type);
693 720
694 721 $options[-1] = __('Select', 'adminify');
695 722
696 723 if (count($page_templates)) {
@@ -706,9 +733,9 @@
706 733
707 734 public static function get_page_template_options()
708 735 {
709 736 $type = 'page';
710 - $page_templates = self::get_page_templates($type);
737 + $page_templates = self::jltwp_adminify_get_page_templates($type);
711 738
712 739 $options[-1] = __('Select', 'adminify');
713 740
714 741 if (count($page_templates)) {
@@ -721,22 +748,14 @@
721 748
722 749 return $options;
723 750 }
724 751
725 - /**
726 - * Common preset CSS variables (padding / sizing / typography
727 - * defaults) shared by every theme preset and by the Pro
728 - * custom-color preset path. Extracted so the Pro filter
729 - * (Pro/Classes/OutputCSS_Body_Pro::build_custom_color_preset())
730 - * can reuse the same defaults instead of re-declaring them.
731 - *
732 - * @return array<string,string>
733 - */
734 - public static function get_common_preset_vars()
752 + public static function get_theme_presets($theme = null)
735 753 {
736 - return [
754 +
755 + $common_var = [
737 756 '--adminify-menu-vertical-padding' => '10px',
738 - '--adminify-menu-horizontal-padding' => '8px',
757 + '--adminify-menu-horizontal-padding' => '8px',
739 758 '--adminify-menu-wrapper-padding-top' => '16px',
740 759 '--adminify-menu-wrapper-padding-right' => '8px',
741 760 '--adminify-menu-wrapper-padding-bottom' => '16px',
742 761 '--adminify-menu-wrapper-padding-left' => '8px',
@@ -744,20 +763,17 @@
744 763 '--adminify-submenu-wrapper-padding-top' => '8px',
745 764 '--adminify-submenu-wrapper-padding-right' => '0px',
746 765 '--adminify-submenu-wrapper-padding-bottom' => '8px',
747 766 '--adminify-submenu-wrapper-padding-left' => '28px',
748 - '--adminify-menu-font-size' => '13px',
749 - '--adminify-menu-line-height' => '20px',
750 - '--adminify-menu-letter-spacing' => '',
751 - '--adminify-menu-width' => '260px',
767 + // '--adminify-menu-text-align' => 'left',
768 + // '--adminify-menu-text-transform' => '',
769 + // '--adminify-menu-text-decoration' => 'none',
770 + '--adminify-menu-font-size' => '13px',
771 + '--adminify-menu-line-height' => '20px',
772 + '--adminify-menu-letter-spacing' => '',
773 + '--adminify-menu-width' => '260px'
752 774 ];
753 - }
754 775
755 - public static function get_theme_presets($theme = null)
756 - {
757 -
758 - $common_var = self::get_common_preset_vars();
759 -
760 776 $presets = [
761 777
762 778 // Base/ Default Preset
763 779 'preset1' => [
@@ -803,9 +819,9 @@
803 819 '--adminify-notif-color' => '#ffffff',
804 820 ],
805 821 ];
806 822
807 - $pro_presets = apply_filters('pxlbsadminify_settings/color_presets', $common_var);
823 + $pro_presets = apply_filters('adminify_settings/color_presets', $common_var);
808 824
809 825 if( !empty(array_key_exists('preset3', $pro_presets)) ) {
810 826 $presets = array_merge($presets, $pro_presets);
811 827 }
@@ -824,14 +840,13 @@
824 840 if (array_key_exists($theme, $presets)) {
825 841 return $presets[$theme];
826 842 }
827 843
828 - // specific preset not found (Pro-only/custom theme saved while Pro add-on inactive).
829 - // Fall back to base preset so core CSS vars (--adminify-menu-width) always emit.
830 - return isset($presets['preset1']) ? $presets['preset1'] : $common_var;
844 + // specific preset not found
845 + return [];
831 846 }
832 847
833 - public static function get_page_templates($type = '')
848 + public static function jltwp_adminify_get_page_templates($type = '')
834 849 {
835 850 $args = [
836 851 'post_type' => 'elementor_library',
837 852 'posts_per_page' => -1,
@@ -837,9 +852,9 @@
837 852 'posts_per_page' => -1,
838 853 ];
839 854
840 855 if ($type) {
841 - $args['tax_query'] = [ // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query -- intentional taxonomy filter on an admin-side query.
856 + $args['tax_query'] = [
842 857 [
843 858 'taxonomy' => 'elementor_library_type',
844 859 'field' => 'slug',
845 860 'terms' => $type,
@@ -866,79 +881,64 @@
866 881 }
867 882 return '.min' . $ext;
868 883 }
869 884
870 - public static function kses_atts_map(array $attrs)
885 + public static function wp_kses_atts_map(array $attrs)
871 886 {
872 887 return array_fill_keys(array_values($attrs), true);
873 888 }
874 889
875 - public static function kses_allowed_html()
890 + public static function wp_kses_custom($content)
876 891 {
877 - /**
878 - * 'post' returns the tags allowed in post content (a, p, strong, em, etc.),
879 - * which we then extend with the custom tags below (svg, form fields, style).
880 - * https://developer.wordpress.org/reference/functions/wp_kses_allowed_html/
881 - */
882 892 $allowed_tags = wp_kses_allowed_html('post');
883 - if( !is_array($allowed_tags) ) $allowed_tags = [];
884 893
885 894 $custom_tags = [
886 - 'select' => self::kses_atts_map(['class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'multiple', 'required', 'size']),
887 - 'input' => self::kses_atts_map(['class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'required', 'size', 'type', 'checked', 'readonly', 'placeholder', 'value', 'maxlength', 'min', 'max', 'multiple', 'pattern', 'step', 'autocomplete']),
888 - 'textarea' => self::kses_atts_map(['class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'required', 'rows', 'cols', 'wrap', 'maxlength']),
889 - 'option' => self::kses_atts_map(['class', 'id', 'label', 'disabled', 'label', 'selected', 'value']),
890 - 'optgroup' => self::kses_atts_map(['disabled', 'label', 'class', 'id']),
891 - 'form' => self::kses_atts_map(['class', 'id', 'data', 'style', 'width', 'height', 'accept-charset', 'action', 'autocomplete', 'enctype', 'method', 'name', 'novalidate', 'rel', 'target']),
892 - 'svg' => self::kses_atts_map(['class', 'xmlns', 'viewbox', 'width', 'height', 'fill', 'stroke', 'aria-hidden', 'aria-labelledby', 'role']),
893 - 'rect' => self::kses_atts_map(['rx', 'width', 'height', 'fill']),
894 - 'path' => self::kses_atts_map(['d', 'fill', 'fill-rule', 'clip-rule', 'stroke', 'stroke-width', 'stroke-linecap', 'stroke-linejoin']),
895 - 'g' => self::kses_atts_map(['fill']),
896 - 'defs' => self::kses_atts_map(['fill']),
897 - 'linearGradient' => self::kses_atts_map(['id', 'x1', 'x2', 'y1', 'y2', 'gradientUnits']),
898 - 'stop' => self::kses_atts_map(['stop-color', 'offset', 'stop-opacity']),
899 - 'style' => self::kses_atts_map(['type']),
900 - 'div' => self::kses_atts_map(['class', 'id', 'style']),
901 - 'ul' => self::kses_atts_map(['class', 'id', 'style']),
902 - 'li' => self::kses_atts_map(['class', 'id', 'style']),
903 - 'label' => self::kses_atts_map(['class', 'for']),
904 - 'span' => self::kses_atts_map(['class', 'id', 'style']),
905 - 'h1' => self::kses_atts_map(['class', 'id', 'style']),
906 - 'h2' => self::kses_atts_map(['class', 'id', 'style']),
907 - 'h3' => self::kses_atts_map(['class', 'id', 'style']),
908 - 'h4' => self::kses_atts_map(['class', 'id', 'style']),
909 - 'h5' => self::kses_atts_map(['class', 'id', 'style']),
910 - 'h6' => self::kses_atts_map(['class', 'id', 'style']),
911 - 'a' => self::kses_atts_map(['class', 'href', 'target', 'rel']),
912 - 'p' => self::kses_atts_map(['class', 'id', 'style', 'data']),
913 - 'table' => self::kses_atts_map(['class', 'id', 'style']),
914 - 'thead' => self::kses_atts_map(['class', 'id', 'style']),
915 - 'tbody' => self::kses_atts_map(['class', 'id', 'style']),
916 - 'tr' => self::kses_atts_map(['class', 'id', 'style']),
917 - 'th' => self::kses_atts_map(['class', 'id', 'style']),
918 - 'td' => self::kses_atts_map(['class', 'id', 'style']),
919 - 'i' => self::kses_atts_map(['class', 'id', 'style']),
920 - 'button' => self::kses_atts_map(['class', 'id']),
921 - 'nav' => self::kses_atts_map(['class', 'id', 'style']),
922 - 'time' => self::kses_atts_map(['datetime']),
895 + 'select' => self::wp_kses_atts_map(['class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'multiple', 'required', 'size']),
896 + 'input' => self::wp_kses_atts_map(['class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'required', 'size', 'type', 'checked', 'readonly', 'placeholder', 'value', 'maxlength', 'min', 'max', 'multiple', 'pattern', 'step', 'autocomplete']),
897 + 'textarea' => self::wp_kses_atts_map(['class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'required', 'rows', 'cols', 'wrap', 'maxlength']),
898 + 'option' => self::wp_kses_atts_map(['class', 'id', 'label', 'disabled', 'label', 'selected', 'value']),
899 + 'optgroup' => self::wp_kses_atts_map(['disabled', 'label', 'class', 'id']),
900 + 'form' => self::wp_kses_atts_map(['class', 'id', 'data', 'style', 'width', 'height', 'accept-charset', 'action', 'autocomplete', 'enctype', 'method', 'name', 'novalidate', 'rel', 'target']),
901 + 'svg' => self::wp_kses_atts_map(['class', 'xmlns', 'viewbox', 'width', 'height', 'fill', 'aria-hidden', 'aria-labelledby', 'role']),
902 + 'rect' => self::wp_kses_atts_map(['rx', 'width', 'height', 'fill']),
903 + 'path' => self::wp_kses_atts_map(['d', 'fill']),
904 + 'g' => self::wp_kses_atts_map(['fill']),
905 + 'defs' => self::wp_kses_atts_map(['fill']),
906 + 'linearGradient' => self::wp_kses_atts_map(['id', 'x1', 'x2', 'y1', 'y2', 'gradientUnits']),
907 + 'stop' => self::wp_kses_atts_map(['stop-color', 'offset', 'stop-opacity']),
908 + 'style' => self::wp_kses_atts_map(['type']),
909 + 'div' => self::wp_kses_atts_map(['class', 'id', 'style']),
910 + 'ul' => self::wp_kses_atts_map(['class', 'id', 'style']),
911 + 'li' => self::wp_kses_atts_map(['class', 'id', 'style']),
912 + 'label' => self::wp_kses_atts_map(['class', 'for']),
913 + 'span' => self::wp_kses_atts_map(['class', 'id', 'style']),
914 + 'h1' => self::wp_kses_atts_map(['class', 'id', 'style']),
915 + 'h2' => self::wp_kses_atts_map(['class', 'id', 'style']),
916 + 'h3' => self::wp_kses_atts_map(['class', 'id', 'style']),
917 + 'h4' => self::wp_kses_atts_map(['class', 'id', 'style']),
918 + 'h5' => self::wp_kses_atts_map(['class', 'id', 'style']),
919 + 'h6' => self::wp_kses_atts_map(['class', 'id', 'style']),
920 + 'a' => self::wp_kses_atts_map(['class', 'href', 'target', 'rel']),
921 + 'p' => self::wp_kses_atts_map(['class', 'id', 'style', 'data']),
922 + 'table' => self::wp_kses_atts_map(['class', 'id', 'style']),
923 + 'thead' => self::wp_kses_atts_map(['class', 'id', 'style']),
924 + 'tbody' => self::wp_kses_atts_map(['class', 'id', 'style']),
925 + 'tr' => self::wp_kses_atts_map(['class', 'id', 'style']),
926 + 'th' => self::wp_kses_atts_map(['class', 'id', 'style']),
927 + 'td' => self::wp_kses_atts_map(['class', 'id', 'style']),
928 + 'i' => self::wp_kses_atts_map(['class', 'id', 'style']),
929 + 'button' => self::wp_kses_atts_map(['class', 'id']),
930 + 'nav' => self::wp_kses_atts_map(['class', 'id', 'style']),
931 + 'time' => self::wp_kses_atts_map(['datetime']),
923 932 'br' => [],
924 933 'strong' => [],
925 934 'style' => [],
926 - 'img' => self::kses_atts_map(['class', 'src', 'alt', 'height', 'width', 'srcset', 'id', 'loading']),
935 + 'img' => self::wp_kses_atts_map(['class', 'src', 'alt', 'height', 'width', 'srcset', 'id', 'loading']),
927 936 ];
928 937
929 - return array_merge_recursive($allowed_tags, $custom_tags);
930 - }
938 + $allowed_tags = array_merge_recursive($allowed_tags, $custom_tags);
931 939
932 - /**
933 - * Sanitize a string with wp_kses() using the extended allowed-tags list.
934 - *
935 - * @param string $content
936 - * @return string
937 - */
938 - public static function kses_custom($content)
939 - {
940 - return wp_kses( stripslashes_deep($content), self::kses_allowed_html() );
940 + return wp_kses(stripslashes_deep($content), $allowed_tags);
941 941 }
942 942
943 943
944 944 /**
@@ -949,16 +949,16 @@
949 949 * @return void
950 950 */
951 951 public static function missing_plugin_notice( $plugin_name = '' )
952 952 {
953 + /* translators: %s: Plugin Name */
953 954 $missing_plugin_notice = sprintf(
954 - /* translators: 1: Plugin name, 2: Addons/plugins admin page URL, 3: "Install Now" link text */
955 955 __('<strong>"%1$s"</strong> plugin is not Activated! Please install and activate <strong>%1$s</strong> Plugin <p> <a class="adminify-missing-addons" href="%2$s">%3$s</a></p>', 'adminify'),
956 956 esc_html($plugin_name),
957 957 admin_url('admin.php?page=wp-adminify-addons-plugins'),
958 958 __('Install Now', 'adminify')
959 959 );
960 - return '<div class="adminify-missing-addons">' . self::upgrade_pro_icon() . self::kses_custom( $missing_plugin_notice ) . '</div>';
960 + return '<div class="adminify-missing-addons">' . self::jltwp_adminify_upgrade_pro_icon() . self::wp_kses_custom( $missing_plugin_notice ) . '</div>';
961 961 }
962 962
963 963
964 964 /**
@@ -1005,9 +1005,8 @@
1005 1005 * @return void
1006 1006 */
1007 1007 public static function replace_keys($sourceArray, $newArray){
1008 1008 $new_value = [];
1009 - if( ! is_array($sourceArray)) $sourceArray = [];
1010 1009 foreach ($newArray as $key => $value) {
1011 1010 if (!array_key_exists($key, $sourceArray)) {
1012 1011 return $sourceArray;
1013 1012 }
@@ -1162,52 +1161,19 @@
1162 1161
1163 1162 return array_merge_recursive($old_db, $result);
1164 1163 }
1165 1164
1166 - /**
1167 - * Inline "Upgrade to Pro" marker rendered next to a checkbox option
1168 - * label in the free build.
1169 - *
1170 - * Returns the rocket-icon + (Upgrade to Pro) span the settings UI
1171 - * has rendered historically. The
1172 - * Inc/Admin/AdminSettings::render_pro_locked_field() handler
1173 - * detects this span inside a checkbox <li> and strips name= + sets
1174 - * disabled on the enclosed input so the locked option cannot submit
1175 - * a value.
1176 - *
1177 - * Returns an empty string when the Pro plugin is active so the Pro
1178 - * UI is unchanged.
1179 - */
1180 - public static function upgrade_pro_class($inline_badge = false){
1181 - if (function_exists('jltwp_adminify') && jltwp_adminify()->can_use_premium_code__premium_only()) {
1182 - return '';
1183 - }
1184 - if (!empty($inline_badge)){
1165 + public static function adminify_upgrade_pro_class($inline_badge=false){
1166 + if(!empty($inline_badge)){
1185 1167 return '<span class="adminify-pro-checkbox adminify-pro-badge adminify-pro-notice">Pro</span>';
1186 1168 }
1187 - return '<span class="adminify-pro-checkbox">' . self::upgrade_pro_icon() . ' <strong>(Upgrade to Pro)</strong>' . '</span>';
1169 + return '<span class="adminify-pro-checkbox">' . self::jltwp_adminify_upgrade_pro_icon() . ' <strong>(Upgrade to Pro)</strong>' . '</span>';
1188 1170 }
1189 1171
1190 - /**
1191 - * Inline "Pro" badge rendered next to a field title in the free
1192 - * build.
1193 - *
1194 - * Returns the legacy <span class="adminify-pro-badge">Pro</span>
1195 - * markup. The render handler detects fields whose class list
1196 - * contains adminify-pro-fieldset / -feature / -notice (the
1197 - * Pro-style classes used alongside this badge) and neutralises
1198 - * the inputs at render time.
1199 - *
1200 - * Returns an empty string when the Pro plugin is active.
1201 - */
1202 - public static function upgrade_pro_badge($badge_text = 'Pro'){
1203 - if (function_exists('jltwp_adminify') && jltwp_adminify()->can_use_premium_code__premium_only()) {
1204 - return '';
1172 + public static function adminify_upgrade_pro_badge($badge_text = 'Pro'){
1173 + if(!empty($badge_text)){
1174 + return '<span class="adminify-pro-badge">' . $badge_text . '</span>';
1205 1175 }
1206 - if (!empty($badge_text)){
1207 - return '<span class="adminify-pro-badge">' . esc_html($badge_text) . '</span>';
1208 - }
1209 - return '';
1210 1176 }
1211 1177
1212 1178 /*
1213 1179 * Compares the version of WordPress running to the $version specified.
@@ -1219,113 +1185,7 @@
1219 1185 */
1220 1186 public static function check_wp_version( $operator = '>', $version = '6.6' ) {
1221 1187 global $wp_version;
1222 1188 return version_compare( $wp_version, $version, $operator );
1223 - }
1224 -
1225 - public static function help_urls($module_name = '', $docs = '', $youtube = '', $facebook_grp = '', $support = '')
1226 - {
1227 - $help_content = '';
1228 -
1229 - // Modules ( sanitize the label so the returned template is safe to echo ).
1230 - // Callers may pass benign markup (e.g. an empty <span></span> used for layout/icons),
1231 - // so use wp_kses_post() — it keeps that markup while stripping scripts. esc_html()
1232 - // would print the tags literally (e.g. "<span></span>" shown as text).
1233 - $module_name = empty($module_name) ? '' : wp_kses_post($module_name);
1234 -
1235 - $help_content_urls = '';
1236 -
1237 - // Docs
1238 - if (!empty($docs)) {
1239 - $help_content_urls .= '<a class="adminify-tag adminify-tag-purple adminify-docs-url" href="' . esc_url( $docs ) . '" target="_blank"> ' . self::docs_icon() . ' Docs</a>';
1240 - }
1241 -
1242 - // youtube
1243 - if (!empty($youtube)) {
1244 - $help_content_urls .= '<a class="adminify-tag adminify-tag-danger adminify-video-url" href="' . esc_url( $youtube ) . '" target="_blank">' . self::video_tutorials_icon() . ' Video Tutorial</a>';
1245 - }
1246 -
1247 - // facebook_grp
1248 - if (!empty($facebook_grp)) {
1249 - $help_content_urls .= '<a class="adminify-tag adminify-tag-primary adminify-fbgroup-url" href="' . esc_url($facebook_grp) . '" target="_blank">' . self::fbgroup_icon() . ' Facebook Group</a>';
1250 - }
1251 -
1252 - // Support
1253 - if ( !empty($support)) {
1254 - $help_content_urls .= '<a class="adminify-tag adminify-tag-secondary adminify-support-url" href="' . esc_url($support) . '" target="_blank">' . self::support_icon() . ' Support</a>';
1255 - }
1256 -
1257 - $help_content = sprintf( '%1$s <div class="adminify-helps">%2$s</div>', $module_name, $help_content_urls );
1258 - return $help_content;
1259 - }
1260 -
1261 - /**
1262 - * Check if the request is coming from an iframe.
1263 - *
1264 - * @param None
1265 - * @throws None
1266 - * @return bool
1267 - */
1268 - public static function is_iframe()
1269 - {
1270 - // Adminify-tagged iframe URL: Templates.php injects a JS interceptor that
1271 - // rewrites every iframe src to include ?adminify-iframe=1. Authoritative
1272 - // when present and works regardless of browser headers (covers WordPress
1273 - // Playground where Sec-Fetch-Dest + Referer are stripped by the SW). The
1274 - // param is read-only intent; no sanitization concern beyond isset.
1275 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only flag.
1276 - if ( isset($_GET['adminify-iframe']) ) {
1277 - return true;
1278 - }
1279 - // Fetch Metadata Request Headers (modern browsers): authoritative.
1280 - if ( isset($_SERVER["HTTP_SEC_FETCH_DEST"]) ) {
1281 - return strtolower(sanitize_text_field(wp_unslash($_SERVER["HTTP_SEC_FETCH_DEST"]))) === "iframe";
1282 - }
1283 - // Header absent (older browsers): fall back to a same-host /wp-admin Referer.
1284 - if ( ! empty($_SERVER['HTTP_REFERER']) ) {
1285 - $referer = wp_unslash($_SERVER['HTTP_REFERER']);
1286 - $referer_host = wp_parse_url($referer, PHP_URL_HOST);
1287 - $self_host = isset($_SERVER['HTTP_HOST']) ? sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST'])) : '';
1288 - if ( $referer_host && $self_host && strtolower($referer_host) === strtolower($self_host) && strpos($referer, '/wp-admin') !== false ) {
1289 - return true;
1290 - }
1291 - }
1292 - return false;
1293 - }
1294 -
1295 - /**
1296 - * Load a template file.
1297 - *
1298 - * @param string $template_name The name of the template file to load.
1299 - * @throws None
1300 - * @return void
1301 - */
1302 - public static function load_template($template_name)
1303 - {
1304 - require_once PXLBSADMINIFY_PATH . 'Inc/Admin/Frames/Templates/' . $template_name;
1305 - }
1306 -
1307 - /**
1308 - * Multisite Check
1309 - * @param URL
1310 - * @return Admin_URL
1311 - */
1312 - public static function maybe_network_admin_url($url) {
1313 - if ( is_network_admin() ) {
1314 - return network_admin_url($url);
1315 - }
1316 - return admin_url($url);
1317 - }
1318 -
1319 - /**
1320 - * Sluggify a string and replace hyphens with underscores.
1321 - * @param string $string The string to sluggify.
1322 - * @return string The sluggified string with underscores.
1323 - */
1324 - public static function sluggify_with_underscores($string) {
1325 - $slug = sanitize_title($string);
1326 - $slug = str_replace('-', '_', $slug);
1327 -
1328 - return $slug;
1329 1189 }
1330 1190
1331 1191 }