PluginProbe ʕ •ᴥ•ʔ
Strong Testimonials / 2.38
Strong Testimonials v2.38
3.3.2 3.3.1 trunk 1.0.1 2.30.9 2.31.10 2.32 2.32.1 2.32.2 2.32.3 2.32.4 2.33 2.34 2.35 2.36 2.37 2.38 2.38.1 2.39 2.39.1 2.39.2 2.39.3 2.40.0 2.40.1 2.40.2 2.40.3 2.40.4 2.40.5 2.40.6 2.40.7 2.41.0 2.41.1 2.50.0 2.50.1 2.50.2 2.50.3 2.50.4 2.51.0 2.51.1 2.51.2 2.51.3 2.51.4 2.51.5 2.51.6 2.51.7 2.51.8 2.51.9 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.20 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.17 3.2.18 3.2.19 3.2.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0
strong-testimonials / includes / functions-rating.php
strong-testimonials / includes Last commit date
integrations 7 years ago class-strong-form.php 7 years ago class-strong-log.php 7 years ago class-strong-mail.php 7 years ago class-strong-templates.php 7 years ago class-strong-testimonials-order.php 7 years ago class-strong-testimonials-privacy.php 7 years ago class-strong-testimonials-render.php 7 years ago class-strong-testimonials-shortcode-average.php 7 years ago class-strong-testimonials-shortcode-count.php 7 years ago class-strong-testimonials-shortcode.php 7 years ago class-strong-view-display.php 7 years ago class-strong-view-form.php 7 years ago class-strong-view-slideshow.php 7 years ago class-strong-view.php 7 years ago class-walker-strong-category-checklist-front.php 7 years ago deprecated.php 7 years ago filters.php 7 years ago functions-activation.php 7 years ago functions-content.php 7 years ago functions-image.php 7 years ago functions-rating.php 7 years ago functions-template-form.php 7 years ago functions-template.php 7 years ago functions-views.php 7 years ago functions.php 7 years ago l10n-polylang.php 7 years ago l10n-wpml.php 7 years ago post-types.php 7 years ago retro.php 7 years ago scripts.php 7 years ago widget2.php 7 years ago
functions-rating.php
101 lines
1 <?php
2
3 /**
4 * Print the star rating form.
5 *
6 * @since 2.12.0
7 * @since 2.23.2 $field_array
8 *
9 * @param array|string $field
10 * @param int $value
11 * @param string $class
12 * @param bool $echo
13 * @param string $field_array If included, set field name in array. In post editor meta box.
14 *
15 * @return string
16 */
17 function wpmtst_star_rating_form( $field, $value = 0, $class, $echo = true, $field_array = '' ) {
18 $value = (int) $value;
19 if ( $field && is_array( $field ) && isset( $field['name'] ) ) {
20 $name = $field['name'];
21 if ( $field_array ) {
22 $name = $field_array . '[' . $name . ']';
23 }
24 } else {
25 $name = 'rating';
26 }
27 ob_start(); ?>
28 <div class="strong-rating-wrapper field-wrap <?php echo $class; ?>"><!-- cheap trick to collapse whitespace around inline-blocks
29 --><fieldset contenteditable=false
30 id="wpmtst_<?php echo $field['name']; ?>"
31 name="<?php echo $field['name']; ?>"
32 class="strong-rating"
33 data-field-type="rating"
34 tabindex="0"><!--
35
36 --><input type="radio" id="<?php echo $field['name']; ?>-star0" name="<?php echo $name; ?>" value="0" <?php checked( $value, 0 ); ?> /><!--
37 --><label for="<?php echo $field['name']; ?>-star0" title="No stars"></label><!--
38
39 --><input type="radio" id="<?php echo $field['name']; ?>-star1" name="<?php echo $name; ?>" value="1" <?php checked( $value, 1 ); ?> /><!--
40 --><label for="<?php echo $field['name']; ?>-star1" title="1 star"></label><!--
41
42 --><input type="radio" id="<?php echo $field['name']; ?>-star2" name="<?php echo $name; ?>" value="2" <?php checked( $value, 2 ); ?> /><!--
43 --><label for="<?php echo $field['name']; ?>-star2" title="2 stars"></label><!--
44
45 --><input type="radio" id="<?php echo $field['name']; ?>-star3" name="<?php echo $name; ?>" value="3" <?php checked( $value, 3 ); ?> /><!--
46 --><label for="<?php echo $field['name']; ?>-star3" title="3 stars"></label><!--
47
48 --><input type="radio" id="<?php echo $field['name']; ?>-star4" name="<?php echo $name; ?>" value="4" <?php checked( $value, 4 ); ?> /><!--
49 --><label for="<?php echo $field['name']; ?>-star4" title="4 stars"></label><!--
50
51 --><input type="radio" id="<?php echo $field['name']; ?>-star5" name="<?php echo $name; ?>" value="5" <?php checked( $value, 5 ); ?> /><!--
52 --><label for="<?php echo $field['name']; ?>-star5" title="5 stars"></label><!--
53
54 --></fieldset><!--
55 --></div>
56 <?php
57 $html = ob_get_contents();
58 ob_end_clean();
59 $html = preg_replace( '/<!--(.|\s)*?-->/', '', $html );
60
61 if ( $echo ) {
62 echo $html;
63 return true;
64 }
65
66 return $html;
67 }
68
69 /**
70 * @param int $value
71 * @param $class
72 * @param bool $echo
73 *
74 * @return bool|string
75 */
76 function wpmtst_star_rating_display( $value = 0, $class = 'in-view', $echo = true ) {
77 $value = (int) $value;
78 ob_start(); ?>
79 <span class="strong-rating-wrapper <?php echo $class; ?>">
80 <span class="strong-rating"><!-- cheap trick to collapse whitespace around inline-blocks
81 --><span class="star<?php echo ( 0 == $value ) ? ' current' : '' ; ?>" style="display: none;"></span><!--
82 --><span class="star<?php echo ( 1 == $value ) ? ' current' : '' ; ?>"></span><!--
83 --><span class="star<?php echo ( 2 == $value ) ? ' current' : '' ; ?>"></span><!--
84 --><span class="star<?php echo ( 3 == $value ) ? ' current' : '' ; ?>"></span><!--
85 --><span class="star<?php echo ( 4 == $value ) ? ' current' : '' ; ?>"></span><!--
86 --><span class="star<?php echo ( 5 == $value ) ? ' current' : '' ; ?>"></span><!--
87 --></span>
88 </span>
89 <?php
90 $html = ob_get_contents();
91 ob_end_clean();
92 $html = preg_replace( '/<!--(.|\s)*?-->/', '', $html );
93
94 if ( $echo ) {
95 echo $html;
96 return true;
97 }
98
99 return $html;
100 }
101