| 1 |
<?php |
| 2 |
namespace Falcon; |
| 3 |
|
| 4 |
class Admin extends Base { |
| 5 |
protected $features = [ |
| 6 |
'login_site_icon', |
| 7 |
'no_update_nags', |
| 8 |
'no_footer_text', |
| 9 |
'no_dashboard_widgets', |
| 10 |
'no_wp_logo', |
| 11 |
'no_application_passwords', |
| 12 |
]; |
| 13 |
|
| 14 |
public function login_site_icon() { |
| 15 |
new Components\Login; |
| 16 |
} |
| 17 |
|
| 18 |
public function no_update_nags() { |
| 19 |
add_action( 'admin_init', [ $this, 'remove_update_nag' ] ); |
| 20 |
} |
| 21 |
|
| 22 |
public function remove_update_nag() { |
| 23 |
remove_action( 'admin_notices', 'update_nag', 3 ); |
| 24 |
remove_action( 'network_admin_notices', 'update_nag', 3 ); |
| 25 |
} |
| 26 |
|
| 27 |
public function no_footer_text() { |
| 28 |
add_filter( 'admin_footer_text', '__return_empty_string' ); |
| 29 |
add_filter( 'update_footer', '__return_empty_string', 9999 ); |
| 30 |
} |
| 31 |
|
| 32 |
public function no_dashboard_widgets() { |
| 33 |
add_action( 'wp_dashboard_setup', [ $this, 'remove_widgets' ] ); |
| 34 |
} |
| 35 |
public function remove_widgets() { |
| 36 |
remove_action( 'welcome_panel', 'wp_welcome_panel' ); |
| 37 |
|
| 38 |
remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' ); |
| 39 |
remove_meta_box( 'dashboard_activity', 'dashboard', 'normal' ); |
| 40 |
|
| 41 |
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' ); |
| 42 |
remove_meta_box( 'dashboard_primary', 'dashboard', 'side' ); |
| 43 |
|
| 44 |
remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'normal' ); |
| 45 |
remove_meta_box( 'dashboard_secondary', 'dashboard', 'normal' ); |
| 46 |
remove_meta_box( 'dashboard_site_health', 'dashboard', 'normal' ); |
| 47 |
|
| 48 |
// Gutenberg. |
| 49 |
remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' ); |
| 50 |
|
| 51 |
// Popular plugins. |
| 52 |
remove_meta_box( 'wc_admin_dashboard_setup', 'dashboard', 'normal' ); // WooCommerce. |
| 53 |
remove_meta_box( 'themeisle', 'dashboard', 'normal' ); // WP CloudFlare Super Cache. |
| 54 |
remove_meta_box( 'fluentform_stat_widget', 'dashboard', 'normal' ); // Fluent Form. |
| 55 |
remove_meta_box( 'fluentsmtp_reports_widget', 'dashboard', 'normal' ); // Fluent SMTP. |
| 56 |
remove_meta_box( 'jetpack_summary_widget', 'dashboard', 'normal' ); // Jetpack. |
| 57 |
} |
| 58 |
|
| 59 |
public function no_wp_logo() { |
| 60 |
add_action( 'admin_bar_menu', [ $this, 'remove_wp_logo' ], 20 ); |
| 61 |
} |
| 62 |
|
| 63 |
public function remove_wp_logo( $wp_admin_bar ) { |
| 64 |
$wp_admin_bar->remove_node( 'wp-logo' ); |
| 65 |
} |
| 66 |
|
| 67 |
public function no_application_passwords() { |
| 68 |
add_filter( 'wp_is_application_passwords_available', '__return_false' ); |
| 69 |
} |
| 70 |
} |
| 71 |
|