Eliminate use of `extract()` in `wp_star_rating()`.
See #22400. git-svn-id: https://develop.svn.wordpress.org/trunk@28409 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5e046b92fd
commit
98ca12ef2e
|
@ -2070,13 +2070,12 @@ function wp_star_rating( $args = array() ) {
|
|||
'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 );
|
||||
$rating = str_replace( ',', '.', $r['rating'] );
|
||||
|
||||
// Convert Percentage to star rating, 0..5 in .5 increments
|
||||
if ( 'percent' == $type ) {
|
||||
if ( 'percent' == $r['type'] ) {
|
||||
$rating = round( $rating / 10, 0 ) / 2;
|
||||
}
|
||||
|
||||
|
@ -2085,10 +2084,10 @@ function wp_star_rating( $args = array() ) {
|
|||
$half_stars = ceil( $rating - $full_stars );
|
||||
$empty_stars = 5 - $full_stars - $half_stars;
|
||||
|
||||
if ( $number ) {
|
||||
if ( $r['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 ) );
|
||||
$format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $r['number'] );
|
||||
$title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $r['number'] ) );
|
||||
} else {
|
||||
/* translators: 1: The rating */
|
||||
$title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) );
|
||||
|
|
Loading…
Reference in New Issue