PluginProbe
Borderless – Addons and Templates for Elementor / 1.1.2
Borderless – Addons and Templates for Elementor v1.1.2
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 All 78 releases
borderless / dashboard.php

dashboard.php in Borderless – Addons and Templates for Elementor 1.1.2, at dashboard.php

298 lines 11.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // don't load directly
4 defined( 'ABSPATH' ) || exit;
5
6
7 /*-----------------------------------------------------------------------------------*/
8 /* *. Borderless Dashboard
9 /*-----------------------------------------------------------------------------------*/
10
11 class BorderlessDashboard {
12
13 public function __construct() {
14
15 add_action( 'admin_menu', array( $this, 'add_admin_menu' ) );
16 add_action( 'admin_init', array( $this, 'init_settings' ) );
17
18 }
19
20 public function add_admin_menu() {
21
22 add_menu_page(
23 esc_html__( 'Borderless', 'borderless' ),
24 esc_html__( 'Borderless', 'borderless' ),
25 'manage_options',
26 'borderless.php',
27 array( $this, 'page_layout' ),
28 plugin_dir_url(__FILE__) . "/assets/img/borderless.svg",
29 2
30 );
31
32 add_submenu_page(
33 'borderless.php', // parent slug
34 esc_html__( 'Settings', 'borderless' ), // page title
35 esc_html__( 'Settings', 'borderless' ), // menu title
36 'manage_options', // capability
37 'borderless.php', // slug
38 );
39
40 add_action('admin_enqueue_scripts', 'borderless_dashboard_style');
41
42 function borderless_dashboard_style($hook)
43 {
44
45 $current_screen = get_current_screen();
46
47 if ( strpos($current_screen->base, 'toplevel_page_borderless') === false) {
48 return;
49 } else {
50
51 wp_enqueue_style('borderless_backend_style', plugins_url('assets/styles/dashboard.min.css', __FILE__) );
52 }
53 }
54
55 add_action( 'admin_menu', 'borderless_icon_fonts_submenu', 50 );
56
57 if ( ! function_exists( 'borderless_icon_fonts_submenu' ) ) {
58 function borderless_icon_fonts_submenu() {
59 $icon_manager_page = add_submenu_page(
60 'borderless.php',
61 esc_html__( "Icon Fonts", "borderless" ),
62 esc_html__( "Icon Fonts", "borderless" ),
63 'manage_options',
64 'borderless-fonts',
65 'borderless_custom_icons_menu'
66 );
67 $Borderless_IF = new Borderless_IF;
68 add_action('admin_print_styles-' . $icon_manager_page, array( $Borderless_IF, 'admin_scripts' ) );
69 }
70 }
71
72 add_submenu_page(
73 'borderless.php',
74 esc_html__( 'System Info', 'borderless' ),
75 esc_html__( 'System Info', 'borderless' ),
76 'manage_options',
77 'borderless-system-info',
78 'borderless_system_info',
79 99
80 );
81
82 }
83
84 public function init_settings() {
85
86 register_setting(
87 'settings_group',
88 'borderless'
89 );
90
91 add_settings_section(
92 'borderless_section',
93 '',
94 false,
95 'borderless'
96 );
97
98 add_settings_field(
99 'primary_color',
100 __( 'Primary Color', 'borderless' ),
101 array( $this, 'render_primary_color_field' ),
102 'borderless',
103 'borderless_section'
104 );
105 add_settings_field(
106 'secondary_color',
107 __( 'Secondary Color', 'borderless' ),
108 array( $this, 'render_secondary_color_field' ),
109 'borderless',
110 'borderless_section'
111 );
112 add_settings_field(
113 'text_color',
114 __( 'Text Color', 'borderless' ),
115 array( $this, 'render_text_color_field' ),
116 'borderless',
117 'borderless_section'
118 );
119 add_settings_field(
120 'accent_color',
121 __( 'Accent Color', 'borderless' ),
122 array( $this, 'render_accent_color_field' ),
123 'borderless',
124 'borderless_section'
125 );
126 add_settings_field(
127 'elementor',
128 __( 'Elementor', 'borderless' ),
129 array( $this, 'render_elementor_field' ),
130 'borderless',
131 'borderless_section'
132 );
133 add_settings_field(
134 'related_posts',
135 __( 'Related Posts', 'borderless' ),
136 array( $this, 'render_related_posts_field' ),
137 'borderless',
138 'borderless_section'
139 );
140
141 }
142
143 public function page_layout() {
144
145 // Check required user capability
146 if ( !current_user_can( 'manage_options' ) ) {
147 wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'borderless' ) );
148 }
149
150 $current_user = wp_get_current_user();
151 $time = date('H');
152 $timezone = date('e');
153 $hi = __('Good Evening, ', 'borderless');
154 $avatar = wp_get_current_user();
155 if($time < '12'){
156 $hi = __('Good Morning, ', 'borderless');
157 }elseif($time >= '12' && $time < '17'){
158 $hi = __('Good Afternoon, ', 'borderless');
159 }
160
161 // Admin Page Layout
162
163 ?><div class="wrap borderless-page-welcome about-wrap">
164
165 <!-- Welcome to Borderless -->
166 <div class="borderless-dashboard-header">
167 <div class="borderless-dashboard-howdy">
168 <div class="borderless-dashboard-avatar"><?php echo get_avatar( $current_user->ID, 64 ); ?></div>
169 <div class="borderless-dashboard-title-subtitle">
170 <h1 class="borderless-dashboard-title"><?php echo $hi .'<strong>'.$current_user->display_name.'</strong>'; ?></h1>
171 <h2 class="borderless-dashboard-subtitle"><?php _e('You are running Borderless ', 'borderless'); echo BORDERLESS__VERSION; ?></h2>
172 </div>
173 </div>
174 <p class="about-text"><?php _e('Within minutes you can build complex layouts on the basis of our content elements and without touching a single line of code.', 'borderless') ?></p>
175 </div>
176 <div class="wp-badge borderless-page-logo">
177 <?php echo sprintf( __( 'Version %s', 'borderless' ), BORDERLESS__VERSION ) ?>
178 </div>
179 <p class="borderless-page-actions">
180 <a href="https://twitter.com/share" class="twitter-share-button"
181 data-via="visualmodo"
182 data-text="Take full control over your WordPress site with Borderless"
183 data-url="https://visualmodo.com" data-size="large">Tweet</a>
184 <script>! function ( d, s, id ) {
185 var js, fjs = d.getElementsByTagName( s )[ 0 ], p = /^http:/.test( d.location ) ? 'http' : 'https';
186 if ( ! d.getElementById( id ) ) {
187 js = d.createElement( s );
188 js.id = id;
189 js.src = p + '://platform.twitter.com/widgets.js';
190 fjs.parentNode.insertBefore( js, fjs );
191 }
192 }( document, 'script', 'twitter-wjs' );</script>
193 </p>
194
195 <?php
196 echo '<div class="borderless-dashboard-settings">' . "\n";
197 echo '<h3>Settings</h3>' . "\n";
198 echo ' <form action="options.php" method="post">' . "\n";
199
200 settings_fields( 'settings_group' );
201 do_settings_sections( 'borderless' );
202 submit_button();
203
204 echo '</form>' . "\n";
205 echo '</div>' . "\n";
206 echo '</div>' . "\n";
207
208 ?></div><?php
209
210 }
211
212 function render_primary_color_field() {
213
214 // Retrieve data from the database.
215 $options = get_option( 'borderless' );
216
217 // Set default value.
218 $value = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc';
219
220 // Field output.
221 echo '<input type="color" name="borderless[primary_color]" class="regular-text primary_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
222 echo '<span class="description">' . __( 'Pick a primary color for the elements.', 'borderless' ) . '</span>';
223
224 }
225
226 function render_secondary_color_field() {
227
228 // Retrieve data from the database.
229 $options = get_option( 'borderless' );
230
231 // Set default value.
232 $value = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc';
233
234 // Field output.
235 echo '<input type="color" name="borderless[secondary_color]" class="regular-text secondary_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
236 echo '<span class="description">' . __( 'Pick a secondary color for the elements.', 'borderless' ) . '</span>';
237
238 }
239
240 function render_text_color_field() {
241
242 // Retrieve data from the database.
243 $options = get_option( 'borderless' );
244
245 // Set default value.
246 $value = isset( $options['text_color'] ) ? $options['text_color'] : '';
247
248 // Field output.
249 echo '<input type="color" name="borderless[text_color]" class="regular-text text_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
250 echo '<span class="description">' . __( 'Pick a text color for the elements.', 'borderless' ) . '</span>';
251
252 }
253
254 function render_accent_color_field() {
255
256 // Retrieve data from the database.
257 $options = get_option( 'borderless' );
258
259 // Set default value.
260 $value = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc';
261
262 // Field output.
263 echo '<input type="color" name="borderless[accent_color]" class="regular-text accent_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
264 echo '<span class="description">' . __( 'Pick a accent color for the elements.', 'borderless' ) . '</span>';
265
266 }
267
268 function render_elementor_field() {
269
270 // Retrieve data from the database.
271 $options = get_option( 'borderless' );
272
273 // Set default value.
274 $value = isset( $options['elementor'] ) ? $options['elementor'] : true;
275
276 // Field output.
277 echo '<input type="checkbox" name="borderless[elementor]" class="switch elementor_field" value="checked" ' . checked( $value, 'checked', false ) . '> ' . __( '', 'borderless' );
278 echo '<span class="description">' . __( 'Elementor Website Builder', 'borderless' ) . '</span>';
279
280 }
281
282 function render_related_posts_field() {
283
284 // Retrieve data from the database.
285 $options = get_option( 'borderless' );
286
287 // Set default value.
288 $value = isset( $options['related_posts'] ) ? $options['related_posts'] : '';
289
290 // Field output.
291 echo '<input type="checkbox" name="borderless[related_posts]" class="switch related_posts_field" value="checked" ' . checked( $value, 'checked', false ) . '> ' . __( '', 'borderless' );
292 echo '<span class="description">' . __( 'Related Posts', 'borderless' ) . '</span>';
293
294 }
295
296 }
297
298 new BorderlessDashboard;