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 / Media.php

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

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