PluginProbe
AI Builder – Generate pages, blocks, images & translate with AI / 2.0.9
AI Builder – Generate pages, blocks, images & translate with AI v2.0.9
2.7.10 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 All 122 releases
ai-builder / admin / pages / multi-page.php

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

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