init(); } /** * Initialize the notice */ private function init() { $is_notice_hidden = get_option( 'post-smtp-recommendation-notice-hidden', false ); if( ! $is_notice_hidden ) { add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); add_action( 'admin_head', array( $this, 'admin_head' ) ); add_action( 'admin_notices', array( $this, 'show_notice' ) ); add_action( 'admin_post_hide-post-smtp-recommendation-notice', array( $this, 'hide_post_smtp_recommendation_notice' ) ); add_action( 'rest_api_init', array( $this, 'rest_api_init' ) ); } } /** * Set plugin slug and format */ public function set_plugin_info( $slug, $format = 'png' ) { $this->slug = $slug; $this->format = $format; } /** * Check if any SMTP plugin is active */ private function is_smtp_plugin_active() { if( ! function_exists( 'is_plugin_active' ) ) { require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); } foreach( $this->plugins as $plugin ) { if( is_plugin_active( $plugin ) ) { return true; } } return false; } /** * Display the admin notice */ public function show_notice() { // Don't show if any SMTP plugin is active if( $this->is_smtp_plugin_active() ) { return; } $button = array( 'text' => 'Install & Activate', 'action' => 'install-plugin_post-smtp', ); if( file_exists( WP_PLUGIN_DIR . "/{$this->plugins[0]}" ) ) { $this->is_installed = true; $button['text'] = 'Activate Post SMTP'; $button['action'] = 'activate-plugin_post-smtp'; } ?>
✨ Boost Your Email Delivery with Post SMTP!
Make sure every WordPress email lands safely in your users' inboxes.
Install Post SMTP — trusted by 400,000+ websites for reliable delivery, detailed logs, and instant alerts.