WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Upgrader::flatten_dirlist() WP 4.9.0

Flatten the results of WP_Filesystem::dirlist() for iterating over.

Это метод класса: WP_Upgrader

Хуков нет.

Возвращает

Массив. $files A flattened array of the $nested_files specified.

Использование

$WP_Upgrader = new WP_Upgrader();
$var = $WP_Upgrader->flatten_dirlist( $nested_files, $path );
$nested_files(массив) (обязательный)
Array of files as returned by WP_Filesystem::dirlist()
$path(строка)
Relative path to prepend to child nodes. Optional.
По умолчанию: ''

Список изменений

С версии 4.9.0 Введена.

Код WP Upgrader::flatten dirlist: wp-admin/includes/class-wp-upgrader.php WP 5.2.4

<?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;
}