get_thumbnail();
if ( ! empty( $thumb ) ) {
$image = esc_url_raw( $thumb );
}
}
if ( ! $image && method_exists( $item, 'get_enclosure' ) ) {
$enclosure = $item->get_enclosure();
if ( $enclosure && $enclosure->get_link() ) {
$image = esc_url_raw( $enclosure->get_link() );
}
}
if ( ! $image ) {
$media_content = $item->get_item_tags( 'http://search.yahoo.com/mrss/', 'content' );
if ( ! empty( $media_content[0]['attribs']['']['url'] ) ) {
$image = esc_url_raw( $media_content[0]['attribs']['']['url'] );
}
}
if ( ! $image ) {
$media_thumb = $item->get_item_tags( 'http://search.yahoo.com/mrss/', 'thumbnail' );
if ( ! empty( $media_thumb[0]['attribs']['']['url'] ) ) {
$image = esc_url_raw( $media_thumb[0]['attribs']['']['url'] );
}
}
if ( ! $image ) {
$content = $item->get_content();
if ( preg_match( '/]+src\s*=\s*["\']([^"\']+)/i', $content, $matches ) ) {
$image = esc_url_raw( $matches[1] );
}
}
return $image ? $image : AI_CONTENT_WIZARD_DEFAULT_FEED_IMAGE;
}
function ai_content_wizard_render_icon( $slug ) {
switch ( $slug ) {
case 'spark':
return '';
case 'workflow':
return '';
case 'shield':
return '';
default:
return '';
}
}
function ai_content_wizard_main_page() {
include_once ABSPATH . WPINC . '/feed.php';
$rss_items = fetch_feed( 'https://aiwizard.buyreadysite.com/blog/feed/' );
$blog_items = array();
if ( ! is_wp_error( $rss_items ) ) {
$maxitems = $rss_items->get_item_quantity( 3 );
$items = $rss_items->get_items( 0, $maxitems );
foreach ( $items as $item ) {
$blog_items[] = array(
'title' => $item->get_title(),
'link' => $item->get_permalink(),
'date' => $item->get_date( 'M d, Y' ),
'image' => ai_content_wizard_get_feed_image( $item ),
);
}
}
global $wpdb;
$logs_table = $wpdb->prefix . 'ai_content_wizard_posts_logs';
$table_exists = $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $logs_table ) );
$stats = array(
'total_posts' => 0,
'recent_posts' => 0,
'avg_tokens' => 0,
'active_models' => 'OpenAI Turbo Series',
);
if ( $table_exists === $logs_table ) {
$stats['total_posts'] = (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$logs_table}" );
$stats['recent_posts'] = (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$logs_table} WHERE generation_time >= DATE_SUB( NOW(), INTERVAL 7 DAY )" );
$tokens_column_exists = $wpdb->get_var( $wpdb->prepare( "SHOW COLUMNS FROM {$logs_table} LIKE %s", 'tokens_used' ) );
if ( $tokens_column_exists ) {
$stats['avg_tokens'] = (int) $wpdb->get_var( "SELECT AVG(tokens_used) FROM {$logs_table} WHERE tokens_used > 0" );
}
}
$quick_links = array(
array(
'label' => __( 'Single Post Studio', 'ai-content-wizard' ),
'url' => admin_url( 'admin.php?page=ai_content_wizard_create_post' ),
'desc' => __( 'Craft a blog post with guided brief + image prompts.', 'ai-content-wizard' ),
),
array(
'label' => __( 'API Settings', 'ai-content-wizard' ),
'url' => admin_url( 'admin.php?page=ai_content_wizard_api_settings' ),
'desc' => __( 'Connect OpenAI and preview locked providers.', 'ai-content-wizard' ),
),
array(
'label' => __( 'Statistics', 'ai-content-wizard' ),
'url' => admin_url( 'admin.php?page=ai_content_wizard_statistics' ),
'desc' => __( 'Track drafts, failures and token burn.', 'ai-content-wizard' ),
),
);
$focus_cards = array(
array(
'title' => __( 'SEO Playbooks', 'ai-content-wizard' ),
'desc' => __( 'Auto-generate outlines, FAQs, meta tags and internal links for each brief.', 'ai-content-wizard' ),
'icon' => ai_content_wizard_render_icon( 'spark' ),
),
array(
'title' => __( 'Guided Workflows', 'ai-content-wizard' ),
'desc' => __( 'Switch between quick drafts and research-heavy longreads in Pro mode.', 'ai-content-wizard' ),
'icon' => ai_content_wizard_render_icon( 'workflow' ),
),
array(
'title' => __( 'Compliance Guardrails', 'ai-content-wizard' ),
'desc' => __( 'Automatic brand voice, safe-search filters, plagiarism checkpoints.', 'ai-content-wizard' ),
'icon' => ai_content_wizard_render_icon( 'shield' ),
),
);
$upgrade_features = array(
__( 'Unlock Gemini 2.0 Flash, Grok 3 Beta, Claude 3.5 Sonnet, DeepSeek-R1 and custom OpenAI endpoints.', 'ai-content-wizard' ),
__( '40+ language auto-translation with Polylang/WPML syncing and locale-aware SEO fields.', 'ai-content-wizard' ),
__( 'Content Planner: build multi-week calendars, assign owners and auto-schedule publications.', 'ai-content-wizard' ),
__( 'Content Streams: transform RSS / Telegram feeds into moderated drafts with PromoPilot approvals.', 'ai-content-wizard' ),
__( 'Expert Longread Studio: 20–100k character research flows with fact cards, TOC and section rewrites.', 'ai-content-wizard' ),
__( 'Advanced media + compliance: watermarks, brand packs, per-workspace token budgets and audit logs.', 'ai-content-wizard' ),
);
$support_links = array(
array(
'label' => __( 'Telegram', 'ai-content-wizard' ),
'url' => 'https://t.me/buyreadysite',
),
array(
'label' => __( 'Email', 'ai-content-wizard' ),
'url' => 'mailto:aiwizard@buyreadysite.com',
),
array(
'label' => __( 'YouTube', 'ai-content-wizard' ),
'url' => 'https://www.youtube.com/@BuyReadySite_com',
),
);
/* translators: %s is the current Lite plugin version. */
/* translators: %s is the plugin version number. */
$lite_release_label = sprintf( __( 'What is new in Lite %s', 'ai-content-wizard' ), AI_CONTENT_WIZARD_VERSION );
?>