diff --git a/src/Admin/AdminModule.php b/src/Admin/AdminModule.php index ec01d6f6..6e651b10 100644 --- a/src/Admin/AdminModule.php +++ b/src/Admin/AdminModule.php @@ -74,13 +74,6 @@ class AdminModule { */ public $health; - /** - * Admin notices page. - * - * @var AdminNotices - */ - public $notices; - /** * Admin reports page. * @@ -126,7 +119,6 @@ public function __construct( Plugin $plugin ) { $this->settings = new AdminSettings( $plugin ); $this->dashboard = new AdminDashboard(); $this->health = new AdminHealth( $plugin ); - $this->notices = new AdminNotices(); $this->reports = new AdminReports( $plugin ); $this->tour = new AdminTour( $plugin ); diff --git a/src/Admin/AdminNotices.php b/src/Admin/AdminNotices.php deleted file mode 100644 index dba6dace..00000000 --- a/src/Admin/AdminNotices.php +++ /dev/null @@ -1,155 +0,0 @@ - - * @copyright 2005-2023 Pronamic - * @license GPL-3.0-or-later - * @package Pronamic\WordPress\Pay\Admin - */ - -namespace Pronamic\WordPress\Pay\Admin; - -use Pronamic\WordPress\Pay\Plugin; - -/** - * WordPress admin notices - * - * @author Remco Tolsma - * @version 2.2.6 - * @since 3.7.0 - */ -class AdminNotices { - /** - * Construct admin notices. - * - * @link https://github.com/woothemes/woocommerce/blob/2.4.3/includes/admin/class-wc-admin-notices.php - */ - public function __construct() { - // Actions. - add_action( 'admin_init', [ $this, 'admin_init' ] ); - add_action( 'admin_notices', [ $this, 'admin_notices' ], 11 ); - } - - /** - * Admin notices. - * - * @link https://github.com/WordPress/WordPress/blob/4.3.1/wp-admin/admin-header.php#L245-L250 - * @return void - */ - public function admin_notices() { - // Show notices only to options managers (administrators). - if ( ! current_user_can( 'manage_options' ) ) { - return; - } - - // Jetpack. - $screen = get_current_screen(); - - if ( null !== $screen && 'jetpack' === $screen->parent_base ) { - return; - } - - $this->removed_support_notices(); - } - - /** - * Removed support notices. - * - * @link https://github.com/pronamic/wp-pronamic-pay/issues/293 - * @return void - */ - private function removed_support_notices() { - $notifications = []; - - /** - * Filters the removed extensions notifications. - * - * @param AdminNotification[] $notifications Notifications for removed extensions. - */ - $notifications = \apply_filters( 'pronamic_pay_removed_extension_notifications', $notifications ); - - foreach ( $notifications as $notification ) { - $this->removed_support_notice( $notification ); - } - } - - /** - * Removed support notice. - * - * @param AdminNotification $notification Notification. - * @return void - */ - private function removed_support_notice( $notification ) { - if ( ! $notification->is_met() ) { - return; - } - - $is_dismissed = (bool) \get_user_option( 'pronamic_pay_dismissed_notification:' . $notification->get_id(), \get_current_user_id() ); - - if ( true === $is_dismissed ) { - return; - } - - $dismiss_notification_url = \add_query_arg( 'pronamic_pay_dismiss_notification', $notification->get_id() ); - $dismiss_notification_url = \wp_nonce_url( $dismiss_notification_url, 'pronamic_pay_dismiss_notification:' . $notification->get_id(), 'pronamic_pay_dismiss_notification_nonce' ); - - ?> -
-

- — - get_message() ); ?> -

- - -
- false, - 'pronamic_pay_dismiss_notification_nonce' => false, - 'pronamic_pay_dismissed_notification' => $id, - ], - \wp_get_referer() - ); - - \wp_safe_redirect( $url ); - - exit; - } -}