PluginProbe
Elementor Website Builder – more than just a page builder / 3.27.4
Elementor Website Builder – more than just a page builder v3.27.4
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | includes/base/widget-base.php +23 -58 4.3.0-beta13.27.4 View file →
@@ -1,10 +1,8 @@
1 1 <?php
2 2 namespace Elementor;
3 3
4 -use Elementor\Core\Frontend\Widget_Content_Render_Mode;
5 4 use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
6 -use Elementor\Utils;
7 5
8 6 if ( ! defined( 'ABSPATH' ) ) {
9 7 exit; // Exit if accessed directly.
10 8 }
@@ -301,9 +299,9 @@
301 299 foreach ( $skins as $skin_id => $skin ) {
302 300 $skin_options[ $skin_id ] = $skin->get_title();
303 301 }
304 302
305 - // Get the first item for default value.
303 + // Get the first item for default value
306 304 $default_value = array_keys( $skin_options );
307 305 $default_value = array_shift( $default_value );
308 306
309 307 if ( 1 >= count( $skin_options ) ) {
@@ -380,9 +378,9 @@
380 378 'categories' => $this->get_categories(),
381 379 'html_wrapper_class' => $this->get_html_wrapper_class(),
382 380 'show_in_panel' => $this->show_in_panel(),
383 381 'hide_on_search' => $this->hide_on_search(),
384 - 'upsale_data' => null,
382 + 'upsale_data' => $this->get_upsale_data(),
385 383 'is_dynamic_content' => $this->is_dynamic_content(),
386 384 'has_widget_inner_wrapper' => $this->has_widget_inner_wrapper(),
387 385 ];
388 386
@@ -427,9 +425,9 @@
427 425 protected function print_template_content( $template_content ) {
428 426 if ( $this->has_widget_inner_wrapper() ) : ?>
429 427 <div class="elementor-widget-container">
430 428 <?php endif;
431 - Utils::print_unescaped_internal_string( $template_content );
429 + echo $template_content; // XSS ok.
432 430 if ( $this->has_widget_inner_wrapper() ) : ?>
433 431 </div>
434 432 <?php endif;
435 433 }
@@ -542,17 +540,18 @@
542 540 *
543 541 * Used to add Light-Box-related data attributes to links that open media files.
544 542 *
545 543 * @param array|string $element The link HTML element.
546 - * @param int $id The ID of the image.
547 - * @param string $lightbox_setting_key The setting key that dictates whether to open the image in a lightbox.
548 - * @param string $group_id Unique ID for a group of lightbox images.
549 - * @param bool $overwrite Optional. Whether to overwrite existing
550 - * attribute. Default is false, not to overwrite.
544 + * @param int $id The ID of the image
545 + * @param string $lightbox_setting_key The setting key that dictates whether to open the image in a lightbox
546 + * @param string $group_id Unique ID for a group of lightbox images
547 + * @param bool $overwrite Optional. Whether to overwrite existing
548 + * attribute. Default is false, not to overwrite.
551 549 *
552 550 * @return Widget_Base Current instance of the widget.
553 551 * @since 2.9.0
554 552 * @access public
553 + *
555 554 */
556 555 public function add_lightbox_data_attributes( $element, $id = null, $lightbox_setting_key = null, $group_id = null, $overwrite = false ) {
557 556 $kit = Plugin::$instance->kits_manager->get_active_kit();
558 557
@@ -624,9 +623,9 @@
624 623 * @since 1.0.0
625 624 *
626 625 * @param Widget_Base $this The current widget.
627 626 */
628 - do_action( 'elementor/widget/before_render_content', $this, [ 'mode' => Widget_Content_Render_Mode::NORMAL ] );
627 + do_action( 'elementor/widget/before_render_content', $this );
629 628
630 629 ob_start();
631 630
632 631 $skin = $this->get_current_skin();
@@ -659,10 +658,11 @@
659 658 *
660 659 * @param string $widget_content The content of the widget.
661 660 * @param Widget_Base $this The widget.
662 661 */
663 - $widget_content = apply_filters( 'elementor/widget/render_content', $widget_content, $this, [ 'mode' => Widget_Content_Render_Mode::NORMAL ] );
664 - Utils::print_unescaped_internal_string( $widget_content );
662 + $widget_content = apply_filters( 'elementor/widget/render_content', $widget_content, $this );
663 +
664 + echo $widget_content; // XSS ok.
665 665 ?>
666 666 <?php if ( $this->has_widget_inner_wrapper() ) : ?>
667 667 </div>
668 668 <?php endif;
@@ -697,43 +697,8 @@
697 697 public function render_plain_content() {
698 698 $this->render_content();
699 699 }
700 700
701 - public function render_markdown(): string {
702 - $content = $this->get_render_content_for_markdown();
703 -
704 - if ( '' === $content ) {
705 - return '';
706 - }
707 -
708 - return \Elementor\Modules\MarkdownRender\Html_To_Markdown::convert( $content );
709 - }
710 -
711 - protected function get_render_content_for_markdown(): string {
712 - $render_args = [ 'mode' => Widget_Content_Render_Mode::MARKDOWN ];
713 -
714 - do_action( 'elementor/widget/before_render_content', $this, $render_args );
715 -
716 - ob_start();
717 -
718 - $skin = $this->get_current_skin();
719 -
720 - if ( $skin ) {
721 - $skin->set_parent( $this );
722 - $skin->render_by_mode();
723 - } else {
724 - $this->render_by_mode();
725 - }
726 -
727 - $widget_content = ob_get_clean();
728 -
729 - if ( '' === $widget_content ) {
730 - return '';
731 - }
732 -
733 - return apply_filters( 'elementor/widget/render_content', $widget_content, $this, $render_args );
734 - }
735 -
736 701 /**
737 702 * Before widget rendering.
738 703 *
739 704 * Used to add stuff before the widget `_wrapper` element.
@@ -815,10 +780,10 @@
815 780 *
816 781 * Script tags are allowed on frontend according to the WP theme securing policy.
817 782 *
818 783 * @param string $setting
819 - * @param null $repeater_name
820 - * @param null $index
784 + * @param null $repeater_name
785 + * @param null $index
821 786 */
822 787 final public function print_unescaped_setting( $setting, $repeater_name = null, $index = null ) {
823 788 if ( $repeater_name ) {
824 789 $repeater = $this->get_settings_for_display( $repeater_name );
@@ -883,9 +848,9 @@
883 848 * @access protected
884 849 *
885 850 * @param string $setting_key The current setting key inside the repeater item (e.g. `tab_title`).
886 851 * @param string $repeater_key The repeater key containing the array of all the items in the repeater (e.g. `tabs`).
887 - * @param int $repeater_item_index The current item index in the repeater array (e.g. `3`).
852 + * @param int $repeater_item_index The current item index in the repeater array (e.g. `3`).
888 853 *
889 854 * @return string The repeater setting key (e.g. `tabs.3.tab_title`).
890 855 */
891 856 protected function get_repeater_setting_key( $setting_key, $repeater_key, $repeater_item_index ) {
@@ -1042,12 +1007,12 @@
1042 1007 return $this->get_name();
1043 1008 }
1044 1009
1045 1010 /**
1046 - * @param string $plugin_title Plugin's title.
1047 - * @param string $since Plugin version widget was deprecated.
1048 - * @param string $last Plugin version in which the widget will be removed.
1049 - * @param string $replacement Widget replacement.
1011 + * @param string $plugin_title Plugin's title
1012 + * @param string $since Plugin version widget was deprecated
1013 + * @param string $last Plugin version in which the widget will be removed
1014 + * @param string $replacement Widget replacement
1050 1015 */
1051 1016 protected function deprecated_notice( $plugin_title, $since, $last = '', $replacement = '' ) {
1052 1017 $this->start_controls_section(
1053 1018 'Deprecated',
@@ -1093,11 +1058,11 @@
1093 1058 * Mark widget as deprecated.
1094 1059 *
1095 1060 * Use `get_deprecation_message()` method to print the message control at specific location in register_controls().
1096 1061 *
1097 - * @param string $version The version of Elementor that deprecated the widget.
1098 - * @param string $message A message regarding the deprecation.
1099 - * @param string $replacement The widget that should be used instead.
1062 + * @param $version string The version of Elementor that deprecated the widget.
1063 + * @param $message string A message regarding the deprecation.
1064 + * @param $replacement string The widget that should be used instead.
1100 1065 */
1101 1066 protected function add_deprecation_message( $version, $message, $replacement ) {
1102 1067 // Expose the config for handling in JS.
1103 1068 $this->set_config( 'deprecation', [