Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: pre_wp_unique_filename_file_list

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
2551                 * from the filesystem and return the passed value instead.
2552                 *
2553                 * @since 5.5.0
2554                 *
2555                 * @param array|null $files    The list of files to use for filename comparisons.
2556                 *                             Default null (to retrieve the list from the filesystem).
2557                 * @param string     $dir      The directory for the new file.
2558                 * @param string     $filename The proposed filename for the new file.
2559                 */
2560                $files = apply_filters( 'pre_wp_unique_filename_file_list', null, $dir, $filename );
2561
2562                if ( null === $files ) {
2563                     // List of all files and directories contained in $dir.
2564                     $files = @scandir( $dir );
2565                }
2566
2567                if ( ! empty( $files ) ) {
2568                     // Remove "dot" dirs.
2569                     $files = array_diff( $files, array( '.', '..' ) );