| @@ -1,10 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor; |
| 3 | 3 | |
| 4 | -use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager; | |
| 5 | -use Elementor\Utils; | |
| 6 | - | |
| 7 | 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | 5 | exit; // Exit if accessed directly. |
| 9 | 6 | } |
| 10 | 7 | |
| @@ -19,8 +16,9 @@ | ||
| 19 | 16 | * @since 1.0.0 |
| 20 | 17 | * @abstract |
| 21 | 18 | */ |
| 22 | 19 | abstract class Widget_Base extends Element_Base { |
| 20 | + | |
| 23 | 21 | /** |
| 24 | 22 | * Whether the widget has content. |
| 25 | 23 | * |
| 26 | 24 | * Used in cases where the widget has no content. When widgets uses only |
| @@ -33,24 +31,9 @@ | ||
| 33 | 31 | * @var bool |
| 34 | 32 | */ |
| 35 | 33 | protected $_has_template_content = true; |
| 36 | 34 | |
| 37 | - private $is_first_section = true; | |
| 38 | - | |
| 39 | 35 | /** |
| 40 | - * Registered Runtime Widgets. | |
| 41 | - * | |
| 42 | - * Registering in runtime all widgets that are being used on the page. | |
| 43 | - * | |
| 44 | - * @since 3.3.0 | |
| 45 | - * @access public | |
| 46 | - * @static | |
| 47 | - * | |
| 48 | - * @var array | |
| 49 | - */ | |
| 50 | - public static $registered_runtime_widgets = []; | |
| 51 | - | |
| 52 | - /** | |
| 53 | 36 | * Get element type. |
| 54 | 37 | * |
| 55 | 38 | * Retrieve the element type, in this case `widget`. |
| 56 | 39 | * |
| @@ -106,22 +89,8 @@ | ||
| 106 | 89 | return [ 'general' ]; |
| 107 | 90 | } |
| 108 | 91 | |
| 109 | 92 | /** |
| 110 | - * Get widget upsale data. | |
| 111 | - * | |
| 112 | - * Retrieve the widget promotion data. | |
| 113 | - * | |
| 114 | - * @since 3.18.0 | |
| 115 | - * @access protected | |
| 116 | - * | |
| 117 | - * @return array|null Widget promotion data. | |
| 118 | - */ | |
| 119 | - protected function get_upsale_data() { | |
| 120 | - return null; | |
| 121 | - } | |
| 122 | - | |
| 123 | - /** | |
| 124 | 93 | * Widget base constructor. |
| 125 | 94 | * |
| 126 | 95 | * Initializing the widget base class. |
| 127 | 96 | * |
| @@ -139,20 +108,14 @@ | ||
| 139 | 108 | |
| 140 | 109 | $is_type_instance = $this->is_type_instance(); |
| 141 | 110 | |
| 142 | 111 | if ( ! $is_type_instance && null === $args ) { |
| 143 | - throw new \Exception( 'An `$args` argument is required when initializing a full widget instance.' ); | |
| 112 | + throw new \Exception( '`$args` argument is required when initializing a full widget instance.' ); | |
| 144 | 113 | } |
| 145 | 114 | |
| 146 | 115 | if ( $is_type_instance ) { |
| 147 | - if ( $this->has_own_method( '_register_skins', self::class ) ) { | |
| 148 | - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( '_register_skins', '3.1.0', __CLASS__ . '::register_skins()' ); | |
| 116 | + $this->_register_skins(); | |
| 149 | 117 | |
| 150 | - $this->_register_skins(); | |
| 151 | - } else { | |
| 152 | - $this->register_skins(); | |
| 153 | - } | |
| 154 | - | |
| 155 | 118 | $widget_name = $this->get_name(); |
| 156 | 119 | |
| 157 | 120 | /** |
| 158 | 121 | * Widget skin init. |
| @@ -183,11 +146,11 @@ | ||
| 183 | 146 | */ |
| 184 | 147 | public function get_stack( $with_common_controls = true ) { |
| 185 | 148 | $stack = parent::get_stack(); |
| 186 | 149 | |
| 187 | - if ( $with_common_controls && ! $this instanceof Widget_Common_Base ) { | |
| 188 | - /** @var Widget_Common_Base $common_widget */ | |
| 189 | - $common_widget = Plugin::$instance->widgets_manager->get_widget_types( $this->get_common_widget_name() ); | |
| 150 | + if ( $with_common_controls && 'common' !== $this->get_unique_name() ) { | |
| 151 | + /** @var Widget_Common $common_widget */ | |
| 152 | + $common_widget = Plugin::$instance->widgets_manager->get_widget_types( 'common' ); | |
| 190 | 153 | |
| 191 | 154 | $stack['controls'] = array_merge( $stack['controls'], $common_widget->get_controls() ); |
| 192 | 155 | |
| 193 | 156 | $stack['tabs'] = array_merge( $stack['tabs'], $common_widget->get_tabs_controls() ); |
| @@ -195,16 +158,8 @@ | ||
| 195 | 158 | |
| 196 | 159 | return $stack; |
| 197 | 160 | } |
| 198 | 161 | |
| 199 | - private function get_common_widget_name() { | |
| 200 | - if ( Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ) ) { | |
| 201 | - return $this->has_widget_inner_wrapper() ? 'common' : 'common-optimized'; | |
| 202 | - } | |
| 203 | - | |
| 204 | - return 'common'; | |
| 205 | - } | |
| 206 | - | |
| 207 | 162 | /** |
| 208 | 163 | * Get widget controls pointer index. |
| 209 | 164 | * |
| 210 | 165 | * Retrieve widget pointer index where the next control should be added. |
| @@ -241,21 +196,8 @@ | ||
| 241 | 196 | return true; |
| 242 | 197 | } |
| 243 | 198 | |
| 244 | 199 | /** |
| 245 | - * Hide on search. | |
| 246 | - * | |
| 247 | - * Whether to hide the widget on search in the panel or not. By default returns false. | |
| 248 | - * | |
| 249 | - * @access public | |
| 250 | - * | |
| 251 | - * @return bool Whether to hide the widget when searching for widget or not. | |
| 252 | - */ | |
| 253 | - public function hide_on_search() { | |
| 254 | - return false; | |
| 255 | - } | |
| 256 | - | |
| 257 | - /** | |
| 258 | 200 | * Start widget controls section. |
| 259 | 201 | * |
| 260 | 202 | * Used to add a new section of controls to the widget. Regular controls and |
| 261 | 203 | * skin controls. |
| @@ -271,12 +213,14 @@ | ||
| 271 | 213 | */ |
| 272 | 214 | public function start_controls_section( $section_id, array $args = [] ) { |
| 273 | 215 | parent::start_controls_section( $section_id, $args ); |
| 274 | 216 | |
| 275 | - if ( $this->is_first_section ) { | |
| 217 | + static $is_first_section = true; | |
| 218 | + | |
| 219 | + if ( $is_first_section ) { | |
| 276 | 220 | $this->register_skin_control(); |
| 277 | 221 | |
| 278 | - $this->is_first_section = false; | |
| 222 | + $is_first_section = false; | |
| 279 | 223 | } |
| 280 | 224 | } |
| 281 | 225 | |
| 282 | 226 | /** |
| @@ -293,9 +237,9 @@ | ||
| 293 | 237 | if ( ! empty( $skins ) ) { |
| 294 | 238 | $skin_options = []; |
| 295 | 239 | |
| 296 | 240 | if ( $this->_has_template_content ) { |
| 297 | - $skin_options[''] = esc_html__( 'Default', 'elementor' ); | |
| 241 | + $skin_options[''] = __( 'Default', 'elementor' ); | |
| 298 | 242 | } |
| 299 | 243 | |
| 300 | 244 | foreach ( $skins as $skin_id => $skin ) { |
| 301 | 245 | $skin_options[ $skin_id ] = $skin->get_title(); |
| @@ -300,9 +244,9 @@ | ||
| 300 | 244 | foreach ( $skins as $skin_id => $skin ) { |
| 301 | 245 | $skin_options[ $skin_id ] = $skin->get_title(); |
| 302 | 246 | } |
| 303 | 247 | |
| 304 | - // Get the first item for default value. | |
| 248 | + // Get the first item for default value | |
| 305 | 249 | $default_value = array_keys( $skin_options ); |
| 306 | 250 | $default_value = array_shift( $default_value ); |
| 307 | 251 | |
| 308 | 252 | if ( 1 >= count( $skin_options ) ) { |
| @@ -308,9 +252,9 @@ | ||
| 308 | 252 | if ( 1 >= count( $skin_options ) ) { |
| 309 | 253 | $this->add_control( |
| 310 | 254 | '_skin', |
| 311 | 255 | [ |
| 312 | - 'label' => esc_html__( 'Skin', 'elementor' ), | |
| 256 | + 'label' => __( 'Skin', 'elementor' ), | |
| 313 | 257 | 'type' => Controls_Manager::HIDDEN, |
| 314 | 258 | 'default' => $default_value, |
| 315 | 259 | ] |
| 316 | 260 | ); |
| @@ -317,9 +261,9 @@ | ||
| 317 | 261 | } else { |
| 318 | 262 | $this->add_control( |
| 319 | 263 | '_skin', |
| 320 | 264 | [ |
| 321 | - 'label' => esc_html__( 'Skin', 'elementor' ), | |
| 265 | + 'label' => __( 'Skin', 'elementor' ), | |
| 322 | 266 | 'type' => Controls_Manager::SELECT, |
| 323 | 267 | 'default' => $default_value, |
| 324 | 268 | 'options' => $skin_options, |
| 325 | 269 | ] |
| @@ -328,21 +272,8 @@ | ||
| 328 | 272 | } |
| 329 | 273 | } |
| 330 | 274 | |
| 331 | 275 | /** |
| 332 | - * Register widget skins - deprecated prefixed method | |
| 333 | - * | |
| 334 | - * @since 1.7.12 | |
| 335 | - * @access protected | |
| 336 | - * @deprecated 3.1.0 Use `register_skins()` method instead. | |
| 337 | - */ | |
| 338 | - protected function _register_skins() { | |
| 339 | - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0', 'register_skins()' ); | |
| 340 | - | |
| 341 | - $this->register_skins(); | |
| 342 | - } | |
| 343 | - | |
| 344 | - /** | |
| 345 | 276 | * Register widget skins. |
| 346 | 277 | * |
| 347 | 278 | * This method is activated while initializing the widget base class. It is |
| 348 | 279 | * used to assign skins to widgets with `add_skin()` method. |
| @@ -348,16 +279,16 @@ | ||
| 348 | 279 | * used to assign skins to widgets with `add_skin()` method. |
| 349 | 280 | * |
| 350 | 281 | * Usage: |
| 351 | 282 | * |
| 352 | - * protected function register_skins() { | |
| 283 | + * protected function _register_skins() { | |
| 353 | 284 | * $this->add_skin( new Skin_Classic( $this ) ); |
| 354 | 285 | * } |
| 355 | 286 | * |
| 356 | - * @since 3.1.0 | |
| 287 | + * @since 1.7.12 | |
| 357 | 288 | * @access protected |
| 358 | 289 | */ |
| 359 | - protected function register_skins() {} | |
| 290 | + protected function _register_skins() {} | |
| 360 | 291 | |
| 361 | 292 | /** |
| 362 | 293 | * Get initial config. |
| 363 | 294 | * |
| @@ -378,23 +309,10 @@ | ||
| 378 | 309 | 'keywords' => $this->get_keywords(), |
| 379 | 310 | 'categories' => $this->get_categories(), |
| 380 | 311 | 'html_wrapper_class' => $this->get_html_wrapper_class(), |
| 381 | 312 | 'show_in_panel' => $this->show_in_panel(), |
| 382 | - 'hide_on_search' => $this->hide_on_search(), | |
| 383 | - 'upsale_data' => $this->get_upsale_data(), | |
| 384 | - 'is_dynamic_content' => $this->is_dynamic_content(), | |
| 385 | - 'has_widget_inner_wrapper' => $this->has_widget_inner_wrapper(), | |
| 386 | 313 | ]; |
| 387 | 314 | |
| 388 | - if ( isset( $config['upsale_data'] ) && is_array( $config['upsale_data'] ) ) { | |
| 389 | - $filter_name = 'elementor/widgets/' . $this->get_name() . '/custom_promotion'; | |
| 390 | - $config['upsale_data'] = Filtered_Promotions_Manager::get_filtered_promotion_data( $config['upsale_data'], $filter_name, 'upgrade_url' ); | |
| 391 | - } | |
| 392 | - | |
| 393 | - if ( isset( $config['upsale_data']['image'] ) ) { | |
| 394 | - $config['upsale_data']['image'] = esc_url( $config['upsale_data']['image'] ); | |
| 395 | - } | |
| 396 | - | |
| 397 | 315 | $stack = Plugin::$instance->controls_manager->get_element_stack( $this ); |
| 398 | 316 | |
| 399 | 317 | if ( $stack ) { |
| 400 | 318 | $config['controls'] = $this->get_stack( false )['controls']; |
| @@ -400,9 +318,9 @@ | ||
| 400 | 318 | $config['controls'] = $this->get_stack( false )['controls']; |
| 401 | 319 | $config['tabs_controls'] = $this->get_tabs_controls(); |
| 402 | 320 | } |
| 403 | 321 | |
| 404 | - return array_replace_recursive( parent::get_initial_config(), $config ); | |
| 322 | + return array_merge( parent::get_initial_config(), $config ); | |
| 405 | 323 | } |
| 406 | 324 | |
| 407 | 325 | /** |
| 408 | 326 | * @since 2.3.1 |
| @@ -423,15 +341,15 @@ | ||
| 423 | 341 | * |
| 424 | 342 | * @param string $template_content Template content. |
| 425 | 343 | */ |
| 426 | 344 | protected function print_template_content( $template_content ) { |
| 427 | - if ( $this->has_widget_inner_wrapper() ) : ?> | |
| 345 | + ?> | |
| 428 | 346 | <div class="elementor-widget-container"> |
| 429 | - <?php endif; | |
| 430 | - Utils::print_unescaped_internal_string( $template_content ); | |
| 431 | - if ( $this->has_widget_inner_wrapper() ) : ?> | |
| 347 | + <?php | |
| 348 | + echo $template_content; // XSS ok. | |
| 349 | + ?> | |
| 432 | 350 | </div> |
| 433 | - <?php endif; | |
| 351 | + <?php | |
| 434 | 352 | } |
| 435 | 353 | |
| 436 | 354 | /** |
| 437 | 355 | * Parse text editor. |
| @@ -461,22 +379,8 @@ | ||
| 461 | 379 | return $content; |
| 462 | 380 | } |
| 463 | 381 | |
| 464 | 382 | /** |
| 465 | - * Safe print parsed text editor. | |
| 466 | - * | |
| 467 | - * @uses static::parse_text_editor. | |
| 468 | - * | |
| 469 | - * @access protected | |
| 470 | - * | |
| 471 | - * @param string $content Text editor content. | |
| 472 | - */ | |
| 473 | - final protected function print_text_editor( $content ) { | |
| 474 | - // PHPCS - the method `parse_text_editor` is safe. | |
| 475 | - echo static::parse_text_editor( $content ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 476 | - } | |
| 477 | - | |
| 478 | - /** | |
| 479 | 383 | * Get HTML wrapper class. |
| 480 | 384 | * |
| 481 | 385 | * Retrieve the widget container class. Can be used to override the |
| 482 | 386 | * container class for specific widgets. |
| @@ -495,10 +399,10 @@ | ||
| 495 | 399 | * |
| 496 | 400 | * @since 1.0.0 |
| 497 | 401 | * @access protected |
| 498 | 402 | */ |
| 499 | - protected function add_render_attributes() { | |
| 500 | - parent::add_render_attributes(); | |
| 403 | + protected function _add_render_attributes() { | |
| 404 | + parent::_add_render_attributes(); | |
| 501 | 405 | |
| 502 | 406 | $this->add_render_attribute( |
| 503 | 407 | '_wrapper', 'class', [ |
| 504 | 408 | 'elementor-widget', |
| @@ -541,17 +445,18 @@ | ||
| 541 | 445 | * |
| 542 | 446 | * Used to add Light-Box-related data attributes to links that open media files. |
| 543 | 447 | * |
| 544 | 448 | * @param array|string $element The link HTML element. |
| 545 | - * @param int $id The ID of the image. | |
| 546 | - * @param string $lightbox_setting_key The setting key that dictates whether to open the image in a lightbox. | |
| 547 | - * @param string $group_id Unique ID for a group of lightbox images. | |
| 548 | - * @param bool $overwrite Optional. Whether to overwrite existing | |
| 549 | - * attribute. Default is false, not to overwrite. | |
| 449 | + * @param int $id The ID of the image | |
| 450 | + * @param string $lightbox_setting_key The setting key that dictates weather to open the image in a lightbox | |
| 451 | + * @param string $group_id Unique ID for a group of lightbox images | |
| 452 | + * @param bool $overwrite Optional. Whether to overwrite existing | |
| 453 | + * attribute. Default is false, not to overwrite. | |
| 550 | 454 | * |
| 551 | 455 | * @return Widget_Base Current instance of the widget. |
| 552 | 456 | * @since 2.9.0 |
| 553 | 457 | * @access public |
| 458 | + * | |
| 554 | 459 | */ |
| 555 | 460 | public function add_lightbox_data_attributes( $element, $id = null, $lightbox_setting_key = null, $group_id = null, $overwrite = false ) { |
| 556 | 461 | $kit = Plugin::$instance->kits_manager->get_active_kit(); |
| 557 | 462 | |
| @@ -558,9 +463,9 @@ | ||
| 558 | 463 | $is_global_image_lightbox_enabled = 'yes' === $kit->get_settings( 'global_image_lightbox' ); |
| 559 | 464 | |
| 560 | 465 | if ( 'no' === $lightbox_setting_key ) { |
| 561 | 466 | if ( $is_global_image_lightbox_enabled ) { |
| 562 | - $this->add_render_attribute( $element, 'data-elementor-open-lightbox', 'no', $overwrite ); | |
| 467 | + $this->add_render_attribute( $element, 'data-elementor-open-lightbox', 'no' ); | |
| 563 | 468 | } |
| 564 | 469 | |
| 565 | 470 | return $this; |
| 566 | 471 | } |
| @@ -570,19 +475,10 @@ | ||
| 570 | 475 | } |
| 571 | 476 | |
| 572 | 477 | $attributes['data-elementor-open-lightbox'] = 'yes'; |
| 573 | 478 | |
| 574 | - $action_hash_params = []; | |
| 575 | - | |
| 576 | - if ( $id ) { | |
| 577 | - $action_hash_params['id'] = $id; | |
| 578 | - $action_hash_params['url'] = wp_get_attachment_url( $id ); | |
| 579 | - } | |
| 580 | - | |
| 581 | 479 | if ( $group_id ) { |
| 582 | 480 | $attributes['data-elementor-lightbox-slideshow'] = $group_id; |
| 583 | - | |
| 584 | - $action_hash_params['slideshow'] = $group_id; | |
| 585 | 481 | } |
| 586 | 482 | |
| 587 | 483 | if ( $id ) { |
| 588 | 484 | $lightbox_image_attributes = Plugin::$instance->images_manager->get_lightbox_image_attributes( $id ); |
| @@ -595,10 +491,8 @@ | ||
| 595 | 491 | $attributes['data-elementor-lightbox-description'] = $lightbox_image_attributes['description']; |
| 596 | 492 | } |
| 597 | 493 | } |
| 598 | 494 | |
| 599 | - $attributes['data-e-action-hash'] = Plugin::instance()->frontend->create_action_hash( 'lightbox', $action_hash_params ); | |
| 600 | - | |
| 601 | 495 | $this->add_render_attribute( $element, $attributes, null, $overwrite ); |
| 602 | 496 | |
| 603 | 497 | return $this; |
| 604 | 498 | } |
| @@ -630,11 +524,11 @@ | ||
| 630 | 524 | |
| 631 | 525 | $skin = $this->get_current_skin(); |
| 632 | 526 | if ( $skin ) { |
| 633 | 527 | $skin->set_parent( $this ); |
| 634 | - $skin->render_by_mode(); | |
| 528 | + $skin->render(); | |
| 635 | 529 | } else { |
| 636 | - $this->render_by_mode(); | |
| 530 | + $this->render(); | |
| 637 | 531 | } |
| 638 | 532 | |
| 639 | 533 | $widget_content = ob_get_clean(); |
| 640 | 534 | |
| @@ -640,15 +534,11 @@ | ||
| 640 | 534 | |
| 641 | 535 | if ( empty( $widget_content ) ) { |
| 642 | 536 | return; |
| 643 | 537 | } |
| 644 | - if ( $this->has_widget_inner_wrapper() ) : ?> | |
| 538 | + ?> | |
| 645 | 539 | <div class="elementor-widget-container"> |
| 646 | - <?php endif; ?> | |
| 647 | 540 | <?php |
| 648 | - if ( $this->is_widget_first_render( $this->get_group_name() ) ) { | |
| 649 | - $this->register_runtime_widget( $this->get_group_name() ); | |
| 650 | - } | |
| 651 | 541 | |
| 652 | 542 | /** |
| 653 | 543 | * Render widget content. |
| 654 | 544 | * |
| @@ -659,19 +549,15 @@ | ||
| 659 | 549 | * @param string $widget_content The content of the widget. |
| 660 | 550 | * @param Widget_Base $this The widget. |
| 661 | 551 | */ |
| 662 | 552 | $widget_content = apply_filters( 'elementor/widget/render_content', $widget_content, $this ); |
| 663 | - Utils::print_unescaped_internal_string( $widget_content ); | |
| 553 | + | |
| 554 | + echo $widget_content; // XSS ok. | |
| 664 | 555 | ?> |
| 665 | - <?php if ( $this->has_widget_inner_wrapper() ) : ?> | |
| 666 | 556 | </div> |
| 667 | - <?php endif; | |
| 557 | + <?php | |
| 668 | 558 | } |
| 669 | 559 | |
| 670 | - protected function is_widget_first_render( $widget_name ) { | |
| 671 | - return ! in_array( $widget_name, self::$registered_runtime_widgets, true ); | |
| 672 | - } | |
| 673 | - | |
| 674 | 560 | /** |
| 675 | 561 | * Render widget plain content. |
| 676 | 562 | * |
| 677 | 563 | * Elementor saves the page content in a unique way, but it's not the way |
| @@ -769,33 +655,13 @@ | ||
| 769 | 655 | * |
| 770 | 656 | * @since 1.0.0 |
| 771 | 657 | * @access protected |
| 772 | 658 | */ |
| 773 | - protected function print_content() { | |
| 659 | + protected function _print_content() { | |
| 774 | 660 | $this->render_content(); |
| 775 | 661 | } |
| 776 | 662 | |
| 777 | 663 | /** |
| 778 | - * Print a setting content without escaping. | |
| 779 | - * | |
| 780 | - * Script tags are allowed on frontend according to the WP theme securing policy. | |
| 781 | - * | |
| 782 | - * @param string $setting | |
| 783 | - * @param null $repeater_name | |
| 784 | - * @param null $index | |
| 785 | - */ | |
| 786 | - final public function print_unescaped_setting( $setting, $repeater_name = null, $index = null ) { | |
| 787 | - if ( $repeater_name ) { | |
| 788 | - $repeater = $this->get_settings_for_display( $repeater_name ); | |
| 789 | - $output = $repeater[ $index ][ $setting ]; | |
| 790 | - } else { | |
| 791 | - $output = $this->get_settings_for_display( $setting ); | |
| 792 | - } | |
| 793 | - | |
| 794 | - echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 795 | - } | |
| 796 | - | |
| 797 | - /** | |
| 798 | 664 | * Get default data. |
| 799 | 665 | * |
| 800 | 666 | * Retrieve the default widget data. Used to reset the data on initialization. |
| 801 | 667 | * |
| @@ -847,9 +713,9 @@ | ||
| 847 | 713 | * @access protected |
| 848 | 714 | * |
| 849 | 715 | * @param string $setting_key The current setting key inside the repeater item (e.g. `tab_title`). |
| 850 | 716 | * @param string $repeater_key The repeater key containing the array of all the items in the repeater (e.g. `tabs`). |
| 851 | - * @param int $repeater_item_index The current item index in the repeater array (e.g. `3`). | |
| 717 | + * @param int $repeater_item_index The current item index in the repeater array (e.g. `3`). | |
| 852 | 718 | * |
| 853 | 719 | * @return string The repeater setting key (e.g. `tabs.3.tab_title`). |
| 854 | 720 | */ |
| 855 | 721 | protected function get_repeater_setting_key( $setting_key, $repeater_key, $repeater_item_index ) { |
| @@ -898,9 +764,9 @@ | ||
| 898 | 764 | /** |
| 899 | 765 | * Add new skin. |
| 900 | 766 | * |
| 901 | 767 | * Register new widget skin to allow the user to set custom designs. Must be |
| 902 | - * called inside the `register_skins()` method. | |
| 768 | + * called inside the `_register_skins()` method. | |
| 903 | 769 | * |
| 904 | 770 | * @since 1.0.0 |
| 905 | 771 | * @access public |
| 906 | 772 | * |
| @@ -991,33 +857,17 @@ | ||
| 991 | 857 | return Plugin::$instance->skins_manager->get_skins( $this ); |
| 992 | 858 | } |
| 993 | 859 | |
| 994 | 860 | /** |
| 995 | - * Get group name. | |
| 996 | - * | |
| 997 | - * Some widgets need to use group names, this method allows you to create them. | |
| 998 | - * By default it retrieves the regular name. | |
| 999 | - * | |
| 1000 | - * @since 3.3.0 | |
| 1001 | - * @access public | |
| 1002 | - * | |
| 1003 | - * @return string Unique name. | |
| 861 | + * @param string $plugin_title Plugin's title | |
| 862 | + * @param string $since Plugin version widget was deprecated | |
| 863 | + * @param string $last Plugin version in which the widget will be removed | |
| 864 | + * @param string $replacement Widget replacement | |
| 1004 | 865 | */ |
| 1005 | - public function get_group_name() { | |
| 1006 | - return $this->get_name(); | |
| 1007 | - } | |
| 1008 | - | |
| 1009 | - /** | |
| 1010 | - * @param string $plugin_title Plugin's title. | |
| 1011 | - * @param string $since Plugin version widget was deprecated. | |
| 1012 | - * @param string $last Plugin version in which the widget will be removed. | |
| 1013 | - * @param string $replacement Widget replacement. | |
| 1014 | - */ | |
| 1015 | 866 | protected function deprecated_notice( $plugin_title, $since, $last = '', $replacement = '' ) { |
| 1016 | - $this->start_controls_section( | |
| 1017 | - 'Deprecated', | |
| 867 | + $this->start_controls_section( 'Deprecated', | |
| 1018 | 868 | [ |
| 1019 | - 'label' => esc_html__( 'Deprecated', 'elementor' ), | |
| 869 | + 'label' => __( 'Deprecated', 'elementor' ), | |
| 1020 | 870 | ] |
| 1021 | 871 | ); |
| 1022 | 872 | |
| 1023 | 873 | $this->add_control( |
| @@ -1032,52 +882,7 @@ | ||
| 1032 | 882 | ] |
| 1033 | 883 | ); |
| 1034 | 884 | |
| 1035 | 885 | $this->end_controls_section(); |
| 1036 | - } | |
| 1037 | 886 | |
| 1038 | - /** | |
| 1039 | - * Init controls. | |
| 1040 | - * | |
| 1041 | - * Reset the `is_first_section` flag to true, so when the Stacks are cleared | |
| 1042 | - * all the controls will be registered again with their skins and settings. | |
| 1043 | - * | |
| 1044 | - * @since 3.14.0 | |
| 1045 | - * @access protected | |
| 1046 | - */ | |
| 1047 | - protected function init_controls() { | |
| 1048 | - $this->is_first_section = true; | |
| 1049 | - parent::init_controls(); | |
| 1050 | - } | |
| 1051 | - | |
| 1052 | - public function register_runtime_widget( $widget_name ) { | |
| 1053 | - self::$registered_runtime_widgets[] = $widget_name; | |
| 1054 | - } | |
| 1055 | - | |
| 1056 | - /** | |
| 1057 | - * Mark widget as deprecated. | |
| 1058 | - * | |
| 1059 | - * Use `get_deprecation_message()` method to print the message control at specific location in register_controls(). | |
| 1060 | - * | |
| 1061 | - * @param string $version The version of Elementor that deprecated the widget. | |
| 1062 | - * @param string $message A message regarding the deprecation. | |
| 1063 | - * @param string $replacement The widget that should be used instead. | |
| 1064 | - */ | |
| 1065 | - protected function add_deprecation_message( $version, $message, $replacement ) { | |
| 1066 | - // Expose the config for handling in JS. | |
| 1067 | - $this->set_config( 'deprecation', [ | |
| 1068 | - 'version' => $version, | |
| 1069 | - 'message' => $message, | |
| 1070 | - 'replacement' => $replacement, | |
| 1071 | - ] ); | |
| 1072 | - | |
| 1073 | - $this->add_control( | |
| 1074 | - 'deprecation_message', | |
| 1075 | - [ | |
| 1076 | - 'type' => Controls_Manager::ALERT, | |
| 1077 | - 'alert_type' => 'info', | |
| 1078 | - 'content' => $message, | |
| 1079 | - 'separator' => 'after', | |
| 1080 | - ] | |
| 1081 | - ); | |
| 1082 | 887 | } |
| 1083 | 888 | } |