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 | modules/elementor/elementor.php +182 -22 1.2.31.6.1 View file →
@@ -4,10 +4,37 @@
4 4 defined( 'ABSPATH' ) || exit;
5 5
6 6 final class Borderless_Elementor {
7 7
8 + /**
9 + * Plugin Version
10 + */
11 + const VERSION = '1.0.0';
12 +
13 + /**
14 + * Minimum Elementor Version
15 + */
16 + const MINIMUM_ELEMENTOR_VERSION = '2.0.0';
17 +
18 + /**
19 + * Minimum PHP Version
20 + */
21 + const MINIMUM_PHP_VERSION = '7.0';
22 +
23 + /**
24 + * Instance
25 + *
26 + * @var Borderless_Elementor The single instance of the class.
27 + */
8 28 private static $_instance = null;
9 29
30 + /**
31 + * Instance
32 + *
33 + * Ensures only one instance of the class is loaded or can be loaded.
34 + *
35 + * @return Borderless_Elementor An instance of the class.
36 + */
10 37 public static function instance() {
11 38
12 39 if ( is_null( self::$_instance ) ) {
13 40 self::$_instance = new self();
@@ -15,14 +42,41 @@
15 42 return self::$_instance;
16 43
17 44 }
18 45
46 + /**
47 + * Constructor
48 + */
19 49 public function __construct() {
20 50
21 51 add_action( 'plugins_loaded', [ $this, 'on_plugins_loaded' ] );
22 52
53 + require_once('assets.php');
54 + borderless_elementor_assets()->init();
55 +
23 56 }
24 57
58 + /**
59 + * Load Textdomain
60 + *
61 + * Load plugin localization files.
62 + *
63 + * Fired by `init` action hook.
64 + */
65 + public function i18n() {
66 +
67 + load_plugin_textdomain( 'borderless' );
68 +
69 + }
70 +
71 + /**
72 + * On Plugins Loaded
73 + *
74 + * Checks if Elementor has loaded, and performs some compatibility checks.
75 + * If All checks pass, inits the plugin.
76 + *
77 + * Fired by `plugins_loaded` action hook.
78 + */
25 79 public function on_plugins_loaded() {
26 80
27 81 if ( $this->is_compatible() ) {
28 82 add_action( 'elementor/init', [ $this, 'init' ] );
@@ -29,57 +83,163 @@
29 83 }
30 84
31 85 }
32 86
87 + /**
88 + * Compatibility Checks
89 + *
90 + * Checks if the installed version of Elementor meets the plugin's minimum requirement.
91 + * Checks if the installed PHP version meets the plugin's minimum requirement.
92 + */
33 93 public function is_compatible() {
34 94
95 + // Check if Elementor installed and activated
96 + if ( ! did_action( 'elementor/loaded' ) ) {
97 + //add_action( 'admin_notices', [ $this, 'admin_notice_missing_main_plugin' ] );
98 + return false;
99 + }
100 +
101 + // Check for required Elementor version
102 + if ( ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) {
103 + add_action( 'admin_notices', [ $this, 'admin_notice_minimum_elementor_version' ] );
104 + return false;
105 + }
106 +
107 + // Check for required PHP version
108 + if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) {
109 + add_action( 'admin_notices', [ $this, 'admin_notice_minimum_php_version' ] );
110 + return false;
111 + }
112 +
35 113 return true;
36 114
37 115 }
38 116
117 + /**
118 + * Initialize the plugin
119 + *
120 + * Load the plugin only after Elementor (and other plugins) are loaded.
121 + * Load the files required to run the plugin.
122 + *
123 + * Fired by `plugins_loaded` action hook.
124 + */
39 125 public function init() {
126 +
127 + $this->i18n();
40 128
41 - wp_register_style(
42 - 'font-awesome-5',
43 - ELEMENTOR_ASSETS_URL . 'lib/font-awesome/css/all.min.css',
44 - false,
45 - BORDERLESS__VERSION
46 - );
47 -
48 129 // Add Plugin actions
49 130 add_action( 'elementor/widgets/widgets_registered', [ $this, 'init_widgets' ] );
50 - add_action( 'elementor/elements/categories_registered', [ $this, 'register_borderless_elementor_category' ] );
131 + add_action( 'elementor/elements/categories_registered', [ $this, 'register_borderless_elementor_category' ] );
51 132
52 133 }
53 134
135 + /**
136 + * Init Widgets
137 + */
54 138 public function init_widgets() {
55 139
56 140 // Include Widget files
57 141 require_once('helper.php');
142 + require_once('widgets/animated-text.php');
58 143 require_once('widgets/circular-progress-bar.php');
59 - require_once('widgets/contact-form-7.php');
144 + require_once('widgets/contact-form-7.php');
145 + require_once('widgets/hero.php');
146 + require_once('widgets/marquee-text.php');
147 + require_once('widgets/portfolio.php');
148 + require_once('widgets/progress-bar.php');
60 149 require_once('widgets/semi-circular-progress-bar.php');
150 + require_once('widgets/slider.php');
151 + require_once('widgets/split-hero.php');
61 152 require_once('widgets/team-member.php');
62 153 require_once('widgets/testimonial.php');
63 154
64 155 // Register widget
65 - \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Circular_Progress_Bar() );
66 - \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Contact_Form_7() );
67 - \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Semi_Circular_Progress_Bar() );
68 - \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Team_Member() );
69 - \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Testimonial() );
156 + \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Animated_Text() );
157 + \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Circular_Progress_Bar() );
158 + \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Contact_Form_7() );
159 + \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Hero() );
160 + \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Marquee_text() );
161 + \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Portfolio() );
162 + \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Progress_Bar() );
163 + \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Semi_Circular_Progress_Bar() );
164 + \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Slider() );
165 + \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Split_Hero() );
166 + \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Team_Member() );
167 + \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Testimonial() );
70 168
71 169 }
72 170
73 - public function register_borderless_elementor_category( $elements_manager ) {
74 - $elements_manager->add_category(
75 - 'borderless',
76 - [
77 - 'title' => __( 'Borderless', 'borderless' ),
78 - 'icon' => 'fa fa-plug',
79 - ]
171 + public function register_borderless_elementor_category( $elements_manager ) {
172 + $elements_manager->add_category(
173 + 'borderless',
174 + [
175 + 'title' => __( 'Borderless', 'borderless' ),
176 + 'icon' => 'borderless-icon-borderless',
177 + ]
178 + );
179 + }
180 +
181 + /**
182 + * Admin notice
183 + *
184 + * Warning when the site doesn't have Elementor installed or activated.
185 + */
186 + public function admin_notice_missing_main_plugin() {
187 +
188 + if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );
189 +
190 + $message = sprintf(
191 + /* translators: 1: Plugin name 2: Elementor */
192 + esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'borderless' ),
193 + '<strong>' . esc_html__( 'Borderless', 'borderless' ) . '</strong>',
194 + '<strong>' . esc_html__( 'Elementor', 'borderless' ) . '</strong>'
80 195 );
196 +
197 + printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
198 +
81 199 }
82 200
201 + /**
202 + * Admin notice
203 + *
204 + * Warning when the site doesn't have a minimum required Elementor version.
205 + */
206 + public function admin_notice_minimum_elementor_version() {
207 +
208 + if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );
209 +
210 + $message = sprintf(
211 + /* translators: 1: Plugin name 2: Elementor 3: Required Elementor version */
212 + esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'borderless' ),
213 + '<strong>' . esc_html__( 'Elementor Test Extension', 'borderless' ) . '</strong>',
214 + '<strong>' . esc_html__( 'Elementor', 'borderless' ) . '</strong>',
215 + self::MINIMUM_ELEMENTOR_VERSION
216 + );
217 +
218 + printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
219 +
220 + }
221 +
222 + /**
223 + * Admin notice
224 + *
225 + * Warning when the site doesn't have a minimum required PHP version.
226 + */
227 + public function admin_notice_minimum_php_version() {
228 +
229 + if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );
230 +
231 + $message = sprintf(
232 + /* translators: 1: Plugin name 2: PHP 3: Required PHP version */
233 + esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'borderless' ),
234 + '<strong>' . esc_html__( 'Elementor Test Extension', 'borderless' ) . '</strong>',
235 + '<strong>' . esc_html__( 'PHP', 'borderless' ) . '</strong>',
236 + self::MINIMUM_PHP_VERSION
237 + );
238 +
239 + printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
240 +
241 + }
242 +
83 243 }
84 244
85 -Borderless_Elementor::instance();
245 +Borderless_Elementor::instance();