PluginProbe
Borderless – Addons and Templates for Elementor / 1.1.1
Borderless – Addons and Templates for Elementor v1.1.1
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.1, at dashboard.php

282 lines 10.6 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', 99 );
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
73 public function init_settings() {
74
75 register_setting(
76 'settings_group',
77 'borderless'
78 );
79
80 add_settings_section(
81 'borderless_section',
82 '',
83 false,
84 'borderless'
85 );
86
87 add_settings_field(
88 'primary_color',
89 __( 'Primary Color', 'borderless' ),
90 array( $this, 'render_primary_color_field' ),
91 'borderless',
92 'borderless_section'
93 );
94 add_settings_field(
95 'secondary_color',
96 __( 'Secondary Color', 'borderless' ),
97 array( $this, 'render_secondary_color_field' ),
98 'borderless',
99 'borderless_section'
100 );
101 add_settings_field(
102 'text_color',
103 __( 'Text Color', 'borderless' ),
104 array( $this, 'render_text_color_field' ),
105 'borderless',
106 'borderless_section'
107 );
108 add_settings_field(
109 'accent_color',
110 __( 'Accent Color', 'borderless' ),
111 array( $this, 'render_accent_color_field' ),
112 'borderless',
113 'borderless_section'
114 );
115 add_settings_field(
116 'elementor',
117 __( 'Elementor', 'borderless' ),
118 array( $this, 'render_elementor_field' ),
119 'borderless',
120 'borderless_section'
121 );
122 add_settings_field(
123 'related_posts',
124 __( 'Related Posts', 'borderless' ),
125 array( $this, 'render_related_posts_field' ),
126 'borderless',
127 'borderless_section'
128 );
129
130 }
131
132 public function page_layout() {
133
134 // Check required user capability
135 if ( !current_user_can( 'manage_options' ) ) {
136 wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'borderless' ) );
137 }
138
139 $current_user = wp_get_current_user();
140 $time = date('H');
141 $timezone = date('e');
142 $hi = __('Good Evening ', 'borderless');
143 //$selling = $rsaf->get_addition('selling');
144 if($time < '12'){
145 $hi = __('Good Morning ', 'borderless');
146 }elseif($time >= '12' && $time < '17'){
147 $hi = __('Good Afternoon ', 'borderless');
148 }
149
150 // Admin Page Layout
151
152 ?><div class="wrap borderless-page-welcome about-wrap">
153
154 <!-- WELCOME TO BORDERLESS -->
155 <div class="borderless-dashboard-header">
156 <h1 class="borderless-dashboard-title"><?php echo $hi; echo $current_user->display_name; echo '!'; ?></h1>
157 <h2 class="borderless-dashboard-subtitle"><?php _e('You are running Borderless ', 'borderless'); echo BORDERLESS__VERSION; ?></h2>
158 <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>
159 </div>
160 <div class="wp-badge borderless-page-logo">
161 <?php echo sprintf( __( 'Version %s', 'borderless' ), BORDERLESS__VERSION ) ?>
162 </div>
163 <p class="borderless-page-actions">
164 <a href="https://twitter.com/share" class="twitter-share-button"
165 data-via="visualmodo"
166 data-text="Take full control over your WordPress site with Borderless"
167 data-url="https://visualmodo.com" data-size="large">Tweet</a>
168 <script>! function ( d, s, id ) {
169 var js, fjs = d.getElementsByTagName( s )[ 0 ], p = /^http:/.test( d.location ) ? 'http' : 'https';
170 if ( ! d.getElementById( id ) ) {
171 js = d.createElement( s );
172 js.id = id;
173 js.src = p + '://platform.twitter.com/widgets.js';
174 fjs.parentNode.insertBefore( js, fjs );
175 }
176 }( document, 'script', 'twitter-wjs' );</script>
177 </p>
178
179 <?php
180 echo '<div class="borderless-dashboard-settings">' . "\n";
181 echo '<h3>Settings</h3>' . "\n";
182 echo ' <form action="options.php" method="post">' . "\n";
183
184 settings_fields( 'settings_group' );
185 do_settings_sections( 'borderless' );
186 submit_button();
187
188 echo '</form>' . "\n";
189 echo '</div>' . "\n";
190 echo '</div>' . "\n";
191
192 ?></div><?php
193
194 }
195
196 function render_primary_color_field() {
197
198 // Retrieve data from the database.
199 $options = get_option( 'borderless' );
200
201 // Set default value.
202 $value = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc';
203
204 // Field output.
205 echo '<input type="color" name="borderless[primary_color]" class="regular-text primary_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
206 echo '<span class="description">' . __( 'Pick a primary color for the elements.', 'borderless' ) . '</span>';
207
208 }
209
210 function render_secondary_color_field() {
211
212 // Retrieve data from the database.
213 $options = get_option( 'borderless' );
214
215 // Set default value.
216 $value = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc';
217
218 // Field output.
219 echo '<input type="color" name="borderless[secondary_color]" class="regular-text secondary_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
220 echo '<span class="description">' . __( 'Pick a secondary color for the elements.', 'borderless' ) . '</span>';
221
222 }
223
224 function render_text_color_field() {
225
226 // Retrieve data from the database.
227 $options = get_option( 'borderless' );
228
229 // Set default value.
230 $value = isset( $options['text_color'] ) ? $options['text_color'] : '';
231
232 // Field output.
233 echo '<input type="color" name="borderless[text_color]" class="regular-text text_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
234 echo '<span class="description">' . __( 'Pick a text color for the elements.', 'borderless' ) . '</span>';
235
236 }
237
238 function render_accent_color_field() {
239
240 // Retrieve data from the database.
241 $options = get_option( 'borderless' );
242
243 // Set default value.
244 $value = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc';
245
246 // Field output.
247 echo '<input type="color" name="borderless[accent_color]" class="regular-text accent_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
248 echo '<span class="description">' . __( 'Pick a accent color for the elements.', 'borderless' ) . '</span>';
249
250 }
251
252 function render_elementor_field() {
253
254 // Retrieve data from the database.
255 $options = get_option( 'borderless' );
256
257 // Set default value.
258 $value = isset( $options['elementor'] ) ? $options['elementor'] : true;
259
260 // Field output.
261 echo '<input type="checkbox" name="borderless[elementor]" class="switch elementor_field" value="checked" ' . checked( $value, 'checked', false ) . '> ' . __( '', 'borderless' );
262 echo '<span class="description">' . __( 'Elementor Website Builder', 'borderless' ) . '</span>';
263
264 }
265
266 function render_related_posts_field() {
267
268 // Retrieve data from the database.
269 $options = get_option( 'borderless' );
270
271 // Set default value.
272 $value = isset( $options['related_posts'] ) ? $options['related_posts'] : '';
273
274 // Field output.
275 echo '<input type="checkbox" name="borderless[related_posts]" class="switch related_posts_field" value="checked" ' . checked( $value, 'checked', false ) . '> ' . __( '', 'borderless' );
276 echo '<span class="description">' . __( 'Related Posts', 'borderless' ) . '</span>';
277
278 }
279
280 }
281
282 new BorderlessDashboard;