Make WordPress Core


Ignore:
Timestamp:
10/27/2010 10:27:06 PM (15 years ago)
Author:
nacin
Message:

Use call_user_func for wpnique_filename callback. fixes #14627.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r15938 r16025  
    21992199 * unique.
    22002200 *
    2201  * The callback must accept two parameters, the first one is the directory and
    2202  * 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.
    22032203 *
    22042204 * @since 2.5
     
    22062206 * @param string $dir
    22072207 * @param string $filename
    2208  * @param string $unique_filename_callback Function name, must be a function.
     2208 * @param mixed $unique_filename_callback Callback.
    22092209 * @return string New filename, if given wasn't unique.
    22102210 */
     
    22222222        $name = '';
    22232223
    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.
    22252225    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 );
    22272227    } else {
    22282228        $number = '';
Note: See TracChangeset for help on using the changeset viewer.