compute_steps();
$done = count( array_filter( $steps, function ( $s ) { return $s['done']; } ) );
$total = count( $steps );
$pct = $total > 0 ? (int) round( ( $done / $total ) * 100 ) : 0;
?>
$step ) :
$n = $i + 1;
$class = $step['done'] ? 'aiep-step--done' : 'aiep-step--pending';
?>
get_var( "SELECT COUNT(DISTINCT post_id) FROM {$wpdb->postmeta} WHERE meta_key = '_ai_explainer_scanned_date'" );
// Step 2 — badges enabled and visible somewhere?
$badges_on = (bool) get_option( 'ai_explainer_pro_show_badges', true )
&& ( (bool) get_option( 'ai_explainer_pro_show_human_badge', 1 ) || (bool) get_option( 'ai_explainer_pro_show_ai_badge', 1 ) )
&& ( (bool) get_option( 'ai_explainer_pro_show_on_posts', 1 ) || (bool) get_option( 'ai_explainer_pro_show_on_pages', 0 ) );
// Step 3 — public authenticity page enabled?
$authenticity_on = (bool) get_option( 'aiep_authenticity_enabled', 1 );
// Step 4 — AI scraper defense enabled?
$defense_on = (bool) get_option( 'aiep_scraper_defense_enabled', 0 );
return [
[
'title' => __( 'Scan your existing content', 'ai-explainer-pro' ),
'why' => __( 'Without a scan, the compliance dashboard and the public authenticity page have nothing to show. Every published post and page is analysed by the local five-method engine in seconds — nothing is sent off-site.', 'ai-explainer-pro' ),
'detail' => '',
'done' => $scanned > 0,
'cta_label' => $scanned > 0
? sprintf(
/* translators: %d: number of posts already scanned */
__( 'Re-scan all (%d already analysed)', 'ai-explainer-pro' ),
$scanned
)
: __( 'Scan all content now', 'ai-explainer-pro' ),
'cta_scan' => true,
'time' => 1,
'secondary_url' => admin_url( 'admin.php?page=ai-explainer-pro-detector' ),
'secondary_label' => __( 'Or try the live detector first →', 'ai-explainer-pro' ),
],
[
'title' => __( 'Show authenticity badges to readers', 'ai-explainer-pro' ),
'why' => __( 'Badges signal "Human / AI / Mixed" content right on your posts. They\'re the public-facing piece readers actually see — and what gives compliance teeth.', 'ai-explainer-pro' ),
'detail' => $badges_on
? __( 'Badges are on. You can fine-tune which post types display them in Settings → General.', 'ai-explainer-pro' )
: __( 'Badges are currently off or limited. Click below to open the General settings and enable them.', 'ai-explainer-pro' ),
'done' => $badges_on,
'cta_label' => $badges_on ? __( 'Customise badges', 'ai-explainer-pro' ) : __( 'Open badge settings', 'ai-explainer-pro' ),
'cta_url' => admin_url( 'admin.php?page=ai-explainer-pro-settings&tab=badges' ),
'time' => 1,
],
[
'title' => __( 'Publish your authenticity page', 'ai-explainer-pro' ),
'why' => __( 'A public /authenticity page on your domain lets readers, partners and journalists see at a glance what share of your content is human-written. Useful for press kits, RFPs and partnership outreach. Includes a free embeddable trust badge other sites can drop in.', 'ai-explainer-pro' ),
'detail' => $authenticity_on
? __( 'Page is live. Click below to view it on your site.', 'ai-explainer-pro' )
: __( 'Page is currently disabled. Enable it with one click below.', 'ai-explainer-pro' ),
'done' => $authenticity_on,
'cta_form' => $authenticity_on ? '' : 'enable_authenticity',
'cta_url' => $authenticity_on ? home_url( '/' . ( class_exists( 'AIEP_Authenticity' ) ? AIEP_Authenticity::slug() : 'authenticity' ) . '/' ) : '',
'cta_new_tab' => true,
'cta_label' => $authenticity_on ? __( 'View my authenticity page', 'ai-explainer-pro' ) : __( 'Enable the public page', 'ai-explainer-pro' ),
'time' => 1,
'secondary_url' => admin_url( 'admin.php?page=ai-explainer-pro-settings&tab=authenticity' ),
'secondary_label' => __( 'Configure slug & embed widget →', 'ai-explainer-pro' ),
],
[
'title' => __( 'Block AI training crawlers', 'ai-explainer-pro' ),
'why' => __( 'GPTBot, ClaudeBot, PerplexityBot, CCBot and 18 other crawlers will gladly hoover your content into their training datasets. Enabling the AI scraper defense adds them to your robots.txt and starts counting hits.', 'ai-explainer-pro' ),
'detail' => $defense_on
? __( 'Defense is on. robots.txt now blocks 22 known AI crawlers. Visit the settings to see hit stats.', 'ai-explainer-pro' )
: __( 'This step is OPTIONAL. Some sites want to be in AI search results (Perplexity, ChatGPT browsing). Enable only if you prefer to opt out of training datasets.', 'ai-explainer-pro' ),
'done' => $defense_on,
'cta_form' => $defense_on ? '' : 'enable_defense',
'cta_url' => $defense_on ? admin_url( 'admin.php?page=ai-explainer-pro-settings&tab=defense' ) : '',
'cta_label' => $defense_on ? __( 'View defense stats', 'ai-explainer-pro' ) : __( 'Enable scraper defense', 'ai-explainer-pro' ),
'time' => 1,
'secondary_url' => admin_url( 'admin.php?page=ai-explainer-pro-settings&tab=defense' ),
'secondary_label' => __( 'Read the docs first →', 'ai-explainer-pro' ),
],
];
}
public static function handle_actions() {
if ( ! isset( $_POST['aiep_getstarted_step'] ) ) {
return;
}
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
check_admin_referer( 'aiep_getstarted_action' );
$step = sanitize_key( wp_unslash( $_POST['aiep_getstarted_step'] ) );
switch ( $step ) {
case 'enable_authenticity':
update_option( 'aiep_authenticity_enabled', 1 );
if ( class_exists( 'AIEP_Authenticity' ) ) {
AIEP_Authenticity::flush_rules();
}
break;
case 'enable_defense':
update_option( 'aiep_scraper_defense_enabled', 1 );
break;
}
wp_safe_redirect( admin_url( 'admin.php?page=ai-explainer-pro-getstarted' ) );
exit;
}
}