| 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 |
?> |
| 26 |
<div class="mxch-admin-wrapper"> |
| 27 |
<!-- Mobile Header --> |
| 28 |
<header class="mxch-mobile-header"> |
| 29 |
<a href="#" class="mxch-mobile-logo"> |
| 30 |
<div class="mxch-mobile-logo-icon"> |
| 31 |
<img src="<?php echo esc_url($plugin_url . 'images/icon-128x128.png'); ?>" alt="MxChat"> |
| 32 |
</div> |
| 33 |
<span class="mxch-mobile-logo-text">MxChat</span> |
| 34 |
</a> |
| 35 |
<button type="button" class="mxch-mobile-menu-btn" aria-label="<?php esc_attr_e('Open menu', 'mxchat'); ?>"> |
| 36 |
<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> |
| 37 |
</button> |
| 38 |
</header> |
| 39 |
|
| 40 |
<!-- Mobile Menu Overlay --> |
| 41 |
<div class="mxch-mobile-overlay"></div> |
| 42 |
|
| 43 |
<!-- Mobile Menu Modal --> |
| 44 |
<div class="mxch-mobile-menu"> |
| 45 |
<div class="mxch-mobile-menu-header"> |
| 46 |
<span class="mxch-mobile-menu-title"><?php esc_html_e('Content', 'mxchat'); ?></span> |
| 47 |
<button type="button" class="mxch-mobile-menu-close" aria-label="<?php esc_attr_e('Close menu', 'mxchat'); ?>"> |
| 48 |
<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> |
| 49 |
</button> |
| 50 |
</div> |
| 51 |
<nav class="mxch-mobile-menu-nav"> |
| 52 |
<div class="mxch-mobile-nav-section"> |
| 53 |
<div class="mxch-mobile-nav-section-title"><?php esc_html_e('Content', 'mxchat'); ?></div> |
| 54 |
<button class="mxch-mobile-nav-link active" data-target="content-generate"> |
| 55 |
<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> |
| 56 |
<span><?php esc_html_e('Generate', 'mxchat'); ?></span> |
| 57 |
</button> |
| 58 |
<button class="mxch-mobile-nav-link" data-target="content-history"> |
| 59 |
<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> |
| 60 |
<span><?php esc_html_e('History', 'mxchat'); ?></span> |
| 61 |
</button> |
| 62 |
<button class="mxch-mobile-nav-link" data-target="content-settings"> |
| 63 |
<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> |
| 64 |
<span><?php esc_html_e('Settings', 'mxchat'); ?></span> |
| 65 |
</button> |
| 66 |
</div> |
| 67 |
</nav> |
| 68 |
</div> |
| 69 |
|
| 70 |
<!-- Sidebar Navigation --> |
| 71 |
<aside class="mxch-sidebar"> |
| 72 |
<div class="mxch-sidebar-header"> |
| 73 |
<a href="#" class="mxch-sidebar-logo"> |
| 74 |
<div class="mxch-sidebar-logo-icon"> |
| 75 |
<img src="<?php echo esc_url($plugin_url . 'images/icon-128x128.png'); ?>" alt="MxChat"> |
| 76 |
</div> |
| 77 |
<span class="mxch-sidebar-logo-text">MxChat</span> |
| 78 |
<span class="mxch-sidebar-version">v<?php echo esc_html(MXCHAT_VERSION ?? '3.1.0'); ?></span> |
| 79 |
</a> |
| 80 |
</div> |
| 81 |
|
| 82 |
<nav class="mxch-sidebar-nav"> |
| 83 |
<div class="mxch-nav-section"> |
| 84 |
<div class="mxch-nav-section-title"><?php esc_html_e('Content', 'mxchat'); ?></div> |
| 85 |
|
| 86 |
<div class="mxch-nav-item" data-section="content-generate"> |
| 87 |
<button class="mxch-nav-link active" data-target="content-generate"> |
| 88 |
<span class="mxch-nav-link-icon"> |
| 89 |
<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> |
| 90 |
</span> |
| 91 |
<span class="mxch-nav-link-text"><?php esc_html_e('Generate', 'mxchat'); ?></span> |
| 92 |
</button> |
| 93 |
</div> |
| 94 |
|
| 95 |
<div class="mxch-nav-item" data-section="content-history"> |
| 96 |
<button class="mxch-nav-link" data-target="content-history"> |
| 97 |
<span class="mxch-nav-link-icon"> |
| 98 |
<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> |
| 99 |
</span> |
| 100 |
<span class="mxch-nav-link-text"><?php esc_html_e('History', 'mxchat'); ?></span> |
| 101 |
</button> |
| 102 |
</div> |
| 103 |
|
| 104 |
<div class="mxch-nav-item" data-section="content-settings"> |
| 105 |
<button class="mxch-nav-link" data-target="content-settings"> |
| 106 |
<span class="mxch-nav-link-icon"> |
| 107 |
<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> |
| 108 |
</span> |
| 109 |
<span class="mxch-nav-link-text"><?php esc_html_e('Settings', 'mxchat'); ?></span> |
| 110 |
</button> |
| 111 |
</div> |
| 112 |
</div> |
| 113 |
</nav> |
| 114 |
</aside> |
| 115 |
|
| 116 |
<!-- Main Content Area --> |
| 117 |
<main class="mxch-content"> |
| 118 |
|
| 119 |
<!-- ======================================== |
| 120 |
GENERATE |
| 121 |
======================================== --> |
| 122 |
<div id="content-generate" class="mxch-section active"> |
| 123 |
|
| 124 |
<!-- Toolbar --> |
| 125 |
<div class="mxch-cg-toolbar mxch-cg-toolbar-minimal"> |
| 126 |
<div class="mxch-cg-toolbar-left"> |
| 127 |
<button type="button" id="mxch-cg-new-btn" class="mxch-cg-generate-btn"> |
| 128 |
<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> |
| 129 |
<span><?php esc_html_e('Generate', 'mxchat'); ?></span> |
| 130 |
</button> |
| 131 |
<h2 id="mxch-cg-preview-title" class="mxch-cg-toolbar-title"><?php esc_html_e('Content Generator', 'mxchat'); ?></h2> |
| 132 |
<div id="mxch-cg-status-dropdown" class="mxch-cg-status-dropdown" style="display:none;"> |
| 133 |
<button type="button" id="mxch-cg-status-badge" class="mxch-cg-status-badge" title="<?php esc_attr_e('Change status', 'mxchat'); ?>"> |
| 134 |
<span class="mxch-cg-status-badge-text"></span> |
| 135 |
<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> |
| 136 |
</button> |
| 137 |
<div class="mxch-cg-status-menu" style="display:none;"> |
| 138 |
<button type="button" class="mxch-cg-status-option" data-status="draft"> |
| 139 |
<span class="mxch-cg-status-dot mxch-cg-dot-draft"></span> |
| 140 |
<?php esc_html_e('Draft', 'mxchat'); ?> |
| 141 |
</button> |
| 142 |
<button type="button" class="mxch-cg-status-option" data-status="publish"> |
| 143 |
<span class="mxch-cg-status-dot mxch-cg-dot-publish"></span> |
| 144 |
<?php esc_html_e('Published', 'mxchat'); ?> |
| 145 |
</button> |
| 146 |
<button type="button" class="mxch-cg-status-option" data-status="future"> |
| 147 |
<span class="mxch-cg-status-dot mxch-cg-dot-future"></span> |
| 148 |
<?php esc_html_e('Scheduled', 'mxchat'); ?> |
| 149 |
</button> |
| 150 |
<div class="mxch-cg-status-schedule-row" style="display:none;"> |
| 151 |
<input type="datetime-local" id="mxch-cg-status-schedule-input" class="mxch-cg-input mxch-cg-status-schedule-input"> |
| 152 |
<button type="button" id="mxch-cg-status-schedule-confirm" class="mxch-cg-status-schedule-confirm"> |
| 153 |
<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> |
| 154 |
</button> |
| 155 |
</div> |
| 156 |
</div> |
| 157 |
</div> |
| 158 |
</div> |
| 159 |
<div class="mxch-cg-toolbar-right" style="display:none;"> |
| 160 |
<div class="mxch-cg-viewport-toggle"> |
| 161 |
<button type="button" class="mxch-cg-viewport-btn active" data-viewport="desktop" title="<?php esc_attr_e('Desktop', 'mxchat'); ?>"> |
| 162 |
<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> |
| 163 |
</button> |
| 164 |
<button type="button" class="mxch-cg-viewport-btn" data-viewport="mobile" title="<?php esc_attr_e('Mobile', 'mxchat'); ?>"> |
| 165 |
<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> |
| 166 |
</button> |
| 167 |
</div> |
| 168 |
<a id="mxch-cg-view-post" href="#" target="_blank" class="mxch-cg-action-btn"> |
| 169 |
<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> |
| 170 |
<?php esc_html_e('View', 'mxchat'); ?> |
| 171 |
</a> |
| 172 |
<button type="button" id="mxch-cg-chat-toggle" class="mxch-cg-action-btn" title="<?php esc_attr_e('Edit with AI', 'mxchat'); ?>"> |
| 173 |
<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> |
| 174 |
<?php esc_html_e('AI Edit', 'mxchat'); ?> |
| 175 |
</button> |
| 176 |
</div> |
| 177 |
</div> |
| 178 |
|
| 179 |
<!-- Full-Width Preview --> |
| 180 |
<div class="mxch-cg-preview-wrap"> |
| 181 |
<div id="mxch-cg-preview-container" class="mxch-cg-preview-container"> |
| 182 |
<!-- Inline Generation Form --> |
| 183 |
<div id="mxch-cg-inline-form" class="mxch-cg-inline-form"> |
| 184 |
<div class="mxch-cg-inline-form-inner"> |
| 185 |
<div class="mxch-cg-inline-form-header"> |
| 186 |
<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> |
| 187 |
<div> |
| 188 |
<h3><?php esc_html_e('Generate Content', 'mxchat'); ?></h3> |
| 189 |
<p><?php esc_html_e('Describe what you want and let AI create it for you.', 'mxchat'); ?></p> |
| 190 |
</div> |
| 191 |
</div> |
| 192 |
<div class="mxch-cg-form"> |
| 193 |
<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> |
| 194 |
<div class="mxch-cg-options"> |
| 195 |
<div class="mxch-cg-option"> |
| 196 |
<label class="mxch-cg-option-label" for="mxch-cg-type"><?php esc_html_e('Type', 'mxchat'); ?></label> |
| 197 |
<select id="mxch-cg-type" class="mxch-cg-select"> |
| 198 |
<option value="post"><?php esc_html_e('Blog Post', 'mxchat'); ?></option> |
| 199 |
<option value="page"><?php esc_html_e('Landing Page', 'mxchat'); ?></option> |
| 200 |
</select> |
| 201 |
</div> |
| 202 |
<div class="mxch-cg-option"> |
| 203 |
<label class="mxch-cg-option-label" for="mxch-cg-status"><?php esc_html_e('Status', 'mxchat'); ?></label> |
| 204 |
<select id="mxch-cg-status" class="mxch-cg-select"> |
| 205 |
<option value="draft"><?php esc_html_e('Draft', 'mxchat'); ?></option> |
| 206 |
<option value="future"><?php esc_html_e('Scheduled', 'mxchat'); ?></option> |
| 207 |
<option value="publish"><?php esc_html_e('Publish', 'mxchat'); ?></option> |
| 208 |
</select> |
| 209 |
</div> |
| 210 |
<div class="mxch-cg-option mxch-cg-schedule-wrap" style="display:none;"> |
| 211 |
<label class="mxch-cg-option-label" for="mxch-cg-schedule"><?php esc_html_e('Schedule', 'mxchat'); ?></label> |
| 212 |
<input type="datetime-local" id="mxch-cg-schedule" class="mxch-cg-input"> |
| 213 |
</div> |
| 214 |
</div> |
| 215 |
<div class="mxch-cg-options"> |
| 216 |
<div class="mxch-cg-option"> |
| 217 |
<label class="mxch-cg-option-label" for="mxch-cg-layout"><?php esc_html_e('Layout', 'mxchat'); ?></label> |
| 218 |
<select id="mxch-cg-layout" class="mxch-cg-select"> |
| 219 |
<option value="default"><?php esc_html_e('Theme Default', 'mxchat'); ?></option> |
| 220 |
<option value="fullwidth" selected><?php esc_html_e('Fullwidth (No Padding)', 'mxchat'); ?></option> |
| 221 |
</select> |
| 222 |
</div> |
| 223 |
<div class="mxch-cg-option"> |
| 224 |
<label class="mxch-cg-option-label" for="mxch-cg-title-display"><?php esc_html_e('Post Title', 'mxchat'); ?></label> |
| 225 |
<select id="mxch-cg-title-display" class="mxch-cg-select"> |
| 226 |
<option value="show"><?php esc_html_e('Show', 'mxchat'); ?></option> |
| 227 |
<option value="hide" selected><?php esc_html_e('Hide (title in content)', 'mxchat'); ?></option> |
| 228 |
</select> |
| 229 |
</div> |
| 230 |
</div> |
| 231 |
<button type="button" id="mxch-cg-generate-btn" class="mxch-cg-generate-btn mxch-cg-generate-btn-full"> |
| 232 |
<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> |
| 233 |
<span><?php esc_html_e('Generate Content', 'mxchat'); ?></span> |
| 234 |
</button> |
| 235 |
</div> |
| 236 |
<!-- Progress (shown during generation) --> |
| 237 |
<div id="mxch-cg-progress" class="mxch-cg-progress" style="display:none;"> |
| 238 |
<div class="mxch-cg-progress-bar"> |
| 239 |
<div class="mxch-cg-progress-fill" style="width:0%"></div> |
| 240 |
</div> |
| 241 |
<p class="mxch-cg-progress-text"><?php esc_html_e('Starting...', 'mxchat'); ?></p> |
| 242 |
</div> |
| 243 |
</div> |
| 244 |
</div> |
| 245 |
<!-- Loading indicator (shown during async generation) --> |
| 246 |
<div id="mxch-cg-loading-indicator" class="mxch-cg-loading-indicator" style="display:none;"> |
| 247 |
<div class="mxch-cg-loading-spinner"> |
| 248 |
<div class="mxch-cg-loading-spinner-ring"></div> |
| 249 |
<div class="mxch-cg-loading-spinner-ring"></div> |
| 250 |
<div class="mxch-cg-loading-spinner-ring"></div> |
| 251 |
<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> |
| 252 |
</div> |
| 253 |
<p id="mxch-cg-loading-phrase" class="mxch-cg-loading-phrase"></p> |
| 254 |
<div class="mxch-cg-loading-progress-mini"> |
| 255 |
<div class="mxch-cg-loading-progress-mini-bar"> |
| 256 |
<div id="mxch-cg-loading-progress-fill" class="mxch-cg-loading-progress-mini-fill" style="width:0%"></div> |
| 257 |
</div> |
| 258 |
<p id="mxch-cg-loading-progress-text" class="mxch-cg-loading-progress-mini-text"><?php esc_html_e('Starting...', 'mxchat'); ?></p> |
| 259 |
</div> |
| 260 |
</div> |
| 261 |
<iframe id="mxch-cg-preview-iframe" class="mxch-cg-preview-iframe" style="display:none;" sandbox="allow-same-origin allow-scripts"></iframe> |
| 262 |
</div> |
| 263 |
</div> |
| 264 |
|
| 265 |
<!-- Mini Chat Panel (slides up from bottom, hidden by default) --> |
| 266 |
<div id="mxch-cg-chat" class="mxch-cg-chat-panel mxch-cg-chat-panel--with-images" style="display:none;"> |
| 267 |
|
| 268 |
<!-- Left Column: Images + Meta (Tabbed) --> |
| 269 |
<div class="mxch-cg-images-col<?php echo $pro_image_management ? '' : ' mxch-cg-pro-locked'; ?>"> |
| 270 |
<!-- Tab Navigation --> |
| 271 |
<div class="mxch-cg-left-tabs"> |
| 272 |
<button type="button" class="mxch-cg-left-tab active" data-tab="images"> |
| 273 |
<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> |
| 274 |
<?php esc_html_e('Images', 'mxchat'); ?> |
| 275 |
<?php if (!$pro_image_management): ?> |
| 276 |
<span class="mxch-cg-pro-badge"><?php echo $is_activated ? esc_html__('ADD-ON', 'mxchat') : esc_html__('PRO', 'mxchat'); ?></span> |
| 277 |
<?php endif; ?> |
| 278 |
</button> |
| 279 |
<button type="button" class="mxch-cg-left-tab" data-tab="meta"> |
| 280 |
<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> |
| 281 |
<?php esc_html_e('Meta', 'mxchat'); ?> |
| 282 |
<?php if (!$pro_meta_management): ?> |
| 283 |
<span class="mxch-cg-pro-badge"><?php echo $is_activated ? esc_html__('ADD-ON', 'mxchat') : esc_html__('PRO', 'mxchat'); ?></span> |
| 284 |
<?php endif; ?> |
| 285 |
</button> |
| 286 |
</div> |
| 287 |
|
| 288 |
<!-- Images Panel (default visible) --> |
| 289 |
<div class="mxch-cg-left-panel active" id="mxch-cg-panel-images"> |
| 290 |
<div class="mxch-cg-images-grid" id="mxch-cg-images-grid"> |
| 291 |
<div class="mxch-cg-images-empty" id="mxch-cg-images-empty"> |
| 292 |
<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> |
| 293 |
<span><?php esc_html_e('Images will appear here after generation', 'mxchat'); ?></span> |
| 294 |
</div> |
| 295 |
</div> |
| 296 |
</div> |
| 297 |
|
| 298 |
<!-- Meta Panel (hidden by default) --> |
| 299 |
<div class="mxch-cg-left-panel" id="mxch-cg-panel-meta" style="position:relative;"> |
| 300 |
<div class="mxch-cg-meta-form<?php echo $pro_meta_management ? '' : ' mxch-cg-meta-locked'; ?>"> |
| 301 |
<div class="mxch-cg-meta-field"> |
| 302 |
<label for="mxch-cg-meta-title"><?php esc_html_e('Title', 'mxchat'); ?></label> |
| 303 |
<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'; ?>> |
| 304 |
</div> |
| 305 |
<div class="mxch-cg-meta-field"> |
| 306 |
<label for="mxch-cg-meta-description"><?php esc_html_e('Meta Description', 'mxchat'); ?></label> |
| 307 |
<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> |
| 308 |
<span class="mxch-cg-meta-charcount">0 / 160</span> |
| 309 |
</div> |
| 310 |
<div class="mxch-cg-meta-field"> |
| 311 |
<label for="mxch-cg-meta-keyword"><?php esc_html_e('Focus Keyword', 'mxchat'); ?></label> |
| 312 |
<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'; ?>> |
| 313 |
</div> |
| 314 |
<div class="mxch-cg-meta-field"> |
| 315 |
<label for="mxch-cg-meta-excerpt"><?php esc_html_e('Excerpt', 'mxchat'); ?></label> |
| 316 |
<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> |
| 317 |
</div> |
| 318 |
</div> |
| 319 |
<?php if (!$pro_meta_management): ?> |
| 320 |
<div class="mxch-cg-meta-lock-overlay"> |
| 321 |
<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> |
| 322 |
<span><?php echo $is_activated ? esc_html__('Install Add-on', 'mxchat') : esc_html__('Upgrade to Pro', 'mxchat'); ?></span> |
| 323 |
</div> |
| 324 |
<?php endif; ?> |
| 325 |
</div> |
| 326 |
</div> |
| 327 |
|
| 328 |
<!-- Chat Column --> |
| 329 |
<div class="mxch-cg-chat-col"> |
| 330 |
<div class="mxch-cg-chat-panel-header"> |
| 331 |
<span class="mxch-cg-chat-panel-title"><?php esc_html_e('Edit with AI', 'mxchat'); ?></span> |
| 332 |
<button type="button" id="mxch-cg-chat-close" class="mxch-cg-chat-panel-close" title="<?php esc_attr_e('Close', 'mxchat'); ?>"> |
| 333 |
<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> |
| 334 |
</button> |
| 335 |
</div> |
| 336 |
<div id="mxch-cg-chat-messages" class="mxch-cg-chat-messages"></div> |
| 337 |
<div class="mxch-cg-chat-input-wrap"> |
| 338 |
<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> |
| 339 |
<button type="button" id="mxch-cg-chat-send" class="mxch-cg-chat-send" disabled> |
| 340 |
<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> |
| 341 |
</button> |
| 342 |
</div> |
| 343 |
</div> |
| 344 |
</div> |
| 345 |
</div> |
| 346 |
|
| 347 |
<!-- ======================================== |
| 348 |
HISTORY |
| 349 |
======================================== --> |
| 350 |
<div id="content-history" class="mxch-section"> |
| 351 |
<div class="mxch-content-header"> |
| 352 |
<h1 class="mxch-content-title"><?php esc_html_e('Content History', 'mxchat'); ?></h1> |
| 353 |
<p class="mxch-content-subtitle"><?php esc_html_e('Browse and edit your AI-generated content.', 'mxchat'); ?></p> |
| 354 |
</div> |
| 355 |
|
| 356 |
<div class="mxch-card"> |
| 357 |
<div class="mxch-card-body"> |
| 358 |
<!-- Loading state --> |
| 359 |
<div id="mxch-cg-history-loading" class="mxch-cg-history-loading"> |
| 360 |
<div class="mxch-cg-history-spinner"></div> |
| 361 |
<p><?php esc_html_e('Loading history...', 'mxchat'); ?></p> |
| 362 |
</div> |
| 363 |
|
| 364 |
<!-- Empty state --> |
| 365 |
<div id="mxch-cg-history-empty" class="mxch-cg-history-empty" style="display:none;"> |
| 366 |
<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> |
| 367 |
<p><?php esc_html_e('No AI-generated content yet. Use the Generate tab to create your first post.', 'mxchat'); ?></p> |
| 368 |
</div> |
| 369 |
|
| 370 |
<!-- History list (rendered by JS) --> |
| 371 |
<div id="mxch-cg-history-list" class="mxch-cg-history-list" style="display:none;"></div> |
| 372 |
|
| 373 |
<!-- Pagination (rendered by JS) --> |
| 374 |
<div id="mxch-cg-history-pagination" class="mxch-cg-history-pagination" style="display:none;"></div> |
| 375 |
</div> |
| 376 |
</div> |
| 377 |
</div> |
| 378 |
|
| 379 |
<!-- ======================================== |
| 380 |
SETTINGS |
| 381 |
======================================== --> |
| 382 |
<div id="content-settings" class="mxch-section"> |
| 383 |
<div class="mxch-content-header"> |
| 384 |
<h1 class="mxch-content-title"><?php esc_html_e('Content Settings', 'mxchat'); ?></h1> |
| 385 |
<p class="mxch-content-subtitle"><?php esc_html_e('Configure AI models and image generation for content creation.', 'mxchat'); ?></p> |
| 386 |
</div> |
| 387 |
|
| 388 |
<div class="mxch-card"> |
| 389 |
<div class="mxch-card-body"> |
| 390 |
|
| 391 |
<!-- Content Model --> |
| 392 |
<div class="mxch-field"> |
| 393 |
<label class="mxch-field-label" for="mxch-content-model"><?php esc_html_e('Content Model', 'mxchat'); ?></label> |
| 394 |
<div class="mxch-field-control"> |
| 395 |
<select id="mxch-content-model" data-field="content_model" class="mxch-cg-select"> |
| 396 |
<?php |
| 397 |
$content_model = $options['content_model'] ?? ($options['model'] ?? 'gpt-5.1-chat-latest'); |
| 398 |
$models = array( |
| 399 |
'OpenAI' => array( |
| 400 |
'gpt-5.2' => 'GPT-5.2', |
| 401 |
'gpt-5.1-chat-latest' => 'GPT-5.1', |
| 402 |
'gpt-5' => 'GPT-5', |
| 403 |
), |
| 404 |
'Anthropic' => array( |
| 405 |
'claude-opus-4-6' => 'Claude Opus 4.6', |
| 406 |
'claude-sonnet-4-6' => 'Claude Sonnet 4.6', |
| 407 |
'claude-haiku-4-5-20251001' => 'Claude Haiku 4.5', |
| 408 |
), |
| 409 |
'Google' => array( |
| 410 |
'gemini-3-pro-preview' => 'Gemini 3 Pro', |
| 411 |
'gemini-2.5-pro' => 'Gemini 2.5 Pro', |
| 412 |
), |
| 413 |
'xAI' => array( |
| 414 |
'grok-4-0709' => 'Grok 4', |
| 415 |
'grok-4-1-fast-non-reasoning' => 'Grok 4.1 Fast', |
| 416 |
'grok-code-fast-1' => 'Grok Code Fast', |
| 417 |
), |
| 418 |
); |
| 419 |
foreach ($models as $group => $group_models) { |
| 420 |
echo '<optgroup label="' . esc_attr($group) . '">'; |
| 421 |
foreach ($group_models as $value => $label) { |
| 422 |
$selected = selected($content_model, $value, false); |
| 423 |
echo '<option value="' . esc_attr($value) . '" ' . $selected . '>' . esc_html($label) . '</option>'; |
| 424 |
} |
| 425 |
echo '</optgroup>'; |
| 426 |
} |
| 427 |
?> |
| 428 |
</select> |
| 429 |
</div> |
| 430 |
<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> |
| 431 |
</div> |
| 432 |
|
| 433 |
<!-- Image Model --> |
| 434 |
<div class="mxch-field"> |
| 435 |
<label class="mxch-field-label" for="mxch-image-model"><?php esc_html_e('Image Model', 'mxchat'); ?></label> |
| 436 |
<div class="mxch-field-control"> |
| 437 |
<?php $image_model = $options['content_image_model'] ?? 'gpt-image-1.5'; ?> |
| 438 |
<select id="mxch-image-model" data-field="content_image_model" class="mxch-cg-select"> |
| 439 |
<optgroup label="<?php esc_attr_e('OpenAI', 'mxchat'); ?>"> |
| 440 |
<option value="gpt-image-1.5" <?php selected($image_model, 'gpt-image-1.5'); ?>><?php esc_html_e('GPT Image 1.5', 'mxchat'); ?></option> |
| 441 |
</optgroup> |
| 442 |
<optgroup label="<?php esc_attr_e('xAI', 'mxchat'); ?>"> |
| 443 |
<option value="grok-imagine-image-pro" <?php selected($image_model, 'grok-imagine-image-pro'); ?>><?php esc_html_e('Grok Imagine Pro', 'mxchat'); ?></option> |
| 444 |
<option value="grok-imagine-image" <?php selected($image_model, 'grok-imagine-image'); ?>><?php esc_html_e('Grok Imagine', 'mxchat'); ?></option> |
| 445 |
</optgroup> |
| 446 |
<optgroup label="<?php esc_attr_e('Google', 'mxchat'); ?>"> |
| 447 |
<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> |
| 448 |
<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> |
| 449 |
</optgroup> |
| 450 |
</select> |
| 451 |
</div> |
| 452 |
<p class="mxch-field-description"><?php esc_html_e('Select the AI model used for generating images within your content.', 'mxchat'); ?></p> |
| 453 |
</div> |
| 454 |
|
| 455 |
<!-- Enable Image Generation --> |
| 456 |
<div class="mxch-field"> |
| 457 |
<label class="mxch-toggle"> |
| 458 |
<?php $enable_images = $options['content_enable_images'] ?? 'on'; ?> |
| 459 |
<input type="checkbox" class="mxch-toggle-input" data-field="content_enable_images" value="on" <?php checked($enable_images, 'on'); ?>> |
| 460 |
<span class="mxch-toggle-switch"></span> |
| 461 |
<span class="mxch-toggle-label"><?php esc_html_e('Enable Image Generation', 'mxchat'); ?></span> |
| 462 |
</label> |
| 463 |
<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> |
| 464 |
</div> |
| 465 |
|
| 466 |
<!-- Internal Linking (Pro) --> |
| 467 |
<div class="mxch-field mxch-cg-pro-field<?php echo $pro_internal_linking ? '' : ' mxch-cg-pro-locked'; ?>"> |
| 468 |
<label class="mxch-toggle"> |
| 469 |
<?php $internal_linking_val = $options['content_internal_linking'] ?? 'off'; ?> |
| 470 |
<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'; ?>> |
| 471 |
<span class="mxch-toggle-switch"></span> |
| 472 |
<span class="mxch-toggle-label"> |
| 473 |
<?php esc_html_e('Internal Linking', 'mxchat'); ?> |
| 474 |
<?php if (!$pro_internal_linking): ?> |
| 475 |
<span class="mxch-cg-pro-badge"><?php echo $is_activated ? esc_html__('ADD-ON', 'mxchat') : esc_html__('PRO', 'mxchat'); ?></span> |
| 476 |
<?php endif; ?> |
| 477 |
</span> |
| 478 |
</label> |
| 479 |
<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> |
| 480 |
<?php if (!$pro_internal_linking): ?> |
| 481 |
<?php if ($is_activated): ?> |
| 482 |
<a href="https://mxchat.ai/" target="_blank" class="mxch-cg-pro-upgrade-link"><?php esc_html_e('Install Add-on', 'mxchat'); ?></a> |
| 483 |
<?php else: ?> |
| 484 |
<a href="https://mxchat.ai/" target="_blank" class="mxch-cg-pro-upgrade-link"><?php esc_html_e('Upgrade to Pro', 'mxchat'); ?></a> |
| 485 |
<?php endif; ?> |
| 486 |
<?php endif; ?> |
| 487 |
</div> |
| 488 |
|
| 489 |
<!-- Tool Use for AI Editing (Pro) --> |
| 490 |
<div class="mxch-field mxch-cg-pro-field<?php echo $pro_tool_use ? '' : ' mxch-cg-pro-locked'; ?>"> |
| 491 |
<label class="mxch-toggle"> |
| 492 |
<?php $tool_use_val = $options['content_tool_use'] ?? 'off'; ?> |
| 493 |
<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'; ?>> |
| 494 |
<span class="mxch-toggle-switch"></span> |
| 495 |
<span class="mxch-toggle-label"> |
| 496 |
<?php esc_html_e('Tool Use for AI Editing', 'mxchat'); ?> |
| 497 |
<?php if (!$pro_tool_use): ?> |
| 498 |
<span class="mxch-cg-pro-badge"><?php echo $is_activated ? esc_html__('ADD-ON', 'mxchat') : esc_html__('PRO', 'mxchat'); ?></span> |
| 499 |
<?php endif; ?> |
| 500 |
</span> |
| 501 |
</label> |
| 502 |
<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> |
| 503 |
<?php if (!$pro_tool_use): ?> |
| 504 |
<?php if ($is_activated): ?> |
| 505 |
<a href="https://mxchat.ai/" target="_blank" class="mxch-cg-pro-upgrade-link"><?php esc_html_e('Install Add-on', 'mxchat'); ?></a> |
| 506 |
<?php else: ?> |
| 507 |
<a href="https://mxchat.ai/" target="_blank" class="mxch-cg-pro-upgrade-link"><?php esc_html_e('Upgrade to Pro', 'mxchat'); ?></a> |
| 508 |
<?php endif; ?> |
| 509 |
<?php endif; ?> |
| 510 |
</div> |
| 511 |
|
| 512 |
</div> |
| 513 |
</div> |
| 514 |
</div> |
| 515 |
|
| 516 |
</main> |
| 517 |
</div> |
| 518 |
<?php |
| 519 |
} |
| 520 |
|