summaryrefslogtreecommitdiff
path: root/views/mods/mod_reviews/rating.phtml
blob: 63379ffdb77e45eae9f4c87ece09efe24080b342 (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.
	 * @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') { ?> <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>