# ai-builder/2.0.8/admin/pages/multi-page.php

AI Builder – Generate pages, blocks, images &amp; translate with AI, version 2.0.8. 316 lines.

- Page: https://pluginprobe.com/plugins/ai-builder/2.0.8/code/admin/pages/multi-page.php
- Raw: https://pluginprobe.com/plugins/ai-builder/2.0.8/raw/admin/pages/multi-page.php
- Modified: 2025-10-30T10:51:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ai-builder/2.0.8/code/admin/pages/multi-page.php#L10-L20`.

```php
<?php
if (!defined('ABSPATH'))
    exit; // Exit if accessed directly

// Vérifier si l'utilisateur a déjà un token JWT
$jwt_token = get_option('aibui_jwt_token', '');

// Si pas de token, rediriger vers la page de connexion
if (empty($jwt_token)) {
    wp_redirect(admin_url('admin.php?page=aibui-assistant'));
    exit;
}
?>

<style>
.ai-multi-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}
.ai-multi-page-header {
    text-align: center;
    margin-bottom: 40px;
}
.ai-multi-page-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 10px 0;
}
.ai-multi-page-header p {
    font-size: 16px;
    color: #666;
    margin: 0;
}
.ai-multi-page-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid #e5e7eb;
    margin-bottom: 30px;
}
.ai-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8f9fa;
}
.ai-card-icon {
    width: 48px;
    height: 48px;
    background: #007cba;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}
.ai-card-title h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 4px 0;
}
.ai-card-content {
    padding: 24px;
}
.ai-form-group {
    margin-bottom: 20px;
}
.ai-form-group label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
    font-size: 14px;
}
.ai-form-group select,
.ai-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}
.ai-form-group textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}
.ai-cost-display {
    background: #f3f4f6;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
    color: #1f2937;
    text-align: center;
    font-size: 16px;
}
.ai-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #007cba;
    color: white;
}
.ai-submit-btn:hover {
    background: #005a87;
}
.ai-primary-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #007cba;
    color: white;
}
.ai-page-prompt-item {
    margin-bottom: 24px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}
.ai-char-counter {
    text-align: right;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}
.ai-char-counter span {
    font-weight: 500;
}
.ai-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 14px;
    font-weight: 500;
}
.ai-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.ai-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.ai-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}
</style>

<div class="ai-multi-page-container ai-fade-in">
    <div class="ai-multi-page-header">
        <h2>Multi Page Generator</h2>
        <p>Generate multiple pages at once with AI. Each page costs 75 credits.</p>
    </div>

    <div class="ai-multi-page-content">
        <!-- Configuration Section -->
        <div class="ai-multi-page-card">
            <div class="ai-card-header">
                <div class="ai-card-icon">
                    <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                        <path d="M4 19.5V5.5C4 4.67157 4.67157 4 5.5 4H18.5C19.3284 4 20 4.67157 20 5.5V19.5C20 20.3284 19.3284 21 18.5 21H5.5C4.67157 21 4 20.3284 4 19.5Z" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/>
                        <path d="M8 8H16" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
                        <path d="M8 12H16" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
                        <path d="M8 16H12" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
                    </svg>
                </div>
                <div class="ai-card-title">
                    <h3>Configuration</h3>
                </div>
            </div>
            <div class="ai-card-content">
                <form id="multi-page-form" method="post">
                    <div class="ai-form-group">
                        <label for="page-count">Number of pages (1-6)</label>
                        <select id="page-count" name="page_count" required>
                            <option value="1">1 page</option>
                            <option value="2">2 pages</option>
                            <option value="3">3 pages</option>
                            <option value="4">4 pages</option>
                            <option value="5">5 pages</option>
                            <option value="6">6 pages</option>
                        </select>
                    </div>

                    <div class="ai-form-group">
                        <label for="content-type">Content Type</label>
                        <select id="content-type" name="content_type" required>
                            <option value="page">Page</option>
                            <option value="post">Post</option>
                        </select>
                    </div>

                    <div class="ai-form-group">
                        <div class="ai-form-label">Total Cost</div>
                        <div class="ai-cost-display" id="total-cost" role="status" aria-live="polite">75 credits</div>
                    </div>

                    <button type="button" class="ai-submit-btn" id="start-generation-btn">
                        <span class="ai-loading" style="display: none;"></span>
                        Start Generation
                    </button>
                </form>
            </div>
        </div>

        <!-- Pages Configuration Section -->
        <div class="ai-multi-page-card" id="pages-config-section" style="display: none;">
            <div class="ai-card-header">
                <div class="ai-card-icon">
                    <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                        <path d="M14 2H6C5.46957 2 4.96086 2.21071 4.58579 2.58579C4.21071 2.96086 4 3.46957 4 4V20C4 20.5304 4.21071 21.0391 4.58579 21.4142C4.96086 21.7893 5.46957 22 6 22H18C18.5304 22 19.0391 21.7893 19.4142 21.4142C19.7893 21.0391 20 20.5304 20 20V8L14 2Z" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/>
                        <path d="M14 2V8H20" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/>
                        <path d="M16 13H8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
                        <path d="M16 17H8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
                        <path d="M10 9H8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
                    </svg>
                </div>
                <div class="ai-card-title">
                    <h3>Page Prompts</h3>
                    <p>Enter a prompt for each page (max 1500 characters)</p>
                </div>
            </div>
            <div class="ai-card-content">
                <div id="pages-prompts-container">
                    <!-- Pages prompts will be generated here -->
                </div>
                <button type="button" class="ai-primary-btn" id="generate-pages-btn" style="display: none;">
                    <span class="ai-loading" style="display: none;"></span>
                    Generate Pages
                </button>
            </div>
        </div>

        <!-- Generation Progress Section -->
        <div class="ai-multi-page-card" id="generation-progress-section" style="display: none;">
            <div class="ai-card-header">
                <div class="ai-card-icon">
                    <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                        <circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2"/>
                        <path d="M12 6V12L16 14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                    </svg>
                </div>
                <div class="ai-card-title">
                    <h3>Generation Progress</h3>
                </div>
            </div>
            <div class="ai-card-content">
                <div id="generation-progress">
                    <!-- Progress will be shown here -->
                </div>
            </div>
        </div>

        <!-- Results Section -->
        <div class="ai-multi-page-card" id="results-section" style="display: none;">
            <div class="ai-card-header">
                <div class="ai-card-icon">
                    <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                        <path d="M9 12L11 14L15 10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                        <circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2"/>
                    </svg>
                </div>
                <div class="ai-card-title">
                    <h3>Generated Pages</h3>
                </div>
            </div>
            <div class="ai-card-content">
                <div id="generated-pages-list">
                    <!-- Generated pages links will be shown here -->
                </div>
                <button type="button" class="ai-secondary-btn" id="generate-more-btn">
                    Generate More Pages
                </button>
            </div>
        </div>
    </div>
    <div id="message-container"></div>
</div>

<!-- Hidden form for page generation -->
<div class="ai-form-hidden" id="hidden-page-form">
    <form id="hidden-page-form-element">
        <input type="hidden" name="action" value="aibui_generate_page">
        <input type="hidden" name="nonce" value="<?php echo wp_create_nonce('aibui_nonce'); ?>">
    </form>
</div>

```
