コード例 #1
0
 /**
  * A version-independent wrapper for drupal_system_listing().
  */
 function systemListing($mask, $directory, $key = 'name', $min_depth = 1)
 {
     $files = drupal_system_listing($mask, $directory, $key, $min_depth);
     // This one is actually only for Drupal 6.
     // The file object is:
     //    D6         D7         what it actually is
     //  - filename | uri      | full path and name
     //  - basename | filename | name with the extension
     //  - name     | name     | name without the extension
     // So we copy filename to uri, and then the caller can handle the returned
     // array as if it were Drupal 7 style.
     foreach ($files as $file) {
         $file->uri = $file->filename;
     }
     return $files;
 }
コード例 #2
0
 /**
  * Invoke hook_module_builder_info().
  */
 function invokeInfoHook()
 {
     $major_version = $this->major_version;
     // TODO: just get ours if no bootstrap?
     $mask = '/\\.module_builder.inc$/';
     $mb_files = drupal_system_listing($mask, 'modules');
     //print_r($mb_files);
     $module_data = array();
     foreach ($mb_files as $file) {
         // Our system listing wrapper ensured that there is a uri property on all versions.
         include_once $file->uri;
         // Use a property of the (badly-documented!) $file object that is common to both D6 and D7.
         $module = str_replace('.module_builder', '', $file->name);
         // Note that bad data got back from the hook breaks things.
         if ($result = module_invoke($module, 'module_builder_info', $major_version)) {
             $module_data = array_merge($module_data, $result);
         }
     }
     return $module_data;
 }
コード例 #3
0
/**
 *  Build a list of provider files that serve the invoking module.
 *
 *  @param $module
 *    The contributed Embedded Media Field module in question, such as
 *    Embedded Video Field or Embedded Google Wave.
 *  @param $provider
 *    If provided, then we expect the single provider file named.
 *    Otherwise, we expect an array of all provider files supported.
 *  @return
 *    A listing of files built with drupal_system_listing().
 */
function hook_emfield_providers($module, $provider = NULL)
{
    return drupal_system_listing("{$provider}\\.inc\$", drupal_get_path('module', 'media_example') . "/providers/{$module}", 'name', 0);
}
コード例 #4
0
ファイル: template.php プロジェクト: CalvinZhu/boinc
/**
 * Returns the path to the Zen theme.
 *
 * drupal_get_filename() is broken; see #341140. When that is fixed in Drupal 6,
 * replace _zen_path() with drupal_get_path('theme', 'zen').
 */
function _zen_path()
{
    static $path = FALSE;
    if (!$path) {
        $matches = drupal_system_listing('zen\\.info$', 'themes', 'name', 0);
        if (!empty($matches['zen']->filename)) {
            $path = dirname($matches['zen']->filename);
        }
    }
    return $path;
}
コード例 #5
0
ファイル: sample.php プロジェクト: TMJones/convio_api
/**
 * Loads the hooks for the supported modules.
 */
function user_import_load_supported()
{
    static $loaded = FALSE;
    if (!$loaded) {
        $path = drupal_get_path('module', 'user_import') . '/supported';
        $files = drupal_system_listing('.*\\.inc$', $path, 'name', 0);
        foreach ($files as $module_name => $file) {
            if (module_exists($module_name)) {
                include_once $file->filename;
            }
        }
        $loaded = TRUE;
    }
}