diff --git a/src/wp-admin/css/color-schemes/_admin.scss b/src/wp-admin/css/color-schemes/_admin.scss index a2e7c0acf5..c63c8ce35b 100644 --- a/src/wp-admin/css/color-schemes/_admin.scss +++ b/src/wp-admin/css/color-schemes/_admin.scss @@ -392,3 +392,7 @@ div#moby6-toggle a:before { border-color: transparent; background: $menu-highlight-background; } + +.star-rating .star { + color: $highlight-color; +} \ No newline at end of file diff --git a/src/wp-admin/css/wp-admin.css b/src/wp-admin/css/wp-admin.css index 73efbfe251..b50b716a5a 100644 --- a/src/wp-admin/css/wp-admin.css +++ b/src/wp-admin/css/wp-admin.css @@ -7714,8 +7714,8 @@ body.full-overlay-active { float: left; } -.theme-details .star-holder { - margin: 14px 0; +.theme-details .star-rating { + margin: 7px 0; float: right; } @@ -9341,7 +9341,7 @@ body.menu-max-depth-11 { min-width: 1280px !important; } display: block; } -/* Star ratings */ +/* Star Ratings - Back-compat for pre-3.8 */ div.star-holder { position: relative; height: 17px; @@ -9355,6 +9355,40 @@ div.star-holder .star-rating { float: left; } +/* Star Ratings */ +.star-rating { + white-space: nowrap; +} +.star-rating .star { + display: inline-block; + width: 25px; + height: 25px; + -webkit-font-smoothing: antialiased; + font-size: 25px; + line-height: 1; + font-family: 'dashicons'; + text-decoration: inherit; + font-weight: normal; + font-style: normal; + vertical-align: top; + -moz-transition: color .1s ease-in 0; + -webkit-transition: color .1s ease-in 0; + text-align: center; + color: #0074a2; +} + +.star-rating .star-full:before { + content:'\f155'; +} + +.star-rating .star-half:before { + content:'\f459'; +} + +.star-rating .star-empty:before { + content:'\f154'; +} + div.action-links { font-weight: normal; margin: 6px 0 0; @@ -10725,11 +10759,13 @@ li#wp-admin-bar-toggle-button { background-size: 11px 11px; } + /* Back-compat for pre-3.8 */ div.star-holder { background: url('../images/stars-2x.png?ver=20121108') repeat-x bottom left; background-size: 21px 37px; } + /* Back-compat for pre-3.8 */ div.star-holder .star-rating { background: url('../images/stars-2x.png?ver=20121108') repeat-x top left; background-size: 21px 37px; diff --git a/src/wp-admin/includes/class-wp-plugin-install-list-table.php b/src/wp-admin/includes/class-wp-plugin-install-list-table.php index 6cae9cef63..6096464d69 100644 --- a/src/wp-admin/includes/class-wp-plugin-install-list-table.php +++ b/src/wp-admin/includes/class-wp-plugin-install-list-table.php @@ -270,9 +270,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table { > > -
-
-
+ $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'] ) ); ?> > diff --git a/src/wp-admin/includes/class-wp-theme-install-list-table.php b/src/wp-admin/includes/class-wp-theme-install-list-table.php index 7bb8f18626..a4fc5ba83d 100644 --- a/src/wp-admin/includes/class-wp-theme-install-list-table.php +++ b/src/wp-admin/includes/class-wp-theme-install-list-table.php @@ -341,9 +341,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
-
-
-
+ $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings ) ); ?>
version, $themes_allowedtags ); ?> diff --git a/src/wp-admin/includes/plugin-install.php b/src/wp-admin/includes/plugin-install.php index 58a9e9bab7..37d862e0f5 100644 --- a/src/wp-admin/includes/plugin-install.php +++ b/src/wp-admin/includes/plugin-install.php @@ -413,9 +413,7 @@ function install_plugin_information() { rating) ) : ?>

-
-
-
+ $api->rating, 'type' => 'percent', 'number' => $api->num_ratings ) ); ?> num_ratings), number_format_i18n($api->num_ratings)); ?>
diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php index eda4c953c2..9ff2e0cd5b 100644 --- a/src/wp-admin/includes/template.php +++ b/src/wp-admin/includes/template.php @@ -1966,3 +1966,55 @@ function _local_storage_notice() {
0, + 'type' => 'rating', + 'number' => 0, + ); + $r = wp_parse_args( $args, $defaults ); + extract( $r, EXTR_SKIP ); + + // Non-english decimal places when the $rating is coming from a string + $rating = str_replace( ',', '.', $rating ); + + // Convert Percentage to star rating, 0..5 in .5 increments + if ( 'percent' == $type ) { + $rating = round( $rating / 10, 0 ) / 2; + } + + // Calculate the number of each type of star needed + $full_stars = floor( $rating ); + $half_stars = ceil( $rating - $full_stars ); + $empty_stars = 5 - $full_stars - $half_stars; + + if ( $number ) { + /* translators: 1: The rating, 2: The number of ratings */ + $title = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $number ); + $title = sprintf( $title, number_format_i18n( $rating, 1 ), number_format_i18n( $number ) ); + } else { + /* translators: 1: The rating */ + $title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) ); + } + + echo '
'; + echo str_repeat( '
', $full_stars ); + echo str_repeat( '
', $half_stars ); + echo str_repeat( '
', $empty_stars); + echo '
'; +} \ No newline at end of file