| 1 |
<?php |
| 2 |
|
| 3 |
namespace WpvrElement; |
| 4 |
|
| 5 |
use WpvrElement\Elements\Wpvr\Wpvr_Widget; |
| 6 |
|
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 9 |
|
| 10 |
/** |
| 11 |
* Main Plugin Class |
| 12 |
* |
| 13 |
* Register new elementor widget. |
| 14 |
* |
| 15 |
* @since 1.0.0 |
| 16 |
*/ |
| 17 |
class WpvrElementor { |
| 18 |
|
| 19 |
/** |
| 20 |
* Constructor |
| 21 |
* |
| 22 |
* @since 1.0.0 |
| 23 |
* |
| 24 |
* @access public |
| 25 |
*/ |
| 26 |
public function __construct() { |
| 27 |
$this->add_actions(); |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Add Actions |
| 32 |
* |
| 33 |
* @since 1.0.0 |
| 34 |
* |
| 35 |
* @access private |
| 36 |
*/ |
| 37 |
private function add_actions() { |
| 38 |
add_action( 'elementor/widgets/widgets_registered', [ $this, 'on_widgets_registered' ] ); |
| 39 |
|
| 40 |
//font css per icone |
| 41 |
add_action( 'elementor/editor/before_enqueue_scripts', function () { |
| 42 |
wp_enqueue_style( 'Wpvr-elementor',plugins_url( '../assets/admin.css', __FILE__ ) ); |
| 43 |
} ); |
| 44 |
|
| 45 |
add_action( 'elementor/frontend/after_register_scripts', function() { |
| 46 |
wp_register_script( 'Wpvr-elementor', 'script path', [ 'jquery' ], false, true ); |
| 47 |
} ); |
| 48 |
|
| 49 |
|
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* On Widgets Registered |
| 54 |
* |
| 55 |
* @since 1.0.0 |
| 56 |
* |
| 57 |
* @access public |
| 58 |
*/ |
| 59 |
public function on_widgets_registered() { |
| 60 |
$this->includes(); |
| 61 |
$this->register_widget(); |
| 62 |
} |
| 63 |
|
| 64 |
/** |
| 65 |
* Includes |
| 66 |
* |
| 67 |
* @since 1.0.0 |
| 68 |
* |
| 69 |
* @access private |
| 70 |
*/ |
| 71 |
private function includes() { |
| 72 |
/* |
| 73 |
* Return Wpvr widget file path |
| 74 |
* i.e. PATH.'elementor/elements/Wpvr-element.php' |
| 75 |
*/ |
| 76 |
require __DIR__.'/elements/Wpvr-widget.php'; |
| 77 |
} |
| 78 |
|
| 79 |
/** |
| 80 |
* Register Widget |
| 81 |
* |
| 82 |
* @since 1.0.0 |
| 83 |
* |
| 84 |
* @access private |
| 85 |
*/ |
| 86 |
private function register_widget() { |
| 87 |
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Wpvr_Widget() ); |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
new WpvrElementor(); |
| 92 |
|