opticore/admin/framework-template.php

196 lines
9.1 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Framework Template
*/
if (!defined('ABSPATH')) {
exit;
}
?>
<div class="wrap opticore-framework-wrapper">
<!-- Framework Header -->
<div class="opticore-framework-header">
<div class="opticore-header-left">
<h1 class="opticore-framework-title">
<span class="dashicons dashicons-performance"></span>
<?php echo esc_html($this->settings['framework_title']); ?>
</h1>
<p class="opticore-framework-subtitle">
<?php _e('Professional optimization settings for your WordPress site', 'opticore'); ?>
</p>
</div>
<div class="opticore-header-right">
<div class="opticore-header-buttons">
<?php if ($this->settings['show_export']) : ?>
<button type="button" class="button opticore-export-btn">
<span class="dashicons dashicons-download"></span>
<?php _e('Export', 'opticore'); ?>
</button>
<?php endif; ?>
<?php if ($this->settings['show_import']) : ?>
<button type="button" class="button opticore-import-btn">
<span class="dashicons dashicons-upload"></span>
<?php _e('Import', 'opticore'); ?>
</button>
<?php endif; ?>
<?php if ($this->settings['show_reset']) : ?>
<button type="button" class="button opticore-reset-all-btn">
<span class="dashicons dashicons-image-rotate"></span>
<?php _e('Reset All', 'opticore'); ?>
</button>
<?php endif; ?>
</div>
</div>
</div>
<!-- Framework Body -->
<div class="opticore-framework-body">
<!-- Sidebar Navigation -->
<div class="opticore-framework-nav">
<nav class="opticore-nav-menu">
<?php $first = true; ?>
<?php foreach ($this->sections as $section_id => $section) : ?>
<a href="#<?php echo esc_attr($section_id); ?>"
class="opticore-nav-item <?php echo $first ? 'active' : ''; ?>"
data-section="<?php echo esc_attr($section_id); ?>">
<span class="dashicons <?php echo esc_attr($section['icon']); ?>"></span>
<span class="opticore-nav-label"><?php echo esc_html($section['title']); ?></span>
<span class="opticore-nav-arrow">
<span class="dashicons dashicons-arrow-right-alt2"></span>
</span>
</a>
<?php $first = false; ?>
<?php endforeach; ?>
</nav>
<!-- Sidebar Footer -->
<div class="opticore-nav-footer">
<div class="opticore-version-info">
<span class="dashicons dashicons-info"></span>
<span><?php printf(__('Version %s', 'opticore'), OPTICORE_VERSION); ?></span>
</div>
</div>
</div>
<!-- Main Content Area -->
<div class="opticore-framework-content">
<form method="post" action="" class="opticore-framework-form" id="opticore-framework-form">
<?php wp_nonce_field('opticore_framework_save', 'opticore_framework_nonce'); ?>
<?php $first = true; ?>
<?php foreach ($this->sections as $section_id => $section) : ?>
<!-- Section Content -->
<div class="opticore-section <?php echo $first ? 'active' : ''; ?>"
id="section-<?php echo esc_attr($section_id); ?>"
data-section="<?php echo esc_attr($section_id); ?>">
<!-- Section Header -->
<div class="opticore-section-header">
<h2 class="opticore-section-title">
<span class="dashicons <?php echo esc_attr($section['icon']); ?>"></span>
<?php echo esc_html($section['title']); ?>
</h2>
<?php if ($this->settings['show_reset']) : ?>
<button type="button"
class="button button-secondary opticore-reset-section-btn"
data-section="<?php echo esc_attr($section_id); ?>">
<span class="dashicons dashicons-image-rotate"></span>
<?php _e('Reset Section', 'opticore'); ?>
</button>
<?php endif; ?>
</div>
<!-- Section Fields -->
<div class="opticore-section-fields">
<?php if (!empty($section['fields'])) : ?>
<?php foreach ($section['fields'] as $field) : ?>
<div class="opticore-field-wrapper">
<?php if (!in_array($field['type'], array('heading', 'content', 'notice'))) : ?>
<div class="opticore-field-label">
<label for="<?php echo esc_attr($field['id']); ?>">
<?php echo esc_html($field['title']); ?>
<?php if (!empty($field['subtitle'])) : ?>
<span class="opticore-subtitle"><?php echo esc_html($field['subtitle']); ?></span>
<?php endif; ?>
</label>
</div>
<?php endif; ?>
<div class="opticore-field-input">
<?php
$field_value = isset($options[$field['id']]) ? $options[$field['id']] : (isset($field['default']) ? $field['default'] : '');
$this->render_field($field, $field_value);
?>
</div>
</div>
<?php endforeach; ?>
<?php else : ?>
<div class="opticore-no-fields">
<p><?php _e('No settings available in this section.', 'opticore'); ?></p>
</div>
<?php endif; ?>
</div>
</div>
<?php $first = false; ?>
<?php endforeach; ?>
</form>
<!-- Sticky Save Bar -->
<div class="opticore-save-bar">
<div class="opticore-save-bar-inner">
<div class="opticore-save-left">
<span class="opticore-save-status">
<span class="dashicons dashicons-yes-alt"></span>
<span class="opticore-save-text"><?php _e('Ready to save', 'opticore'); ?></span>
</span>
</div>
<div class="opticore-save-right">
<button type="button" class="button button-primary button-large opticore-save-btn">
<span class="dashicons dashicons-saved"></span>
<span class="opticore-button-text"><?php _e('Save Changes', 'opticore'); ?></span>
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Import Modal -->
<div class="opticore-modal" id="opticore-import-modal" style="display:none;">
<div class="opticore-modal-overlay"></div>
<div class="opticore-modal-content">
<div class="opticore-modal-header">
<h3><?php _e('Import Settings', 'opticore'); ?></h3>
<button type="button" class="opticore-modal-close">×</button>
</div>
<div class="opticore-modal-body">
<p><?php _e('Paste your exported settings JSON below:', 'opticore'); ?></p>
<textarea id="opticore-import-data" rows="10" class="large-text" placeholder='{"setting_key": "value", ...}'></textarea>
</div>
<div class="opticore-modal-footer">
<button type="button" class="button button-secondary opticore-modal-close"><?php _e('Cancel', 'opticore'); ?></button>
<button type="button" class="button button-primary opticore-import-confirm"><?php _e('Import', 'opticore'); ?></button>
</div>
</div>
</div>
</div>
<!-- Toast Notification Container -->
<div class="opticore-toast-container"></div>