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