You are here

function nodewords_load_include in Nodewords: D6 Meta Tags 6.2

Same name and namespace in other branches
  1. 6.3 nodewords.module \nodewords_load_include()

Load an include file.

Parameters

$module: The module for which the file is loaded.

$file: The file to load; the name of the module will be preappended to the file name passed. By default the file name is 'nodewords.inc'.

File

./nodewords.module, line 474
Implement an API that other modules can use to add meta tags.

Code

function nodewords_load_include($module, $file = 'nodewords.inc') {
  $info = module_invoke($module, 'nodewords_api');
  if (isset($info['path']) && $info['path'] == '') {

    // Special case: if the path is an empty string, the directory used will be
    // the directory include in the module directory.
    $include_path = drupal_get_path('module', $module) . '/includes/';
  }
  elseif (isset($info['path'])) {
    $include_path = $info['path'] . '/';
  }
  else {
    $include_path = drupal_get_path('module', $module) . '/';
  }
  $include_file = $include_path . $module . '.' . $file;
  if (is_file($include_file)) {
    require_once $include_file;
  }
  elseif ($file != 'nodewords.inc' && is_file($include_file = $include_path . $module . '.' . 'nodewords.inc')) {
    require_once $include_file;
  }
  else {
    return FALSE;
  }
}