| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Views class for Shortcode generator options. |
| 5 |
* |
| 6 |
* @link https://themeatelier.net |
| 7 |
* @since 1.0.0 |
| 8 |
* |
| 9 |
* @package darkify |
| 10 |
* @subpackage darkify/src/Admin/Views/ImageStyle |
| 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' => '<div class="darkify-info-label">' . __('Enable brightness effect for images in dark mode.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'image-controls/#image_brightness" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'/media/#brightness-grayscale" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 53 |
'text_on' => esc_html__('Yes', 'darkify'), |
| 54 |
'text_off' => esc_html__('No', 'darkify'), |
| 55 |
'default' => true, |
| 56 |
), |
| 57 |
array( |
| 58 |
'id' => 'low_image_brightness_label', |
| 59 |
'type' => 'slider', |
| 60 |
'title' => esc_html__('Brightness Label', 'darkify'), |
| 61 |
'title_help' => '<div class="darkify-info-label">' . __('Adjust the brightness level for dark mode.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'image-controls/#image_brightness" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'/media/#brightness-grayscale" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 62 |
'min' => 0, |
| 63 |
'max' => 100, |
| 64 |
'step' => 5, |
| 65 |
'default' => '20', |
| 66 |
'unit' => '%', |
| 67 |
'dependency' => array('enable_low_image_brightness', '==', 'true', 'all'), |
| 68 |
), |
| 69 |
|
| 70 |
array( |
| 71 |
'id' => 'disallowed_low_brightness_images', |
| 72 |
'type' => 'textarea', |
| 73 |
'title' => esc_html__('Exclude Images', 'darkify'), |
| 74 |
'title_help' => '<div class="darkify-info-label">' . __('Exclude brightness adjustments for specific images.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'image-controls/#image_brightness" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'/media/#brightness-grayscale" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 75 |
'class' => 'only_pro', |
| 76 |
'placeholder' => esc_html__('Enter image URLs (comma-separated or one per line) to exclude from brightness adjustments.', 'darkify'), |
| 77 |
'dependency' => array('enable_low_image_brightness', '==', 'true', 'all'), |
| 78 |
), |
| 79 |
), |
| 80 |
), |
| 81 |
// Grayscale Image |
| 82 |
array( |
| 83 |
'id' => 'grayscale', |
| 84 |
'type' => 'fieldset', |
| 85 |
'fields' => array( |
| 86 |
array( |
| 87 |
'id' => 'enable_image_grayscale', |
| 88 |
'type' => 'switcher', |
| 89 |
'title' => esc_html__('Grayscale Images', 'darkify'), |
| 90 |
'title_help' => '<div class="darkify-info-label">' . __('Enable grayscale effect for images in dark mode.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'image-controls/#image_grayscale" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'/media/#brightness-grayscale" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 91 |
'text_on' => esc_html__('Yes', 'darkify'), |
| 92 |
'text_off' => esc_html__('No', 'darkify'), |
| 93 |
), |
| 94 |
array( |
| 95 |
'id' => 'image_grayscale_label', |
| 96 |
'type' => 'slider', |
| 97 |
'title' => esc_html__('Grayscale Label', 'darkify'), |
| 98 |
'title_help' => '<div class="darkify-info-label">' . __('Adjust the grayscale level for images in dark mode.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'image-controls/#image_grayscale" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'/media/#brightness-grayscale" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 99 |
'min' => 0, |
| 100 |
'max' => 100, |
| 101 |
'step' => 5, |
| 102 |
'default' => '80', |
| 103 |
'unit' => '%', |
| 104 |
'dependency' => array('enable_image_grayscale', '==', 'true', 'all'), |
| 105 |
), |
| 106 |
|
| 107 |
array( |
| 108 |
'id' => 'disallowed_low_grayscale_images', |
| 109 |
'type' => 'textarea', |
| 110 |
'title' => esc_html__('Exclude Images', 'darkify'), |
| 111 |
'title_help' => '<div class="darkify-info-label">' . __('Exclude grayscale effects for specific images.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'image-controls/#image_grayscale" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'/media/#brightness-grayscale" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 112 |
'class' => 'only_pro', |
| 113 |
'placeholder' => esc_html__('Enter image URLs (comma-separated or one per line) to exclude from grayscale effects.', 'darkify'), |
| 114 |
'dependency' => array('enable_image_grayscale', '==', 'true', 'all'), |
| 115 |
), |
| 116 |
), |
| 117 |
), |
| 118 |
|
| 119 |
// Darken Background Image |
| 120 |
array( |
| 121 |
'id' => 'darken_background', |
| 122 |
'type' => 'fieldset', |
| 123 |
'fields' => array( |
| 124 |
array( |
| 125 |
'id' => 'enable_low_image_darken', |
| 126 |
'type' => 'switcher', |
| 127 |
'title' => esc_html__('Darken Background Images', 'darkify'), |
| 128 |
'title_help' => '<div class="darkify-info-label">' . __('Enable background darkening effect in dark mode.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'image-controls/#darken_bg" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'media/#backgrounds-svgs" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 129 |
'text_on' => esc_html__('Yes', 'darkify'), |
| 130 |
'text_off' => esc_html__('No', 'darkify'), |
| 131 |
'default' => true, |
| 132 |
), |
| 133 |
array( |
| 134 |
'id' => 'low_image_darken_label', |
| 135 |
'type' => 'slider', |
| 136 |
'title' => esc_html__('Darken Label', 'darkify'), |
| 137 |
'title_help' => '<div class="darkify-info-label">' . __('Adjust the darkening level for background images in dark mode.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'image-controls/#darken_bg" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'media/#backgrounds-svgs" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 138 |
'min' => 0, |
| 139 |
'max' => 100, |
| 140 |
'step' => 5, |
| 141 |
'default' => '60', |
| 142 |
'unit' => '%', |
| 143 |
'dependency' => array('enable_low_image_darken', '==', 'true', 'all'), |
| 144 |
), |
| 145 |
), |
| 146 |
), |
| 147 |
|
| 148 |
array( |
| 149 |
'id' => 'enable_invert_inline_svg', |
| 150 |
'type' => 'switcher', |
| 151 |
'title' => esc_html__('Invert Inline SVGs', 'darkify'), |
| 152 |
'title_help' => '<div class="darkify-info-label">' . __('Enable automatic inversion of inline SVG images in dark mode.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'image-controls/#darken_bg" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'media/#backgrounds-svgs" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 153 |
), |
| 154 |
|
| 155 |
// Image Inversion |
| 156 |
array( |
| 157 |
'id' => 'invert', |
| 158 |
'type' => 'fieldset', |
| 159 |
'fields' => array( |
| 160 |
array( |
| 161 |
'id' => 'enable_invert_images', |
| 162 |
'type' => 'switcher', |
| 163 |
'title' => esc_html__('Invert Specific Images', 'darkify'), |
| 164 |
'title_help' => '<div class="darkify-info-label">' . __('Enable image inversion in dark mode.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'image-controls/#invert_images" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'media/#targeted-inversion-replacement" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 165 |
'class' => 'switcher_pro_only', |
| 166 |
'text_on' => esc_html__('Yes', 'darkify'), |
| 167 |
'text_off' => esc_html__('No', 'darkify'), |
| 168 |
'default' => false, |
| 169 |
), |
| 170 |
array( |
| 171 |
'id' => 'invert_images_allowed_urls', |
| 172 |
'type' => 'textarea', |
| 173 |
'title' => esc_html__('Image URLs', 'darkify'), |
| 174 |
'placeholder' => esc_html__('Enter URLs (comma-separated or one per line) for images, SVGs, or background images to apply inversion.', 'darkify'), |
| 175 |
'title_help' => '<div class="darkify-info-label">' . __('Apply inversion to specific images, SVGs, or backgrounds.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'image-controls/#invert_images" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'media/#targeted-inversion-replacement" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 176 |
'class' => 'only_pro', |
| 177 |
// 'dependency' => array('enable_invert_images', '==', 'true', 'all'), |
| 178 |
), |
| 179 |
), |
| 180 |
), |
| 181 |
|
| 182 |
|
| 183 |
array( |
| 184 |
'id' => 'image_replacements', |
| 185 |
'type' => 'repeater', |
| 186 |
'class' => 'replacement_repeater repeater_pro_only', |
| 187 |
'title' => esc_html__('Replace Images', 'darkify'), |
| 188 |
'title_help' => '<div class="darkify-info-label">' . __('Replace specefied images when darkmode is active.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'image-controls/#replace_images" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'media/#targeted-inversion-replacement" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 189 |
'fields' => array( |
| 190 |
array( |
| 191 |
'id' => 'normal_image', |
| 192 |
'type' => 'upload', |
| 193 |
'title' => esc_html__('Normal Mode', 'darkify'), |
| 194 |
'library' => 'image', |
| 195 |
'placeholder' => esc_html__('Image URL', 'darkify'), |
| 196 |
'button_title' => esc_html__('Add Image', 'darkify'), |
| 197 |
'remove_title' => esc_html__('Remove Image', 'darkify'), |
| 198 |
), |
| 199 |
|
| 200 |
array( |
| 201 |
'id' => 'dark_image', |
| 202 |
'type' => 'upload', |
| 203 |
'title' => esc_html__('Dark Mode', 'darkify'), |
| 204 |
'library' => 'image', |
| 205 |
'placeholder' => esc_html__('Image URL', 'darkify'), |
| 206 |
'button_title' => esc_html__('Add Image', 'darkify'), |
| 207 |
'remove_title' => esc_html__('Remove Image', 'darkify'), |
| 208 |
), |
| 209 |
|
| 210 |
), |
| 211 |
'default' => array( |
| 212 |
array( |
| 213 |
'normal_image' => '', |
| 214 |
'dark_image' => '', |
| 215 |
), |
| 216 |
) |
| 217 |
), |
| 218 |
|
| 219 |
) |
| 220 |
), |
| 221 |
array( |
| 222 |
'title' => esc_html__('Video Controls', 'darkify'), |
| 223 |
'icon' => 'icofont-file-video', |
| 224 |
'fields' => array( |
| 225 |
|
| 226 |
// Low Brightness |
| 227 |
array( |
| 228 |
'id' => 'video_brightness', |
| 229 |
'type' => 'fieldset', |
| 230 |
'fields' => array( |
| 231 |
array( |
| 232 |
'id' => 'enable_low_video_brightness', |
| 233 |
'type' => 'switcher', |
| 234 |
'title' => esc_html__('Low Brightness Videos', 'darkify'), |
| 235 |
'title_help' => '<div class="darkify-info-label">' . __('Enable brightness effect for videos in dark mode.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'video-controls/#video_brightness" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'media/#video-control" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 236 |
'text_on' => esc_html__('Yes', 'darkify'), |
| 237 |
'text_off' => esc_html__('No', 'darkify'), |
| 238 |
'default' => true, |
| 239 |
), |
| 240 |
array( |
| 241 |
'id' => 'low_video_brightness_label', |
| 242 |
'type' => 'slider', |
| 243 |
'title' => esc_html__('Brightness Label', 'darkify'), |
| 244 |
'title_help' => '<div class="darkify-info-label">' . __('Adjust the brightness level for dark mode.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'video-controls/#video_brightness" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'media/#video-control" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 245 |
'min' => 0, |
| 246 |
'max' => 100, |
| 247 |
'step' => 5, |
| 248 |
'default' => '20', |
| 249 |
'unit' => '%', |
| 250 |
'dependency' => array('enable_low_video_brightness', '==', 'true', 'all'), |
| 251 |
), |
| 252 |
), |
| 253 |
), |
| 254 |
|
| 255 |
// Grayscale Video |
| 256 |
array( |
| 257 |
'id' => 'video_grayscale', |
| 258 |
'type' => 'fieldset', |
| 259 |
'fields' => array( |
| 260 |
array( |
| 261 |
'id' => 'enable_video_grayscale', |
| 262 |
'type' => 'switcher', |
| 263 |
'title' => esc_html__('Grayscale Videos', 'darkify'), |
| 264 |
'title_help' => '<div class="darkify-info-label">' . __('Enable grayscale effect for videos in dark mode.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'video-controls/#video_brightness" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'media/#video-control" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 265 |
'text_on' => esc_html__('Yes', 'darkify'), |
| 266 |
'text_off' => esc_html__('No', 'darkify'), |
| 267 |
), |
| 268 |
array( |
| 269 |
'id' => 'video_grayscale_label', |
| 270 |
'type' => 'slider', |
| 271 |
'title' => esc_html__('Grayscale Label', 'darkify'), |
| 272 |
'title_help' => '<div class="darkify-info-label">' . __('Adjust the grayscale level for dark mode.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'video-controls/#video_brightness" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'media/#video-control" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 273 |
'min' => 0, |
| 274 |
'max' => 100, |
| 275 |
'step' => 5, |
| 276 |
'default' => '80', |
| 277 |
'unit' => '%', |
| 278 |
'dependency' => array('enable_video_grayscale', '==', 'true', 'all'), |
| 279 |
), |
| 280 |
), |
| 281 |
), |
| 282 |
|
| 283 |
|
| 284 |
array( |
| 285 |
'id' => 'video_replacements', |
| 286 |
'type' => 'repeater', |
| 287 |
'class' => 'replacement_repeater repeater_pro_only', |
| 288 |
'title' => esc_html__('Replace Videos', 'darkify'), |
| 289 |
'title_help' => '<div class="darkify-info-label">' . __('Replace specified videos (self-hosted, youtube, vimeo or dailymotion) when dark mode is active.', 'darkify') . '</div><a class="tooltip_btn_primary" href="'.DARKIFY_DEMO_URL.'video-controls/#replace_videos" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="'.DARKIFY_DOCS_URL.'media/#video-control" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 290 |
'fields' => array( |
| 291 |
array( |
| 292 |
'id' => 'normal_video', |
| 293 |
'type' => 'upload', |
| 294 |
'title' => esc_html__('Normal Mode Video', 'darkify'), |
| 295 |
'library' => 'video', |
| 296 |
'placeholder' => esc_html__('Video URL', 'darkify'), |
| 297 |
'button_title' => esc_html__('Add Video', 'darkify'), |
| 298 |
'remove_title' => esc_html__('Remove Video', 'darkify'), |
| 299 |
), |
| 300 |
|
| 301 |
array( |
| 302 |
'id' => 'dark_video', |
| 303 |
'type' => 'upload', |
| 304 |
'title' => esc_html__('Dark Mode Video', 'darkify'), |
| 305 |
'library' => 'video', |
| 306 |
'placeholder' => esc_html__('Video URL', 'darkify'), |
| 307 |
'button_title' => esc_html__('Add Video', 'darkify'), |
| 308 |
'remove_title' => esc_html__('Remove Video', 'darkify'), |
| 309 |
), |
| 310 |
|
| 311 |
), |
| 312 |
'default' => array( |
| 313 |
array( |
| 314 |
'normal_video' => '', |
| 315 |
'dark_video' => '', |
| 316 |
), |
| 317 |
) |
| 318 |
), |
| 319 |
) |
| 320 |
), |
| 321 |
), |
| 322 |
), |
| 323 |
) |
| 324 |
) |
| 325 |
); |
| 326 |
} |
| 327 |
} |
| 328 |
|