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

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

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