| 1 |
<?php |
| 2 |
|
| 3 |
// don't load directly |
| 4 |
defined( 'ABSPATH' ) || exit; |
| 5 |
|
| 6 |
final class Borderless_Elementor { |
| 7 |
|
| 8 |
private static $_instance = null; |
| 9 |
|
| 10 |
public static function instance() { |
| 11 |
|
| 12 |
if ( is_null( self::$_instance ) ) { |
| 13 |
self::$_instance = new self(); |
| 14 |
} |
| 15 |
return self::$_instance; |
| 16 |
|
| 17 |
} |
| 18 |
|
| 19 |
public function __construct() { |
| 20 |
|
| 21 |
add_action( 'plugins_loaded', [ $this, 'on_plugins_loaded' ] ); |
| 22 |
|
| 23 |
} |
| 24 |
|
| 25 |
public function on_plugins_loaded() { |
| 26 |
|
| 27 |
if ( $this->is_compatible() ) { |
| 28 |
add_action( 'elementor/init', [ $this, 'init' ] ); |
| 29 |
} |
| 30 |
|
| 31 |
} |
| 32 |
|
| 33 |
public function is_compatible() { |
| 34 |
|
| 35 |
return true; |
| 36 |
|
| 37 |
} |
| 38 |
|
| 39 |
public function init() { |
| 40 |
|
| 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 |
// Add Plugin actions |
| 49 |
add_action( 'elementor/widgets/widgets_registered', [ $this, 'init_widgets' ] ); |
| 50 |
//add_action( 'elementor/controls/controls_registered', [ $this, 'init_controls' ] ); |
| 51 |
add_action( 'elementor/elements/categories_registered', [ $this, 'register_borderless_elementor_category' ] ); |
| 52 |
|
| 53 |
} |
| 54 |
|
| 55 |
public function init_widgets() { |
| 56 |
|
| 57 |
// Include Widget files |
| 58 |
require_once('helper.php'); |
| 59 |
require_once('widgets/contact-form-7.php'); |
| 60 |
//require_once('widgets/posts.php'); |
| 61 |
require_once('widgets/team-member.php'); |
| 62 |
require_once('widgets/testimonial.php'); |
| 63 |
|
| 64 |
// Register widget |
| 65 |
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Contact_Form_7() ); |
| 66 |
//\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Posts() ); |
| 67 |
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Team_Member() ); |
| 68 |
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Borderless\Widgets\Testimonial() ); |
| 69 |
|
| 70 |
} |
| 71 |
|
| 72 |
/* |
| 73 |
public function init_controls() { |
| 74 |
|
| 75 |
// Include Control files |
| 76 |
require_once( __DIR__ . '/controls/test-control.php' ); |
| 77 |
|
| 78 |
// Register control |
| 79 |
\Elementor\Plugin::$instance->controls_manager->register_control( 'control-type-', new \Test_Control() ); |
| 80 |
|
| 81 |
} |
| 82 |
*/ |
| 83 |
|
| 84 |
public function register_borderless_elementor_category( $elements_manager ) { |
| 85 |
$elements_manager->add_category( |
| 86 |
'borderless', |
| 87 |
[ |
| 88 |
'title' => __( 'Borderless', 'borderless' ), |
| 89 |
'icon' => 'fa fa-plug', |
| 90 |
] |
| 91 |
); |
| 92 |
} |
| 93 |
|
| 94 |
} |
| 95 |
|
| 96 |
Borderless_Elementor::instance(); |