PluginProbe
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress / 9.1.2
WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress v9.1.2
9.1.2 9.1.1 9.1.0 9.0.3 9.0.2 9.0.1 9.0.0 8.5.79 8.5.78 8.5.77 8.5.76 8.5.75 8.5.74 8.5.73 8.5.72 8.5.71 8.5.70 8.5.69 8.5.68 8.5.35 8.5.36 8.5.37 8.5.38 8.5.39 8.5.4 All 221 releases
wpvr / legacy / elementor / elementor.php

elementor.php in WPVR – 360 Panorama viewer and Virtual Tour Builder for WordPress 9.1.2, at legacy/elementor/elementor.php

102 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 // Elementor 3.5+ uses elementor/widgets/register; older versions use widgets_registered
39 if ( defined( 'ELEMENTOR_VERSION' ) && version_compare( ELEMENTOR_VERSION, '3.5.0', '>=' ) ) {
40 add_action( 'elementor/widgets/register', [ $this, 'on_widgets_registered' ] );
41 } else {
42 add_action( 'elementor/widgets/widgets_registered', [ $this, 'on_widgets_registered' ] );
43 }
44
45 //font css per icone
46 add_action( 'elementor/editor/before_enqueue_scripts', function () {
47 wp_enqueue_style( 'Wpvr-elementor',plugins_url( '../assets/admin.css', __FILE__ ) );
48 } );
49
50 add_action( 'elementor/frontend/after_register_scripts', function() {
51 wp_register_script( 'Wpvr-elementor', 'script path', [ 'jquery' ], false, true );
52 } );
53
54 }
55
56 /**
57 * On Widgets Registered
58 *
59 * @since 1.0.0
60 *
61 * @access public
62 */
63 public function on_widgets_registered() {
64 $this->includes();
65 $this->register_widget();
66 }
67
68 /**
69 * Includes
70 *
71 * @since 1.0.0
72 *
73 * @access private
74 */
75 private function includes() {
76 /*
77 * Return Wpvr widget file path
78 * i.e. PATH.'elementor/elements/Wpvr-element.php'
79 */
80 require __DIR__.'/elements/Wpvr-widget.php';
81 }
82
83 /**
84 * Register Widget
85 *
86 * @since 1.0.0
87 *
88 * @access private
89 */
90 private function register_widget() {
91 $widgets_manager = \Elementor\Plugin::instance()->widgets_manager;
92 // Elementor 3.5+ uses register(); older uses register_widget_type()
93 if ( method_exists( $widgets_manager, 'register' ) ) {
94 $widgets_manager->register( new Wpvr_Widget() );
95 } else {
96 $widgets_manager->register_widget_type( new Wpvr_Widget() );
97 }
98 }
99 }
100
101 new WpvrElementor();
102