| @@ -1,19 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor; |
| 3 | 3 | |
| 4 | 4 | use Elementor\Core\Common\Modules\Ajax\Module as Ajax; |
| 5 | -use Elementor\Core\Utils\Collection; | |
| 6 | -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 | -use Elementor\Modules\NestedAccordion\Widgets\Nested_Accordion; | |
| 14 | -use Elementor\Modules\NestedElements\Module as NestedElementsModule; | |
| 15 | -use Elementor\Modules\NestedTabs\Widgets\NestedTabs; | |
| 5 | +use Elementor\Core\Utils\Exceptions; | |
| 16 | 6 | |
| 17 | 7 | if ( ! defined( 'ABSPATH' ) ) { |
| 18 | 8 | exit; // Exit if accessed directly. |
| 19 | 9 | } |
| @@ -40,48 +30,19 @@ | ||
| 40 | 30 | */ |
| 41 | 31 | private $_widget_types = null; |
| 42 | 32 | |
| 43 | 33 | /** |
| 44 | - * Promoted widget types. | |
| 45 | - * | |
| 46 | - * Holds the list of all the Promoted widget types. | |
| 47 | - * | |
| 48 | - * @since 3.15.0 | |
| 49 | - * @access private | |
| 50 | - * | |
| 51 | - * @var Widget_Base[] | |
| 52 | - * | |
| 53 | - * @return array | |
| 54 | - */ | |
| 55 | - private array $promoted_widgets = [ | |
| 56 | - NestedElementsModule::EXPERIMENT_NAME => [ | |
| 57 | - NestedTabs::class, | |
| 58 | - Nested_Accordion::class, | |
| 59 | - ], | |
| 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 | - ]; | |
| 69 | - | |
| 70 | - /** | |
| 71 | 34 | * Init widgets. |
| 72 | 35 | * |
| 73 | - * Initialize Elementor widgets manager. Include all the widgets files | |
| 36 | + * Initialize Elementor widgets manager. Include all the the widgets files | |
| 74 | 37 | * and register each Elementor and WordPress widget. |
| 75 | 38 | * |
| 76 | 39 | * @since 2.0.0 |
| 77 | 40 | * @access private |
| 78 | - */ | |
| 41 | + */ | |
| 79 | 42 | private function init_widgets() { |
| 80 | 43 | $build_widgets_filename = [ |
| 81 | - 'common-base', | |
| 82 | 44 | 'common', |
| 83 | - 'common-optimized', | |
| 84 | 45 | 'inner-section', |
| 85 | 46 | 'heading', |
| 86 | 47 | 'image', |
| 87 | 48 | 'text-editor', |
| @@ -110,17 +71,14 @@ | ||
| 110 | 71 | 'html', |
| 111 | 72 | 'menu-anchor', |
| 112 | 73 | 'sidebar', |
| 113 | 74 | 'read-more', |
| 114 | - 'rating', | |
| 115 | 75 | ]; |
| 116 | 76 | |
| 117 | 77 | $this->_widget_types = []; |
| 118 | 78 | |
| 119 | - $this->register_promoted_widgets(); | |
| 120 | - | |
| 121 | 79 | foreach ( $build_widgets_filename as $widget_filename ) { |
| 122 | - include ELEMENTOR_PATH . 'includes/widgets/' . $widget_filename . '.php'; | |
| 80 | + include( ELEMENTOR_PATH . 'includes/widgets/' . $widget_filename . '.php' ); | |
| 123 | 81 | |
| 124 | 82 | $class_name = str_replace( '-', '_', $widget_filename ); |
| 125 | 83 | |
| 126 | 84 | $class_name = __NAMESPACE__ . '\Widget_' . $class_name; |
| @@ -139,15 +97,18 @@ | ||
| 139 | 97 | * @deprecated 3.5.0 Use `elementor/widgets/register` hook instead. |
| 140 | 98 | * |
| 141 | 99 | * @param Widgets_Manager $this The widgets manager. |
| 142 | 100 | */ |
| 143 | - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->do_deprecated_action( | |
| 144 | - 'elementor/widgets/widgets_registered', | |
| 145 | - [ $this ], | |
| 146 | - '3.5.0', | |
| 147 | - 'elementor/widgets/register' | |
| 148 | - ); | |
| 101 | + // TODO: Uncomment when Pro uses the new hook. | |
| 102 | + //Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->do_deprecated_action( | |
| 103 | + // 'elementor/widgets/widgets_registered', | |
| 104 | + // [ $this ], | |
| 105 | + // '3.5.0', | |
| 106 | + // 'elementor/widgets/register' | |
| 107 | + //); | |
| 149 | 108 | |
| 109 | + do_action( 'elementor/widgets/widgets_registered', $this ); | |
| 110 | + | |
| 150 | 111 | /** |
| 151 | 112 | * After widgets registered. |
| 152 | 113 | * |
| 153 | 114 | * Fires after Elementor widgets are registered. |
| @@ -168,12 +129,27 @@ | ||
| 168 | 129 | * plugin authors can filter the black list. |
| 169 | 130 | * |
| 170 | 131 | * @since 2.0.0 |
| 171 | 132 | * @access private |
| 172 | - */ | |
| 133 | + */ | |
| 173 | 134 | private function register_wp_widgets() { |
| 174 | 135 | global $wp_widget_factory; |
| 175 | 136 | |
| 137 | + // Skip Pojo widgets. | |
| 138 | + $pojo_allowed_widgets = [ | |
| 139 | + 'Pojo_Widget_Recent_Posts', | |
| 140 | + 'Pojo_Widget_Posts_Group', | |
| 141 | + 'Pojo_Widget_Gallery', | |
| 142 | + 'Pojo_Widget_Recent_Galleries', | |
| 143 | + 'Pojo_Slideshow_Widget', | |
| 144 | + 'Pojo_Forms_Widget', | |
| 145 | + 'Pojo_Widget_News_Ticker', | |
| 146 | + | |
| 147 | + 'Pojo_Widget_WC_Products', | |
| 148 | + 'Pojo_Widget_WC_Products_Category', | |
| 149 | + 'Pojo_Widget_WC_Product_Categories', | |
| 150 | + ]; | |
| 151 | + | |
| 176 | 152 | // Allow themes/plugins to filter out their widgets. |
| 177 | 153 | $black_list = []; |
| 178 | 154 | |
| 179 | 155 | /** |
| @@ -192,8 +168,12 @@ | ||
| 192 | 168 | if ( in_array( $widget_class, $black_list ) ) { |
| 193 | 169 | continue; |
| 194 | 170 | } |
| 195 | 171 | |
| 172 | + if ( $widget_obj instanceof \Pojo_Widget_Base && ! in_array( $widget_class, $pojo_allowed_widgets ) ) { | |
| 173 | + continue; | |
| 174 | + } | |
| 175 | + | |
| 196 | 176 | $elementor_widget_class = __NAMESPACE__ . '\Widget_WordPress'; |
| 197 | 177 | |
| 198 | 178 | $this->register( |
| 199 | 179 | new $elementor_widget_class( [], [ |
| @@ -209,24 +189,13 @@ | ||
| 209 | 189 | * Require Elementor widget base class. |
| 210 | 190 | * |
| 211 | 191 | * @since 2.0.0 |
| 212 | 192 | * @access private |
| 213 | - */ | |
| 193 | + */ | |
| 214 | 194 | private function require_files() { |
| 215 | 195 | require ELEMENTOR_PATH . 'includes/base/widget-base.php'; |
| 216 | 196 | } |
| 217 | 197 | |
| 218 | - private function pluck_default_controls( $controls ) { | |
| 219 | - return ( new Collection( $controls ) ) | |
| 220 | - ->reduce( function ( $controls_defaults, $control, $control_key ) { | |
| 221 | - if ( ! empty( $control['default'] ) ) { | |
| 222 | - $controls_defaults[ $control_key ]['default'] = $control['default']; | |
| 223 | - } | |
| 224 | - | |
| 225 | - return $controls_defaults; | |
| 226 | - }, [] ); | |
| 227 | - } | |
| 228 | - | |
| 229 | 198 | /** |
| 230 | 199 | * Register widget type. |
| 231 | 200 | * |
| 232 | 201 | * Add a new widget type to the list of registered widget types. |
| @@ -232,20 +201,21 @@ | ||
| 232 | 201 | * Add a new widget type to the list of registered widget types. |
| 233 | 202 | * |
| 234 | 203 | * @since 1.0.0 |
| 235 | 204 | * @access public |
| 236 | - * @deprecated 3.5.0 Use `register()` method instead. | |
| 205 | + * @deprecated 3.5.0 Use `$this->register()` instead. | |
| 237 | 206 | * |
| 238 | 207 | * @param Widget_Base $widget Elementor widget. |
| 239 | 208 | * |
| 240 | 209 | * @return true True if the widget was registered. |
| 241 | - */ | |
| 210 | + */ | |
| 242 | 211 | public function register_widget_type( Widget_Base $widget ) { |
| 243 | - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( | |
| 244 | - __METHOD__, | |
| 245 | - '3.5.0', | |
| 246 | - 'register()' | |
| 247 | - ); | |
| 212 | + // TODO: Uncomment when Pro uses the new hook. | |
| 213 | + //Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( | |
| 214 | + // __METHOD__, | |
| 215 | + // '3.5.0', | |
| 216 | + // 'register' | |
| 217 | + //); | |
| 248 | 218 | |
| 249 | 219 | return $this->register( $widget ); |
| 250 | 220 | } |
| 251 | 221 | |
| @@ -253,11 +223,12 @@ | ||
| 253 | 223 | * Register a new widget type. |
| 254 | 224 | * |
| 255 | 225 | * @param \Elementor\Widget_Base $widget_instance Elementor Widget. |
| 256 | 226 | * |
| 257 | - * @return bool True if the widget was registered. | |
| 227 | + * @return true True if the widget was registered. | |
| 258 | 228 | * @since 3.5.0 |
| 259 | 229 | * @access public |
| 230 | + * | |
| 260 | 231 | */ |
| 261 | 232 | public function register( Widget_Base $widget_instance ) { |
| 262 | 233 | if ( is_null( $this->_widget_types ) ) { |
| 263 | 234 | $this->init_widgets(); |
| @@ -262,41 +233,13 @@ | ||
| 262 | 233 | if ( is_null( $this->_widget_types ) ) { |
| 263 | 234 | $this->init_widgets(); |
| 264 | 235 | } |
| 265 | 236 | |
| 266 | - /** | |
| 267 | - * Should widget be registered. | |
| 268 | - * | |
| 269 | - * @since 3.18.0 | |
| 270 | - * | |
| 271 | - * @param bool $should_register Should widget be registered. Default is `true`. | |
| 272 | - * @param \Elementor\Widget_Base $widget_instance Widget instance. | |
| 273 | - */ | |
| 274 | - $should_register = apply_filters( 'elementor/widgets/is_widget_enabled', true, $widget_instance ); | |
| 275 | - | |
| 276 | - if ( ! $should_register ) { | |
| 277 | - return false; | |
| 278 | - } | |
| 279 | - | |
| 280 | 237 | $this->_widget_types[ $widget_instance->get_name() ] = $widget_instance; |
| 281 | 238 | |
| 282 | 239 | return true; |
| 283 | 240 | } |
| 284 | 241 | |
| 285 | - /** Register promoted widgets | |
| 286 | - * | |
| 287 | - * Since we cannot allow widgets to place themselves is a specific | |
| 288 | - * location on our widgets panel we need to use a hard coded solution for this. | |
| 289 | - * | |
| 290 | - * @return void | |
| 291 | - */ | |
| 292 | - private function register_promoted_widgets() { | |
| 293 | - | |
| 294 | - foreach ( $this->promoted_widgets as $experiment_name => $classes ) { | |
| 295 | - $this->register_promoted_active_widgets( $experiment_name, $classes ); | |
| 296 | - } | |
| 297 | - } | |
| 298 | - | |
| 299 | 242 | /** |
| 300 | 243 | * Unregister widget type. |
| 301 | 244 | * |
| 302 | 245 | * Removes widget type from the list of registered widget types. |
| @@ -302,20 +245,21 @@ | ||
| 302 | 245 | * Removes widget type from the list of registered widget types. |
| 303 | 246 | * |
| 304 | 247 | * @since 1.0.0 |
| 305 | 248 | * @access public |
| 306 | - * @deprecated 3.5.0 Use `unregister()` method instead. | |
| 249 | + * @deprecated 3.5.0 Use `$this->unregister()` instead. | |
| 307 | 250 | * |
| 308 | 251 | * @param string $name Widget name. |
| 309 | 252 | * |
| 310 | 253 | * @return true True if the widget was unregistered, False otherwise. |
| 311 | - */ | |
| 254 | + */ | |
| 312 | 255 | public function unregister_widget_type( $name ) { |
| 313 | - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( | |
| 314 | - __METHOD__, | |
| 315 | - '3.5.0', | |
| 316 | - 'unregister()' | |
| 317 | - ); | |
| 256 | + // TODO: Uncomment when Pro uses the new hook. | |
| 257 | + //Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( | |
| 258 | + // __METHOD__, | |
| 259 | + // '3.5.0', | |
| 260 | + // 'unregister' | |
| 261 | + //); | |
| 318 | 262 | |
| 319 | 263 | return $this->unregister( $name ); |
| 320 | 264 | } |
| 321 | 265 | |
| @@ -351,9 +295,9 @@ | ||
| 351 | 295 | * |
| 352 | 296 | * @param string $widget_name Optional. Widget name. Default is null. |
| 353 | 297 | * |
| 354 | 298 | * @return Widget_Base|Widget_Base[]|null Registered widget types. |
| 355 | - */ | |
| 299 | + */ | |
| 356 | 300 | public function get_widget_types( $widget_name = null ) { |
| 357 | 301 | if ( is_null( $this->_widget_types ) ) { |
| 358 | 302 | $this->init_widgets(); |
| 359 | 303 | } |
| @@ -373,9 +317,9 @@ | ||
| 373 | 317 | * @since 1.0.0 |
| 374 | 318 | * @access public |
| 375 | 319 | * |
| 376 | 320 | * @return array Registered widget types with each widget config. |
| 377 | - */ | |
| 321 | + */ | |
| 378 | 322 | public function get_widget_types_config() { |
| 379 | 323 | $config = []; |
| 380 | 324 | |
| 381 | 325 | foreach ( $this->get_widget_types() as $widget_key => $widget ) { |
| @@ -384,16 +328,9 @@ | ||
| 384 | 328 | |
| 385 | 329 | return $config; |
| 386 | 330 | } |
| 387 | 331 | |
| 388 | - /** | |
| 389 | - * @throws \Exception If current user don't have permissions to edit the post. | |
| 390 | - */ | |
| 391 | 332 | public function ajax_get_widget_types_controls_config( array $data ) { |
| 392 | - Plugin::$instance->documents->check_permissions( $data['editor_post_id'] ); | |
| 393 | - | |
| 394 | - wp_raise_memory_limit( 'admin' ); | |
| 395 | - | |
| 396 | 333 | $config = []; |
| 397 | 334 | |
| 398 | 335 | foreach ( $this->get_widget_types() as $widget_key => $widget ) { |
| 399 | 336 | if ( isset( $data['exclude'][ $widget_key ] ) ) { |
| @@ -409,61 +346,8 @@ | ||
| 409 | 346 | return $config; |
| 410 | 347 | } |
| 411 | 348 | |
| 412 | 349 | /** |
| 413 | - * @throws \Exception If current user don't have permissions to edit the post. | |
| 414 | - */ | |
| 415 | - public function ajax_refresh_widgets_config( array $data ) { | |
| 416 | - Plugin::$instance->documents->check_permissions( $data['editor_post_id'] ); | |
| 417 | - | |
| 418 | - wp_raise_memory_limit( 'admin' ); | |
| 419 | - | |
| 420 | - $widgets = []; | |
| 421 | - | |
| 422 | - foreach ( $this->get_widget_types() as $widget_key => $widget ) { | |
| 423 | - $widget_config = $widget->get_config(); | |
| 424 | - | |
| 425 | - // get_config() omits controls when the stack isn't initialized yet (see Widget_Base::get_initial_config). | |
| 426 | - // During an AJAX refresh the instances are fresh, so we force-initialize and merge them explicitly. | |
| 427 | - $widget_config['controls'] = $widget->get_stack( false )['controls']; | |
| 428 | - $widget_config['tabs_controls'] = $widget->get_tabs_controls(); | |
| 429 | - | |
| 430 | - $widgets[ $widget_key ] = $widget_config; | |
| 431 | - } | |
| 432 | - | |
| 433 | - return [ | |
| 434 | - 'widgets' => $widgets, | |
| 435 | - 'categories' => Plugin::$instance->elements_manager->get_categories(), | |
| 436 | - ]; | |
| 437 | - } | |
| 438 | - | |
| 439 | - public function ajax_get_widgets_default_value_translations( array $data = [] ) { | |
| 440 | - $locale = empty( $data['locale'] ) | |
| 441 | - ? get_locale() | |
| 442 | - : $data['locale']; | |
| 443 | - | |
| 444 | - $force_locale = new Force_Locale( $locale ); | |
| 445 | - $force_locale->force(); | |
| 446 | - | |
| 447 | - $controls = ( new Collection( $this->get_widget_types() ) ) | |
| 448 | - ->map( function ( Widget_Base $widget ) { | |
| 449 | - $controls = $widget->get_stack( false )['controls']; | |
| 450 | - | |
| 451 | - return [ | |
| 452 | - 'controls' => $this->pluck_default_controls( $controls ), | |
| 453 | - ]; | |
| 454 | - } ) | |
| 455 | - ->filter( function ( $widget ) { | |
| 456 | - return ! empty( $widget['controls'] ); | |
| 457 | - } ) | |
| 458 | - ->all(); | |
| 459 | - | |
| 460 | - $force_locale->restore(); | |
| 461 | - | |
| 462 | - return $controls; | |
| 463 | - } | |
| 464 | - | |
| 465 | - /** | |
| 466 | 350 | * Ajax render widget. |
| 467 | 351 | * |
| 468 | 352 | * Ajax handler for Elementor render_widget. |
| 469 | 353 | * |
| @@ -482,10 +366,14 @@ | ||
| 482 | 366 | * @type string $render The rendered HTML. |
| 483 | 367 | * } |
| 484 | 368 | */ |
| 485 | 369 | public function ajax_render_widget( $request ) { |
| 486 | - $document = Plugin::$instance->documents->get_with_permissions( $request['editor_post_id'] ); | |
| 370 | + $document = Plugin::$instance->documents->get( $request['editor_post_id'] ); | |
| 487 | 371 | |
| 372 | + if ( ! $document->is_editable_by_current_user() ) { | |
| 373 | + throw new \Exception( 'Access denied.', Exceptions::FORBIDDEN ); | |
| 374 | + } | |
| 375 | + | |
| 488 | 376 | // Override the global $post for the render. |
| 489 | 377 | query_posts( |
| 490 | 378 | [ |
| 491 | 379 | 'p' => $request['editor_post_id'], |
| @@ -520,13 +408,10 @@ | ||
| 520 | 408 | * |
| 521 | 409 | * @param array $request Ajax request. |
| 522 | 410 | * |
| 523 | 411 | * @return bool|string Rendered widget form. |
| 524 | - * @throws \Exception If current user don't have permissions to edit the post. | |
| 525 | 412 | */ |
| 526 | 413 | public function ajax_get_wp_widget_form( $request ) { |
| 527 | - Plugin::$instance->documents->check_permissions( $request['editor_post_id'] ); | |
| 528 | - | |
| 529 | 414 | if ( empty( $request['widget_type'] ) ) { |
| 530 | 415 | return false; |
| 531 | 416 | } |
| 532 | 417 | |
| @@ -560,9 +445,9 @@ | ||
| 560 | 445 | * template, for all the registered widget types. |
| 561 | 446 | * |
| 562 | 447 | * @since 1.0.0 |
| 563 | 448 | * @access public |
| 564 | - */ | |
| 449 | + */ | |
| 565 | 450 | public function render_widgets_content() { |
| 566 | 451 | foreach ( $this->get_widget_types() as $widget ) { |
| 567 | 452 | $widget->print_template(); |
| 568 | 453 | } |
| @@ -577,9 +462,9 @@ | ||
| 577 | 462 | * @since 1.3.0 |
| 578 | 463 | * @access public |
| 579 | 464 | * |
| 580 | 465 | * @return array Registered widget types with settings keys for each widget. |
| 581 | - */ | |
| 466 | + */ | |
| 582 | 467 | public function get_widgets_frontend_settings_keys() { |
| 583 | 468 | $keys = []; |
| 584 | 469 | |
| 585 | 470 | foreach ( $this->get_widget_types() as $widget_type_name => $widget_type ) { |
| @@ -593,63 +478,8 @@ | ||
| 593 | 478 | return $keys; |
| 594 | 479 | } |
| 595 | 480 | |
| 596 | 481 | /** |
| 597 | - * Widgets with styles. | |
| 598 | - * | |
| 599 | - * This method returns the list of all the widgets in the `/includes/` | |
| 600 | - * folder that have styles. | |
| 601 | - * | |
| 602 | - * @since 3.24.0 | |
| 603 | - * @access public | |
| 604 | - * | |
| 605 | - * @return array The names of the widgets that have styles. | |
| 606 | - */ | |
| 607 | - public function widgets_with_styles(): array { | |
| 608 | - return [ | |
| 609 | - 'counter', | |
| 610 | - 'divider', | |
| 611 | - 'google_maps', | |
| 612 | - 'heading', | |
| 613 | - 'image', | |
| 614 | - 'image-carousel', | |
| 615 | - 'menu-anchor', | |
| 616 | - 'rating', | |
| 617 | - 'social-icons', | |
| 618 | - 'spacer', | |
| 619 | - 'testimonial', | |
| 620 | - 'text-editor', | |
| 621 | - 'video', | |
| 622 | - ]; | |
| 623 | - } | |
| 624 | - | |
| 625 | - /** | |
| 626 | - * Widgets with responsive styles. | |
| 627 | - * | |
| 628 | - * This method returns the list of all the widgets in the `/includes/` | |
| 629 | - * folder that have responsive styles. | |
| 630 | - * | |
| 631 | - * @since 3.24.0 | |
| 632 | - * @access public | |
| 633 | - * | |
| 634 | - * @return array The names of the widgets that have responsive styles. | |
| 635 | - */ | |
| 636 | - public function widgets_with_responsive_styles(): array { | |
| 637 | - return [ | |
| 638 | - 'accordion', | |
| 639 | - 'alert', | |
| 640 | - 'icon-box', | |
| 641 | - 'icon-list', | |
| 642 | - 'image-box', | |
| 643 | - 'image-gallery', | |
| 644 | - 'progress', | |
| 645 | - 'star-rating', | |
| 646 | - 'tabs', | |
| 647 | - 'toggle', | |
| 648 | - ]; | |
| 649 | - } | |
| 650 | - | |
| 651 | - /** | |
| 652 | 482 | * Enqueue widgets scripts. |
| 653 | 483 | * |
| 654 | 484 | * Enqueue all the scripts defined as a dependency for each widget. |
| 655 | 485 | * |
| @@ -654,9 +484,9 @@ | ||
| 654 | 484 | * Enqueue all the scripts defined as a dependency for each widget. |
| 655 | 485 | * |
| 656 | 486 | * @since 1.3.0 |
| 657 | 487 | * @access public |
| 658 | - */ | |
| 488 | + */ | |
| 659 | 489 | public function enqueue_widgets_scripts() { |
| 660 | 490 | foreach ( $this->get_widget_types() as $widget ) { |
| 661 | 491 | $widget->enqueue_scripts(); |
| 662 | 492 | } |
| @@ -661,14 +491,8 @@ | ||
| 661 | 491 | $widget->enqueue_scripts(); |
| 662 | 492 | } |
| 663 | 493 | } |
| 664 | 494 | |
| 665 | - public function register_frontend_handlers() { | |
| 666 | - foreach ( $this->get_widget_types() as $widget ) { | |
| 667 | - $widget->register_frontend_handlers(); | |
| 668 | - } | |
| 669 | - } | |
| 670 | - | |
| 671 | 495 | /** |
| 672 | 496 | * Enqueue widgets styles |
| 673 | 497 | * |
| 674 | 498 | * Enqueue all the styles defined as a dependency for each widget |
| @@ -743,9 +567,9 @@ | ||
| 743 | 567 | * Initializing Elementor widgets manager. |
| 744 | 568 | * |
| 745 | 569 | * @since 1.0.0 |
| 746 | 570 | * @access public |
| 747 | - */ | |
| 571 | + */ | |
| 748 | 572 | public function __construct() { |
| 749 | 573 | $this->require_files(); |
| 750 | 574 | |
| 751 | 575 | add_action( 'elementor/ajax/register_actions', [ $this, 'register_ajax_actions' ] ); |
| @@ -764,27 +588,6 @@ | ||
| 764 | 588 | public function register_ajax_actions( Ajax $ajax_manager ) { |
| 765 | 589 | $ajax_manager->register_ajax_action( 'render_widget', [ $this, 'ajax_render_widget' ] ); |
| 766 | 590 | $ajax_manager->register_ajax_action( 'editor_get_wp_widget_form', [ $this, 'ajax_get_wp_widget_form' ] ); |
| 767 | 591 | $ajax_manager->register_ajax_action( 'get_widgets_config', [ $this, 'ajax_get_widget_types_controls_config' ] ); |
| 768 | - | |
| 769 | - $ajax_manager->register_ajax_action( 'refresh_widgets_config', [ $this, 'ajax_refresh_widgets_config' ] ); | |
| 770 | - | |
| 771 | - $ajax_manager->register_ajax_action( 'get_widgets_default_value_translations', function ( array $data ) { | |
| 772 | - return $this->ajax_get_widgets_default_value_translations( $data ); | |
| 773 | - } ); | |
| 774 | - } | |
| 775 | - | |
| 776 | - /** | |
| 777 | - * @param string $experiment_name | |
| 778 | - * @param array $classes | |
| 779 | - * @return void | |
| 780 | - */ | |
| 781 | - public function register_promoted_active_widgets( string $experiment_name, array $classes ): void { | |
| 782 | - if ( ! Plugin::$instance->experiments->is_feature_active( $experiment_name ) || empty( $classes ) ) { | |
| 783 | - return; | |
| 784 | - } | |
| 785 | - | |
| 786 | - foreach ( $classes as $class_name ) { | |
| 787 | - $this->register( new $class_name() ); | |
| 788 | - } | |
| 789 | 592 | } |
| 790 | 593 | } |