PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 2.0.6
Adminify – White Label, Admin Menu Editor, Login Customizer v2.0.6
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
adminify / Inc / Admin / Options / General_Layout_Mode.php

General_Layout_Mode.php in Adminify – White Label, Admin Menu Editor, Login Customizer 2.0.6, at Inc/Admin/Options/General_Layout_Mode.php

218 lines 7.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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_Layout_Mode extends AdminSettingsModel
12 {
13 public function __construct()
14 {
15 $this->general_layout_mode_settings();
16 }
17
18 public function get_defaults()
19 {
20 return [
21 'admin_bar_mode' => 'light',
22 'admin_bar_logo_type' => 'image_logo',
23 'admin_bar_light_mode' => array(
24 'admin_bar_light_logo_text' => 'WP Adminify',
25 'admin_bar_light_logo' => '',
26 'light_logo_size' => array(
27 'width' => '150',
28 'height' => '45',
29 'unit' => 'px',
30 ),
31 ),
32 'admin_bar_dark_mode' => array(
33 'admin_bar_dark_logo_text' => 'WP Adminify',
34 'admin_bar_dark_logo' => '',
35 'dark_logo_size' => array(
36 'width' => '150',
37 'height' => '45',
38 'unit' => 'px',
39 ),
40 ),
41 'enable_schedule_dark_mode' => false,
42 'schedule_dark_mode_type' => 'system',
43 'schedule_dark_mode_start_time' => '',
44 'schedule_dark_mode_end_time' => '',
45 ];
46 }
47
48 /**
49 * Dark/Light Mode Settings
50 *
51 * @return void
52 */
53 public function layout_mode_setting_fields( &$fields )
54 {
55 $fields[] = array(
56 'type' => 'subheading',
57 'content' => Utils::adminfiy_help_urls(
58 __( 'Dark/Light Mode Settings', 'adminify' ),
59 'https://wpadminify.com/kb/configure-wordpress-dashboard-dark-mode/',
60 'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8',
61 'https://www.facebook.com/groups/jeweltheme',
62 'https://wpadminify.com/support/'
63 ),
64 );
65 $fields[] = array(
66 'id' => 'admin_bar_mode',
67 'type' => 'button_set',
68 'title' => __( 'Color Mode', 'adminify' ),
69 'options' => array(
70 'light' => __( 'Light Mode', 'adminify' ),
71 'dark' => __( 'Dark Mode', 'adminify' ),
72 ),
73 'default' => $this->get_default_field( 'admin_bar_mode' ),
74 );
75 $fields[] = array(
76 'id' => 'admin_bar_logo_type',
77 'type' => 'button_set',
78 'title' => __( 'Logo Type', 'adminify' ),
79 'options' => array(
80 'image_logo' => __( 'Image', 'adminify' ),
81 'text_logo' => __( 'Text', 'adminify' ),
82 ),
83 'default' => $this->get_default_field( 'admin_bar_logo_type' ),
84 'dependency' => array(
85 'admin_ui',
86 '==',
87 'true',
88 'true'
89 ),
90 );
91 $fields[] = array(
92 'id' => 'admin_bar_light_mode',
93 'type' => 'fieldset',
94 'fields' => array( array(
95 'id' => 'admin_bar_light_logo_text',
96 'type' => 'text',
97 'title' => __( 'Logo Text', 'adminify' ),
98 'dependency' => array(
99 'admin_bar_logo_type',
100 '==',
101 'text_logo',
102 'true'
103 ),
104 'default' => $this->get_default_field( 'admin_bar_light_mode' )['admin_bar_light_logo_text'],
105 ), array(
106 'id' => 'admin_bar_light_logo',
107 'type' => 'media',
108 'title' => __( 'Light Logo', 'adminify' ),
109 'library' => 'image',
110 'preview_size' => 'thumbnail',
111 'button_title' => __( 'Add Light Logo', 'adminify' ),
112 'remove_title' => __( 'Remove Light Logo', 'adminify' ),
113 'default' => $this->get_default_field( 'admin_bar_light_mode' )['admin_bar_light_logo'],
114 'dependency' => array(
115 'admin_bar_logo_type',
116 '==',
117 'image_logo',
118 'true'
119 ),
120 ), array(
121 'id' => 'light_logo_size',
122 'type' => 'dimensions',
123 'title' => __( 'Logo Size', 'adminify' ),
124 'default' => $this->get_default_field( 'admin_bar_light_mode' )['light_logo_size'],
125 'dependency' => array(
126 'admin_bar_logo_type',
127 '==',
128 'image_logo',
129 'true'
130 ),
131 ) ),
132 'dependency' => array(
133 'admin_ui|admin_bar_mode',
134 '==|==',
135 'true|light',
136 'true'
137 ),
138 );
139 $fields[] = array(
140 'id' => 'admin_bar_dark_mode',
141 'type' => 'fieldset',
142 'fields' => array( array(
143 'id' => 'admin_bar_dark_logo_text',
144 'type' => 'text',
145 'title' => __( 'Logo Text', 'adminify' ),
146 'default' => $this->get_default_field( 'admin_bar_dark_mode' )['admin_bar_dark_logo_text'],
147 'dependency' => array(
148 'admin_bar_logo_type',
149 '==',
150 'text_logo',
151 'true'
152 ),
153 ), array(
154 'id' => 'admin_bar_dark_logo',
155 'type' => 'media',
156 'title' => __( 'Dark Logo', 'adminify' ),
157 'library' => 'image',
158 'preview_size' => 'thumbnail',
159 'button_title' => __( 'Add Dark Logo', 'adminify' ),
160 'remove_title' => __( 'Remove Dark Logo', 'adminify' ),
161 'default' => $this->get_default_field( 'admin_bar_dark_mode' )['admin_bar_dark_logo'],
162 'dependency' => array(
163 'admin_bar_logo_type',
164 '==',
165 'image_logo',
166 'true'
167 ),
168 ), array(
169 'id' => 'dark_logo_size',
170 'type' => 'dimensions',
171 'title' => __( 'Logo Size', 'adminify' ),
172 'default' => $this->get_default_field( 'admin_bar_dark_mode' )['dark_logo_size'],
173 'dependency' => array(
174 'admin_bar_logo_type',
175 '==',
176 'image_logo',
177 'true'
178 ),
179 ) ),
180 'dependency' => array(
181 'admin_ui|admin_bar_mode',
182 '==|==',
183 'true|dark',
184 'true'
185 ),
186 );
187 }
188
189 public function schedule_dark_mode_fields( &$fields )
190 {
191 $fields[] = array(
192 'type' => 'subheading',
193 'content' => __( 'Schedule Dark Mode', 'adminify' ),
194 );
195 $fields[] = array(
196 'type' => 'notice',
197 'title' => __( 'Enable Schedule Dark Mode', 'adminify' ),
198 'style' => 'warning',
199 'content' => Utils::adminify_upgrade_pro(),
200 );
201 }
202
203 public function general_layout_mode_settings()
204 {
205 if ( !class_exists( 'ADMINIFY' ) ) {
206 return;
207 }
208 $fields = [];
209 $this->layout_mode_setting_fields( $fields );
210 $this->schedule_dark_mode_fields( $fields );
211 \ADMINIFY::createSection( $this->prefix, array(
212 'title' => __( 'Dark/Light Mode', 'adminify' ),
213 'icon' => 'fas fa-adjust',
214 'fields' => $fields,
215 ) );
216 }
217
218 }