| @@ -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; |
| @@ -57,9 +57,9 @@ | ||
| 57 | 57 | |
| 58 | 58 | $this->security_attachments(); |
| 59 | 59 | |
| 60 | 60 | if(!empty($this->performance['performance_enable'])){ |
| 61 | - $this->performances(); | |
| 61 | + $this->adminify_performances(); | |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // Add Custom Default Gravatar Image |
| 65 | 65 | if (!empty($this->custom_gravatar) && array_key_exists('enable', $this->custom_gravatar)) { |
| @@ -72,9 +72,9 @@ | ||
| 72 | 72 | if (!empty($this->options['white_label']['wordpress']['remove_howdy_msg']) || !empty($this->options['white_label']['wordpress']['change_howdy_text'])) { |
| 73 | 73 | // Change Howdy Text |
| 74 | 74 | // add_action('admin_bar_menu', [$this, 'remove_from_admin_bar'], 999); |
| 75 | 75 | // add_action('admin_bar_menu', [$this, 'clear_node_title'], 999); |
| 76 | - add_filter('admin_bar_menu', [$this, 'change_howdy_text'], 9999); | |
| 76 | + add_filter('admin_bar_menu', [$this, 'adminify_change_howdy_text'], 9999); | |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | |
| @@ -159,10 +159,9 @@ | ||
| 159 | 159 | |
| 160 | 160 | public function url_redirection(){ |
| 161 | 161 | global $wp_query; |
| 162 | 162 | $wp_query->set_404(); |
| 163 | - wp_safe_redirect(esc_url(home_url()), 301); | |
| 164 | - exit; | |
| 163 | + wp_redirect(esc_url(home_url()), 301); | |
| 165 | 164 | } |
| 166 | 165 | |
| 167 | 166 | public function redirect_to_home(){ |
| 168 | 167 | $post_archives_data = $this->security_posts['post_archives_data']; |
| @@ -213,10 +212,10 @@ | ||
| 213 | 212 | public function security_attachments(){ |
| 214 | 213 | |
| 215 | 214 | // Add Featured Image or Post Thumbnail to RSS Feed |
| 216 | 215 | 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']); | |
| 216 | + add_filter('the_excerpt_rss', [$this, 'jltwp_adminify_rss_post_thumbnail']); | |
| 217 | + add_filter('the_content_feed', [$this, 'jltwp_adminify_rss_post_thumbnail']); | |
| 219 | 218 | } |
| 220 | 219 | |
| 221 | 220 | } |
| 222 | 221 | |
| @@ -401,9 +400,9 @@ | ||
| 401 | 400 | |
| 402 | 401 | /* |
| 403 | 402 | * Change Howdy Text |
| 404 | 403 | */ |
| 405 | - public function change_howdy_text($wp_admin_bar) | |
| 404 | + public function adminify_change_howdy_text($wp_admin_bar) | |
| 406 | 405 | { |
| 407 | 406 | // Remove Howdy Message entirely |
| 408 | 407 | if (!empty($this->options['white_label']['wordpress']['remove_howdy_msg'])) { |
| 409 | 408 | |
| @@ -436,9 +435,9 @@ | ||
| 436 | 435 | |
| 437 | 436 | if (isset($my_account->title)) { |
| 438 | 437 | |
| 439 | 438 | // 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); | |
| 439 | + $changed_howdy_text = str_replace('Howdy', Utils::wp_kses_custom($this->options['white_label']['wordpress']['change_howdy_text']), $my_account->title); | |
| 441 | 440 | |
| 442 | 441 | // Update the node with the new title |
| 443 | 442 | $wp_admin_bar->add_node([ |
| 444 | 443 | 'id' => 'my-account', |
| @@ -542,19 +541,16 @@ | ||
| 542 | 541 | |
| 543 | 542 | // Custom Avatars |
| 544 | 543 | public function add_custom_gravatar_image($avatar_defaults) |
| 545 | 544 | { |
| 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 | - } | |
| 545 | + // if (!empty($this->custom_gravatar) && array_key_exists('image', $this->custom_gravatar)) { | |
| 546 | + // foreach ($this->custom_gravatar['image'] as $key => $value) { | |
| 547 | + // $avatar_url = esc_url_raw($value['avatar_image']['url']); | |
| 548 | + // $avatar_defaults[$avatar_url] = $value['avatar_name']; | |
| 549 | + // } | |
| 550 | + // } | |
| 551 | + $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 | |
| 552 | + $avatar_defaults[$custom_avatar_url] = 'Custom Gravatar'; // Text to display in the avatar dropdown | |
| 557 | 553 | |
| 558 | 554 | return $avatar_defaults; |
| 559 | 555 | } |
| 560 | 556 | |
| @@ -626,9 +622,9 @@ | ||
| 626 | 622 | * |
| 627 | 623 | * @param array $rules WordPress rewrite rules. |
| 628 | 624 | * @return array Rewrite rules without embeds rules. |
| 629 | 625 | */ |
| 630 | - public function disable_embeds_rewrites($rules) | |
| 626 | + public function adminify_disable_embeds_rewrites($rules) | |
| 631 | 627 | { |
| 632 | 628 | foreach ($rules as $rule => $rewrite) { |
| 633 | 629 | if (false !== strpos($rewrite, 'embed=true')) { |
| 634 | 630 | unset($rules[$rule]); |
| @@ -653,18 +649,18 @@ | ||
| 653 | 649 | } else { |
| 654 | 650 | $target = esc_url(home_url()); |
| 655 | 651 | } |
| 656 | 652 | |
| 657 | - $target = apply_filters('pxlbsadminify_redirect_target', $target); | |
| 658 | - $status = apply_filters('pxlbsadminify_redirect_status', $this->redirect_status); | |
| 653 | + $target = apply_filters('wp_adminify_redirect_target', $target); | |
| 654 | + $status = apply_filters('wp_adminify_redirect_status', $this->redirect_status); | |
| 659 | 655 | |
| 660 | - wp_safe_redirect($target, $status); | |
| 661 | - exit; | |
| 656 | + wp_redirect($target, $status); | |
| 657 | + die(); | |
| 662 | 658 | } |
| 663 | 659 | |
| 664 | 660 | |
| 665 | 661 | /* Add Featured Image or Post Thumbnail to RSS Feed */ |
| 666 | - public function rss_post_thumbnail($content) | |
| 662 | + public function jltwp_adminify_rss_post_thumbnail($content) | |
| 667 | 663 | { |
| 668 | 664 | global $post; |
| 669 | 665 | if (has_post_thumbnail($post->ID)) { |
| 670 | 666 | $content = '<p>' . get_the_post_thumbnail($post->ID) . |
| @@ -684,12 +680,12 @@ | ||
| 684 | 680 | $u_modified_time = get_the_modified_time('U'); |
| 685 | 681 | |
| 686 | 682 | if ($u_modified_time >= $u_time + 86400) { |
| 687 | 683 | $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')) | |
| 684 | + __('<div class="wp-adminify-last-updated"><strong><span>%1$s</span></strong><span>%2$s %3$s</span></div>', 'adminify'), | |
| 685 | + esc_html__('Last Updated on ', 'adminify'), | |
| 686 | + get_the_modified_time('F jS, Y'), | |
| 687 | + get_the_modified_time('h:i a') | |
| 692 | 688 | ); |
| 693 | 689 | return $custom_content . $content; |
| 694 | 690 | } |
| 695 | 691 | |
| @@ -743,9 +739,9 @@ | ||
| 743 | 739 | } |
| 744 | 740 | |
| 745 | 741 | |
| 746 | 742 | /** Remove Dashicons from Admin Bar for non logged in users **/ |
| 747 | - public function remove_dashicons() | |
| 743 | + public function jltwp_adminify_remove_dashicons() | |
| 748 | 744 | { |
| 749 | 745 | global $pagenow; |
| 750 | 746 | |
| 751 | 747 | if (!is_user_logged_in()) { |
| @@ -750,9 +746,9 @@ | ||
| 750 | 746 | |
| 751 | 747 | if (!is_user_logged_in()) { |
| 752 | 748 | |
| 753 | 749 | // 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'])) : ''; | |
| 750 | + $current_request_uri = sanitize_text_field($_SERVER['REQUEST_URI']); | |
| 755 | 751 | |
| 756 | 752 | // for homepage |
| 757 | 753 | if (empty($current_request_uri)) { |
| 758 | 754 | wp_dequeue_style('dashicons'); |
| @@ -790,9 +786,9 @@ | ||
| 790 | 786 | } |
| 791 | 787 | } |
| 792 | 788 | |
| 793 | 789 | /** Browser Cache Expires & GZIP Compression **/ |
| 794 | - public function htaccess() | |
| 790 | + public function jltwp_adminify_htaccess() | |
| 795 | 791 | { |
| 796 | 792 | // We get the main WordPress .htaccess filepath. |
| 797 | 793 | $ruta_htaccess = get_home_path() . '.htaccess'; // https://codex.wordpress.org/Function_Reference/get_home_path ! |
| 798 | 794 | |
| @@ -823,9 +819,9 @@ | ||
| 823 | 819 | $lineas[] = 'AddOutputFilterByType DEFLATE font/otf font/opentype application/font-otf application/x-font-otf'; |
| 824 | 820 | $lineas[] = 'AddOutputFilterByType DEFLATE font/ttf font/truetype application/font-ttf application/x-font-ttf'; |
| 825 | 821 | $lineas[] = '</IfModule>'; |
| 826 | 822 | |
| 827 | - insert_with_markers($ruta_htaccess, 'Adminify by Jewel Theme', $lineas); // https://developer.wordpress.org/reference/functions/insert_with_markers/ ! | |
| 823 | + insert_with_markers($ruta_htaccess, 'WP Adminify by Jewel Theme', $lineas); // https://developer.wordpress.org/reference/functions/insert_with_markers/ ! | |
| 828 | 824 | } |
| 829 | 825 | |
| 830 | 826 | |
| 831 | 827 | /** |
| @@ -834,9 +830,9 @@ | ||
| 834 | 830 | * @access public |
| 835 | 831 | * @since 1.0.0 |
| 836 | 832 | * @return void |
| 837 | 833 | */ |
| 838 | - public function performances() | |
| 834 | + public function adminify_performances() | |
| 839 | 835 | { |
| 840 | 836 | $performance_data = $this->performance['performance_data']; |
| 841 | 837 | |
| 842 | 838 | // Remove jQuery Migrate |
| @@ -842,9 +838,9 @@ | ||
| 842 | 838 | // Remove jQuery Migrate |
| 843 | 839 | |
| 844 | 840 | // Remove Dashicons from Frontend |
| 845 | 841 | if (!empty($performance_data) && in_array('dashicons', $performance_data)) { |
| 846 | - add_action('wp_print_styles', [$this, 'remove_dashicons'], 100); | |
| 842 | + add_action('wp_print_styles', [$this, 'jltwp_adminify_remove_dashicons'], 100); | |
| 847 | 843 | } |
| 848 | 844 | |
| 849 | 845 | /** Remove Version Query Strings from Scripts/Styles */ |
| 850 | 846 | if (!empty($performance_data) && in_array('version_strings', $performance_data)) { |
| @@ -883,9 +879,9 @@ | ||
| 883 | 879 | } |
| 884 | 880 | |
| 885 | 881 | /** Browser Cache Expires & GZIP Compression */ |
| 886 | 882 | if (in_array('cache_gzip_compression', $performance_data)) { |
| 887 | - register_activation_hook(__FILE__, [$this, 'htaccess']); | |
| 883 | + register_activation_hook(__FILE__, [$this, 'jltwp_adminify_htaccess']); | |
| 888 | 884 | } |
| 889 | 885 | |
| 890 | 886 | |
| 891 | 887 | // Remove Gravatar Query Strings |
| @@ -911,9 +907,9 @@ | ||
| 911 | 907 | |
| 912 | 908 | /** Secure method for Defer Parsing of JavaScript moving ALL JS from Header to Footer **/ |
| 913 | 909 | public function defer_parsing_of_js($tag, $handle) |
| 914 | 910 | { |
| 915 | - $skip = apply_filters('pxlbsadminify_defer_skip', false, $tag, $handle); | |
| 911 | + $skip = apply_filters('wp_adminify_defer_skip', false, $tag, $handle); | |
| 916 | 912 | |
| 917 | 913 | if ($skip) { |
| 918 | 914 | return $tag; |
| 919 | 915 | } |