PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 4.0.1.2
Adminify – White Label, Admin Menu Editor, Login Customizer v4.0.1.2
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/Classes/Tweaks.php +81 -78 4.2.124.0.1.2 View file →
@@ -1,11 +1,11 @@
1 1 <?php
2 2
3 -namespace PXLBSAdminify\Inc\Classes;
3 +namespace WPAdminify\Inc\Classes;
4 4
5 -use PXLBSAdminify\Inc\Utils;
6 -use PXLBSAdminify\Inc\Admin\AdminSettings;
7 -use PXLBSAdminify\Inc\Admin\AdminSettingsModel;
5 +use WPAdminify\Inc\Utils;
6 +use WPAdminify\Inc\Admin\AdminSettings;
7 +use WPAdminify\Inc\Admin\AdminSettingsModel;
8 8
9 9 // no direct access allowed
10 10 if (!defined('ABSPATH')) {
11 11 exit;
@@ -39,9 +39,8 @@
39 39 $this->security_media = $this->options['media_attachments'];
40 40 $this->custom_gravatar = $this->options['custom_gravatar'];
41 41
42 42
43 -
44 43 if (!empty($this->security_head['enable_security_head'])) {
45 44 $this->security_head();
46 45 }
47 46
@@ -57,9 +56,9 @@
57 56
58 57 $this->security_attachments();
59 58
60 59 if(!empty($this->performance['performance_enable'])){
61 - $this->performances();
60 + $this->adminify_performances();
62 61 }
63 62
64 63 // Add Custom Default Gravatar Image
65 64 if (!empty($this->custom_gravatar) && array_key_exists('enable', $this->custom_gravatar)) {
@@ -66,15 +65,14 @@
66 65 // Add Custom Default Gravatar Image
67 66 add_filter('avatar_defaults', [$this, 'add_custom_gravatar_image'], 99);
68 67 }
69 68
70 - // If Admin bar Editor Plugin not Installed
71 - if (! class_exists('\JewelTheme\AdminBarEditor\AdminBarEditor')) {
69 + if( !Utils::is_plugin_active('admin-bar/admin-bar.php') || !Utils::is_plugin_active('admin-bar-pro/admin-bar.php')){
72 70 if (!empty($this->options['white_label']['wordpress']['remove_howdy_msg']) || !empty($this->options['white_label']['wordpress']['change_howdy_text'])) {
73 71 // Change Howdy Text
74 72 // add_action('admin_bar_menu', [$this, 'remove_from_admin_bar'], 999);
75 73 // add_action('admin_bar_menu', [$this, 'clear_node_title'], 999);
76 - add_filter('admin_bar_menu', [$this, 'change_howdy_text'], 9999);
74 + add_filter('admin_bar_menu', [$this, 'adminify_change_howdy_text'], 9999);
77 75 }
78 76 }
79 77
80 78
@@ -159,10 +157,9 @@
159 157
160 158 public function url_redirection(){
161 159 global $wp_query;
162 160 $wp_query->set_404();
163 - wp_safe_redirect(esc_url(home_url()), 301);
164 - exit;
161 + wp_redirect(esc_url(home_url()), 301);
165 162 }
166 163
167 164 public function redirect_to_home(){
168 165 $post_archives_data = $this->security_posts['post_archives_data'];
@@ -213,10 +210,10 @@
213 210 public function security_attachments(){
214 211
215 212 // Add Featured Image or Post Thumbnail to RSS Feed
216 213 if (!empty($this->security_media['thumbnails_rss_feed'])) {
217 - add_filter('the_excerpt_rss', [$this, 'rss_post_thumbnail']);
218 - add_filter('the_content_feed', [$this, 'rss_post_thumbnail']);
214 + add_filter('the_excerpt_rss', [$this, 'jltwp_adminify_rss_post_thumbnail']);
215 + add_filter('the_content_feed', [$this, 'jltwp_adminify_rss_post_thumbnail']);
219 216 }
220 217
221 218 }
222 219
@@ -401,9 +398,9 @@
401 398
402 399 /*
403 400 * Change Howdy Text
404 401 */
405 - public function change_howdy_text($wp_admin_bar)
402 + public function adminify_change_howdy_text($wp_admin_bar)
406 403 {
407 404 // Remove Howdy Message entirely
408 405 if (!empty($this->options['white_label']['wordpress']['remove_howdy_msg'])) {
409 406
@@ -436,9 +433,9 @@
436 433
437 434 if (isset($my_account->title)) {
438 435
439 436 // Replace the "Howdy" text with "Welcome"
440 - $changed_howdy_text = str_replace('Howdy', Utils::kses_custom($this->options['white_label']['wordpress']['change_howdy_text']), $my_account->title);
437 + $changed_howdy_text = str_replace('Howdy', Utils::wp_kses_custom($this->options['white_label']['wordpress']['change_howdy_text']), $my_account->title);
441 438
442 439 // Update the node with the new title
443 440 $wp_admin_bar->add_node([
444 441 'id' => 'my-account',
@@ -542,19 +539,16 @@
542 539
543 540 // Custom Avatars
544 541 public function add_custom_gravatar_image($avatar_defaults)
545 542 {
546 - // Register the avatar images configured by the administrator in the plugin settings.
547 - if ( ! empty( $this->custom_gravatar['image'] ) && is_array( $this->custom_gravatar['image'] ) ) {
548 - foreach ( $this->custom_gravatar['image'] as $value ) {
549 - if ( empty( $value['avatar_image']['url'] ) ) {
550 - continue;
551 - }
552 - $avatar_url = esc_url_raw( $value['avatar_image']['url'] );
553 - $avatar_name = ! empty( $value['avatar_name'] ) ? sanitize_text_field( $value['avatar_name'] ) : __( 'Custom Gravatar', 'adminify' );
554 - $avatar_defaults[ $avatar_url ] = $avatar_name;
555 - }
556 - }
543 + // if (!empty($this->custom_gravatar) && array_key_exists('image', $this->custom_gravatar)) {
544 + // foreach ($this->custom_gravatar['image'] as $key => $value) {
545 + // $avatar_url = esc_url_raw($value['avatar_image']['url']);
546 + // $avatar_defaults[$avatar_url] = $value['avatar_name'];
547 + // }
548 + // }
549 + $custom_avatar_url = 'https://scontent.fzyl2-2.fna.fbcdn.net/v/t39.30808-6/348970682_781621106945149_5992028158112526767_n.jpg?_nc_cat=100&ccb=1-7&_nc_sid=cc71e4&_nc_ohc=gUNSZF2ODw8Q7kNvgG5T48V&_nc_ht=scontent.fzyl2-2.fna&oh=00_AYDLLCAW7eyeRQakH_Fy9R57hYPAekMNIcEHLGi12watcA&oe=66906465'; // Replace with your custom avatar URL
550 + $avatar_defaults[$custom_avatar_url] = 'Custom Gravatar'; // Text to display in the avatar dropdown
557 551
558 552 return $avatar_defaults;
559 553 }
560 554
@@ -626,9 +620,9 @@
626 620 *
627 621 * @param array $rules WordPress rewrite rules.
628 622 * @return array Rewrite rules without embeds rules.
629 623 */
630 - public function disable_embeds_rewrites($rules)
624 + public function adminify_disable_embeds_rewrites($rules)
631 625 {
632 626 foreach ($rules as $rule => $rewrite) {
633 627 if (false !== strpos($rewrite, 'embed=true')) {
634 628 unset($rules[$rule]);
@@ -653,18 +647,18 @@
653 647 } else {
654 648 $target = esc_url(home_url());
655 649 }
656 650
657 - $target = apply_filters('pxlbsadminify_redirect_target', $target);
658 - $status = apply_filters('pxlbsadminify_redirect_status', $this->redirect_status);
651 + $target = apply_filters('wp_adminify_redirect_target', $target);
652 + $status = apply_filters('wp_adminify_redirect_status', $this->redirect_status);
659 653
660 - wp_safe_redirect($target, $status);
661 - exit;
654 + wp_redirect($target, $status);
655 + die();
662 656 }
663 657
664 658
665 659 /* Add Featured Image or Post Thumbnail to RSS Feed */
666 - public function rss_post_thumbnail($content)
660 + public function jltwp_adminify_rss_post_thumbnail($content)
667 661 {
668 662 global $post;
669 663 if (has_post_thumbnail($post->ID)) {
670 664 $content = '<p>' . get_the_post_thumbnail($post->ID) .
@@ -684,12 +678,12 @@
684 678 $u_modified_time = get_the_modified_time('U');
685 679
686 680 if ($u_modified_time >= $u_time + 86400) {
687 681 $custom_content = sprintf(
688 - '<div class="wp-adminify-last-updated"><strong><span>%1$s</span></strong><span>%2$s %3$s</span></div>',
689 - esc_html__('Last Updated on', 'adminify'),
690 - esc_html(get_the_modified_time('F jS, Y')),
691 - esc_html(get_the_modified_time('h:i a'))
682 + __('<div class="wp-adminify-last-updated"><strong><span>%1$s</span></strong><span>%2$s %3$s</span></div>', 'adminify'),
683 + esc_html__('Last Updated on ', 'adminify'),
684 + get_the_modified_time('F jS, Y'),
685 + get_the_modified_time('h:i a')
692 686 );
693 687 return $custom_content . $content;
694 688 }
695 689
@@ -750,9 +744,9 @@
750 744
751 745 if (!is_user_logged_in()) {
752 746
753 747 // This retrieves the /path/file.php?param=val part of the URL
754 - $current_request_uri = isset($_SERVER['REQUEST_URI']) ? sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])) : '';
748 + $current_request_uri = sanitize_text_field($_SERVER['REQUEST_URI']);
755 749
756 750 // for homepage
757 751 if (empty($current_request_uri)) {
758 752 wp_dequeue_style('dashicons');
@@ -790,9 +784,9 @@
790 784 }
791 785 }
792 786
793 787 /** Browser Cache Expires & GZIP Compression **/
794 - public function htaccess()
788 + public function jltwp_adminify_htaccess()
795 789 {
796 790 // We get the main WordPress .htaccess filepath.
797 791 $ruta_htaccess = get_home_path() . '.htaccess'; // https://codex.wordpress.org/Function_Reference/get_home_path !
798 792
@@ -823,9 +817,9 @@
823 817 $lineas[] = 'AddOutputFilterByType DEFLATE font/otf font/opentype application/font-otf application/x-font-otf';
824 818 $lineas[] = 'AddOutputFilterByType DEFLATE font/ttf font/truetype application/font-ttf application/x-font-ttf';
825 819 $lineas[] = '</IfModule>';
826 820
827 - insert_with_markers($ruta_htaccess, 'Adminify by Jewel Theme', $lineas); // https://developer.wordpress.org/reference/functions/insert_with_markers/ !
821 + insert_with_markers($ruta_htaccess, 'WP Adminify by Jewel Theme', $lineas); // https://developer.wordpress.org/reference/functions/insert_with_markers/ !
828 822 }
829 823
830 824
831 825 /**
@@ -834,67 +828,76 @@
834 828 * @access public
835 829 * @since 1.0.0
836 830 * @return void
837 831 */
838 - public function performances()
832 + public function adminify_performances()
839 833 {
840 834 $performance_data = $this->performance['performance_data'];
841 835
842 836 // Remove jQuery Migrate
837 + if (!empty($this->performance_data)) {
843 838
844 - // Remove Dashicons from Frontend
845 - if (!empty($performance_data) && in_array('dashicons', $performance_data)) {
846 - add_action('wp_print_styles', [$this, 'remove_dashicons'], 100);
847 - }
839 + // Remove Dashicons from Frontend
840 + if (!empty($performance_data) && in_array('dashicons', $performance_data)) {
841 + add_action('wp_print_styles', [$this, 'jltwp_adminify_remove_dashicons'], 100);
842 + }
848 843
849 - /** Remove Version Query Strings from Scripts/Styles */
850 - if (!empty($performance_data) && in_array('version_strings', $performance_data)) {
851 - if(!is_admin()){
844 + /** Remove Version Query Strings from Scripts/Styles */
845 + if (!empty($performance_data) && in_array('version_strings', $performance_data)) {
852 846 add_filter('script_loader_src', [$this, 'remove_script_versions'], 15, 1);
853 847 add_filter('style_loader_src', [$this, 'remove_script_versions'], 15, 1);
854 848 }
855 - }
856 849
857 850
858 - // Remove Emoji Styles and Scripts
859 - if (!empty($performance_data) && in_array('emoji', $performance_data)) {
860 - remove_action('wp_head', 'print_emoji_detection_script', 7); // Remove Emoji's Styles and Scripts.
861 - remove_action('embed_head', 'print_emoji_detection_script');
862 - remove_action('embeded_head', 'print_emoji_detection_script');
863 - remove_action('admin_print_scripts', 'print_emoji_detection_script'); // Remove Emoji's Styles and Scripts.
864 - remove_action('wp_print_styles', 'print_emoji_styles'); // Remove Emoji's Styles and Scripts.
865 - remove_action('admin_print_styles', 'print_emoji_styles'); // Remove Emoji's Styles and Scripts.
866 - remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
867 - remove_filter('the_content_feed', 'wp_staticize_emoji');
868 - remove_filter('comment_text_rss', 'wp_staticize_emoji');
869 - add_filter('option_use_smilies', '__return_false');
870 - add_filter('emoji_svg_url', '__return_false');
871 - add_action('admin_init', [$this, 'remove_admin_emojis']);
872 - add_filter('tiny_mce_plugins', [$this, 'disable_emojicons_tinymce']);
873 - add_filter('wp_resource_hints', [$this, 'remove_dns_prefetch'], 10, 2);
874 - }
851 + // Remove Emoji Styles and Scripts
852 + if (!empty($performance_data) && in_array('emoji', $performance_data)) {
853 + remove_action('wp_head', 'print_emoji_detection_script', 7); // Remove Emoji's Styles and Scripts.
854 + remove_action('embed_head', 'print_emoji_detection_script');
855 + remove_action('embeded_head', 'print_emoji_detection_script');
856 + remove_action('admin_print_scripts', 'print_emoji_detection_script'); // Remove Emoji's Styles and Scripts.
857 + remove_action('wp_print_styles', 'print_emoji_styles'); // Remove Emoji's Styles and Scripts.
858 + remove_action('admin_print_styles', 'print_emoji_styles'); // Remove Emoji's Styles and Scripts.
859 + remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
860 + remove_filter('the_content_feed', 'wp_staticize_emoji');
861 + remove_filter('comment_text_rss', 'wp_staticize_emoji');
862 + add_filter('option_use_smilies', '__return_false');
863 + add_filter('emoji_svg_url', '__return_false');
864 + add_action('admin_init', [$this, 'remove_admin_emojis']);
865 + add_filter('tiny_mce_plugins', [$this, 'disable_emojicons_tinymce']);
866 + add_filter('wp_resource_hints', [$this, 'remove_dns_prefetch'], 10, 2);
867 + }
875 868
876 869
877 870
878 - add_action('wp_default_scripts', [$this, 'remove_wp_default_scripts'], 9999);
871 + add_action('wp_default_scripts', [$this, 'remove_wp_default_scripts'], 9999);
879 872
880 - /** Secure method for Defer Parsing of JavaScript moving ALL JS from Header to Footer */
881 - if (in_array('defer_parsing_js_footer', $performance_data)) {
882 - add_filter('script_loader_tag', [$this, 'defer_parsing_of_js'], 10, 2);
883 - }
873 + /** Secure method for Defer Parsing of JavaScript moving ALL JS from Header to Footer */
874 + if (in_array('defer_parsing_js_footer', $performance_data)) {
875 + add_filter('script_loader_tag', [$this, 'defer_parsing_of_js'], 10, 2);
876 + }
884 877
885 - /** Browser Cache Expires & GZIP Compression */
886 - if (in_array('cache_gzip_compression', $performance_data)) {
887 - register_activation_hook(__FILE__, [$this, 'htaccess']);
888 - }
878 + /** Browser Cache Expires & GZIP Compression */
879 + if (in_array('cache_gzip_compression', $performance_data)) {
880 + register_activation_hook(__FILE__, [$this, 'jltwp_adminify_htaccess']);
881 + }
889 882
890 883
891 - // Remove Gravatar Query Strings
892 - if (!empty($performance_data) && in_array('gravatar_query_strings', $performance_data)) {
893 - add_filter('get_avatar_url', [$this, 'remove_avatar_query_string']);
884 + // Remove Gravatar Query Strings
885 + if (!empty($performance_data) && in_array('gravatar_query_strings', $performance_data)) {
886 + add_filter('get_avatar_url', [$this, 'remove_avatar_query_string']);
887 + }
888 +
894 889 }
895 890 }
896 891
892 + /** Remove Dashicons from Admin Bar for non logged in users **/
893 + public function jltwp_adminify_remove_dashicons()
894 + {
895 + wp_dequeue_style('dashicons');
896 + wp_deregister_style('dashicons');
897 + }
898 +
899 +
897 900 /* Remove Gravatar Query Strings */
898 901 public function remove_avatar_query_string($url)
899 902 {
900 903 $url_parts = explode('?', $url);
@@ -911,9 +914,9 @@
911 914
912 915 /** Secure method for Defer Parsing of JavaScript moving ALL JS from Header to Footer **/
913 916 public function defer_parsing_of_js($tag, $handle)
914 917 {
915 - $skip = apply_filters('pxlbsadminify_defer_skip', false, $tag, $handle);
918 + $skip = apply_filters('wp_adminify_defer_skip', false, $tag, $handle);
916 919
917 920 if ($skip) {
918 921 return $tag;
919 922 }