PluginProbe
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder / 51.1.49
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder v51.1.49
51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 51.1.45 51.1.46 51.1.47 51.1.49 All 37 releases
king-addons / includes / extensions / Custom_Code_Manager / templates / admin-list.php

admin-list.php in King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder 51.1.49, at includes/extensions/Custom_Code_Manager/templates/admin-list.php

303 lines 18.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Custom Code Manager - List 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 $snippets */
13 /** @var int $snippet_count */
14 /** @var bool $has_pro */
15 /** @var bool $at_limit */
16 ?>
17 <div class="kng-cc-admin">
18 <!-- Header -->
19 <header class="kng-cc-header">
20 <div class="kng-cc-header-left">
21 <h1 class="kng-cc-title">
22 <?php esc_html_e('Custom Code', 'king-addons'); ?>
23 <?php if (!$has_pro): ?>
24 <span class="kng-cc-limit-badge"><?php echo esc_html($snippet_count); ?>/<?php echo esc_html(Custom_Code_Manager::FREE_LIMIT); ?></span>
25 <?php endif; ?>
26 </h1>
27 <p class="kng-cc-subtitle"><?php echo esc_html($snippet_count); ?> <?php esc_html_e('snippets', 'king-addons'); ?></p>
28 </div>
29 <div class="kng-cc-header-right">
30 <a href="<?php echo esc_url(admin_url('admin.php?page=king-addons-custom-code&view=import-export')); ?>" class="kng-v3-btn kng-v3-btn--ghost">
31 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18">
32 <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
33 <polyline points="17 8 12 3 7 8"/>
34 <line x1="12" y1="3" x2="12" y2="15"/>
35 </svg>
36 <?php esc_html_e('Import / Export', 'king-addons'); ?>
37 </a>
38 <a href="<?php echo esc_url(admin_url('admin.php?page=king-addons-custom-code&view=settings')); ?>" class="kng-v3-btn kng-v3-btn--ghost">
39 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18">
40 <circle cx="12" cy="12" r="3"/>
41 <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"/>
42 </svg>
43 <?php esc_html_e('Settings', 'king-addons'); ?>
44 </a>
45 <?php if ($at_limit): ?>
46 <button type="button" class="kng-v3-btn kng-v3-btn--primary" disabled title="<?php esc_attr_e('Free version limit reached', 'king-addons'); ?>">
47 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18">
48 <line x1="12" y1="5" x2="12" y2="19"/>
49 <line x1="5" y1="12" x2="19" y2="12"/>
50 </svg>
51 <?php esc_html_e('Add New', 'king-addons'); ?>
52 </button>
53 <?php else: ?>
54 <a href="<?php echo esc_url(admin_url('admin.php?page=king-addons-custom-code&view=new')); ?>" class="kng-v3-btn kng-v3-btn--primary">
55 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18">
56 <line x1="12" y1="5" x2="12" y2="19"/>
57 <line x1="5" y1="12" x2="19" y2="12"/>
58 </svg>
59 <?php esc_html_e('Add New', 'king-addons'); ?>
60 </a>
61 <?php endif; ?>
62 </div>
63 </header>
64
65 <!-- Filters & Bulk Actions -->
66 <div class="kng-cc-toolbar">
67 <div class="kng-cc-toolbar-left">
68 <div class="kng-cc-bulk-actions">
69 <label class="kng-cc-checkbox-wrap kng-cc-select-all-wrap">
70 <input type="checkbox" class="kng-cc-select-all" />
71 <span class="kng-cc-checkbox-custom"></span>
72 </label>
73 <select class="kng-cc-bulk-select kng-v3-select" id="kng-cc-bulk-action">
74 <option value=""><?php esc_html_e('Bulk Actions', 'king-addons'); ?></option>
75 <option value="enable"><?php esc_html_e('Enable', 'king-addons'); ?></option>
76 <option value="disable"><?php esc_html_e('Disable', 'king-addons'); ?></option>
77 <option value="delete"><?php esc_html_e('Delete', 'king-addons'); ?></option>
78 </select>
79 <button type="button" class="kng-v3-btn kng-v3-btn--ghost kng-v3-btn--sm" id="kng-cc-bulk-apply">
80 <?php esc_html_e('Apply', 'king-addons'); ?>
81 </button>
82 </div>
83 </div>
84 <div class="kng-cc-toolbar-right">
85 <div class="kng-cc-filters">
86 <select class="kng-v3-select kng-cc-filter" data-filter="type">
87 <option value=""><?php esc_html_e('All Types', 'king-addons'); ?></option>
88 <option value="css">CSS</option>
89 <option value="js">JavaScript</option>
90 <?php if ($has_pro): ?>
91 <option value="html">HTML</option>
92 <?php endif; ?>
93 </select>
94 <select class="kng-v3-select kng-cc-filter" data-filter="status">
95 <option value=""><?php esc_html_e('All Status', 'king-addons'); ?></option>
96 <option value="enabled"><?php esc_html_e('Enabled', 'king-addons'); ?></option>
97 <option value="disabled"><?php esc_html_e('Disabled', 'king-addons'); ?></option>
98 </select>
99 <select class="kng-v3-select kng-cc-filter" data-filter="location">
100 <option value=""><?php esc_html_e('All Locations', 'king-addons'); ?></option>
101 <option value="head"><?php esc_html_e('Head', 'king-addons'); ?></option>
102 <option value="footer"><?php esc_html_e('Footer', 'king-addons'); ?></option>
103 <?php if ($has_pro): ?>
104 <option value="body_open"><?php esc_html_e('Body Open', 'king-addons'); ?></option>
105 <option value="custom_hook"><?php esc_html_e('Custom Hook', 'king-addons'); ?></option>
106 <?php endif; ?>
107 </select>
108 </div>
109 <div class="kng-cc-search">
110 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18">
111 <circle cx="11" cy="11" r="8"/>
112 <line x1="21" y1="21" x2="16.65" y2="16.65"/>
113 </svg>
114 <input type="text" class="kng-v3-input" placeholder="<?php esc_attr_e('Search snippets...', 'king-addons'); ?>" id="kng-cc-search" />
115 </div>
116 </div>
117 </div>
118
119 <!-- Snippets List -->
120 <div class="kng-cc-list">
121 <?php if (empty($snippets)): ?>
122 <div class="kng-cc-empty">
123 <div class="kng-cc-empty-icon">
124 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" width="64" height="64">
125 <polyline points="16 18 22 12 16 6"/>
126 <polyline points="8 6 2 12 8 18"/>
127 </svg>
128 </div>
129 <h3><?php esc_html_e('No snippets yet', 'king-addons'); ?></h3>
130 <p><?php esc_html_e('Create your first custom code snippet to add CSS, JavaScript, or HTML to your site.', 'king-addons'); ?></p>
131 <a href="<?php echo esc_url(admin_url('admin.php?page=king-addons-custom-code&view=new')); ?>" class="kng-v3-btn kng-v3-btn--primary">
132 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18">
133 <line x1="12" y1="5" x2="12" y2="19"/>
134 <line x1="5" y1="12" x2="19" y2="12"/>
135 </svg>
136 <?php esc_html_e('Create First Snippet', 'king-addons'); ?>
137 </a>
138 </div>
139 <?php else: ?>
140 <div class="kng-cc-table-wrap">
141 <table class="kng-cc-table">
142 <thead>
143 <tr>
144 <th class="kng-cc-col-check"></th>
145 <th class="kng-cc-col-name"><?php esc_html_e('Name', 'king-addons'); ?></th>
146 <th class="kng-cc-col-type"><?php esc_html_e('Type', 'king-addons'); ?></th>
147 <th class="kng-cc-col-location"><?php esc_html_e('Location', 'king-addons'); ?></th>
148 <th class="kng-cc-col-scope"><?php esc_html_e('Scope', 'king-addons'); ?></th>
149 <th class="kng-cc-col-priority"><?php esc_html_e('Priority', 'king-addons'); ?></th>
150 <th class="kng-cc-col-status"><?php esc_html_e('Status', 'king-addons'); ?></th>
151 <th class="kng-cc-col-modified"><?php esc_html_e('Modified', 'king-addons'); ?></th>
152 <th class="kng-cc-col-actions"><?php esc_html_e('Actions', 'king-addons'); ?></th>
153 </tr>
154 </thead>
155 <tbody id="kng-cc-snippets-list">
156 <?php foreach ($snippets as $snippet): ?>
157 <tr class="kng-cc-row"
158 data-id="<?php echo esc_attr($snippet['id']); ?>"
159 data-type="<?php echo esc_attr($snippet['type']); ?>"
160 data-status="<?php echo esc_attr($snippet['status']); ?>"
161 data-location="<?php echo esc_attr($snippet['location']); ?>">
162 <td class="kng-cc-col-check">
163 <label class="kng-cc-checkbox-wrap">
164 <input type="checkbox" class="kng-cc-row-check" value="<?php echo esc_attr($snippet['id']); ?>" />
165 <span class="kng-cc-checkbox-custom"></span>
166 </label>
167 </td>
168 <td class="kng-cc-col-name">
169 <a href="<?php echo esc_url(admin_url('admin.php?page=king-addons-custom-code&view=edit&id=' . $snippet['id'])); ?>" class="kng-cc-name-link">
170 <?php echo esc_html($snippet['title'] ?: __('(no title)', 'king-addons')); ?>
171 </a>
172 <?php if (!empty($snippet['notes'])): ?>
173 <span class="kng-cc-has-notes" title="<?php echo esc_attr($snippet['notes']); ?>">
174 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="14" height="14">
175 <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
176 <polyline points="14 2 14 8 20 8"/>
177 <line x1="16" y1="13" x2="8" y2="13"/>
178 <line x1="16" y1="17" x2="8" y2="17"/>
179 </svg>
180 </span>
181 <?php endif; ?>
182 </td>
183 <td class="kng-cc-col-type">
184 <span class="kng-cc-type-badge kng-cc-type-<?php echo esc_attr($snippet['type']); ?>">
185 <?php echo esc_html(strtoupper($snippet['type'])); ?>
186 </span>
187 </td>
188 <td class="kng-cc-col-location">
189 <span class="kng-cc-location-badge">
190 <?php
191 $locations = [
192 'head' => __('Head', 'king-addons'),
193 'footer' => __('Footer', 'king-addons'),
194 'body_open' => __('Body Open', 'king-addons'),
195 'custom_hook' => $snippet['custom_hook'] ?: __('Custom Hook', 'king-addons'),
196 ];
197 echo esc_html($locations[$snippet['location']] ?? $snippet['location']);
198 ?>
199 </span>
200 </td>
201 <td class="kng-cc-col-scope">
202 <span class="kng-cc-scope-badge kng-cc-scope-<?php echo esc_attr($snippet['scope_mode']); ?>">
203 <?php
204 $scopes = [
205 'global' => __('Global', 'king-addons'),
206 'include' => __('Include', 'king-addons'),
207 'exclude' => __('Exclude', 'king-addons'),
208 ];
209 echo esc_html($scopes[$snippet['scope_mode']] ?? $snippet['scope_mode']);
210 ?>
211 </span>
212 <?php if (!empty($snippet['rules'])): ?>
213 <span class="kng-cc-rules-count"><?php echo count($snippet['rules']); ?> <?php esc_html_e('rules', 'king-addons'); ?></span>
214 <?php endif; ?>
215 </td>
216 <td class="kng-cc-col-priority">
217 <?php echo esc_html($snippet['priority']); ?>
218 </td>
219 <td class="kng-cc-col-status">
220 <label class="kng-v3-toggle-wrap">
221 <input type="checkbox"
222 class="kng-cc-status-toggle"
223 data-id="<?php echo esc_attr($snippet['id']); ?>"
224 <?php checked($snippet['status'], 'enabled'); ?> />
225 <span class="kng-v3-toggle-slider"></span>
226 </label>
227 </td>
228 <td class="kng-cc-col-modified">
229 <span class="kng-cc-date" title="<?php echo esc_attr($snippet['modified']); ?>">
230 <?php echo esc_html(human_time_diff(strtotime($snippet['modified'])) . ' ' . __('ago', 'king-addons')); ?>
231 </span>
232 </td>
233 <td class="kng-cc-col-actions">
234 <div class="kng-cc-actions">
235 <a href="<?php echo esc_url(admin_url('admin.php?page=king-addons-custom-code&view=edit&id=' . $snippet['id'])); ?>"
236 class="kng-cc-action-btn"
237 title="<?php esc_attr_e('Edit', 'king-addons'); ?>">
238 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16">
239 <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
240 <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
241 </svg>
242 </a>
243 <button type="button"
244 class="kng-cc-action-btn kng-cc-duplicate-btn"
245 data-id="<?php echo esc_attr($snippet['id']); ?>"
246 title="<?php esc_attr_e('Duplicate', 'king-addons'); ?>">
247 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16">
248 <rect x="9" y="9" width="13" height="13" rx="2"/>
249 <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
250 </svg>
251 </button>
252 <button type="button"
253 class="kng-cc-action-btn kng-cc-export-btn"
254 data-id="<?php echo esc_attr($snippet['id']); ?>"
255 title="<?php esc_attr_e('Export', 'king-addons'); ?>">
256 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16">
257 <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
258 <polyline points="7 10 12 15 17 10"/>
259 <line x1="12" y1="15" x2="12" y2="3"/>
260 </svg>
261 </button>
262 <button type="button"
263 class="kng-cc-action-btn kng-cc-action-btn--danger kng-cc-delete-btn"
264 data-id="<?php echo esc_attr($snippet['id']); ?>"
265 title="<?php esc_attr_e('Delete', 'king-addons'); ?>">
266 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16">
267 <polyline points="3 6 5 6 21 6"/>
268 <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
269 <line x1="10" y1="11" x2="10" y2="17"/>
270 <line x1="14" y1="11" x2="14" y2="17"/>
271 </svg>
272 </button>
273 </div>
274 </td>
275 </tr>
276 <?php endforeach; ?>
277 </tbody>
278 </table>
279 </div>
280 <?php endif; ?>
281 </div>
282
283 <?php if (!$has_pro): ?>
284 <!-- Pro Upsell -->
285 <div class="kng-cc-pro-upsell">
286 <div class="kng-cc-pro-upsell-content">
287 <div class="kng-cc-pro-upsell-icon">
288 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" width="32" height="32">
289 <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>
290 </svg>
291 </div>
292 <div class="kng-cc-pro-upsell-text">
293 <h4><?php esc_html_e('Unlock Pro Features', 'king-addons'); ?></h4>
294 <p><?php esc_html_e('Get HTML snippets, unlimited code blocks, body open injection, custom hooks, advanced rules, and more.', 'king-addons'); ?></p>
295 </div>
296 <a href="<?php echo esc_url(admin_url('admin.php?page=king-addons-upgrade')); ?>" class="kng-v3-btn kng-v3-btn--accent">
297 <?php esc_html_e('Upgrade to Pro', 'king-addons'); ?>
298 </a>
299 </div>
300 </div>
301 <?php endif; ?>
302 </div>
303