PluginProbe
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) / 1.4.23
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) v1.4.23
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) 1.4.23, at src/Admin/Views/AdvancedSettings.php

335 lines 21.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\Framework\Classes\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 // ALLOWED ELEMENTS
40 array(
41 'id' => 'allowed_elements',
42 'type' => 'textarea',
43 'title' => esc_html__('Allow Only Elements', 'darkify'),
44 'title_help' =>
45 '<div class="darkify-info-label">' .
46 __('Dark mode will be applied only to these elements.', 'darkify') .
47 '</div><a class="tooltip_btn_primary" href="' . DARKIFY_DEMO_URL . 'advanced/#element_targeting" target="_blank">' .
48 __('Live Demo', 'darkify') .
49 '</a><a class="tooltip_btn_secondary" href="' . DARKIFY_DOCS_URL . 'advanced/#html-css-restriction" target="_blank">' .
50 __('Open Docs', 'darkify') .
51 '</a>',
52 'placeholder' => esc_html__(
53 'Enter comma-separated HTML tags, CSS classes, or CSS IDs. Example: div, #site-header, .my-footer',
54 'darkify'
55 ),
56
57
58 'class' => 'only_pro',
59 ),
60
61 array(
62 'id' => 'allowed_elements_force_to_correct',
63 'type' => 'switcher',
64 'title' => esc_html__('Force Design Correction', 'darkify'),
65 'title_help' =>
66 '<div class="darkify-info-label">' .
67 __('Force Darkify to preserve layout and readability when background or text colors are modified on allowed elements.', 'darkify') .
68 '</div><a class="tooltip_btn_primary" href="' . DARKIFY_DEMO_URL . 'advanced/#element_targeting" target="_blank">' .
69 __('Live Demo', 'darkify') .
70 '</a><a class="tooltip_btn_secondary" href="' . DARKIFY_DOCS_URL . 'advanced/#html-css-restriction" target="_blank">' .
71 __('Open Docs', 'darkify') .
72 '</a>',
73
74 'class' => 'switcher_pro_only',
75 'text_on' => esc_html__('Yes', 'darkify'),
76 'text_off' => esc_html__('No', 'darkify'),
77 'default' => true,
78 ),
79
80 // DISALLOWED ELEMENTS
81 array(
82 'id' => 'disallowed_elements',
83 'type' => 'textarea',
84 'class' => 'only_pro',
85 'title' => esc_html__('Disallowed Elements', 'darkify'),
86 'title_help' =>
87 '<div class="darkify-info-label">' .
88 esc_html__('Dark mode will NOT be applied to the elements.', 'darkify') .
89 '</div><a class="tooltip_btn_primary" href="' . DARKIFY_DEMO_URL . 'advanced/#element_targeting" target="_blank">' .
90 esc_html__('Live Demo', 'darkify') .
91 '</a><a class="tooltip_btn_secondary" href="' . DARKIFY_DOCS_URL . 'advanced/#html-css-restriction" target="_blank">' .
92 esc_html__('Open Docs', 'darkify') .
93 '</a>',
94
95 'placeholder' => esc_html__(
96 'Enter comma-separated HTML tags, CSS classes, or CSS IDs. Example: div, #site-header, .my-footer',
97 'darkify'
98 ),
99
100 ),
101
102 array(
103 'id' => 'disallowed_elements_force_to_correct',
104 'type' => 'switcher',
105 'title' => esc_html__('Force To Correct', 'darkify'),
106 'title_help' => '<div class="darkify-info-label">' .
107 __('Force Darkify to keep the design correct when background or text colors do not work properly for disallowed elements.', 'darkify') .
108 '</div><a class="tooltip_btn_primary" href="' . DARKIFY_DEMO_URL . 'advanced/#element_targeting" target="_blank">' .
109 __('Live Demo', 'darkify') .
110 '</a><a class="tooltip_btn_secondary" href="' . DARKIFY_DOCS_URL . 'advanced/#html-css-restriction" target="_blank">' .
111 __('Open Docs', 'darkify') .
112 '</a>',
113
114 'class' => 'switcher_pro_only',
115 'text_on' => esc_html__('Yes', 'darkify'),
116 'text_off' => esc_html__('No', 'darkify'),
117 'default' => true,
118 ),
119 )
120 ),
121
122 array(
123 'title' => esc_html__('Page/Posts Restriction', 'darkify'),
124 'icon' => 'icofont-eye-blocked',
125 'fields' => array(
126 array(
127 'type' => 'heading',
128 'title' => esc_html__('Pages Restriction', 'darkify'),
129 ),
130 array(
131 'id' => 'allowed_pages',
132 'type' => 'select',
133 'title' => esc_html__('Allow Only Pages', 'darkify'),
134 'title_help' =>
135 '<div class="darkify-info-label">' .
136 __('Dark mode will be applied only to the selected pages.', 'darkify') .
137 '</div><div class="darkify-short-content">' .
138 __('Choose only the pages where dark mode and the floating switch should work. Dark mode will not be applied to any other pages.', 'darkify') .
139 '</div><a class="tooltip_btn_primary" href="' . DARKIFY_DEMO_URL . 'advanced/#granular_control" target="_blank">' .
140 __('Live Demo', 'darkify') .
141 '</a><a class="tooltip_btn_secondary" href="' . DARKIFY_DOCS_URL . 'advanced/#pages-restriction" target="_blank">' .
142 __('Open Docs', 'darkify') .
143 '</a>',
144 'placeholder' => esc_html__('Select pages', 'darkify'),
145
146 'class' => 'only_pro',
147 'options' => 'pages',
148 'chosen' => true,
149 'multiple' => true,
150 ),
151
152 array(
153 'id' => 'disallowed_pages',
154 'type' => 'select',
155 'title' => esc_html__('Disallowed Pages', 'darkify'),
156 'title_help' =>
157 '<div class="darkify-info-label">' .
158 __('Dark mode will not be applied to these pages.', 'darkify') .
159 '</div><div class="darkify-short-content">' .
160 __('Choose the pages where dark mode and the floating switch should not work. Dark mode will work on all other pages.', 'darkify') .
161 '</div><a class="tooltip_btn_primary" href="' . DARKIFY_DEMO_URL . 'advanced/#granular_control" target="_blank">' .
162 __('Live Demo', 'darkify') .
163 '</a><a class="tooltip_btn_secondary" href="' . DARKIFY_DOCS_URL . 'advanced/#pages-restriction" target="_blank">' .
164 __('Open Docs', 'darkify') .
165 '</a>',
166
167 'class' => 'only_pro',
168 'placeholder' => esc_html__('Select pages', 'darkify'),
169 'options' => 'pages',
170 'chosen' => true,
171 'multiple' => true,
172 'dependency' => array('allowed_pages', '==', ''),
173 ),
174
175 array(
176 'type' => 'heading',
177 'title' => esc_html__('Posts Restriction', 'darkify'),
178 ),
179 array(
180 'id' => 'allowed_posts',
181 'type' => 'select',
182 'title' => esc_html__('Allow Only Posts', 'darkify'),
183 'title_help' =>
184 '<div class="darkify-info-label">' .
185 __('Dark mode will be applied only to these posts.', 'darkify') .
186 '</div><div class="darkify-short-content">' .
187 __('Choose only the posts where dark mode and the floating switch should work. Dark mode will not be applied to any other posts.', 'darkify') .
188 '</div><a class="tooltip_btn_primary" href="' . DARKIFY_DEMO_URL . 'advanced/#granular_control" target="_blank">' .
189 __('Live Demo', 'darkify') .
190 '</a><a class="tooltip_btn_secondary" href="' . DARKIFY_DOCS_URL . 'advanced/#posts-restriction" target="_blank">' .
191 __('Open Docs', 'darkify') .
192 '</a>',
193
194 'placeholder' => esc_html__('Select posts', 'darkify'),
195 'class' => 'only_pro',
196 'options' => 'posts',
197 'chosen' => true,
198 'multiple' => true,
199 ),
200 array(
201 'id' => 'disallowed_posts',
202 'type' => 'select',
203 'title' => esc_html__('Disallowed Posts', 'darkify'),
204 'title_help' =>
205 '<div class="darkify-info-label">' .
206 __('Dark mode will not be applied to these posts.', 'darkify') .
207 '</div><div class="darkify-short-content">' .
208 __('Choose the posts where dark mode and the floating switch cannot work. Other posts will be able to process dark mode.', 'darkify') .
209 '</div><a class="tooltip_btn_primary" href="' . DARKIFY_DEMO_URL . 'advanced/#granular_control" target="_blank">' .
210 __('Live Demo', 'darkify') .
211 '</a><a class="tooltip_btn_secondary" href="' . DARKIFY_DOCS_URL . 'advanced/#posts-restriction" target="_blank">' .
212 __('Open Docs', 'darkify') .
213 '</a>',
214 'placeholder' => esc_html__('Select posts', 'darkify'),
215 'class' => 'only_pro',
216 'options' => 'posts',
217 'chosen' => true,
218 'multiple' => true,
219 'dependency' => array('allowed_posts', '==', ''),
220 ),
221 )
222 ),
223 array(
224 'title' => esc_html__('Custom CSS', 'darkify'),
225 'icon' => 'icofont-file-css',
226 'fields' => array(
227 array(
228 'id' => 'custom_css',
229 'type' => 'code_editor',
230 'title' => esc_html__('Dark Mode CSS', 'darkify'),
231 'title_help' =>
232 '<div class="darkify-info-label">' .
233 __('The CSS code will only be applied when dark mode is active.', 'darkify') .
234 '</div><a class="tooltip_btn_primary" href="' . DARKIFY_DEMO_URL . 'advanced/#custom_css" target="_blank">' .
235 __('Live Demo', 'darkify') .
236 '</a><a class="tooltip_btn_secondary" href="' . DARKIFY_DOCS_URL . 'advanced/#custom-css" target="_blank">' .
237 __('Open Docs', 'darkify') .
238 '</a>',
239
240 'settings' => array(
241 'theme' => 'default',
242 'mode' => 'css',
243 ),
244 ),
245 array(
246 'id' => 'custom_css_rules',
247 'type' => 'switcher',
248 'title' => esc_html__('CSS Rules', 'darkify'),
249
250 'title_help' =>
251 '<div class="darkify-info-label">' .
252 __('CSS rules will be applied to all child elements of the specified CSS selectors.', 'darkify') .
253 '</div>' .
254 '<div class="darkify-short-content">' .
255 __('Custom CSS selectors are automatically treated as Disallowed Elements. To override this behavior, use the :not-disallowed pseudo-class. Example: body:not-disallowed { ... }', 'darkify') .
256 '</div>' .
257 '<a class="tooltip_btn_primary" href="' . DARKIFY_DEMO_URL . 'advanced/#custom_css" target="_blank">' .
258 __('Live Demo', 'darkify') .
259 '</a>' .
260 '<a class="tooltip_btn_secondary" href="' . DARKIFY_DOCS_URL . 'advanced/#custom-css" target="_blank">' .
261 __('Open Docs', 'darkify') .
262 '</a>',
263
264 'text_on' => esc_html__('Yes', 'darkify'),
265 'text_off' => esc_html__('No', 'darkify'),
266
267 'class' => 'switcher_pro_only',
268 ),
269 array(
270 'id' => 'normal_custom_css',
271 'type' => 'code_editor',
272 'title' => esc_html__('Normal Mode CSS', 'darkify'),
273 'title_help' =>
274 '<div class="darkify-info-label">' .
275 __('The CSS code will be applied in both normal mode and dark mode.', 'darkify') .
276 '</div>' .
277 '<a class="tooltip_btn_primary" href="' . DARKIFY_DEMO_URL . 'advanced/#custom_css" target="_blank">' .
278 __('Live Demo', 'darkify') .
279 '</a>' .
280 '<a class="tooltip_btn_secondary" href="' . DARKIFY_DOCS_URL . 'advanced/#custom-css" target="_blank">' .
281 __('Open Docs', 'darkify') .
282 '</a>',
283
284 'settings' => array(
285 'theme' => 'default',
286 'mode' => 'css',
287 ),
288 ),
289 )
290 ),
291 array(
292 'title' => esc_html__('Extras', 'darkify'),
293 'icon' => 'icofont-holding-hands',
294 'fields' => array(
295 // Enable Tooltip On Floating Switch
296 array(
297 'id' => 'darkify_data_remove',
298 'type' => 'checkbox',
299 'title' => esc_html__('Clean-up Data on Deletion', 'darkify'),
300 'title_help' =>
301 '<div class="darkify-info-label">' .
302 esc_html__('Enable this option to completely remove all Darkify data when the plugin is deleted.', 'darkify') .
303 '</div><a class="tooltip_btn_primary" href="' . DARKIFY_DEMO_URL . 'advanced/#backup" target="_blank">' .
304 esc_html__('Live Demo', 'darkify') .
305 '</a><a class="tooltip_btn_secondary" href="' . DARKIFY_DOCS_URL . 'advanced/#extras" target="_blank">' .
306 esc_html__('Open Docs', 'darkify') .
307 '</a>',
308
309 ),
310 array(
311 'type' => 'heading',
312 'title' => esc_html__('Backup', 'darkify'),
313 ),
314 array(
315 'title' => esc_html__('Backup and Restore Settings', 'darkify'),
316 'title_help' =>
317 '<div class="darkify-info-label">' .
318 esc_html__('Use these options to back up your settings for safekeeping or restore them when needed. You can export your current settings as a .json file and import it anytime to restore your configuration.', 'darkify') .
319 '</div><a class="tooltip_btn_primary" href="' . DARKIFY_DEMO_URL . 'advanced/#backup" target="_blank">' .
320 __('Live Demo', 'darkify') .
321 '</a><a class="tooltip_btn_secondary" href="' . DARKIFY_DOCS_URL . 'advanced/#extras" target="_blank">' .
322 __('Open Docs', 'darkify') .
323 '</a>',
324
325 'type' => 'backup',
326 ),
327 )
328 ),
329 )
330 ),
331 ),
332 ));
333 }
334 }
335