PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.0
Adminify – White Label, Admin Menu Editor, Login Customizer v4.0
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 +67 -134 4.1.174.0 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,16 +72,12 @@
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
90 81 // Super Admin for Multisite
91 82 if (is_super_admin() && is_multisite()) {
92 83 if (in_array('Super Admin', $restrict_for) || in_array('administrator', $restrict_for)) {
@@ -162,16 +153,13 @@
162 153 if (!is_array($disabled_for)) {
163 154 return false;
164 155 }
165 156
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.
157 + require_once ABSPATH . '/wp-includes/pluggable.php';
158 +
170 159 if (!function_exists('wp_get_current_user')) {
171 160 return false;
172 161 }
173 -
174 162 $current_user = wp_get_current_user();
175 163 $current_name = $current_user->display_name;
176 164 $current_roles = $current_user->roles;
177 165
@@ -253,9 +241,9 @@
253 241 echo esc_html($title);
254 242
255 243 if (is_multisite()) {
256 244 $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. ?>
245 + <?php echo self::wp_kses_custom(self::admin_page_subtitle($text)); ?>
258 246 <?php } ?>
259 247 <?php
260 248 }
261 249
@@ -358,11 +346,9 @@
358 346 * @return boolean
359 347 */
360 348 public static function is_plugin_active( $plugin_path )
361 349 {
362 - if (!function_exists('is_plugin_active')) {
363 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
364 - }
350 + include_once ABSPATH . 'wp-admin/includes/plugin.php';
365 351 return is_plugin_active( $plugin_path );
366 352 }
367 353
368 354 /**
@@ -474,13 +460,13 @@
474 460 foreach ($values as $index => $in) {
475 461 if (is_array($in)) {
476 462 $values[$index] = self::clean_ajax_input($in);
477 463 } else {
478 - $values[$index] = wp_strip_all_tags($in);
464 + $values[$index] = strip_tags($in);
479 465 }
480 466 }
481 467 } else {
482 - $values = wp_strip_all_tags($values);
468 + $values = strip_tags($values);
483 469 }
484 470
485 471 return $values;
486 472 }
@@ -549,9 +535,45 @@
549 535 }
550 536 return $allupdates;
551 537 }
552 538
539 + public static function adminfiy_help_urls($module_name = '', $docs = '', $youtube = '', $facebook_grp = '', $support = '')
540 + {
541 + $help_content = '';
553 542
543 + // Modules
544 + if (empty($module_name)) {
545 + $module_name = '';
546 + } else {
547 + $module_name = $module_name;
548 + }
549 +
550 + $help_content_urls = '';
551 +
552 + // Docs
553 + if (!empty($docs)) {
554 + $help_content_urls .= '<a class="adminify-tag adminify-tag-purple adminify-docs-url" href="' . esc_url( $docs ) . '" target="_blank"> ' . self::docs_icon() . ' Docs</a>';
555 + }
556 +
557 + // youtube
558 + if (!empty($youtube)) {
559 + $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>';
560 + }
561 +
562 + // facebook_grp
563 + if (!empty($facebook_grp)) {
564 + $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>';
565 + }
566 +
567 + // Support
568 + if ( !empty($support)) {
569 + $help_content_urls .= '<a class="adminify-tag adminify-tag-secondary adminify-support-url" href="' . esc_url($support) . '" target="_blank">' . self::support_icon() . ' Support</a>';
570 + }
571 +
572 + $help_content = sprintf( __('%1$s <div class="adminify-helps">%2$s</div>', 'adminify' ), $module_name, $help_content_urls );
573 + return $help_content;
574 + }
575 +
554 576 /**
555 577 * Upgrade Pro Icon
556 578 *
557 579 * @return void
@@ -584,9 +606,9 @@
584 606 public static function adminify_upgrade_pro($custom_message = '', $style='')
585 607 {
586 608
587 609 if (empty($custom_message)) {
588 - $pro_content = '<strong>' . __('(Upgrade to Pro)', 'adminify') . '</strong>';
610 + $pro_content = sprintf(__('<strong>(Upgrade to Pro)</strong>', 'adminify'));
589 611 } else {
590 612 $pro_content = $custom_message;
591 613 }
592 614
@@ -593,10 +615,10 @@
593 615 if($style === 'inline'){
594 616 return '<strong style="font-size:16px;">' . $pro_content . '</strong>';
595 617 }
596 618
597 - $upgrade_notice_msg = sprintf(
598 - '<div class="adminify-pro-notice adminify-missing-addons"> %1$s %2$s </div>',
619 + $upgrade_notice_msg = sprintf(
620 + __('<div class="adminify-pro-notice"> %1$s %2$s </div>', 'adminify'),
599 621 self::jltwp_adminify_upgrade_pro_icon(),
600 622 self::wp_kses_custom($pro_content)
601 623 );
602 624 return self::wp_kses_custom($upgrade_notice_msg);
@@ -651,14 +673,13 @@
651 673 <div class="wp-adminify-white-label-notice-logo">
652 674 <img src="<?php echo esc_url(WP_ADMINIFY_ASSETS_IMAGE) . 'logos/logo-text-light.svg'; ?>" alt="<?php echo esc_attr(WP_ADMINIFY); ?>">
653 675 </div>
654 676 <h2>
655 - <?php echo wp_kses_post( sprintf(__('Upgrade <span>Pro</span> for White Labeling', 'adminify')) ); ?>
677 + <?php echo sprintf(__('Upgrade <span>Pro</span> for White Labeling', 'adminify')); ?>
656 678 </h2>
657 679 <p>
658 680 <?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)) );
681 + 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 682 ?>
662 683 <br>
663 684 <em><?php esc_html_e('Note: Agency or Higher Plans Only', 'adminify'); ?></em>
664 685 </p>
@@ -723,22 +744,14 @@
723 744
724 745 return $options;
725 746 }
726 747
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()
748 + public static function get_theme_presets($theme = null)
737 749 {
738 - return [
750 +
751 + $common_var = [
739 752 '--adminify-menu-vertical-padding' => '10px',
740 - '--adminify-menu-horizontal-padding' => '8px',
753 + '--adminify-menu-horizontal-padding' => '8px',
741 754 '--adminify-menu-wrapper-padding-top' => '16px',
742 755 '--adminify-menu-wrapper-padding-right' => '8px',
743 756 '--adminify-menu-wrapper-padding-bottom' => '16px',
744 757 '--adminify-menu-wrapper-padding-left' => '8px',
@@ -746,20 +759,17 @@
746 759 '--adminify-submenu-wrapper-padding-top' => '8px',
747 760 '--adminify-submenu-wrapper-padding-right' => '0px',
748 761 '--adminify-submenu-wrapper-padding-bottom' => '8px',
749 762 '--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',
763 + // '--adminify-menu-text-align' => 'left',
764 + // '--adminify-menu-text-transform' => '',
765 + // '--adminify-menu-text-decoration' => 'none',
766 + '--adminify-menu-font-size' => '13px',
767 + '--adminify-menu-line-height' => '20px',
768 + '--adminify-menu-letter-spacing' => '',
769 + '--adminify-menu-width' => '260px'
754 770 ];
755 - }
756 771
757 - public static function get_theme_presets($theme = null)
758 - {
759 -
760 - $common_var = self::get_common_preset_vars();
761 -
762 772 $presets = [
763 773
764 774 // Base/ Default Preset
765 775 'preset1' => [
@@ -874,15 +884,9 @@
874 884 }
875 885
876 886 public static function wp_kses_custom($content)
877 887 {
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 = [];
888 + $allowed_tags = wp_kses_allowed_html('post');
885 889
886 890 $custom_tags = [
887 891 'select' => self::wp_kses_atts_map(['class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'multiple', 'required', 'size']),
888 892 '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 +945,10 @@
941 945 * @return void
942 946 */
943 947 public static function missing_plugin_notice( $plugin_name = '' )
944 948 {
949 + /* translators: %s: Plugin Name */
945 950 $missing_plugin_notice = sprintf(
946 - /* translators: 1: Plugin name, 2: Addons/plugins admin page URL, 3: "Install Now" link text */
947 951 __('<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 952 esc_html($plugin_name),
949 953 admin_url('admin.php?page=wp-adminify-addons-plugins'),
950 954 __('Install Now', 'adminify')
@@ -997,9 +1001,8 @@
997 1001 * @return void
998 1002 */
999 1003 public static function replace_keys($sourceArray, $newArray){
1000 1004 $new_value = [];
1001 - if( ! is_array($sourceArray)) $sourceArray = [];
1002 1005 foreach ($newArray as $key => $value) {
1003 1006 if (!array_key_exists($key, $sourceArray)) {
1004 1007 return $sourceArray;
1005 1008 }
@@ -1154,52 +1157,19 @@
1154 1157
1155 1158 return array_merge_recursive($old_db, $result);
1156 1159 }
1157 1160
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)){
1161 + public static function adminify_upgrade_pro_class($inline_badge=false){
1162 + if(!empty($inline_badge)){
1177 1163 return '<span class="adminify-pro-checkbox adminify-pro-badge adminify-pro-notice">Pro</span>';
1178 1164 }
1179 1165 return '<span class="adminify-pro-checkbox">' . self::jltwp_adminify_upgrade_pro_icon() . ' <strong>(Upgrade to Pro)</strong>' . '</span>';
1180 1166 }
1181 1167
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 1168 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 '';
1169 + if(!empty($badge_text)){
1170 + return '<span class="adminify-pro-badge">' . $badge_text . '</span>';
1197 1171 }
1198 - if (!empty($badge_text)){
1199 - return '<span class="adminify-pro-badge">' . esc_html($badge_text) . '</span>';
1200 - }
1201 - return '';
1202 1172 }
1203 1173
1204 1174 /*
1205 1175 * Compares the version of WordPress running to the $version specified.
@@ -1211,44 +1181,7 @@
1211 1181 */
1212 1182 public static function check_wp_version( $operator = '>', $version = '6.6' ) {
1213 1183 global $wp_version;
1214 1184 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 1185 }
1253 1186
1254 1187 }