| @@ -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,49 +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 | - 'inner-section', | |
| 85 | 45 | 'heading', |
| 86 | 46 | 'image', |
| 87 | 47 | 'text-editor', |
| 88 | 48 | 'video', |
| @@ -110,23 +70,20 @@ | ||
| 110 | 70 | 'html', |
| 111 | 71 | 'menu-anchor', |
| 112 | 72 | 'sidebar', |
| 113 | 73 | 'read-more', |
| 114 | - 'rating', | |
| 115 | 74 | ]; |
| 116 | 75 | |
| 117 | 76 | $this->_widget_types = []; |
| 118 | 77 | |
| 119 | - $this->register_promoted_widgets(); | |
| 120 | - | |
| 121 | 78 | foreach ( $build_widgets_filename as $widget_filename ) { |
| 122 | - include ELEMENTOR_PATH . 'includes/widgets/' . $widget_filename . '.php'; | |
| 79 | + include( ELEMENTOR_PATH . 'includes/widgets/' . $widget_filename . '.php' ); | |
| 123 | 80 | |
| 124 | 81 | $class_name = str_replace( '-', '_', $widget_filename ); |
| 125 | 82 | |
| 126 | 83 | $class_name = __NAMESPACE__ . '\Widget_' . $class_name; |
| 127 | 84 | |
| 128 | - $this->register( new $class_name() ); | |
| 85 | + $this->register_widget_type( new $class_name() ); | |
| 129 | 86 | } |
| 130 | 87 | |
| 131 | 88 | $this->register_wp_widgets(); |
| 132 | 89 | |
| @@ -135,29 +92,12 @@ | ||
| 135 | 92 | * |
| 136 | 93 | * Fires after Elementor widgets are registered. |
| 137 | 94 | * |
| 138 | 95 | * @since 1.0.0 |
| 139 | - * @deprecated 3.5.0 Use `elementor/widgets/register` hook instead. | |
| 140 | 96 | * |
| 141 | 97 | * @param Widgets_Manager $this The widgets manager. |
| 142 | 98 | */ |
| 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 | - ); | |
| 149 | - | |
| 150 | - /** | |
| 151 | - * After widgets registered. | |
| 152 | - * | |
| 153 | - * Fires after Elementor widgets are registered. | |
| 154 | - * | |
| 155 | - * @since 3.5.0 | |
| 156 | - * | |
| 157 | - * @param Widgets_Manager $this The widgets manager. | |
| 158 | - */ | |
| 159 | - do_action( 'elementor/widgets/register', $this ); | |
| 99 | + do_action( 'elementor/widgets/widgets_registered', $this ); | |
| 160 | 100 | } |
| 161 | 101 | |
| 162 | 102 | /** |
| 163 | 103 | * Register WordPress widgets. |
| @@ -168,12 +108,27 @@ | ||
| 168 | 108 | * plugin authors can filter the black list. |
| 169 | 109 | * |
| 170 | 110 | * @since 2.0.0 |
| 171 | 111 | * @access private |
| 172 | - */ | |
| 112 | + */ | |
| 173 | 113 | private function register_wp_widgets() { |
| 174 | 114 | global $wp_widget_factory; |
| 175 | 115 | |
| 116 | + // Skip Pojo widgets. | |
| 117 | + $pojo_allowed_widgets = [ | |
| 118 | + 'Pojo_Widget_Recent_Posts', | |
| 119 | + 'Pojo_Widget_Posts_Group', | |
| 120 | + 'Pojo_Widget_Gallery', | |
| 121 | + 'Pojo_Widget_Recent_Galleries', | |
| 122 | + 'Pojo_Slideshow_Widget', | |
| 123 | + 'Pojo_Forms_Widget', | |
| 124 | + 'Pojo_Widget_News_Ticker', | |
| 125 | + | |
| 126 | + 'Pojo_Widget_WC_Products', | |
| 127 | + 'Pojo_Widget_WC_Products_Category', | |
| 128 | + 'Pojo_Widget_WC_Product_Categories', | |
| 129 | + ]; | |
| 130 | + | |
| 176 | 131 | // Allow themes/plugins to filter out their widgets. |
| 177 | 132 | $black_list = []; |
| 178 | 133 | |
| 179 | 134 | /** |
| @@ -192,11 +147,15 @@ | ||
| 192 | 147 | if ( in_array( $widget_class, $black_list ) ) { |
| 193 | 148 | continue; |
| 194 | 149 | } |
| 195 | 150 | |
| 151 | + if ( $widget_obj instanceof \Pojo_Widget_Base && ! in_array( $widget_class, $pojo_allowed_widgets ) ) { | |
| 152 | + continue; | |
| 153 | + } | |
| 154 | + | |
| 196 | 155 | $elementor_widget_class = __NAMESPACE__ . '\Widget_WordPress'; |
| 197 | 156 | |
| 198 | - $this->register( | |
| 157 | + $this->register_widget_type( | |
| 199 | 158 | new $elementor_widget_class( [], [ |
| 200 | 159 | 'widget_name' => $widget_class, |
| 201 | 160 | ] ) |
| 202 | 161 | ); |
| @@ -209,24 +168,13 @@ | ||
| 209 | 168 | * Require Elementor widget base class. |
| 210 | 169 | * |
| 211 | 170 | * @since 2.0.0 |
| 212 | 171 | * @access private |
| 213 | - */ | |
| 172 | + */ | |
| 214 | 173 | private function require_files() { |
| 215 | 174 | require ELEMENTOR_PATH . 'includes/base/widget-base.php'; |
| 216 | 175 | } |
| 217 | 176 | |
| 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 | 177 | /** |
| 230 | 178 | * Register widget type. |
| 231 | 179 | * |
| 232 | 180 | * Add a new widget type to the list of registered widget types. |
| @@ -232,71 +180,23 @@ | ||
| 232 | 180 | * Add a new widget type to the list of registered widget types. |
| 233 | 181 | * |
| 234 | 182 | * @since 1.0.0 |
| 235 | 183 | * @access public |
| 236 | - * @deprecated 3.5.0 Use `register()` method instead. | |
| 237 | 184 | * |
| 238 | 185 | * @param Widget_Base $widget Elementor widget. |
| 239 | 186 | * |
| 240 | 187 | * @return true True if the widget was registered. |
| 241 | - */ | |
| 188 | + */ | |
| 242 | 189 | 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 | - ); | |
| 248 | - | |
| 249 | - return $this->register( $widget ); | |
| 250 | - } | |
| 251 | - | |
| 252 | - /** | |
| 253 | - * Register a new widget type. | |
| 254 | - * | |
| 255 | - * @param \Elementor\Widget_Base $widget_instance Elementor Widget. | |
| 256 | - * | |
| 257 | - * @return bool True if the widget was registered. | |
| 258 | - * @since 3.5.0 | |
| 259 | - * @access public | |
| 260 | - */ | |
| 261 | - public function register( Widget_Base $widget_instance ) { | |
| 262 | 190 | if ( is_null( $this->_widget_types ) ) { |
| 263 | 191 | $this->init_widgets(); |
| 264 | 192 | } |
| 265 | 193 | |
| 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 ); | |
| 194 | + $this->_widget_types[ $widget->get_name() ] = $widget; | |
| 275 | 195 | |
| 276 | - if ( ! $should_register ) { | |
| 277 | - return false; | |
| 278 | - } | |
| 279 | - | |
| 280 | - $this->_widget_types[ $widget_instance->get_name() ] = $widget_instance; | |
| 281 | - | |
| 282 | 196 | return true; |
| 283 | 197 | } |
| 284 | 198 | |
| 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 | 199 | /** |
| 300 | 200 | * Unregister widget type. |
| 301 | 201 | * |
| 302 | 202 | * Removes widget type from the list of registered widget types. |
| @@ -302,37 +202,14 @@ | ||
| 302 | 202 | * Removes widget type from the list of registered widget types. |
| 303 | 203 | * |
| 304 | 204 | * @since 1.0.0 |
| 305 | 205 | * @access public |
| 306 | - * @deprecated 3.5.0 Use `unregister()` method instead. | |
| 307 | 206 | * |
| 308 | 207 | * @param string $name Widget name. |
| 309 | 208 | * |
| 310 | 209 | * @return true True if the widget was unregistered, False otherwise. |
| 311 | - */ | |
| 210 | + */ | |
| 312 | 211 | 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 | - ); | |
| 318 | - | |
| 319 | - return $this->unregister( $name ); | |
| 320 | - } | |
| 321 | - | |
| 322 | - /** | |
| 323 | - * Unregister widget type. | |
| 324 | - * | |
| 325 | - * Removes widget type from the list of registered widget types. | |
| 326 | - * | |
| 327 | - * @since 3.5.0 | |
| 328 | - * @access public | |
| 329 | - * | |
| 330 | - * @param string $name Widget name. | |
| 331 | - * | |
| 332 | - * @return boolean Whether the widget was unregistered. | |
| 333 | - */ | |
| 334 | - public function unregister( $name ) { | |
| 335 | 212 | if ( ! isset( $this->_widget_types[ $name ] ) ) { |
| 336 | 213 | return false; |
| 337 | 214 | } |
| 338 | 215 | |
| @@ -351,9 +228,9 @@ | ||
| 351 | 228 | * |
| 352 | 229 | * @param string $widget_name Optional. Widget name. Default is null. |
| 353 | 230 | * |
| 354 | 231 | * @return Widget_Base|Widget_Base[]|null Registered widget types. |
| 355 | - */ | |
| 232 | + */ | |
| 356 | 233 | public function get_widget_types( $widget_name = null ) { |
| 357 | 234 | if ( is_null( $this->_widget_types ) ) { |
| 358 | 235 | $this->init_widgets(); |
| 359 | 236 | } |
| @@ -373,9 +250,9 @@ | ||
| 373 | 250 | * @since 1.0.0 |
| 374 | 251 | * @access public |
| 375 | 252 | * |
| 376 | 253 | * @return array Registered widget types with each widget config. |
| 377 | - */ | |
| 254 | + */ | |
| 378 | 255 | public function get_widget_types_config() { |
| 379 | 256 | $config = []; |
| 380 | 257 | |
| 381 | 258 | foreach ( $this->get_widget_types() as $widget_key => $widget ) { |
| @@ -384,16 +261,9 @@ | ||
| 384 | 261 | |
| 385 | 262 | return $config; |
| 386 | 263 | } |
| 387 | 264 | |
| 388 | - /** | |
| 389 | - * @throws \Exception If current user don't have permissions to edit the post. | |
| 390 | - */ | |
| 391 | 265 | 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 | 266 | $config = []; |
| 397 | 267 | |
| 398 | 268 | foreach ( $this->get_widget_types() as $widget_key => $widget ) { |
| 399 | 269 | if ( isset( $data['exclude'][ $widget_key ] ) ) { |
| @@ -408,34 +278,8 @@ | ||
| 408 | 278 | |
| 409 | 279 | return $config; |
| 410 | 280 | } |
| 411 | 281 | |
| 412 | - public function ajax_get_widgets_default_value_translations( array $data = [] ) { | |
| 413 | - $locale = empty( $data['locale'] ) | |
| 414 | - ? get_locale() | |
| 415 | - : $data['locale']; | |
| 416 | - | |
| 417 | - $force_locale = new Force_Locale( $locale ); | |
| 418 | - $force_locale->force(); | |
| 419 | - | |
| 420 | - $controls = ( new Collection( $this->get_widget_types() ) ) | |
| 421 | - ->map( function ( Widget_Base $widget ) { | |
| 422 | - $controls = $widget->get_stack( false )['controls']; | |
| 423 | - | |
| 424 | - return [ | |
| 425 | - 'controls' => $this->pluck_default_controls( $controls ), | |
| 426 | - ]; | |
| 427 | - } ) | |
| 428 | - ->filter( function ( $widget ) { | |
| 429 | - return ! empty( $widget['controls'] ); | |
| 430 | - } ) | |
| 431 | - ->all(); | |
| 432 | - | |
| 433 | - $force_locale->restore(); | |
| 434 | - | |
| 435 | - return $controls; | |
| 436 | - } | |
| 437 | - | |
| 438 | 282 | /** |
| 439 | 283 | * Ajax render widget. |
| 440 | 284 | * |
| 441 | 285 | * Ajax handler for Elementor render_widget. |
| @@ -455,10 +299,14 @@ | ||
| 455 | 299 | * @type string $render The rendered HTML. |
| 456 | 300 | * } |
| 457 | 301 | */ |
| 458 | 302 | public function ajax_render_widget( $request ) { |
| 459 | - $document = Plugin::$instance->documents->get_with_permissions( $request['editor_post_id'] ); | |
| 303 | + $document = Plugin::$instance->documents->get( $request['editor_post_id'] ); | |
| 460 | 304 | |
| 305 | + if ( ! $document->is_editable_by_current_user() ) { | |
| 306 | + throw new \Exception( 'Access denied.', Exceptions::FORBIDDEN ); | |
| 307 | + } | |
| 308 | + | |
| 461 | 309 | // Override the global $post for the render. |
| 462 | 310 | query_posts( |
| 463 | 311 | [ |
| 464 | 312 | 'p' => $request['editor_post_id'], |
| @@ -493,13 +341,10 @@ | ||
| 493 | 341 | * |
| 494 | 342 | * @param array $request Ajax request. |
| 495 | 343 | * |
| 496 | 344 | * @return bool|string Rendered widget form. |
| 497 | - * @throws \Exception If current user don't have permissions to edit the post. | |
| 498 | 345 | */ |
| 499 | 346 | public function ajax_get_wp_widget_form( $request ) { |
| 500 | - Plugin::$instance->documents->check_permissions( $request['editor_post_id'] ); | |
| 501 | - | |
| 502 | 347 | if ( empty( $request['widget_type'] ) ) { |
| 503 | 348 | return false; |
| 504 | 349 | } |
| 505 | 350 | |
| @@ -533,9 +378,9 @@ | ||
| 533 | 378 | * template, for all the registered widget types. |
| 534 | 379 | * |
| 535 | 380 | * @since 1.0.0 |
| 536 | 381 | * @access public |
| 537 | - */ | |
| 382 | + */ | |
| 538 | 383 | public function render_widgets_content() { |
| 539 | 384 | foreach ( $this->get_widget_types() as $widget ) { |
| 540 | 385 | $widget->print_template(); |
| 541 | 386 | } |
| @@ -550,9 +395,9 @@ | ||
| 550 | 395 | * @since 1.3.0 |
| 551 | 396 | * @access public |
| 552 | 397 | * |
| 553 | 398 | * @return array Registered widget types with settings keys for each widget. |
| 554 | - */ | |
| 399 | + */ | |
| 555 | 400 | public function get_widgets_frontend_settings_keys() { |
| 556 | 401 | $keys = []; |
| 557 | 402 | |
| 558 | 403 | foreach ( $this->get_widget_types() as $widget_type_name => $widget_type ) { |
| @@ -566,63 +411,8 @@ | ||
| 566 | 411 | return $keys; |
| 567 | 412 | } |
| 568 | 413 | |
| 569 | 414 | /** |
| 570 | - * Widgets with styles. | |
| 571 | - * | |
| 572 | - * This method returns the list of all the widgets in the `/includes/` | |
| 573 | - * folder that have styles. | |
| 574 | - * | |
| 575 | - * @since 3.24.0 | |
| 576 | - * @access public | |
| 577 | - * | |
| 578 | - * @return array The names of the widgets that have styles. | |
| 579 | - */ | |
| 580 | - public function widgets_with_styles(): array { | |
| 581 | - return [ | |
| 582 | - 'counter', | |
| 583 | - 'divider', | |
| 584 | - 'google_maps', | |
| 585 | - 'heading', | |
| 586 | - 'image', | |
| 587 | - 'image-carousel', | |
| 588 | - 'menu-anchor', | |
| 589 | - 'rating', | |
| 590 | - 'social-icons', | |
| 591 | - 'spacer', | |
| 592 | - 'testimonial', | |
| 593 | - 'text-editor', | |
| 594 | - 'video', | |
| 595 | - ]; | |
| 596 | - } | |
| 597 | - | |
| 598 | - /** | |
| 599 | - * Widgets with responsive styles. | |
| 600 | - * | |
| 601 | - * This method returns the list of all the widgets in the `/includes/` | |
| 602 | - * folder that have responsive styles. | |
| 603 | - * | |
| 604 | - * @since 3.24.0 | |
| 605 | - * @access public | |
| 606 | - * | |
| 607 | - * @return array The names of the widgets that have responsive styles. | |
| 608 | - */ | |
| 609 | - public function widgets_with_responsive_styles(): array { | |
| 610 | - return [ | |
| 611 | - 'accordion', | |
| 612 | - 'alert', | |
| 613 | - 'icon-box', | |
| 614 | - 'icon-list', | |
| 615 | - 'image-box', | |
| 616 | - 'image-gallery', | |
| 617 | - 'progress', | |
| 618 | - 'star-rating', | |
| 619 | - 'tabs', | |
| 620 | - 'toggle', | |
| 621 | - ]; | |
| 622 | - } | |
| 623 | - | |
| 624 | - /** | |
| 625 | 415 | * Enqueue widgets scripts. |
| 626 | 416 | * |
| 627 | 417 | * Enqueue all the scripts defined as a dependency for each widget. |
| 628 | 418 | * |
| @@ -627,9 +417,9 @@ | ||
| 627 | 417 | * Enqueue all the scripts defined as a dependency for each widget. |
| 628 | 418 | * |
| 629 | 419 | * @since 1.3.0 |
| 630 | 420 | * @access public |
| 631 | - */ | |
| 421 | + */ | |
| 632 | 422 | public function enqueue_widgets_scripts() { |
| 633 | 423 | foreach ( $this->get_widget_types() as $widget ) { |
| 634 | 424 | $widget->enqueue_scripts(); |
| 635 | 425 | } |
| @@ -634,14 +424,8 @@ | ||
| 634 | 424 | $widget->enqueue_scripts(); |
| 635 | 425 | } |
| 636 | 426 | } |
| 637 | 427 | |
| 638 | - public function register_frontend_handlers() { | |
| 639 | - foreach ( $this->get_widget_types() as $widget ) { | |
| 640 | - $widget->register_frontend_handlers(); | |
| 641 | - } | |
| 642 | - } | |
| 643 | - | |
| 644 | 428 | /** |
| 645 | 429 | * Enqueue widgets styles |
| 646 | 430 | * |
| 647 | 431 | * Enqueue all the styles defined as a dependency for each widget |
| @@ -716,9 +500,9 @@ | ||
| 716 | 500 | * Initializing Elementor widgets manager. |
| 717 | 501 | * |
| 718 | 502 | * @since 1.0.0 |
| 719 | 503 | * @access public |
| 720 | - */ | |
| 504 | + */ | |
| 721 | 505 | public function __construct() { |
| 722 | 506 | $this->require_files(); |
| 723 | 507 | |
| 724 | 508 | add_action( 'elementor/ajax/register_actions', [ $this, 'register_ajax_actions' ] ); |
| @@ -737,25 +521,6 @@ | ||
| 737 | 521 | public function register_ajax_actions( Ajax $ajax_manager ) { |
| 738 | 522 | $ajax_manager->register_ajax_action( 'render_widget', [ $this, 'ajax_render_widget' ] ); |
| 739 | 523 | $ajax_manager->register_ajax_action( 'editor_get_wp_widget_form', [ $this, 'ajax_get_wp_widget_form' ] ); |
| 740 | 524 | $ajax_manager->register_ajax_action( 'get_widgets_config', [ $this, 'ajax_get_widget_types_controls_config' ] ); |
| 741 | - | |
| 742 | - $ajax_manager->register_ajax_action( 'get_widgets_default_value_translations', function ( array $data ) { | |
| 743 | - return $this->ajax_get_widgets_default_value_translations( $data ); | |
| 744 | - } ); | |
| 745 | - } | |
| 746 | - | |
| 747 | - /** | |
| 748 | - * @param string $experiment_name | |
| 749 | - * @param array $classes | |
| 750 | - * @return void | |
| 751 | - */ | |
| 752 | - public function register_promoted_active_widgets( string $experiment_name, array $classes ): void { | |
| 753 | - if ( ! Plugin::$instance->experiments->is_feature_active( $experiment_name ) || empty( $classes ) ) { | |
| 754 | - return; | |
| 755 | - } | |
| 756 | - | |
| 757 | - foreach ( $classes as $class_name ) { | |
| 758 | - $this->register( new $class_name() ); | |
| 759 | - } | |
| 760 | 525 | } |
| 761 | 526 | } |