PluginProbe
Post Grid Gutenberg Blocks – PostX / 2.2.5
Post Grid Gutenberg Blocks – PostX v2.2.5
5.0.41 5.0.39 5.0.38 5.0.37 5.0.36 5.0.35 5.0.34 5.0.33 5.0.32 5.0.31 5.0.30 5.0.29 5.0.28 5.0.27 5.0.26 5.0.25 5.0.23 5.0.24 5.0.22 5.0.21 5.0.20 5.0.19 5.0.18 5.0.17 2.1.1 All 238 releases
← All changes | addons/elementor/Elementor.php +29 -45 5.0.412.2.5 View file →
@@ -1,56 +1,40 @@
1 1 <?php
2 -defined( 'ABSPATH' ) || exit;
2 +defined('ABSPATH') || exit;
3 3
4 4 final class Elementor_ULTP_Extension {
5 5
6 - private static $_instance = null;
6 + private static $_instance = null;
7 7
8 - public static function instance() {
9 - if ( is_null( self::$_instance ) ) {
10 - self::$_instance = new self();
11 - }
12 - return self::$_instance;
13 - }
8 + public static function instance() {
9 + if ( is_null( self::$_instance ) ) {
10 + self::$_instance = new self();
11 + }
12 + return self::$_instance;
13 + }
14 14
15 - public function __construct() {
16 - $this->init();
17 - }
15 + public function __construct() {
16 + //add_action( 'plugins_loaded', array($this, 'init') );
17 + $this->init();
18 + }
18 19
19 - public function init() {
20 - add_action( 'elementor/widgets/register', array( $this, 'register_widgets' ) );
21 - add_action( 'elementor/frontend/before_enqueue_scripts', array( $this, 'widget_scripts' ) ); // after_register_scripts before_enqueue_scripts conflct with short code
22 - add_action( 'elementor/frontend/after_enqueue_styles', array( $this, 'widget_styles' ) );
23 - }
20 + public function init() {
21 + add_action( 'elementor/widgets/widgets_registered', [ $this, 'register_widgets' ] );
22 + add_action( 'elementor/frontend/after_register_scripts', [ $this, 'widget_scripts' ] );
23 + }
24 24
25 - public function widget_styles() {
26 - wp_register_style( 'ultp-style', ULTP_URL . 'assets/css/style.min.css', array(), ultimate_post()->get_setting( 'save_version' ) );
27 - wp_enqueue_style( 'ultp-style' );
28 - }
25 + public function widget_scripts() {
26 + $init = new \ULTP\ULTP_Initialization();
27 + $init->register_scripts_common();
28 + }
29 29
30 - public function widget_scripts() {
31 - wp_register_script( 'ultp-script', ULTP_URL . 'assets/js/ultp.min.js', array( 'jquery', 'wp-api-fetch' ), ultimate_post()->get_setting( 'save_version' ), true );
32 - wp_enqueue_script( 'ultp-script' );
33 - wp_localize_script(
34 - 'ultp-script',
35 - 'ultp_data_frontend',
36 - array(
37 - 'url' => ULTP_URL,
38 - 'active' => ultimate_post()->is_lc_active(),
39 - 'ultpSavedDLMode' => ultimate_post()->get_dl_mode(),
40 - 'ajax' => admin_url( 'admin-ajax.php' ),
41 - 'security' => wp_create_nonce( 'ultp-nonce' ),
42 - 'home_url' => home_url(),
43 - 'dark_logo' => get_option( 'ultp_site_dark_logo', false ),
44 - )
45 - );
46 - }
30 +
47 31
48 - public function includes() {
49 - require_once ULTP_PATH . 'addons/elementor/Elementor_Widget.php';
50 - }
32 + public function includes() {
33 + require_once ULTP_PATH.'addons/elementor/Elementor_Widget.php';
34 + }
51 35
52 - public function register_widgets() {
53 - $this->includes();
54 - \Elementor\Plugin::instance()->widgets_manager->register( new \Gutenberg_Post_Blocks_Widget() );
55 - }
56 -}
36 + public function register_widgets() {
37 + $this->includes();
38 + \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Gutenberg_Post_Blocks_Widget() );
39 + }
40 +}