| 1 |
<?php |
| 2 |
namespace Elementor\Modules\WebCli; |
| 3 |
|
| 4 |
use Elementor\Core\Base\App; |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; // Exit if accessed directly. |
| 8 |
} |
| 9 |
|
| 10 |
class Module extends App { |
| 11 |
|
| 12 |
public function get_name() { |
| 13 |
return 'web-cli'; |
| 14 |
} |
| 15 |
|
| 16 |
public function __construct() { |
| 17 |
add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'register_scripts' ] ); |
| 18 |
add_action( 'admin_enqueue_scripts', [ $this, 'register_scripts' ] ); |
| 19 |
add_action( 'wp_enqueue_scripts', [ $this, 'register_scripts' ] ); |
| 20 |
add_action( 'elementor/frontend/after_register_scripts', [ $this, 'register_scripts' ] ); |
| 21 |
} |
| 22 |
|
| 23 |
public function register_scripts() { |
| 24 |
wp_register_script( |
| 25 |
'elementor-web-cli', |
| 26 |
$this->get_js_assets_url( 'web-cli' ), |
| 27 |
[ |
| 28 |
'elementor-vendors-redux', |
| 29 |
'jquery', |
| 30 |
], |
| 31 |
ELEMENTOR_VERSION, |
| 32 |
true |
| 33 |
); |
| 34 |
|
| 35 |
$this->print_config( 'elementor-web-cli' ); |
| 36 |
} |
| 37 |
|
| 38 |
protected function get_init_settings() { |
| 39 |
return [ |
| 40 |
'isDebug' => ( defined( 'WP_DEBUG' ) && WP_DEBUG ), |
| 41 |
'urls' => [ |
| 42 |
'rest' => get_rest_url(), |
| 43 |
'assets' => ELEMENTOR_ASSETS_URL, |
| 44 |
], |
| 45 |
'nonce' => wp_create_nonce( 'wp_rest' ), |
| 46 |
'version' => ELEMENTOR_VERSION, |
| 47 |
]; |
| 48 |
} |
| 49 |
} |
| 50 |
|