_upgrade_422_find_genericons_files_in_folder

Recursively find Genericons example files in a given folder.

Description

(array) _upgrade_422_find_genericons_files_in_folder( (string) $directory ); 

Returns (array)

Parameters (1)

0. $directory (string)
Directory path. Expects trailingslashed.

Usage

  1. if ( !function_exists( '_upgrade_422_find_genericons_files_in_folder' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/update-core.php'; 
  3.  
  4. // Directory path. Expects trailingslashed. 
  5. $directory = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = _upgrade_422_find_genericons_files_in_folder($directory); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/update-core.php  
  1. function _upgrade_422_find_genericons_files_in_folder( $directory ) { 
  2. $directory = trailingslashit( $directory ); 
  3. $files = array(); 
  4.  
  5. if ( file_exists( "{$directory}example.html" ) && false !== strpos( file_get_contents( "{$directory}example.html" ), '<title>Genericons</title>' ) ) { 
  6. $files[] = "{$directory}example.html"; 
  7.  
  8. $dirs = glob( $directory . '*', GLOB_ONLYDIR ); 
  9. if ( $dirs ) { 
  10. foreach ( $dirs as $dir ) { 
  11. $files = array_merge( $files, _upgrade_422_find_genericons_files_in_folder( $dir ) ); 
  12.  
  13. return $files;