| @@ -1,10 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor\Core\Base; |
| 3 | 3 | |
| 4 | -use Elementor\Plugin; | |
| 5 | -use Elementor\Utils; | |
| 6 | - | |
| 7 | 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | 5 | exit; // Exit if accessed directly. |
| 9 | 6 | } |
| 10 | 7 | |
| @@ -76,9 +73,9 @@ | ||
| 76 | 73 | * @since 1.7.0 |
| 77 | 74 | * @access public |
| 78 | 75 | * @static |
| 79 | 76 | * |
| 80 | - * @return $this An instance of the class. | |
| 77 | + * @return Module An instance of the class. | |
| 81 | 78 | */ |
| 82 | 79 | public static function instance() { |
| 83 | 80 | $class_name = static::class_name(); |
| 84 | 81 | |
| @@ -126,13 +123,10 @@ | ||
| 126 | 123 | * @since 1.7.0 |
| 127 | 124 | * @access public |
| 128 | 125 | */ |
| 129 | 126 | public function __clone() { |
| 130 | - _doing_it_wrong( | |
| 131 | - __FUNCTION__, | |
| 132 | - sprintf( 'Cloning instances of the singleton "%s" class is forbidden.', get_class( $this ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 133 | - '1.0.0' | |
| 134 | - ); | |
| 127 | + // Cloning instances of the class is forbidden | |
| 128 | + _doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'elementor' ), '1.0.0' ); | |
| 135 | 129 | } |
| 136 | 130 | |
| 137 | 131 | /** |
| 138 | 132 | * Wakeup. |
| @@ -142,13 +136,10 @@ | ||
| 142 | 136 | * @since 1.7.0 |
| 143 | 137 | * @access public |
| 144 | 138 | */ |
| 145 | 139 | public function __wakeup() { |
| 146 | - _doing_it_wrong( | |
| 147 | - __FUNCTION__, | |
| 148 | - sprintf( 'Unserializing instances of the singleton "%s" class is forbidden.', get_class( $this ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 149 | - '1.0.0' | |
| 150 | - ); | |
| 140 | + // Unserializing instances of the class is forbidden | |
| 141 | + _doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'elementor' ), '1.0.0' ); | |
| 151 | 142 | } |
| 152 | 143 | |
| 153 | 144 | /** |
| 154 | 145 | * @since 2.0.0 |
| @@ -223,9 +214,9 @@ | ||
| 223 | 214 | final protected function get_assets_url( $file_name, $file_extension, $relative_url = null, $add_min_suffix = 'default' ) { |
| 224 | 215 | static $is_test_mode = null; |
| 225 | 216 | |
| 226 | 217 | if ( null === $is_test_mode ) { |
| 227 | - $is_test_mode = Utils::is_script_debug() || Utils::is_elementor_tests(); | |
| 218 | + $is_test_mode = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || defined( 'ELEMENTOR_TESTS' ) && ELEMENTOR_TESTS; | |
| 228 | 219 | } |
| 229 | 220 | |
| 230 | 221 | if ( ! $relative_url ) { |
| 231 | 222 | $relative_url = $this->get_assets_relative_url() . $file_extension . '/'; |
| @@ -268,9 +259,9 @@ | ||
| 268 | 259 | * |
| 269 | 260 | * @param string $file_name |
| 270 | 261 | * @param string $relative_url Optional. Default is null. |
| 271 | 262 | * @param string $add_min_suffix Optional. Default is 'default'. |
| 272 | - * @param bool $add_direction_suffix Optional. Default is `false`. | |
| 263 | + * @param bool $add_direction_suffix Optional. Default is `false` | |
| 273 | 264 | * |
| 274 | 265 | * @return string |
| 275 | 266 | */ |
| 276 | 267 | final protected function get_css_assets_url( $file_name, $relative_url = null, $add_min_suffix = 'default', $add_direction_suffix = false ) { |
| @@ -287,27 +278,8 @@ | ||
| 287 | 278 | return $this->get_assets_url( $file_name, 'css', $relative_url, $add_min_suffix ); |
| 288 | 279 | } |
| 289 | 280 | |
| 290 | 281 | /** |
| 291 | - * Get Frontend File URL | |
| 292 | - * | |
| 293 | - * Returns the URL for the CSS file to be loaded in the front end. If requested via the second parameter, a custom | |
| 294 | - * file is generated based on a passed template file name. Otherwise, the URL for the default CSS file is returned. | |
| 295 | - * | |
| 296 | - * @since 3.24.0 | |
| 297 | - * | |
| 298 | - * @access public | |
| 299 | - * | |
| 300 | - * @param string $file_name | |
| 301 | - * @param boolean $has_custom_breakpoints | |
| 302 | - * | |
| 303 | - * @return string frontend file URL | |
| 304 | - */ | |
| 305 | - public function get_frontend_file_url( $file_name, $has_custom_breakpoints ) { | |
| 306 | - return Plugin::$instance->frontend->get_frontend_file_url( $file_name, $has_custom_breakpoints ); | |
| 307 | - } | |
| 308 | - | |
| 309 | - /** | |
| 310 | 282 | * Get assets base url |
| 311 | 283 | * |
| 312 | 284 | * @since 2.6.0 |
| 313 | 285 | * @access protected |
| @@ -327,32 +299,6 @@ | ||
| 327 | 299 | * @return string |
| 328 | 300 | */ |
| 329 | 301 | protected function get_assets_relative_url() { |
| 330 | 302 | return 'assets/'; |
| 331 | - } | |
| 332 | - | |
| 333 | - /** | |
| 334 | - * Get the module's associated widgets. | |
| 335 | - * | |
| 336 | - * @return string[] | |
| 337 | - */ | |
| 338 | - protected function get_widgets() { | |
| 339 | - return []; | |
| 340 | - } | |
| 341 | - | |
| 342 | - /** | |
| 343 | - * Initialize the module related widgets. | |
| 344 | - */ | |
| 345 | - public function init_widgets() { | |
| 346 | - $widget_manager = Plugin::instance()->widgets_manager; | |
| 347 | - | |
| 348 | - foreach ( $this->get_widgets() as $widget ) { | |
| 349 | - $class_name = $this->get_reflection()->getNamespaceName() . '\Widgets\\' . $widget; | |
| 350 | - | |
| 351 | - $widget_manager->register( new $class_name() ); | |
| 352 | - } | |
| 353 | - } | |
| 354 | - | |
| 355 | - public function __construct() { | |
| 356 | - add_action( 'elementor/widgets/register', [ $this, 'init_widgets' ] ); | |
| 357 | 303 | } |
| 358 | 304 | } |