is_minimum_php_version() ) { $this->admin_notice_hooks(); return; } } /** * Initializes actions for the admin notice if the plugin can't load. */ protected function admin_notice_hooks() { global $pagenow; if ( 'plugins.php' === $pagenow ) { add_action( 'admin_notices', [ $this, 'admin_notice' ] ); add_action( 'network_admin_notices', [ $this, 'admin_notice' ] ); } } /** * Shows an admin notice if the plugin can't load. */ protected function admin_notice() { if ( ! is_admin() ) { return; } elseif ( ! is_user_logged_in() ) { return; } elseif ( ! current_user_can( 'update_core' ) ) { return; } $message = $this->get_loading_error(); if ( $message ) { echo '
' . sprintf( $message ) . '
'; echo '