Outil de recherche WordPress pour les développeurs et auteurs de thèmes



_upgrade_422_find_genericons_files_in_folder ›

Depuis4.2.2
Dépréciéen/a
_upgrade_422_find_genericons_files_in_folder ( $directory )
Paramètres:
  • (string) $directory Directory path. Expects trailingslashed.
    Requis: Oui
Retourne:
  • (array)
Défini(e) dans:
Codex:

Recursively find Genericons example files in a given folder.



Source

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