PluginProbe
Borderless – Addons and Templates for Elementor / 1.4.9
Borderless – Addons and Templates for Elementor v1.4.9
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.4.9, at modules/elementor/elementor.php

246 lines 7.2 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/hero.php');
146 require_once('widgets/marquee-text.php');
147 require_once('widgets/portfolio.php');
148 require_once('widgets/progress-bar.php');
149 require_once('widgets/semi-circular-progress-bar.php');
150 require_once('widgets/slider.php');
151 require_once('widgets/split-hero.php');
152 require_once('widgets/team-member.php');
153 require_once('widgets/testimonial.php');
154
155 // Register widget
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() );
168
169 }
170
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>'
195 );
196
197 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
198
199 }
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
243 }
244
245 Borderless_Elementor::instance();
246