PluginProbe
MxChat – AI Chatbot & Content Generation for WordPress / 3.1.3
MxChat – AI Chatbot & Content Generation for WordPress v3.1.3
3.2.21 3.2.20 3.2.19 3.2.18 3.2.17 3.2.16 3.2.15 3.2.14 3.2.12 3.2.13 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 3.2.6 3.2.5 3.2.4 3.2.3 3.2.2 3.2.1 2.0.3 2.0.4 2.0.5 2.0.6 All 152 releases
mxchat-basic / includes / admin-content-page.php

admin-content-page.php in MxChat – AI Chatbot & Content Generation for WordPress 3.1.3, at includes/admin-content-page.php

917 lines 76.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * MxChat Content Generator Page
4 *
5 * Admin page template with sidebar navigation for content generation.
6 *
7 * @package MxChat
8 * @since 3.1.0
9 */
10
11 if (!defined('ABSPATH')) {
12 exit;
13 }
14
15 function mxchat_render_content_page($admin_instance) {
16 $is_activated = $admin_instance->is_activated();
17 $options = get_option('mxchat_options', array());
18 $plugin_url = plugin_dir_url(dirname(__FILE__));
19
20 // Pro feature checks — add-on plugins hook into this filter to unlock
21 $pro_internal_linking = apply_filters('mxchat_content_pro_feature', false, 'internal_linking');
22 $pro_tool_use = apply_filters('mxchat_content_pro_feature', false, 'tool_use');
23 $pro_image_management = apply_filters('mxchat_content_pro_feature', false, 'image_management');
24 $pro_meta_management = apply_filters('mxchat_content_pro_feature', false, 'meta_management');
25 $pro_gsc_integration = apply_filters('mxchat_content_pro_feature', false, 'gsc_integration');
26 $pro_content_calendar = apply_filters('mxchat_content_pro_feature', false, 'content_calendar');
27 ?>
28 <div class="mxch-admin-wrapper">
29 <!-- Mobile Header -->
30 <header class="mxch-mobile-header">
31 <a href="#" class="mxch-mobile-logo">
32 <div class="mxch-mobile-logo-icon">
33 <img src="<?php echo esc_url($plugin_url . 'images/icon-128x128.png'); ?>" alt="MxChat">
34 </div>
35 <span class="mxch-mobile-logo-text">MxChat</span>
36 </a>
37 <button type="button" class="mxch-mobile-menu-btn" aria-label="<?php esc_attr_e('Open menu', 'mxchat'); ?>">
38 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg>
39 </button>
40 </header>
41
42 <!-- Mobile Menu Overlay -->
43 <div class="mxch-mobile-overlay"></div>
44
45 <!-- Mobile Menu Modal -->
46 <div class="mxch-mobile-menu">
47 <div class="mxch-mobile-menu-header">
48 <span class="mxch-mobile-menu-title"><?php esc_html_e('Content', 'mxchat'); ?></span>
49 <button type="button" class="mxch-mobile-menu-close" aria-label="<?php esc_attr_e('Close menu', 'mxchat'); ?>">
50 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
51 </button>
52 </div>
53 <nav class="mxch-mobile-menu-nav">
54 <div class="mxch-mobile-nav-section">
55 <div class="mxch-mobile-nav-section-title"><?php esc_html_e('Content', 'mxchat'); ?></div>
56 <button class="mxch-mobile-nav-link active" data-target="content-generate">
57 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"/></svg>
58 <span><?php esc_html_e('Generate', 'mxchat'); ?></span>
59 </button>
60 <button class="mxch-mobile-nav-link" data-target="content-history">
61 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
62 <span><?php esc_html_e('History', 'mxchat'); ?></span>
63 </button>
64 <button class="mxch-mobile-nav-link" data-target="content-settings">
65 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/></svg>
66 <span><?php esc_html_e('Settings', 'mxchat'); ?></span>
67 </button>
68 <button class="mxch-mobile-nav-link" data-target="content-seo">
69 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20V10"/><path d="M18 20V4"/><path d="M6 20v-4"/></svg>
70 <span><?php esc_html_e('SEO', 'mxchat'); ?></span>
71 </button>
72 <button class="mxch-mobile-nav-link" data-target="content-calendar">
73 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>
74 <span><?php esc_html_e('Calendar', 'mxchat'); ?></span>
75 </button>
76 </div>
77 </nav>
78 </div>
79
80 <!-- Sidebar Navigation -->
81 <aside class="mxch-sidebar">
82 <div class="mxch-sidebar-header">
83 <a href="#" class="mxch-sidebar-logo">
84 <div class="mxch-sidebar-logo-icon">
85 <img src="<?php echo esc_url($plugin_url . 'images/icon-128x128.png'); ?>" alt="MxChat">
86 </div>
87 <span class="mxch-sidebar-logo-text">MxChat</span>
88 <span class="mxch-sidebar-version">v<?php echo esc_html(MXCHAT_VERSION ?? '3.1.0'); ?></span>
89 </a>
90 </div>
91
92 <nav class="mxch-sidebar-nav">
93 <div class="mxch-nav-section">
94 <div class="mxch-nav-section-title"><?php esc_html_e('Content', 'mxchat'); ?></div>
95
96 <div class="mxch-nav-item" data-section="content-generate">
97 <button class="mxch-nav-link active" data-target="content-generate">
98 <span class="mxch-nav-link-icon">
99 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"/></svg>
100 </span>
101 <span class="mxch-nav-link-text"><?php esc_html_e('Generate', 'mxchat'); ?></span>
102 </button>
103 </div>
104
105 <div class="mxch-nav-item" data-section="content-history">
106 <button class="mxch-nav-link" data-target="content-history">
107 <span class="mxch-nav-link-icon">
108 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
109 </span>
110 <span class="mxch-nav-link-text"><?php esc_html_e('History', 'mxchat'); ?></span>
111 </button>
112 </div>
113
114 <div class="mxch-nav-item" data-section="content-settings">
115 <button class="mxch-nav-link" data-target="content-settings">
116 <span class="mxch-nav-link-icon">
117 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>
118 </span>
119 <span class="mxch-nav-link-text"><?php esc_html_e('Settings', 'mxchat'); ?></span>
120 </button>
121 </div>
122
123 <div class="mxch-nav-item" data-section="content-seo">
124 <button class="mxch-nav-link" data-target="content-seo">
125 <span class="mxch-nav-link-icon">
126 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20V10"/><path d="M18 20V4"/><path d="M6 20v-4"/></svg>
127 </span>
128 <span class="mxch-nav-link-text"><?php esc_html_e('SEO', 'mxchat'); ?></span>
129 </button>
130 </div>
131
132 <div class="mxch-nav-item" data-section="content-calendar">
133 <button class="mxch-nav-link" data-target="content-calendar">
134 <span class="mxch-nav-link-icon">
135 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>
136 </span>
137 <span class="mxch-nav-link-text"><?php esc_html_e('Calendar', 'mxchat'); ?></span>
138 </button>
139 </div>
140 </div>
141 </nav>
142 </aside>
143
144 <!-- Main Content Area -->
145 <main class="mxch-content">
146
147 <!-- ========================================
148 GENERATE
149 ======================================== -->
150 <div id="content-generate" class="mxch-section active">
151
152 <!-- Toolbar -->
153 <div class="mxch-cg-toolbar mxch-cg-toolbar-minimal">
154 <div class="mxch-cg-toolbar-left">
155 <button type="button" id="mxch-cg-new-btn" class="mxch-cg-generate-btn">
156 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>
157 <span><?php esc_html_e('Generate', 'mxchat'); ?></span>
158 </button>
159 <h2 id="mxch-cg-preview-title" class="mxch-cg-toolbar-title"><?php esc_html_e('Content Generator', 'mxchat'); ?></h2>
160 <div id="mxch-cg-status-dropdown" class="mxch-cg-status-dropdown" style="display:none;">
161 <button type="button" id="mxch-cg-status-badge" class="mxch-cg-status-badge" title="<?php esc_attr_e('Change status', 'mxchat'); ?>">
162 <span class="mxch-cg-status-badge-text"></span>
163 <svg class="mxch-cg-status-chevron" xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>
164 </button>
165 <div class="mxch-cg-status-menu" style="display:none;">
166 <button type="button" class="mxch-cg-status-option" data-status="draft">
167 <span class="mxch-cg-status-dot mxch-cg-dot-draft"></span>
168 <?php esc_html_e('Draft', 'mxchat'); ?>
169 </button>
170 <button type="button" class="mxch-cg-status-option" data-status="publish">
171 <span class="mxch-cg-status-dot mxch-cg-dot-publish"></span>
172 <?php esc_html_e('Published', 'mxchat'); ?>
173 </button>
174 <button type="button" class="mxch-cg-status-option" data-status="future">
175 <span class="mxch-cg-status-dot mxch-cg-dot-future"></span>
176 <?php esc_html_e('Scheduled', 'mxchat'); ?>
177 </button>
178 <div class="mxch-cg-status-schedule-row" style="display:none;">
179 <input type="datetime-local" id="mxch-cg-status-schedule-input" class="mxch-cg-input mxch-cg-status-schedule-input">
180 <button type="button" id="mxch-cg-status-schedule-confirm" class="mxch-cg-status-schedule-confirm">
181 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
182 </button>
183 </div>
184 </div>
185 </div>
186 </div>
187 <div class="mxch-cg-toolbar-right" style="display:none;">
188 <div class="mxch-cg-viewport-toggle">
189 <button type="button" class="mxch-cg-viewport-btn active" data-viewport="desktop" title="<?php esc_attr_e('Desktop', 'mxchat'); ?>">
190 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="20" height="14" rx="2" ry="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg>
191 </button>
192 <button type="button" class="mxch-cg-viewport-btn" data-viewport="mobile" title="<?php esc_attr_e('Mobile', 'mxchat'); ?>">
193 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="2" width="14" height="20" rx="2" ry="2"/><line x1="12" y1="18" x2="12.01" y2="18"/></svg>
194 </button>
195 </div>
196 <a id="mxch-cg-view-post" href="#" target="_blank" class="mxch-cg-action-btn">
197 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>
198 <?php esc_html_e('View', 'mxchat'); ?>
199 </a>
200 <button type="button" id="mxch-cg-chat-toggle" class="mxch-cg-action-btn" title="<?php esc_attr_e('Edit with AI', 'mxchat'); ?>">
201 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
202 <?php esc_html_e('AI Edit', 'mxchat'); ?>
203 </button>
204 </div>
205 </div>
206
207 <!-- Full-Width Preview -->
208 <div class="mxch-cg-preview-wrap">
209 <div id="mxch-cg-preview-container" class="mxch-cg-preview-container">
210 <!-- Inline Generation Form -->
211 <div id="mxch-cg-inline-form" class="mxch-cg-inline-form">
212 <div class="mxch-cg-inline-form-inner">
213 <div class="mxch-cg-inline-form-header">
214 <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>
215 <div>
216 <h3><?php esc_html_e('Generate Content', 'mxchat'); ?></h3>
217 <p><?php esc_html_e('Describe what you want and let AI create it for you.', 'mxchat'); ?></p>
218 </div>
219 </div>
220 <div class="mxch-cg-form">
221 <textarea id="mxch-cg-prompt" class="mxch-cg-prompt" rows="3" placeholder="<?php esc_attr_e('Describe the content you want to generate...', 'mxchat'); ?>"></textarea>
222 <div class="mxch-cg-options">
223 <div class="mxch-cg-option">
224 <label class="mxch-cg-option-label" for="mxch-cg-type"><?php esc_html_e('Type', 'mxchat'); ?></label>
225 <select id="mxch-cg-type" class="mxch-cg-select">
226 <option value="post"><?php esc_html_e('Blog Post', 'mxchat'); ?></option>
227 <option value="page"><?php esc_html_e('Landing Page', 'mxchat'); ?></option>
228 </select>
229 </div>
230 <div class="mxch-cg-option">
231 <label class="mxch-cg-option-label" for="mxch-cg-status"><?php esc_html_e('Status', 'mxchat'); ?></label>
232 <select id="mxch-cg-status" class="mxch-cg-select">
233 <option value="draft"><?php esc_html_e('Draft', 'mxchat'); ?></option>
234 <option value="future"><?php esc_html_e('Scheduled', 'mxchat'); ?></option>
235 <option value="publish"><?php esc_html_e('Publish', 'mxchat'); ?></option>
236 </select>
237 </div>
238 <div class="mxch-cg-option mxch-cg-schedule-wrap" style="display:none;">
239 <label class="mxch-cg-option-label" for="mxch-cg-schedule"><?php esc_html_e('Schedule', 'mxchat'); ?></label>
240 <input type="datetime-local" id="mxch-cg-schedule" class="mxch-cg-input">
241 </div>
242 </div>
243 <div class="mxch-cg-options">
244 <div class="mxch-cg-option">
245 <label class="mxch-cg-option-label" for="mxch-cg-layout"><?php esc_html_e('Layout', 'mxchat'); ?></label>
246 <select id="mxch-cg-layout" class="mxch-cg-select">
247 <option value="default"><?php esc_html_e('Theme Default', 'mxchat'); ?></option>
248 <option value="fullwidth" selected><?php esc_html_e('Fullwidth (No Padding)', 'mxchat'); ?></option>
249 </select>
250 </div>
251 <div class="mxch-cg-option">
252 <label class="mxch-cg-option-label" for="mxch-cg-title-display"><?php esc_html_e('Post Title', 'mxchat'); ?></label>
253 <select id="mxch-cg-title-display" class="mxch-cg-select">
254 <option value="show"><?php esc_html_e('Show', 'mxchat'); ?></option>
255 <option value="hide" selected><?php esc_html_e('Hide (title in content)', 'mxchat'); ?></option>
256 </select>
257 </div>
258 </div>
259 <button type="button" id="mxch-cg-generate-btn" class="mxch-cg-generate-btn mxch-cg-generate-btn-full">
260 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>
261 <span><?php esc_html_e('Generate Content', 'mxchat'); ?></span>
262 </button>
263 </div>
264 <!-- Progress (shown during generation) -->
265 <div id="mxch-cg-progress" class="mxch-cg-progress" style="display:none;">
266 <div class="mxch-cg-progress-bar">
267 <div class="mxch-cg-progress-fill" style="width:0%"></div>
268 </div>
269 <p class="mxch-cg-progress-text"><?php esc_html_e('Starting...', 'mxchat'); ?></p>
270 </div>
271 </div>
272 </div>
273 <!-- Loading indicator (shown during async generation) -->
274 <div id="mxch-cg-loading-indicator" class="mxch-cg-loading-indicator" style="display:none;">
275 <div class="mxch-cg-loading-spinner">
276 <div class="mxch-cg-loading-spinner-ring"></div>
277 <div class="mxch-cg-loading-spinner-ring"></div>
278 <div class="mxch-cg-loading-spinner-ring"></div>
279 <svg class="mxch-cg-loading-spinner-icon" xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>
280 </div>
281 <p id="mxch-cg-loading-phrase" class="mxch-cg-loading-phrase"></p>
282 <div class="mxch-cg-loading-progress-mini">
283 <div class="mxch-cg-loading-progress-mini-bar">
284 <div id="mxch-cg-loading-progress-fill" class="mxch-cg-loading-progress-mini-fill" style="width:0%"></div>
285 </div>
286 <p id="mxch-cg-loading-progress-text" class="mxch-cg-loading-progress-mini-text"><?php esc_html_e('Starting...', 'mxchat'); ?></p>
287 </div>
288 </div>
289 <iframe id="mxch-cg-preview-iframe" class="mxch-cg-preview-iframe" style="display:none;" sandbox="allow-same-origin allow-scripts"></iframe>
290 </div>
291 </div>
292
293 <!-- Mini Chat Panel (slides up from bottom, hidden by default) -->
294 <div id="mxch-cg-chat" class="mxch-cg-chat-panel mxch-cg-chat-panel--with-images" style="display:none;">
295
296 <!-- Left Column: Images + Meta (Tabbed) -->
297 <div class="mxch-cg-images-col<?php echo $pro_image_management ? '' : ' mxch-cg-pro-locked'; ?>">
298 <!-- Tab Navigation -->
299 <div class="mxch-cg-left-tabs">
300 <button type="button" class="mxch-cg-left-tab active" data-tab="images">
301 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
302 <?php esc_html_e('Images', 'mxchat'); ?>
303 <?php if (!$pro_image_management): ?>
304 <span class="mxch-cg-pro-badge"><?php echo $is_activated ? esc_html__('ADD-ON', 'mxchat') : esc_html__('PRO', 'mxchat'); ?></span>
305 <?php endif; ?>
306 </button>
307 <button type="button" class="mxch-cg-left-tab" data-tab="meta">
308 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 7V4h16v3"/><path d="M9 20h6"/><path d="M12 4v16"/></svg>
309 <?php esc_html_e('Meta', 'mxchat'); ?>
310 <?php if (!$pro_meta_management): ?>
311 <span class="mxch-cg-pro-badge"><?php echo $is_activated ? esc_html__('ADD-ON', 'mxchat') : esc_html__('PRO', 'mxchat'); ?></span>
312 <?php endif; ?>
313 </button>
314 <button type="button" class="mxch-cg-left-tab" data-tab="seo">
315 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
316 <?php esc_html_e('SEO', 'mxchat'); ?>
317 </button>
318 </div>
319
320 <!-- Images Panel (default visible) -->
321 <div class="mxch-cg-left-panel active" id="mxch-cg-panel-images">
322 <div class="mxch-cg-images-grid" id="mxch-cg-images-grid">
323 <div class="mxch-cg-images-empty" id="mxch-cg-images-empty">
324 <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
325 <span><?php esc_html_e('Images will appear here after generation', 'mxchat'); ?></span>
326 </div>
327 </div>
328 </div>
329
330 <!-- Meta Panel (hidden by default) -->
331 <div class="mxch-cg-left-panel" id="mxch-cg-panel-meta" style="position:relative;">
332 <div class="mxch-cg-meta-form<?php echo $pro_meta_management ? '' : ' mxch-cg-meta-locked'; ?>">
333 <div class="mxch-cg-meta-field">
334 <label for="mxch-cg-meta-title"><?php esc_html_e('Title', 'mxchat'); ?></label>
335 <input type="text" id="mxch-cg-meta-title" class="mxch-cg-meta-input" placeholder="<?php esc_attr_e('Post title...', 'mxchat'); ?>"<?php echo $pro_meta_management ? '' : ' disabled readonly'; ?>>
336 </div>
337 <div class="mxch-cg-meta-field">
338 <label for="mxch-cg-meta-description"><?php esc_html_e('Meta Description', 'mxchat'); ?></label>
339 <textarea id="mxch-cg-meta-description" class="mxch-cg-meta-input" rows="3" placeholder="<?php esc_attr_e('Meta description...', 'mxchat'); ?>"<?php echo $pro_meta_management ? '' : ' disabled readonly'; ?>></textarea>
340 <span class="mxch-cg-meta-charcount">0 / 160</span>
341 </div>
342 <div class="mxch-cg-meta-field">
343 <label for="mxch-cg-meta-keyword"><?php esc_html_e('Focus Keyword', 'mxchat'); ?></label>
344 <input type="text" id="mxch-cg-meta-keyword" class="mxch-cg-meta-input" placeholder="<?php esc_attr_e('Primary keyword...', 'mxchat'); ?>"<?php echo $pro_meta_management ? '' : ' disabled readonly'; ?>>
345 </div>
346 <div class="mxch-cg-meta-field">
347 <label for="mxch-cg-meta-excerpt"><?php esc_html_e('Excerpt', 'mxchat'); ?></label>
348 <textarea id="mxch-cg-meta-excerpt" class="mxch-cg-meta-input" rows="3" placeholder="<?php esc_attr_e('Post excerpt...', 'mxchat'); ?>"<?php echo $pro_meta_management ? '' : ' disabled readonly'; ?>></textarea>
349 </div>
350 </div>
351 <?php if (!$pro_meta_management): ?>
352 <div class="mxch-cg-meta-lock-overlay">
353 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
354 <span><?php echo $is_activated ? esc_html__('Install Add-on', 'mxchat') : esc_html__('Upgrade to Pro', 'mxchat'); ?></span>
355 </div>
356 <?php endif; ?>
357 </div>
358
359 <!-- SEO Panel -->
360 <div class="mxch-cg-left-panel" id="mxch-cg-panel-seo">
361 <div class="mxch-seo-panel">
362 <!-- Score Header -->
363 <div class="mxch-seo-score-header">
364 <div class="mxch-seo-score-ring">
365 <svg viewBox="0 0 60 60">
366 <circle class="mxch-seo-ring-bg" cx="30" cy="30" r="26" />
367 <circle class="mxch-seo-ring-fill" id="mxch-seo-ring" cx="30" cy="30" r="26" stroke-dasharray="163.36" stroke-dashoffset="163.36" />
368 </svg>
369 <span class="mxch-seo-score-num" id="mxch-seo-score">&mdash;</span>
370 </div>
371 <div class="mxch-seo-score-info">
372 <span class="mxch-seo-score-label" id="mxch-seo-score-label"><?php esc_html_e('SEO Score', 'mxchat'); ?></span>
373 <span class="mxch-seo-score-summary" id="mxch-seo-score-summary"><?php esc_html_e('Generate content to analyze', 'mxchat'); ?></span>
374 </div>
375 <button type="button" class="mxch-seo-analyze-btn" id="mxch-seo-analyze" title="<?php esc_attr_e('Analyze', 'mxchat'); ?>">
376 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"/><path d="M16 16h5v5"/></svg>
377 </button>
378 </div>
379 <!-- Checklist -->
380 <div class="mxch-seo-checklist" id="mxch-seo-checklist">
381 <div class="mxch-seo-empty" id="mxch-seo-empty">
382 <svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
383 <span><?php esc_html_e('SEO analysis will appear here after content is generated', 'mxchat'); ?></span>
384 </div>
385 </div>
386 <!-- AI Optimize -->
387 <div class="mxch-seo-actions" id="mxch-seo-actions" style="display:none;">
388 <button type="button" class="mxch-seo-fix-btn" id="mxch-seo-ai-optimize" title="<?php esc_attr_e('AI optimizes all failing SEO checks', 'mxchat'); ?>">
389 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m12 3-1.9 5.8a2 2 0 0 1-1.287 1.288L3 12l5.8 1.9a2 2 0 0 1 1.288 1.287L12 21l1.9-5.8a2 2 0 0 1 1.287-1.288L21 12l-5.8-1.9a2 2 0 0 1-1.288-1.287Z"/></svg>
390 <?php esc_html_e('Optimize All', 'mxchat'); ?>
391 </button>
392 </div>
393 </div>
394 </div>
395 </div>
396
397 <!-- Chat Column -->
398 <div class="mxch-cg-chat-col">
399 <div class="mxch-cg-chat-panel-header">
400 <span class="mxch-cg-chat-panel-title"><?php esc_html_e('Edit with AI', 'mxchat'); ?></span>
401 <button type="button" id="mxch-cg-chat-close" class="mxch-cg-chat-panel-close" title="<?php esc_attr_e('Close', 'mxchat'); ?>">
402 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
403 </button>
404 </div>
405 <div id="mxch-cg-chat-messages" class="mxch-cg-chat-messages"></div>
406 <div class="mxch-cg-chat-input-wrap">
407 <textarea id="mxch-cg-chat-input" class="mxch-cg-chat-input" rows="2" placeholder="<?php esc_attr_e('e.g. Change the hero heading to...', 'mxchat'); ?>"></textarea>
408 <button type="button" id="mxch-cg-chat-send" class="mxch-cg-chat-send" disabled>
409 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>
410 </button>
411 </div>
412 </div>
413 </div>
414 </div>
415
416 <!-- ========================================
417 HISTORY
418 ======================================== -->
419 <div id="content-history" class="mxch-section">
420 <div class="mxch-content-header">
421 <h1 class="mxch-content-title"><?php esc_html_e('Content History', 'mxchat'); ?></h1>
422 <p class="mxch-content-subtitle"><?php esc_html_e('Browse and edit your AI-generated content.', 'mxchat'); ?></p>
423 </div>
424
425 <div class="mxch-card">
426 <div class="mxch-card-body">
427 <!-- Loading state -->
428 <div id="mxch-cg-history-loading" class="mxch-cg-history-loading">
429 <div class="mxch-cg-history-spinner"></div>
430 <p><?php esc_html_e('Loading history...', 'mxchat'); ?></p>
431 </div>
432
433 <!-- Empty state -->
434 <div id="mxch-cg-history-empty" class="mxch-cg-history-empty" style="display:none;">
435 <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
436 <p><?php esc_html_e('No AI-generated content yet. Use the Generate tab to create your first post.', 'mxchat'); ?></p>
437 </div>
438
439 <!-- History list (rendered by JS) -->
440 <div id="mxch-cg-history-list" class="mxch-cg-history-list" style="display:none;"></div>
441
442 <!-- Pagination (rendered by JS) -->
443 <div id="mxch-cg-history-pagination" class="mxch-cg-history-pagination" style="display:none;"></div>
444 </div>
445 </div>
446 </div>
447
448 <!-- ========================================
449 SETTINGS
450 ======================================== -->
451 <div id="content-settings" class="mxch-section">
452 <div class="mxch-content-header">
453 <h1 class="mxch-content-title"><?php esc_html_e('Settings', 'mxchat'); ?></h1>
454 <p class="mxch-content-subtitle"><?php esc_html_e('Configure content generation and SEO optimization.', 'mxchat'); ?></p>
455 </div>
456
457 <!-- ── Content Settings ── -->
458 <div class="mxch-card">
459 <div class="mxch-card-header">
460 <h3 class="mxch-card-title"><?php esc_html_e('Content', 'mxchat'); ?></h3>
461 </div>
462 <div class="mxch-card-body">
463
464 <!-- Content Model -->
465 <div class="mxch-field">
466 <label class="mxch-field-label" for="mxch-content-model"><?php esc_html_e('Content Model', 'mxchat'); ?></label>
467 <div class="mxch-field-control">
468 <select id="mxch-content-model" data-field="content_model" class="mxch-cg-select">
469 <?php
470 $content_model = $options['content_model'] ?? ($options['model'] ?? 'gpt-5.1-chat-latest');
471 $models = array(
472 'OpenAI' => array(
473 'gpt-5.2' => 'GPT-5.2',
474 'gpt-5.1-chat-latest' => 'GPT-5.1',
475 'gpt-5' => 'GPT-5',
476 ),
477 'Anthropic' => array(
478 'claude-opus-4-6' => 'Claude Opus 4.6',
479 'claude-sonnet-4-6' => 'Claude Sonnet 4.6',
480 'claude-haiku-4-5-20251001' => 'Claude Haiku 4.5',
481 ),
482 'Google' => array(
483 'gemini-3-pro-preview' => 'Gemini 3 Pro',
484 'gemini-2.5-pro' => 'Gemini 2.5 Pro',
485 ),
486 'xAI' => array(
487 'grok-4-0709' => 'Grok 4',
488 'grok-4-1-fast-non-reasoning' => 'Grok 4.1 Fast',
489 'grok-code-fast-1' => 'Grok Code Fast',
490 ),
491 );
492 foreach ($models as $group => $group_models) {
493 echo '<optgroup label="' . esc_attr($group) . '">';
494 foreach ($group_models as $value => $label) {
495 $selected = selected($content_model, $value, false);
496 echo '<option value="' . esc_attr($value) . '" ' . $selected . '>' . esc_html($label) . '</option>';
497 }
498 echo '</optgroup>';
499 }
500 ?>
501 </select>
502 </div>
503 <p class="mxch-field-description"><?php esc_html_e('Select the AI model used for generating content. Uses the API key configured in your main MxChat settings.', 'mxchat'); ?></p>
504 </div>
505
506 <!-- Image Model -->
507 <div class="mxch-field">
508 <label class="mxch-field-label" for="mxch-image-model"><?php esc_html_e('Image Model', 'mxchat'); ?></label>
509 <div class="mxch-field-control">
510 <?php $image_model = $options['content_image_model'] ?? 'gpt-image-1.5'; ?>
511 <select id="mxch-image-model" data-field="content_image_model" class="mxch-cg-select">
512 <optgroup label="<?php esc_attr_e('OpenAI', 'mxchat'); ?>">
513 <option value="gpt-image-1.5" <?php selected($image_model, 'gpt-image-1.5'); ?>><?php esc_html_e('GPT Image 1.5', 'mxchat'); ?></option>
514 </optgroup>
515 <optgroup label="<?php esc_attr_e('xAI', 'mxchat'); ?>">
516 <option value="grok-imagine-image-pro" <?php selected($image_model, 'grok-imagine-image-pro'); ?>><?php esc_html_e('Grok Imagine Pro', 'mxchat'); ?></option>
517 <option value="grok-imagine-image" <?php selected($image_model, 'grok-imagine-image'); ?>><?php esc_html_e('Grok Imagine', 'mxchat'); ?></option>
518 </optgroup>
519 <optgroup label="<?php esc_attr_e('Google', 'mxchat'); ?>">
520 <option value="gemini-2.5-flash-image" <?php selected($image_model, 'gemini-2.5-flash-image'); ?>><?php esc_html_e('Nano Banana (Gemini 2.5 Flash)', 'mxchat'); ?></option>
521 <option value="gemini-3-pro-image-preview" <?php selected($image_model, 'gemini-3-pro-image-preview'); ?>><?php esc_html_e('Nano Banana Pro (Gemini 3 Pro)', 'mxchat'); ?></option>
522 </optgroup>
523 </select>
524 </div>
525 <p class="mxch-field-description"><?php esc_html_e('Select the AI model used for generating images within your content.', 'mxchat'); ?></p>
526 </div>
527
528 <!-- Enable Image Generation -->
529 <div class="mxch-field">
530 <label class="mxch-toggle">
531 <?php $enable_images = $options['content_enable_images'] ?? 'on'; ?>
532 <input type="checkbox" class="mxch-toggle-input" data-field="content_enable_images" value="on" <?php checked($enable_images, 'on'); ?>>
533 <span class="mxch-toggle-switch"></span>
534 <span class="mxch-toggle-label"><?php esc_html_e('Enable Image Generation', 'mxchat'); ?></span>
535 </label>
536 <p class="mxch-field-description"><?php esc_html_e('When enabled, AI will generate and place images throughout your content. When disabled, pages are generated with text-only layouts.', 'mxchat'); ?></p>
537 </div>
538
539 <!-- Internal Linking (Pro) -->
540 <div class="mxch-field mxch-cg-pro-field<?php echo $pro_internal_linking ? '' : ' mxch-cg-pro-locked'; ?>">
541 <label class="mxch-toggle">
542 <?php $internal_linking_val = $options['content_internal_linking'] ?? 'off'; ?>
543 <input type="checkbox" class="mxch-toggle-input" data-field="content_internal_linking" value="on" <?php checked($internal_linking_val, 'on'); ?><?php echo $pro_internal_linking ? '' : ' disabled'; ?>>
544 <span class="mxch-toggle-switch"></span>
545 <span class="mxch-toggle-label">
546 <?php esc_html_e('Internal Linking', 'mxchat'); ?>
547 <?php if (!$pro_internal_linking): ?>
548 <span class="mxch-cg-pro-badge"><?php echo $is_activated ? esc_html__('ADD-ON', 'mxchat') : esc_html__('PRO', 'mxchat'); ?></span>
549 <?php endif; ?>
550 </span>
551 </label>
552 <p class="mxch-field-description"><?php esc_html_e('Automatically find and link to existing blog posts on your site within generated content.', 'mxchat'); ?></p>
553 <?php if (!$pro_internal_linking): ?>
554 <?php if ($is_activated): ?>
555 <a href="https://mxchat.ai/" target="_blank" class="mxch-cg-pro-upgrade-link"><?php esc_html_e('Install Add-on', 'mxchat'); ?></a>
556 <?php else: ?>
557 <a href="https://mxchat.ai/" target="_blank" class="mxch-cg-pro-upgrade-link"><?php esc_html_e('Upgrade to Pro', 'mxchat'); ?></a>
558 <?php endif; ?>
559 <?php endif; ?>
560 </div>
561
562 <!-- Tool Use for AI Editing (Pro) -->
563 <div class="mxch-field mxch-cg-pro-field<?php echo $pro_tool_use ? '' : ' mxch-cg-pro-locked'; ?>">
564 <label class="mxch-toggle">
565 <?php $tool_use_val = $options['content_tool_use'] ?? 'off'; ?>
566 <input type="checkbox" class="mxch-toggle-input" data-field="content_tool_use" value="on" <?php checked($tool_use_val, 'on'); ?><?php echo $pro_tool_use ? '' : ' disabled'; ?>>
567 <span class="mxch-toggle-switch"></span>
568 <span class="mxch-toggle-label">
569 <?php esc_html_e('Tool Use for AI Editing', 'mxchat'); ?>
570 <?php if (!$pro_tool_use): ?>
571 <span class="mxch-cg-pro-badge"><?php echo $is_activated ? esc_html__('ADD-ON', 'mxchat') : esc_html__('PRO', 'mxchat'); ?></span>
572 <?php endif; ?>
573 </span>
574 </label>
575 <p class="mxch-field-description"><?php esc_html_e('Enable precise editing with tool calling — the AI makes targeted changes instead of rewriting the entire page, improving accuracy and token efficiency. Supports Claude, OpenAI, Gemini, and xAI models.', 'mxchat'); ?></p>
576 <?php if (!$pro_tool_use): ?>
577 <?php if ($is_activated): ?>
578 <a href="https://mxchat.ai/" target="_blank" class="mxch-cg-pro-upgrade-link"><?php esc_html_e('Install Add-on', 'mxchat'); ?></a>
579 <?php else: ?>
580 <a href="https://mxchat.ai/" target="_blank" class="mxch-cg-pro-upgrade-link"><?php esc_html_e('Upgrade to Pro', 'mxchat'); ?></a>
581 <?php endif; ?>
582 <?php endif; ?>
583 </div>
584
585 </div>
586 </div>
587
588 <!-- ── SEO Settings ── -->
589 <div class="mxch-card" style="margin-top: 16px;">
590 <div class="mxch-card-header">
591 <h3 class="mxch-card-title"><?php esc_html_e('SEO', 'mxchat'); ?></h3>
592 </div>
593 <div class="mxch-card-body">
594
595 <?php if (!$pro_gsc_integration): ?>
596 <!-- Google Search Console (Pro/Add-on) -->
597 <div class="mxch-field mxch-gsc-settings-locked">
598 <div class="mxch-gsc-settings-locked-header">
599 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/><path d="M9 21V9"/></svg>
600 <span><?php esc_html_e('Google Search Console', 'mxchat'); ?></span>
601 <span class="mxch-cg-pro-badge"><?php echo $is_activated ? esc_html__('ADD-ON', 'mxchat') : esc_html__('PRO', 'mxchat'); ?></span>
602 </div>
603 <p class="mxch-field-description"><?php esc_html_e('Connect Google Search Console to see real search performance data — clicks, impressions, CTR, and keyword rankings — directly in your SEO dashboard. Chat with your GSC data using the AI Admin Assistant add-on.', 'mxchat'); ?></p>
604 <button type="button" class="mxch-gsc-connect-btn" disabled>
605 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
606 <?php esc_html_e('Connect Google Search Console', 'mxchat'); ?>
607 </button>
608 <?php if ($is_activated): ?>
609 <a href="https://mxchat.ai/" target="_blank" class="mxch-cg-pro-upgrade-link"><?php esc_html_e('Install Add-on', 'mxchat'); ?></a>
610 <?php else: ?>
611 <a href="https://mxchat.ai/" target="_blank" class="mxch-cg-pro-upgrade-link"><?php esc_html_e('Upgrade to Pro', 'mxchat'); ?></a>
612 <?php endif; ?>
613 </div>
614 <?php endif; ?>
615
616 <!-- AI Optimize Fields -->
617 <?php
618 $seo_opt_meta = $options['seo_optimize_meta_desc'] ?? 'on';
619 $seo_opt_title = $options['seo_optimize_seo_title'] ?? 'on';
620 $seo_opt_slug = $options['seo_optimize_slug'] ?? 'on';
621 $seo_opt_read = $options['seo_optimize_readability'] ?? 'on';
622 $seo_opt_links = $options['seo_optimize_internal_links'] ?? 'on';
623 $seo_opt_imgalt = $options['seo_optimize_img_alt'] ?? 'on';
624 $seo_opt_feat = $options['seo_optimize_featured_img'] ?? 'on';
625 $has_addon = $pro_internal_linking; // any addon feature unlocked means addon is present
626 ?>
627 <div class="mxch-field">
628 <label class="mxch-field-label"><?php esc_html_e('AI Optimize', 'mxchat'); ?></label>
629 <p class="mxch-field-description" style="margin-bottom: 10px;"><?php esc_html_e('Choose which checks AI Optimize will fix when run.', 'mxchat'); ?></p>
630 <div class="mxch-seo-opt-grid">
631 <label class="mxch-seo-opt-item">
632 <input type="checkbox" class="mxch-seo-opt-check" data-field="seo_optimize_meta_desc" <?php checked($seo_opt_meta, 'on'); ?>>
633 <span><?php esc_html_e('Meta Description', 'mxchat'); ?></span>
634 </label>
635 <label class="mxch-seo-opt-item">
636 <input type="checkbox" class="mxch-seo-opt-check" data-field="seo_optimize_seo_title" <?php checked($seo_opt_title, 'on'); ?>>
637 <span><?php esc_html_e('SEO Title', 'mxchat'); ?></span>
638 </label>
639 <label class="mxch-seo-opt-item">
640 <input type="checkbox" class="mxch-seo-opt-check" data-field="seo_optimize_slug" <?php checked($seo_opt_slug, 'on'); ?>>
641 <span><?php esc_html_e('URL Slug', 'mxchat'); ?></span>
642 </label>
643 <label class="mxch-seo-opt-item<?php echo $has_addon ? '' : ' mxch-seo-opt-locked'; ?>">
644 <input type="checkbox" class="mxch-seo-opt-check" data-field="seo_optimize_readability" <?php checked($seo_opt_read, 'on'); ?><?php echo $has_addon ? '' : ' disabled'; ?>>
645 <span><?php esc_html_e('Readability', 'mxchat'); ?></span>
646 <?php if (!$has_addon): ?>
647 <span class="mxch-cg-pro-badge"><?php echo $is_activated ? esc_html__('ADD-ON', 'mxchat') : esc_html__('PRO', 'mxchat'); ?></span>
648 <?php endif; ?>
649 </label>
650 <label class="mxch-seo-opt-item<?php echo $has_addon ? '' : ' mxch-seo-opt-locked'; ?>">
651 <input type="checkbox" class="mxch-seo-opt-check" data-field="seo_optimize_internal_links" <?php checked($seo_opt_links, 'on'); ?><?php echo $has_addon ? '' : ' disabled'; ?>>
652 <span><?php esc_html_e('Internal Links', 'mxchat'); ?></span>
653 <?php if (!$has_addon): ?>
654 <span class="mxch-cg-pro-badge"><?php echo $is_activated ? esc_html__('ADD-ON', 'mxchat') : esc_html__('PRO', 'mxchat'); ?></span>
655 <?php endif; ?>
656 </label>
657 <label class="mxch-seo-opt-item<?php echo $has_addon ? '' : ' mxch-seo-opt-locked'; ?>">
658 <input type="checkbox" class="mxch-seo-opt-check" data-field="seo_optimize_img_alt" <?php checked($seo_opt_imgalt, 'on'); ?><?php echo $has_addon ? '' : ' disabled'; ?>>
659 <span><?php esc_html_e('Image ALT Text', 'mxchat'); ?></span>
660 <?php if (!$has_addon): ?>
661 <span class="mxch-cg-pro-badge"><?php echo $is_activated ? esc_html__('ADD-ON', 'mxchat') : esc_html__('PRO', 'mxchat'); ?></span>
662 <?php endif; ?>
663 </label>
664 <label class="mxch-seo-opt-item<?php echo $has_addon ? '' : ' mxch-seo-opt-locked'; ?>">
665 <input type="checkbox" class="mxch-seo-opt-check" data-field="seo_optimize_featured_img" <?php checked($seo_opt_feat, 'on'); ?><?php echo $has_addon ? '' : ' disabled'; ?>>
666 <span><?php esc_html_e('Featured Image', 'mxchat'); ?></span>
667 <?php if (!$has_addon): ?>
668 <span class="mxch-cg-pro-badge"><?php echo $is_activated ? esc_html__('ADD-ON', 'mxchat') : esc_html__('PRO', 'mxchat'); ?></span>
669 <?php endif; ?>
670 </label>
671 </div>
672 </div>
673
674 </div>
675 </div>
676 </div>
677
678 <!-- ========================================
679 SEO
680 ======================================== -->
681 <div id="content-seo" class="mxch-section">
682 <div class="mxch-content-header">
683 <h1 class="mxch-content-title"><?php esc_html_e('SEO Analysis', 'mxchat'); ?></h1>
684 <p class="mxch-content-subtitle"><?php esc_html_e('Analyze and optimize SEO for all your content.', 'mxchat'); ?></p>
685 </div>
686
687 <div class="mxch-card">
688 <div class="mxch-card-body" style="padding:0;">
689 <!-- Filter Bar -->
690 <div class="mxch-seod-filters">
691 <div class="mxch-seod-filters-left">
692 <select id="mxch-seod-post-type" class="mxch-seod-select">
693 <option value="any"><?php esc_html_e('All Types', 'mxchat'); ?></option>
694 <option value="post"><?php esc_html_e('Posts', 'mxchat'); ?></option>
695 <option value="page"><?php esc_html_e('Pages', 'mxchat'); ?></option>
696 <?php
697 $extra_types = get_post_types(array('public' => true, '_builtin' => false), 'objects');
698 foreach ($extra_types as $pt) {
699 if (in_array($pt->name, array('attachment', 'elementor_library', 'e-landing-page'), true)) continue;
700 printf('<option value="%s">%s</option>', esc_attr($pt->name), esc_html($pt->labels->name));
701 }
702 ?>
703 </select>
704 <div class="mxch-seod-filter-pills">
705 <button type="button" class="mxch-seod-pill active" data-filter="all"><?php esc_html_e('All', 'mxchat'); ?></button>
706 <button type="button" class="mxch-seod-pill" data-filter="issues"><?php esc_html_e('Issues', 'mxchat'); ?></button>
707 <button type="button" class="mxch-seod-pill" data-filter="good"><?php esc_html_e('Good', 'mxchat'); ?></button>
708 <button type="button" class="mxch-seod-pill" data-filter="unscored"><?php esc_html_e('Not Scanned', 'mxchat'); ?></button>
709 </div>
710 </div>
711 <div class="mxch-seod-filters-right">
712 <?php if (!$has_addon): ?>
713 <span class="mxch-seod-bulk-note" id="mxch-seod-bulk-note" style="display:none;"><?php echo $is_activated ? esc_html__('Bulk optimize requires the Advanced Content Editor add-on', 'mxchat') : esc_html__('Bulk optimize requires MxChat Pro', 'mxchat'); ?></span>
714 <?php endif; ?>
715 <button type="button" class="mxch-seod-scan-btn mxch-seod-optimize-selected-btn<?php echo $has_addon ? '' : ' mxch-seod-bulk-locked'; ?>" id="mxch-seod-optimize-selected" style="display:none;"<?php echo $has_addon ? '' : ' disabled title="' . esc_attr__('Pro required for bulk optimization', 'mxchat') . '"'; ?>>
716 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m12 3-1.9 5.8a2 2 0 0 1-1.287 1.288L3 12l5.8 1.9a2 2 0 0 1 1.288 1.287L12 21l1.9-5.8a2 2 0 0 1 1.287-1.288L21 12l-5.8-1.9a2 2 0 0 1-1.288-1.287Z"/></svg>
717 <span><?php esc_html_e('Optimize Selected', 'mxchat'); ?></span>
718 <?php if (!$has_addon): ?>
719 <span class="mxch-cg-pro-badge"><?php echo $is_activated ? esc_html__('ADD-ON', 'mxchat') : esc_html__('PRO', 'mxchat'); ?></span>
720 <?php endif; ?>
721 </button>
722 <button type="button" class="mxch-seod-scan-btn mxch-seod-scan-stop-btn" id="mxch-seod-optimize-stop" style="display:none;">
723 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="6" y="6" width="12" height="12" rx="2"/></svg>
724 <span><?php esc_html_e('Stop', 'mxchat'); ?></span>
725 </button>
726 <div class="mxch-seod-search-wrap">
727 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
728 <input type="text" id="mxch-seod-search" class="mxch-seod-search" placeholder="<?php esc_attr_e('Search posts...', 'mxchat'); ?>">
729 </div>
730 </div>
731 </div>
732
733 <!-- Posts Table -->
734 <div class="mxch-seod-table-wrap">
735 <div id="mxch-seod-table" class="mxch-seod-table">
736 <!-- Rendered by JS -->
737 </div>
738 <div id="mxch-seod-loading" class="mxch-seod-loading">
739 <div class="mxch-cg-history-spinner"></div>
740 <p><?php esc_html_e('Loading posts...', 'mxchat'); ?></p>
741 </div>
742 <div id="mxch-seod-empty" class="mxch-seod-empty" style="display:none;">
743 <svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20V10"/><path d="M18 20V4"/><path d="M6 20v-4"/></svg>
744 <p><?php esc_html_e('No posts found matching your filters.', 'mxchat'); ?></p>
745 </div>
746 </div>
747
748 <!-- Footer: Scan + Pagination -->
749 <div class="mxch-seod-footer" id="mxch-seod-footer" style="display:none;">
750 <div class="mxch-seod-footer-left">
751 <button type="button" class="mxch-seod-scan-btn" id="mxch-seod-scan-all">
752 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20V10"/><path d="M18 20V4"/><path d="M6 20v-4"/></svg>
753 <span><?php esc_html_e('Scan Unscored', 'mxchat'); ?></span>
754 </button>
755 <span class="mxch-seod-scan-status" id="mxch-seod-scan-status"></span>
756 </div>
757 <div class="mxch-seod-pagination" id="mxch-seod-pagination">
758 <!-- Rendered by JS -->
759 </div>
760 </div>
761 </div>
762 </div>
763 </div>
764
765 <!-- ========================================
766 CALENDAR
767 ======================================== -->
768 <div id="content-calendar" class="mxch-section">
769 <?php if ($pro_content_calendar) : ?>
770 <!-- Add-on is active container for calendar JS to populate -->
771 <div class="mxcal-container" id="mxcal-container"></div>
772 <?php else : ?>
773 <!-- Add-on not installed show blurred demo calendar -->
774 <style>
775 .mxcal-demo-wrap { position: relative; }
776 .mxcal-demo-blur { filter: blur(3px); pointer-events: none; user-select: none; opacity: 0.7; }
777 .mxcal-demo-overlay {
778 position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
779 z-index: 10; text-align: center; background: rgba(255,255,255,0.95);
780 border-radius: 16px; padding: 40px 48px; box-shadow: 0 8px 40px rgba(120,115,245,0.15);
781 border: 1px solid rgba(120,115,245,0.12); max-width: 460px; width: 90%;
782 }
783 .mxcal-demo-overlay h2 {
784 font-size: 22px; font-weight: 700; margin: 0 0 8px; color: #1A202C;
785 }
786 .mxcal-demo-overlay p { font-size: 14px; color: #718096; line-height: 1.6; margin: 0 0 20px; }
787 .mxcal-demo-overlay .mxcal-demo-badge {
788 display: inline-block; background: linear-gradient(135deg, #fa73e6, #7873f5);
789 color: #fff; font-size: 11px; font-weight: 700; padding: 4px 12px;
790 border-radius: 20px; margin-bottom: 16px; letter-spacing: 0.5px;
791 }
792 .mxcal-demo-overlay a.mxcal-demo-btn {
793 display: inline-block; background: linear-gradient(135deg, #fa73e6, #7873f5);
794 color: #fff; font-size: 14px; font-weight: 600; padding: 12px 28px;
795 border-radius: 10px; text-decoration: none; transition: all 0.2s;
796 box-shadow: 0 4px 14px rgba(120,115,245,0.25);
797 }
798 .mxcal-demo-overlay a.mxcal-demo-btn:hover {
799 box-shadow: 0 6px 20px rgba(120,115,245,0.35); transform: translateY(-1px);
800 }
801 .mxcal-demo-grid {
802 display: grid; grid-template-columns: repeat(7, 1fr);
803 border: 1px solid #E2E8F0; border-radius: 12px; overflow: hidden; background: #fff;
804 }
805 .mxcal-demo-hdr {
806 background: #F7FAFC; padding: 10px 6px; text-align: center;
807 font-size: 11px; font-weight: 600; color: #A0AEC0; text-transform: uppercase;
808 border-bottom: 1px solid #E2E8F0;
809 }
810 .mxcal-demo-day {
811 min-height: 90px; padding: 8px; border-right: 1px solid #F0F0F5;
812 border-bottom: 1px solid #F0F0F5; display: flex; flex-direction: column; gap: 4px;
813 }
814 .mxcal-demo-day:nth-child(7n) { border-right: none; }
815 .mxcal-demo-num { font-size: 12px; font-weight: 600; color: #A0AEC0; }
816 .mxcal-demo-kw { font-size: 10px; font-weight: 600; color: #2D3748; line-height: 1.2; }
817 .mxcal-demo-stats { display: flex; gap: 4px; margin-top: auto; }
818 .mxcal-demo-vol { font-size: 9px; background: #EDF2F7; padding: 1px 5px; border-radius: 3px; color: #718096; }
819 .mxcal-demo-kd { font-size: 9px; padding: 1px 5px; border-radius: 3px; font-weight: 700; }
820 .mxcal-demo-easy { background: rgba(16,185,129,0.1); color: #059669; }
821 .mxcal-demo-med { background: rgba(245,158,11,0.1); color: #d97706; }
822 .mxcal-demo-hard { background: rgba(239,68,68,0.1); color: #dc2626; }
823 .mxcal-demo-planned { border-left: 3px solid #CBD5E0; }
824 .mxcal-demo-done { border-left: 3px solid #10b981; }
825 .mxcal-demo-empty { background: #FAFAFA; }
826 .mxcal-demo-header {
827 display: flex; justify-content: space-between; align-items: center;
828 margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
829 }
830 .mxcal-demo-header h3 { font-size: 18px; font-weight: 700; color: #1A202C; margin: 0; }
831 .mxcal-demo-month {
832 display: flex; align-items: center; gap: 16px; justify-content: center; margin-bottom: 14px;
833 }
834 .mxcal-demo-month span { font-size: 16px; font-weight: 700; color: #2D3748; }
835 .mxcal-demo-month-btn {
836 background: none; border: 1px solid #E2E8F0; border-radius: 6px;
837 padding: 4px 12px; font-size: 12px; color: #718096;
838 }
839 </style>
840 <div class="mxcal-demo-wrap">
841 <div class="mxcal-demo-blur">
842 <div class="mxcal-demo-header">
843 <h3>Content Calendar</h3>
844 <div style="display:flex;gap:8px;">
845 <span style="background:#EDF2F7;padding:4px 12px;border-radius:20px;font-size:12px;color:#4A5568;">mxchat.ai</span>
846 <span style="background:linear-gradient(135deg,#fa73e6,#7873f5);padding:4px 12px;border-radius:20px;font-size:11px;color:#fff;font-weight:600;">AI Chatbot Plugin</span>
847 </div>
848 </div>
849 <div class="mxcal-demo-month">
850 <button class="mxcal-demo-month-btn">&larr;</button>
851 <span><?php echo esc_html(wp_date('F Y')); ?></span>
852 <button class="mxcal-demo-month-btn">&rarr;</button>
853 </div>
854 <div class="mxcal-demo-grid">
855 <?php
856 $days = array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
857 foreach ($days as $d) echo '<div class="mxcal-demo-hdr">' . $d . '</div>';
858
859 $demo_posts = array(
860 array('kw' => 'wordpress chatbot plugin', 'vol' => '2,400', 'kd' => 'KD 28', 'cls' => 'easy', 'st' => 'done'),
861 array('kw' => 'ai customer support', 'vol' => '1,900', 'kd' => 'KD 35', 'cls' => 'med', 'st' => 'done'),
862 array('kw' => 'chatbot for ecommerce', 'vol' => '1,600', 'kd' => 'KD 22', 'cls' => 'easy', 'st' => 'done'),
863 array('kw' => 'gpt wordpress integration', 'vol' => '1,100', 'kd' => 'KD 41', 'cls' => 'med', 'st' => 'planned'),
864 array('kw' => 'live chat vs chatbot', 'vol' => '3,200', 'kd' => 'KD 18', 'cls' => 'easy', 'st' => 'planned'),
865 array('kw' => 'ai lead generation', 'vol' => '2,800', 'kd' => 'KD 52', 'cls' => 'med', 'st' => 'planned'),
866 array('kw' => 'reduce support tickets ai', 'vol' => '880', 'kd' => 'KD 15', 'cls' => 'easy', 'st' => 'planned'),
867 array('kw' => 'best chatbot plugins 2026', 'vol' => '4,100', 'kd' => 'KD 62', 'cls' => 'hard', 'st' => 'planned'),
868 array('kw' => 'woocommerce chatbot', 'vol' => '1,400', 'kd' => 'KD 30', 'cls' => 'med', 'st' => 'planned'),
869 array('kw' => 'automate faq wordpress', 'vol' => '720', 'kd' => 'KD 12', 'cls' => 'easy', 'st' => 'planned'),
870 array('kw' => 'claude vs chatgpt wordpress', 'vol' => '2,100', 'kd' => 'KD 38', 'cls' => 'med', 'st' => 'planned'),
871 array('kw' => 'ai content generation', 'vol' => '5,400', 'kd' => 'KD 68', 'cls' => 'hard', 'st' => 'planned'),
872 );
873
874 $first_day = (int) wp_date('w', strtotime('first day of this month'));
875 $days_in_month = (int) wp_date('t');
876 $post_idx = 0;
877
878 for ($i = 0; $i < $first_day; $i++) echo '<div class="mxcal-demo-day mxcal-demo-empty"></div>';
879
880 for ($d = 1; $d <= $days_in_month; $d++) {
881 if ($post_idx < count($demo_posts)) {
882 $p = $demo_posts[$post_idx];
883 $st_cls = $p['st'] === 'done' ? 'mxcal-demo-done' : 'mxcal-demo-planned';
884 echo '<div class="mxcal-demo-day ' . $st_cls . '">';
885 echo '<span class="mxcal-demo-num">' . $d . '</span>';
886 echo '<span class="mxcal-demo-kw">' . esc_html($p['kw']) . '</span>';
887 echo '<div class="mxcal-demo-stats">';
888 echo '<span class="mxcal-demo-vol">' . $p['vol'] . '</span>';
889 echo '<span class="mxcal-demo-kd mxcal-demo-' . $p['cls'] . '">' . $p['kd'] . '</span>';
890 echo '</div></div>';
891 $post_idx++;
892 } else {
893 echo '<div class="mxcal-demo-day mxcal-demo-empty"><span class="mxcal-demo-num">' . $d . '</span></div>';
894 }
895 }
896
897 $total = $first_day + $days_in_month;
898 $remaining = $total % 7 === 0 ? 0 : 7 - ($total % 7);
899 for ($i = 0; $i < $remaining; $i++) echo '<div class="mxcal-demo-day mxcal-demo-empty"></div>';
900 ?>
901 </div>
902 </div>
903 <div class="mxcal-demo-overlay">
904 <span class="mxcal-demo-badge">PRO ADD-ON</span>
905 <h2>AI Content Calendar</h2>
906 <p>Import SEO data and let AI generate a 30-day blog plan with targeted keywords, difficulty scores, and automated post scheduling.</p>
907 <a href="https://mxchat.ai/advanced-content-editor/" target="_blank" class="mxcal-demo-btn">Get Advanced Content Editor</a>
908 </div>
909 </div>
910 <?php endif; ?>
911 </div>
912
913 </main>
914 </div>
915 <?php
916 }
917