| @@ -2,15 +2,10 @@ | ||
| 2 | 2 | namespace Elementor; |
| 3 | 3 | |
| 4 | 4 | use Elementor\Core\Common\Modules\Ajax\Module as Ajax; |
| 5 | 5 | use Elementor\Core\Utils\Collection; |
| 6 | +use Elementor\Core\Utils\Exceptions; | |
| 6 | 7 | use Elementor\Core\Utils\Force_Locale; |
| 7 | -use Elementor\Modules\AtomicWidgets\Elements\Atomic_Button\Atomic_Button; | |
| 8 | -use Elementor\Modules\AtomicWidgets\Elements\Atomic_Divider\Atomic_Divider; | |
| 9 | -use Elementor\Modules\AtomicWidgets\Elements\Atomic_Heading\Atomic_Heading; | |
| 10 | -use Elementor\Modules\AtomicWidgets\Elements\Atomic_Image\Atomic_Image; | |
| 11 | -use Elementor\Modules\AtomicWidgets\Elements\Atomic_Paragraph\Atomic_Paragraph; | |
| 12 | -use Elementor\Modules\AtomicWidgets\Elements\Atomic_Svg\Atomic_Svg; | |
| 13 | 8 | use Elementor\Modules\NestedAccordion\Widgets\Nested_Accordion; |
| 14 | 9 | use Elementor\Modules\NestedElements\Module as NestedElementsModule; |
| 15 | 10 | use Elementor\Modules\NestedTabs\Widgets\NestedTabs; |
| 16 | 11 | |
| @@ -56,16 +51,8 @@ | ||
| 56 | 51 | NestedElementsModule::EXPERIMENT_NAME => [ |
| 57 | 52 | NestedTabs::class, |
| 58 | 53 | Nested_Accordion::class, |
| 59 | 54 | ], |
| 60 | - 'atomic_widgets' => [ | |
| 61 | - Atomic_Heading::class, | |
| 62 | - Atomic_Image::class, | |
| 63 | - Atomic_Paragraph::class, | |
| 64 | - Atomic_Button::class, | |
| 65 | - Atomic_Svg::class, | |
| 66 | - Atomic_Divider::class, | |
| 67 | - ], | |
| 68 | 55 | ]; |
| 69 | 56 | |
| 70 | 57 | /** |
| 71 | 58 | * Init widgets. |
| @@ -74,9 +61,9 @@ | ||
| 74 | 61 | * and register each Elementor and WordPress widget. |
| 75 | 62 | * |
| 76 | 63 | * @since 2.0.0 |
| 77 | 64 | * @access private |
| 78 | - */ | |
| 65 | + */ | |
| 79 | 66 | private function init_widgets() { |
| 80 | 67 | $build_widgets_filename = [ |
| 81 | 68 | 'common-base', |
| 82 | 69 | 'common', |
| @@ -168,9 +155,9 @@ | ||
| 168 | 155 | * plugin authors can filter the black list. |
| 169 | 156 | * |
| 170 | 157 | * @since 2.0.0 |
| 171 | 158 | * @access private |
| 172 | - */ | |
| 159 | + */ | |
| 173 | 160 | private function register_wp_widgets() { |
| 174 | 161 | global $wp_widget_factory; |
| 175 | 162 | |
| 176 | 163 | // Allow themes/plugins to filter out their widgets. |
| @@ -209,9 +196,9 @@ | ||
| 209 | 196 | * Require Elementor widget base class. |
| 210 | 197 | * |
| 211 | 198 | * @since 2.0.0 |
| 212 | 199 | * @access private |
| 213 | - */ | |
| 200 | + */ | |
| 214 | 201 | private function require_files() { |
| 215 | 202 | require ELEMENTOR_PATH . 'includes/base/widget-base.php'; |
| 216 | 203 | } |
| 217 | 204 | |
| @@ -237,9 +224,9 @@ | ||
| 237 | 224 | * |
| 238 | 225 | * @param Widget_Base $widget Elementor widget. |
| 239 | 226 | * |
| 240 | 227 | * @return true True if the widget was registered. |
| 241 | - */ | |
| 228 | + */ | |
| 242 | 229 | public function register_widget_type( Widget_Base $widget ) { |
| 243 | 230 | Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( |
| 244 | 231 | __METHOD__, |
| 245 | 232 | '3.5.0', |
| @@ -307,9 +294,9 @@ | ||
| 307 | 294 | * |
| 308 | 295 | * @param string $name Widget name. |
| 309 | 296 | * |
| 310 | 297 | * @return true True if the widget was unregistered, False otherwise. |
| 311 | - */ | |
| 298 | + */ | |
| 312 | 299 | public function unregister_widget_type( $name ) { |
| 313 | 300 | Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( |
| 314 | 301 | __METHOD__, |
| 315 | 302 | '3.5.0', |
| @@ -351,9 +338,9 @@ | ||
| 351 | 338 | * |
| 352 | 339 | * @param string $widget_name Optional. Widget name. Default is null. |
| 353 | 340 | * |
| 354 | 341 | * @return Widget_Base|Widget_Base[]|null Registered widget types. |
| 355 | - */ | |
| 342 | + */ | |
| 356 | 343 | public function get_widget_types( $widget_name = null ) { |
| 357 | 344 | if ( is_null( $this->_widget_types ) ) { |
| 358 | 345 | $this->init_widgets(); |
| 359 | 346 | } |
| @@ -373,9 +360,9 @@ | ||
| 373 | 360 | * @since 1.0.0 |
| 374 | 361 | * @access public |
| 375 | 362 | * |
| 376 | 363 | * @return array Registered widget types with each widget config. |
| 377 | - */ | |
| 364 | + */ | |
| 378 | 365 | public function get_widget_types_config() { |
| 379 | 366 | $config = []; |
| 380 | 367 | |
| 381 | 368 | foreach ( $this->get_widget_types() as $widget_key => $widget ) { |
| @@ -385,9 +372,9 @@ | ||
| 385 | 372 | return $config; |
| 386 | 373 | } |
| 387 | 374 | |
| 388 | 375 | /** |
| 389 | - * @throws \Exception If current user don't have permissions to edit the post. | |
| 376 | + * @throws \Exception | |
| 390 | 377 | */ |
| 391 | 378 | public function ajax_get_widget_types_controls_config( array $data ) { |
| 392 | 379 | Plugin::$instance->documents->check_permissions( $data['editor_post_id'] ); |
| 393 | 380 | |
| @@ -493,9 +480,9 @@ | ||
| 493 | 480 | * |
| 494 | 481 | * @param array $request Ajax request. |
| 495 | 482 | * |
| 496 | 483 | * @return bool|string Rendered widget form. |
| 497 | - * @throws \Exception If current user don't have permissions to edit the post. | |
| 484 | + * @throws \Exception | |
| 498 | 485 | */ |
| 499 | 486 | public function ajax_get_wp_widget_form( $request ) { |
| 500 | 487 | Plugin::$instance->documents->check_permissions( $request['editor_post_id'] ); |
| 501 | 488 | |
| @@ -533,9 +520,9 @@ | ||
| 533 | 520 | * template, for all the registered widget types. |
| 534 | 521 | * |
| 535 | 522 | * @since 1.0.0 |
| 536 | 523 | * @access public |
| 537 | - */ | |
| 524 | + */ | |
| 538 | 525 | public function render_widgets_content() { |
| 539 | 526 | foreach ( $this->get_widget_types() as $widget ) { |
| 540 | 527 | $widget->print_template(); |
| 541 | 528 | } |
| @@ -550,9 +537,9 @@ | ||
| 550 | 537 | * @since 1.3.0 |
| 551 | 538 | * @access public |
| 552 | 539 | * |
| 553 | 540 | * @return array Registered widget types with settings keys for each widget. |
| 554 | - */ | |
| 541 | + */ | |
| 555 | 542 | public function get_widgets_frontend_settings_keys() { |
| 556 | 543 | $keys = []; |
| 557 | 544 | |
| 558 | 545 | foreach ( $this->get_widget_types() as $widget_type_name => $widget_type ) { |
| @@ -627,9 +614,9 @@ | ||
| 627 | 614 | * Enqueue all the scripts defined as a dependency for each widget. |
| 628 | 615 | * |
| 629 | 616 | * @since 1.3.0 |
| 630 | 617 | * @access public |
| 631 | - */ | |
| 618 | + */ | |
| 632 | 619 | public function enqueue_widgets_scripts() { |
| 633 | 620 | foreach ( $this->get_widget_types() as $widget ) { |
| 634 | 621 | $widget->enqueue_scripts(); |
| 635 | 622 | } |
| @@ -634,14 +621,8 @@ | ||
| 634 | 621 | $widget->enqueue_scripts(); |
| 635 | 622 | } |
| 636 | 623 | } |
| 637 | 624 | |
| 638 | - public function register_frontend_handlers() { | |
| 639 | - foreach ( $this->get_widget_types() as $widget ) { | |
| 640 | - $widget->register_frontend_handlers(); | |
| 641 | - } | |
| 642 | - } | |
| 643 | - | |
| 644 | 625 | /** |
| 645 | 626 | * Enqueue widgets styles |
| 646 | 627 | * |
| 647 | 628 | * Enqueue all the styles defined as a dependency for each widget |
| @@ -716,9 +697,9 @@ | ||
| 716 | 697 | * Initializing Elementor widgets manager. |
| 717 | 698 | * |
| 718 | 699 | * @since 1.0.0 |
| 719 | 700 | * @access public |
| 720 | - */ | |
| 701 | + */ | |
| 721 | 702 | public function __construct() { |
| 722 | 703 | $this->require_files(); |
| 723 | 704 | |
| 724 | 705 | add_action( 'elementor/ajax/register_actions', [ $this, 'register_ajax_actions' ] ); |
| @@ -744,13 +725,13 @@ | ||
| 744 | 725 | } ); |
| 745 | 726 | } |
| 746 | 727 | |
| 747 | 728 | /** |
| 748 | - * @param string $experiment_name | |
| 749 | - * @param array $classes | |
| 729 | + * @param $experiment_name | |
| 730 | + * @param $classes | |
| 750 | 731 | * @return void |
| 751 | 732 | */ |
| 752 | - public function register_promoted_active_widgets( string $experiment_name, array $classes ): void { | |
| 733 | + public function register_promoted_active_widgets( string $experiment_name, array $classes ) : void { | |
| 753 | 734 | if ( ! Plugin::$instance->experiments->is_feature_active( $experiment_name ) || empty( $classes ) ) { |
| 754 | 735 | return; |
| 755 | 736 | } |
| 756 | 737 | |