| 1 |
<?php |
| 2 |
/** |
| 3 |
* Custom Code Manager - Settings Page Template |
| 4 |
* |
| 5 |
* @package King_Addons |
| 6 |
*/ |
| 7 |
|
| 8 |
defined('ABSPATH') || exit; |
| 9 |
|
| 10 |
use King_Addons\Custom_Code_Manager; |
| 11 |
|
| 12 |
/** @var array $settings */ |
| 13 |
/** @var bool $has_pro */ |
| 14 |
?> |
| 15 |
<div class="kng-cc-admin"> |
| 16 |
<!-- Header --> |
| 17 |
<header class="kng-cc-header"> |
| 18 |
<div class="kng-cc-header-left"> |
| 19 |
<a href="<?php echo esc_url(admin_url('admin.php?page=king-addons-custom-code')); ?>" class="kng-cc-back-btn"> |
| 20 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16"> |
| 21 |
<line x1="19" y1="12" x2="5" y2="12"/> |
| 22 |
<polyline points="12 19 5 12 12 5"/> |
| 23 |
</svg> |
| 24 |
<?php esc_html_e('Back to snippets', 'king-addons'); ?> |
| 25 |
</a> |
| 26 |
<h1 class="kng-cc-title"><?php esc_html_e('Settings', 'king-addons'); ?></h1> |
| 27 |
<p class="kng-cc-subtitle"><?php esc_html_e('Configure Custom Code Manager behavior', 'king-addons'); ?></p> |
| 28 |
</div> |
| 29 |
<div class="kng-cc-header-right"> |
| 30 |
<div class="ka-v3-segmented" id="ka-v3-theme-segment" role="radiogroup" aria-label="<?php echo esc_attr(esc_html__('Theme', 'king-addons')); ?>" data-active="<?php echo esc_attr($theme_mode); ?>"> |
| 31 |
<span class="ka-v3-segmented-indicator" aria-hidden="true"></span> |
| 32 |
<button type="button" class="ka-v3-segmented-btn" data-theme="light" aria-pressed="<?php echo $theme_mode === 'light' ? 'true' : 'false'; ?>"> |
| 33 |
<span class="ka-v3-segmented-icon" aria-hidden="true">☀︎</span> |
| 34 |
<?php esc_html_e('Light', 'king-addons'); ?> |
| 35 |
</button> |
| 36 |
<button type="button" class="ka-v3-segmented-btn" data-theme="dark" aria-pressed="<?php echo $theme_mode === 'dark' ? 'true' : 'false'; ?>"> |
| 37 |
<span class="ka-v3-segmented-icon" aria-hidden="true">☾</span> |
| 38 |
<?php esc_html_e('Dark', 'king-addons'); ?> |
| 39 |
</button> |
| 40 |
<button type="button" class="ka-v3-segmented-btn" data-theme="auto" aria-pressed="<?php echo $theme_mode === 'auto' ? 'true' : 'false'; ?>"> |
| 41 |
<span class="ka-v3-segmented-icon" aria-hidden="true">◐</span> |
| 42 |
<?php esc_html_e('Auto', 'king-addons'); ?> |
| 43 |
</button> |
| 44 |
</div> |
| 45 |
</div> |
| 46 |
</header> |
| 47 |
|
| 48 |
<div class="kng-cc-settings-content"> |
| 49 |
<form id="kng-cc-settings-form" class="kng-cc-settings-form"> |
| 50 |
<!-- General Settings --> |
| 51 |
<div class="kng-cc-settings-card"> |
| 52 |
<div class="kng-cc-settings-card-header"> |
| 53 |
<h3> |
| 54 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="20" height="20"> |
| 55 |
<circle cx="12" cy="12" r="3"/> |
| 56 |
<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 .33-1.82 1.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 1.82.33H9a1.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-.33 1.82V9a1.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"/> |
| 57 |
</svg> |
| 58 |
<?php esc_html_e('General', 'king-addons'); ?> |
| 59 |
</h3> |
| 60 |
</div> |
| 61 |
<div class="kng-cc-settings-card-content"> |
| 62 |
<div class="kng-v3-field"> |
| 63 |
<label class="kng-v3-toggle-wrap kng-v3-toggle-row"> |
| 64 |
<input type="checkbox" name="enabled" <?php checked($settings['enabled']); ?> /> |
| 65 |
<span class="kng-v3-toggle-slider"></span> |
| 66 |
<span class="kng-v3-toggle-text"><?php esc_html_e('Enable Custom Code Manager', 'king-addons'); ?></span> |
| 67 |
</label> |
| 68 |
<p class="kng-v3-field-help"><?php esc_html_e('When disabled, no custom code will be injected on the frontend.', 'king-addons'); ?></p> |
| 69 |
</div> |
| 70 |
</div> |
| 71 |
</div> |
| 72 |
|
| 73 |
<!-- Default Settings --> |
| 74 |
<div class="kng-cc-settings-card"> |
| 75 |
<div class="kng-cc-settings-card-header"> |
| 76 |
<h3> |
| 77 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" width="20" height="20"> |
| 78 |
<line x1="4" y1="21" x2="4" y2="14"/><line x1="4" y1="10" x2="4" y2="3"/><line x1="12" y1="21" x2="12" y2="12"/><line x1="12" y1="8" x2="12" y2="3"/><line x1="20" y1="21" x2="20" y2="16"/><line x1="20" y1="12" x2="20" y2="3"/><line x1="1" y1="14" x2="7" y2="14"/><line x1="9" y1="8" x2="15" y2="8"/><line x1="17" y1="16" x2="23" y2="16"/> |
| 79 |
</svg> |
| 80 |
<?php esc_html_e('Defaults', 'king-addons'); ?> |
| 81 |
</h3> |
| 82 |
</div> |
| 83 |
<div class="kng-cc-settings-card-content"> |
| 84 |
<div class="kng-cc-settings-row"> |
| 85 |
<div class="kng-v3-field"> |
| 86 |
<label class="kng-v3-label"><?php esc_html_e('Default CSS Location', 'king-addons'); ?></label> |
| 87 |
<select name="default_location_css" class="kng-v3-select"> |
| 88 |
<option value="head" <?php selected($settings['default_location_css'], 'head'); ?>><?php esc_html_e('Head', 'king-addons'); ?></option> |
| 89 |
<option value="footer" <?php selected($settings['default_location_css'], 'footer'); ?>><?php esc_html_e('Footer', 'king-addons'); ?></option> |
| 90 |
</select> |
| 91 |
</div> |
| 92 |
<div class="kng-v3-field"> |
| 93 |
<label class="kng-v3-label"><?php esc_html_e('Default JS Location', 'king-addons'); ?></label> |
| 94 |
<select name="default_location_js" class="kng-v3-select"> |
| 95 |
<option value="head" <?php selected($settings['default_location_js'], 'head'); ?>><?php esc_html_e('Head', 'king-addons'); ?></option> |
| 96 |
<option value="footer" <?php selected($settings['default_location_js'], 'footer'); ?>><?php esc_html_e('Footer', 'king-addons'); ?></option> |
| 97 |
</select> |
| 98 |
</div> |
| 99 |
</div> |
| 100 |
<div class="kng-v3-field"> |
| 101 |
<label class="kng-v3-label"><?php esc_html_e('Default Priority', 'king-addons'); ?></label> |
| 102 |
<input type="number" name="default_priority" class="kng-v3-input kng-v3-input--small" value="<?php echo esc_attr($settings['default_priority']); ?>" min="1" max="9999" /> |
| 103 |
</div> |
| 104 |
</div> |
| 105 |
</div> |
| 106 |
|
| 107 |
<!-- Debug Settings --> |
| 108 |
<div class="kng-cc-settings-card"> |
| 109 |
<div class="kng-cc-settings-card-header"> |
| 110 |
<h3> |
| 111 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="20" height="20"> |
| 112 |
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/> |
| 113 |
</svg> |
| 114 |
<?php esc_html_e('Debug', 'king-addons'); ?> |
| 115 |
</h3> |
| 116 |
</div> |
| 117 |
<div class="kng-cc-settings-card-content"> |
| 118 |
<div class="kng-v3-field"> |
| 119 |
<label class="kng-v3-toggle-wrap kng-v3-toggle-row"> |
| 120 |
<input type="checkbox" name="debug_mode" <?php checked($settings['debug_mode']); ?> /> |
| 121 |
<span class="kng-v3-toggle-slider"></span> |
| 122 |
<span class="kng-v3-toggle-text"><?php esc_html_e('Enable Debug Mode', 'king-addons'); ?></span> |
| 123 |
</label> |
| 124 |
<p class="kng-v3-field-help"><?php esc_html_e('When enabled, logs which snippets are loaded on each page to browser console (visible to admins only).', 'king-addons'); ?></p> |
| 125 |
</div> |
| 126 |
</div> |
| 127 |
</div> |
| 128 |
|
| 129 |
<div class="kng-cc-settings-actions"> |
| 130 |
<button type="submit" class="kng-v3-btn kng-v3-btn--primary" id="kng-cc-save-settings"> |
| 131 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18"> |
| 132 |
<path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/> |
| 133 |
<polyline points="17 21 17 13 7 13 7 21"/> |
| 134 |
<polyline points="7 3 7 8 15 8"/> |
| 135 |
</svg> |
| 136 |
<?php esc_html_e('Save Settings', 'king-addons'); ?> |
| 137 |
</button> |
| 138 |
</div> |
| 139 |
</form> |
| 140 |
</div> |
| 141 |
</div> |
| 142 |
|