本文整理汇总了PHP中module_list函数的典型用法代码示例。如果您正苦于以下问题:PHP module_list函数的具体用法?PHP module_list怎么用?PHP module_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了module_list函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: invoke
static function invoke($numParams, &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, $fnSuffix)
{
$result = array();
// copied from user_module_invoke
if (function_exists('module_list')) {
foreach (module_list() as $module) {
$fnName = "{$module}_{$fnSuffix}";
if (function_exists($fnName)) {
if ($numParams == 1) {
$fResult = $fnName($arg1);
} else {
if ($numParams == 2) {
$fResult = $fnName($arg1, $arg2);
} else {
if ($numParams == 3) {
$fResult = $fnName($arg1, $arg2, $arg3);
} else {
if ($numParams == 4) {
$fResult = $fnName($arg1, $arg2, $arg3, $arg4);
} else {
if ($numParams == 5) {
$fResult = $fnName($arg1, $arg2, $arg3, $arg4, $arg5);
}
}
}
}
}
if (is_array($fResult)) {
$result = array_merge($result, $fResult);
}
}
}
}
return empty($result) ? true : $result;
}
示例2: includeLibClassFilesWithPattern
/**
* @param string $folder_name
*/
private static function includeLibClassFilesWithPattern($folder_name)
{
$enabled_modules = module_list();
foreach ($enabled_modules as $module_name) {
$module_path = drupal_get_path('module', $module_name);
// PSR-0 compliant search
$path = $module_path . '/lib/Drupal/' . $module_name;
if (is_dir($path)) {
$folders = self::listFoldersWithPattern($path, $folder_name);
if (!empty($folders)) {
foreach ($folders as $folder) {
foreach (self::listClassesWithinFolder($folder) as $class_name) {
include_once $class_name;
}
}
}
}
// PSR-4 compliant search
$path = $module_path . '/src';
if (is_dir($path)) {
$folders = self::listFoldersWithPattern($path, $folder_name);
if (!empty($folders)) {
foreach ($folders as $folder) {
foreach (self::listClassesWithinFolder($folder) as $class_name) {
include_once $class_name;
}
}
}
}
}
}
示例3: index
public function index($context = null)
{
// Get a list of modules with a controller matching
// $context ('content', 'appearance', 'settings', 'statistics', or 'developer')
foreach (module_list() as $module) {
if (module_controller_exists($context, $module)) {
$this->actions[] = $module;
}
}
// Do we have any actions?
if (!count($this->actions)) {
return '<ul class="nav-sub clearfix"></ul>';
}
// Grab our module permissions so we know who can see what on the sidebar
$permissions = config_item('module_permissions');
// Build up our menu array
foreach ($this->actions as $module) {
// Make sure the user has permission to view this page.
if (isset($permissions[$context][$module]) && has_permission($permissions[$context][$module]) || !array_key_exists($module, $permissions[$context])) {
// Grab our module config array, if any.
$mod_config = module_config($module);
$display_name = isset($mod_config['name']) ? $mod_config['name'] : $module;
$title = isset($mod_config['description']) ? $mod_config['description'] : $module;
$menu_topic = isset($mod_config['menu_topic'][$context]) ? $mod_config['menu_topic'][$context] : $display_name;
// Drop-down menus?
if (isset($mod_config['menus']) && isset($mod_config['menus'][$context])) {
$menu_view = $mod_config['menus'][$context];
} else {
$menu_view = '';
}
$this->menu[$menu_topic][$module] = array('title' => $title, 'display_name' => $display_name, 'menu_view' => $menu_view, 'menu_topic' => $menu_topic);
}
}
return $this->build_menu($context);
}
示例4: crm_get_data
/**
* Get an array of data structures from the database, and allow all modules
* to extend them. This function will call hook_data() to get the data and
* hook_data_alter() to allow modules to alter the data.
* @param $type The type of data.
* @param $opts An associative array of options.
* @return An array of data structures.
*/
function crm_get_data($type, $opts = array())
{
// Get the base data
$hook = "{$type}_data";
if (!function_exists($hook)) {
error_register('No such data type: ' . $type);
die;
}
$data = call_user_func($hook, $opts);
if (!empty($data)) {
// Let other modules extend the data
foreach (module_list() as $module) {
// Make sure module is really installed
$rev_hook = "{$module}_revision";
$hook = "{$module}_data_alter";
if (function_exists($hook)) {
if (module_get_schema_revision($module) != call_user_func($rev_hook)) {
error_register("Database schema needs to be upgraded for module {$module}.");
continue;
}
$data = call_user_func($hook, $type, $data, $opts);
// Make sure the hook actually returned data
if (is_null($data)) {
error_register('Hook returned null: ' . $hook);
}
}
}
}
return $data;
}
示例5: crm_get_form
/**
* Get a form, allowing modules to alter it.
*/
function crm_get_form()
{
if (func_num_args() < 1) {
return array();
}
$args = func_get_args();
$form_id = array_shift($args);
$hook = "{$form_id}_form";
// Build initial form
if (!function_exists($hook)) {
error_register("No such hook: {$hook}");
return array();
}
$form = call_user_func_array($hook, $args);
if (empty($form)) {
return $form;
}
// Allow modules to alter the form
foreach (module_list() as $module) {
$hook = $module . '_form_alter';
if (function_exists($hook)) {
$form = $hook($form, $form_id);
if (empty($form)) {
error_register('Empty form returned by ' . $hook);
}
}
}
return $form;
}
示例6: settingsForm
/**
* Generate a settings form for this handler.
*/
public function settingsForm($field, $instance)
{
$field_name = $field['field_name'];
$form['action'] = array('#type' => 'select', '#title' => t('Action'), '#options' => array('none' => t('Do nothing'), 'hide' => t('Hide field'), 'disable' => t('Disable field')), '#description' => t('Action to take when prepopulating field with values via URL.'));
$form['action_on_edit'] = array('#type' => 'checkbox', '#title' => t('Apply action on edit'), '#description' => t('Apply action when editing an existing entity.'), '#states' => array('invisible' => array(':input[name="instance[settings][behaviors][prepopulate][action]"]' => array('value' => 'none'))));
$form['fallback'] = array('#type' => 'select', '#title' => t('Fallback behaviour'), '#description' => t('Determine what should happen if no values are provided via URL.'), '#options' => array('none' => t('Do nothing'), 'hide' => t('Hide field'), 'form_error' => t('Set form error'), 'redirect' => t('Redirect')));
// Get list of permissions.
$perms = array();
$perms[0] = t('- None -');
foreach (module_list(FALSE, FALSE, TRUE) as $module) {
// By keeping them keyed by module we can use optgroups with the
// 'select' type.
if ($permissions = module_invoke($module, 'permission')) {
foreach ($permissions as $id => $permission) {
$perms[$module][$id] = strip_tags($permission['title']);
}
}
}
$form['skip_perm'] = array('#type' => 'select', '#title' => t('Skip access permission'), '#description' => t('Set a permission that will not be affected by the fallback behavior.'), '#options' => $perms);
$description = t('Determine if values that should be prepopulated should "listen" to the OG-context.');
if ($disabled = !module_exists('og_context') || !og_is_group_audience_field($field_name)) {
$description .= '<br / >' . t('Organic groups integration: Enable OG-context and set "Entity selection mode" to "Organic groups" to enable this selection.');
}
$form['og_context'] = array('#type' => 'checkbox', '#title' => t('OG context'), '#description' => $description, '#disabled' => $disabled);
return $form;
}
开发者ID:swarad07,项目名称:india-standalone-drupal,代码行数:29,代码来源:EntityReferencePrepopulateInstanceBehavior.class.php
示例7: buildModuleList
/**
* Build the list of modules to be processed for hooks.
*/
function buildModuleList()
{
if ($this->isBuilt === FALSE) {
if ($this->drupalModules === NULL) {
if (function_exists('module_list')) {
// copied from user_module_invoke
$this->drupalModules = module_list();
}
}
if ($this->civiModules === NULL) {
$this->civiModules = array();
$this->requireCiviModules($this->civiModules);
}
// we should add civicrm's module's just after main civicrm drupal module
// Note: Assume that drupalModules and civiModules may each be array() or NULL
if ($this->drupalModules !== NULL) {
foreach ($this->drupalModules as $moduleName) {
$this->allModules[$moduleName] = $moduleName;
if ($moduleName == 'civicrm') {
if (!empty($this->civiModules)) {
foreach ($this->civiModules as $civiModuleName) {
$this->allModules[$civiModuleName] = $civiModuleName;
}
}
}
}
} else {
$this->allModules = (array) $this->civiModules;
}
if ($this->drupalModules !== NULL && $this->civiModules !== NULL) {
// both CRM and CMS have bootstrapped, so this is the final list
$this->isBuilt = TRUE;
}
}
}
示例8: list_lang_files
/**
* Finds a list of all language files for a specific language by
* searching the application/languages folder as well as all core_module
* folders for folders matching the language name.
*
* @param string $language The language
*
* @return array An array of files.
*/
function list_lang_files($language = 'english')
{
$ci =& get_instance();
$ci->load->helper('file');
$lang_files = array();
// Base language files.
$lang_files['core'] = find_lang_files(APPPATH . 'language/' . $language . '/');
// Module lang files
$modules = module_list();
$custom_modules = module_list(TRUE);
foreach ($modules as $module) {
$module_langs = module_files($module, 'language');
$type = 'core';
if (isset($module_langs[$module]['language'][$language])) {
$path = implode('/', array($module, 'language', $language));
if (in_array($module, $custom_modules)) {
$files = find_lang_files(realpath(APPPATH . '../modules/' . $path) . '/');
$type = 'custom';
} else {
$files = find_lang_files(APPPATH . 'core_modules/' . $path . '/');
}
foreach ($files as $file) {
$lang_files[$type][] = $file;
}
}
//end if
}
//end foreach
return $lang_files;
}
示例9: index
public function index($type=null)
{
// Get a list of modules with a controller matching
// $type ('content', 'appearance', 'settings', 'statistics', or 'developer')
foreach (module_list() as $module)
{
if (module_controller_exists($type, $module))
{
$this->actions[] = $module;
}
}
// Do we have any actions?
if (!count($this->actions))
{
return '<ul class="nav-sub clearfix"></ul>';
}
// Grab our module permissions so we know who can see what on the sidebar
$permissions = config_item('module_permissions');
// Build a ul to return
$list = "<ul class='nav-sub clearfix'>\n";
foreach ($this->actions as $module)
{
// Make sure the user has permission to view this page.
if ((isset($permissions[$type][$module]) && has_permission($permissions[$type][$module])) || !array_key_exists($module, $permissions[$type]))
{
// Is this the current module?
if ($module == $this->uri->segment(3))
{
$class = 'class="current"';
}
else
{
$class = '';
}
// Build our list item.
$list .= '<li><a href="'. site_url('admin/'. $type .'/'. $module) .'" '. $class;
// Icon
/*
if ($icon = module_icon($module))
{
$list .= ' style="background: url('. $icon .')"';
}
*/
$list .= '>'. ucwords(str_replace('_', '', $module)) ."</a></li>\n";
}
}
$list .= "</ul>\n";
return $list;
}
示例10: index
/**
* Displays a list of installed modules with the option to create
* a new one.
*
* @access public
*
* @return void
*/
public function index()
{
$modules = module_list(true);
$configs = array();
// check that the modules folder is writeable
Template::set('writeable', $this->_check_writeable());
// Get a list of available generators
Template::set('generators', $this->get_generators());
Template::render();
}
示例11: post
/**
* This hook will be called on any operation on some core CiviCRM
* objects. We will extend the functionality over a period of time
* to make it similar to Drupal's user hook, where the external module
* can inject and collect form elements and form information into a
* Drupal form (specifically the registration page and the account
* information page)
*
* @param string $op the type of operation being performed
* @param string $objectName the BAO class name of the object
* @param int $objectId the unique identifier for the object
* @param object $objectRef the reference to the object if available
*
* @return mixed based on op. pre-hooks return a boolean and/or
* an error message which aborts the operation
* @access public
*/
function post($op, $objectName, $objectId, &$objectRef)
{
// copied from user_module_invoke
foreach (module_list() as $module) {
$function = $module . '_civicrm_post';
if (function_exists($function)) {
$function($op, $objectName, $objectId, $objectRef);
}
}
}
示例12: getAllModulePerms
public function getAllModulePerms() {
$permissions = array();
$module_list = module_list();
ksort($module_list);
foreach ($module_list as $module) {
if ($perms = $this->getModulePerms($module)) {
$permissions = array_merge($permissions, $perms);
}
}
return $permissions;
}
示例13: __construct
/**
* Constructs a new instance.
*
* @param string[] $plugin_manager_definition
* (optional) An array of namespace that may contain plugin implementations.
* Defaults to an empty array.
* @param string $plugin_definition_annotation_name
* (optional) The name of the annotation that contains the plugin definition.
* Defaults to 'Drupal\Component\Annotation\Plugin'.
*/
function __construct($plugin_manager_definition, $plugin_definition_annotation_name = 'Drupal\\Component\\Annotation\\Plugin')
{
$namespaces = array();
foreach (module_list() as $module_name) {
$directory = DRUPAL_ROOT . '/' . drupal_get_path('module', $module_name) . '/src/' . trim($plugin_manager_definition['directory'], DIRECTORY_SEPARATOR);
$namespaces['Drupal\\' . $module_name] = array($directory);
}
$this->pluginNamespaces = new \ArrayObject($namespaces);
$this->pluginDefinitionAnnotationName = isset($plugin_manager_definition['class']) ? $plugin_manager_definition['class'] : $plugin_definition_annotation_name;
$this->pluginManagerDefinition = $plugin_manager_definition;
}
示例14: invoke
function invoke($numParams, &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, $fnSuffix)
{
if (!$this->first || empty($this->allModules)) {
$this->first = TRUE;
// copied from user_module_invoke
if (function_exists('module_list')) {
$this->allModules = module_list();
}
$this->requireCiviModules($this->allModules);
}
return $this->runHooks($this->allModules, $fnSuffix, $numParams, $arg1, $arg2, $arg3, $arg4, $arg5);
}
示例15: modules
/**
* Display the list of modules in the Bonfire installation
*
* @access public
*
* @return void
*/
public function modules()
{
$modules = module_list();
$configs = array();
foreach ($modules as $module) {
$configs[$module] = module_config($module);
if (!isset($configs[$module]['name'])) {
$configs[$module]['name'] = ucwords($module);
}
}
ksort($configs);
Template::set('modules', $configs);
Template::render();
}