Eliminate use of `extract()` in `wp_star_rating()`.

See #22400.

Built from https://develop.svn.wordpress.org/trunk@28409


git-svn-id: http://core.svn.wordpress.org/trunk@28236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-05-15 02:57:14 +00:00
parent ff665b2f38
commit a75f8137bc
1 changed files with 5 additions and 6 deletions

View File

@ -2070,13 +2070,12 @@ function wp_star_rating( $args = array() ) {
'number' => 0, 'number' => 0,
); );
$r = wp_parse_args( $args, $defaults ); $r = wp_parse_args( $args, $defaults );
extract( $r, EXTR_SKIP );
// Non-english decimal places when the $rating is coming from a string // 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 // Convert Percentage to star rating, 0..5 in .5 increments
if ( 'percent' == $type ) { if ( 'percent' == $r['type'] ) {
$rating = round( $rating / 10, 0 ) / 2; $rating = round( $rating / 10, 0 ) / 2;
} }
@ -2085,10 +2084,10 @@ function wp_star_rating( $args = array() ) {
$half_stars = ceil( $rating - $full_stars ); $half_stars = ceil( $rating - $full_stars );
$empty_stars = 5 - $full_stars - $half_stars; $empty_stars = 5 - $full_stars - $half_stars;
if ( $number ) { if ( $r['number'] ) {
/* translators: 1: The rating, 2: The number of ratings */ /* 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 ); $format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $r['number'] );
$title = sprintf( $title, number_format_i18n( $rating, 1 ), number_format_i18n( $number ) ); $title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $r['number'] ) );
} else { } else {
/* translators: 1: The rating */ /* translators: 1: The rating */
$title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) ); $title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) );