PluginProbe
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) / 2.0.2
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) v2.0.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
darkify / src / Admin / Views / Media.php

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

465 lines 19.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Media class for Media Options.
5 *
6 * @link https://themeatelier.net
7 * @since 1.0.0
8 *
9 * @package darkify
10 * @subpackage darkify/src/Admin/Views/Media
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 Media
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(
29 $prefix,
30 array(
31 'id' => 'media',
32 'title' => esc_html__('Media', 'darkify'),
33 'icon' => 'icofont-multimedia',
34 'fields' => array(
35
36 array(
37 'type' => 'section_tab',
38 'tabs' => array(
39
40 array(
41 'id' => 'image-controls',
42 'title' => esc_html__('Image Controls', 'darkify'),
43 'icon' => 'icofont-file-image',
44 'fields' => array(
45 // Intro line, rendered plain above the section cards.
46 array(
47 'type' => 'page_hint',
48 'content' => esc_html__('Control how images adapt when dark mode is active.', 'darkify'),
49 ),
50 // ===== BRIGHTNESS =====
51 array(
52 'type' => 'heading',
53 'title' => esc_html__('Brightness', 'darkify'),
54 'section_start' => true,
55 ),
56 // Low Brightness
57 array(
58 'id' => 'brightness',
59 'type' => 'fieldset',
60 'fields' => array(
61 array(
62 'id' => 'enable_low_image_brightness',
63 'type' => 'switcher',
64 'title' => esc_html__('Low Brightness Images', 'darkify'),
65 'title_help' =>
66 '<div class="darkify-info-label">' .
67 __('Enable a low-brightness effect for images when dark mode is active.', 'darkify') .
68 '</div>',
69
70 'text_on' => esc_html__('Enabled', 'darkify'),
71 'text_off' => esc_html__('Disabled', 'darkify'),
72 'text_width' => 100,
73 'default' => true,
74 ),
75 array(
76 'id' => 'low_image_brightness_label',
77 'type' => 'slider',
78 'title' => esc_html__('Brightness Level', 'darkify'),
79 'title_help' => '<div class="darkify-info-label">' .
80 __('Adjust the brightness level for images in dark mode.', 'darkify') .
81 '</div>',
82
83 'min' => 0,
84 'max' => 100,
85 'step' => 5,
86 'default' => '20',
87 'unit' => '%',
88 'panel' => true,
89 'dependency' => array('enable_low_image_brightness', '==', 'true', 'all'),
90 ),
91
92 array(
93 'id' => 'disallowed_low_brightness_images',
94 'type' => 'textarea',
95 'title' => esc_html__('Exclude Images', 'darkify'),
96 'title_help' =>
97 '<div class="darkify-info-label">' .
98 __('Exclude specific images from brightness adjustments in dark mode.', 'darkify') .
99 '</div>',
100 'placeholder' => esc_html__(
101 'Enter image URLs to exclude (comma-separated or one per line).',
102 'darkify'
103 ),
104
105 'class' => 'only_pro',
106 'dependency' => array('enable_low_image_brightness', '==', 'true', 'all'),
107 ),
108 ),
109 ),
110 // ===== GRAYSCALE =====
111 array(
112 'type' => 'heading',
113 'title' => esc_html__('Grayscale', 'darkify'),
114 'section_start' => true,
115 ),
116 // Grayscale Image
117 array(
118 'id' => 'grayscale',
119 'type' => 'fieldset',
120 'fields' => array(
121 array(
122 'id' => 'enable_image_grayscale',
123 'type' => 'switcher',
124 'title' => esc_html__('Grayscale Images', 'darkify'),
125 'title_help' =>
126 '<div class="darkify-info-label">' .
127 __('Enable grayscale effect for images when dark mode is enabled.', 'darkify') .
128 '</div>',
129
130 'text_on' => esc_html__('Enabled', 'darkify'),
131 'text_off' => esc_html__('Disabled', 'darkify'),
132 'text_width' => 100,
133 ),
134 array(
135 'id' => 'image_grayscale_label',
136 'type' => 'slider',
137 'title' => esc_html__('Grayscale Level', 'darkify'),
138 'title_help' =>
139 '<div class="darkify-info-label">' .
140 __('Adjust the grayscale level for images in dark mode.', 'darkify') .
141 '</div>',
142
143 'min' => 0,
144 'max' => 100,
145 'step' => 5,
146 'default' => '80',
147 'unit' => '%',
148 'panel' => true,
149 'dependency' => array('enable_image_grayscale', '==', 'true', 'all'),
150 ),
151
152 array(
153 'id' => 'disallowed_low_grayscale_images',
154 'type' => 'textarea',
155 'title' => esc_html__('Exclude Images', 'darkify'),
156 'title_help' => '<div class="darkify-info-label">' .
157 __('Exclude grayscale effects for specific images.', 'darkify') .
158 '</div>',
159 'placeholder' => esc_html__(
160 'Enter image URLs (comma-separated or one per line) to exclude from grayscale effects.',
161 'darkify'
162 ),
163
164 'class' => 'only_pro',
165 'dependency' => array('enable_image_grayscale', '==', 'true', 'all'),
166 ),
167 ),
168 ),
169
170 // ===== BACKGROUND & INVERSION =====
171 array(
172 'type' => 'heading',
173 'title' => esc_html__('Background & Inversion', 'darkify'),
174 'section_start' => true,
175 ),
176 // Darken Background Image
177 array(
178 'id' => 'darken_background',
179 'type' => 'fieldset',
180 'fields' => array(
181 array(
182 'id' => 'enable_low_image_darken',
183 'type' => 'switcher',
184 'title' => esc_html__('Darken Background Images', 'darkify'),
185 'title_help' => '<div class="darkify-info-label">' .
186 __('Enable background darkening effect in dark mode.', 'darkify') .
187 '</div>',
188
189 'text_on' => esc_html__('Enabled', 'darkify'),
190 'text_off' => esc_html__('Disabled', 'darkify'),
191 'text_width' => 100,
192 'default' => true,
193 ),
194 array(
195 'id' => 'low_image_darken_label',
196 'type' => 'slider',
197 'title' => esc_html__('Darkening Level', 'darkify'),
198 'title_help' => '<div class="darkify-info-label">' .
199 __('Adjust the darkening level for background images in dark mode.', 'darkify') .
200 '</div>',
201
202 'min' => 0,
203 'max' => 100,
204 'step' => 5,
205 'default' => '60',
206 'unit' => '%',
207 'panel' => true,
208 'dependency' => array('enable_low_image_darken', '==', 'true', 'all'),
209 ),
210 ),
211 ),
212
213 array(
214 'id' => 'enable_invert_inline_svg',
215 'type' => 'switcher',
216 'title' => esc_html__('Invert Inline SVGs', 'darkify'),
217 'title_help' =>
218 '<div class="darkify-info-label">' .
219 __('Enable automatic inversion of inline SVG images in dark mode.', 'darkify') .
220 '</div>',
221
222 'text_on' => esc_html__('Enabled', 'darkify'),
223 'text_off' => esc_html__('Disabled', 'darkify'),
224 'text_width' => 100,
225 ),
226
227 // Image Inversion
228 array(
229 'id' => 'invert',
230 'type' => 'fieldset',
231 'fields' => array(
232 array(
233 'id' => 'enable_invert_images',
234 'type' => 'switcher',
235 'title' => esc_html__('Invert Specific Images', 'darkify'),
236 'title_help' => '<div class="darkify-info-label">' .
237 __('Enable image inversion for specific images in dark mode.', 'darkify') .
238 '</div>',
239
240 'text_on' => esc_html__('Enabled', 'darkify'),
241 'text_off' => esc_html__('Disabled', 'darkify'),
242 'text_width' => 100,
243 'class' => 'switcher_pro_only',
244 'default' => false,
245 ),
246 array(
247 'id' => 'invert_images_allowed_urls',
248 'type' => 'textarea',
249 'title' => esc_html__('Image URLs', 'darkify'),
250 'title_help' => '<div class="darkify-info-label">' .
251 __('Apply inversion to specific images, SVGs, or backgrounds.', 'darkify') .
252 '</div>',
253 'placeholder' => esc_html__(
254 'Enter URLs (comma-separated or one per line) for images, SVGs, or background images to apply inversion.',
255 'darkify'
256 ),
257
258 'class' => 'only_pro',
259 ),
260 ),
261 ),
262
263
264 array(
265 'type' => 'heading',
266 'title' => esc_html__('Replace Images', 'darkify'),
267 'section_start' => true,
268 ),
269 array(
270 'id' => 'image_replacements',
271 'type' => 'repeater',
272 'class' => 'replacement_repeater repeater_pro_only',
273 'title' => esc_html__('Replace Images', 'darkify'),
274 'title_help' =>
275 '<div class="darkify-info-label">' .
276 __('Replace specified images when dark mode is active.', 'darkify') .
277 '</div>' .
278 '' .
279 '',
280
281 'fields' => array(
282 array(
283 'id' => 'normal_image',
284 'type' => 'upload',
285 'library' => 'image',
286 'title' => esc_html__('Normal Mode Image', 'darkify'),
287 'placeholder' => esc_html__('Image URL', 'darkify'),
288 'button_title' => esc_html__('Add Image', 'darkify'),
289 'remove_title' => esc_html__('Remove Image', 'darkify'),
290 ),
291
292 array(
293 'id' => 'dark_image',
294 'type' => 'upload',
295 'library' => 'image',
296 'title' => esc_html__('Dark Mode Image', 'darkify'),
297 'placeholder' => esc_html__('Image URL', 'darkify'),
298 'button_title' => esc_html__('Add Image', 'darkify'),
299 'remove_title' => esc_html__('Remove Image', 'darkify'),
300 ),
301
302 ),
303 'default' => array(
304 array(
305 'normal_image' => '',
306 'dark_image' => '',
307 ),
308 )
309 ),
310
311 )
312 ),
313 array(
314 'id' => 'video-controls',
315 'title' => esc_html__('Video Controls', 'darkify'),
316 'icon' => 'icofont-file-video',
317 'fields' => array(
318 // Intro line, rendered plain above the section cards.
319 array(
320 'type' => 'page_hint',
321 'content' => esc_html__('Control how videos respond to dark mode.', 'darkify'),
322 ),
323 // ===== BRIGHTNESS =====
324 array(
325 'type' => 'heading',
326 'title' => esc_html__('Brightness', 'darkify'),
327 'section_start' => true,
328 ),
329 // Low Brightness
330 array(
331 'id' => 'video_brightness',
332 'type' => 'fieldset',
333 'fields' => array(
334 array(
335 'id' => 'enable_low_video_brightness',
336 'type' => 'switcher',
337 'title' => esc_html__('Low Brightness Videos', 'darkify'),
338 'title_help' =>
339 '<div class="darkify-info-label">' .
340 __('Enable brightness effect for videos in dark mode.', 'darkify') .
341 '</div>',
342
343 'text_on' => esc_html__('Enabled', 'darkify'),
344 'text_off' => esc_html__('Disabled', 'darkify'),
345 'text_width' => 100,
346 'default' => true,
347 ),
348 array(
349 'id' => 'low_video_brightness_label',
350 'type' => 'slider',
351 'title' => esc_html__('Brightness Level', 'darkify'),
352 'title_help' => '<div class="darkify-info-label">' .
353 __('Adjust the brightness level for videos in dark mode.', 'darkify') .
354 '</div>',
355
356 'min' => 0,
357 'max' => 100,
358 'step' => 5,
359 'default' => '20',
360 'unit' => '%',
361 'panel' => true,
362 'dependency' => array('enable_low_video_brightness', '==', 'true', 'all'),
363 ),
364 ),
365 ),
366
367 // ===== GRAYSCALE =====
368 array(
369 'type' => 'heading',
370 'title' => esc_html__('Grayscale', 'darkify'),
371 'section_start' => true,
372 ),
373 // Grayscale Video
374 array(
375 'id' => 'video_grayscale',
376 'type' => 'fieldset',
377 'fields' => array(
378 array(
379 'id' => 'enable_video_grayscale',
380 'type' => 'switcher',
381 'title' => esc_html__('Grayscale Videos', 'darkify'),
382 'title_help' =>
383 '<div class="darkify-info-label">' .
384 __('Enable grayscale effect for videos in dark mode.', 'darkify') .
385 '</div>',
386
387 'text_on' => esc_html__('Enabled', 'darkify'),
388 'text_off' => esc_html__('Disabled', 'darkify'),
389 'text_width' => 100,
390 ),
391 array(
392 'id' => 'video_grayscale_label',
393 'type' => 'slider',
394 'title' => esc_html__('Grayscale Level', 'darkify'),
395 'title_help' => '<div class="darkify-info-label">' .
396 __('Adjust the grayscale level for videos in dark mode.', 'darkify') .
397 '</div>',
398
399 'min' => 0,
400 'max' => 100,
401 'step' => 5,
402 'default' => '80',
403 'unit' => '%',
404 'panel' => true,
405 'dependency' => array('enable_video_grayscale', '==', 'true', 'all'),
406 ),
407 ),
408 ),
409
410
411 array(
412 'type' => 'heading',
413 'title' => esc_html__('Replace Videos', 'darkify'),
414 'section_start' => true,
415 ),
416 array(
417 'id' => 'video_replacements',
418 'type' => 'repeater',
419 'class' => 'replacement_repeater repeater_pro_only',
420 'title' => esc_html__('Replace Videos', 'darkify'),
421 'title_help' => '<div class="darkify-info-label">' .
422 __('Replace specified videos (self-hosted, YouTube, Vimeo, or Dailymotion) when dark mode is active.', 'darkify') .
423 '</div>',
424
425 'fields' => array(
426 array(
427 'id' => 'normal_video',
428 'type' => 'upload',
429 'library' => 'video',
430 'title' => esc_html__('Normal Mode Video', 'darkify'),
431 'placeholder' => esc_html__('Video URL', 'darkify'),
432 'button_title' => esc_html__('Add Video', 'darkify'),
433 'remove_title' => esc_html__('Remove Video', 'darkify'),
434
435 ),
436
437 array(
438 'id' => 'dark_video',
439 'type' => 'upload',
440 'library' => 'video',
441 'title' => esc_html__('Dark Mode Video', 'darkify'),
442 'placeholder' => esc_html__('Video URL', 'darkify'),
443 'button_title' => esc_html__('Add Video', 'darkify'),
444 'remove_title' => esc_html__('Remove Video', 'darkify'),
445
446 ),
447
448 ),
449 'default' => array(
450 array(
451 'normal_video' => '',
452 'dark_video' => '',
453 ),
454 )
455 ),
456 )
457 ),
458 ),
459 ),
460 )
461 )
462 );
463 }
464 }
465