PluginProbe
Elementor Website Builder – more than just a page builder / 3.28.0-dev2
Elementor Website Builder – more than just a page builder v3.28.0-dev2
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/widgets/heading.php +25 -114 4.0.73.28.0-dev2 View file →
@@ -7,10 +7,8 @@
7 7
8 8 use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
9 9 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
10 10 use Elementor\Modules\ContentSanitizer\Interfaces\Sanitizable;
11 -use Elementor\Core\Utils\Hints;
12 -use Elementor\Core\Admin\Admin_Notices;
13 11 use Elementor\Modules\Promotions\Controls\Promotion_Control;
14 12
15 13 /**
16 14 * Elementor heading widget.
@@ -141,29 +139,8 @@
141 139 return wp_kses( $content, $allowed_tags_for_heading );
142 140 }
143 141
144 142 /**
145 - * Get widget upsale data.
146 - *
147 - * Retrieve the widget promotion data.
148 - *
149 - * @since 3.18.0
150 - * @access protected
151 - *
152 - * @return array Widget promotion data.
153 - */
154 - protected function get_upsale_data() {
155 - return [
156 - 'condition' => ! Utils::has_pro(),
157 - 'image' => esc_url( ELEMENTOR_ASSETS_URL . 'images/go-pro.svg' ),
158 - 'image_alt' => esc_attr__( 'Upgrade', 'elementor' ),
159 - 'description' => esc_html__( 'Create captivating headings that rotate with the Animated Headline Widget.', 'elementor' ),
160 - 'upgrade_url' => esc_url( 'https://go.elementor.com/go-pro-heading-widget/' ),
161 - 'upgrade_text' => esc_html__( 'Upgrade Now', 'elementor' ),
162 - ];
163 - }
164 -
165 - /**
166 143 * Register heading widget controls.
167 144 *
168 145 * Adds different input fields to allow the user to change and customize the widget settings.
169 146 *
@@ -247,9 +224,17 @@
247 224 'default' => 'h2',
248 225 ]
249 226 );
250 227
251 - $this->maybe_add_ally_heading_hint();
228 + if ( ! Utils::has_pro() ) {
229 + $this->add_control(
230 + Utils::ANIMATED_HEADLINE . '_promotion',
231 + [
232 + 'label' => esc_html__( 'Animated Headline widget', 'elementor' ),
233 + 'type' => Promotion_Control::TYPE,
234 + ]
235 + );
236 + }
252 237
253 238 $this->end_controls_section();
254 239
255 240 $this->start_controls_section(
@@ -265,10 +250,10 @@
265 250 [
266 251 'label' => esc_html__( 'Alignment', 'elementor' ),
267 252 'type' => Controls_Manager::CHOOSE,
268 253 'options' => [
269 - 'start' => [
270 - 'title' => esc_html__( 'Start', 'elementor' ),
254 + 'left' => [
255 + 'title' => esc_html__( 'Left', 'elementor' ),
271 256 'icon' => 'eicon-text-align-left',
272 257 ],
273 258 'center' => [
274 259 'title' => esc_html__( 'Center', 'elementor' ),
@@ -273,10 +258,10 @@
273 258 'center' => [
274 259 'title' => esc_html__( 'Center', 'elementor' ),
275 260 'icon' => 'eicon-text-align-center',
276 261 ],
277 - 'end' => [
278 - 'title' => esc_html__( 'End', 'elementor' ),
262 + 'right' => [
263 + 'title' => esc_html__( 'Right', 'elementor' ),
279 264 'icon' => 'eicon-text-align-right',
280 265 ],
281 266 'justify' => [
282 267 'title' => esc_html__( 'Justified', 'elementor' ),
@@ -282,13 +267,8 @@
282 267 'title' => esc_html__( 'Justified', 'elementor' ),
283 268 'icon' => 'eicon-text-align-justify',
284 269 ],
285 270 ],
286 - 'classes' => 'elementor-control-start-end',
287 - 'selectors_dictionary' => [
288 - 'left' => is_rtl() ? 'end' : 'start',
289 - 'right' => is_rtl() ? 'start' : 'end',
290 - ],
291 271 'default' => '',
292 272 'selectors' => [
293 273 '{{WRAPPER}}' => 'text-align: {{VALUE}};',
294 274 ],
@@ -445,9 +425,9 @@
445 425 }
446 426
447 427 $this->add_inline_editing_attributes( 'title' );
448 428
449 - $title = wp_kses_post( $settings['title'] );
429 + $title = $this->should_sanitize( $settings ) ? wp_kses_post( $settings['title'] ) : $settings['title'];
450 430
451 431 if ( ! empty( $settings['link']['url'] ) ) {
452 432 $this->add_link_attributes( 'url', $settings['link'] );
453 433
@@ -459,86 +439,8 @@
459 439 // PHPCS - the variable $title_html holds safe data.
460 440 echo $title_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
461 441 }
462 442
463 - public function maybe_add_ally_heading_hint() {
464 - $notice_id = 'ally_heading_notice';
465 - $plugin_slug = 'pojo-accessibility';
466 -
467 - if ( ! Hints::should_display_hint( $notice_id ) ) {
468 - return;
469 - }
470 -
471 - $one_subscription = Hints::is_plugin_connected_to_one_subscription();
472 - $is_installed = Hints::is_plugin_installed( $plugin_slug );
473 - $is_active = Hints::is_plugin_active( $plugin_slug );
474 -
475 - if ( $is_active ) {
476 - return;
477 - }
478 -
479 - if ( $one_subscription ) {
480 - if ( ! $is_installed ) {
481 - $notice_content = esc_html__( 'Want to ensure this heading is accessible? Your ONE subscription includes Ally. Install it and scan your page.', 'elementor' );
482 - $button_text = esc_html__( 'Install now', 'elementor' );
483 - $button_url = Hints::get_plugin_install_url( $plugin_slug );
484 - $campaign_data = [
485 - 'name' => 'elementor_ea11y_campaign',
486 - 'campaign' => 'acc-scanner-plg-heading-one-install',
487 - 'source' => 'editor-heading-widget-one-install',
488 - 'medium' => 'editor-one',
489 - ];
490 - } elseif ( ! $is_active ) {
491 - $notice_content = esc_html__( 'Keep your content accessible. Activate Ally, included in ONE, to scan this page.', 'elementor' );
492 - $button_text = esc_html__( 'Activate now', 'elementor' );
493 - $button_url = Hints::get_plugin_activate_url( $plugin_slug );
494 - $campaign_data = [
495 - 'name' => 'elementor_ea11y_campaign',
496 - 'campaign' => 'acc-scanner-plg-heading-one-activate',
497 - 'source' => 'editor-heading-widget-one-non-activate',
498 - 'medium' => 'editor-one',
499 - ];
500 - }
501 - } else {
502 - $notice_content = esc_html__( 'Make sure your page is structured with accessibility in mind. Ally helps detect and fix common issues across your site.', 'elementor' );
503 - if ( ! $is_installed ) {
504 - $button_text = esc_html__( 'Install now', 'elementor' );
505 - $button_url = Hints::get_plugin_install_url( $plugin_slug );
506 - } elseif ( ! $is_active ) {
507 - $button_text = esc_html__( 'Activate now', 'elementor' );
508 - $button_url = Hints::get_plugin_activate_url( $plugin_slug );
509 - }
510 - $campaign_data = [
511 - 'name' => 'elementor_ea11y_campaign',
512 - 'campaign' => 'acc-scanner-plg-heading',
513 - 'source' => 'editor-heading-widget',
514 - 'medium' => 'editor',
515 - ];
516 - }
517 -
518 - $notice_heading = esc_html__( 'Accessible structure matters', 'elementor' );
519 -
520 - $this->add_control(
521 - $notice_id,
522 - [
523 - 'type' => Controls_Manager::RAW_HTML,
524 - 'raw' => Hints::get_notice_template( [
525 - 'display' => ! Hints::is_dismissed( $notice_id ),
526 - 'heading' => $notice_heading,
527 - 'type' => 'info',
528 - 'content' => $notice_content,
529 - 'icon' => true,
530 - 'dismissible' => $notice_id,
531 - 'button_text' => $button_text,
532 - 'button_event' => $notice_id,
533 - 'button_data' => [
534 - 'action_url' => Admin_Notices::add_plg_campaign_data( $button_url, $campaign_data ),
535 - ],
536 - ], true ),
537 - ]
538 - );
539 - }
540 -
541 443 /**
542 444 * Render heading widget output in the editor.
543 445 *
544 446 * Written as a Backbone JavaScript template and used to generate the live preview.
@@ -550,10 +452,10 @@
550 452 ?>
551 453 <#
552 454 let title = elementor.helpers.sanitize( settings.title, { ALLOW_DATA_ATTR: false } );
553 455
554 - if ( '' !== settings.link?.url ) {
555 - title = '<a href="' + elementor.helpers.sanitizeUrl( settings.link?.url ) + '">' + title + '</a>';
456 + if ( '' !== settings.link.url ) {
457 + title = '<a href="' + elementor.helpers.sanitizeUrl( settings.link.url ) + '">' + title + '</a>';
556 458 }
557 459
558 460 view.addRenderAttribute( 'title', 'class', [ 'elementor-heading-title' ] );
559 461
@@ -570,6 +472,15 @@
570 472
571 473 print( title_html );
572 474 #>
573 475 <?php
476 + }
477 +
478 + /**
479 + * Check if the content should be sanitized. Sanitizing should be applied for non-admin users in the editor and for shortcodes.
480 + *
481 + * @return bool
482 + */
483 + private function should_sanitize( array $settings ): bool {
484 + return ( is_admin() && ! current_user_can( 'manage_options' ) ) || ! empty( $settings['isShortcode'] );
574 485 }
575 486 }