$ai_ok, 'title' => __( 'Connect an AI provider', 'linkcortex' ), 'hint' => $ai_ok ? __( 'AI is connected and ready.', 'linkcortex' ) : ( $status ? $status['message'] : __( 'Open the AI & Cost settings to check your connection. The plugin never asks for API keys: WordPress keeps them in Settings → Connectors.', 'linkcortex' ) ), 'link' => Menu::url( 'settings', array( 'tab' => 'ai' ) ), 'label' => __( 'Check AI connection', 'linkcortex' ), ), array( 'done' => (bool) get_user_meta( $user, self::STEP_TYPES, true ), 'title' => __( 'Choose which content to include', 'linkcortex' ), 'hint' => __( 'Pick the post types that should get links. Fewer types means a cheaper scan.', 'linkcortex' ), 'link' => Menu::url( 'settings', array( 'tab' => 'general' ) ), 'label' => __( 'Choose content', 'linkcortex' ), ), array( 'done' => (bool) get_user_meta( $user, self::STEP_COSTS, true ), 'title' => __( 'See what it will cost', 'linkcortex' ), 'hint' => __( 'Use the calculator and set a monthly budget cap so there are no surprises.', 'linkcortex' ), 'link' => Menu::url( 'settings', array( 'tab' => 'ai' ) ) . '#ailsug-calculator', 'label' => __( 'Open the cost calculator', 'linkcortex' ), ), array( 'done' => $kpis['scans'] > 0, 'title' => __( 'Run your first scan', 'linkcortex' ), 'hint' => __( 'Use the Scan button below. You will see the estimated cost first.', 'linkcortex' ), 'link' => '', 'label' => '', ), ); } /** * Render the checklist unless dismissed or complete. * * @param array $kpis Dashboard KPIs. * @return void */ public static function render( array $kpis ) { if ( get_user_meta( get_current_user_id(), 'ailsug_dismissed_onboarding', true ) ) { return; } $steps = self::steps( $kpis ); $done = count( array_filter( wp_list_pluck( $steps, 'done' ) ) ); if ( count( $steps ) === $done ) { return; } echo '
'; echo '

' . esc_html__( 'Get started', 'linkcortex' ) . '

'; /* translators: 1: done, 2: total. */ echo '

' . esc_html( sprintf( __( '%1$d of %2$d steps done.', 'linkcortex' ), $done, count( $steps ) ) ) . '

    '; foreach ( $steps as $step ) { echo '
  1. '; echo ' '; echo '' . esc_html( $step['title'] ) . ' ' . ( $step['done'] ? esc_html__( '(done)', 'linkcortex' ) : esc_html__( '(not done yet)', 'linkcortex' ) ) . ''; echo '
    ' . esc_html( $step['hint'] ) . ''; if ( ! $step['done'] && '' !== $step['link'] ) { echo ' ' . esc_html( $step['label'] ) . ''; } if ( ! $step['done'] && 0 === $done && 0 === array_search( $step, $steps, true ) && ! Availability::is_available() ) { echo '
    ' . esc_html__( 'Official provider plugins:', 'linkcortex' ) . ' '; $links = array(); foreach ( Availability::provider_plugins() as $slug => $label ) { $url = current_user_can( 'install_plugins' ) ? self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $slug ) : 'https://wordpress.org/plugins/' . $slug . '/'; $links[] = '' . esc_html( $label ) . ''; } echo wp_kses_post( implode( ', ', $links ) ) . ''; } echo '
  2. '; } echo '
'; echo '
'; wp_nonce_field( 'ailsug_dismiss_onboarding' ); echo ''; submit_button( __( 'Hide this checklist', 'linkcortex' ), 'link', 'submit', false ); echo '
'; } }