Changeset 14173
- Timestamp:
- 11/13/2024 05:02:50 AM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-ratings-compat.php
r13923 r14173 213 213 ?> 214 214 <div class="review-ratings"> 215 <div class="col-3"> 216 <div class="reviews-about" style="display:none;"><?php echo esc_html( $this->object->post_title ); ?></div> 217 <div class="reviews-total-count"><?php 218 printf( 219 /* translators: %s: number of reviews */ 220 _n( '%s review', '%s reviews', $this->reviews_count, 'wporg-forums' ), 221 '<span>' . number_format_i18n( $this->reviews_count ) . '</span>' 222 ); 223 ?></div> 224 <?php 225 foreach ( array( 5, 4, 3, 2, 1 ) as $rating ) { 226 $ratings_count = isset( $this->ratings_counts[ $rating ] ) ? $this->ratings_counts[ $rating ] : 0; 227 $ratings_count_total = isset( $this->ratings_counts ) ? array_sum( $this->ratings_counts) : 0; 228 $stars_title = sprintf( 229 /* translators: %s: number of stars */ 230 _n( 231 'Click to see reviews that provided a rating of %d star', 232 'Click to see reviews that provided a rating of %d stars', 233 $rating, 234 'wporg-forums' 235 ), 236 $rating 237 ); 238 /* translators: %d: number of stars */ 239 $stars_text = sprintf( 240 /* translators: %d: number of stars */ 241 _n( '%d star', '%d stars', $rating, 'wporg-forums' ), 242 $rating 243 ); 244 $width = 0; 245 if ( $ratings_count && $ratings_count_total ) { 246 $width = 100 * ( $ratings_count / $ratings_count_total ); 247 } 248 ?> 249 <div class="counter-container"> 250 <a href="<?php echo esc_url( sprintf( home_url( '/%s/%s/reviews/?filter=%s' ), $this->compat, $this->slug, $rating ) ); ?>" 251 title="<?php echo esc_attr( $stars_title ); ?>"> 252 <span class="counter-label" style="float:left;margin-right:5px;min-width:58px;"><?php echo esc_html( $stars_text ); ?></span> 253 <span class="counter-back" style="height:17px;width:100px;background-color:#ececec;float:left;"> 254 <span class="counter-bar" style="width:<?php echo esc_attr( $width ); ?>px;height:17px;background-color:#ffc733;float:left;"></span> 255 </span> 256 </a> 257 <span class="counter-count" style="margin-left:5px;"><?php echo esc_html( number_format_i18n( $ratings_count ) ); ?></span> 258 </div> 259 <?php 260 } 261 ?> 262 </div> 263 <div class="col-5"> 215 <div> 264 216 <div style="font-weight:bold;"><?php _e( 'Average Rating', 'wporg-forums' ); ?></div> 265 <?php 266 echo \WPORG_Ratings::get_dashicons_stars( $this->avg_rating ); 267 printf( 268 /* translators: 1: number of stars in rating, 2: total number of stars (5) */ 269 __( '%1$s out of %2$s stars', 'wporg-forums' ), 270 round( isset( $this->avg_rating ) ? $this->avg_rating : 0, 1 ), 271 '<span>5</span>' 272 ); 273 ?> 217 <?php echo do_blocks( '<!-- wp:wporg/ratings-stars /-->' ); ?> 274 218 <div class="reviews-submit-link"> 275 219 <?php … … 298 242 </div> 299 243 </div> 244 <div> 245 <div class="reviews-about" style="display:none;"><?php echo esc_html( $this->object->post_title ); ?></div> 246 <div class="reviews-total-count"><?php 247 printf( 248 /* translators: %s: number of reviews */ 249 _n( '%s review', '%s reviews', $this->reviews_count, 'wporg-forums' ), 250 '<span>' . number_format_i18n( $this->reviews_count ) . '</span>' 251 ); 252 ?></div> 253 <?php echo do_blocks( '<!-- wp:wporg/ratings-bars /-->' ); ?> 254 </div> 300 255 </div> 301 256 <?php
Note: See TracChangeset
for help on using the changeset viewer.