| 1 |
<?php |
| 2 |
namespace Elementor\Modules\DevTools; |
| 3 |
|
| 4 |
use Elementor\Core\Base\App; |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; // Exit if accessed directly. |
| 8 |
} |
| 9 |
|
| 10 |
/** |
| 11 |
* Fix issue with 'Potentially polymorphic call. The code may be inoperable depending on the actual class instance passed as the argument.'. |
| 12 |
* Its tells to the editor that instance() return right module. instead of base module. |
| 13 |
* |
| 14 |
* @method Module instance() |
| 15 |
*/ |
| 16 |
class Module extends App { |
| 17 |
/** |
| 18 |
* @var Deprecation |
| 19 |
*/ |
| 20 |
public $deprecation; |
| 21 |
|
| 22 |
public function __construct() { |
| 23 |
$this->deprecation = new Deprecation( ELEMENTOR_VERSION ); |
| 24 |
|
| 25 |
add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'register_scripts' ] ); |
| 26 |
add_action( 'admin_enqueue_scripts', [ $this, 'register_scripts' ] ); |
| 27 |
add_action( 'wp_enqueue_scripts', [ $this, 'register_scripts' ] ); |
| 28 |
add_action( 'elementor/frontend/after_register_scripts', [ $this, 'register_scripts' ] ); |
| 29 |
add_action( 'elementor/common/after_register_scripts', [ $this, 'register_scripts' ] ); |
| 30 |
} |
| 31 |
|
| 32 |
public function get_name() { |
| 33 |
return 'dev-tools'; |
| 34 |
} |
| 35 |
|
| 36 |
public function register_scripts() { |
| 37 |
wp_register_script( |
| 38 |
'elementor-dev-tools', |
| 39 |
$this->get_js_assets_url( 'dev-tools' ), |
| 40 |
[], |
| 41 |
ELEMENTOR_VERSION, |
| 42 |
true |
| 43 |
); |
| 44 |
|
| 45 |
$this->print_config( 'elementor-dev-tools' ); |
| 46 |
} |
| 47 |
|
| 48 |
protected function get_init_settings() { |
| 49 |
return [ |
| 50 |
'isDebug' => ( defined( 'WP_DEBUG' ) && WP_DEBUG ), |
| 51 |
'urls' => [ |
| 52 |
'assets' => ELEMENTOR_ASSETS_URL, |
| 53 |
], |
| 54 |
'deprecation' => $this->deprecation->get_settings(), |
| 55 |
]; |
| 56 |
} |
| 57 |
} |
| 58 |
|