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.
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
Parameters
$filename
The file we are parsing. Accepts file with relative or absolute path.
Return value
The info array.
Код
<?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;
}
?>
Войдите или
зарегистрируйтесь, чтобы получить возможность отправлять комментарии