PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.2.4
Adminify – White Label, Admin Menu Editor, Login Customizer v4.2.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/utils.php +146 -88 4.1.174.2.4 View file →
@@ -1,10 +1,8 @@
1 1 <?php
2 2
3 -namespace WPAdminify\Inc;
3 +namespace PXLBSAdminify\Inc;
4 4
5 -use ReturnTypeWillChange;
6 -use WPAdminify\Inc\Classes\Helper;
7 5 // no direct access allowed
8 6 if (!defined('ABSPATH')) {
9 7 exit;
10 8 }
@@ -229,9 +227,9 @@
229 227 }
230 228
231 229
232 230 // verfiy current page id
233 - public static function jltwp_adminify_currentpage_id($id)
231 + public static function currentpage_id($id)
234 232 {
235 233 if (!function_exists('get_current_screen')) {
236 234 return true;
237 235 }
@@ -248,14 +246,14 @@
248 246 * @return void
249 247 */
250 248 public static function admin_page_title($title = '')
251 249 {
252 - $title = isset($title) && !empty($title) ? $title : WP_ADMINIFY;
250 + $title = isset($title) && !empty($title) ? $title : PXLBSADMINIFY;
253 251 echo esc_html($title);
254 252
255 253 if (is_multisite()) {
256 254 $text = ' | ' . esc_html__('Current Blog ID', 'adminify') . ': ' . get_current_blog_id(); ?>
257 - <?php echo self::wp_kses_custom(self::admin_page_subtitle($text)); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- wp_kses_custom() is a wp_kses() wrapper; output already escaped. ?>
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. ?>
258 256 <?php } ?>
259 257 <?php
260 258 }
261 259
@@ -282,9 +280,9 @@
282 280 $class = str_replace([' ', ',', '.', '"', "'", '/', '\\', '+', '=', ')', '(', '*', '&', '^', '%', '$', '#', '@', '!', '~', '`', '<', '>', '?', '[', ']', '{', '}', '|', ':'], '', $name);
283 281 return $class;
284 282 }
285 283
286 - public static function jltwp_adminify_class_cleanup($string)
284 + public static function class_cleanup($string)
287 285 {
288 286 // Lower case everything
289 287 $string = strtolower($string);
290 288 // Make alphanumeric (removes all other characters)
@@ -402,9 +400,9 @@
402 400 $installed_plugins = get_plugins();
403 401 return isset($installed_plugins[$plugin_file]);
404 402 }
405 403
406 - public static function jltwp_adminify_notification_bar()
404 + public static function notification_bar()
407 405 {
408 406 $plugin_slug = 'adminify-notification-bar';
409 407 $plugin_file = 'adminify-notification-bar/adminify-notification-bar.php';
410 408 $addons_page_url = network_admin_url('admin.php?page=wp-adminify-settings-addons');
@@ -449,9 +447,9 @@
449 447
450 448 public static function get_user_preference($key)
451 449 {
452 450 $userid = get_current_user_id();
453 - $current = get_user_meta($userid, '_wpadminify_preferences', true);
451 + $current = get_user_meta($userid, 'pxlbsadminify_preferences', true);
454 452 $value = false;
455 453
456 454 if (is_array($current)) {
457 455 if (isset($current[$key])) {
@@ -496,9 +494,9 @@
496 494 {
497 495 $returndata = [];
498 496 $returndata['error'] = true;
499 497 $returndata['error_message'] = $message;
500 - return json_encode($returndata);
498 + return wp_json_encode($returndata);
501 499 }
502 500
503 501 /**
504 502 * Get All Updates
@@ -553,11 +551,11 @@
553 551
554 552 /**
555 553 * Upgrade Pro Icon
556 554 *
557 - * @return void
555 + * @return string
558 556 */
559 - public static function jltwp_adminify_upgrade_pro_icon()
557 + public static function upgrade_pro_icon()
560 558 {
561 559 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">
562 560 <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"/>
563 561 </svg>';
@@ -564,25 +562,25 @@
564 562 }
565 563
566 564
567 565 // Upgrade to Pro Notice
568 - public static function adminify_upgrade_pro_img_notice( $image ){
566 + public static function upgrade_pro_img_notice( $image ){
569 567 return '<div class="adminify-pro-notice"><img src="' . esc_url_raw($image ) . '" /></div>';
570 568 }
571 569
572 570 // Upgrade to Pro Notice Class
573 - public static function upgrade_pro_class($classname = '')
571 + public static function upgrade_pro_notice_class($notice = '')
574 572 {
575 - if(empty($classname)){
573 + if(empty($notice)){
576 574 // return ' adminify-depend-visible adminify-depend-on adminify-pro-notice ';
577 575 return ' adminify-pro-feature adminify-pro-notice';
578 576 } else {
579 - echo esc_attr($classname);
577 + echo esc_attr($notice);
580 578 }
581 579 }
582 580
583 581 // Upgrade to Pro Notice
584 - public static function adminify_upgrade_pro($custom_message = '', $style='')
582 + public static function upgrade_pro_notice($custom_message = '', $style='')
585 583 {
586 584
587 585 if (empty($custom_message)) {
588 586 $pro_content = '<strong>' . __('(Upgrade to Pro)', 'adminify') . '</strong>';
@@ -595,12 +593,12 @@
595 593 }
596 594
597 595 $upgrade_notice_msg = sprintf(
598 596 '<div class="adminify-pro-notice adminify-missing-addons"> %1$s %2$s </div>',
599 - self::jltwp_adminify_upgrade_pro_icon(),
600 - self::wp_kses_custom($pro_content)
597 + self::upgrade_pro_icon(),
598 + self::kses_custom($pro_content)
601 599 );
602 - return self::wp_kses_custom($upgrade_notice_msg);
600 + return self::kses_custom($upgrade_notice_msg);
603 601 }
604 602
605 603
606 604
@@ -643,14 +641,14 @@
643 641 </svg>';
644 642 }
645 643
646 644 /* White Label Upgrade Pro */
647 - public static function jltwp_adminify_white_label_upgrade()
645 + public static function white_label_upgrade()
648 646 {
649 647 ?>
650 648 <div class="wp-adminify-white-label-notice-content">
651 649 <div class="wp-adminify-white-label-notice-logo">
652 - <img src="<?php echo esc_url(WP_ADMINIFY_ASSETS_IMAGE) . 'logos/logo-text-light.svg'; ?>" alt="<?php echo esc_attr(WP_ADMINIFY); ?>">
650 + <img src="<?php echo esc_url(PXLBSADMINIFY_ASSETS_IMAGE) . 'logos/logo-text-light.svg'; ?>" alt="<?php echo esc_attr(PXLBSADMINIFY); ?>">
653 651 </div>
654 652 <h2>
655 653 <?php echo wp_kses_post( sprintf(__('Upgrade <span>Pro</span> for White Labeling', 'adminify')) ); ?>
656 654 </h2>
@@ -656,9 +654,9 @@
656 654 </h2>
657 655 <p>
658 656 <?php
659 657 /* translators: %s: Plugin name */
660 - 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(WP_ADMINIFY)) );
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)) );
661 659 ?>
662 660 <br>
663 661 <em><?php esc_html_e('Note: Agency or Higher Plans Only', 'adminify'); ?></em>
664 662 </p>
@@ -672,9 +670,9 @@
672 670
673 671 public static function get_widget_template_options()
674 672 {
675 673 $type = 'widget';
676 - $page_templates = self::jltwp_adminify_get_page_templates($type);
674 + $page_templates = self::get_page_templates($type);
677 675
678 676 $options[-1] = __('Select', 'adminify');
679 677
680 678 if (count($page_templates)) {
@@ -690,9 +688,9 @@
690 688
691 689 public static function get_section_template_options()
692 690 {
693 691 $type = 'section';
694 - $page_templates = self::jltwp_adminify_get_page_templates($type);
692 + $page_templates = self::get_page_templates($type);
695 693
696 694 $options[-1] = __('Select', 'adminify');
697 695
698 696 if (count($page_templates)) {
@@ -708,9 +706,9 @@
708 706
709 707 public static function get_page_template_options()
710 708 {
711 709 $type = 'page';
712 - $page_templates = self::jltwp_adminify_get_page_templates($type);
710 + $page_templates = self::get_page_templates($type);
713 711
714 712 $options[-1] = __('Select', 'adminify');
715 713
716 714 if (count($page_templates)) {
@@ -805,9 +803,9 @@
805 803 '--adminify-notif-color' => '#ffffff',
806 804 ],
807 805 ];
808 806
809 - $pro_presets = apply_filters('adminify_settings/color_presets', $common_var);
807 + $pro_presets = apply_filters('pxlbsadminify_settings/color_presets', $common_var);
810 808
811 809 if( !empty(array_key_exists('preset3', $pro_presets)) ) {
812 810 $presets = array_merge($presets, $pro_presets);
813 811 }
@@ -830,9 +828,9 @@
830 828 // specific preset not found
831 829 return [];
832 830 }
833 831
834 - public static function jltwp_adminify_get_page_templates($type = '')
832 + public static function get_page_templates($type = '')
835 833 {
836 834 $args = [
837 835 'post_type' => 'elementor_library',
838 836 'posts_per_page' => -1,
@@ -838,9 +836,9 @@
838 836 'posts_per_page' => -1,
839 837 ];
840 838
841 839 if ($type) {
842 - $args['tax_query'] = [
840 + $args['tax_query'] = [ // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query -- intentional taxonomy filter on an admin-side query.
843 841 [
844 842 'taxonomy' => 'elementor_library_type',
845 843 'field' => 'slug',
846 844 'terms' => $type,
@@ -867,70 +865,79 @@
867 865 }
868 866 return '.min' . $ext;
869 867 }
870 868
871 - public static function wp_kses_atts_map(array $attrs)
869 + public static function kses_atts_map(array $attrs)
872 870 {
873 871 return array_fill_keys(array_values($attrs), true);
874 872 }
875 873
876 - public static function wp_kses_custom($content)
874 + public static function kses_allowed_html()
877 875 {
878 876 /**
879 - * the context can be different
880 - * 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.
881 - * the post means here it will return all the tags that are allowed in post such as a, p, strong, em etc
882 - */
883 - $allowed_tags = wp_kses_allowed_html('post'); // Details : https://developer.wordpress.org/reference/functions/wp_kses_allowed_html/
877 + * 'post' returns the tags allowed in post content (a, p, strong, em, etc.),
878 + * which we then extend with the custom tags below (svg, form fields, style).
879 + * https://developer.wordpress.org/reference/functions/wp_kses_allowed_html/
880 + */
881 + $allowed_tags = wp_kses_allowed_html('post');
884 882 if( !is_array($allowed_tags) ) $allowed_tags = [];
885 883
886 884 $custom_tags = [
887 - 'select' => self::wp_kses_atts_map(['class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'multiple', 'required', 'size']),
888 - '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']),
889 - 'textarea' => self::wp_kses_atts_map(['class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'required', 'rows', 'cols', 'wrap', 'maxlength']),
890 - 'option' => self::wp_kses_atts_map(['class', 'id', 'label', 'disabled', 'label', 'selected', 'value']),
891 - 'optgroup' => self::wp_kses_atts_map(['disabled', 'label', 'class', 'id']),
892 - 'form' => self::wp_kses_atts_map(['class', 'id', 'data', 'style', 'width', 'height', 'accept-charset', 'action', 'autocomplete', 'enctype', 'method', 'name', 'novalidate', 'rel', 'target']),
893 - 'svg' => self::wp_kses_atts_map(['class', 'xmlns', 'viewbox', 'width', 'height', 'fill', 'aria-hidden', 'aria-labelledby', 'role']),
894 - 'rect' => self::wp_kses_atts_map(['rx', 'width', 'height', 'fill']),
895 - 'path' => self::wp_kses_atts_map(['d', 'fill']),
896 - 'g' => self::wp_kses_atts_map(['fill']),
897 - 'defs' => self::wp_kses_atts_map(['fill']),
898 - 'linearGradient' => self::wp_kses_atts_map(['id', 'x1', 'x2', 'y1', 'y2', 'gradientUnits']),
899 - 'stop' => self::wp_kses_atts_map(['stop-color', 'offset', 'stop-opacity']),
900 - 'style' => self::wp_kses_atts_map(['type']),
901 - 'div' => self::wp_kses_atts_map(['class', 'id', 'style']),
902 - 'ul' => self::wp_kses_atts_map(['class', 'id', 'style']),
903 - 'li' => self::wp_kses_atts_map(['class', 'id', 'style']),
904 - 'label' => self::wp_kses_atts_map(['class', 'for']),
905 - 'span' => self::wp_kses_atts_map(['class', 'id', 'style']),
906 - 'h1' => self::wp_kses_atts_map(['class', 'id', 'style']),
907 - 'h2' => self::wp_kses_atts_map(['class', 'id', 'style']),
908 - 'h3' => self::wp_kses_atts_map(['class', 'id', 'style']),
909 - 'h4' => self::wp_kses_atts_map(['class', 'id', 'style']),
910 - 'h5' => self::wp_kses_atts_map(['class', 'id', 'style']),
911 - 'h6' => self::wp_kses_atts_map(['class', 'id', 'style']),
912 - 'a' => self::wp_kses_atts_map(['class', 'href', 'target', 'rel']),
913 - 'p' => self::wp_kses_atts_map(['class', 'id', 'style', 'data']),
914 - 'table' => self::wp_kses_atts_map(['class', 'id', 'style']),
915 - 'thead' => self::wp_kses_atts_map(['class', 'id', 'style']),
916 - 'tbody' => self::wp_kses_atts_map(['class', 'id', 'style']),
917 - 'tr' => self::wp_kses_atts_map(['class', 'id', 'style']),
918 - 'th' => self::wp_kses_atts_map(['class', 'id', 'style']),
919 - 'td' => self::wp_kses_atts_map(['class', 'id', 'style']),
920 - 'i' => self::wp_kses_atts_map(['class', 'id', 'style']),
921 - 'button' => self::wp_kses_atts_map(['class', 'id']),
922 - 'nav' => self::wp_kses_atts_map(['class', 'id', 'style']),
923 - 'time' => self::wp_kses_atts_map(['datetime']),
885 + 'select' => self::kses_atts_map(['class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'multiple', 'required', 'size']),
886 + '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']),
887 + 'textarea' => self::kses_atts_map(['class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'required', 'rows', 'cols', 'wrap', 'maxlength']),
888 + 'option' => self::kses_atts_map(['class', 'id', 'label', 'disabled', 'label', 'selected', 'value']),
889 + 'optgroup' => self::kses_atts_map(['disabled', 'label', 'class', 'id']),
890 + 'form' => self::kses_atts_map(['class', 'id', 'data', 'style', 'width', 'height', 'accept-charset', 'action', 'autocomplete', 'enctype', 'method', 'name', 'novalidate', 'rel', 'target']),
891 + 'svg' => self::kses_atts_map(['class', 'xmlns', 'viewbox', 'width', 'height', 'fill', 'stroke', 'aria-hidden', 'aria-labelledby', 'role']),
892 + 'rect' => self::kses_atts_map(['rx', 'width', 'height', 'fill']),
893 + 'path' => self::kses_atts_map(['d', 'fill', 'fill-rule', 'clip-rule', 'stroke', 'stroke-width', 'stroke-linecap', 'stroke-linejoin']),
894 + 'g' => self::kses_atts_map(['fill']),
895 + 'defs' => self::kses_atts_map(['fill']),
896 + 'linearGradient' => self::kses_atts_map(['id', 'x1', 'x2', 'y1', 'y2', 'gradientUnits']),
897 + 'stop' => self::kses_atts_map(['stop-color', 'offset', 'stop-opacity']),
898 + 'style' => self::kses_atts_map(['type']),
899 + 'div' => self::kses_atts_map(['class', 'id', 'style']),
900 + 'ul' => self::kses_atts_map(['class', 'id', 'style']),
901 + 'li' => self::kses_atts_map(['class', 'id', 'style']),
902 + 'label' => self::kses_atts_map(['class', 'for']),
903 + 'span' => self::kses_atts_map(['class', 'id', 'style']),
904 + 'h1' => self::kses_atts_map(['class', 'id', 'style']),
905 + 'h2' => self::kses_atts_map(['class', 'id', 'style']),
906 + 'h3' => self::kses_atts_map(['class', 'id', 'style']),
907 + 'h4' => self::kses_atts_map(['class', 'id', 'style']),
908 + 'h5' => self::kses_atts_map(['class', 'id', 'style']),
909 + 'h6' => self::kses_atts_map(['class', 'id', 'style']),
910 + 'a' => self::kses_atts_map(['class', 'href', 'target', 'rel']),
911 + 'p' => self::kses_atts_map(['class', 'id', 'style', 'data']),
912 + 'table' => self::kses_atts_map(['class', 'id', 'style']),
913 + 'thead' => self::kses_atts_map(['class', 'id', 'style']),
914 + 'tbody' => self::kses_atts_map(['class', 'id', 'style']),
915 + 'tr' => self::kses_atts_map(['class', 'id', 'style']),
916 + 'th' => self::kses_atts_map(['class', 'id', 'style']),
917 + 'td' => self::kses_atts_map(['class', 'id', 'style']),
918 + 'i' => self::kses_atts_map(['class', 'id', 'style']),
919 + 'button' => self::kses_atts_map(['class', 'id']),
920 + 'nav' => self::kses_atts_map(['class', 'id', 'style']),
921 + 'time' => self::kses_atts_map(['datetime']),
924 922 'br' => [],
925 923 'strong' => [],
926 924 'style' => [],
927 - 'img' => self::wp_kses_atts_map(['class', 'src', 'alt', 'height', 'width', 'srcset', 'id', 'loading']),
925 + 'img' => self::kses_atts_map(['class', 'src', 'alt', 'height', 'width', 'srcset', 'id', 'loading']),
928 926 ];
929 927
930 - $allowed_tags = array_merge_recursive($allowed_tags, $custom_tags);
928 + return array_merge_recursive($allowed_tags, $custom_tags);
929 + }
931 930
932 - return wp_kses(stripslashes_deep($content), $allowed_tags);
931 + /**
932 + * Sanitize a string with wp_kses() using the extended allowed-tags list.
933 + *
934 + * @param string $content
935 + * @return string
936 + */
937 + public static function kses_custom($content)
938 + {
939 + return wp_kses( stripslashes_deep($content), self::kses_allowed_html() );
933 940 }
934 941
935 942
936 943 /**
@@ -948,9 +955,9 @@
948 955 esc_html($plugin_name),
949 956 admin_url('admin.php?page=wp-adminify-addons-plugins'),
950 957 __('Install Now', 'adminify')
951 958 );
952 - return '<div class="adminify-missing-addons">' . self::jltwp_adminify_upgrade_pro_icon() . self::wp_kses_custom( $missing_plugin_notice ) . '</div>';
959 + return '<div class="adminify-missing-addons">' . self::upgrade_pro_icon() . self::kses_custom( $missing_plugin_notice ) . '</div>';
953 960 }
954 961
955 962
956 963 /**
@@ -1160,9 +1167,9 @@
1160 1167 * label in the free build.
1161 1168 *
1162 1169 * Returns the rocket-icon + (Upgrade to Pro) span the settings UI
1163 1170 * has rendered historically. The
1164 - * Inc/Admin/AdminSettings::adminify_render_pro_locked_field() handler
1171 + * Inc/Admin/AdminSettings::render_pro_locked_field() handler
1165 1172 * detects this span inside a checkbox <li> and strips name= + sets
1166 1173 * disabled on the enclosed input so the locked option cannot submit
1167 1174 * a value.
1168 1175 *
@@ -1168,9 +1175,9 @@
1168 1175 *
1169 1176 * Returns an empty string when the Pro plugin is active so the Pro
1170 1177 * UI is unchanged.
1171 1178 */
1172 - public static function adminify_upgrade_pro_class($inline_badge = false){
1179 + public static function upgrade_pro_class($inline_badge = false){
1173 1180 if (function_exists('jltwp_adminify') && jltwp_adminify()->can_use_premium_code__premium_only()) {
1174 1181 return '';
1175 1182 }
1176 1183 if (!empty($inline_badge)){
@@ -1175,9 +1182,9 @@
1175 1182 }
1176 1183 if (!empty($inline_badge)){
1177 1184 return '<span class="adminify-pro-checkbox adminify-pro-badge adminify-pro-notice">Pro</span>';
1178 1185 }
1179 - return '<span class="adminify-pro-checkbox">' . self::jltwp_adminify_upgrade_pro_icon() . ' <strong>(Upgrade to Pro)</strong>' . '</span>';
1186 + return '<span class="adminify-pro-checkbox">' . self::upgrade_pro_icon() . ' <strong>(Upgrade to Pro)</strong>' . '</span>';
1180 1187 }
1181 1188
1182 1189 /**
1183 1190 * Inline "Pro" badge rendered next to a field title in the free
@@ -1190,9 +1197,9 @@
1190 1197 * the inputs at render time.
1191 1198 *
1192 1199 * Returns an empty string when the Pro plugin is active.
1193 1200 */
1194 - public static function adminify_upgrade_pro_badge($badge_text = 'Pro'){
1201 + public static function upgrade_pro_badge($badge_text = 'Pro'){
1195 1202 if (function_exists('jltwp_adminify') && jltwp_adminify()->can_use_premium_code__premium_only()) {
1196 1203 return '';
1197 1204 }
1198 1205 if (!empty($badge_text)){
@@ -1213,18 +1220,17 @@
1213 1220 global $wp_version;
1214 1221 return version_compare( $wp_version, $version, $operator );
1215 1222 }
1216 1223
1217 - public static function adminfiy_help_urls($module_name = '', $docs = '', $youtube = '', $facebook_grp = '', $support = '')
1224 + public static function help_urls($module_name = '', $docs = '', $youtube = '', $facebook_grp = '', $support = '')
1218 1225 {
1219 1226 $help_content = '';
1220 1227
1221 - // Modules
1222 - if (empty($module_name)) {
1223 - $module_name = '';
1224 - } else {
1225 - $module_name = $module_name;
1226 - }
1228 + // Modules ( sanitize the label so the returned template is safe to echo ).
1229 + // Callers may pass benign markup (e.g. an empty <span></span> used for layout/icons),
1230 + // so use wp_kses_post() — it keeps that markup while stripping scripts. esc_html()
1231 + // would print the tags literally (e.g. "<span></span>" shown as text).
1232 + $module_name = empty($module_name) ? '' : wp_kses_post($module_name);
1227 1233
1228 1234 $help_content_urls = '';
1229 1235
1230 1236 // Docs
@@ -1248,7 +1254,59 @@
1248 1254 }
1249 1255
1250 1256 $help_content = sprintf( '%1$s <div class="adminify-helps">%2$s</div>', $module_name, $help_content_urls );
1251 1257 return $help_content;
1258 + }
1259 +
1260 + /**
1261 + * Check if the request is coming from an iframe.
1262 + *
1263 + * @param None
1264 + * @throws None
1265 + * @return bool
1266 + */
1267 + public static function is_iframe()
1268 + {
1269 + return isset($_SERVER["HTTP_SEC_FETCH_DEST"]) && strtolower(sanitize_text_field(wp_unslash($_SERVER["HTTP_SEC_FETCH_DEST"]))) === "iframe";
1270 + // $isIframe = isset($_SERVER["HTTP_SEC_FETCH_DEST"]) && strtolower($_SERVER["HTTP_SEC_FETCH_DEST"]) === "iframe";
1271 + // if ( $isIframe ) return true;
1272 + // if ( isset($_GET['adminify-iframe']) ) return true;
1273 + // return false;
1274 + }
1275 +
1276 + /**
1277 + * Load a template file.
1278 + *
1279 + * @param string $template_name The name of the template file to load.
1280 + * @throws None
1281 + * @return void
1282 + */
1283 + public static function load_template($template_name)
1284 + {
1285 + require_once PXLBSADMINIFY_PATH . 'Inc/Admin/Frames/Templates/' . $template_name;
1286 + }
1287 +
1288 + /**
1289 + * Multisite Check
1290 + * @param URL
1291 + * @return Admin_URL
1292 + */
1293 + public static function maybe_network_admin_url($url) {
1294 + if ( is_network_admin() ) {
1295 + return network_admin_url($url);
1296 + }
1297 + return admin_url($url);
1298 + }
1299 +
1300 + /**
1301 + * Sluggify a string and replace hyphens with underscores.
1302 + * @param string $string The string to sluggify.
1303 + * @return string The sluggified string with underscores.
1304 + */
1305 + public static function sluggify_with_underscores($string) {
1306 + $slug = sanitize_title($string);
1307 + $slug = str_replace('-', '_', $slug);
1308 +
1309 + return $slug;
1252 1310 }
1253 1311
1254 1312 }