bb_glob

The BuddyPress bb glob function.

Description

bb_glob( $pattern ); 

Parameters (1)

0. $pattern
The pattern.

Usage

  1. if ( !function_exists( 'bb_glob' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-core.php'; 
  3.  
  4. // The pattern. 
  5. $pattern = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_glob($pattern); 
  9.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-core.php  
  1. function bb_glob($pattern) { 
  2. // On fail return an empty array so that loops don't explode 
  3.  
  4. if (!$pattern) 
  5. return array(); 
  6.  
  7. // May break if pattern contains forward slashes 
  8. $directory = dirname( $pattern ); 
  9.  
  10. if (!$directory) 
  11. return array(); 
  12.  
  13. if (!file_exists($directory)) 
  14. return array(); 
  15.  
  16. if (!is_dir($directory)) 
  17. return array(); 
  18.  
  19. if (!function_exists('glob')) 
  20. return array(); 
  21.  
  22. if (!is_callable('glob')) 
  23. return array(); 
  24.  
  25. $glob = glob($pattern); 
  26.  
  27. if (!is_array($glob)) 
  28. $glob = array(); 
  29.  
  30. return $glob;