PluginProbe
Borderless – Addons and Templates for Elementor / 1.3.6
Borderless – Addons and Templates for Elementor v1.3.6
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 / modules / elementor / elementor.php

elementor.php in Borderless – Addons and Templates for Elementor 1.3.6, at modules/elementor/elementor.php

242 lines 6.9 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 final class Borderless_Elementor {
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 */
28 private static $_instance = null;
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 */
37 public static function instance() {
38
39 if ( is_null( self::$_instance ) ) {
40 self::$_instance = new self();
41 }
42 return self::$_instance;
43
44 }
45
46 /**
47 * Constructor
48 */
49 public function __construct() {
50
51 add_action( 'plugins_loaded', [ $this, 'on_plugins_loaded' ] );
52
53 require_once('assets.php');
54 borderless_elementor_assets()->init();
55
56 }
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 */
79 public function on_plugins_loaded() {
80
81 if ( $this->is_compatible() ) {
82 add_action( 'elementor/init', [ $this, 'init' ] );
83 }
84
85 }
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 */
93 public function is_compatible() {
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
113 return true;
114
115 }
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 */
125 public function init() {
126
127 $this->i18n();
128
129 // Add Plugin actions
130 add_action( 'elementor/widgets/widgets_registered', [ $this, 'init_widgets' ] );
131 add_action( 'elementor/elements/categories_registered', [ $this, 'register_borderless_elementor_category' ] );
132
133 }
134
135 /**
136 * Init Widgets
137 */
138 public function init_widgets() {
139
140 // Include Widget files
141 require_once('helper.php');
142 require_once('widgets/animated-text.php');
143 require_once('widgets/circular-progress-bar.php');
144 require_once('widgets/contact-form-7.php');
145 require_once('widgets/marquee-text.php');
146 require_once('widgets/portfolio.php');
147 require_once('widgets/progress-bar.php');
148 require_once('widgets/semi-circular-progress-bar.php');
149 require_once('widgets/slider.php');
150 require_once('widgets/team-member.php');
151 require_once('widgets/testimonial.php');
152
153 // Register widget
154 \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Animated_Text() );
155 \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Circular_Progress_Bar() );
156 \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Contact_Form_7() );
157 \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Marquee_text() );
158 \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Portfolio() );
159 \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Progress_Bar() );
160 \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Semi_Circular_Progress_Bar() );
161 \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Slider() );
162 \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Team_Member() );
163 \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Testimonial() );
164
165 }
166
167 public function register_borderless_elementor_category( $elements_manager ) {
168 $elements_manager->add_category(
169 'borderless',
170 [
171 'title' => __( 'Borderless', 'borderless' ),
172 'icon' => 'borderless-icon-borderless',
173 ]
174 );
175 }
176
177 /**
178 * Admin notice
179 *
180 * Warning when the site doesn't have Elementor installed or activated.
181 */
182 public function admin_notice_missing_main_plugin() {
183
184 if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );
185
186 $message = sprintf(
187 /* translators: 1: Plugin name 2: Elementor */
188 esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'borderless' ),
189 '<strong>' . esc_html__( 'Borderless', 'borderless' ) . '</strong>',
190 '<strong>' . esc_html__( 'Elementor', 'borderless' ) . '</strong>'
191 );
192
193 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
194
195 }
196
197 /**
198 * Admin notice
199 *
200 * Warning when the site doesn't have a minimum required Elementor version.
201 */
202 public function admin_notice_minimum_elementor_version() {
203
204 if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );
205
206 $message = sprintf(
207 /* translators: 1: Plugin name 2: Elementor 3: Required Elementor version */
208 esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'borderless' ),
209 '<strong>' . esc_html__( 'Elementor Test Extension', 'borderless' ) . '</strong>',
210 '<strong>' . esc_html__( 'Elementor', 'borderless' ) . '</strong>',
211 self::MINIMUM_ELEMENTOR_VERSION
212 );
213
214 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
215
216 }
217
218 /**
219 * Admin notice
220 *
221 * Warning when the site doesn't have a minimum required PHP version.
222 */
223 public function admin_notice_minimum_php_version() {
224
225 if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );
226
227 $message = sprintf(
228 /* translators: 1: Plugin name 2: PHP 3: Required PHP version */
229 esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'borderless' ),
230 '<strong>' . esc_html__( 'Elementor Test Extension', 'borderless' ) . '</strong>',
231 '<strong>' . esc_html__( 'PHP', 'borderless' ) . '</strong>',
232 self::MINIMUM_PHP_VERSION
233 );
234
235 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
236
237 }
238
239 }
240
241 Borderless_Elementor::instance();
242