| 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 ImageStyle |
| 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($prefix, array( |
| 29 |
'title' => esc_html__('IMAGE STYLE', 'darkify'), |
| 30 |
'icon' => 'icofont-image', |
| 31 |
'fields' => array( |
| 32 |
// Appearance Control |
| 33 |
array( |
| 34 |
'type' => 'heading', |
| 35 |
'content' => esc_html__('Appearance Control', 'darkify'), |
| 36 |
), |
| 37 |
|
| 38 |
// Low Brightness |
| 39 |
array( |
| 40 |
'id' => 'brightness', |
| 41 |
'type' => 'fieldset', |
| 42 |
'fields' => array( |
| 43 |
array( |
| 44 |
'id' => 'enable_low_image_brightness', |
| 45 |
'type' => 'switcher', |
| 46 |
'title' => esc_html__('Low Brightness', 'darkify'), |
| 47 |
'desc' => esc_html__('Switch and select the brightness level of images on dark mode.', 'darkify'), |
| 48 |
'text_on' => esc_html__('Yes', 'darkify'), |
| 49 |
'text_off' => esc_html__('No', 'darkify'), |
| 50 |
'default' => true, |
| 51 |
), |
| 52 |
array( |
| 53 |
'id' => 'low_image_brightness_label', |
| 54 |
'type' => 'select', |
| 55 |
'title' => esc_html__('Brightness Label', 'darkify'), |
| 56 |
'options' => array( |
| 57 |
'0' => esc_html__('0% Brightness', 'darkify'), |
| 58 |
'10' => esc_html__('10% Brightness', 'darkify'), |
| 59 |
'20' => esc_html__('20% Brightness', 'darkify'), |
| 60 |
'30' => esc_html__('30% Brightness', 'darkify'), |
| 61 |
'40' => esc_html__('40% Brightness', 'darkify'), |
| 62 |
'50' => esc_html__('50% Brightness', 'darkify'), |
| 63 |
'60' => esc_html__('60% Brightness', 'darkify'), |
| 64 |
'70' => esc_html__('70% Brightness', 'darkify'), |
| 65 |
'80' => esc_html__('80% Brightness', 'darkify'), |
| 66 |
'90' => esc_html__('90% Brightness', 'darkify'), |
| 67 |
'100' => esc_html__('100% Brightness', 'darkify'), |
| 68 |
), |
| 69 |
'default' => '80', |
| 70 |
'dependency' => array('enable_low_image_brightness', '==', 'true', 'all'), |
| 71 |
), |
| 72 |
array( |
| 73 |
'id' => 'disallowed_low_brightness_images', |
| 74 |
'type' => 'textarea', |
| 75 |
'title' => esc_html__('Allow Only Elements', 'darkify'), |
| 76 |
'desc' => esc_html__('Enter comma-separated image URLs where brightness will be normal.', 'darkify'), |
| 77 |
'placeholder' => esc_html__('Exclude low brightness on specific images.', 'darkify'), |
| 78 |
'dependency' => array('enable_low_image_brightness', '==', 'true', 'all'), |
| 79 |
'class' => 'only_pro', |
| 80 |
), |
| 81 |
), |
| 82 |
), |
| 83 |
// Grayscale Image |
| 84 |
array( |
| 85 |
'id' => 'grayscale', |
| 86 |
'type' => 'fieldset', |
| 87 |
'fields' => array( |
| 88 |
array( |
| 89 |
'id' => 'enable_image_grayscale', |
| 90 |
'type' => 'switcher', |
| 91 |
'title' => esc_html__('Grayscale Image', 'darkify'), |
| 92 |
'desc' => esc_html__('Switch and select the grayscale level of images on dark mode.', 'darkify'), |
| 93 |
'text_on' => esc_html__('Yes', 'darkify'), |
| 94 |
'text_off' => esc_html__('No', 'darkify'), |
| 95 |
'default' => false, |
| 96 |
), |
| 97 |
array( |
| 98 |
'id' => 'image_grayscale_label', |
| 99 |
'type' => 'select', |
| 100 |
'title' => esc_html__('Grayscale Label', 'darkify'), |
| 101 |
'options' => array( |
| 102 |
'0' => esc_html__('0% Brightness', 'darkify'), |
| 103 |
'10' => esc_html__('10% Grayscale', 'darkify'), |
| 104 |
'20' => esc_html__('20% Grayscale', 'darkify'), |
| 105 |
'30' => esc_html__('30% Grayscale', 'darkify'), |
| 106 |
'40' => esc_html__('40% Grayscale', 'darkify'), |
| 107 |
'50' => esc_html__('50% Grayscale', 'darkify'), |
| 108 |
'60' => esc_html__('60% Grayscale', 'darkify'), |
| 109 |
'70' => esc_html__('70% Grayscale', 'darkify'), |
| 110 |
'80' => esc_html__('80% Grayscale', 'darkify'), |
| 111 |
'90' => esc_html__('90% Grayscale', 'darkify'), |
| 112 |
'100' => esc_html__('100% Grayscale', 'darkify'), |
| 113 |
), |
| 114 |
'default' => '80', |
| 115 |
'dependency' => array('enable_image_grayscale', '==', 'true', 'all'), |
| 116 |
), |
| 117 |
|
| 118 |
array( |
| 119 |
'id' => 'disallowed_low_grayscale_images', |
| 120 |
'type' => 'textarea', |
| 121 |
'title' => esc_html__('Exclude images', 'darkify'), |
| 122 |
'desc' => esc_html__('Enter comma-separated image URLs where grayscale will be normal.', 'darkify'), |
| 123 |
'placeholder' => esc_html__('Exclude low grayscale on specific images.', 'darkify'), |
| 124 |
'dependency' => array('enable_image_grayscale', '==', 'true', 'all'), |
| 125 |
'class' => 'only_pro', |
| 126 |
), |
| 127 |
), |
| 128 |
), |
| 129 |
|
| 130 |
// Darken Background Image |
| 131 |
array( |
| 132 |
'id' => 'darken_background', |
| 133 |
'type' => 'fieldset', |
| 134 |
'fields' => array( |
| 135 |
array( |
| 136 |
'id' => 'enable_low_image_darken', |
| 137 |
'type' => 'switcher', |
| 138 |
'title' => esc_html__('Darken Background Image', 'darkify'), |
| 139 |
'desc' => esc_html__('Switch and select the level of darkness of background images on dark mode.', 'darkify'), |
| 140 |
'text_on' => esc_html__('Yes', 'darkify'), |
| 141 |
'text_off' => esc_html__('No', 'darkify'), |
| 142 |
'default' => true, |
| 143 |
), |
| 144 |
array( |
| 145 |
'id' => 'low_image_darken_label', |
| 146 |
'type' => 'select', |
| 147 |
'title' => esc_html__('Darken Label', 'darkify'), |
| 148 |
'options' => array( |
| 149 |
'0' => esc_html__('0% Darken', 'darkify'), |
| 150 |
'10' => esc_html__('10% Darken', 'darkify'), |
| 151 |
'20' => esc_html__('20% Darken', 'darkify'), |
| 152 |
'30' => esc_html__('30% Darken', 'darkify'), |
| 153 |
'40' => esc_html__('40% Darken', 'darkify'), |
| 154 |
'50' => esc_html__('50% Darken', 'darkify'), |
| 155 |
'60' => esc_html__('60% Darken', 'darkify'), |
| 156 |
'70' => esc_html__('70% Darken', 'darkify'), |
| 157 |
'80' => esc_html__('80% Darken', 'darkify'), |
| 158 |
'90' => esc_html__('90% Darken', 'darkify'), |
| 159 |
'100' => esc_html__('100% Darken', 'darkify'), |
| 160 |
), |
| 161 |
'default' => '80', |
| 162 |
'dependency' => array('enable_low_image_darken', '==', 'true', 'all'), |
| 163 |
), |
| 164 |
), |
| 165 |
), |
| 166 |
|
| 167 |
array( |
| 168 |
'id' => 'enable_invert_inline_svg', |
| 169 |
'type' => 'switcher', |
| 170 |
'title' => esc_html__('Invert Inline SVG', 'darkify'), |
| 171 |
'desc' => esc_html__('Turn On to automatically invert all inline SVG images in dark mode.', 'darkify'), |
| 172 |
'default' => false, |
| 173 |
), |
| 174 |
// Image Inversion |
| 175 |
array( |
| 176 |
'id' => 'invert', |
| 177 |
'type' => 'fieldset', |
| 178 |
'class' => 'only_pro', |
| 179 |
'fields' => array( |
| 180 |
array( |
| 181 |
'id' => 'enable_invert_images', |
| 182 |
'type' => 'switcher', |
| 183 |
'class' => 'switcher_pro_only', |
| 184 |
'title' => esc_html__('Invert speceifc Images', 'darkify'), |
| 185 |
'desc' => esc_html__('Switch to invert specific images on dark mode.', 'darkify'), |
| 186 |
'text_on' => esc_html__('Yes', 'darkify'), |
| 187 |
'text_off' => esc_html__('No', 'darkify'), |
| 188 |
'default' => false, |
| 189 |
), |
| 190 |
array( |
| 191 |
'id' => 'invert_images_allowed_urls', |
| 192 |
'type' => 'textarea', |
| 193 |
'title' => esc_html__('Image URLs', 'darkify'), |
| 194 |
'desc' => esc_html__('Image "src", "srcset" or CSS backgroundImage URLs are supported to target for inversion.', 'darkify'), |
| 195 |
'placeholder' => esc_html__('Enter comma-separated image URLs where inversion needed to apply.', 'darkify'), |
| 196 |
// 'dependency' => array('enable_invert_images', '==', 'true', 'all'), |
| 197 |
), |
| 198 |
), |
| 199 |
), |
| 200 |
// Image Replacement |
| 201 |
array( |
| 202 |
'type' => 'heading', |
| 203 |
'content' => esc_html__('Image Replacement', 'darkify'), |
| 204 |
), |
| 205 |
|
| 206 |
array( |
| 207 |
'id' => 'image_replacements', |
| 208 |
'type' => 'repeater', |
| 209 |
'class' => 'repeater_pro_only', |
| 210 |
'title' => esc_html__('Replace images', 'darkify'), |
| 211 |
'fields' => array( |
| 212 |
array( |
| 213 |
'id' => 'normal_image', |
| 214 |
'type' => 'upload', |
| 215 |
'title' => esc_html__('Normal Mode Image', 'darkify'), |
| 216 |
'library' => 'image', |
| 217 |
'placeholder' => esc_html__('Image URL', 'darkify'), |
| 218 |
'button_title' => esc_html__('Add Image', 'darkify'), |
| 219 |
'remove_title' => esc_html__('Remove Image', 'darkify'), |
| 220 |
), |
| 221 |
|
| 222 |
array( |
| 223 |
'id' => 'dark_image', |
| 224 |
'type' => 'upload', |
| 225 |
'title' => esc_html__('Dark Mode Image', 'darkify'), |
| 226 |
'library' => 'image', |
| 227 |
'placeholder' => esc_html__('Image URL', 'darkify'), |
| 228 |
'button_title' => esc_html__('Add Image', 'darkify'), |
| 229 |
'remove_title' => esc_html__('Remove Image', 'darkify'), |
| 230 |
), |
| 231 |
|
| 232 |
), |
| 233 |
'default' => array( |
| 234 |
array( |
| 235 |
'normal_image' => '', |
| 236 |
'dark_image' => '', |
| 237 |
), |
| 238 |
) |
| 239 |
), |
| 240 |
) |
| 241 |
)); |
| 242 |
} |
| 243 |
} |
| 244 |
|