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
2557                 * from the filesystem and return the passed value instead.
2558                 *
2559                 * @since 5.5.0
2560                 *
2561                 * @param array|null $files    The list of files to use for filename comparisons.
2562                 *                             Default null (to retrieve the list from the filesystem).
2563                 * @param string     $dir      The directory for the new file.
2564                 * @param string     $filename The proposed filename for the new file.
2565                 */
2566                $files = apply_filters( 'pre_wp_unique_filename_file_list', null, $dir, $filename );
2567
2568                if ( null === $files ) {
2569                     // List of all files and directories contained in $dir.
2570                     $files = @scandir( $dir );
2571                }
2572
2573                if ( ! empty( $files ) ) {
2574                     // Remove "dot" dirs.
2575                     $files = array_diff( $files, array( '.', '..' ) );