PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 1.0.4
Adminify – White Label, Admin Menu Editor, Login Customizer v1.0.4
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 1.0.4, at Inc/admin/Options/General_Layout_Mode.php

224 lines 7.5 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', WP_ADMINIFY_TD ),
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', WP_ADMINIFY_TD ),
69 'options' => array(
70 'light' => __( 'Light Mode', WP_ADMINIFY_TD ),
71 'dark' => __( 'Dark Mode', WP_ADMINIFY_TD ),
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', WP_ADMINIFY_TD ),
79 'options' => array(
80 'image_logo' => __( 'Image', WP_ADMINIFY_TD ),
81 'text_logo' => __( 'Text', WP_ADMINIFY_TD ),
82 ),
83 'default' => $this->get_default_field( 'admin_bar_logo_type' ),
84 );
85 $fields[] = array(
86 'id' => 'admin_bar_light_mode',
87 'type' => 'fieldset',
88 'fields' => array( array(
89 'id' => 'admin_bar_light_logo_text',
90 'type' => 'text',
91 'title' => __( 'Logo Text', WP_ADMINIFY_TD ),
92 'dependency' => array(
93 'admin_bar_logo_type',
94 '==',
95 'text_logo',
96 'true'
97 ),
98 'default' => $this->get_default_field( 'admin_bar_light_mode' )['admin_bar_light_logo_text'],
99 ), array(
100 'id' => 'admin_bar_light_logo',
101 'type' => 'media',
102 'title' => __( 'Light Logo', WP_ADMINIFY_TD ),
103 'library' => 'image',
104 'preview_size' => 'thumbnail',
105 'button_title' => __( 'Add Light Logo', WP_ADMINIFY_TD ),
106 'remove_title' => __( 'Remove Light Logo', WP_ADMINIFY_TD ),
107 'default' => $this->get_default_field( 'admin_bar_light_mode' )['admin_bar_light_logo'],
108 'dependency' => array(
109 'admin_bar_logo_type',
110 '==',
111 'image_logo',
112 'true'
113 ),
114 ), array(
115 'id' => 'light_logo_size',
116 'type' => 'dimensions',
117 'title' => __( 'Logo Size', WP_ADMINIFY_TD ),
118 'default' => $this->get_default_field( 'admin_bar_light_mode' )['light_logo_size'],
119 'dependency' => array(
120 'admin_bar_logo_type',
121 '==',
122 'image_logo',
123 'true'
124 ),
125 ) ),
126 'dependency' => array(
127 'admin_bar_mode',
128 '==',
129 'light',
130 'true'
131 ),
132 );
133 $fields[] = array(
134 'id' => 'admin_bar_dark_mode',
135 'type' => 'fieldset',
136 'fields' => array( array(
137 'id' => 'admin_bar_dark_logo_text',
138 'type' => 'text',
139 'title' => __( 'Logo Text', WP_ADMINIFY_TD ),
140 'default' => $this->get_default_field( 'admin_bar_dark_mode' )['admin_bar_dark_logo_text'],
141 'dependency' => array(
142 'admin_bar_logo_type',
143 '==',
144 'text_logo',
145 'true'
146 ),
147 ), array(
148 'id' => 'admin_bar_dark_logo',
149 'type' => 'media',
150 'title' => __( 'Dark Logo', WP_ADMINIFY_TD ),
151 'library' => 'image',
152 'preview_size' => 'thumbnail',
153 'button_title' => __( 'Add Dark Logo', WP_ADMINIFY_TD ),
154 'remove_title' => __( 'Remove Dark Logo', WP_ADMINIFY_TD ),
155 'default' => $this->get_default_field( 'admin_bar_dark_mode' )['admin_bar_dark_logo'],
156 'dependency' => array(
157 'admin_bar_logo_type',
158 '==',
159 'image_logo',
160 'true'
161 ),
162 ), array(
163 'id' => 'dark_logo_size',
164 'type' => 'dimensions',
165 'title' => __( 'Logo Size', WP_ADMINIFY_TD ),
166 'default' => $this->get_default_field( 'admin_bar_dark_mode' )['dark_logo_size'],
167 'dependency' => array(
168 'admin_bar_logo_type',
169 '==',
170 'image_logo',
171 'true'
172 ),
173 ) ),
174 'dependency' => array(
175 'admin_bar_mode',
176 '==',
177 'dark',
178 'true'
179 ),
180 );
181 }
182
183 public function schedule_dark_mode_fields( &$fields )
184 {
185 $fields[] = array(
186 'type' => 'subheading',
187 'content' => __( 'Schedule Dark Mode', WP_ADMINIFY_TD ),
188 'dependency' => array(
189 'admin_bar_mode',
190 '==',
191 'dark',
192 'true'
193 ),
194 );
195 $fields[] = array(
196 'type' => 'notice',
197 'title' => __( 'Enable Schedule Dark Mode', WP_ADMINIFY_TD ),
198 'style' => 'warning',
199 'content' => Utils::adminify_upgrade_pro(),
200 'dependency' => array( array(
201 'admin_bar_mode',
202 '==',
203 'dark',
204 'true'
205 ) ),
206 );
207 }
208
209 public function general_layout_mode_settings()
210 {
211 if ( !class_exists( 'ADMINIFY' ) ) {
212 return;
213 }
214 $fields = [];
215 $this->layout_mode_setting_fields( $fields );
216 $this->schedule_dark_mode_fields( $fields );
217 \ADMINIFY::createSection( $this->prefix, array(
218 'title' => __( 'Dark/Light Mode', WP_ADMINIFY_TD ),
219 'icon' => 'fas fa-adjust',
220 'fields' => $fields,
221 ) );
222 }
223
224 }