PluginProbe
Borderless – Addons and Templates for Elementor / 1.6.1
Borderless – Addons and Templates for Elementor v1.6.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
← All changes | borderless.php +220 -75 1.0.81.6.1 View file →
@@ -1,11 +1,11 @@
1 1 <?php
2 2
3 3 /*
4 4 Plugin Name: Borderless
5 -Plugin URI: https://borderless.visualmodo.com/
5 +Plugin URI: https://visualmodo.com/borderless/
6 6 Description: One service packed with powerful tools to help you reach your purposes.
7 -Version: 1.0.8
7 +Version: 1.6.1
8 8 Author: Visualmodo
9 9 Author URI: https://visualmodo.com
10 10 License: GPLv3 or later
11 11 Text Domain: borderless
@@ -14,105 +14,250 @@
14 14
15 15 // don't load directly
16 16 defined( 'ABSPATH' ) || exit;
17 17
18 -/**
19 -* Define Constants.
20 -*/
21 -define( 'BORDERLESS__VERSION', '1.0.8' );
18 +
19 +/*-----------------------------------------------------------------------------------*/
20 +/* *. Borderless Constants
21 +/*-----------------------------------------------------------------------------------*/
22 +
23 +define( 'BORDERLESS__VERSION', '1.6.1' );
22 24 define( 'BORDERLESS__DIR', plugin_dir_path( __FILE__ ) );
25 +define( 'BORDERLESS__URL', plugins_url( '/', __FILE__ ) );
23 26 define( 'BORDERLESS__INC', BORDERLESS__DIR . '/includes' );
27 +define( 'BORDERLESS__ASSETS', BORDERLESS__URL . 'assets/' );
28 +define( 'BORDERLESS__STYLES', BORDERLESS__ASSETS . 'styles/' );
29 +define( 'BORDERLESS__SCRIPTS', BORDERLESS__ASSETS . 'scripts/' );
30 +define( 'BORDERLESS__LIB', BORDERLESS__ASSETS . 'lib/' );
31 +define( 'BORDERLESS__LIBRARY__DIR', BORDERLESS__DIR . '/includes/library/' );
32 +define( 'BORDERLESS__LIBRARY__URL', BORDERLESS__URL . 'includes/library/' );
33 +define( 'BORDERLESS__BLOCK_EDITOR', BORDERLESS__DIR . '/modules/block-editor' );
34 +define( 'BORDERLESS__ELEMENTOR', BORDERLESS__DIR . '/modules/elementor' );
24 35 define( 'BORDERLESS__WPBAKERY', BORDERLESS__DIR . '/modules/wpbakery' );
25 -define( 'BORDERLESS__ELEMENTOR', BORDERLESS__DIR . '/modules/elementor' );
36 +define( 'BORDERLESS__LIBS', BORDERLESS__DIR . '/modules/libraries' );
26 37 define( 'BORDERLESS__RELATED_POSTS', BORDERLESS__DIR . '/modules/related-posts' );
27 38
28 -
29 -/**
30 -* Requires.
31 -*/
32 -
33 -$options = get_option( 'borderless' ); // Just for enable/disable requires.
34 -require_once( BORDERLESS__DIR . "/dashboard.php");
35 -require_once( BORDERLESS__INC . "/icon-manager/icon-manager.php");
36 -require_once( BORDERLESS__INC . "/svg/svg.php");
37 -if ( isset( $options['elementor'] ) && did_action( 'elementor/loaded' ) ) { require_once( BORDERLESS__ELEMENTOR . "/elementor.php"); }
38 -if ( isset( $options['related_posts'] ) ) { require_once( BORDERLESS__RELATED_POSTS . "/related-posts.php"); }
39 -
40 39 /*-----------------------------------------------------------------------------------*/
41 -/* *. Borderless Construct
40 +/* *. Borderless Core
42 41 /*-----------------------------------------------------------------------------------*/
43 42
44 43 class Borderless {
45 - function __construct() {
44 +
45 + /**
46 + * The loader that's responsible for maintaining and registering all hooks that power
47 + * the plugin.
48 + *
49 + * @since 1.0.0
50 + * @access protected
51 + * @var Borderless_Loader $loader Maintains and registers all hooks for the plugin.
52 + */
53 + protected $loader;
54 +
55 + /**
56 + * The unique identifier of this plugin.
57 + *
58 + * @since 1.0.0
59 + * @access protected
60 + * @var string $plugin_name The string used to uniquely identify this plugin.
61 + */
62 + protected $plugin_name;
63 +
64 + /**
65 + * The current version of the plugin.
66 + *
67 + * @since 1.0.0
68 + * @access protected
69 + * @var string $version The current version of the plugin.
70 + */
71 + protected $version;
72 +
73 + /**
74 + * Define the core functionality of the plugin.
75 + *
76 + * Set the plugin name and the plugin version that can be used throughout the plugin.
77 + * Load the dependencies, define the locale, and set the hooks for the admin area and
78 + * the public-facing side of the site.
79 + *
80 + * @since 1.0.0
81 + */
82 + public function __construct() {
83 +
84 + if ( defined( 'BORDERLESS__VERSION' ) ) {
85 + $this->version = BORDERLESS__VERSION;
86 + } else {
87 + $this->version = '1.0.0';
88 + }
89 + $this->plugin_name = 'borderless';
46 90
47 - // We safely integrate with WPBakery with this hook
48 - add_action( 'init', array( $this, 'wpbakeryCheck' ) );
49 -
50 - add_action( 'wp_enqueue_scripts', array( $this, 'frontendAssets' ) );
51 - add_action('admin_enqueue_scripts',array($this,'backendAssets'));
91 + $this->borderless_load_dependencies();
92 + $this->borderless_define_public_hooks();
93 +
52 94 }
95 +
96 + /**
97 + * Define the core functionality of the plugin.
98 + *
99 + * Set the plugin name and the plugin version that can be used throughout the plugin.
100 + * Load the dependencies, define the locale, and set the hooks for the admin area and
101 + * the public-facing side of the site.
102 + *
103 + * @since 1.0.0
104 + */
53 105
54 - // Load plugin css and javascript files which you may need on front end of your site
55 - public function frontendAssets() {
56 - wp_register_style( 'borderless_frontend_style', plugins_url('assets/styles/borderless.min.css', __FILE__), array(), BORDERLESS__VERSION );
57 - wp_enqueue_style( 'borderless_frontend_style' );
106 + public function borderless_load_dependencies() {
58 107
59 - // If you need any javascript files on front end, here is how you can load them.
60 - wp_enqueue_script( 'borderless_frontend_script', plugins_url('assets/scripts/borderless.min.js', __FILE__), array(), BORDERLESS__VERSION, true );
108 + $options = get_option( 'borderless' );
109 +
110 + $theme = wp_get_theme(get_template());
111 +
112 + /**
113 + * Dashboard Page.
114 + */
115 +
116 + require_once( BORDERLESS__INC . "/templates/dashboard.php" );
117 +
118 + /**
119 + * License Manager Page.
120 + */
121 +
122 + require_once( BORDERLESS__INC . "/templates/license.php" );
123 +
124 + /**
125 + * The class responsible for orchestrating the actions and filters of the
126 + * core plugin.
127 + */
128 + require_once( BORDERLESS__INC . "/class-borderless-loader.php" );
129 +
130 + /**
131 + * The class responsible for defining all actions that occur in the public-facing
132 + * side of the site.
133 + */
134 + require_once( BORDERLESS__INC . "/class-borderless-public.php" );
135 +
136 + require_once( BORDERLESS__INC . "/templates/system-info.php" );
137 + require_once( BORDERLESS__INC . "/icon-manager/icon-manager.php" );
138 + require_once( BORDERLESS__INC . "/custom-post-types/custom-post-types.php" );
139 + require_once( BORDERLESS__INC . "/svg/svg.php" );
140 + require_once( BORDERLESS__BLOCK_EDITOR . "/contact-information/contact-information.php" );
141 + require_once( BORDERLESS__BLOCK_EDITOR . "/social-icons/social-icons.php" );
142 + require_once( BORDERLESS__BLOCK_EDITOR . "/spacer/spacer.php" );
143 + require_once( BORDERLESS__ELEMENTOR . "/elementor.php" );
144 + require_once( BORDERLESS__WPBAKERY . "/wpbakery.php" );
145 + require_once( BORDERLESS__INC . "/helper.php" );
146 + require_once( BORDERLESS__INC . "/custom-post-types/templates.php" );
147 + require_once( BORDERLESS__LIBRARY__DIR . "templates/templates.php" );
148 + require_once( BORDERLESS__LIBRARY__DIR . "importer.php" );
149 +
150 + if ( isset( $options['related_posts'] ) ) {
151 + require_once( BORDERLESS__RELATED_POSTS . "/related-posts.php" );
152 + }
153 +
154 + $this->loader = new Borderless_Loader();
155 +
61 156 }
62 157
63 - function backendAssets($hook) {
64 - wp_enqueue_style('borderless_backend_style', plugins_url('assets/styles/backend.min.css', __FILE__) );
158 + /**
159 + * Register all of the hooks related to the public-facing functionality
160 + * of the plugin.
161 + *
162 + * @since 1.0.0
163 + * @access private
164 + */
165 + private function borderless_define_public_hooks() {
65 166
66 - // enqueue css files on backend
67 - if($hook == "post.php" || $hook == "post-new.php" || $hook == 'visual-composer_page_vc-roles'){
68 - if((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || is_ssl()) {
69 - $scheme = 'https';
167 + $plugin_public = new Borderless_Public( $this->get_plugin_name(), $this->get_version() );
168 +
169 + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
170 + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
171 +
172 + // Enqueue script for Gutenberg
173 + add_action('enqueue_block_editor_assets', array($this, 'enqueue_gutenberg_button_script'));
174 +
175 +
176 + function borderless_settings_colors() {
177 + $options = get_option( 'borderless' );
178 +
179 + ?>
180 + <style type="text/css">
181 +
182 + :root {
183 + --borderless-color-primary: <?php echo esc_attr( $options['primary_color'], '#0000FF' ); ?>;
184 + --borderless-secondary-primary: <?php echo esc_attr( $options['secondary_color'], '#FF6819' ); ?>;
185 + --borderless-color-tertiary: <?php echo esc_attr( $options['tertiary_color'], '#3FCC14' ); ?>;
70 186 }
71 - else {
72 - $scheme = 'http';
73 - }
74 - $this->paths = wp_upload_dir();
75 - $this->paths['fonts'] = 'borderless_icon_fonts';
76 - $this->paths['fonturl'] = set_url_scheme($this->paths['baseurl'].'/'.$this->paths['fonts'], $scheme);
77 - $fonts = get_option('borderless_icon_fonts');
78 - if(is_array($fonts))
79 - {
80 - foreach($fonts as $font => $info)
81 - {
82 - if(strpos($info['style'], 'http://' ) !== false) {
83 - wp_enqueue_style('borderless-'.$font,$info['style']);
84 - } else {
85 - wp_enqueue_style('borderless-'.$font,trailingslashit($this->paths['fonturl']).$info['style']);
86 - }
87 - }
88 - }
187 +
188 + </style>
189 + <?php
190 +
89 191 }
192 + add_action( 'wp_head', 'borderless_settings_colors' );
193 +
90 194 }
195 +
196 + /**
197 + * Enqueue the script for the Gutenberg editor.
198 + *
199 + * @since 1.0.0
200 + */
201 + public function enqueue_gutenberg_button_script() {
202 + wp_enqueue_script(
203 + 'borderless-ai-button',
204 + BORDERLESS__SCRIPTS . 'ai-button.js',
205 + array( 'wp-element', 'wp-components', 'wp-edit-post', 'wp-plugins' ), // Added 'wp-plugins' dependency
206 + filemtime( BORDERLESS__DIR . 'assets/scripts/ai-button.js' ),
207 + true
208 + );
209 + }
91 210
211 + /**
212 + * Run the loader to execute all of the hooks with WordPress.
213 + *
214 + * @since 1.0.0
215 + */
216 + public function run() {
217 + $this->loader->run();
218 + }
92 219
93 220 /**
94 - * WPBakery.
95 - */
221 + * The name of the plugin used to uniquely identify it within the context of
222 + * WordPress and to define internationalization functionality.
223 + *
224 + * @since 1.0.0
225 + * @return string The name of the plugin.
226 + */
227 + public function get_plugin_name() {
228 + return $this->plugin_name;
229 + }
96 230
97 - // Check if WPBakery is installed
98 - public function wpbakeryCheck() {
99 - if ( defined( 'WPB_VC_VERSION' ) ) {
100 - require_once( BORDERLESS__WPBAKERY . "/wpbakery.php");
101 - } else {
102 - add_action('admin_notices', array( $this, 'wpbakeryNotice' ));
103 - return;
104 - }
231 + /**
232 + * The reference to the class that orchestrates the hooks with the plugin.
233 + *
234 + * @since 1.0.0
235 + * @return Borderless_Loader Orchestrates the hooks of the plugin.
236 + */
237 + public function get_loader() {
238 + return $this->loader;
105 239 }
106 240
107 - // Show notice if your plugin is activated but WPBakery is not
108 - public function wpbakeryNotice() {
109 - $plugin_data = get_plugin_data(__FILE__);
110 - echo '
111 - <div class="updated">
112 - <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.', 'borderless'), $plugin_data['Name']).'</p>
113 - </div>';
241 + /**
242 + * Retrieve the version number of the plugin.
243 + *
244 + * @since 1.0.0
245 + * @return string The version number of the plugin.
246 + */
247 + public function get_version() {
248 + return $this->version;
114 249 }
115 250
116 251 }
117 -// Finally initialize code
118 -new Borderless();
252 +
253 +/*-----------------------------------------------------------------------------------*/
254 +/* *. Borderless Init
255 +/*-----------------------------------------------------------------------------------*/
256 +
257 +function run_borderless() {
258 +
259 + $plugin = new Borderless();
260 + $plugin->run();
261 +
262 +}
263 +run_borderless();