| @@ -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,14 +61,12 @@ | ||
| 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 | - 'common-base', | |
| 82 | 68 | 'common', |
| 83 | - 'common-optimized', | |
| 84 | 69 | 'inner-section', |
| 85 | 70 | 'heading', |
| 86 | 71 | 'image', |
| 87 | 72 | 'text-editor', |
| @@ -111,8 +96,9 @@ | ||
| 111 | 96 | 'menu-anchor', |
| 112 | 97 | 'sidebar', |
| 113 | 98 | 'read-more', |
| 114 | 99 | 'rating', |
| 100 | + 'share-buttons', | |
| 115 | 101 | ]; |
| 116 | 102 | |
| 117 | 103 | $this->_widget_types = []; |
| 118 | 104 | |
| @@ -168,9 +154,9 @@ | ||
| 168 | 154 | * plugin authors can filter the black list. |
| 169 | 155 | * |
| 170 | 156 | * @since 2.0.0 |
| 171 | 157 | * @access private |
| 172 | - */ | |
| 158 | + */ | |
| 173 | 159 | private function register_wp_widgets() { |
| 174 | 160 | global $wp_widget_factory; |
| 175 | 161 | |
| 176 | 162 | // Allow themes/plugins to filter out their widgets. |
| @@ -209,9 +195,9 @@ | ||
| 209 | 195 | * Require Elementor widget base class. |
| 210 | 196 | * |
| 211 | 197 | * @since 2.0.0 |
| 212 | 198 | * @access private |
| 213 | - */ | |
| 199 | + */ | |
| 214 | 200 | private function require_files() { |
| 215 | 201 | require ELEMENTOR_PATH . 'includes/base/widget-base.php'; |
| 216 | 202 | } |
| 217 | 203 | |
| @@ -237,9 +223,9 @@ | ||
| 237 | 223 | * |
| 238 | 224 | * @param Widget_Base $widget Elementor widget. |
| 239 | 225 | * |
| 240 | 226 | * @return true True if the widget was registered. |
| 241 | - */ | |
| 227 | + */ | |
| 242 | 228 | public function register_widget_type( Widget_Base $widget ) { |
| 243 | 229 | Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( |
| 244 | 230 | __METHOD__, |
| 245 | 231 | '3.5.0', |
| @@ -307,9 +293,9 @@ | ||
| 307 | 293 | * |
| 308 | 294 | * @param string $name Widget name. |
| 309 | 295 | * |
| 310 | 296 | * @return true True if the widget was unregistered, False otherwise. |
| 311 | - */ | |
| 297 | + */ | |
| 312 | 298 | public function unregister_widget_type( $name ) { |
| 313 | 299 | Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( |
| 314 | 300 | __METHOD__, |
| 315 | 301 | '3.5.0', |
| @@ -351,9 +337,9 @@ | ||
| 351 | 337 | * |
| 352 | 338 | * @param string $widget_name Optional. Widget name. Default is null. |
| 353 | 339 | * |
| 354 | 340 | * @return Widget_Base|Widget_Base[]|null Registered widget types. |
| 355 | - */ | |
| 341 | + */ | |
| 356 | 342 | public function get_widget_types( $widget_name = null ) { |
| 357 | 343 | if ( is_null( $this->_widget_types ) ) { |
| 358 | 344 | $this->init_widgets(); |
| 359 | 345 | } |
| @@ -373,9 +359,9 @@ | ||
| 373 | 359 | * @since 1.0.0 |
| 374 | 360 | * @access public |
| 375 | 361 | * |
| 376 | 362 | * @return array Registered widget types with each widget config. |
| 377 | - */ | |
| 363 | + */ | |
| 378 | 364 | public function get_widget_types_config() { |
| 379 | 365 | $config = []; |
| 380 | 366 | |
| 381 | 367 | foreach ( $this->get_widget_types() as $widget_key => $widget ) { |
| @@ -385,9 +371,9 @@ | ||
| 385 | 371 | return $config; |
| 386 | 372 | } |
| 387 | 373 | |
| 388 | 374 | /** |
| 389 | - * @throws \Exception If current user don't have permissions to edit the post. | |
| 375 | + * @throws \Exception | |
| 390 | 376 | */ |
| 391 | 377 | public function ajax_get_widget_types_controls_config( array $data ) { |
| 392 | 378 | Plugin::$instance->documents->check_permissions( $data['editor_post_id'] ); |
| 393 | 379 | |
| @@ -493,9 +479,9 @@ | ||
| 493 | 479 | * |
| 494 | 480 | * @param array $request Ajax request. |
| 495 | 481 | * |
| 496 | 482 | * @return bool|string Rendered widget form. |
| 497 | - * @throws \Exception If current user don't have permissions to edit the post. | |
| 483 | + * @throws \Exception | |
| 498 | 484 | */ |
| 499 | 485 | public function ajax_get_wp_widget_form( $request ) { |
| 500 | 486 | Plugin::$instance->documents->check_permissions( $request['editor_post_id'] ); |
| 501 | 487 | |
| @@ -533,9 +519,9 @@ | ||
| 533 | 519 | * template, for all the registered widget types. |
| 534 | 520 | * |
| 535 | 521 | * @since 1.0.0 |
| 536 | 522 | * @access public |
| 537 | - */ | |
| 523 | + */ | |
| 538 | 524 | public function render_widgets_content() { |
| 539 | 525 | foreach ( $this->get_widget_types() as $widget ) { |
| 540 | 526 | $widget->print_template(); |
| 541 | 527 | } |
| @@ -550,9 +536,9 @@ | ||
| 550 | 536 | * @since 1.3.0 |
| 551 | 537 | * @access public |
| 552 | 538 | * |
| 553 | 539 | * @return array Registered widget types with settings keys for each widget. |
| 554 | - */ | |
| 540 | + */ | |
| 555 | 541 | public function get_widgets_frontend_settings_keys() { |
| 556 | 542 | $keys = []; |
| 557 | 543 | |
| 558 | 544 | foreach ( $this->get_widget_types() as $widget_type_name => $widget_type ) { |
| @@ -627,9 +613,9 @@ | ||
| 627 | 613 | * Enqueue all the scripts defined as a dependency for each widget. |
| 628 | 614 | * |
| 629 | 615 | * @since 1.3.0 |
| 630 | 616 | * @access public |
| 631 | - */ | |
| 617 | + */ | |
| 632 | 618 | public function enqueue_widgets_scripts() { |
| 633 | 619 | foreach ( $this->get_widget_types() as $widget ) { |
| 634 | 620 | $widget->enqueue_scripts(); |
| 635 | 621 | } |
| @@ -634,14 +620,8 @@ | ||
| 634 | 620 | $widget->enqueue_scripts(); |
| 635 | 621 | } |
| 636 | 622 | } |
| 637 | 623 | |
| 638 | - public function register_frontend_handlers() { | |
| 639 | - foreach ( $this->get_widget_types() as $widget ) { | |
| 640 | - $widget->register_frontend_handlers(); | |
| 641 | - } | |
| 642 | - } | |
| 643 | - | |
| 644 | 624 | /** |
| 645 | 625 | * Enqueue widgets styles |
| 646 | 626 | * |
| 647 | 627 | * Enqueue all the styles defined as a dependency for each widget |
| @@ -716,9 +696,9 @@ | ||
| 716 | 696 | * Initializing Elementor widgets manager. |
| 717 | 697 | * |
| 718 | 698 | * @since 1.0.0 |
| 719 | 699 | * @access public |
| 720 | - */ | |
| 700 | + */ | |
| 721 | 701 | public function __construct() { |
| 722 | 702 | $this->require_files(); |
| 723 | 703 | |
| 724 | 704 | add_action( 'elementor/ajax/register_actions', [ $this, 'register_ajax_actions' ] ); |
| @@ -744,13 +724,13 @@ | ||
| 744 | 724 | } ); |
| 745 | 725 | } |
| 746 | 726 | |
| 747 | 727 | /** |
| 748 | - * @param string $experiment_name | |
| 749 | - * @param array $classes | |
| 728 | + * @param $experiment_name | |
| 729 | + * @param $classes | |
| 750 | 730 | * @return void |
| 751 | 731 | */ |
| 752 | - public function register_promoted_active_widgets( string $experiment_name, array $classes ): void { | |
| 732 | + public function register_promoted_active_widgets( string $experiment_name, array $classes ) : void { | |
| 753 | 733 | if ( ! Plugin::$instance->experiments->is_feature_active( $experiment_name ) || empty( $classes ) ) { |
| 754 | 734 | return; |
| 755 | 735 | } |
| 756 | 736 | |