get_label(); } /** * Register tab hooks. Runs only when this tab is the current one. * * @since 4.9.0 */ public function hooks() { add_action( 'wp_mail_smtp_admin_area_enqueue_assets', [ $this, 'enqueue_assets' ] ); } /** * Enqueue the tab's install/activate script and localized strings. * * @since 4.9.0 */ public function enqueue_assets() { wp_enqueue_script( 'wp-mail-smtp-ai-mcp', wp_mail_smtp()->assets_url . '/js/smtp-ai-mcp' . WP::asset_min() . '.js', [ 'jquery', 'wp-mail-smtp-admin' ], WPMS_PLUGIN_VER, true ); wp_localize_script( 'wp-mail-smtp-ai-mcp', 'wp_mail_smtp_ai_mcp', [ 'error_text' => esc_html__( 'Something went wrong. Please try again.', 'wp-mail-smtp' ), ] ); } /** * Resolve the WPVibe install state: not installed, installed but inactive, or active. * * @since 4.9.0 * * @return string One of 'not_installed', 'installed_inactive', 'active'. */ private function get_wpvibe_state() { if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $plugins = get_plugins(); if ( ! array_key_exists( self::WPVIBE_BASENAME, $plugins ) ) { return 'not_installed'; } if ( ! is_plugin_active( self::WPVIBE_BASENAME ) ) { return 'installed_inactive'; } return 'active'; } /** * Output the state-dependent WPVibe CTA button. * * @since 4.9.0 * * @param string $state WPVibe state. * @param bool $can_install Whether the user can install plugins. * @param bool $can_activate Whether the user can activate plugins. * @param string $setup_url WPVibe admin page URL for the active state. */ private function render_cta_button( $state, $can_install, $can_activate, $setup_url ) { if ( $state === 'active' ) { ?> get_wpvibe_state(); $is_pro = wp_mail_smtp()->is_pro(); $can_install = current_user_can( 'install_plugins' ); $can_activate = current_user_can( 'activate_plugins' ); $wpvibe_setup = admin_url( 'admin.php?page=' . self::WPVIBE_PAGE_SLUG ); $pro_badge_url = wp_mail_smtp()->assets_url . '/images/pro-badge-small.svg'; $docs_url = wp_mail_smtp()->get_utm_url( 'https://wpmailsmtp.com/docs/using-wpmailsmtp-with-ai-assistants/', [ 'medium' => 'ai-mcp', 'content' => 'View Abilities API Documentation', ] ); // Icon classes are literal so the Tailwind scanner can generate the Iconify utilities. $cards = [ [ 'icon' => 'wpms:icon-[fa6-solid--rectangle-list]', 'title' => esc_html__( 'Email Logs', 'wp-mail-smtp' ), 'bullets' => [ esc_html__( 'Browse and filter logged emails by status, mailer, date, and recipient', 'wp-mail-smtp' ), esc_html__( "Get a single email's full details and content", 'wp-mail-smtp' ), ], 'pro' => true, ], [ 'icon' => 'wpms:icon-[fa6-solid--chart-column]', 'title' => esc_html__( 'Email Stats', 'wp-mail-smtp' ), 'bullets' => [ esc_html__( 'See aggregate sending stats for any period or date range', 'wp-mail-smtp' ), esc_html__( 'Scope stats to a single mailer and check the success rate', 'wp-mail-smtp' ), ], 'pro' => true, ], [ 'icon' => 'wpms:icon-[fa6-solid--bug]', 'title' => esc_html__( 'Debug Events', 'wp-mail-smtp' ), 'bullets' => [ esc_html__( 'List recorded send errors and debug entries', 'wp-mail-smtp' ), ], 'pro' => false, ], ]; ?>