summaryrefslogtreecommitdiff
path: root/views/mods/mod_reviews/rating.phtml
blob: 8c6fa2577b75e6a8bdf6941e210740f26f59f4c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
	/**
	 * Sterne mit Schnitt und Anzahl (Modul Produktbewertungen)
	 *
	 * Die Sternzeichen sind aria-hidden, den Wert sagt der Text. Leere Sterne sind Umrisse, volle Sterne liegen darüber. Modus full: Text sichtbar; compact: sichtbar „4,5 (12)“,
	 * der ganze Text für Screenreader; single: nur Sterne, der Text für Screenreader. Mit href ist in full die Anzahl der Link zur Liste derselben Seite.
	 * @version 4.6.1
	 */
	defined('ABSPATH') || exit;

	$r = $this->view['wpsg_mod_reviews']['rating'];
?>
<p class="wpsg-rating<?php if ($r['class'] !== '') echo ' '.esc_attr($r['class']); ?>"><span class="wpsg-rating__stars" aria-hidden="true"><span class="wpsg-rating__empty">☆☆☆☆☆</span><span class="wpsg-rating__fill" style="width:<?php echo intval($r['percent']); ?>%">★★★★★</span></span><?php if ($r['mode'] === 'full' && ($r['href']??'') !== '') { ?> <span class="wpsg-rating__text"><?php echo esc_html($r['stars']); ?>, <a class="wpsg-rating__link" href="<?php echo esc_url($r['href']); ?>"><?php echo esc_html($r['count']); ?></a></span><?php } else if ($r['mode'] === 'full') { ?> <span class="wpsg-rating__text"><?php echo esc_html($r['text']); ?></span><?php } else if ($r['mode'] === 'compact') { ?> <span class="wpsg-rating__text" aria-hidden="true"><?php echo esc_html($r['short']); ?></span><span class="screen-reader-text"><?php echo esc_html($r['text']); ?></span><?php } else { ?><span class="screen-reader-text"><?php echo esc_html($r['text']); ?></span><?php } ?></p>