| @@ -1,10 +1,13 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -namespace PXLBSAdminify\Inc\Modules\DisableComments; | |
| 3 | +namespace WPAdminify\Inc\Modules\DisableComments; | |
| 4 | 4 | |
| 5 | -use PXLBSAdminify\Inc\Admin\AdminSettings; | |
| 6 | -use PXLBSAdminify\Inc\Admin\AdminSettingsModel; | |
| 5 | +use \Elementor; | |
| 6 | +use WPAdminify\Inc\Utils; | |
| 7 | +use WPAdminify\Inc\Classes\Multisite_Helper; | |
| 8 | +use WPAdminify\Inc\Admin\AdminSettings; | |
| 9 | +use WPAdminify\Inc\Admin\AdminSettingsModel; | |
| 7 | 10 | |
| 8 | 11 | |
| 9 | 12 | // no direct access allowed |
| 10 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -11,9 +14,9 @@ | ||
| 11 | 14 | exit; |
| 12 | 15 | } |
| 13 | 16 | |
| 14 | 17 | /** |
| 15 | - * PXLBSAdminify | |
| 18 | + * WPAdminify | |
| 16 | 19 | * |
| 17 | 20 | * @package Module: Disable Comments |
| 18 | 21 | * |
| 19 | 22 | * @author Jewel Theme <support@jeweltheme.com> |
| @@ -33,11 +36,9 @@ | ||
| 33 | 36 | return; |
| 34 | 37 | } |
| 35 | 38 | |
| 36 | 39 | // Disable Comments |
| 37 | - if(!empty($this->disable_comments['post_types'])){ | |
| 38 | - add_action( 'admin_init', [ $this, 'disable_comments_settings' ] ); // Supported Hooks: 'init', 'admin_init', 'wp_loaded', 'do_meta_boxes' | |
| 39 | - } | |
| 40 | + add_action( 'admin_init', [ $this, 'disable_comments_settings' ] ); // Supported Hooks: 'init', 'admin_init', 'wp_loaded', 'do_meta_boxes' | |
| 40 | 41 | |
| 41 | 42 | |
| 42 | 43 | // Close comments on the front-end |
| 43 | 44 | if (!empty($this->disable_comments['apply_for']) && in_array('close_front', $this->disable_comments['apply_for'])) { |
| @@ -51,10 +52,10 @@ | ||
| 51 | 52 | } |
| 52 | 53 | |
| 53 | 54 | // Remove comments links from admin bar |
| 54 | 55 | if (!empty($this->disable_comments['apply_for']) && in_array('admin_bar', $this->disable_comments['apply_for'])) { |
| 55 | - // add_action('init', [$this, 'disable_comments_admin_bar_menu']); | |
| 56 | - add_action( 'wp_before_admin_bar_render', [ $this, 'remove_admin_bar_menus' ], 0 ); | |
| 56 | + // add_action('init', [$this, 'jltma_adminify_disable_comments_admin_bar_menu']); | |
| 57 | + add_action( 'wp_before_admin_bar_render', [ $this, 'jltma_adminify_remove_admin_bar_menus' ], 0 ); | |
| 57 | 58 | } |
| 58 | 59 | |
| 59 | 60 | // URL field remove from Comments |
| 60 | 61 | if (!empty($this->disable_comments['apply_for']) && in_array('comments_url_field', $this->disable_comments['apply_for'])) { |
| @@ -113,9 +114,9 @@ | ||
| 113 | 114 | |
| 114 | 115 | |
| 115 | 116 | // Remove styles for .recentcomments |
| 116 | 117 | if (!empty($this->disable_comments['apply_for']) && in_array('recentcomments', $this->disable_comments['apply_for'])) { |
| 117 | - add_action('widgets_init', [$this, 'remove_recent_comments_style']); | |
| 118 | + add_action('widgets_init', [$this, 'jltwp_adminify_remove_recent_comments_style']); | |
| 118 | 119 | add_filter( 'show_recent_comments_widget_style', '__return_false' ); |
| 119 | 120 | } |
| 120 | 121 | |
| 121 | 122 | // Redirect any user trying to access comments page. |
| @@ -134,9 +135,9 @@ | ||
| 134 | 135 | add_filter('rest_pre_insert_comment', [$this, 'return_blank_comment'], 10, 2); |
| 135 | 136 | } |
| 136 | 137 | |
| 137 | 138 | // Remove styles for .recentcomments |
| 138 | - public function remove_recent_comments_style() | |
| 139 | + public function jltwp_adminify_remove_recent_comments_style() | |
| 139 | 140 | { |
| 140 | 141 | global $wp_widget_factory; |
| 141 | 142 | remove_action('wp_head', [$wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style']); |
| 142 | 143 | } |
| @@ -188,15 +189,15 @@ | ||
| 188 | 189 | return $defaults; |
| 189 | 190 | } |
| 190 | 191 | |
| 191 | 192 | /* Remove from the administration bar */ |
| 192 | - public function remove_admin_bar_menus() { | |
| 193 | + public function jltma_adminify_remove_admin_bar_menus() { | |
| 193 | 194 | global $wp_admin_bar; |
| 194 | 195 | $wp_admin_bar->remove_menu( 'comments' ); |
| 195 | 196 | } |
| 196 | 197 | |
| 197 | 198 | // Remove Comments Menu |
| 198 | - public function disable_comments_admin_bar_menu() { | |
| 199 | + public function jltma_adminify_disable_comments_admin_bar_menu() { | |
| 199 | 200 | if ( is_admin_bar_showing() ) { |
| 200 | 201 | remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 ); |
| 201 | 202 | } |
| 202 | 203 | } |