Changeset 41184
- Timestamp:
- 07/29/2017 08:34:26 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/template.php
r40967 r41184 2095 2095 * Optional. Array of star ratings arguments. 2096 2096 * 2097 * @type int 2098 * or percentage. Default 0.2099 * @type string $type Format that the $rating is in. Valid values are 'rating' (default),2100 * or, 'percent'. Default 'rating'.2101 * @type int $number The number of ratings that makes up this rating. Default 0.2102 * @type bool $echo Whether to echo the generated markup. False to return the markup instead2103 * of echoing it. Default true.2097 * @type int|float $rating The rating to display, expressed in either a 0.5 rating increment, 2098 * or percentage. Default 0. 2099 * @type string $type Format that the $rating is in. Valid values are 'rating' (default), 2100 * or, 'percent'. Default 'rating'. 2101 * @type int $number The number of ratings that makes up this rating. Default 0. 2102 * @type bool $echo Whether to echo the generated markup. False to return the markup instead 2103 * of echoing it. Default true. 2104 2104 * } 2105 * @return string Star rating HTML. 2105 2106 */ 2106 2107 function wp_star_rating( $args = array() ) { … … 2113 2114 $r = wp_parse_args( $args, $defaults ); 2114 2115 2115 // Non- english decimal places when the $rating is coming from a string2116 $rating = str_replace( ',', '.', $r['rating'] );2116 // Non-English decimal places when the $rating is coming from a string 2117 $rating = (float) str_replace( ',', '.', $r['rating'] ); 2117 2118 2118 2119 // Convert Percentage to star rating, 0..5 in .5 increments 2119 if ( 'percent' == $r['type'] ) {2120 if ( 'percent' === $r['type'] ) { 2120 2121 $rating = round( $rating / 10, 0 ) / 2; 2121 2122 }
Note: See TracChangeset
for help on using the changeset viewer.