Uses
Uses | Description |
---|---|
wp-admin/includes/class-wp-upgrader.php: WP_Upgrader::flatten_dirlist() | Flatten the results of WP_Filesystem::dirlist() for iterating over. |
Flatten the results of WP_Filesystem::dirlist() for iterating over.
(array) (Required) Array of files as returned by WP_Filesystem::dirlist().
(string) (Optional) Relative path to prepend to child nodes. Optional.
Default value: ''
(array) A flattened array of the $nested_files specified.
File: wp-admin/includes/class-wp-upgrader.php
protected function flatten_dirlist( $nested_files, $path = '' ) { $files = array(); foreach ( $nested_files as $name => $details ) { $files[ $path . $name ] = $details; // Append children recursively. if ( ! empty( $details['files'] ) ) { $children = $this->flatten_dirlist( $details['files'], $path . $name . '/' ); // Merge keeping possible numeric keys, which array_merge() will reindex from 0..n. $files = $files + $children; } } return $files; }
Version | Description |
---|---|
4.9.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_upgrader/flatten_dirlist