PluginProbe
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) / 2.0.1
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) v2.0.1
2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 trunk 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 All 57 releases
darkify / src / Admin / Views / AdvancedSettings.php

AdvancedSettings.php in Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) 2.0.1, at src/Admin/Views/AdvancedSettings.php

319 lines 18.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * AdvancedSettings class for Advanced options.
5 *
6 * @link https://themeatelier.net
7 * @since 1.0.0
8 *
9 * @package darkify
10 * @subpackage darkify/src/Admin/Views/AdvancedSettings
11 * @author ThemeAtelier<themeatelierbd@gmail.com>
12 */
13
14 namespace ThemeAtelier\Darkify\Admin\Views;
15
16 use ThemeAtelier\Darkify\Admin\Schema\SchemaRegistry as Darkify;
17
18 class AdvancedSettings
19 {
20 /**
21 * Create Option fields for the setting options.
22 *
23 * @param string $prefix Option setting key prefix.
24 * @return void
25 */
26 public static function options($prefix)
27 {
28 Darkify::createSection($prefix, array(
29 'title' => esc_html__('Advanced', 'darkify'),
30 'icon' => 'icofont-settings',
31 'fields' => array(
32 array(
33 'type' => 'section_tab',
34 'tabs' => array(
35 array(
36 'title' => esc_html__('HTML/CSS Restriction', 'darkify'),
37 'icon' => 'icofont-code-alt',
38 'fields' => array(
39 // Intro line, rendered plain above the section card.
40 array(
41 'type' => 'page_hint',
42 'content' => esc_html__('Restrict which HTML elements dark mode applies to, by tag, CSS class, or CSS ID.', 'darkify'),
43 ),
44 // ===== HTML/CSS RESTRICTION =====
45 array(
46 'type' => 'heading',
47 'title' => esc_html__('HTML/CSS Restriction', 'darkify'),
48 'section_start' => true,
49 ),
50 // ALLOWED ELEMENTS
51 array(
52 'id' => 'allowed_elements',
53 'type' => 'textarea',
54 'title' => esc_html__('Allow Only Elements', 'darkify'),
55 'title_help' =>
56 '<div class="darkify-info-label">' .
57 __('Dark mode will be applied only to these elements.', 'darkify') .
58 '</div>',
59 'placeholder' => esc_html__(
60 'Enter comma-separated HTML tags, CSS classes, or CSS IDs. Example: div, #site-header, .my-footer',
61 'darkify'
62 ),
63
64
65 'class' => 'only_pro',
66 ),
67
68 array(
69 'id' => 'allowed_elements_force_to_correct',
70 'type' => 'switcher',
71 'title' => esc_html__('Force Design Correction', 'darkify'),
72 'title_help' =>
73 '<div class="darkify-info-label">' .
74 __('Force Darkify to preserve layout and readability when background or text colors are modified on allowed elements.', 'darkify') .
75 '</div>',
76
77 'class' => 'switcher_pro_only',
78 'text_on' => esc_html__('Yes', 'darkify'),
79 'text_off' => esc_html__('No', 'darkify'),
80 'default' => true,
81 ),
82
83 // DISALLOWED ELEMENTS
84 array(
85 'id' => 'disallowed_elements',
86 'type' => 'textarea',
87 'class' => 'only_pro',
88 'title' => esc_html__('Disallowed Elements', 'darkify'),
89 'title_help' =>
90 '<div class="darkify-info-label">' .
91 esc_html__('Dark mode will NOT be applied to the elements.', 'darkify') .
92 '</div>',
93
94 'placeholder' => esc_html__(
95 'Enter comma-separated HTML tags, CSS classes, or CSS IDs. Example: div, #site-header, .my-footer',
96 'darkify'
97 ),
98
99 ),
100
101 array(
102 'id' => 'disallowed_elements_force_to_correct',
103 'type' => 'switcher',
104 'title' => esc_html__('Force To Correct', 'darkify'),
105 'title_help' => '<div class="darkify-info-label">' .
106 __('Force Darkify to keep the design correct when background or text colors do not work properly for disallowed elements.', 'darkify') .
107 '</div>',
108
109 'class' => 'switcher_pro_only',
110 'text_on' => esc_html__('Yes', 'darkify'),
111 'text_off' => esc_html__('No', 'darkify'),
112 'default' => true,
113 ),
114 )
115 ),
116
117 array(
118 'title' => esc_html__('Page/Posts Restriction', 'darkify'),
119 'icon' => 'icofont-eye-blocked',
120 'fields' => array(
121 // Intro line, rendered plain above the section cards.
122 array(
123 'type' => 'page_hint',
124 'content' => esc_html__('Limit where dark mode and the floating switch run, by specific pages or posts.', 'darkify'),
125 ),
126 array(
127 'type' => 'heading',
128 'title' => esc_html__('Pages Restriction', 'darkify'),
129 'section_start' => true,
130 ),
131 array(
132 'id' => 'allowed_pages',
133 'type' => 'select',
134 'title' => esc_html__('Allow Only Pages', 'darkify'),
135 'title_help' =>
136 '<div class="darkify-info-label">' .
137 __('Dark mode will be applied only to the selected pages.', 'darkify') .
138 '</div><div class="darkify-short-content">' .
139 __('Choose only the pages where dark mode and the floating switch should work. Dark mode will not be applied to any other pages.', 'darkify') .
140 '</div>',
141 'placeholder' => esc_html__('Select pages', 'darkify'),
142
143 'class' => 'only_pro',
144 'options' => 'pages',
145 'chosen' => true,
146 'multiple' => true,
147 ),
148
149 array(
150 'id' => 'disallowed_pages',
151 'type' => 'select',
152 'title' => esc_html__('Disallowed Pages', 'darkify'),
153 'title_help' =>
154 '<div class="darkify-info-label">' .
155 __('Dark mode will not be applied to these pages.', 'darkify') .
156 '</div><div class="darkify-short-content">' .
157 __('Choose the pages where dark mode and the floating switch should not work. Dark mode will work on all other pages.', 'darkify') .
158 '</div>',
159
160 'class' => 'only_pro',
161 'placeholder' => esc_html__('Select pages', 'darkify'),
162 'options' => 'pages',
163 'chosen' => true,
164 'multiple' => true,
165 'dependency' => array('allowed_pages', '==', ''),
166 ),
167
168 array(
169 'type' => 'heading',
170 'title' => esc_html__('Posts Restriction', 'darkify'),
171 'section_start' => true,
172 ),
173 array(
174 'id' => 'allowed_posts',
175 'type' => 'select',
176 'title' => esc_html__('Allow Only Posts', 'darkify'),
177 'title_help' =>
178 '<div class="darkify-info-label">' .
179 __('Dark mode will be applied only to these posts.', 'darkify') .
180 '</div><div class="darkify-short-content">' .
181 __('Choose only the posts where dark mode and the floating switch should work. Dark mode will not be applied to any other posts.', 'darkify') .
182 '</div>',
183
184 'placeholder' => esc_html__('Select posts', 'darkify'),
185 'class' => 'only_pro',
186 'options' => 'posts',
187 'chosen' => true,
188 'multiple' => true,
189 ),
190 array(
191 'id' => 'disallowed_posts',
192 'type' => 'select',
193 'title' => esc_html__('Disallowed Posts', 'darkify'),
194 'title_help' =>
195 '<div class="darkify-info-label">' .
196 __('Dark mode will not be applied to these posts.', 'darkify') .
197 '</div><div class="darkify-short-content">' .
198 __('Choose the posts where dark mode and the floating switch cannot work. Other posts will be able to process dark mode.', 'darkify') .
199 '</div>',
200 'placeholder' => esc_html__('Select posts', 'darkify'),
201 'class' => 'only_pro',
202 'options' => 'posts',
203 'chosen' => true,
204 'multiple' => true,
205 'dependency' => array('allowed_posts', '==', ''),
206 ),
207 )
208 ),
209 array(
210 'title' => esc_html__('Custom CSS', 'darkify'),
211 'icon' => 'icofont-file-css',
212 'fields' => array(
213 // Intro line, rendered plain above the section card.
214 array(
215 'type' => 'page_hint',
216 'content' => esc_html__('Add your own CSS for dark mode, and CSS that applies in both modes.', 'darkify'),
217 ),
218 // ===== CUSTOM CSS =====
219 array(
220 'type' => 'heading',
221 'title' => esc_html__('Custom CSS', 'darkify'),
222 'section_start' => true,
223 ),
224 array(
225 'id' => 'custom_css',
226 'type' => 'code_editor',
227 'title' => esc_html__('Dark Mode CSS', 'darkify'),
228 'title_help' =>
229 '<div class="darkify-info-label">' .
230 __('The CSS code will only be applied when dark mode is active.', 'darkify') .
231 '</div>',
232
233 'settings' => array(
234 'theme' => 'default',
235 'mode' => 'css',
236 ),
237 ),
238 array(
239 'id' => 'custom_css_rules',
240 'type' => 'switcher',
241 'title' => esc_html__('CSS Rules', 'darkify'),
242
243 'title_help' =>
244 '<div class="darkify-info-label">' .
245 __('CSS rules will be applied to all child elements of the specified CSS selectors.', 'darkify') .
246 '</div>' .
247 '<div class="darkify-short-content">' .
248 __('Custom CSS selectors are automatically treated as Disallowed Elements. To override this behavior, use the :not-disallowed pseudo-class. Example: body:not-disallowed { ... }', 'darkify') .
249 '</div>' .
250 '' .
251 '',
252
253 'text_on' => esc_html__('Yes', 'darkify'),
254 'text_off' => esc_html__('No', 'darkify'),
255
256 'class' => 'switcher_pro_only',
257 ),
258 array(
259 'id' => 'normal_custom_css',
260 'type' => 'code_editor',
261 'title' => esc_html__('Normal Mode CSS', 'darkify'),
262 'title_help' =>
263 '<div class="darkify-info-label">' .
264 __('The CSS code will be applied in both normal mode and dark mode.', 'darkify') .
265 '</div>' .
266 '' .
267 '',
268
269 'settings' => array(
270 'theme' => 'default',
271 'mode' => 'css',
272 ),
273 ),
274 )
275 ),
276 // "Extras" — the Frontend Iframe Dark Mode toggle lives here,
277 // matching Pro's layout (moved out of Controls → Frontend). The
278 // page's former Extras contents (Clean-up Data on Deletion +
279 // Backup and Restore) now live on their own Tools page — see
280 // Views/Tools.php.
281 array(
282 'title' => esc_html__('Extras', 'darkify'),
283 'icon' => 'icofont-holding-hands',
284 'fields' => array(
285 // Intro line, rendered plain above the section card.
286 array(
287 'type' => 'page_hint',
288 'content' => esc_html__('Extra behaviors that don’t fit elsewhere.', 'darkify'),
289 ),
290 // ===== EXTRAS =====
291 array(
292 'type' => 'heading',
293 'title' => esc_html__('Extras', 'darkify'),
294 'section_start' => true,
295 ),
296 array(
297 'id' => 'enable_frontend_iframe_dark_mode',
298 'type' => 'switcher',
299 'title' => esc_html__('Frontend Iframe Dark Mode', 'darkify'),
300 'title_help' =>
301 '<div class="darkify-info-label">' .
302 __('Apply dark mode to iframes when dark mode is active. Same-origin iframes receive full dark mode styling; cross-origin iframes (embedded third-party widgets) are dimmed to 60% brightness. Disable to keep all iframes at their original appearance.', 'darkify') .
303 '</div>' .
304 '' .
305 '',
306 'text_on' => esc_html__('Enabled', 'darkify'),
307 'text_off' => esc_html__('Disabled', 'darkify'),
308 'text_width' => 100,
309 'default' => true,
310 ),
311 )
312 ),
313 )
314 ),
315 ),
316 ));
317 }
318 }
319