345 lines
21 KiB
PHP
345 lines
21 KiB
PHP
<?php
|
|
/**
|
|
* ==========================
|
|
* 🔐 IGNY8 FILE RULE HEADER
|
|
* ==========================
|
|
* @file : profile.php
|
|
* @location : /modules/thinker/profile.php
|
|
* @type : Admin Page
|
|
* @scope : Module Only
|
|
* @allowed : AI profile configuration, behavior settings, personality management
|
|
* @reusability : Single Use
|
|
* @notes : AI behavior configuration interface for thinker module
|
|
*/
|
|
|
|
// Prevent direct access
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
?>
|
|
<div class="igny8-module-page">
|
|
<div class="igny8-container">
|
|
<!-- Page title removed - titles should not appear inside page content -->
|
|
|
|
<!-- Writing Style Section -->
|
|
<div class="igny8-dashboard-section">
|
|
<div class="igny8-card">
|
|
<div class="igny8-standard-header">
|
|
<div class="igny8-card-header-content">
|
|
<div class="igny8-card-title-text">
|
|
<h3>Writing Style Preferences</h3>
|
|
<p class="igny8-card-subtitle">Configure AI writing tone, style, and behavior</p>
|
|
</div>
|
|
<div class="igny8-card-icon">
|
|
<span class="dashicons dashicons-edit-page igny8-dashboard-icon-lg igny8-dashboard-icon-blue"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="igny8-card-body">
|
|
<form id="igny8-ai-profile-form">
|
|
<!-- Tone Selection -->
|
|
<div class="igny8-form-group" style="margin-bottom: 20px;">
|
|
<label for="ai_tone" class="igny8-field-label">Default Tone</label>
|
|
<select name="ai_tone" id="ai_tone" class="igny8-select" style="width: 100%;">
|
|
<option value="professional" <?php selected(igny8_get_ai_setting('ai_tone', 'professional'), 'professional'); ?>>Professional</option>
|
|
<option value="casual" <?php selected(igny8_get_ai_setting('ai_tone', 'professional'), 'casual'); ?>>Casual</option>
|
|
<option value="authoritative" <?php selected(igny8_get_ai_setting('ai_tone', 'professional'), 'authoritative'); ?>>Authoritative</option>
|
|
<option value="friendly" <?php selected(igny8_get_ai_setting('ai_tone', 'professional'), 'friendly'); ?>>Friendly</option>
|
|
<option value="technical" <?php selected(igny8_get_ai_setting('ai_tone', 'professional'), 'technical'); ?>>Technical</option>
|
|
</select>
|
|
<small class="igny8-field-description">Choose the default tone for AI-generated content</small>
|
|
</div>
|
|
|
|
<!-- Writing Level -->
|
|
<div class="igny8-form-group" style="margin-bottom: 20px;">
|
|
<label for="writing_level" class="igny8-field-label">Writing Level</label>
|
|
<select name="writing_level" id="writing_level" class="igny8-select" style="width: 100%;">
|
|
<option value="beginner" <?php selected(igny8_get_ai_setting('writing_level', 'intermediate'), 'beginner'); ?>>Beginner (Simple, clear language)</option>
|
|
<option value="intermediate" <?php selected(igny8_get_ai_setting('writing_level', 'intermediate'), 'intermediate'); ?>>Intermediate (Balanced complexity)</option>
|
|
<option value="advanced" <?php selected(igny8_get_ai_setting('writing_level', 'intermediate'), 'advanced'); ?>>Advanced (Complex, detailed)</option>
|
|
</select>
|
|
<small class="igny8-field-description">Select the complexity level for AI-generated content</small>
|
|
</div>
|
|
|
|
<!-- Content Length Preference -->
|
|
<div class="igny8-form-group" style="margin-bottom: 20px;">
|
|
<label for="content_length" class="igny8-field-label">Preferred Content Length</label>
|
|
<select name="content_length" id="content_length" class="igny8-select" style="width: 100%;">
|
|
<option value="short" <?php selected(igny8_get_ai_setting('content_length', 'medium'), 'short'); ?>>Short (300-500 words)</option>
|
|
<option value="medium" <?php selected(igny8_get_ai_setting('content_length', 'medium'), 'medium'); ?>>Medium (500-1000 words)</option>
|
|
<option value="long" <?php selected(igny8_get_ai_setting('content_length', 'medium'), 'long'); ?>>Long (1000+ words)</option>
|
|
</select>
|
|
<small class="igny8-field-description">Choose the preferred length for AI-generated content</small>
|
|
</div>
|
|
|
|
<!-- Custom Instructions -->
|
|
<div class="igny8-form-group" style="margin-bottom: 20px;">
|
|
<label for="custom_instructions" class="igny8-field-label">Custom AI Instructions</label>
|
|
<textarea name="custom_instructions" id="custom_instructions" rows="6" class="igny8-textarea igny8-textarea-blue" style="width: 100%;" placeholder="Enter specific instructions for how the AI should behave, write, or respond..."><?php echo esc_textarea(wp_unslash(igny8_get_ai_setting('custom_instructions', ''))); ?></textarea>
|
|
<small class="igny8-field-description">These instructions will be added to all AI prompts to customize behavior.</small>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- SEO Preferences Section -->
|
|
<div class="igny8-dashboard-section">
|
|
<div class="igny8-card">
|
|
<div class="igny8-standard-header">
|
|
<div class="igny8-card-header-content">
|
|
<div class="igny8-card-title-text">
|
|
<h3>SEO Preferences</h3>
|
|
<p class="igny8-card-subtitle">Configure SEO optimization settings and preferences</p>
|
|
</div>
|
|
<div class="igny8-card-icon">
|
|
<span class="dashicons dashicons-search igny8-dashboard-icon-lg igny8-dashboard-icon-green"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="igny8-card-body">
|
|
<form id="igny8-seo-profile-form">
|
|
<!-- Keyword Density -->
|
|
<div class="igny8-form-group" style="margin-bottom: 20px;">
|
|
<label for="keyword_density" class="igny8-field-label">Keyword Density Preference</label>
|
|
<select name="keyword_density" id="keyword_density" class="igny8-select" style="width: 100%;">
|
|
<option value="low" <?php selected(igny8_get_ai_setting('keyword_density', 'medium'), 'low'); ?>>Low (1-2%)</option>
|
|
<option value="medium" <?php selected(igny8_get_ai_setting('keyword_density', 'medium'), 'medium'); ?>>Medium (2-3%)</option>
|
|
<option value="high" <?php selected(igny8_get_ai_setting('keyword_density', 'medium'), 'high'); ?>>High (3-4%)</option>
|
|
</select>
|
|
<small class="igny8-field-description">Choose the keyword density for SEO optimization</small>
|
|
</div>
|
|
|
|
<!-- Meta Description Length -->
|
|
<div class="igny8-form-group" style="margin-bottom: 20px;">
|
|
<label for="meta_description_length" class="igny8-field-label">Meta Description Length</label>
|
|
<select name="meta_description_length" id="meta_description_length" class="igny8-select" style="width: 100%;">
|
|
<option value="short" <?php selected(igny8_get_ai_setting('meta_description_length', 'medium'), 'short'); ?>>Short (120-140 chars)</option>
|
|
<option value="medium" <?php selected(igny8_get_ai_setting('meta_description_length', 'medium'), 'medium'); ?>>Medium (140-160 chars)</option>
|
|
<option value="long" <?php selected(igny8_get_ai_setting('meta_description_length', 'medium'), 'long'); ?>>Long (160+ chars)</option>
|
|
</select>
|
|
<small class="igny8-field-description">Choose the preferred length for meta descriptions</small>
|
|
</div>
|
|
|
|
<!-- Include Schema Markup -->
|
|
<div class="igny8-form-group" style="margin-bottom: 15px;">
|
|
<label class="igny8-checkbox-label" style="display: flex; align-items: center; gap: 10px;">
|
|
<input type="checkbox" name="include_schema" id="include_schema" <?php checked(igny8_get_ai_setting('include_schema', false)); ?>>
|
|
<span class="igny8-checkbox-text">Include Schema.org markup suggestions</span>
|
|
</label>
|
|
<small class="igny8-field-description">Enable structured data recommendations for better SEO</small>
|
|
</div>
|
|
|
|
<!-- Include Internal Linking -->
|
|
<div class="igny8-form-group" style="margin-bottom: 15px;">
|
|
<label class="igny8-checkbox-label" style="display: flex; align-items: center; gap: 10px;">
|
|
<input type="checkbox" name="include_internal_links" id="include_internal_links" <?php checked(igny8_get_ai_setting('include_internal_links', true)); ?>>
|
|
<span class="igny8-checkbox-text">Suggest internal linking opportunities</span>
|
|
</label>
|
|
<small class="igny8-field-description">Enable internal linking suggestions for better site structure</small>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Content Structure Preferences -->
|
|
<div class="igny8-dashboard-section">
|
|
<div class="igny8-card">
|
|
<div class="igny8-standard-header">
|
|
<div class="igny8-card-header-content">
|
|
<div class="igny8-card-title-text">
|
|
<h3>Content Structure Preferences</h3>
|
|
<p class="igny8-card-subtitle">Configure content structure and formatting preferences</p>
|
|
</div>
|
|
<div class="igny8-card-icon">
|
|
<span class="dashicons dashicons-list-view igny8-dashboard-icon-lg igny8-dashboard-icon-purple"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="igny8-card-body">
|
|
<form id="igny8-structure-profile-form">
|
|
<!-- Heading Structure -->
|
|
<div class="igny8-form-group" style="margin-bottom: 20px;">
|
|
<label for="heading_style" class="igny8-field-label">Heading Style Preference</label>
|
|
<select name="heading_style" id="heading_style" class="igny8-select" style="width: 100%;">
|
|
<option value="hierarchical" <?php selected(igny8_get_ai_setting('heading_style', 'hierarchical'), 'hierarchical'); ?>>Hierarchical (H1 > H2 > H3)</option>
|
|
<option value="flat" <?php selected(igny8_get_ai_setting('heading_style', 'hierarchical'), 'flat'); ?>>Flat (H1 > H2 only)</option>
|
|
<option value="minimal" <?php selected(igny8_get_ai_setting('heading_style', 'hierarchical'), 'minimal'); ?>>Minimal (H1 only)</option>
|
|
</select>
|
|
<small class="igny8-field-description">Choose the heading structure for content organization</small>
|
|
</div>
|
|
|
|
<!-- Include Table of Contents -->
|
|
<div class="igny8-form-group" style="margin-bottom: 15px;">
|
|
<label class="igny8-checkbox-label" style="display: flex; align-items: center; gap: 10px;">
|
|
<input type="checkbox" name="include_toc" id="include_toc" <?php checked(igny8_get_ai_setting('include_toc', false)); ?>>
|
|
<span class="igny8-checkbox-text">Include Table of Contents for long articles</span>
|
|
</label>
|
|
<small class="igny8-field-description">Automatically generate table of contents for lengthy content</small>
|
|
</div>
|
|
|
|
<!-- Include Call-to-Action -->
|
|
<div class="igny8-form-group" style="margin-bottom: 15px;">
|
|
<label class="igny8-checkbox-label" style="display: flex; align-items: center; gap: 10px;">
|
|
<input type="checkbox" name="include_cta" id="include_cta" <?php checked(igny8_get_ai_setting('include_cta', true)); ?>>
|
|
<span class="igny8-checkbox-text">Include Call-to-Action sections</span>
|
|
</label>
|
|
<small class="igny8-field-description">Add call-to-action sections to engage readers</small>
|
|
</div>
|
|
|
|
<!-- Bullet Points Preference -->
|
|
<div class="igny8-form-group" style="margin-bottom: 20px;">
|
|
<label for="bullet_style" class="igny8-field-label">Bullet Points Style</label>
|
|
<select name="bullet_style" id="bullet_style" class="igny8-select" style="width: 100%;">
|
|
<option value="numbered" <?php selected(igny8_get_ai_setting('bullet_style', 'bulleted'), 'numbered'); ?>>Numbered Lists</option>
|
|
<option value="bulleted" <?php selected(igny8_get_ai_setting('bullet_style', 'bulleted'), 'bulleted'); ?>>Bulleted Lists</option>
|
|
<option value="mixed" <?php selected(igny8_get_ai_setting('bullet_style', 'bulleted'), 'mixed'); ?>>Mixed (as appropriate)</option>
|
|
</select>
|
|
<small class="igny8-field-description">Choose the preferred list style for content</small>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Save Actions -->
|
|
<div class="igny8-dashboard-section">
|
|
<div class="igny8-card">
|
|
<div class="igny8-standard-header">
|
|
<div class="igny8-card-header-content">
|
|
<div class="igny8-card-title-text">
|
|
<h3>Profile Actions</h3>
|
|
<p class="igny8-card-subtitle">Save, reset, or test your AI profile settings</p>
|
|
</div>
|
|
<div class="igny8-card-icon">
|
|
<span class="dashicons dashicons-admin-tools igny8-dashboard-icon-lg igny8-dashboard-icon-amber"></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="igny8-card-body">
|
|
<div class="igny8-form-actions">
|
|
<button type="button" id="igny8-save-profile" class="igny8-btn igny8-btn-success">
|
|
<span class="dashicons dashicons-yes"></span>
|
|
Save AI Profile
|
|
</button>
|
|
<button type="button" id="igny8-reset-profile" class="igny8-btn igny8-btn-outline">
|
|
<span class="dashicons dashicons-update"></span>
|
|
Reset to Defaults
|
|
</button>
|
|
<button type="button" id="igny8-test-profile" class="igny8-btn igny8-btn-primary">
|
|
<span class="dashicons dashicons-admin-network"></span>
|
|
Test Profile Settings
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
jQuery(document).ready(function($) {
|
|
// Save AI Profile
|
|
$('#igny8-save-profile').on('click', function() {
|
|
var formData = {
|
|
action: 'igny8_save_ai_profile',
|
|
nonce: '<?php echo wp_create_nonce('igny8_thinker_profile'); ?>',
|
|
ai_tone: $('#ai_tone').val(),
|
|
writing_level: $('#writing_level').val(),
|
|
content_length: $('#content_length').val(),
|
|
custom_instructions: $('#custom_instructions').val(),
|
|
keyword_density: $('#keyword_density').val(),
|
|
meta_description_length: $('#meta_description_length').val(),
|
|
include_schema: $('#include_schema').is(':checked'),
|
|
include_internal_links: $('#include_internal_links').is(':checked'),
|
|
heading_style: $('#heading_style').val(),
|
|
include_toc: $('#include_toc').is(':checked'),
|
|
include_cta: $('#include_cta').is(':checked'),
|
|
bullet_style: $('#bullet_style').val()
|
|
};
|
|
|
|
$.ajax({
|
|
url: ajaxurl,
|
|
type: 'POST',
|
|
data: formData,
|
|
success: function(response) {
|
|
if (response.success) {
|
|
igny8ShowNotification('AI Profile saved successfully!', 'success', 'thinker');
|
|
} else {
|
|
igny8ShowNotification('Error saving profile: ' + response.data, 'error', 'thinker');
|
|
}
|
|
},
|
|
error: function() {
|
|
igny8ShowNotification('Error saving profile', 'error', 'thinker');
|
|
}
|
|
});
|
|
});
|
|
|
|
// Reset Profile
|
|
$('#igny8-reset-profile').on('click', function() {
|
|
if (confirm('Are you sure you want to reset the AI profile to default settings?')) {
|
|
$.ajax({
|
|
url: ajaxurl,
|
|
type: 'POST',
|
|
data: {
|
|
action: 'igny8_reset_ai_profile',
|
|
nonce: '<?php echo wp_create_nonce('igny8_thinker_profile'); ?>'
|
|
},
|
|
success: function(response) {
|
|
if (response.success) {
|
|
igny8ShowNotification('AI Profile reset to defaults!', 'success', 'thinker');
|
|
// Update form fields with reset values from response
|
|
if (response.data) {
|
|
if (response.data.ai_tone) $('#ai_tone').val(response.data.ai_tone);
|
|
if (response.data.writing_level) $('#writing_level').val(response.data.writing_level);
|
|
if (response.data.content_length) $('#content_length').val(response.data.content_length);
|
|
if (response.data.custom_instructions) $('#custom_instructions').val(response.data.custom_instructions);
|
|
if (response.data.keyword_density) $('#keyword_density').val(response.data.keyword_density);
|
|
if (response.data.meta_description_length) $('#meta_description_length').val(response.data.meta_description_length);
|
|
if (response.data.include_schema !== undefined) $('#include_schema').prop('checked', response.data.include_schema);
|
|
if (response.data.include_internal_links !== undefined) $('#include_internal_links').prop('checked', response.data.include_internal_links);
|
|
if (response.data.heading_style) $('#heading_style').val(response.data.heading_style);
|
|
if (response.data.include_toc !== undefined) $('#include_toc').prop('checked', response.data.include_toc);
|
|
if (response.data.include_cta !== undefined) $('#include_cta').prop('checked', response.data.include_cta);
|
|
if (response.data.bullet_style) $('#bullet_style').val(response.data.bullet_style);
|
|
}
|
|
} else {
|
|
igny8ShowNotification('Error resetting profile: ' + response.data, 'error', 'thinker');
|
|
}
|
|
},
|
|
error: function() {
|
|
igny8ShowNotification('Error resetting profile', 'error', 'thinker');
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
// Test Profile
|
|
$('#igny8-test-profile').on('click', function() {
|
|
$.ajax({
|
|
url: ajaxurl,
|
|
type: 'POST',
|
|
data: {
|
|
action: 'igny8_test_ai_profile',
|
|
nonce: '<?php echo wp_create_nonce('igny8_thinker_profile'); ?>'
|
|
},
|
|
success: function(response) {
|
|
if (response.success) {
|
|
igny8ShowNotification('AI Profile test successful!', 'success', 'thinker');
|
|
} else {
|
|
igny8ShowNotification('AI Profile test failed: ' + response.data, 'error', 'thinker');
|
|
}
|
|
},
|
|
error: function() {
|
|
igny8ShowNotification('Error testing profile', 'error', 'thinker');
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<!-- Global notification system is handled by core.js -->
|
|
<?php
|
|
|