PluginProbe
Borderless – Addons and Templates for Elementor / 1.0.0
Borderless – Addons and Templates for Elementor v1.0.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 / borderless.php

borderless.php in Borderless – Addons and Templates for Elementor 1.0.0, at borderless.php

287 lines 9.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 Plugin Name: Borderless
5 Plugin URI: https://borderless.visualmodo.com/
6 Description: One service packed with powerful tools to help you reach your purposes.
7 Version: 1.0.0
8 Author: Visualmodo
9 Author URI: https://visualmodo.com
10 License: GPLv3 or later
11 Text Domain: borderless
12 Domain Path: /languages
13 */
14
15 // don't load directly
16 defined( 'ABSPATH' ) || exit;
17
18 if ( ! defined( 'BORDERLESS_VERSION' ) ) define( 'BORDERLESS_VERSION', '1.0.0' );
19
20 // Borderless Base
21 $dir = dirname( __FILE__ );
22 $inc = dirname(__FILE__) . "/includes";
23
24 require_once( $inc . "/paramns/icon-manager/icon-manager.php");
25 require_once( $inc . "/svg/svg.php");
26
27
28 /*-----------------------------------------------------------------------------------*/
29 /* *. Borderless Dashboard
30 /*-----------------------------------------------------------------------------------*/
31
32 class BorderlessSettings {
33
34 public function __construct() {
35
36 add_action( 'admin_menu', array( $this, 'add_admin_menu' ) );
37 add_action( 'admin_init', array( $this, 'init_settings' ) );
38
39 }
40
41 public function add_admin_menu() {
42
43 add_menu_page(
44 esc_html__( 'Settings', 'borderless' ),
45 esc_html__( 'Borderless', 'borderless' ),
46 'manage_options',
47 'borderless.php',
48 array( $this, 'page_layout' ),
49 plugin_dir_url(__FILE__) . "/assets/img/borderless.svg",
50 2
51 );
52
53 }
54
55 public function init_settings() {
56
57 register_setting(
58 'settings_group',
59 'borderless'
60 );
61
62 add_settings_section(
63 'borderless_section',
64 '',
65 false,
66 'borderless'
67 );
68
69 add_settings_field(
70 'primary_color',
71 __( 'Primary Color', 'borderless' ),
72 array( $this, 'render_primary_color_field' ),
73 'borderless',
74 'borderless_section'
75 );
76 add_settings_field(
77 'secondary_color',
78 __( 'Secondary Color', 'borderless' ),
79 array( $this, 'render_secondary_color_field' ),
80 'borderless',
81 'borderless_section'
82 );
83 add_settings_field(
84 'text_color',
85 __( 'Text Color', 'borderless' ),
86 array( $this, 'render_text_color_field' ),
87 'borderless',
88 'borderless_section'
89 );
90 add_settings_field(
91 'accent_color',
92 __( 'Accent Color', 'borderless' ),
93 array( $this, 'render_accent_color_field' ),
94 'borderless',
95 'borderless_section'
96 );
97
98 }
99
100 public function page_layout() {
101
102 // Check required user capability
103 if ( !current_user_can( 'manage_options' ) ) {
104 wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'borderless' ) );
105 }
106
107 // Admin Page Layout
108
109 ?><div class="wrap ve-page-welcome about-wrap">
110 <h1><?php echo sprintf( __( 'Welcome to Borderless %s', 'borderless' ), isset( $matches[0] ) ? $matches[0] : BORDERLESS_VERSION ) ?></h1>
111
112 <div class="about-text">
113 <?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' ) ?>
114 </div>
115 <div class="wp-badge ve-page-logo">
116 <?php echo sprintf( __( 'Version %s', 'borderless' ), BORDERLESS_VERSION ) ?>
117 </div>
118 <p class="ve-page-actions">
119 <a href="https://twitter.com/share" class="twitter-share-button"
120 data-via="visualmodo"
121 data-text="Take full control over your WordPress site with Borderless"
122 data-url="https://visualmodo.com" data-size="large">Tweet</a>
123 <script>! function ( d, s, id ) {
124 var js, fjs = d.getElementsByTagName( s )[ 0 ], p = /^http:/.test( d.location ) ? 'http' : 'https';
125 if ( ! d.getElementById( id ) ) {
126 js = d.createElement( s );
127 js.id = id;
128 js.src = p + '://platform.twitter.com/widgets.js';
129 fjs.parentNode.insertBefore( js, fjs );
130 }
131 }( document, 'script', 'twitter-wjs' );</script>
132 </p>
133
134 <?php
135 echo '<h3>Settings</h3>' . "\n";
136 echo ' <form action="options.php" method="post">' . "\n";
137
138 settings_fields( 'settings_group' );
139 do_settings_sections( 'borderless' );
140 submit_button();
141
142 echo ' </form>' . "\n";
143 echo '</div>' . "\n";
144
145 ?></div><?php
146
147 }
148
149 function render_primary_color_field() {
150
151 // Retrieve data from the database.
152 $options = get_option( 'borderless' );
153
154 // Set default value.
155 $value = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc';
156
157 // Field output.
158 echo '<input type="color" name="borderless[primary_color]" class="regular-text primary_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
159 echo '<p class="description">' . __( 'Pick a primary color for the elements.', 'borderless' ) . '</p>';
160
161 }
162
163 function render_secondary_color_field() {
164
165 // Retrieve data from the database.
166 $options = get_option( 'borderless' );
167
168 // Set default value.
169 $value = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc';
170
171 // Field output.
172 echo '<input type="color" name="borderless[secondary_color]" class="regular-text secondary_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
173 echo '<p class="description">' . __( 'Pick a secondary color for the elements.', 'borderless' ) . '</p>';
174
175 }
176
177 function render_text_color_field() {
178
179 // Retrieve data from the database.
180 $options = get_option( 'borderless' );
181
182 // Set default value.
183 $value = isset( $options['text_color'] ) ? $options['text_color'] : '';
184
185 // Field output.
186 echo '<input type="color" name="borderless[text_color]" class="regular-text text_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
187 echo '<p class="description">' . __( 'Pick a text color for the elements.', 'borderless' ) . '</p>';
188
189 }
190
191 function render_accent_color_field() {
192
193 // Retrieve data from the database.
194 $options = get_option( 'borderless' );
195
196 // Set default value.
197 $value = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc';
198
199 // Field output.
200 echo '<input type="color" name="borderless[accent_color]" class="regular-text accent_color_field" placeholder="' . esc_attr__( '', 'borderless' ) . '" value="' . esc_attr( $value ) . '">';
201 echo '<p class="description">' . __( 'Pick a accent color for the elements.', 'borderless' ) . '</p>';
202
203 }
204
205 }
206
207 new BorderlessSettings;
208
209
210 /*-----------------------------------------------------------------------------------*/
211 /* *. Extend
212 /*-----------------------------------------------------------------------------------*/
213
214 class BorderlessExtendAddonClass {
215 function __construct() {
216 // We safely integrate with VC with this hook
217 add_action( 'init', array( $this, 'integrateWithVC' ) );
218
219 // WPBakery Custom Params
220 require_once( dirname(__FILE__) . "/includes/paramns/icon-manager/includes/icon-manager-param.php" );
221
222 add_action('admin_enqueue_scripts',array($this,'ipm_scripts'));
223
224 // Register CSS and JS
225 add_action( 'wp_enqueue_scripts', array( $this, 'ipm_css_js' ) );
226 }
227
228 function ipm_scripts($hook) {
229 wp_enqueue_style('borderless_backend_extend_style', plugins_url('assets/css/backend.css', __FILE__) );
230
231 // enqueue css files on backend
232 if($hook == "post.php" || $hook == "post-new.php" || $hook == 'visual-composer_page_vc-roles'){
233 if((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || is_ssl()) {
234 $scheme = 'https';
235 }
236 else {
237 $scheme = 'http';
238 }
239 $this->paths = wp_upload_dir();
240 $this->paths['fonts'] = 'borderless_ip';
241 $this->paths['fonturl'] = set_url_scheme($this->paths['baseurl'].'/'.$this->paths['fonts'], $scheme);
242 $fonts = get_option('borderless_ip');
243 if(is_array($fonts))
244 {
245 foreach($fonts as $font => $info)
246 {
247 if(strpos($info['style'], 'http://' ) !== false) {
248 wp_enqueue_style('borderless-'.$font,$info['style']);
249 } else {
250 wp_enqueue_style('borderless-'.$font,trailingslashit($this->paths['fonturl']).$info['style']);
251 }
252 }
253 }
254 }
255 }
256
257 public function integrateWithVC() {
258 // Check if Visual Composer is installed
259 if ( ! defined( 'WPB_VC_VERSION' ) ) {
260 // Display notice that Visual Compser is required
261 add_action('admin_notices', array( $this, 'showVcVersionNotice' ));
262 return;
263 }
264
265 require_once( dirname(__FILE__) . "/includes/elements/lean-map.php");
266 }
267
268 // Load plugin css and javascript files which you may need on front end of your site
269 public function ipm_css_js() {
270 wp_register_style( 'borderless_frontend_style', plugins_url('assets/css/borderless.min.css', __FILE__), array(), BORDERLESS_VERSION );
271 wp_enqueue_style( 'borderless_frontend_style' );
272
273 // If you need any javascript files on front end, here is how you can load them.
274 wp_enqueue_script( 'borderless_frontend_script', plugins_url('assets/js/borderless.js', __FILE__), array(), BORDERLESS_VERSION, true );
275 }
276
277 // Show notice if your plugin is activated but Visual Composer is not
278 public function showVcVersionNotice() {
279 $plugin_data = get_plugin_data(__FILE__);
280 echo '
281 <div class="updated">
282 <p>'.sprintf(__('<strong>%s</strong> requires <strong><a href="https://wpbakery.com/" target="_blank">WPBakery Page Builder</a></strong> plugin to be installed and activated on your site.', 'visualmodo'), $plugin_data['Name']).'</p>
283 </div>';
284 }
285 }
286 // Finally initialize code
287 new BorderlessExtendAddonClass();