evolve_include_all

Evolve_include_all() A function to include all files from a directory path.

Description

evolve_include_all( $path, (constant) $ignore = false ); 

Parameters (2)

0. $path
The path.
1. $ignore — Optional. (constant) => false
The ignore.

Usage

  1. if ( !function_exists( 'evolve_include_all' ) ) { 
  2. require_once '/library/functions/functions.php'; 
  3.  
  4. // The path. 
  5. $path = null; 
  6.  
  7. // The ignore. 
  8. $ignore = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = evolve_include_all($path, $ignore); 
  12.  

Defined (1)

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

/library/functions/functions.php  
  1. function evolve_include_all($path, $ignore = false) { 
  2.  
  3. /** Open the directory */ 
  4. $dir = @dir($path) or die('Could not open required directory ' . $path); 
  5.  
  6. /** Get all the files from the directory */ 
  7. while (( $file = $dir->read() ) !== false) { 
  8. /** Check the file is a file, and is a PHP file */ 
  9. if (is_file($path . $file) and ( !$ignore or ! in_array($file, $ignore) ) and preg_match('/\.php$/i', $file)) { 
  10. require_once( $path . $file ); 
  11. $dir->close(); // Close the directory, we're done.