PluginProbe
Borderless – Addons and Templates for Elementor / 1.4.9
Borderless – Addons and Templates for Elementor v1.4.9
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.4.9, at includes/templates/dashboard.php

285 lines 10.7 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 3
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 'related_posts',
136 __( 'Related Posts', 'borderless' ),
137 array( $this, 'render_related_posts_field' ),
138 'borderless',
139 'borderless_section'
140 );
141
142 }
143
144 public function page_layout() {
145
146 // Check required user capability
147 if ( !current_user_can( 'manage_options' ) ) {
148 wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'borderless' ) );
149 }
150
151 $current_user = wp_get_current_user();
152 $time = date('H');
153 $timezone = date('e');
154 $hi = __('Good Evening, ', 'borderless');
155 $avatar = wp_get_current_user();
156 if($time < '12'){
157 $hi = __('Good Morning, ', 'borderless');
158 }elseif($time >= '12' && $time < '17'){
159 $hi = __('Good Afternoon, ', 'borderless');
160 }
161
162 // Admin Page Layout
163
164 ?><div class="wrap borderless-page-welcome about-wrap">
165
166 <!-- Welcome to Borderless -->
167 <div class="borderless-dashboard-header">
168 <div class="borderless-dashboard-howdy">
169 <div class="borderless-dashboard-avatar"><?php echo get_avatar( $current_user->ID, 64 ); ?></div>
170 <div class="borderless-dashboard-title-subtitle">
171 <h1 class="borderless-dashboard-title"><?php echo $hi .'<strong>'.$current_user->display_name.'</strong>'; ?></h1>
172 <h2 class="borderless-dashboard-subtitle"><?php _e('You are running Borderless ', 'borderless'); echo BORDERLESS__VERSION; ?></h2>
173 </div>
174 </div>
175 <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>
176 </div>
177 <div class="wp-badge borderless-page-logo">
178 <?php echo sprintf( __( 'Version %s', 'borderless' ), BORDERLESS__VERSION ) ?>
179 </div>
180 <p class="borderless-page-actions">
181 <a href="https://twitter.com/share" class="twitter-share-button"
182 data-via="visualmodo"
183 data-text="Take full control over your WordPress site with Borderless"
184 data-url="https://visualmodo.com" data-size="large">Tweet</a>
185 <script>! function ( d, s, id ) {
186 var js, fjs = d.getElementsByTagName( s )[ 0 ], p = /^http:/.test( d.location ) ? 'http' : 'https';
187 if ( ! d.getElementById( id ) ) {
188 js = d.createElement( s );
189 js.id = id;
190 js.src = p + '://platform.twitter.com/widgets.js';
191 fjs.parentNode.insertBefore( js, fjs );
192 }
193 }( document, 'script', 'twitter-wjs' );</script>
194 </p>
195
196 <?php
197 echo '<div class="borderless-dashboard-settings">' . "\n";
198 echo '<h3>Settings</h3>' . "\n";
199 echo ' <form action="options.php" method="post">' . "\n";
200
201 settings_fields( 'settings_group' );
202 do_settings_sections( 'borderless' );
203 submit_button();
204
205 echo '</form>' . "\n";
206 echo '</div>' . "\n";
207 echo '</div>' . "\n";
208
209 ?></div><?php
210
211 }
212
213 function render_primary_color_field() {
214
215 // Retrieve data from the database.
216 $options = get_option( 'borderless' );
217
218 // Set default value.
219 $value = isset( $options['primary_color'] ) ? $options['primary_color'] : '#0000FF';
220
221 // Field output.
222 echo '<input type="color" name="borderless[primary_color]" class="regular-text primary_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
223 echo '<span class="description">' . __( 'Pick a primary color for the elements.', 'borderless' ) . '</span>';
224
225 }
226
227 function render_secondary_color_field() {
228
229 // Retrieve data from the database.
230 $options = get_option( 'borderless' );
231
232 // Set default value.
233 $value = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#FF6819';
234
235 // Field output.
236 echo '<input type="color" name="borderless[secondary_color]" class="regular-text secondary_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
237 echo '<span class="description">' . __( 'Pick a secondary color for the elements.', 'borderless' ) . '</span>';
238
239 }
240
241 function render_tertiary_color_field() {
242
243 // Retrieve data from the database.
244 $options = get_option( 'borderless' );
245
246 // Set default value.
247 $value = isset( $options['tertiary_color'] ) ? $options['tertiary_color'] : '#3FCC14';
248
249 // Field output.
250 echo '<input type="color" name="borderless[tertiary_color]" class="regular-text tertiary_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
251 echo '<span class="description">' . __( 'Pick a tertiary color for the elements.', 'borderless' ) . '</span>';
252
253 }
254
255 function render_text_color_field() {
256
257 // Retrieve data from the database.
258 $options = get_option( 'borderless' );
259
260 // Set default value.
261 $value = isset( $options['text_color'] ) ? $options['text_color'] : '';
262
263 // Field output.
264 echo '<input type="color" name="borderless[text_color]" class="regular-text text_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
265 echo '<span class="description">' . __( 'Pick a text color for the elements.', 'borderless' ) . '</span>';
266
267 }
268
269 function render_related_posts_field() {
270
271 // Retrieve data from the database.
272 $options = get_option( 'borderless' );
273
274 // Set default value.
275 $value = isset( $options['related_posts'] ) ? $options['related_posts'] : '';
276
277 // Field output.
278 echo '<input type="checkbox" name="borderless[related_posts]" class="switch related_posts_field" value="checked" ' . checked( $value, 'checked', false ) . '> ' . __( '', 'borderless' );
279 echo '<span class="description">' . __( 'Related Posts.', 'borderless' ) . '</span>';
280
281 }
282
283 }
284
285 new Borderless_Dashboard;