Ticket #14627: 14627.diff
File 14627.diff, 1.5 KB (added by , 10 years ago) |
---|
-
wp-includes/functions.php
2198 2198 * before the extension, and will continue adding numbers until the filename is 2199 2199 * unique. 2200 2200 * 2201 * The callback must accept two parameters, the first one is the directory and2202 * the second is the filename. The callback must be a function.2201 * The callback is passed three parameters, the first one is the directory, the 2202 * second is the filename, and the third is the extension. 2203 2203 * 2204 2204 * @since 2.5 2205 2205 * 2206 2206 * @param string $dir 2207 2207 * @param string $filename 2208 * @param string $unique_filename_callback Function name, must be a function.2208 * @param mixed $unique_filename_callback Callback. 2209 2209 * @return string New filename, if given wasn't unique. 2210 2210 */ 2211 2211 function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) { … … 2221 2221 if ( $name === $ext ) 2222 2222 $name = ''; 2223 2223 2224 // Increment the file number until we have a unique file to save in $dir. Use $override['unique_filename_callback']if supplied.2224 // Increment the file number until we have a unique file to save in $dir. Use callback if supplied. 2225 2225 if ( $unique_filename_callback && is_callable( $unique_filename_callback ) ) { 2226 $filename = $unique_filename_callback( $dir, $name);2226 $filename = call_user_func( $unique_filename_callback, $dir, $name, $ext ); 2227 2227 } else { 2228 2228 $number = ''; 2229 2229