_module_parse_info_file

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/module.inc, строка 190

Версии
5
_module_parse_info_file($filename)

Parse Drupal info file format. Uses ini parser provided by php's parse_ini_file().

Files should use the ini format to specify values. e.g. key = 'value' key2 = value2

Some things to be aware of:

  • This function is NOT for placing arbitrary module-specific settings. Use variable_get() and variable_set() for that.
  • You may not use double-quotes in a value.
Information stored in the module.info file: name - The real name of the module for display purposes. description - A brief description of the module. dependencies - A space delimited list of the short names (shortname) of other modules this module depends on. package - The name of the package of modules this module belongs to.

Example of .info file: name = Forum description = Enables threaded discussions about general topics. dependencies = taxonomy comment package = Core - optional

Параметры

$filename The file we are parsing. Accepts file with relative or absolute path.

Возвращаемое значение

The info array.

▾ 4 функции вызывают _module_parse_info_file()

help_page in modules/help/help.module
Menu callback; prints a page listing general help for all modules.
module_rebuild_cache in includes/module.inc
Обновляет кеш файлов модулей.
system_modules_uninstall in modules/system/system.module
Builds a form of currently disabled modules.
system_modules_uninstall_confirm_form in modules/system/system.module
Confirm uninstall of selected modules.

Код

<?php
function _module_parse_info_file($filename) {
  $info = array();

  if (file_exists($filename)) {
    $info = parse_ini_file($filename);

    if (isset($info['dependencies'])) {
      $info['dependencies'] = explode(" ", $info['dependencies']);
    }
    else {
      $info['dependencies'] = NULL;
    }
  }
  return $info;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему