PluginProbe
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) / 1.3.2
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) v1.3.2
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
← All changes | src/Admin/Views/Control.php +140 -274 2.0.01.3.2 View file →
@@ -1,8 +1,8 @@
1 1 <?php
2 2
3 3 /**
4 - * Control class for Control options.
4 + * Views class for Shortcode generator options.
5 5 *
6 6 * @link https://themeatelier.net
7 7 * @since 1.0.0
8 8 *
@@ -12,9 +12,9 @@
12 12 */
13 13
14 14 namespace ThemeAtelier\Darkify\Admin\Views;
15 15
16 -use ThemeAtelier\Darkify\Admin\Schema\SchemaRegistry as Darkify;
16 +use ThemeAtelier\Darkify\Admin\Framework\Classes\Darkify;
17 17
18 18 class Control
19 19 {
20 20 /**
@@ -27,288 +27,154 @@
27 27 {
28 28 Darkify::createSection(
29 29 $prefix,
30 30 array(
31 - 'title' => esc_html__('Controls', 'darkify'),
31 + 'title' => esc_html__('CONTROL', 'darkify'),
32 32 'icon' => 'icofont-ui-settings',
33 33 'fields' => array(
34 34 array(
35 - 'type' => 'section_tab',
36 - 'tabs' => array(
37 -
35 + 'type' => 'heading',
36 + 'content' => esc_html__('Basic Control', 'darkify'),
37 + ),
38 + array(
39 + 'id' => 'enable_dark_mode_switch',
40 + 'type' => 'switcher',
41 + 'title' => esc_html__('Enable or Disable Frontend Dark Mode Switch', 'darkify'),
42 + 'desc' => esc_html__('Switch to show the Dark Mode Floating Switch in your Websites frontend.', 'darkify'),
43 + 'text_on' => esc_html__('Enabled', 'darkify-pro'),
44 + 'text_off' => esc_html__('Disabled', 'darkify-pro'),
45 + 'text_width' => 100,
46 + 'default' => true,
47 + ),
48 + array(
49 + 'id' => 'enable_default_dark_mode',
50 + 'type' => 'switcher',
51 + 'title' => esc_html__('Enable or Disable Default Dark Mode', 'darkify'),
52 + 'desc' => esc_html__('Switch to automatically turn your website dark by default.', 'darkify'),
53 + 'text_on' => esc_html__('Enabled', 'darkify-pro'),
54 + 'text_off' => esc_html__('Disabled', 'darkify-pro'),
55 + 'text_width' => 100,
56 + ),
57 + array(
58 + 'id' => 'enable_os_aware',
59 + 'type' => 'switcher',
60 + 'title' => esc_html__('Enable or Disable OS Aware Dark Mode', 'darkify'),
61 + 'desc' => esc_html__('Switch to enable or disable dark mode automatically according to users’ device preference.', 'darkify'),
62 + 'text_on' => esc_html__('Enabled', 'darkify-pro'),
63 + 'text_off' => esc_html__('Disabled', 'darkify-pro'),
64 + 'text_width' => 100,
65 + 'default' => true,
66 + ),
67 + array(
68 + 'id' => 'enable_keyboard_shortcut',
69 + 'type' => 'switcher',
70 + 'title' => esc_html__('Enable or Disable Keyboard Shortcut', 'darkify'),
71 + 'desc' => esc_html__('Switch to turn ON or OFF dark mode by pressing Ctrl+Alt+D on keyboard.', 'darkify'),
72 + 'text_on' => esc_html__('Enabled', 'darkify-pro'),
73 + 'text_off' => esc_html__('Disabled', 'darkify-pro'),
74 + 'text_width' => 100,
75 + 'default' => true,
76 + ),
77 + array(
78 + 'type' => 'heading',
79 + 'content' => esc_html__('Advanced Control', 'darkify'),
80 + ),
81 +
82 + // Enable Time Based Auto Dark Mode
83 + array(
84 + 'id' => 'enable_time',
85 + 'type' => 'fieldset',
86 + 'fields' => array(
38 87 array(
39 - 'title' => esc_html__('Frontend', 'darkify'),
40 - 'icon' => 'icofont-computer',
41 - 'fields' => array(
42 - // Intro line with a docs link, rendered plain above the section cards.
43 - array(
44 - 'type' => 'page_hint',
45 - 'content' => sprintf(
46 - /* translators: %s: documentation link */
47 - __('Decide how and when dark mode turns on for visitors on your public website. %s', 'darkify'),
48 - '<a href="https://darkifywp.com/docs/" target="_blank" rel="noopener noreferrer">' . esc_html__('View documentation', 'darkify') . '</a>'
49 - ),
50 - ),
51 -
52 - // ===== AVAILABILITY =====
53 - array(
54 - 'type' => 'heading',
55 - 'title' => esc_html__('Availability', 'darkify'),
56 - 'section_start' => true,
57 - ),
58 - array(
59 - 'id' => 'enable_dark_mode_switch',
60 - 'type' => 'switcher',
61 - 'title' => esc_html__('Frontend Dark Mode', 'darkify'),
62 - 'title_help' => '<div class="darkify-info-label">' .
63 - __('Show the dark mode floating switch on your website frontend. This is the master control for everything below.', 'darkify') .
64 - '</div>' . '' . '',
65 - 'text_on' => esc_html__('Enabled', 'darkify'),
66 - 'text_off' => esc_html__('Disabled', 'darkify'),
67 - 'text_width' => 100,
68 - 'default' => true,
69 - // Commit instantly (master toggle governs the whole frontend feature).
70 - 'auto_save' => true,
71 - ),
72 - array(
73 - 'id' => 'enable_default_dark_mode',
74 - 'type' => 'switcher',
75 - 'title' => esc_html__('Default Dark Mode', 'darkify'),
76 - 'title_help' =>
77 - '<div class="darkify-info-label">' .
78 - __('Enable dark mode by default on your website.', 'darkify') .
79 - '</div>' .
80 - '' .
81 - '',
82 - 'text_on' => esc_html__('Enabled', 'darkify'),
83 - 'text_off' => esc_html__('Disabled', 'darkify'),
84 - 'text_width' => 100,
85 - // Commit instantly (the priority notice depends on it, which would
86 - // otherwise force the manual-Save workflow).
87 - 'auto_save' => true,
88 - ),
89 - array(
90 - 'id' => 'enable_os_aware',
91 - 'type' => 'switcher',
92 - 'title' => esc_html__('OS Aware Dark Mode', 'darkify'),
93 - 'title_help' =>
94 - '<div class="darkify-info-label">' .
95 - __('Toggle dark mode based on the user’s device or operating system preference.', 'darkify') .
96 - '</div>' .
97 - '' .
98 - '',
99 - 'text_on' => esc_html__('Enabled', 'darkify'),
100 - 'text_off' => esc_html__('Disabled', 'darkify'),
101 - 'text_width' => 100,
102 - 'default' => true,
103 - // Commit instantly (the priority notice depends on it).
104 - 'auto_save' => true,
105 - ),
106 - // Priority notice: shown only when Default Dark Mode AND OS Aware are both on.
107 - array(
108 - 'type' => 'submessage',
109 - 'style' => 'info',
110 - 'content' => '<strong>' . esc_html__('OS Aware takes priority.', 'darkify') . '</strong> ' . esc_html__('Both are on, so visitors following the system “dark” setting get dark mode automatically; Default Dark Mode applies only when no system preference is detected.', 'darkify'),
111 - 'dependency' => array('enable_default_dark_mode|enable_os_aware', '==|==', 'true|true'),
112 - ),
113 -
114 - // ===== ACTIVATION =====
115 - array(
116 - 'type' => 'heading',
117 - 'title' => esc_html__('Activation', 'darkify'),
118 - 'section_start' => true,
119 - ),
120 - array(
121 - 'id' => 'enable_keyboard_shortcut',
122 - 'type' => 'switcher',
123 - 'title' => esc_html__('Keyboard Shortcut', 'darkify'),
124 - 'title_help' =>
125 - '<div class="darkify-info-label">' .
126 - __('Let visitors toggle dark mode with a keyboard shortcut.', 'darkify') .
127 - '</div>' .
128 - '' .
129 - '',
130 - 'text_on' => esc_html__('Enabled', 'darkify'),
131 - 'text_off' => esc_html__('Disabled', 'darkify'),
132 - 'text_width' => 100,
133 - 'default' => true,
134 - // Commit instantly (the shortcut-keys field depends on it).
135 - 'auto_save' => true,
136 - ),
137 - // Editable shortcut combo (shown when the shortcut is enabled).
138 - array(
139 - 'id' => 'keyboard_shortcut_keys',
140 - 'type' => 'keyboard_shortcut',
141 - 'default' => 'ctrl+alt+d',
142 - 'dependency' => array('enable_keyboard_shortcut', '==', 'true'),
143 - ),
144 - // Enable Time Based Auto Dark Mode
145 - array(
146 - 'id' => 'enable_time',
147 - 'type' => 'fieldset',
148 - 'fields' => array(
149 - array(
150 - 'id' => 'enable_time_based_dark',
151 - 'type' => 'switcher',
152 - 'title' => esc_html__('Time Based Auto Dark Mode', 'darkify'),
153 - 'title_help' =>
154 - '<div class="darkify-info-label">' .
155 - __('Automatically enable dark mode based on the user’s local time.', 'darkify') .
156 - '</div>' .
157 - '' .
158 - '',
159 - 'text_on' => esc_html__('Enabled', 'darkify'),
160 - 'text_off' => esc_html__('Disabled', 'darkify'),
161 - 'text_width' => 100,
162 - ),
163 - array(
164 - 'id' => 'enable_time_fields',
165 - 'type' => 'fieldset',
166 - 'class' => 'enable_time_fields',
167 - 'dependency' => array('enable_time_based_dark', '==', 'true'),
168 - 'title' => esc_html__('Pick a Time', 'darkify'),
169 - 'title_help' =>
170 - '<div class="darkify-info-label">' .
171 - __('Set the exact start and end times when dark mode should be automatically enabled or disabled.', 'darkify') .
172 - '</div>' .
173 - '' .
174 - '',
175 - 'fields' => array(
176 - array(
177 - 'id' => 'time_based_dark_start',
178 - 'type' => 'datetime',
179 - 'after' => esc_html__('From', 'darkify'),
180 - 'placeholder' => esc_html__('From', 'darkify'),
181 - 'settings' => array(
182 - 'noCalendar' => true,
183 - 'enableTime' => true,
184 - 'dateFormat' => 'H:i',
185 - 'time_24hr' => false,
186 - ),
187 - ),
188 - array(
189 - 'id' => 'time_based_dark_end',
190 - 'type' => 'datetime',
191 - 'after' => esc_html__('To', 'darkify'),
192 - 'placeholder' => esc_html__('To', 'darkify'),
193 - 'settings' => array(
194 - 'noCalendar' => true,
195 - 'enableTime' => true,
196 - 'dateFormat' => 'H:i',
197 - 'time_24hr' => false,
198 - ),
199 - ),
200 - ),
201 - ),
202 - ),
203 - ),
88 + 'id' => 'enable_time_based_dark',
89 + 'type' => 'switcher',
90 + 'title' => esc_html__('Enable or Disable Time Based Auto Dark Mode', 'darkify'),
91 + 'desc' => esc_html__('Automatically turn dark mode ON based on users’ localtime.', 'darkify'),
92 + 'text_on' => esc_html__('Enabled', 'darkify-pro'),
93 + 'text_off' => esc_html__('Disabled', 'darkify-pro'),
94 + 'text_width' => 100,
95 + ),
96 + array(
97 + 'id' => 'time_based_dark_start',
98 + 'type' => 'datetime',
99 + 'title' => esc_html__('Pick a Time', 'darkify'),
100 + 'from_to' => true,
101 + 'text_from' => esc_html__('Form', 'darkify'),
102 + 'text_to' => esc_html__('To', 'darkify'),
103 + 'settings' => array(
104 + 'noCalendar' => true,
105 + 'enableTime' => true,
106 + 'dateFormat' => 'H:i',
107 + 'time_24hr' => false,
204 108 ),
109 + 'dependency' => array('enable_time_based_dark', '==', 'true'),
205 110 ),
111 + ),
112 + ),
113 + array(
114 + 'id' => 'hide_on_desktop',
115 + 'type' => 'switcher',
116 + 'title' => esc_html__('Show or Hide Dark Mode Switch on Desktop', 'darkify'),
117 + 'desc' => esc_html__('Switch to hide the Dark Mode Floating Switch if users’ are using desktop or laptop.', 'darkify'),
118 + 'text_on' => esc_html__('Show', 'darkify-pro'),
119 + 'text_off' => esc_html__('Hide', 'darkify-pro'),
120 + 'text_width' => 80,
121 + ),
122 + array(
123 + 'id' => 'hide_on_mobile',
124 + 'type' => 'fieldset',
125 + 'fields' => array(
206 126 array(
207 - 'title' => esc_html__('Admin', 'darkify'),
208 - 'icon' => 'icofont-dashboard-web',
209 - 'fields' => array(
210 - // Intro line with a docs link, rendered plain above the section cards.
211 - array(
212 - 'type' => 'page_hint',
213 - 'content' => sprintf(
214 - /* translators: %s: documentation link */
215 - __('Bring dark mode to the WordPress admin dashboard and editors. %s', 'darkify'),
216 - '<a href="https://darkifywp.com/docs/" target="_blank" rel="noopener noreferrer">' . esc_html__('View documentation', 'darkify') . '</a>'
217 - ),
218 - ),
219 - // ===== ADMIN APPEARANCE =====
220 - array(
221 - 'type' => 'heading',
222 - 'title' => esc_html__('Admin Appearance', 'darkify'),
223 - 'section_start' => true,
224 - ),
225 - array(
226 - 'id' => 'enable_admin_panel_dark_mode',
227 - 'type' => 'switcher',
228 - 'title' => esc_html__('Admin Panel Dark Mode', 'darkify'),
229 - 'title_help' =>
230 - '<div class="darkify-info-label">' .
231 - __('Enable dark mode in the WordPress admin dashboard.', 'darkify') .
232 - '</div>' .
233 - '' .
234 - '',
235 - 'text_on' => esc_html__('Enabled', 'darkify'),
236 - 'text_off' => esc_html__('Disabled', 'darkify'),
237 - 'default' => false,
238 - 'text_width' => 100,
239 - // Commit instantly even though other fields depend on it.
240 - 'auto_save' => true,
241 - ),
242 -
243 - array(
244 - 'id' => 'block_editor_dark_mode',
245 - 'type' => 'switcher',
246 - 'title' => esc_html__('Block Editor Dark Mode', 'darkify'),
247 - 'title_help' =>
248 - '<div class="darkify-info-label">' .
249 - __('Enable the dark mode switch in the block editor to toggle between dark and light mode.', 'darkify') .
250 - '</div>' .
251 - '' .
252 - '',
253 - 'text_on' => esc_html__('Enabled', 'darkify'),
254 - 'text_off' => esc_html__('Disabled', 'darkify'),
255 - 'default' => false,
256 - 'text_width' => 100,
257 - ),
258 - array(
259 - 'id' => 'classic_editor_dark_mode',
260 - 'type' => 'switcher',
261 - 'title' => esc_html__('Classic Editor Dark Mode', 'darkify'),
262 - 'title_help' =>
263 - '<div class="darkify-info-label">' .
264 - __('Enable the dark mode switch in the classic editor to toggle between dark and light modes.', 'darkify') .
265 - '</div>' .
266 - '' .
267 - '',
268 - 'text_on' => esc_html__('Enabled', 'darkify'),
269 - 'text_off' => esc_html__('Disabled', 'darkify'),
270 -
271 - 'default' => false,
272 - 'text_width' => 100,
273 - ),
274 -
275 - // ===== SCOPE & CUSTOMIZATION =====
276 - array(
277 - 'type' => 'heading',
278 - 'title' => esc_html__('Scope & Customization', 'darkify'),
279 - 'section_start' => true,
280 - 'dependency' => array('enable_admin_panel_dark_mode', '==', 'true'),
281 - ),
282 - array(
283 - 'id' => 'disallowed_admin_pages',
284 - 'type' => 'textarea',
285 - 'title' => esc_html__('Disallowed Pages', 'darkify'),
286 - 'title_help' => '<div class="darkify-info-text">' .
287 - __('If an admin page URL looks like http://example.com/wp-admin/admin.php?page=darkify, then "darkify" is the page slug.', 'darkify') .
288 - '</div>' .
289 - '' .
290 - '',
291 - 'placeholder' => esc_html__('Enter comma-separated page slugs. Example: darkify-dashboard, elementor', 'darkify'),
292 - 'dependency' => array('enable_admin_panel_dark_mode', '==', 'true'),
293 - 'class' => 'only_pro'
294 - ),
295 - array(
296 - 'id' => 'admin_custom_css',
297 - 'type' => 'code_editor',
298 - 'title' => esc_html__('Admin Dark Mode CSS', 'darkify'),
299 - 'title_help' =>
300 - '<div class="darkify-info-label">' .
301 - __('The CSS code will only be applied when admin dark mode is active.', 'darkify') .
302 - '</div>',
303 - 'settings' => array(
304 - 'theme' => 'mbo',
305 - 'mode' => 'css',
306 - ),
307 - // Only relevant when admin dark mode is active — hide it while off.
308 - 'dependency' => array('enable_admin_panel_dark_mode', '==', 'true'),
309 - ),
127 + 'id' => 'hide_dark_mode_on_mobile',
128 + 'type' => 'switcher',
129 + 'title' => esc_html__('Show or Hide Dark Mode on Mobile', 'darkify'),
130 + 'desc' => esc_html__('Switch to hide the Dark Mode Floating Switch if users’ are using mobile.', 'darkify'),
131 + 'text_on' => esc_html__('Show', 'darkify-pro'),
132 + 'text_off' => esc_html__('Hide', 'darkify-pro'),
133 + 'text_width' => 80,
134 + ),
135 + array(
136 + 'id' => 'type_of_hide_by',
137 + 'type' => 'select',
138 + 'title' => esc_html__('Type of Hide By', 'darkify'),
139 + 'options' => array(
140 + 'user_agent' => esc_html__('Hide by User Agent', 'darkify'),
141 + 'screen_size' => esc_html__('Hide by Screen Size', 'darkify'),
142 + 'both' => esc_html__('Hide by Both', 'darkify'),
310 143 ),
144 + 'default' => 'both',
145 + 'dependency' => array('hide_dark_mode_on_mobile', '==', 'true'),
146 + ),
147 + ),
148 + ),
149 +
150 + array(
151 + 'id' => 'show_in_menu',
152 + 'type' => 'fieldset',
153 + 'fields' => array(
154 + array(
155 + 'id' => 'enable_switch_in_menu',
156 + 'type' => 'switcher',
157 + 'title' => esc_html__('Show or Hide Switch in Menu', 'darkify'),
158 + 'desc' => esc_html__('Show the dark mode toggle switch in specific menu.', 'darkify'),
159 + 'text_on' => esc_html__('Show', 'darkify-pro'),
160 + 'text_off' => esc_html__('Hide', 'darkify-pro'),
161 + 'text_width' => 80,
162 + ),
163 + array(
164 + 'id' => 'switch_in_menu_location',
165 + 'type' => 'select',
166 + 'title' => esc_html__('Select Menu', 'darkify'),
167 + 'options' => 'menus',
168 + 'dependency' => array('enable_switch_in_menu', '==', 'true'),
169 + ),
170 + array(
171 + 'id' => 'darkify_menu_shortcode_helper',
172 + 'type' => 'textarea',
173 + 'title' => esc_html__('Short Code menu', 'darkify'),
174 + 'desc' => esc_html__('You can generate customized switch shortcode from SWITCH STYLE > Advanced Customization.', 'darkify'),
175 + 'dependency' => array('enable_switch_in_menu', '==', 'true'),
176 + 'default' => '[darkify switch="1" width_height="60px" border_radius="7px" icon_size="40px" light_mode_bg="#121116" dark_mode_bg="#ffffff" light_mode_color="#ffffff" dark_mode_color="#121116"]'
311 177 ),
312 178 ),
313 179 ),
314 180 ),