From a75f8137bcf8bc01978ae98576d8c02dde2825a7 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 15 May 2014 02:57:14 +0000 Subject: [PATCH] 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 --- wp-admin/includes/template.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index fb5814483c..b4caec8825 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -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 ) );