| @@ -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 | |
| @@ -162,12 +157,10 @@ | ||
| 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 | 166 | |
| @@ -253,9 +246,9 @@ | ||
| 253 | 246 | echo esc_html($title); |
| 254 | 247 | |
| 255 | 248 | if (is_multisite()) { |
| 256 | 249 | $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. ?> | |
| 250 | + <?php echo self::wp_kses_custom(self::admin_page_subtitle($text)); ?> | |
| 258 | 251 | <?php } ?> |
| 259 | 252 | <?php |
| 260 | 253 | } |
| 261 | 254 | |
| @@ -358,11 +351,9 @@ | ||
| 358 | 351 | * @return boolean |
| 359 | 352 | */ |
| 360 | 353 | public static function is_plugin_active( $plugin_path ) |
| 361 | 354 | { |
| 362 | - if (!function_exists('is_plugin_active')) { | |
| 363 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 364 | - } | |
| 355 | + include_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 365 | 356 | return is_plugin_active( $plugin_path ); |
| 366 | 357 | } |
| 367 | 358 | |
| 368 | 359 | /** |
| @@ -474,13 +465,13 @@ | ||
| 474 | 465 | foreach ($values as $index => $in) { |
| 475 | 466 | if (is_array($in)) { |
| 476 | 467 | $values[$index] = self::clean_ajax_input($in); |
| 477 | 468 | } else { |
| 478 | - $values[$index] = wp_strip_all_tags($in); | |
| 469 | + $values[$index] = strip_tags($in); | |
| 479 | 470 | } |
| 480 | 471 | } |
| 481 | 472 | } else { |
| 482 | - $values = wp_strip_all_tags($values); | |
| 473 | + $values = strip_tags($values); | |
| 483 | 474 | } |
| 484 | 475 | |
| 485 | 476 | return $values; |
| 486 | 477 | } |
| @@ -549,9 +540,45 @@ | ||
| 549 | 540 | } |
| 550 | 541 | return $allupdates; |
| 551 | 542 | } |
| 552 | 543 | |
| 544 | + public static function adminfiy_help_urls($module_name = '', $docs = '', $youtube = '', $facebook_grp = '', $support = '') | |
| 545 | + { | |
| 546 | + $help_content = ''; | |
| 553 | 547 | |
| 548 | + // Modules | |
| 549 | + if (empty($module_name)) { | |
| 550 | + $module_name = ''; | |
| 551 | + } else { | |
| 552 | + $module_name = $module_name; | |
| 553 | + } | |
| 554 | + | |
| 555 | + $help_content_urls = ''; | |
| 556 | + | |
| 557 | + // Docs | |
| 558 | + if (!empty($docs)) { | |
| 559 | + $help_content_urls .= '<a class="adminify-tag adminify-tag-purple adminify-docs-url" href="' . esc_url( $docs ) . '" target="_blank"> ' . self::docs_icon() . ' Docs</a>'; | |
| 560 | + } | |
| 561 | + | |
| 562 | + // youtube | |
| 563 | + if (!empty($youtube)) { | |
| 564 | + $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>'; | |
| 565 | + } | |
| 566 | + | |
| 567 | + // facebook_grp | |
| 568 | + if (!empty($facebook_grp)) { | |
| 569 | + $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>'; | |
| 570 | + } | |
| 571 | + | |
| 572 | + // Support | |
| 573 | + if ( !empty($support)) { | |
| 574 | + $help_content_urls .= '<a class="adminify-tag adminify-tag-secondary adminify-support-url" href="' . esc_url($support) . '" target="_blank">' . self::support_icon() . ' Support</a>'; | |
| 575 | + } | |
| 576 | + | |
| 577 | + $help_content = sprintf( __('%1$s <div class="adminify-helps">%2$s</div>', 'adminify' ), $module_name, $help_content_urls ); | |
| 578 | + return $help_content; | |
| 579 | + } | |
| 580 | + | |
| 554 | 581 | /** |
| 555 | 582 | * Upgrade Pro Icon |
| 556 | 583 | * |
| 557 | 584 | * @return void |
| @@ -584,9 +611,9 @@ | ||
| 584 | 611 | public static function adminify_upgrade_pro($custom_message = '', $style='') |
| 585 | 612 | { |
| 586 | 613 | |
| 587 | 614 | if (empty($custom_message)) { |
| 588 | - $pro_content = '<strong>' . __('(Upgrade to Pro)', 'adminify') . '</strong>'; | |
| 615 | + $pro_content = sprintf(__('<strong>(Upgrade to Pro)</strong>', 'adminify')); | |
| 589 | 616 | } else { |
| 590 | 617 | $pro_content = $custom_message; |
| 591 | 618 | } |
| 592 | 619 | |
| @@ -594,9 +621,9 @@ | ||
| 594 | 621 | return '<strong style="font-size:16px;">' . $pro_content . '</strong>'; |
| 595 | 622 | } |
| 596 | 623 | |
| 597 | 624 | $upgrade_notice_msg = sprintf( |
| 598 | - '<div class="adminify-pro-notice adminify-missing-addons"> %1$s %2$s </div>', | |
| 625 | + __('<div class="adminify-pro-notice adminify-missing-addons"> %1$s %2$s </div>', 'adminify'), | |
| 599 | 626 | self::jltwp_adminify_upgrade_pro_icon(), |
| 600 | 627 | self::wp_kses_custom($pro_content) |
| 601 | 628 | ); |
| 602 | 629 | return self::wp_kses_custom($upgrade_notice_msg); |
| @@ -651,14 +678,13 @@ | ||
| 651 | 678 | <div class="wp-adminify-white-label-notice-logo"> |
| 652 | 679 | <img src="<?php echo esc_url(WP_ADMINIFY_ASSETS_IMAGE) . 'logos/logo-text-light.svg'; ?>" alt="<?php echo esc_attr(WP_ADMINIFY); ?>"> |
| 653 | 680 | </div> |
| 654 | 681 | <h2> |
| 655 | - <?php echo wp_kses_post( sprintf(__('Upgrade <span>Pro</span> for White Labeling', 'adminify')) ); ?> | |
| 682 | + <?php echo sprintf(__('Upgrade <span>Pro</span> for White Labeling', 'adminify')); ?> | |
| 656 | 683 | </h2> |
| 657 | 684 | <p> |
| 658 | 685 | <?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)) ); | |
| 686 | + 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 | 687 | ?> |
| 662 | 688 | <br> |
| 663 | 689 | <em><?php esc_html_e('Note: Agency or Higher Plans Only', 'adminify'); ?></em> |
| 664 | 690 | </p> |
| @@ -723,22 +749,14 @@ | ||
| 723 | 749 | |
| 724 | 750 | return $options; |
| 725 | 751 | } |
| 726 | 752 | |
| 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() | |
| 753 | + public static function get_theme_presets($theme = null) | |
| 737 | 754 | { |
| 738 | - return [ | |
| 755 | + | |
| 756 | + $common_var = [ | |
| 739 | 757 | '--adminify-menu-vertical-padding' => '10px', |
| 740 | - '--adminify-menu-horizontal-padding' => '8px', | |
| 758 | + '--adminify-menu-horizontal-padding' => '8px', | |
| 741 | 759 | '--adminify-menu-wrapper-padding-top' => '16px', |
| 742 | 760 | '--adminify-menu-wrapper-padding-right' => '8px', |
| 743 | 761 | '--adminify-menu-wrapper-padding-bottom' => '16px', |
| 744 | 762 | '--adminify-menu-wrapper-padding-left' => '8px', |
| @@ -746,20 +764,17 @@ | ||
| 746 | 764 | '--adminify-submenu-wrapper-padding-top' => '8px', |
| 747 | 765 | '--adminify-submenu-wrapper-padding-right' => '0px', |
| 748 | 766 | '--adminify-submenu-wrapper-padding-bottom' => '8px', |
| 749 | 767 | '--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', | |
| 768 | + // '--adminify-menu-text-align' => 'left', | |
| 769 | + // '--adminify-menu-text-transform' => '', | |
| 770 | + // '--adminify-menu-text-decoration' => 'none', | |
| 771 | + '--adminify-menu-font-size' => '13px', | |
| 772 | + '--adminify-menu-line-height' => '20px', | |
| 773 | + '--adminify-menu-letter-spacing' => '', | |
| 774 | + '--adminify-menu-width' => '260px' | |
| 754 | 775 | ]; |
| 755 | - } | |
| 756 | 776 | |
| 757 | - public static function get_theme_presets($theme = null) | |
| 758 | - { | |
| 759 | - | |
| 760 | - $common_var = self::get_common_preset_vars(); | |
| 761 | - | |
| 762 | 777 | $presets = [ |
| 763 | 778 | |
| 764 | 779 | // Base/ Default Preset |
| 765 | 780 | 'preset1' => [ |
| @@ -874,15 +889,9 @@ | ||
| 874 | 889 | } |
| 875 | 890 | |
| 876 | 891 | public static function wp_kses_custom($content) |
| 877 | 892 | { |
| 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 = []; | |
| 893 | + $allowed_tags = wp_kses_allowed_html('post'); | |
| 885 | 894 | |
| 886 | 895 | $custom_tags = [ |
| 887 | 896 | 'select' => self::wp_kses_atts_map(['class', 'id', 'style', 'width', 'height', 'title', 'data', 'name', 'autofocus', 'disabled', 'multiple', 'required', 'size']), |
| 888 | 897 | '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 +950,10 @@ | ||
| 941 | 950 | * @return void |
| 942 | 951 | */ |
| 943 | 952 | public static function missing_plugin_notice( $plugin_name = '' ) |
| 944 | 953 | { |
| 954 | + /* translators: %s: Plugin Name */ | |
| 945 | 955 | $missing_plugin_notice = sprintf( |
| 946 | - /* translators: 1: Plugin name, 2: Addons/plugins admin page URL, 3: "Install Now" link text */ | |
| 947 | 956 | __('<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 | 957 | esc_html($plugin_name), |
| 949 | 958 | admin_url('admin.php?page=wp-adminify-addons-plugins'), |
| 950 | 959 | __('Install Now', 'adminify') |
| @@ -997,9 +1006,8 @@ | ||
| 997 | 1006 | * @return void |
| 998 | 1007 | */ |
| 999 | 1008 | public static function replace_keys($sourceArray, $newArray){ |
| 1000 | 1009 | $new_value = []; |
| 1001 | - if( ! is_array($sourceArray)) $sourceArray = []; | |
| 1002 | 1010 | foreach ($newArray as $key => $value) { |
| 1003 | 1011 | if (!array_key_exists($key, $sourceArray)) { |
| 1004 | 1012 | return $sourceArray; |
| 1005 | 1013 | } |
| @@ -1154,52 +1162,19 @@ | ||
| 1154 | 1162 | |
| 1155 | 1163 | return array_merge_recursive($old_db, $result); |
| 1156 | 1164 | } |
| 1157 | 1165 | |
| 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)){ | |
| 1166 | + public static function adminify_upgrade_pro_class($inline_badge=false){ | |
| 1167 | + if(!empty($inline_badge)){ | |
| 1177 | 1168 | return '<span class="adminify-pro-checkbox adminify-pro-badge adminify-pro-notice">Pro</span>'; |
| 1178 | 1169 | } |
| 1179 | 1170 | return '<span class="adminify-pro-checkbox">' . self::jltwp_adminify_upgrade_pro_icon() . ' <strong>(Upgrade to Pro)</strong>' . '</span>'; |
| 1180 | 1171 | } |
| 1181 | 1172 | |
| 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 | 1173 | 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 ''; | |
| 1174 | + if(!empty($badge_text)){ | |
| 1175 | + return '<span class="adminify-pro-badge">' . $badge_text . '</span>'; | |
| 1197 | 1176 | } |
| 1198 | - if (!empty($badge_text)){ | |
| 1199 | - return '<span class="adminify-pro-badge">' . esc_html($badge_text) . '</span>'; | |
| 1200 | - } | |
| 1201 | - return ''; | |
| 1202 | 1177 | } |
| 1203 | 1178 | |
| 1204 | 1179 | /* |
| 1205 | 1180 | * Compares the version of WordPress running to the $version specified. |
| @@ -1211,44 +1186,7 @@ | ||
| 1211 | 1186 | */ |
| 1212 | 1187 | public static function check_wp_version( $operator = '>', $version = '6.6' ) { |
| 1213 | 1188 | global $wp_version; |
| 1214 | 1189 | 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 | 1190 | } |
| 1253 | 1191 | |
| 1254 | 1192 | } |