PluginProbe
Borderless – Addons and Templates for Elementor / 1.1.0
Borderless – Addons and Templates for Elementor v1.1.0
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.0, at dashboard.php

228 lines 8.0 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__( 'Settings', '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 }
33
34 public function init_settings() {
35
36 register_setting(
37 'settings_group',
38 'borderless'
39 );
40
41 add_settings_section(
42 'borderless_section',
43 '',
44 false,
45 'borderless'
46 );
47
48 add_settings_field(
49 'primary_color',
50 __( 'Primary Color', 'borderless' ),
51 array( $this, 'render_primary_color_field' ),
52 'borderless',
53 'borderless_section'
54 );
55 add_settings_field(
56 'secondary_color',
57 __( 'Secondary Color', 'borderless' ),
58 array( $this, 'render_secondary_color_field' ),
59 'borderless',
60 'borderless_section'
61 );
62 add_settings_field(
63 'text_color',
64 __( 'Text Color', 'borderless' ),
65 array( $this, 'render_text_color_field' ),
66 'borderless',
67 'borderless_section'
68 );
69 add_settings_field(
70 'accent_color',
71 __( 'Accent Color', 'borderless' ),
72 array( $this, 'render_accent_color_field' ),
73 'borderless',
74 'borderless_section'
75 );
76 add_settings_field(
77 'elementor',
78 __( 'Elementor', 'borderless' ),
79 array( $this, 'render_elementor_field' ),
80 'borderless',
81 'borderless_section'
82 );
83 add_settings_field(
84 'related_posts',
85 __( 'Related Posts', 'borderless' ),
86 array( $this, 'render_related_posts_field' ),
87 'borderless',
88 'borderless_section'
89 );
90
91 }
92
93 public function page_layout() {
94
95 // Check required user capability
96 if ( !current_user_can( 'manage_options' ) ) {
97 wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'borderless' ) );
98 }
99
100 // Admin Page Layout
101
102 ?><div class="wrap borderless-page-welcome about-wrap">
103 <h1><?php echo sprintf( __( 'Welcome to Borderless %s', 'borderless' ), isset( $matches[0] ) ? $matches[0] : BORDERLESS__VERSION ) ?></h1>
104
105 <div class="about-text">
106 <?php _e( 'Congratulations! Within minutes you can build complex layouts on the basis of our content elements and without touching a single line of code.', 'borderless' ) ?>
107 </div>
108 <div class="wp-badge borderless-page-logo">
109 <?php echo sprintf( __( 'Version %s', 'borderless' ), BORDERLESS__VERSION ) ?>
110 </div>
111 <p class="borderless-page-actions">
112 <a href="https://twitter.com/share" class="twitter-share-button"
113 data-via="visualmodo"
114 data-text="Take full control over your WordPress site with Borderless"
115 data-url="https://visualmodo.com" data-size="large">Tweet</a>
116 <script>! function ( d, s, id ) {
117 var js, fjs = d.getElementsByTagName( s )[ 0 ], p = /^http:/.test( d.location ) ? 'http' : 'https';
118 if ( ! d.getElementById( id ) ) {
119 js = d.createElement( s );
120 js.id = id;
121 js.src = p + '://platform.twitter.com/widgets.js';
122 fjs.parentNode.insertBefore( js, fjs );
123 }
124 }( document, 'script', 'twitter-wjs' );</script>
125 </p>
126
127 <?php
128 echo '<h3>Settings</h3>' . "\n";
129 echo ' <form action="options.php" method="post">' . "\n";
130
131 settings_fields( 'settings_group' );
132 do_settings_sections( 'borderless' );
133 submit_button();
134
135 echo ' </form>' . "\n";
136 echo '</div>' . "\n";
137
138 ?></div><?php
139
140 }
141
142 function render_primary_color_field() {
143
144 // Retrieve data from the database.
145 $options = get_option( 'borderless' );
146
147 // Set default value.
148 $value = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc';
149
150 // Field output.
151 echo '<input type="color" name="borderless[primary_color]" class="regular-text primary_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
152 echo '<p class="description">' . __( 'Pick a primary color for the elements.', 'borderless' ) . '</p>';
153
154 }
155
156 function render_secondary_color_field() {
157
158 // Retrieve data from the database.
159 $options = get_option( 'borderless' );
160
161 // Set default value.
162 $value = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc';
163
164 // Field output.
165 echo '<input type="color" name="borderless[secondary_color]" class="regular-text secondary_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
166 echo '<p class="description">' . __( 'Pick a secondary color for the elements.', 'borderless' ) . '</p>';
167
168 }
169
170 function render_text_color_field() {
171
172 // Retrieve data from the database.
173 $options = get_option( 'borderless' );
174
175 // Set default value.
176 $value = isset( $options['text_color'] ) ? $options['text_color'] : '';
177
178 // Field output.
179 echo '<input type="color" name="borderless[text_color]" class="regular-text text_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
180 echo '<p class="description">' . __( 'Pick a text color for the elements.', 'borderless' ) . '</p>';
181
182 }
183
184 function render_accent_color_field() {
185
186 // Retrieve data from the database.
187 $options = get_option( 'borderless' );
188
189 // Set default value.
190 $value = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc';
191
192 // Field output.
193 echo '<input type="color" name="borderless[accent_color]" class="regular-text accent_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
194 echo '<p class="description">' . __( 'Pick a accent color for the elements.', 'borderless' ) . '</p>';
195
196 }
197
198 function render_elementor_field() {
199
200 // Retrieve data from the database.
201 $options = get_option( 'borderless' );
202
203 // Set default value.
204 $value = isset( $options['elementor'] ) ? $options['elementor'] : true;
205
206 // Field output.
207 echo '<input type="checkbox" name="borderless[elementor]" class="elementor_field" value="checked" ' . checked( $value, 'checked', false ) . '> ' . __( '', 'borderless' );
208 echo '<span class="description">' . __( 'Enable or Disable Elementor Support', 'borderless' ) . '</span>';
209
210 }
211
212 function render_related_posts_field() {
213
214 // Retrieve data from the database.
215 $options = get_option( 'borderless' );
216
217 // Set default value.
218 $value = isset( $options['related_posts'] ) ? $options['related_posts'] : '';
219
220 // Field output.
221 echo '<input type="checkbox" name="borderless[related_posts]" class="related_posts_field" value="checked" ' . checked( $value, 'checked', false ) . '> ' . __( '', 'borderless' );
222 echo '<span class="description">' . __( 'Enable or Disable Related Posts', 'borderless' ) . '</span>';
223
224 }
225
226 }
227
228 new BorderlessDashboard;