PluginProbe
Elementor Website Builder – more than just a page builder / 3.33.0-beta1
Elementor Website Builder – more than just a page builder v3.33.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 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 All 457 releases
← All changes | includes/widgets/star-rating.php +8 -29 4.2.4 → 3.33.0-beta1 View file →
@@ -208,8 +208,11 @@
208 208 ],
209 209 ]
210 210 );
211 211
212 + $start = is_rtl() ? 'right' : 'left';
213 + $end = ! is_rtl() ? 'right' : 'left';
214 +
212 215 $this->add_responsive_control(
213 216 'align',
214 217 [
215 218 'label' => esc_html__( 'Alignment', 'elementor' ),
@@ -216,9 +219,9 @@
216 219 'type' => Controls_Manager::CHOOSE,
217 220 'options' => [
218 221 'start' => [
219 222 'title' => esc_html__( 'Start', 'elementor' ),
220 - 'icon' => 'eicon-text-align-left',
223 + 'icon' => "eicon-text-align-$start",
221 224 ],
222 225 'center' => [
223 226 'title' => esc_html__( 'Center', 'elementor' ),
224 227 'icon' => 'eicon-text-align-center',
@@ -224,9 +227,9 @@
224 227 'icon' => 'eicon-text-align-center',
225 228 ],
226 229 'end' => [
227 230 'title' => esc_html__( 'End', 'elementor' ),
228 - 'icon' => 'eicon-text-align-right',
231 + 'icon' => "eicon-text-align-$end",
229 232 ],
230 233 'justify' => [
231 234 'title' => esc_html__( 'Justified', 'elementor' ),
232 235 'icon' => 'eicon-text-align-justify',
@@ -231,9 +234,8 @@
231 234 'title' => esc_html__( 'Justified', 'elementor' ),
232 235 'icon' => 'eicon-text-align-justify',
233 236 ],
234 237 ],
235 - 'classes' => 'elementor-control-start-end',
236 238 'classes_dictionary' => [
237 239 'left' => is_rtl() ? 'end' : 'start',
238 240 'right' => is_rtl() ? 'start' : 'end',
239 241 ],
@@ -411,9 +413,9 @@
411 413 */
412 414 protected function get_rating() {
413 415 $settings = $this->get_settings_for_display();
414 416 $rating_scale = (int) $settings['rating_scale'];
415 - $rating = min( (float) $settings['rating'], $rating_scale );
417 + $rating = (float) $settings['rating'] > $rating_scale ? $rating_scale : $settings['rating'];
416 418
417 419 return [ $rating, $rating_scale ];
418 420 }
419 421
@@ -442,9 +444,9 @@
442 444 $stars_html .= '<i class="elementor-star-empty" aria-hidden="true">' . $icon . '</i>';
443 445 }
444 446 }
445 447
446 - Utils::print_unescaped_internal_string( $stars_html );
448 + return $stars_html;
447 449 }
448 450
449 451 /**
450 452 * @since 2.3.0
@@ -484,36 +486,13 @@
484 486 <?php if ( ! Utils::is_empty( $settings['title'] ) ) : ?>
485 487 <div class="elementor-star-rating__title"><?php echo esc_html( $settings['title'] ); ?></div>
486 488 <?php endif; ?>
487 489 <div <?php $this->print_render_attribute_string( 'icon_wrapper' ); ?>>
488 - <?php $this->render_stars( $icon ); ?>
490 + <?php echo $this->render_stars( $icon ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
489 491 <span itemprop="ratingValue" class="elementor-screen-only"><?php echo esc_html( $textual_rating ); ?></span>
490 492 </div>
491 493 </div>
492 494 <?php
493 - }
494 -
495 - public function render_markdown(): string {
496 - $settings = $this->get_settings_for_display();
497 - $title = Utils::html_to_plain_text( $settings['title'] ?? '' );
498 - $rating = floatval( $settings['rating'] ?? 0 );
499 - $scale = intval( $settings['rating_scale'] ?? 5 );
500 -
501 - if ( empty( $rating ) ) {
502 - return '';
503 - }
504 -
505 - $full_stars = intval( floor( $rating ) );
506 - $empty_stars = $scale - $full_stars;
507 - $stars = str_repeat( '★', $full_stars ) . str_repeat( '☆', max( 0, $empty_stars ) );
508 -
509 - $md = $stars . ' ' . $rating . '/' . $scale;
510 -
511 - if ( ! empty( $title ) ) {
512 - $md .= "\n\n" . $title;
513 - }
514 -
515 - return $md;
516 495 }
517 496
518 497 /**
519 498 * @since 2.9.0