Make WordPress Core

Ticket #34080: 34080.patch

File 34080.patch, 6.3 KB (added by SergeyBiryukov, 11 years ago)
  • src/wp-admin/css/themes.css

     
    11541154        }
    11551155}
    11561156
    1157 .theme-details .star-rating {
    1158         margin: 15px 0 0;
     1157.theme-details .theme-rating {
     1158        line-height: 23px;
    11591159}
    11601160
    1161 .theme-details .star-rating span:before {
    1162         color: #ffb900;
    1163         content: "\f154";
    1164         display: inline-block;
    1165         -webkit-font-smoothing: antialiased;
    1166         font: normal 20px/1 dashicons;
    1167         vertical-align: top;
     1161.theme-details .star-rating {
     1162        display: inline;
    11681163}
    11691164
    1170 /* Half stars */
    1171 .star-rating.rating-10 span.one:before,
    1172 .star-rating.rating-30 span.two:before,
    1173 .star-rating.rating-50 span.three:before,
    1174 .star-rating.rating-70 span.four:before,
    1175 .star-rating.rating-90 span.five:before {
    1176         content: "\f459";
     1165.theme-details .num-ratings,
     1166.theme-details .no-rating {
     1167        font-size: 11px;
     1168        color: #999;
    11771169}
    11781170
    1179 /* Full stars */
    1180 .star-rating.rating-20 span.one:before,
    1181 .star-rating.rating-30 span.one:before,
    1182 .star-rating.rating-40 span.one:before,
    1183 .star-rating.rating-40 span.two:before,
    1184 .star-rating.rating-50 span.one:before,
    1185 .star-rating.rating-50 span.two:before,
    1186 .star-rating.rating-60 span.one:before,
    1187 .star-rating.rating-60 span.two:before,
    1188 .star-rating.rating-60 span.three:before,
    1189 .star-rating.rating-70 span.one:before,
    1190 .star-rating.rating-70 span.two:before,
    1191 .star-rating.rating-70 span.three:before,
    1192 .star-rating.rating-80 span.one:before,
    1193 .star-rating.rating-80 span.two:before,
    1194 .star-rating.rating-80 span.three:before,
    1195 .star-rating.rating-80 span.four:before,
    1196 .star-rating.rating-90 span.one:before,
    1197 .star-rating.rating-90 span.two:before,
    1198 .star-rating.rating-90 span.three:before,
    1199 .star-rating.rating-90 span.four:before,
    1200 .star-rating.rating-100 > span:before {
    1201         content: "\f155";
    1202 }
    1203 
    1204 .theme-details .star-rating .ratings {
     1171.theme-details .no-rating {
    12051172        display: block;
    12061173        line-height: 20px;
    1207         color: #999;
    12081174}
    12091175
    12101176/*------------------------------------------------------------------------------
     
    16281594}
    16291595
    16301596.install-theme-info .theme-screenshot {
    1631         margin-top: 15px;
     1597        margin: 15px 0;
    16321598        width: 258px;
    16331599        border: 1px solid #ccc;
    16341600}
  • src/wp-admin/includes/ajax-actions.php

     
    27972797                $theme->author      = wp_kses( $theme->author, $themes_allowedtags );
    27982798                $theme->version     = wp_kses( $theme->version, $themes_allowedtags );
    27992799                $theme->description = wp_kses( $theme->description, $themes_allowedtags );
    2800                 $theme->num_ratings = sprintf( _n( '(based on %s rating)', '(based on %s ratings)', $theme->num_ratings ), number_format_i18n( $theme->num_ratings ) );
     2800                $theme->stars       = wp_star_rating( array( 'rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings, 'echo' => false ) );
     2801                $theme->num_ratings = number_format_i18n( $theme->num_ratings );
    28012802                $theme->preview_url = set_url_scheme( $theme->preview_url );
    28022803        }
    28032804
  • src/wp-admin/includes/template-functions.php

     
    19491949 * number of ratings may also be displayed by passing the $number parameter.
    19501950 *
    19511951 * @since 3.8.0
     1952 * @since 4.4.0 Introduced the `echo` parameter.
     1953 *
    19521954 * @param array $args {
    19531955 *     Optional. Array of star ratings arguments.
    19541956 *
     
    19571959 *     @type string $type   Format that the $rating is in. Valid values are 'rating' (default),
    19581960 *                          or, 'percent'. Default 'rating'.
    19591961 *     @type int    $number The number of ratings that makes up this rating. Default 0.
     1962 *     @type bool   $echo   Whether to echo the generated markup. False to return the markup instead
     1963 *                          of echoing it. Default true.
    19601964 * }
    19611965 */
    19621966function wp_star_rating( $args = array() ) {
    19631967        $defaults = array(
    19641968                'rating' => 0,
    1965                 'type' => 'rating',
     1969                'type'   => 'rating',
    19661970                'number' => 0,
     1971                'echo'   => true,
    19671972        );
    19681973        $r = wp_parse_args( $args, $defaults );
    19691974
     
    19891994                $title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) );
    19901995        }
    19911996
    1992         echo '<div class="star-rating" title="' . esc_attr( $title ) . '">';
    1993         echo '<span class="screen-reader-text">' . $title . '</span>';
    1994         echo str_repeat( '<div class="star star-full"></div>', $full_stars );
    1995         echo str_repeat( '<div class="star star-half"></div>', $half_stars );
    1996         echo str_repeat( '<div class="star star-empty"></div>', $empty_stars);
    1997         echo '</div>';
     1997        $output = '<div class="star-rating" title="' . esc_attr( $title ) . '">';
     1998        $output .= '<span class="screen-reader-text">' . $title . '</span>';
     1999        $output .= str_repeat( '<div class="star star-full"></div>', $full_stars );
     2000        $output .= str_repeat( '<div class="star star-half"></div>', $half_stars );
     2001        $output .= str_repeat( '<div class="star star-empty"></div>', $empty_stars );
     2002        $output .= '</div>';
     2003
     2004        if ( $r['echo'] ) {
     2005                echo $output;
     2006        }
     2007
     2008        return $output;
    19982009}
    19992010
    20002011/**
  • src/wp-admin/theme-install.php

     
    239239
    240240                                <div class="theme-details">
    241241                                        <# if ( data.rating ) { #>
    242                                                 <div class="star-rating rating-{{ Math.round( data.rating / 10 ) * 10 }}">
    243                                                         <span class="one"></span><span class="two"></span><span class="three"></span><span class="four"></span><span class="five"></span>
    244                                                         <small class="ratings">{{ data.num_ratings }}</small>
     242                                                <div class="theme-rating">
     243                                                        {{{ data.stars }}}
     244                                                        <span class="num-ratings">({{ data.num_ratings }})</span>
    245245                                                </div>
    246246                                        <# } else { #>
    247                                                 <div class="star-rating">
    248                                                         <small class="ratings"><?php _e( 'This theme has not been rated yet.' ); ?></small>
    249                                                 </div>
     247                                                <span class="no-rating"><?php _e( 'This theme has not been rated yet.' ); ?></span>
    250248                                        <# } #>
    251249                                        <div class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></div>
    252250                                        <div class="theme-description">{{{ data.description }}}</div>