Ticket #8252: int_aware_trim.diff
| File int_aware_trim.diff, 1.4 KB (added by , 18 years ago) |
|---|
-
wp-includes/post.php
1677 1677 if ( empty($tags) ) 1678 1678 $tags = array(); 1679 1679 $tags = (is_array($tags)) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") ); 1680 $tags = array_map(' trim', $tags); //Trim whitespace from around the tags.1680 $tags = array_map('wp_type_aware_trim', $tags); //Trim whitespace from around the tags. 1681 1681 wp_set_object_terms($post_id, $tags, 'post_tag', $append); 1682 1682 } 1683 1683 -
wp-includes/functions.php
2895 2895 return version_compare(phpversion(), '5.0') < 0 ? $object : clone($object); 2896 2896 } 2897 2897 2898 2898 /** 2899 * Trim without making integers to strings 2900 * 2901 * Returns a trimmed string or a integer 2902 * 2903 * @since 2.7.0 2904 * 2905 * @param string $string The string to be trimmed 2906 * @param string $charlist Possible charlist parameter for trim command 2907 * @return string/integer Trimmed string or integer value 2908 */ 2909 function wp_type_aware_trim( $string, $charlist = false ) { 2910 if ( is_int( $string ) ) 2911 return $string; 2912 else { 2913 if ( $charlist ) 2914 return trim( $string, $charlist ); 2915 else 2916 return trim( $string ); 2917 } 2918 return $string; 2919 } 2899 2920 ?>
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)