PluginProbe
Borderless – Addons and Templates for Elementor / 1.2.5
Borderless – Addons and Templates for Elementor v1.2.5
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 / includes / templates / dashboard.php

dashboard.php in Borderless – Addons and Templates for Elementor 1.2.5, at includes/templates/dashboard.php

306 lines 11.5 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 Borderless_Dashboard {
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 BORDERLESS__URL . '/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_submenu_page(
41 'borderless.php',
42 esc_html__( 'Post Types', 'borderless' ),
43 esc_html__( 'Post Types', 'borderless' ),
44 'manage_options',
45 'edit.php?post_type=borderless_cpt'
46 );
47
48 add_action('admin_enqueue_scripts', 'borderless_dashboard_style');
49
50 function borderless_dashboard_style($hook)
51 {
52
53 $current_screen = get_current_screen();
54
55 if ( strpos($current_screen->base, 'toplevel_page_borderless') === false) {
56 return;
57 } else {
58
59 wp_enqueue_style('borderless_backend_style', BORDERLESS__URL . '/assets/styles/dashboard.min.css', array(), BORDERLESS__VERSION );
60 }
61 }
62
63 add_action( 'admin_menu', 'borderless_icon_fonts_submenu', 50 );
64
65 if ( ! function_exists( 'borderless_icon_fonts_submenu' ) ) {
66 function borderless_icon_fonts_submenu() {
67 $icon_manager_page = add_submenu_page(
68 'borderless.php',
69 esc_html__( "Icon Fonts", "borderless" ),
70 esc_html__( "Icon Fonts", "borderless" ),
71 'manage_options',
72 'borderless-fonts',
73 'borderless_custom_icons_menu'
74 );
75 $Borderless_IF = new Borderless_IF;
76 add_action('admin_print_styles-' . $icon_manager_page, array( $Borderless_IF, 'admin_scripts' ) );
77 }
78 }
79
80 add_submenu_page(
81 'borderless.php',
82 esc_html__( 'System Info', 'borderless' ),
83 esc_html__( 'System Info', 'borderless' ),
84 'manage_options',
85 'borderless-system-info',
86 'Borderless_System_Info',
87 99
88 );
89
90 }
91
92 public function init_settings() {
93
94 register_setting(
95 'settings_group',
96 'borderless'
97 );
98
99 add_settings_section(
100 'borderless_section',
101 '',
102 false,
103 'borderless'
104 );
105
106 add_settings_field(
107 'primary_color',
108 __( 'Primary Color', 'borderless' ),
109 array( $this, 'render_primary_color_field' ),
110 'borderless',
111 'borderless_section'
112 );
113 add_settings_field(
114 'secondary_color',
115 __( 'Secondary Color', 'borderless' ),
116 array( $this, 'render_secondary_color_field' ),
117 'borderless',
118 'borderless_section'
119 );
120 add_settings_field(
121 'tertiary_color',
122 __( 'Tertiary Color', 'borderless' ),
123 array( $this, 'render_tertiary_color_field' ),
124 'borderless',
125 'borderless_section'
126 );
127 add_settings_field(
128 'text_color',
129 __( 'Text Color', 'borderless' ),
130 array( $this, 'render_text_color_field' ),
131 'borderless',
132 'borderless_section'
133 );
134 add_settings_field(
135 'elementor',
136 __( 'Elementor', 'borderless' ),
137 array( $this, 'render_elementor_field' ),
138 'borderless',
139 'borderless_section'
140 );
141 add_settings_field(
142 'related_posts',
143 __( 'Related Posts', 'borderless' ),
144 array( $this, 'render_related_posts_field' ),
145 'borderless',
146 'borderless_section'
147 );
148
149 }
150
151 public function page_layout() {
152
153 // Check required user capability
154 if ( !current_user_can( 'manage_options' ) ) {
155 wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'borderless' ) );
156 }
157
158 $current_user = wp_get_current_user();
159 $time = date('H');
160 $timezone = date('e');
161 $hi = __('Good Evening, ', 'borderless');
162 $avatar = wp_get_current_user();
163 if($time < '12'){
164 $hi = __('Good Morning, ', 'borderless');
165 }elseif($time >= '12' && $time < '17'){
166 $hi = __('Good Afternoon, ', 'borderless');
167 }
168
169 // Admin Page Layout
170
171 ?><div class="wrap borderless-page-welcome about-wrap">
172
173 <!-- Welcome to Borderless -->
174 <div class="borderless-dashboard-header">
175 <div class="borderless-dashboard-howdy">
176 <div class="borderless-dashboard-avatar"><?php echo get_avatar( $current_user->ID, 64 ); ?></div>
177 <div class="borderless-dashboard-title-subtitle">
178 <h1 class="borderless-dashboard-title"><?php echo $hi .'<strong>'.$current_user->display_name.'</strong>'; ?></h1>
179 <h2 class="borderless-dashboard-subtitle"><?php _e('You are running Borderless ', 'borderless'); echo BORDERLESS__VERSION; ?></h2>
180 </div>
181 </div>
182 <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>
183 </div>
184 <div class="wp-badge borderless-page-logo">
185 <?php echo sprintf( __( 'Version %s', 'borderless' ), BORDERLESS__VERSION ) ?>
186 </div>
187 <p class="borderless-page-actions">
188 <a href="https://twitter.com/share" class="twitter-share-button"
189 data-via="visualmodo"
190 data-text="Take full control over your WordPress site with Borderless"
191 data-url="https://visualmodo.com" data-size="large">Tweet</a>
192 <script>! function ( d, s, id ) {
193 var js, fjs = d.getElementsByTagName( s )[ 0 ], p = /^http:/.test( d.location ) ? 'http' : 'https';
194 if ( ! d.getElementById( id ) ) {
195 js = d.createElement( s );
196 js.id = id;
197 js.src = p + '://platform.twitter.com/widgets.js';
198 fjs.parentNode.insertBefore( js, fjs );
199 }
200 }( document, 'script', 'twitter-wjs' );</script>
201 </p>
202
203 <?php
204 echo '<div class="borderless-dashboard-settings">' . "\n";
205 echo '<h3>Settings</h3>' . "\n";
206 echo ' <form action="options.php" method="post">' . "\n";
207
208 settings_fields( 'settings_group' );
209 do_settings_sections( 'borderless' );
210 submit_button();
211
212 echo '</form>' . "\n";
213 echo '</div>' . "\n";
214 echo '</div>' . "\n";
215
216 ?></div><?php
217
218 }
219
220 function render_primary_color_field() {
221
222 // Retrieve data from the database.
223 $options = get_option( 'borderless' );
224
225 // Set default value.
226 $value = isset( $options['primary_color'] ) ? $options['primary_color'] : '#0000FF';
227
228 // Field output.
229 echo '<input type="color" name="borderless[primary_color]" class="regular-text primary_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
230 echo '<span class="description">' . __( 'Pick a primary color for the elements.', 'borderless' ) . '</span>';
231
232 }
233
234 function render_secondary_color_field() {
235
236 // Retrieve data from the database.
237 $options = get_option( 'borderless' );
238
239 // Set default value.
240 $value = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#FF6819';
241
242 // Field output.
243 echo '<input type="color" name="borderless[secondary_color]" class="regular-text secondary_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
244 echo '<span class="description">' . __( 'Pick a secondary color for the elements.', 'borderless' ) . '</span>';
245
246 }
247
248 function render_tertiary_color_field() {
249
250 // Retrieve data from the database.
251 $options = get_option( 'borderless' );
252
253 // Set default value.
254 $value = isset( $options['tertiary_color'] ) ? $options['tertiary_color'] : '#3FCC14';
255
256 // Field output.
257 echo '<input type="color" name="borderless[tertiary_color]" class="regular-text tertiary_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
258 echo '<span class="description">' . __( 'Pick a tertiary color for the elements.', 'borderless' ) . '</span>';
259
260 }
261
262 function render_text_color_field() {
263
264 // Retrieve data from the database.
265 $options = get_option( 'borderless' );
266
267 // Set default value.
268 $value = isset( $options['text_color'] ) ? $options['text_color'] : '';
269
270 // Field output.
271 echo '<input type="color" name="borderless[text_color]" class="regular-text text_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
272 echo '<span class="description">' . __( 'Pick a text color for the elements.', 'borderless' ) . '</span>';
273
274 }
275
276 function render_elementor_field() {
277
278 // Retrieve data from the database.
279 $options = get_option( 'borderless' );
280
281 // Set default value.
282 $value = isset( $options['elementor'] ) ? $options['elementor'] : '';
283
284 // Field output.
285 echo '<input type="checkbox" name="borderless[elementor]" class="switch elementor_field" value="checked" ' . checked( $value, 'checked', false ) . '> ' . __( '', 'borderless' );
286 echo '<span class="description">' . __( 'Elementor Website Builder', 'borderless' ) . '</span>';
287
288 }
289
290 function render_related_posts_field() {
291
292 // Retrieve data from the database.
293 $options = get_option( 'borderless' );
294
295 // Set default value.
296 $value = isset( $options['related_posts'] ) ? $options['related_posts'] : '';
297
298 // Field output.
299 echo '<input type="checkbox" name="borderless[related_posts]" class="switch related_posts_field" value="checked" ' . checked( $value, 'checked', false ) . '> ' . __( '', 'borderless' );
300 echo '<span class="description">' . __( 'Related Posts.', 'borderless' ) . '</span>';
301
302 }
303
304 }
305
306 new Borderless_Dashboard;