slug = $slug; $this->format = $format; // Only show notice if global option not set $global_notice_hidden = get_option('post_smtp_global_recommendation_notice_hidden', false); if ($global_notice_hidden) { $show_admin_notice = false; } add_action('rest_api_init', array($this, 'rest_api_init')); // Register AJAX actions early add_action('wp_ajax_post_smtp_request', array($this, 'request_post_smtp_ajax')); add_action('wp_ajax_nopriv_post_smtp_request', array($this, 'request_post_smtp_ajax')); if ($show_admin_notice || $parent_menu) { add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); add_action('admin_head', array($this, 'admin_head')); if (!function_exists('is_plugin_active')) { require_once(ABSPATH . 'wp-admin/includes/plugin.php'); } foreach ($this->plugins as $plugin) { if (is_plugin_active($plugin)) { break; } else { if ($parent_menu) { if ('login-designer' === $this->slug) { add_action('admin_menu', function () use ($parent_menu) { add_theme_page('SMTP', 'SMTP Free', 'manage_options', "{$this->slug}-recommend-post-smtp", array($this, 'recommend_post_smtp_submenu'), 99); }, 9999); } else { add_action('admin_menu', function () use ($parent_menu) { add_submenu_page( $parent_menu, 'SMTP', 'SMTP Free', 'manage_options', "{$this->slug}-recommend-post-smtp", array($this, 'recommend_post_smtp_submenu'), 99 ); }, 9999); } } if (file_exists(WP_PLUGIN_DIR . "/{$this->plugins[0]}")) { $this->is_installed = true; } break; } } } } /** * Hide the admin notice | Action Callback * * @return void */ public function hide_post_smtp_recommendation_notice() { if (!current_user_can('manage_options') || !isset($_GET['nonce']) || !wp_verify_nonce($_GET['nonce'], 'hide-post-smtp-recommendation-notice')) { wp_die(__('Security Check.', 'file-manager-advanced')); } if (isset($_GET['action']) && $_GET['action'] === 'hide-post-smtp-recommendation-notice') { update_option('post-smtp-recommendation-notice-hidden', true); wp_redirect(wp_get_referer()); } } /** * Display the submenu page for the plugin | Action Callback * * @return void */ public function recommend_post_smtp_submenu() { $button = array( 'text' => 'Install and Activate Post SMTP Now!', 'action' => 'install-plugin_post-smtp', ); if ($this->is_installed) { $button['text'] = 'Activate Post SMTP Now!'; $button['action'] = 'activate-plugin_post-smtp'; } ?>
Post SMTP is #1 SMTP plugin trusted by over 400,000 WordPress sites. Experience flawless email deliverability, detailed email logs, instant failure notifications and much more.
Ensure guaranteed email deliverability with seamless integration to top SMTP services. Manage your emails confidently and ensure they always reach the inbox. Learn more about Post SMTP