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

207 lines 7.3 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 'related_posts',
78 __( 'Related Posts', 'borderless' ),
79 array( $this, 'render_related_posts_field' ),
80 'borderless',
81 'borderless_section'
82 );
83
84 }
85
86 public function page_layout() {
87
88 // Check required user capability
89 if ( !current_user_can( 'manage_options' ) ) {
90 wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'borderless' ) );
91 }
92
93 // Admin Page Layout
94
95 ?><div class="wrap ve-page-welcome about-wrap">
96 <h1><?php echo sprintf( __( 'Welcome to Borderless %s', 'borderless' ), isset( $matches[0] ) ? $matches[0] : BORDERLESS__VERSION ) ?></h1>
97
98 <div class="about-text">
99 <?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' ) ?>
100 </div>
101 <div class="wp-badge ve-page-logo">
102 <?php echo sprintf( __( 'Version %s', 'borderless' ), BORDERLESS__VERSION ) ?>
103 </div>
104 <p class="ve-page-actions">
105 <a href="https://twitter.com/share" class="twitter-share-button"
106 data-via="visualmodo"
107 data-text="Take full control over your WordPress site with Borderless"
108 data-url="https://visualmodo.com" data-size="large">Tweet</a>
109 <script>! function ( d, s, id ) {
110 var js, fjs = d.getElementsByTagName( s )[ 0 ], p = /^http:/.test( d.location ) ? 'http' : 'https';
111 if ( ! d.getElementById( id ) ) {
112 js = d.createElement( s );
113 js.id = id;
114 js.src = p + '://platform.twitter.com/widgets.js';
115 fjs.parentNode.insertBefore( js, fjs );
116 }
117 }( document, 'script', 'twitter-wjs' );</script>
118 </p>
119
120 <?php
121 echo '<h3>Settings</h3>' . "\n";
122 echo ' <form action="options.php" method="post">' . "\n";
123
124 settings_fields( 'settings_group' );
125 do_settings_sections( 'borderless' );
126 submit_button();
127
128 echo ' </form>' . "\n";
129 echo '</div>' . "\n";
130
131 ?></div><?php
132
133 }
134
135 function render_primary_color_field() {
136
137 // Retrieve data from the database.
138 $options = get_option( 'borderless' );
139
140 // Set default value.
141 $value = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc';
142
143 // Field output.
144 echo '<input type="color" name="borderless[primary_color]" class="regular-text primary_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
145 echo '<p class="description">' . __( 'Pick a primary color for the elements.', 'borderless' ) . '</p>';
146
147 }
148
149 function render_secondary_color_field() {
150
151 // Retrieve data from the database.
152 $options = get_option( 'borderless' );
153
154 // Set default value.
155 $value = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc';
156
157 // Field output.
158 echo '<input type="color" name="borderless[secondary_color]" class="regular-text secondary_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
159 echo '<p class="description">' . __( 'Pick a secondary color for the elements.', 'borderless' ) . '</p>';
160
161 }
162
163 function render_text_color_field() {
164
165 // Retrieve data from the database.
166 $options = get_option( 'borderless' );
167
168 // Set default value.
169 $value = isset( $options['text_color'] ) ? $options['text_color'] : '';
170
171 // Field output.
172 echo '<input type="color" name="borderless[text_color]" class="regular-text text_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
173 echo '<p class="description">' . __( 'Pick a text color for the elements.', 'borderless' ) . '</p>';
174
175 }
176
177 function render_accent_color_field() {
178
179 // Retrieve data from the database.
180 $options = get_option( 'borderless' );
181
182 // Set default value.
183 $value = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc';
184
185 // Field output.
186 echo '<input type="color" name="borderless[accent_color]" class="regular-text accent_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
187 echo '<p class="description">' . __( 'Pick a accent color for the elements.', 'borderless' ) . '</p>';
188
189 }
190
191 function render_related_posts_field() {
192
193 // Retrieve data from the database.
194 $options = get_option( 'borderless' );
195
196 // Set default value.
197 $value = isset( $options['related_posts'] ) ? $options['related_posts'] : '';
198
199 // Field output.
200 echo '<input type="checkbox" name="borderless[related_posts]" class="related_posts_field" value="checked" ' . checked( $value, 'checked', false ) . '> ' . __( '', 'borderless' );
201 echo '<span class="description">' . __( 'Enable or Disable Related Posts', 'borderless' ) . '</span>';
202
203 }
204
205 }
206
207 new BorderlessDashboard;