Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



_upgrade_422_find_genericons_files_in_folder ›

Seit4.2.2
Veraltetn/v
_upgrade_422_find_genericons_files_in_folder ( $directory )
Parameter:
  • (string) $directory Directory path. Expects trailingslashed.
    Erforderlich: Ja
Gibt zurück:
  • (array)
Definiert in:
Codex:

Recursively find Genericons example files in a given folder.



Quellcode

function _upgrade_422_find_genericons_files_in_folder( $directory ) {
	$directory = trailingslashit( $directory );
	$files     = array();

	if ( file_exists( "{$directory}example.html" ) && false !== strpos( file_get_contents( "{$directory}example.html" ), '<title>Genericons</title>' ) ) {
		$files[] = "{$directory}example.html";
	}

	$dirs = glob( $directory . '*', GLOB_ONLYDIR );
	if ( $dirs ) {
		foreach ( $dirs as $dir ) {
			$files = array_merge( $files, _upgrade_422_find_genericons_files_in_folder( $dir ) );
		}
	}

	return $files;
}