| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\Admin\Options; |
| 4 |
|
| 5 |
use WPAdminify\Inc\Utils ; |
| 6 |
use WPAdminify\Inc\Admin\AdminSettingsModel ; |
| 7 |
if ( !defined( 'ABSPATH' ) ) { |
| 8 |
die; |
| 9 |
} |
| 10 |
// Cannot access directly. |
| 11 |
class General_Settings extends AdminSettingsModel |
| 12 |
{ |
| 13 |
public function __construct() |
| 14 |
{ |
| 15 |
$this->general_settings(); |
| 16 |
} |
| 17 |
|
| 18 |
public function get_defaults() |
| 19 |
{ |
| 20 |
return [ |
| 21 |
'adminify_theme' => 'preset1', |
| 22 |
'adminify_theme_custom_colors' => [ |
| 23 |
'--adminify-preset-background' => '#F9F9F9', |
| 24 |
'--adminify-menu-bg' => '#4738a6', |
| 25 |
'--adminify-menu-text-color' => '#ffffff', |
| 26 |
'--adminify-admin-bar-bg' => '#4738a6', |
| 27 |
'--adminify-admin-bar-icon' => '#ffffff', |
| 28 |
'--adminify-admin-bar-input-bg' => '#594caf', |
| 29 |
'--adminify-admin-bar-input-text' => '#ffffff', |
| 30 |
'--adminify-notif-bg-color' => '#FD49A0', |
| 31 |
'--adminify-btn-bg' => '#48c7fd', |
| 32 |
], |
| 33 |
'admin_general_google_font' => array( |
| 34 |
'font-family' => 'Nunito Sans', |
| 35 |
'font-weight' => '400', |
| 36 |
'type' => 'google', |
| 37 |
'font-size' => '', |
| 38 |
'line-height' => '', |
| 39 |
'color' => '', |
| 40 |
'output' => 'body', |
| 41 |
), |
| 42 |
'admin_general_bg' => 'color', |
| 43 |
'admin_general_bg_color' => '', |
| 44 |
'admin_general_bg_gradient' => array( |
| 45 |
'background-color' => '#0347FF', |
| 46 |
'background-gradient-color' => '#fd1919', |
| 47 |
'background-gradient-direction' => '135deg', |
| 48 |
), |
| 49 |
'admin_general_bg_image' => '', |
| 50 |
'admin_general_bg_slideshow' => '', |
| 51 |
'admin_general_bg_video_type' => 'youtube', |
| 52 |
'admin_general_bg_video_self_hosted' => '', |
| 53 |
'admin_general_bg_video_youtube' => '', |
| 54 |
'admin_general_bg_video_loop' => true, |
| 55 |
'admin_general_bg_video_poster' => '', |
| 56 |
'admin_glass_effect' => true, |
| 57 |
'admin_general_button_color' => [ |
| 58 |
'primary_color' => '#0347FF', |
| 59 |
'secondary_color' => '#fff', |
| 60 |
], |
| 61 |
'admin_danger_button_color' => [ |
| 62 |
'primary_color' => '#c30052', |
| 63 |
'secondary_color' => '#fff', |
| 64 |
], |
| 65 |
]; |
| 66 |
} |
| 67 |
|
| 68 |
public function general_template_preset_google_fonts( &$fields ) |
| 69 |
{ |
| 70 |
$fields[] = array( |
| 71 |
'type' => 'subheading', |
| 72 |
'content' => Utils::adminfiy_help_urls( |
| 73 |
__( 'Customize Settings', 'adminify' ), |
| 74 |
'https://wpadminify.com/kb/admin-customization/', |
| 75 |
'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8', |
| 76 |
'https://www.facebook.com/groups/jeweltheme', |
| 77 |
'https://wpadminify.com/support/' |
| 78 |
), |
| 79 |
); |
| 80 |
$fields[] = array( |
| 81 |
'id' => 'adminify_theme', |
| 82 |
'type' => 'image_select', |
| 83 |
'title' => __( 'Adminify UI Templates', 'adminify' ), |
| 84 |
'options' => array( |
| 85 |
'preset1' => WP_ADMINIFY_ASSETS_IMAGE . 'presets/preset-1.png', |
| 86 |
'preset2' => WP_ADMINIFY_ASSETS_IMAGE . 'presets/preset-2.png', |
| 87 |
'preset3' => WP_ADMINIFY_ASSETS_IMAGE . 'presets/preset-3.png', |
| 88 |
'preset4' => WP_ADMINIFY_ASSETS_IMAGE . 'presets/preset-4.png', |
| 89 |
'preset5' => WP_ADMINIFY_ASSETS_IMAGE . 'presets/preset-5.png', |
| 90 |
'preset6' => WP_ADMINIFY_ASSETS_IMAGE . 'presets/preset-6.png', |
| 91 |
'preset7' => WP_ADMINIFY_ASSETS_IMAGE . 'presets/preset-7.png', |
| 92 |
'preset8' => WP_ADMINIFY_ASSETS_IMAGE . 'presets/preset-8.png', |
| 93 |
'preset9' => WP_ADMINIFY_ASSETS_IMAGE . 'presets/preset-9.png', |
| 94 |
'custom' => WP_ADMINIFY_ASSETS_IMAGE . 'presets/preset-10.png', |
| 95 |
), |
| 96 |
'default' => $this->get_default_field( 'adminify_theme' ), |
| 97 |
); |
| 98 |
$fields[] = array( |
| 99 |
'title' => '', |
| 100 |
'type' => 'notice', |
| 101 |
'style' => 'warning', |
| 102 |
'content' => Utils::adminify_upgrade_pro(), |
| 103 |
'dependency' => array( |
| 104 |
'adminify_theme|adminify_theme', |
| 105 |
'!=|!=', |
| 106 |
'preset1|preset2', |
| 107 |
'any' |
| 108 |
), |
| 109 |
); |
| 110 |
$fields[] = array( |
| 111 |
'title' => 'Body Font', |
| 112 |
'type' => 'notice', |
| 113 |
'style' => 'warning', |
| 114 |
'content' => Utils::adminify_upgrade_pro(), |
| 115 |
); |
| 116 |
} |
| 117 |
|
| 118 |
public function general_gradient_bg( &$fields ) |
| 119 |
{ |
| 120 |
$fields[] = array( |
| 121 |
'title' => '', |
| 122 |
'type' => 'notice', |
| 123 |
'style' => 'warning', |
| 124 |
'content' => Utils::adminify_upgrade_pro(), |
| 125 |
'dependency' => array( |
| 126 |
'admin_general_bg', |
| 127 |
'==', |
| 128 |
'gradient', |
| 129 |
true |
| 130 |
), |
| 131 |
); |
| 132 |
} |
| 133 |
|
| 134 |
public function general_image_bg( &$fields ) |
| 135 |
{ |
| 136 |
$fields[] = array( |
| 137 |
'title' => '', |
| 138 |
'type' => 'notice', |
| 139 |
'style' => 'warning', |
| 140 |
'content' => Utils::adminify_upgrade_pro(), |
| 141 |
'dependency' => array( |
| 142 |
'admin_general_bg', |
| 143 |
'==', |
| 144 |
'image', |
| 145 |
true |
| 146 |
), |
| 147 |
); |
| 148 |
} |
| 149 |
|
| 150 |
public function general_slideshow_bg( &$fields ) |
| 151 |
{ |
| 152 |
$fields[] = array( |
| 153 |
'title' => '', |
| 154 |
'type' => 'notice', |
| 155 |
'style' => 'warning', |
| 156 |
'content' => Utils::adminify_upgrade_pro(), |
| 157 |
'dependency' => array( |
| 158 |
'admin_general_bg', |
| 159 |
'==', |
| 160 |
'slideshow', |
| 161 |
true |
| 162 |
), |
| 163 |
); |
| 164 |
} |
| 165 |
|
| 166 |
public function general_glass_effect_bg( &$fields ) |
| 167 |
{ |
| 168 |
$fields[] = array( |
| 169 |
'title' => __( 'Glass Effect', 'adminify' ), |
| 170 |
'type' => 'notice', |
| 171 |
'style' => 'warning', |
| 172 |
'content' => Utils::adminify_upgrade_pro(), |
| 173 |
); |
| 174 |
} |
| 175 |
|
| 176 |
public function general_video_bg( &$fields ) |
| 177 |
{ |
| 178 |
$fields[] = array( |
| 179 |
'title' => '', |
| 180 |
'type' => 'notice', |
| 181 |
'style' => 'warning', |
| 182 |
'content' => Utils::adminify_upgrade_pro(), |
| 183 |
'dependency' => array( |
| 184 |
'admin_general_bg', |
| 185 |
'==', |
| 186 |
'video', |
| 187 |
true |
| 188 |
), |
| 189 |
); |
| 190 |
} |
| 191 |
|
| 192 |
public function general_fields( &$fields ) |
| 193 |
{ |
| 194 |
$fields[] = array( |
| 195 |
'type' => 'subheading', |
| 196 |
'content' => __( 'Body Background', 'adminify' ), |
| 197 |
); |
| 198 |
$fields[] = array( |
| 199 |
'id' => 'admin_general_bg', |
| 200 |
'type' => 'button_set', |
| 201 |
'title' => 'Background Type', |
| 202 |
'options' => array( |
| 203 |
'color' => 'Color', |
| 204 |
'gradient' => 'Gradient', |
| 205 |
'image' => 'Image', |
| 206 |
'slideshow' => 'Slideshow', |
| 207 |
'video' => 'Video', |
| 208 |
), |
| 209 |
'default' => 'color', |
| 210 |
); |
| 211 |
$fields[] = array( |
| 212 |
'id' => 'admin_general_bg_color', |
| 213 |
'type' => 'color', |
| 214 |
'title' => 'Background Color', |
| 215 |
'default' => '', |
| 216 |
'dependency' => array( |
| 217 |
'admin_general_bg', |
| 218 |
'==', |
| 219 |
'color', |
| 220 |
true |
| 221 |
), |
| 222 |
); |
| 223 |
} |
| 224 |
|
| 225 |
public function general_customization( &$fields ) |
| 226 |
{ |
| 227 |
$fields[] = array( |
| 228 |
'type' => 'subheading', |
| 229 |
'content' => __( 'General Customization', 'adminify' ), |
| 230 |
); |
| 231 |
$fields[] = array( |
| 232 |
'id' => 'admin_general_button_color', |
| 233 |
'type' => 'color_group', |
| 234 |
'title' => __( 'Button', 'adminify' ), |
| 235 |
'subtitle' => __( 'Change Admin Button Colors', 'adminify' ), |
| 236 |
'options' => array( |
| 237 |
'primary_color' => __( 'Primary Color', 'adminify' ), |
| 238 |
'secondary_color' => __( 'Secondary Color', 'adminify' ), |
| 239 |
), |
| 240 |
'default' => $this->get_default_field( 'admin_general_button_color' ), |
| 241 |
); |
| 242 |
$fields[] = array( |
| 243 |
'id' => 'admin_danger_button_color', |
| 244 |
'type' => 'color_group', |
| 245 |
'title' => __( 'Danger Button', 'adminify' ), |
| 246 |
'subtitle' => __( 'Change Admin Delete Button Colors', 'adminify' ), |
| 247 |
'options' => array( |
| 248 |
'primary_color' => __( 'Primary Color', 'adminify' ), |
| 249 |
'secondary_color' => __( 'Secondary Color', 'adminify' ), |
| 250 |
), |
| 251 |
'default' => $this->get_default_field( 'admin_danger_button_color' ), |
| 252 |
); |
| 253 |
} |
| 254 |
|
| 255 |
public function general_settings() |
| 256 |
{ |
| 257 |
if ( !class_exists( 'ADMINIFY' ) ) { |
| 258 |
return; |
| 259 |
} |
| 260 |
$fields = []; |
| 261 |
$this->general_template_preset_google_fonts( $fields ); |
| 262 |
$this->general_fields( $fields ); |
| 263 |
$this->general_gradient_bg( $fields ); |
| 264 |
$this->general_image_bg( $fields ); |
| 265 |
$this->general_slideshow_bg( $fields ); |
| 266 |
$this->general_video_bg( $fields ); |
| 267 |
// self::general_glass_effect_bg($fields); |
| 268 |
$this->general_customization( $fields ); |
| 269 |
\ADMINIFY::createSection( $this->prefix, array( |
| 270 |
'title' => __( 'Customize', 'adminify' ), |
| 271 |
'icon' => 'fas fa-fill-drip', |
| 272 |
'fields' => $fields, |
| 273 |
) ); |
| 274 |
} |
| 275 |
|
| 276 |
} |