PluginProbe
AI Builder – Generate pages, blocks, images & translate with AI / trunk
AI Builder – Generate pages, blocks, images & translate with AI vtrunk
2.7.9 2.7.8 2.0.8 2.0.9 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.3.10 2.3.11 All 121 releases
ai-builder / admin / pages / multi-page.php

multi-page.php in AI Builder – Generate pages, blocks, images & translate with AI trunk, at admin/pages/multi-page.php

321 lines 10.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH'))
3 exit; // Exit if accessed directly
4
5 // Vérifier si l'utilisateur a déjà un token JWT
6 $jwt_token = get_option('aibui_jwt_token', '');
7
8 if (empty($jwt_token)) {
9 echo '<div class="ai-auth-container"><div class="ai-message error">' . esc_html__('Please sign in to use the Multi Page Generator.', 'ai-builder') . '</div></div>';
10 return;
11 }
12 ?>
13
14 <style>
15 .ai-multi-page-container {
16 max-width: 1200px;
17 margin: 0 auto;
18 padding: 20px;
19 font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
20 }
21 .ai-multi-page-header {
22 text-align: center;
23 margin-bottom: 40px;
24 }
25 .ai-multi-page-header h2 {
26 font-size: 32px;
27 font-weight: 700;
28 color: #1a1a1a;
29 margin: 0 0 10px 0;
30 }
31 .ai-multi-page-header p {
32 font-size: 16px;
33 color: #666;
34 margin: 0;
35 }
36 .ai-multi-page-card {
37 background: #fff;
38 border-radius: 12px;
39 box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
40 overflow: hidden;
41 border: 1px solid #e5e7eb;
42 margin-bottom: 30px;
43 }
44 .ai-card-header {
45 display: flex;
46 align-items: center;
47 gap: 16px;
48 padding: 24px;
49 border-bottom: 1px solid #e5e7eb;
50 background: #f8f9fa;
51 }
52 .ai-card-icon {
53 width: 48px;
54 height: 48px;
55 background: #007cba;
56 border-radius: 8px;
57 display: flex;
58 align-items: center;
59 justify-content: center;
60 color: white;
61 flex-shrink: 0;
62 }
63 .ai-card-title h3 {
64 font-size: 20px;
65 font-weight: 600;
66 color: #1a1a1a;
67 margin: 0 0 4px 0;
68 }
69 .ai-card-content {
70 padding: 24px;
71 }
72 .ai-form-group {
73 margin-bottom: 20px;
74 }
75 .ai-form-group label {
76 display: block;
77 font-weight: 500;
78 color: #374151;
79 margin-bottom: 8px;
80 font-size: 14px;
81 }
82 .ai-form-group select,
83 .ai-form-group textarea {
84 width: 100%;
85 padding: 12px 16px;
86 border: 1px solid #d1d5db;
87 border-radius: 8px;
88 font-size: 14px;
89 transition: all 0.2s ease;
90 box-sizing: border-box;
91 }
92 .ai-form-group textarea {
93 resize: vertical;
94 min-height: 120px;
95 font-family: inherit;
96 }
97 .ai-cost-display {
98 background: #f3f4f6;
99 padding: 12px 16px;
100 border-radius: 8px;
101 font-weight: 600;
102 color: #1f2937;
103 text-align: center;
104 font-size: 16px;
105 }
106 .ai-submit-btn {
107 display: inline-flex;
108 align-items: center;
109 gap: 8px;
110 padding: 12px 24px;
111 border: none;
112 border-radius: 8px;
113 font-size: 14px;
114 font-weight: 500;
115 cursor: pointer;
116 transition: all 0.2s ease;
117 background: #007cba;
118 color: white;
119 }
120 .ai-submit-btn:hover {
121 background: #005a87;
122 }
123 .ai-primary-btn {
124 display: inline-flex;
125 align-items: center;
126 gap: 8px;
127 padding: 12px 24px;
128 border: none;
129 border-radius: 8px;
130 font-size: 14px;
131 font-weight: 500;
132 cursor: pointer;
133 transition: all 0.2s ease;
134 background: #007cba;
135 color: white;
136 }
137 .ai-page-prompt-item {
138 margin-bottom: 24px;
139 padding: 20px;
140 background: #f8f9fa;
141 border-radius: 8px;
142 border: 1px solid #e5e7eb;
143 }
144 .ai-char-counter {
145 text-align: right;
146 font-size: 12px;
147 color: #666;
148 margin-top: 4px;
149 }
150 .ai-char-counter span {
151 font-weight: 500;
152 }
153 .ai-message {
154 padding: 12px 16px;
155 border-radius: 8px;
156 margin: 16px 0;
157 font-size: 14px;
158 font-weight: 500;
159 }
160 .ai-message.success {
161 background: #d4edda;
162 color: #155724;
163 border: 1px solid #c3e6cb;
164 }
165 .ai-message.error {
166 background: #f8d7da;
167 color: #721c24;
168 border: 1px solid #f5c6cb;
169 }
170 .ai-message.info {
171 background: #d1ecf1;
172 color: #0c5460;
173 border: 1px solid #bee5eb;
174 }
175 </style>
176
177 <div class="ai-multi-page-container ai-fade-in">
178 <div class="ai-multi-page-header">
179 <h2>Multi Page Generator</h2>
180 <p>Generate multiple pages at once with AI. Each page costs 75 credits.</p>
181 </div>
182
183 <div id="premium-warning-container"></div>
184
185 <div class="ai-multi-page-content">
186 <!-- Configuration Section -->
187 <div class="ai-multi-page-card">
188 <div class="ai-card-header">
189 <div class="ai-card-icon">
190 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
191 <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"/>
192 <path d="M8 8H16" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
193 <path d="M8 12H16" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
194 <path d="M8 16H12" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
195 </svg>
196 </div>
197 <div class="ai-card-title">
198 <h3>Configuration</h3>
199 </div>
200 </div>
201 <div class="ai-card-content">
202 <form id="multi-page-form" method="post">
203 <div class="ai-form-group">
204 <label for="page-count">Number of pages (1-10)</label>
205 <select id="page-count" name="page_count" required>
206 <option value="1">1 page</option>
207 <option value="2">2 pages</option>
208 <option value="3">3 pages</option>
209 <option value="4">4 pages</option>
210 <option value="5">5 pages</option>
211 <option value="6">6 pages</option>
212 <option value="7">7 pages</option>
213 <option value="8">8 pages</option>
214 <option value="9">9 pages</option>
215 <option value="10">10 pages</option>
216 </select>
217 </div>
218
219 <div class="ai-form-group">
220 <label for="content-type">Content Type</label>
221 <select id="content-type" name="content_type" required>
222 <option value="page">Page</option>
223 <option value="post">Post</option>
224 </select>
225 </div>
226
227 <div class="ai-form-group">
228 <div class="ai-form-label">Total Cost</div>
229 <div class="ai-cost-display" id="total-cost" role="status" aria-live="polite">75 credits</div>
230 </div>
231
232 <button type="button" class="ai-submit-btn" id="start-generation-btn">
233 <span class="ai-loading" style="display: none;"></span>
234 Continue
235 </button>
236 </form>
237 </div>
238 </div>
239
240 <!-- Pages Configuration Section -->
241 <div class="ai-multi-page-card" id="pages-config-section" style="display: none;">
242 <div class="ai-card-header">
243 <div class="ai-card-icon">
244 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
245 <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"/>
246 <path d="M14 2V8H20" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/>
247 <path d="M16 13H8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
248 <path d="M16 17H8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
249 <path d="M10 9H8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
250 </svg>
251 </div>
252 <div class="ai-card-title">
253 <h3>Page Prompts</h3>
254 <p>Enter a prompt for each page (max 1500 characters)</p>
255 </div>
256 </div>
257 <div class="ai-card-content">
258 <div id="pages-prompts-container">
259 <!-- Pages prompts will be generated here -->
260 </div>
261 <button type="button" class="ai-primary-btn" id="generate-pages-btn" style="display: none;">
262 <span class="ai-loading" style="display: none;"></span>
263 Generate Pages
264 </button>
265 </div>
266 </div>
267
268 <!-- Generation Progress Section -->
269 <div class="ai-multi-page-card" id="generation-progress-section" style="display: none;">
270 <div class="ai-card-header">
271 <div class="ai-card-icon">
272 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
273 <circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2"/>
274 <path d="M12 6V12L16 14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
275 </svg>
276 </div>
277 <div class="ai-card-title">
278 <h3>Generation Progress</h3>
279 </div>
280 </div>
281 <div class="ai-card-content">
282 <div id="generation-progress">
283 <!-- Progress will be shown here -->
284 </div>
285 </div>
286 </div>
287
288 <!-- Results Section -->
289 <div class="ai-multi-page-card" id="results-section" style="display: none;">
290 <div class="ai-card-header">
291 <div class="ai-card-icon">
292 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
293 <path d="M9 12L11 14L15 10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
294 <circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2"/>
295 </svg>
296 </div>
297 <div class="ai-card-title">
298 <h3>Generated Pages</h3>
299 </div>
300 </div>
301 <div class="ai-card-content">
302 <div id="generated-pages-list">
303 <!-- Generated pages links will be shown here -->
304 </div>
305 <button type="button" class="ai-secondary-btn" id="generate-more-btn">
306 Generate More Pages
307 </button>
308 </div>
309 </div>
310 </div>
311 <div id="message-container"></div>
312 </div>
313
314 <!-- Hidden form for page generation -->
315 <div class="ai-form-hidden" id="hidden-page-form">
316 <form id="hidden-page-form-element">
317 <input type="hidden" name="action" value="aibui_generate_page">
318 <input type="hidden" name="nonce" value="<?php echo wp_create_nonce('aibui_nonce'); ?>">
319 </form>
320 </div>
321