You are here

function spam_init_api in Spam 5.3

As the spam module isn't a core Drupal module, many important modules won't utilize its API. We define the appropriate hooks for these modules in the modules/ subdirectory. For example, we define the spam api hooks for the node module in modules/spam_node.inc.

1 call to spam_init_api()
spam.module in ./spam.module

File

./spam.module, line 953

Code

function spam_init_api() {
  static $initialized = FALSE;
  if (!$initialized) {

    // We only need to include these files once.
    $initialized = TRUE;
    $path = drupal_get_path('module', 'spam') . '/modules';

    // These files must be names spam_*.inc, such as spam_node.inc.
    $files = drupal_system_listing('spam_.*\\.inc$', $path, 'name', 0);
    foreach ($files as $file) {
      $module = substr_replace($file->name, '', 0, 5);
      if (module_exists($module)) {
        require_once "./{$file->filename}";
      }
    }
  }
}