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.2 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 All 165 releases
← All changes | Inc/utils.php +70 -133 4.1.174.0.2.5 View file →
@@ -43,9 +43,9 @@
43 43 }
44 44
45 45
46 46 /**
47 - * Check hidden for roles or not
47 + * Check hidden for rules or not
48 48 *
49 49 * @param [type] $value
50 50 *
51 51 * @return bool
@@ -55,15 +55,10 @@
55 55 if (empty($disabled_for)) {
56 56 return false;
57 57 }
58 58
59 - // wp_get_current_user() lives in wp-includes/pluggable.php and is
60 - // always available in normal plugin execution. If it is somehow
61 - // unavailable (e.g. very early bootstrap), bail out instead of
62 - // manually loading core files, which is disallowed by the
63 - // WordPress.org plugin guidelines.
64 59 if (!function_exists('wp_get_current_user')) {
65 - return false;
60 + include ABSPATH . 'wp-includes/pluggable.php';
66 61 }
67 62
68 63 $restrict_for = array();
69 64
@@ -77,17 +72,17 @@
77 72 $current_user = wp_get_current_user();
78 73 $current_name = $current_user->display_name;
79 74 $current_roles = $current_user->roles;
80 75 // $all_roles = wp_roles()->get_names();
81 -
76 +
82 77 if (in_array($current_name, $restrict_for)) {
83 78 return true;
84 79 }
85 -
86 - // if (in_array('Super Admin', $restrict_for) || in_array('administrator', $restrict_for)) {
87 - // return true;
88 - // }
89 80
81 + if (in_array('Super Admin', $restrict_for) || in_array('administrator', $restrict_for)) {
82 + return true;
83 + }
84 +
90 85 // Super Admin for Multisite
91 86 if (is_super_admin() && is_multisite()) {
92 87 if (in_array('Super Admin', $restrict_for) || in_array('administrator', $restrict_for)) {
93 88 return true;
@@ -162,16 +157,13 @@
162 157 if (!is_array($disabled_for)) {
163 158 return false;
164 159 }
165 160
166 - // wp_get_current_user() is provided by wp-includes/pluggable.php and
167 - // is loaded by core early in normal plugin execution. Manually
168 - // loading core files is disallowed by the plugin guidelines, so we
169 - // simply bail out if it is unavailable for any reason.
161 + require_once ABSPATH . '/wp-includes/pluggable.php';
162 +
170 163 if (!function_exists('wp_get_current_user')) {
171 164 return false;
172 165 }
173 -
174 166 $current_user = wp_get_current_user();
175 167 $current_name = $current_user->display_name;
176 168 $current_roles = $current_user->roles;
177 169
@@ -253,9 +245,9 @@
253 245 echo esc_html($title);
254 246
255 247 if (is_multisite()) {
256 248 $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. ?>
249 + <?php echo self::wp_kses_custom(self::admin_page_subtitle($text)); ?>
258 250 <?php } ?>
259 251 <?php
260 252 }
261 253
@@ -358,11 +350,9 @@
358 350 * @return boolean
359 351 */
360 352 public static function is_plugin_active( $plugin_path )
361 353 {
362 - if (!function_exists('is_plugin_active')) {
363 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
364 - }
354 + include_once ABSPATH . 'wp-admin/includes/plugin.php';
365 355 return is_plugin_active( $plugin_path );
366 356 }
367 357
368 358 /**
@@ -474,13 +464,13 @@
474 464 foreach ($values as $index => $in) {
475 465 if (is_array($in)) {
476 466 $values[$index] = self::clean_ajax_input($in);
477 467 } else {
478 - $values[$index] = wp_strip_all_tags($in);
468 + $values[$index] = strip_tags($in);
479 469 }
480 470 }
481 471 } else {
482 - $values = wp_strip_all_tags($values);
472 + $values = strip_tags($values);
483 473 }
484 474
485 475 return $values;
486 476 }
@@ -549,9 +539,45 @@
549 539 }
550 540 return $allupdates;
551 541 }
552 542
543 + public static function adminfiy_help_urls($module_name = '', $docs = '', $youtube = '', $facebook_grp = '', $support = '')
544 + {
545 + $help_content = '';
553 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 +
554 580 /**
555 581 * Upgrade Pro Icon
556 582 *
557 583 * @return void
@@ -584,9 +610,9 @@
584 610 public static function adminify_upgrade_pro($custom_message = '', $style='')
585 611 {
586 612
587 613 if (empty($custom_message)) {
588 - $pro_content = '<strong>' . __('(Upgrade to Pro)', 'adminify') . '</strong>';
614 + $pro_content = sprintf(__('<strong>(Upgrade to Pro)</strong>', 'adminify'));
589 615 } else {
590 616 $pro_content = $custom_message;
591 617 }
592 618
@@ -594,9 +620,9 @@
594 620 return '<strong style="font-size:16px;">' . $pro_content . '</strong>';
595 621 }
596 622
597 623 $upgrade_notice_msg = sprintf(
598 - '<div class="adminify-pro-notice adminify-missing-addons"> %1$s %2$s </div>',
624 + __('<div class="adminify-pro-notice adminify-missing-addons"> %1$s %2$s </div>', 'adminify'),
599 625 self::jltwp_adminify_upgrade_pro_icon(),
600 626 self::wp_kses_custom($pro_content)
601 627 );
602 628 return self::wp_kses_custom($upgrade_notice_msg);
@@ -651,14 +677,13 @@
651 677 <div class="wp-adminify-white-label-notice-logo">
652 678 <img src="<?php echo esc_url(WP_ADMINIFY_ASSETS_IMAGE) . 'logos/logo-text-light.svg'; ?>" alt="<?php echo esc_attr(WP_ADMINIFY); ?>">
653 679 </div>
654 680 <h2>
655 - <?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')); ?>
656 682 </h2>
657 683 <p>
658 684 <?php
659 - /* 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)) );
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));
661 686 ?>
662 687 <br>
663 688 <em><?php esc_html_e('Note: Agency or Higher Plans Only', 'adminify'); ?></em>
664 689 </p>
@@ -723,22 +748,14 @@
723 748
724 749 return $options;
725 750 }
726 751
727 - /**
728 - * Common preset CSS variables (padding / sizing / typography
729 - * defaults) shared by every theme preset and by the Pro
730 - * custom-color preset path. Extracted so the Pro filter
731 - * (Pro/Classes/OutputCSS_Body_Pro::build_custom_color_preset())
732 - * can reuse the same defaults instead of re-declaring them.
733 - *
734 - * @return array<string,string>
735 - */
736 - public static function get_common_preset_vars()
752 + public static function get_theme_presets($theme = null)
737 753 {
738 - return [
754 +
755 + $common_var = [
739 756 '--adminify-menu-vertical-padding' => '10px',
740 - '--adminify-menu-horizontal-padding' => '8px',
757 + '--adminify-menu-horizontal-padding' => '8px',
741 758 '--adminify-menu-wrapper-padding-top' => '16px',
742 759 '--adminify-menu-wrapper-padding-right' => '8px',
743 760 '--adminify-menu-wrapper-padding-bottom' => '16px',
744 761 '--adminify-menu-wrapper-padding-left' => '8px',
@@ -746,20 +763,17 @@
746 763 '--adminify-submenu-wrapper-padding-top' => '8px',
747 764 '--adminify-submenu-wrapper-padding-right' => '0px',
748 765 '--adminify-submenu-wrapper-padding-bottom' => '8px',
749 766 '--adminify-submenu-wrapper-padding-left' => '28px',
750 - '--adminify-menu-font-size' => '13px',
751 - '--adminify-menu-line-height' => '20px',
752 - '--adminify-menu-letter-spacing' => '',
753 - '--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'
754 774 ];
755 - }
756 775
757 - public static function get_theme_presets($theme = null)
758 - {
759 -
760 - $common_var = self::get_common_preset_vars();
761 -
762 776 $presets = [
763 777
764 778 // Base/ Default Preset
765 779 'preset1' => [
@@ -874,15 +888,9 @@
874 888 }
875 889
876 890 public static function wp_kses_custom($content)
877 891 {
878 - /**
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/
884 - if( !is_array($allowed_tags) ) $allowed_tags = [];
892 + $allowed_tags = wp_kses_allowed_html('post');
885 893
886 894 $custom_tags = [
887 895 'select' => self::wp_kses_atts_map(['class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'multiple', 'required', 'size']),
888 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']),
@@ -941,10 +949,10 @@
941 949 * @return void
942 950 */
943 951 public static function missing_plugin_notice( $plugin_name = '' )
944 952 {
953 + /* translators: %s: Plugin Name */
945 954 $missing_plugin_notice = sprintf(
946 - /* translators: 1: Plugin name, 2: Addons/plugins admin page URL, 3: "Install Now" link text */
947 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'),
948 956 esc_html($plugin_name),
949 957 admin_url('admin.php?page=wp-adminify-addons-plugins'),
950 958 __('Install Now', 'adminify')
@@ -997,9 +1005,8 @@
997 1005 * @return void
998 1006 */
999 1007 public static function replace_keys($sourceArray, $newArray){
1000 1008 $new_value = [];
1001 - if( ! is_array($sourceArray)) $sourceArray = [];
1002 1009 foreach ($newArray as $key => $value) {
1003 1010 if (!array_key_exists($key, $sourceArray)) {
1004 1011 return $sourceArray;
1005 1012 }
@@ -1154,52 +1161,19 @@
1154 1161
1155 1162 return array_merge_recursive($old_db, $result);
1156 1163 }
1157 1164
1158 - /**
1159 - * Inline "Upgrade to Pro" marker rendered next to a checkbox option
1160 - * label in the free build.
1161 - *
1162 - * Returns the rocket-icon + (Upgrade to Pro) span the settings UI
1163 - * has rendered historically. The
1164 - * Inc/Admin/AdminSettings::adminify_render_pro_locked_field() handler
1165 - * detects this span inside a checkbox <li> and strips name= + sets
1166 - * disabled on the enclosed input so the locked option cannot submit
1167 - * a value.
1168 - *
1169 - * Returns an empty string when the Pro plugin is active so the Pro
1170 - * UI is unchanged.
1171 - */
1172 - public static function adminify_upgrade_pro_class($inline_badge = false){
1173 - if (function_exists('jltwp_adminify') && jltwp_adminify()->can_use_premium_code__premium_only()) {
1174 - return '';
1175 - }
1176 - if (!empty($inline_badge)){
1165 + public static function adminify_upgrade_pro_class($inline_badge=false){
1166 + if(!empty($inline_badge)){
1177 1167 return '<span class="adminify-pro-checkbox adminify-pro-badge adminify-pro-notice">Pro</span>';
1178 1168 }
1179 1169 return '<span class="adminify-pro-checkbox">' . self::jltwp_adminify_upgrade_pro_icon() . ' <strong>(Upgrade to Pro)</strong>' . '</span>';
1180 1170 }
1181 1171
1182 - /**
1183 - * Inline "Pro" badge rendered next to a field title in the free
1184 - * build.
1185 - *
1186 - * Returns the legacy <span class="adminify-pro-badge">Pro</span>
1187 - * markup. The render handler detects fields whose class list
1188 - * contains adminify-pro-fieldset / -feature / -notice (the
1189 - * Pro-style classes used alongside this badge) and neutralises
1190 - * the inputs at render time.
1191 - *
1192 - * Returns an empty string when the Pro plugin is active.
1193 - */
1194 1172 public static function adminify_upgrade_pro_badge($badge_text = 'Pro'){
1195 - if (function_exists('jltwp_adminify') && jltwp_adminify()->can_use_premium_code__premium_only()) {
1196 - return '';
1173 + if(!empty($badge_text)){
1174 + return '<span class="adminify-pro-badge">' . $badge_text . '</span>';
1197 1175 }
1198 - if (!empty($badge_text)){
1199 - return '<span class="adminify-pro-badge">' . esc_html($badge_text) . '</span>';
1200 - }
1201 - return '';
1202 1176 }
1203 1177
1204 1178 /*
1205 1179 * Compares the version of WordPress running to the $version specified.
@@ -1211,44 +1185,7 @@
1211 1185 */
1212 1186 public static function check_wp_version( $operator = '>', $version = '6.6' ) {
1213 1187 global $wp_version;
1214 1188 return version_compare( $wp_version, $version, $operator );
1215 - }
1216 -
1217 - public static function adminfiy_help_urls($module_name = '', $docs = '', $youtube = '', $facebook_grp = '', $support = '')
1218 - {
1219 - $help_content = '';
1220 -
1221 - // Modules
1222 - if (empty($module_name)) {
1223 - $module_name = '';
1224 - } else {
1225 - $module_name = $module_name;
1226 - }
1227 -
1228 - $help_content_urls = '';
1229 -
1230 - // Docs
1231 - if (!empty($docs)) {
1232 - $help_content_urls .= '<a class="adminify-tag adminify-tag-purple adminify-docs-url" href="' . esc_url( $docs ) . '" target="_blank"> ' . self::docs_icon() . ' Docs</a>';
1233 - }
1234 -
1235 - // youtube
1236 - if (!empty($youtube)) {
1237 - $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>';
1238 - }
1239 -
1240 - // facebook_grp
1241 - if (!empty($facebook_grp)) {
1242 - $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>';
1243 - }
1244 -
1245 - // Support
1246 - if ( !empty($support)) {
1247 - $help_content_urls .= '<a class="adminify-tag adminify-tag-secondary adminify-support-url" href="' . esc_url($support) . '" target="_blank">' . self::support_icon() . ' Support</a>';
1248 - }
1249 -
1250 - $help_content = sprintf( '%1$s <div class="adminify-helps">%2$s</div>', $module_name, $help_content_urls );
1251 - return $help_content;
1252 1189 }
1253 1190
1254 1191 }