示例#1
0
 /**
  * Fetch all modules from a directory and its subdirectories
  *
  * @param string $directory specified directory
  * @param string $prefix    for the class names, will be used in recursive calls
  *
  * @static
  * @access protected
  * @return array modules
  */
 function _getModulesFromDir($directory, $prefix = '')
 {
     $modules = array();
     $d = dir($directory);
     while (false !== ($moduleFile = $d->read())) {
         if ($moduleFile === '.' || $moduleFile === '..' || $moduleFile === 'CVS') {
             continue;
         }
         if (is_dir($directory . '/' . $moduleFile)) {
             $modules = array_merge($modules, Date_Holidays::_getModulesFromDir($directory . '/' . $moduleFile, $prefix . $moduleFile . '_'));
             continue;
         }
         $matches = array();
         if (preg_match('/(.*)\\.php$/', $moduleFile, $matches)) {
             array_push($modules, array('id' => $prefix . $matches[1], 'title' => $prefix . $matches[1]));
         }
     }
     return $modules;
 }