+ <small><?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $api->num_ratings ), number_format_i18n( $api->num_ratings ) ); ?></small>
+ <?php }
+
+ if ( ! empty( $api->ratings ) && array_sum( (array) $api->ratings ) > 0 ) {
+ foreach( $api->ratings as $key => $ratecount ) {
+ // Avoid div-by-zero.
+ $_rating = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0;
+ ?>
+ <div class="counter-container">
+ <span class="counter-label"><a href="https://wordpress.org/support/view/plugin-reviews/<?php echo $api->slug; ?>?filter=<?php echo $key; ?>"
+ target="_blank"
+ title="<?php echo esc_attr( sprintf( _n( 'Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $key ), $key ) ); ?>"><?php printf( _n( '%d star', '%d stars', $key ), $key ); ?></a></span>
+ <span class="counter-back">
+ <span class="counter-bar" style="width: <?php echo 92 * $_rating; ?>px;"></span>
+ </span>
+ <span class="counter-count"><?php echo number_format_i18n( $ratecount ); ?></span>
+ </div>
+ <?php
+ }
+ }
+ if ( ! empty( $api->contributors ) ) { ?>
+ <h3><?php _e( 'Contributors' ); ?></h3>
+ <ul class="contributors">
+ <?php
+ foreach ( (array) $api->contributors as $contrib_username => $contrib_profile ) {
+ if ( empty( $contrib_username ) && empty( $contrib_profile ) ) {
+ continue;
+ }
+ if ( empty( $contrib_username ) ) {
+ $contrib_username = preg_replace( '/^.+\/(.+)\/?$/', '\1', $contrib_profile );
+ }
+ $contrib_username = sanitize_user( $contrib_username );
+ if ( empty( $contrib_profile ) ) {
+ echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</li>";
+ } else {
+ echo "<li><a href='{$contrib_profile}' target='_blank'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' />{$contrib_username}</a></li>";
+ }
+ }
+ ?>
+ </ul>
+ <?php if ( ! empty( $api->donate_link ) ) { ?>
+ <a target="_blank" href="<?php echo esc_url( $api->donate_link ); ?>"><?php _e( 'Donate to this plugin »' ); ?></a>
+ <?php } ?>
+ <?php } ?>