| @@ -1,9 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor\Core\Base; |
| 3 | 3 | |
| 4 | 4 | use Elementor\Plugin; |
| 5 | -use Elementor\Utils; | |
| 6 | 5 | |
| 7 | 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | 7 | exit; // Exit if accessed directly. |
| 9 | 8 | } |
| @@ -76,9 +75,9 @@ | ||
| 76 | 75 | * @since 1.7.0 |
| 77 | 76 | * @access public |
| 78 | 77 | * @static |
| 79 | 78 | * |
| 80 | - * @return $this An instance of the class. | |
| 79 | + * @return Module An instance of the class. | |
| 81 | 80 | */ |
| 82 | 81 | public static function instance() { |
| 83 | 82 | $class_name = static::class_name(); |
| 84 | 83 | |
| @@ -126,13 +125,10 @@ | ||
| 126 | 125 | * @since 1.7.0 |
| 127 | 126 | * @access public |
| 128 | 127 | */ |
| 129 | 128 | 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 | - ); | |
| 129 | + // Cloning instances of the class is forbidden | |
| 130 | + _doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'elementor' ), '1.0.0' ); | |
| 135 | 131 | } |
| 136 | 132 | |
| 137 | 133 | /** |
| 138 | 134 | * Wakeup. |
| @@ -142,13 +138,10 @@ | ||
| 142 | 138 | * @since 1.7.0 |
| 143 | 139 | * @access public |
| 144 | 140 | */ |
| 145 | 141 | 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 | - ); | |
| 142 | + // Unserializing instances of the class is forbidden | |
| 143 | + _doing_it_wrong( __FUNCTION__, esc_html__( 'Something went wrong.', 'elementor' ), '1.0.0' ); | |
| 151 | 144 | } |
| 152 | 145 | |
| 153 | 146 | /** |
| 154 | 147 | * @since 2.0.0 |
| @@ -223,9 +216,9 @@ | ||
| 223 | 216 | final protected function get_assets_url( $file_name, $file_extension, $relative_url = null, $add_min_suffix = 'default' ) { |
| 224 | 217 | static $is_test_mode = null; |
| 225 | 218 | |
| 226 | 219 | if ( null === $is_test_mode ) { |
| 227 | - $is_test_mode = Utils::is_script_debug() || Utils::is_elementor_tests(); | |
| 220 | + $is_test_mode = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || defined( 'ELEMENTOR_TESTS' ) && ELEMENTOR_TESTS; | |
| 228 | 221 | } |
| 229 | 222 | |
| 230 | 223 | if ( ! $relative_url ) { |
| 231 | 224 | $relative_url = $this->get_assets_relative_url() . $file_extension . '/'; |
| @@ -268,9 +261,9 @@ | ||
| 268 | 261 | * |
| 269 | 262 | * @param string $file_name |
| 270 | 263 | * @param string $relative_url Optional. Default is null. |
| 271 | 264 | * @param string $add_min_suffix Optional. Default is 'default'. |
| 272 | - * @param bool $add_direction_suffix Optional. Default is `false`. | |
| 265 | + * @param bool $add_direction_suffix Optional. Default is `false` | |
| 273 | 266 | * |
| 274 | 267 | * @return string |
| 275 | 268 | */ |
| 276 | 269 | final protected function get_css_assets_url( $file_name, $relative_url = null, $add_min_suffix = 'default', $add_direction_suffix = false ) { |
| @@ -287,27 +280,8 @@ | ||
| 287 | 280 | return $this->get_assets_url( $file_name, 'css', $relative_url, $add_min_suffix ); |
| 288 | 281 | } |
| 289 | 282 | |
| 290 | 283 | /** |
| 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 | 284 | * Get assets base url |
| 311 | 285 | * |
| 312 | 286 | * @since 2.6.0 |
| 313 | 287 | * @access protected |
| @@ -347,12 +321,12 @@ | ||
| 347 | 321 | |
| 348 | 322 | foreach ( $this->get_widgets() as $widget ) { |
| 349 | 323 | $class_name = $this->get_reflection()->getNamespaceName() . '\Widgets\\' . $widget; |
| 350 | 324 | |
| 351 | - $widget_manager->register( new $class_name() ); | |
| 325 | + $widget_manager->register_widget_type( new $class_name() ); | |
| 352 | 326 | } |
| 353 | 327 | } |
| 354 | 328 | |
| 355 | 329 | public function __construct() { |
| 356 | - add_action( 'elementor/widgets/register', [ $this, 'init_widgets' ] ); | |
| 330 | + add_action( 'elementor/widgets/widgets_registered', [ $this, 'init_widgets' ] ); | |
| 357 | 331 | } |
| 358 | 332 | } |