| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\Admin\Options; |
| 4 |
|
| 5 |
use WPAdminify\Inc\Utils; |
| 6 |
use WPAdminify\Inc\Admin\AdminSettingsModel; |
| 7 |
|
| 8 |
|
| 9 |
if (!defined('ABSPATH')) { |
| 10 |
die; |
| 11 |
} // Cannot access directly. |
| 12 |
|
| 13 |
class General_Settings extends AdminSettingsModel |
| 14 |
{ |
| 15 |
public function __construct() |
| 16 |
{ |
| 17 |
$this->general_settings(); |
| 18 |
} |
| 19 |
|
| 20 |
public function get_defaults() |
| 21 |
{ |
| 22 |
return [ |
| 23 |
'admin_general_google_font' => array( |
| 24 |
'font-family' => 'Nunito Sans', |
| 25 |
'font-weight' => '400', |
| 26 |
'type' => 'google', |
| 27 |
'font-size' => '', |
| 28 |
'line-height' => '', |
| 29 |
'color' => '', |
| 30 |
'output' => 'body' |
| 31 |
), |
| 32 |
'admin_general_bg' => 'color', |
| 33 |
'admin_general_bg_color' => '', |
| 34 |
'admin_general_bg_gradient' => array( |
| 35 |
'background-color' => '#0347FF', |
| 36 |
'background-gradient-color' => '#fd1919', |
| 37 |
'background-gradient-direction' => '135deg' |
| 38 |
), |
| 39 |
'admin_general_bg_image' => '', |
| 40 |
'admin_general_bg_slideshow' => '', |
| 41 |
'admin_general_bg_video_type' => 'youtube', |
| 42 |
'admin_general_bg_video_self_hosted' => '', |
| 43 |
'admin_general_bg_video_youtube' => '', |
| 44 |
'admin_general_bg_video_loop' => true, |
| 45 |
'admin_general_bg_video_poster' => '', |
| 46 |
'admin_glass_effect' => true |
| 47 |
]; |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
public function general_google_fonts(&$fields) |
| 52 |
{ |
| 53 |
$fields[] = array( |
| 54 |
'type' => 'subheading', |
| 55 |
'content' => Utils::adminfiy_help_urls( |
| 56 |
__('Customize Settings', WP_ADMINIFY_TD), |
| 57 |
'https://wpadminify.com/kb/admin-customization/', |
| 58 |
'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8', |
| 59 |
'https://www.facebook.com/groups/jeweltheme', |
| 60 |
'https://wpadminify.com/support/' |
| 61 |
) |
| 62 |
); |
| 63 |
|
| 64 |
if (jltwp_adminify()->can_use_premium_code__premium_only()) { |
| 65 |
$fields[] = array( |
| 66 |
'id' => 'admin_general_google_font', |
| 67 |
'type' => 'typography', |
| 68 |
'title' => __('Body Font', WP_ADMINIFY_TD), |
| 69 |
'line_height' => true, |
| 70 |
'text_align' => false, |
| 71 |
'text_transform' => false, |
| 72 |
'subset' => false, |
| 73 |
'letter_spacing' => false, |
| 74 |
'default' => $this->get_default_field('admin_general_google_font'), |
| 75 |
); |
| 76 |
} else { |
| 77 |
$fields[] = array( |
| 78 |
'title' => 'Body Font', |
| 79 |
'type' => 'notice', |
| 80 |
'style' => 'warning', |
| 81 |
'content' => Utils::adminify_upgrade_pro(), |
| 82 |
); |
| 83 |
} |
| 84 |
} |
| 85 |
|
| 86 |
public function general_gradient_bg(&$fields) |
| 87 |
{ |
| 88 |
if (jltwp_adminify()->can_use_premium_code__premium_only()) { |
| 89 |
$fields[] = array( |
| 90 |
'id' => 'admin_general_bg_gradient', |
| 91 |
'type' => 'background', |
| 92 |
'title' => __('Gradient Background', WP_ADMINIFY_TD), |
| 93 |
'background_color' => true, |
| 94 |
'background_image' => false, |
| 95 |
'background_position' => false, |
| 96 |
'background_repeat' => false, |
| 97 |
'background_attachment' => false, |
| 98 |
'background_size' => false, |
| 99 |
'background_origin' => false, |
| 100 |
'background_clip' => false, |
| 101 |
'background_blend_mode' => false, |
| 102 |
'background_gradient' => true, |
| 103 |
'default' => $this->get_default_field('admin_general_bg_gradient'), |
| 104 |
'dependency' => array('admin_general_bg', '==', 'gradient', true), |
| 105 |
); |
| 106 |
} else { |
| 107 |
$fields[] = array( |
| 108 |
'title' => '', |
| 109 |
'type' => 'notice', |
| 110 |
'style' => 'warning', |
| 111 |
'content' => Utils::adminify_upgrade_pro(), |
| 112 |
'dependency' => array('admin_general_bg', '==', 'gradient', true), |
| 113 |
); |
| 114 |
} |
| 115 |
} |
| 116 |
|
| 117 |
public function general_image_bg(&$fields) |
| 118 |
{ |
| 119 |
if (jltwp_adminify()->can_use_premium_code__premium_only()) { |
| 120 |
$fields[] = array( |
| 121 |
'id' => 'admin_general_bg_image', |
| 122 |
'type' => 'background', |
| 123 |
'title' => __('Background Image', WP_ADMINIFY_TD), |
| 124 |
'background_color' => false, |
| 125 |
'background_image' => true, |
| 126 |
'background_position' => false, |
| 127 |
'background_repeat' => false, |
| 128 |
'background_attachment' => false, |
| 129 |
'background_size' => false, |
| 130 |
'background_origin' => false, |
| 131 |
'background_clip' => false, |
| 132 |
'background_blend_mode' => false, |
| 133 |
'background_gradient' => false, |
| 134 |
'default' => $this->get_default_field('admin_general_bg_image'), |
| 135 |
'dependency' => array('admin_general_bg', '==', 'image', true), |
| 136 |
); |
| 137 |
} else { |
| 138 |
$fields[] = array( |
| 139 |
'title' => '', |
| 140 |
'type' => 'notice', |
| 141 |
'style' => 'warning', |
| 142 |
'content' => Utils::adminify_upgrade_pro(), |
| 143 |
'dependency' => array('admin_general_bg', '==', 'image', true), |
| 144 |
); |
| 145 |
} |
| 146 |
} |
| 147 |
|
| 148 |
|
| 149 |
public function general_slideshow_bg(&$fields) |
| 150 |
{ |
| 151 |
if (jltwp_adminify()->can_use_premium_code__premium_only()) { |
| 152 |
$fields[] = array( |
| 153 |
'id' => 'admin_general_bg_slideshow', |
| 154 |
'type' => 'gallery', |
| 155 |
'title' => __('Slideshow Images', WP_ADMINIFY_TD), |
| 156 |
'add_title' => __('Add Slide', WP_ADMINIFY_TD), |
| 157 |
'edit_title' => __('Edit Slides', WP_ADMINIFY_TD), |
| 158 |
'clear_title' => __('Remove', WP_ADMINIFY_TD), |
| 159 |
'default' => $this->get_default_field('admin_general_bg_slideshow'), |
| 160 |
'dependency' => array('admin_general_bg', '==', 'slideshow', true), |
| 161 |
); |
| 162 |
} else { |
| 163 |
$fields[] = array( |
| 164 |
'title' => '', |
| 165 |
'type' => 'notice', |
| 166 |
'style' => 'warning', |
| 167 |
'content' => Utils::adminify_upgrade_pro(), |
| 168 |
'dependency' => array('admin_general_bg', '==', 'slideshow', true), |
| 169 |
); |
| 170 |
} |
| 171 |
} |
| 172 |
|
| 173 |
|
| 174 |
public function general_glass_effect_bg(&$fields) |
| 175 |
{ |
| 176 |
if (jltwp_adminify()->can_use_premium_code__premium_only()) { |
| 177 |
$fields[] = array( |
| 178 |
'id' => 'admin_glass_effect', |
| 179 |
'type' => 'switcher', |
| 180 |
'title' => __('Glass Effect', WP_ADMINIFY_TD), |
| 181 |
'text_on' => 'Enabled', |
| 182 |
'text_off' => 'Disabled', |
| 183 |
'text_width' => 100, |
| 184 |
'default' => $this->get_default_field('admin_glass_effect'), |
| 185 |
); |
| 186 |
} else { |
| 187 |
$fields[] = array( |
| 188 |
'title' => __('Glass Effect', WP_ADMINIFY_TD), |
| 189 |
'type' => 'notice', |
| 190 |
'style' => 'warning', |
| 191 |
'content' => Utils::adminify_upgrade_pro() |
| 192 |
); |
| 193 |
} |
| 194 |
} |
| 195 |
|
| 196 |
|
| 197 |
public function general_video_bg(&$fields) |
| 198 |
{ |
| 199 |
if (jltwp_adminify()->can_use_premium_code__premium_only()) { |
| 200 |
$fields[] = array( |
| 201 |
'id' => 'admin_general_bg_video_type', |
| 202 |
'type' => 'button_set', |
| 203 |
'title' => __('Video Type', WP_ADMINIFY_TD), |
| 204 |
'options' => array( |
| 205 |
'youtube' => __('Youtube', WP_ADMINIFY_TD), |
| 206 |
'self_hosted' => __('Self Hosted', WP_ADMINIFY_TD), |
| 207 |
), |
| 208 |
'default' => $this->get_default_field('admin_general_bg_video_type'), |
| 209 |
'dependency' => array('admin_general_bg', '==', 'video', true), |
| 210 |
); |
| 211 |
$fields[] = array( |
| 212 |
'id' => 'admin_general_bg_video_self_hosted', |
| 213 |
'type' => 'media', |
| 214 |
'title' => __('Upload Video', WP_ADMINIFY_TD), |
| 215 |
'library' => 'video', |
| 216 |
'preview' => true, |
| 217 |
'default' => $this->get_default_field('admin_general_bg_video_self_hosted'), |
| 218 |
'dependency' => array('admin_general_bg|admin_general_bg_video_type', '==|==', 'video|self_hosted', true), |
| 219 |
); |
| 220 |
$fields[] = array( |
| 221 |
'id' => 'admin_general_bg_video_youtube', |
| 222 |
'type' => 'text', |
| 223 |
'title' => 'Youtube URL', |
| 224 |
'default' => $this->get_default_field('admin_general_bg_video_youtube'), |
| 225 |
'dependency' => array('admin_general_bg|admin_general_bg_video_type', '==|==', 'video|youtube', true), |
| 226 |
); |
| 227 |
$fields[] = array( |
| 228 |
'id' => 'admin_general_bg_video_loop', |
| 229 |
'type' => 'switcher', |
| 230 |
'title' => __('Loop Video?', WP_ADMINIFY_TD), |
| 231 |
'text_on' => 'Yes', |
| 232 |
'text_off' => 'No', |
| 233 |
'class' => 'wp-adminify-cs', |
| 234 |
'default' => $this->get_default_field('admin_general_bg_video_loop'), |
| 235 |
'dependency' => array('admin_general_bg', '==', 'video', true), |
| 236 |
); |
| 237 |
$fields[] = array( |
| 238 |
'id' => 'admin_general_bg_video_poster', |
| 239 |
'type' => 'media', |
| 240 |
'title' => __('Poster Image', WP_ADMINIFY_TD), |
| 241 |
'library' => 'image', |
| 242 |
'default' => $this->get_default_field('admin_general_bg_video_poster'), |
| 243 |
'dependency' => array('admin_general_bg', '==', 'video', true), |
| 244 |
); |
| 245 |
} else { |
| 246 |
$fields[] = array( |
| 247 |
'title' => '', |
| 248 |
'type' => 'notice', |
| 249 |
'style' => 'warning', |
| 250 |
'content' => Utils::adminify_upgrade_pro(), |
| 251 |
'dependency' => array('admin_general_bg', '==', 'video', true), |
| 252 |
); |
| 253 |
} |
| 254 |
} |
| 255 |
|
| 256 |
|
| 257 |
public function general_fields(&$fields) |
| 258 |
{ |
| 259 |
$fields[] = array( |
| 260 |
'type' => 'subheading', |
| 261 |
'content' => __('Body Color Customization', WP_ADMINIFY_TD) |
| 262 |
); |
| 263 |
|
| 264 |
$fields[] = array( |
| 265 |
'id' => 'admin_general_bg', |
| 266 |
'type' => 'button_set', |
| 267 |
'title' => 'Background Type', |
| 268 |
'options' => array( |
| 269 |
'color' => 'Color', |
| 270 |
'gradient' => 'Gradient', |
| 271 |
'image' => 'Image', |
| 272 |
'slideshow' => 'Slideshow', |
| 273 |
'video' => 'Video', |
| 274 |
), |
| 275 |
'default' => 'color' |
| 276 |
); |
| 277 |
|
| 278 |
$fields[] = array( |
| 279 |
'id' => 'admin_general_bg_color', |
| 280 |
'type' => 'color', |
| 281 |
'title' => 'Background Color', |
| 282 |
'default' => '', |
| 283 |
'dependency' => array('admin_general_bg', '==', 'color', true), |
| 284 |
); |
| 285 |
} |
| 286 |
|
| 287 |
public function general_settings() |
| 288 |
{ |
| 289 |
if (!class_exists('ADMINIFY')) { |
| 290 |
return; |
| 291 |
} |
| 292 |
|
| 293 |
$fields = []; |
| 294 |
|
| 295 |
$this->general_google_fonts($fields); |
| 296 |
$this->general_fields($fields); |
| 297 |
$this->general_gradient_bg($fields); |
| 298 |
$this->general_image_bg($fields); |
| 299 |
$this->general_slideshow_bg($fields); |
| 300 |
$this->general_video_bg($fields); |
| 301 |
// self::general_glass_effect_bg($fields); |
| 302 |
|
| 303 |
\ADMINIFY::createSection($this->prefix, array( |
| 304 |
'title' => __('Customize', WP_ADMINIFY_TD), |
| 305 |
'icon' => 'fas fa-fill-drip', |
| 306 |
'fields' => $fields |
| 307 |
)); |
| 308 |
} |
| 309 |
} |
| 310 |
|