PluginProbe
BotWriter – AI Writer & SEO Content Generator / 3.2.8
BotWriter – AI Writer & SEO Content Generator v3.2.8
3.4.10 3.4.9 3.4.8 3.4.7 3.4.6 3.4.4 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 3.3.0 3.2.8 trunk 1.3.0 1.3.1 1.3.2 1.3.3 All 51 releases
botwriter / includes / settings / stability.php

stability.php in BotWriter – AI Writer & SEO Content Generator 3.2.8, at includes/settings/stability.php

221 lines 10.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Stability AI Image Provider Settings
4 *
5 * @package BotWriter
6 */
7
8 if (!defined('ABSPATH')) {
9 exit;
10 }
11
12 /**
13 * Get Stability AI models configuration
14 */
15 function botwriter_get_stability_models() {
16 return [
17 'Stable Diffusion 3.5' => [
18 'sd3.5-large-turbo' => 'SD 3.5 Large Turbo (fast)',
19 'sd3.5-large' => 'SD 3.5 Large (highest quality)',
20 'sd3.5-medium' => 'SD 3.5 Medium (balanced)',
21 ],
22 'Stable Diffusion 3' => [
23 'sd3-large' => 'SD3 Large',
24 'sd3-medium' => 'SD3 Medium',
25 ],
26 'Premium' => [
27 'core' => 'Stable Image Core',
28 'ultra' => 'Stable Image Ultra',
29 ],
30 ];
31 }
32
33 /**
34 * Get Stability AI provider info
35 */
36 function botwriter_get_stability_info() {
37 return [
38 'name' => 'Stability AI',
39 'description' => __('Creators of Stable Diffusion, the most popular open-source image model. Credit-based pricing with excellent quality.', 'botwriter'),
40 'website' => 'https://stability.ai',
41 'api_url' => 'https://platform.stability.ai/account/keys',
42 'docs_url' => 'https://platform.stability.ai/docs/getting-started',
43 'pricing_url' => 'https://platform.stability.ai/pricing',
44 'free_credits' => __('25 FREE credits on signup (no credit card required!)', 'botwriter'),
45 'pricing_summary' => [
46 'SD 3.5 Large' => '6.5 credits (~$0.065/image)',
47 'SD 3.5 Large Turbo' => '4 credits (~$0.04/image)',
48 'SD 3.5 Medium' => '3.5 credits (~$0.035/image)',
49 'Stable Image Core' => '3 credits (~$0.03/image)',
50 'Creative Upscaler' => '60 credits (~$0.60/upscale)',
51 ],
52 'features' => [
53 __('25 free credits to start!', 'botwriter'),
54 __('Creators of Stable Diffusion', 'botwriter'),
55 __('Excellent image quality', 'botwriter'),
56 __('Image editing tools (inpaint, outpaint)', 'botwriter'),
57 __('Upscaling (up to 4K)', 'botwriter'),
58 __('Background removal', 'botwriter'),
59 __('3D and audio generation too', 'botwriter'),
60 ],
61 'pros' => [
62 __('Free credits to start', 'botwriter'),
63 __('Pioneer in AI imagery', 'botwriter'),
64 __('Many editing tools', 'botwriter'),
65 __('Predictable credit pricing', 'botwriter'),
66 ],
67 'cons' => [
68 __('Credit system can be confusing', 'botwriter'),
69 __('Credits expire after 1 year', 'botwriter'),
70 ],
71 ];
72 }
73
74 /**
75 * Render Stability AI settings tab content
76 */
77 function botwriter_render_stability_settings($settings, $is_active) {
78 $info = botwriter_get_stability_info();
79 $models = botwriter_get_stability_models();
80 ?>
81 <div class="provider-config-section">
82 <div class="provider-config-card">
83 <h4><?php esc_html_e('API Configuration', 'botwriter'); ?></h4>
84 <div class="form-row">
85 <label><?php esc_html_e('API Key:', 'botwriter'); ?></label>
86 <div class="api-key-wrapper">
87 <input type="password" name="botwriter_stability_api_key" class="form-control api-key-input"
88 value="<?php echo esc_attr(botwriter_decrypt_api_key(get_option('botwriter_stability_api_key'))); ?>"
89 placeholder="sk-...">
90 <button type="button" class="button toggle-api-key"><?php esc_html_e('Show', 'botwriter'); ?></button>
91 <button type="button" class="button button-secondary test-api-key" data-provider="stability">
92 <span class="dashicons dashicons-yes-alt"></span> <?php esc_html_e('Test API Key', 'botwriter'); ?>
93 </button>
94 <span class="test-api-result"></span>
95 </div>
96 <p class="description"><?php esc_html_e('Your Stability API key starts with "sk-"', 'botwriter'); ?></p>
97 </div>
98 <div class="form-row">
99 <label><?php esc_html_e('Model:', 'botwriter'); ?></label>
100 <select name="botwriter_stability_model" class="form-select" style="width: 100%; max-width: 400px;">
101 <?php foreach ($models as $group => $group_models): ?>
102 <optgroup label="<?php echo esc_attr($group); ?>">
103 <?php foreach ($group_models as $id => $name): ?>
104 <option value="<?php echo esc_attr($id); ?>" <?php selected($settings['botwriter_stability_model'], $id); ?>><?php echo esc_html($name); ?></option>
105 <?php endforeach; ?>
106 </optgroup>
107 <?php endforeach; ?>
108 </select>
109 </div>
110 </div>
111
112 <div class="provider-info-card highlight-free">
113 <h4><span class="dashicons dashicons-info-outline"></span> <?php esc_html_e('How to Get Your API Key', 'botwriter'); ?></h4>
114 <div class="free-banner">
115 <span class="dashicons dashicons-awards"></span>
116 <strong><?php esc_html_e('🎁 25 FREE credits on signup!', 'botwriter'); ?></strong>
117 </div>
118 <ol class="setup-steps">
119 <li><?php esc_html_e('Go to', 'botwriter'); ?> <a href="https://platform.stability.ai/" target="_blank">platform.stability.ai</a> <?php esc_html_e('and create an account', 'botwriter'); ?></li>
120 <li><?php esc_html_e('Navigate to', 'botwriter'); ?> <a href="https://platform.stability.ai/account/keys" target="_blank"><?php esc_html_e('Account → API Keys', 'botwriter'); ?></a></li>
121 <li><?php esc_html_e('Click "Create API Key"', 'botwriter'); ?></li>
122 <li><?php esc_html_e('Copy the key and paste it above', 'botwriter'); ?></li>
123 </ol>
124 <div class="info-tip success">
125 <span class="dashicons dashicons-yes-alt"></span>
126 <p><?php esc_html_e('You get 25 free credits immediately - no credit card needed! That\'s about 6-8 high-quality images.', 'botwriter'); ?></p>
127 </div>
128 </div>
129
130 <div class="provider-pricing-card">
131 <h4><span class="dashicons dashicons-money-alt"></span> <?php esc_html_e('Pricing Overview', 'botwriter'); ?></h4>
132
133 <div class="pricing-highlight free-highlight">
134 <span class="free-credits-badge large"><?php esc_html_e('🎁 25 FREE Credits', 'botwriter'); ?></span>
135 <p><?php echo esc_html($info['free_credits']); ?></p>
136 </div>
137
138 <div class="credits-explanation">
139 <p><strong><?php esc_html_e('How credits work:', 'botwriter'); ?></strong> <?php esc_html_e('1 credit = $0.01. Buy credits in bundles starting at $10.', 'botwriter'); ?></p>
140 </div>
141
142 <table class="pricing-table">
143 <thead>
144 <tr>
145 <th><?php esc_html_e('Model', 'botwriter'); ?></th>
146 <th><?php esc_html_e('Credits / Est. Cost', 'botwriter'); ?></th>
147 </tr>
148 </thead>
149 <tbody>
150 <?php foreach ($info['pricing_summary'] as $model => $price): ?>
151 <tr>
152 <td><code><?php echo esc_html($model); ?></code></td>
153 <td><?php echo esc_html($price); ?></td>
154 </tr>
155 <?php endforeach; ?>
156 </tbody>
157 </table>
158
159 <p class="pricing-note">
160 <a href="<?php echo esc_url($info['pricing_url']); ?>" target="_blank" class="button button-secondary">
161 <span class="dashicons dashicons-external"></span> <?php esc_html_e('View Full Pricing', 'botwriter'); ?>
162 </a>
163 <a href="https://platform.stability.ai/account/credits" target="_blank" class="button button-secondary">
164 <span class="dashicons dashicons-money-alt"></span> <?php esc_html_e('Buy Credits', 'botwriter'); ?>
165 </a>
166 </p>
167 </div>
168
169 <div class="provider-features-card">
170 <h4><span class="dashicons dashicons-star-filled"></span> <?php esc_html_e('Features & Benefits', 'botwriter'); ?></h4>
171 <ul class="features-list">
172 <?php foreach ($info['features'] as $feature): ?>
173 <li><span class="dashicons dashicons-yes-alt"></span> <?php echo esc_html($feature); ?></li>
174 <?php endforeach; ?>
175 </ul>
176
177 <div class="pros-cons">
178 <div class="pros">
179 <h5><?php esc_html_e('Pros', 'botwriter'); ?></h5>
180 <ul>
181 <?php foreach ($info['pros'] as $pro): ?>
182 <li><span class="dashicons dashicons-plus-alt2"></span> <?php echo esc_html($pro); ?></li>
183 <?php endforeach; ?>
184 </ul>
185 </div>
186 <div class="cons">
187 <h5><?php esc_html_e('Cons', 'botwriter'); ?></h5>
188 <ul>
189 <?php foreach ($info['cons'] as $con): ?>
190 <li><span class="dashicons dashicons-minus"></span> <?php echo esc_html($con); ?></li>
191 <?php endforeach; ?>
192 </ul>
193 </div>
194 </div>
195 </div>
196
197 <div class="provider-links-card">
198 <h4><span class="dashicons dashicons-admin-links"></span> <?php esc_html_e('Useful Links', 'botwriter'); ?></h4>
199 <div class="links-grid">
200 <a href="<?php echo esc_url($info['api_url']); ?>" target="_blank" class="link-item">
201 <span class="dashicons dashicons-admin-network"></span>
202 <?php esc_html_e('Get API Key', 'botwriter'); ?>
203 </a>
204 <a href="<?php echo esc_url($info['docs_url']); ?>" target="_blank" class="link-item">
205 <span class="dashicons dashicons-book"></span>
206 <?php esc_html_e('Documentation', 'botwriter'); ?>
207 </a>
208 <a href="<?php echo esc_url($info['pricing_url']); ?>" target="_blank" class="link-item">
209 <span class="dashicons dashicons-money-alt"></span>
210 <?php esc_html_e('Pricing', 'botwriter'); ?>
211 </a>
212 <a href="https://stabilityai.instatus.com/" target="_blank" class="link-item">
213 <span class="dashicons dashicons-heart"></span>
214 <?php esc_html_e('Status', 'botwriter'); ?>
215 </a>
216 </div>
217 </div>
218 </div>
219 <?php
220 }
221