本文整理汇总了PHP中module_implements函数的典型用法代码示例。如果您正苦于以下问题:PHP module_implements函数的具体用法?PHP module_implements怎么用?PHP module_implements使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了module_implements函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: messageHandler
/**
* @todo .
*/
public function messageHandler()
{
if (!isset($_POST['serviceKey']) || !nodejs_is_valid_service_key($_POST['serviceKey'])) {
return new JsonResponse(array('error' => 'Invalid service key.'));
}
if (!isset($_POST['messageJson'])) {
return new JsonResponse(array('error' => 'No message.'));
}
$message = Json::decode($_POST['messageJson']);
$response = array();
switch ($message['messageType']) {
case 'authenticate':
$response = nodejs_auth_check($message);
break;
case 'userOffline':
nodejs_user_set_offline($message['uid']);
break;
default:
$handlers = array();
foreach (module_implements('nodejs_message_callback') as $module) {
$function = $module . '_nodejs_message_callback';
$handlers += $function($message['messageType']);
}
foreach ($handlers as $callback) {
$callback($message, $response);
}
}
\Drupal::moduleHandler()->alter('nodejs_message_response', $response, $message);
return new JsonResponse($response ? $response : array('error' => 'Not implemented'));
}
开发者ID:edwardchan,项目名称:d8-drupalvm,代码行数:33,代码来源:NodejsPages.php
示例2: grantPermission
/**
* Grant permissions to a specific role, if it exists.
*
* @param string $role
* Role machine name.
* @param string $permission
* Permission machine name.
* @param string $module
* Module name.
*
* @return bool
* TRUE if operation was successful, FALSE otherwise.
*/
public function grantPermission($role, $permission, $module = NULL)
{
$permission_rebuilt =& drupal_static(__CLASS__ . ':' . __FUNCTION__);
if (!$permission_rebuilt) {
// Make sure the list of available node types is up to date.
node_types_rebuild();
// Reset hook_permission() cached information.
module_implements('permission', FALSE, TRUE);
$permission_rebuilt = TRUE;
}
$permissions = is_array($permission) ? $permission : array($permission);
$role_object = user_role_load_by_name($role);
if ($role_object) {
// Use code from user_role_grant_permissions() in order to be able
// to force medule field in special cases.
$modules = user_permission_get_modules();
// Grant new permissions for the role.
foreach ($permissions as $name) {
$modules[$name] = isset($modules[$name]) ? $modules[$name] : $module;
db_merge('role_permission')->key(array('rid' => $role_object->rid, 'permission' => $name))->fields(array('module' => $modules[$name]))->execute();
}
// Clear the user access cache.
drupal_static_reset('user_access');
drupal_static_reset('user_role_permissions');
return TRUE;
} else {
return FALSE;
}
}
开发者ID:kimlop,项目名称:platform-dev,代码行数:42,代码来源:Config.php
示例3: __construct
function __construct($template_id)
{
$this->_template_id = $template_id;
$context_options = cache_get('maestro_taskclass_info');
// Test if context options are cached - if not then we will set it
// The class function getContextMenu will read options from the cache
if ($context_options === FALSE) {
$context_options = array();
// Scan through each available class type and fetch its corresponding context menu.
foreach (module_implements('maestro_get_taskobject_info') as $module) {
$function = $module . '_maestro_get_taskobject_info';
if ($arr = $function()) {
$context_options = maestro_array_add($context_options, $arr);
}
}
cache_set('maestro_taskclass_info', $context_options);
}
$handler_options = cache_get('maestro_handler_options');
// Test if task type handler options are cached - if not then we will set it
// The class function getHandlerOptions will read options from the cache
if ($handler_options === FALSE) {
// Scan through each available class type and fetch its corresponding context menu.
foreach (module_implements('maestro_handler_options') as $module) {
$function = $module . '_maestro_handler_options';
if ($arr = $function()) {
$handler_options = maestro_array_merge_keys($arr, $handler_options);
}
}
cache_set('maestro_handler_options', $handler_options);
}
}
开发者ID:kastowo,项目名称:idbigdata,代码行数:31,代码来源:maestro_interface.class.php
示例4: services_edit_form_endpoint_authentication
/**
* Endpoint authentication configuration form.
*/
function services_edit_form_endpoint_authentication($form_state)
{
$endpoint = services_endpoint_load(arg(4));
// Loading runtime include as needed by services_authentication_info().
module_load_include('runtime.inc', 'services');
$form = array();
$auth_modules = module_implements('services_authentication_info');
$form['endpoint_object'] = array('#type' => 'value', '#value' => $endpoint);
if (empty($auth_modules)) {
$form['message'] = array('#type' => 'item', '#title' => t('Authentication'), '#description' => t('No authentication modules are installed, all requests will be anonymous.'));
return $form;
}
if (empty($endpoint->authentication)) {
$form['message'] = array('#type' => 'item', '#title' => t('Authentication'), '#description' => t('No authentication modules are enabled, all requests will be anonymous.'));
return $form;
}
// Add configuration fieldsets for the authentication modules
foreach ($endpoint->authentication as $module => $settings) {
$info = services_authentication_info($module);
if (empty($info)) {
continue;
}
$form[$module] = array('#type' => 'fieldset', '#title' => isset($info['title']) ? $info['title'] : $module, '#tree' => TRUE);
$module_settings_form = services_auth_invoke($module, 'security_settings', $settings);
if (!empty($module_settings_form) && $module_settings_form !== TRUE && $settings == $module || is_array($settings)) {
$form[$module] += $module_settings_form;
} else {
$form[$module]['message'] = array('#type' => 'item', '#value' => t('@module has no settings available.', array('@module' => drupal_ucfirst($module))));
}
}
$form['submit'] = array('#type' => 'submit', '#value' => 'Save');
return $form;
}
开发者ID:maduhu,项目名称:opengovplatform-alpha,代码行数:36,代码来源:services_ctools_export_ui.class.php
示例5: __construct
/**
* Constructor
*
* @param $users
* Mandatory - An array of integers or single integer specifying the Drupal users to notify.
*
* @param $defaultMessage
* String: The default message to send in the email, overridden with the message stored in the template_data record
*
* @param $defaultSubject
* String: The default email subject, overridden with the message stored in the template_data record
*
* @param $queueID
* Integer: The QueueID associated with the message you're sending out
*
* @param $type
* String: The actual notification type using the MaestroNotificationTypes Constants
*/
function __construct($defaultMessage = '', $defaultSubject = '', $queueID = 0, $type = MaestroNotificationTypes::ASSIGNMENT)
{
$observers = array();
$this->_notificationType = $type;
$this->_queueID = $queueID;
$this->getNotificationUserIDs();
$this->setNotificationSubjectAndMessage($defaultMessage, $defaultSubject);
//Now, lets determine if we've got our observers cached. If not, lets rebuild that observer list
//This is how we subscribe to becoming a notification provider for Maestro.
$observers = cache_get('maestro_notification_observers');
if ($observers === FALSE) {
//build the observer cache
//need to scan through each available class type and fetch its corresponding context menu.
foreach (module_implements('maestro_notification_observer') as $module) {
$function = $module . '_maestro_notification_observer';
if ($declaredObserver = $function()) {
foreach ($declaredObserver as $observerToCache) {
$observers[] = $observerToCache;
$this->_observers[] = $observerToCache;
}
}
}
cache_set('maestro_notification_observers', $observers);
} else {
$this->_observers = $observers->data;
}
}
开发者ID:kastowo,项目名称:idbigdata,代码行数:45,代码来源:maestro_notification.class.php
示例6: get_valid_address_list
/**
* Return a list of valid addresses where key = email address and value = associated UID.
* EG. $array['[email protected]'] = 1
*
* @return list of valid addresses
*/
private function get_valid_address_list()
{
// Define a hook -- this plugin is intended to be used with mailhandler_singlebox
// but it could be implemented using another email address to uid mapping function.
$addresses = array();
foreach (module_implements('mailhandler_sendto_addresses') as $module) {
$addresses += module_invoke($module, 'mailhandler_sendto_addresses');
}
return $addresses;
}
开发者ID:Chaogan-Yan,项目名称:rfmri.org,代码行数:16,代码来源:MailhandlerAuthenticateSendto.class.php
示例7: _groupadmin_get_modules
/**
* Get data from other modules via hook_groupadmin_ functions.
*/
function _groupadmin_get_modules($op)
{
$hook = 'hook_groupadmin_' . $op;
$modules = module_implements($hook);
//drupal_set_message('modules: ' . print_r($modules, 1));
$data = array();
foreach ($modules as $module) {
$data = array_merge($data, module_invoke($module, $hook));
}
return $data;
}
开发者ID:j573fan1s,项目名称:portal,代码行数:14,代码来源:groupadmin.misc.inc.php
示例8: invokeByRef
private static function invokeByRef($hook, &$obj)
{
// Construct our argument array
$args = func_get_args();
array_shift($args);
$args[0] =& $obj;
$modules = module_implements($hook);
foreach ($modules as $module) {
call_user_func_array($module . '_' . $hook, $args);
}
}
开发者ID:hugowetterberg,项目名称:dissue,代码行数:11,代码来源:DIssue.php
示例9: entityFieldQueryAlter
public function entityFieldQueryAlter(SelectQueryInterface $query)
{
// Adding the 'node_access' tag is sadly insufficient for nodes: core
// requires us to also know about the concept of 'published' and
// 'unpublished'. We need to do that as long as there are no access control
// modules in use on the site. As long as one access control module is there,
// it is supposed to handle this check.
if (!user_access('bypass node access') && !count(module_implements('node_grants')) && !user_access('reference unpublished nodes')) {
$base_table = $this->ensureBaseTable($query);
$query->condition("{$base_table}.status", NODE_PUBLISHED);
}
}
开发者ID:rhabbachi,项目名称:data_starter,代码行数:12,代码来源:EntityReference_SelectionHandler_Generic_eun.class.php
示例10: operateOnFinder
/**
* {@inheritdoc}
*/
function operateOnFinder($finder, $helper)
{
// Let other modules register stuff to the finder via hook_xautoload().
$classmap_generator = new ClassMapGenerator();
$adapter = new ClassFinderAdapter($finder, $classmap_generator);
$api = new \xautoload_InjectedAPI_hookXautoload($adapter, '');
foreach (module_implements('xautoload') as $module) {
$api->setExtensionDir($dir = drupal_get_path('module', $module));
$f = $module . '_xautoload';
$f($api, $dir);
}
}
开发者ID:stevebresnick,项目名称:iomedia_stp_d7_core,代码行数:15,代码来源:HookXautoloadOperation.php
示例11: calculateScore
/**
* Implements \SiteAudit\Check\Abstract\calculateScore().
*/
public function calculateScore()
{
global $conf;
if ($conf['block_cache']) {
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS;
} elseif (count(module_implements('node_grants'))) {
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN;
}
// Block caching is off.
if (site_audit_env_is_dev()) {
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO;
}
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL;
}
开发者ID:OPIN-CA,项目名称:checkpoint,代码行数:17,代码来源:Cache.php
示例12: drupalAlter
/**
* @see drupal_alter
*/
private function drupalAlter($type, &$data)
{
$dir = getcwd();
chdir($this->drupal_dir);
// Hang onto a reference to the data array so that it isn't blown away later.
$args = array(&$data);
// Now, use func_get_args() to pull in any additional parameters passed into
// the drupalAlter() call.
$additional_args = func_get_args();
array_shift($additional_args);
array_shift($additional_args);
$args = array_merge($args, $additional_args);
foreach (module_implements($type . '_alter') as $module) {
$function = $module . '_' . $type . '_alter';
call_user_func_array($function, $args);
}
chdir($dir);
}
开发者ID:jakob-stoeck,项目名称:os_poker,代码行数:21,代码来源:ShindigIntegratorDbFetcher.php
示例13: get_queues
/**
* Get cron queues and static cache them.
*
* Works like module_invoke_all('cron_queue_info'), but adds
* a 'module' to each item.
*
* @return array
* Cron queue definitions.
*/
private function get_queues()
{
if (!isset(self::$queues)) {
$queues = array();
foreach (module_implements('cron_queue_info') as $module) {
$items = module_invoke($module, 'cron_queue_info');
if (is_array($items)) {
foreach ($items as &$item) {
$item['module'] = $module;
}
$queues += $items;
}
}
drupal_alter('cron_queue_info', $queues);
self::$queues = $queues;
}
return $queues;
}
开发者ID:etype-services,项目名称:cni-theme,代码行数:27,代码来源:queue.class.php
示例14: check
public function check(&$output, &$perf)
{
$status = PROD_MONITORING_OK;
$messages = array();
$output = '';
$perf = '';
$checkers = module_implements('prod_nagios_check');
foreach ($checkers as $i => $module) {
$result = module_invoke($module, 'prod_nagios_check');
// Check output format
if (!is_array($result) || !array_key_exists('status', $result)) {
throw new MonitoringException($module . ' has invalid output format');
}
// Collect messages
if (array_key_exists('message', $result)) {
$messages[] = $result['message'];
}
// Collect perfdata
// TODO (via arrays?)
switch ($result['status']) {
case PROD_MONITORING_CRITICAL:
$status = $result['status'];
// stop processing modules and exit right now
break 2;
case PROD_MONITORING_WARNING:
if (PROD_MONITORING_OK === $status || PROD_MONITORING_PENDING === $status || PROD_MONITORING_UNKNOWN === $status) {
$status = $result['status'];
}
break;
case PROD_MONITORING_UNKNOWN:
if (PROD_MONITORING_OK === $status || PROD_MONITORING_PENDING === $status) {
$status = $result['status'];
}
break;
case PROD_MONITORING_PENDING:
if (PROD_MONITORING_OK === $status) {
$status = $result['status'];
}
break;
}
}
$output = implode('; ', $messages);
return $status;
}
开发者ID:regilero,项目名称:prod,代码行数:44,代码来源:Nagios.php
示例15: getDefaultScope
public function getDefaultScope($client_id = NULL)
{
// Allow any hook_oauth2_server_default_scope() implementations to supply
// the default scope. The first one to return a scope wins.
foreach (module_implements('oauth2_server_default_scope') as $module) {
$function = $module . '_' . 'oauth2_server_default_scope';
$args = array($this->server);
$result = call_user_func_array($function, $args);
if (is_array($result)) {
return implode(' ', $result);
}
}
// If there's a valid default scope set in server settings, return it.
$default_scope = $this->server->settings['default_scope'];
if (!empty($default_scope) && oauth2_server_scope_load($this->server->name, $default_scope)) {
return $default_scope;
}
return FALSE;
}
开发者ID:casivaagustin,项目名称:drupal-services,代码行数:19,代码来源:Scope.php
示例16: render
public function render()
{
$reporters = module_implements('prod_monitor_summary');
$lines = array();
// D7 hooks
foreach ($reporters as $i => $module) {
$new_lines = module_invoke($module, 'prod_monitor_summary');
if (!is_array($new_lines)) {
throw new MonitoringException($module . ' has invalid output format');
}
$lines = array_merge($lines, new_lines);
}
// Listeners should call AddOutputLine() on ourself
$this->notify(ProdObservable::SIGNAL_MONITOR_SUMMARY);
$lines = array_merge($lines, $this->_lines);
foreach ($lines as $line) {
drush_print($line, 0, NULL, TRUE);
}
}
开发者ID:regilero,项目名称:prod,代码行数:19,代码来源:Cacti.php
示例17: services_edit_form_endpoint_authentication
/**
* Endpoint authentication configuration form.
*/
function services_edit_form_endpoint_authentication($form, &$form_state)
{
list($endpoint) = $form_state['build_info']['args'];
// Loading runtime include as needed by services_authentication_info().
module_load_include('inc', 'services', 'includes/services.runtime');
$auth_modules = module_implements('services_authentication_info');
$form['endpoint_object'] = array('#type' => 'value', '#value' => $endpoint);
if (empty($auth_modules)) {
$form['message'] = array('#type' => 'item', '#title' => t('Authentication'), '#description' => t('No authentication modules are installed, all requests will be anonymous.'));
return $form;
}
if (empty($endpoint->authentication)) {
$form['message'] = array('#type' => 'item', '#title' => t('Authentication'), '#description' => t('No authentication modules are enabled, all requests will be anonymous.'));
return $form;
}
// Add configuration fieldsets for the authentication modules
foreach ($endpoint->authentication as $module => $settings) {
$info = services_authentication_info($module);
if (empty($info)) {
continue;
}
$form[$module] = array('#type' => 'fieldset', '#title' => isset($info['title']) ? $info['title'] : $module, '#tree' => TRUE);
// Append the default settings for the authentication module.
$default_security_settings = services_auth_invoke($module, 'default_security_settings');
if ($settings == $module && is_array($default_security_settings)) {
$settings = $default_security_settings;
}
// Ask the authentication module for a settings form.
$module_settings_form = services_auth_invoke($module, 'security_settings', $settings, $form_state);
if (is_array($module_settings_form)) {
$form[$module] += $module_settings_form;
} else {
$form[$module]['message'] = array('#type' => 'item', '#markup' => t('@module has no settings available.', array('@module' => drupal_ucfirst($module))));
}
}
$form['submit'] = array('#type' => 'submit', '#value' => 'Save');
return $form;
}
开发者ID:adamstacey5,项目名称:drupal-7-training,代码行数:41,代码来源:services_ctools_export_ui.class.php
示例18: buildEntityFieldQuery
/**
* Build an EntityFieldQuery to get referencable entities.
*/
public function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS')
{
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', $this->field['settings']['target_type']);
if (!empty($this->field['settings']['handler_settings']['target_bundles'])) {
$query->entityCondition('bundle', $this->field['settings']['handler_settings']['target_bundles'], 'IN');
}
if (isset($match)) {
$query->propertyCondition('title', $match, $match_operator);
}
// Add an access tag to the query.
$query->addTag('harmony_access');
$query->addTag('entityreference');
$query->addMetaData('field', $this->field);
$query->addMetaData('entityreference_selection_handler', $this);
// Adding the 'harmony_thread_access' tag is sadly insufficient for threads: core
// requires us to also know about the concept of 'published' and
// 'unpublished'. We need to do that as long as there are no access control
// modules in use on the site. As long as one access control module is there,
// it is supposed to handle this check.
if ((!user_access('bypass harmony forum access control') || !user_access('administer forum content')) && !count(module_implements('harmony_thread_grants'))) {
$query->propertyCondition('status', HARMONY_PUBLISHED);
$query->propertyCondition('locked', HARMONY_NOT_LOCKED);
}
// Add the sort option.
if (!empty($this->field['settings']['handler_settings']['sort'])) {
$sort_settings = $this->field['settings']['handler_settings']['sort'];
if ($sort_settings['type'] == 'property') {
$query->propertyOrderBy($sort_settings['property'], $sort_settings['direction']);
} elseif ($sort_settings['type'] == 'field') {
list($field, $column) = explode(':', $sort_settings['field'], 2);
$query->fieldOrderBy($field, $column, $sort_settings['direction']);
}
}
return $query;
}
开发者ID:rickhumphries,项目名称:elmsln,代码行数:39,代码来源:HarmonyThreadSelectionPlugin.class.php
示例19: write
/**
* {@inheritDoc}
*/
protected function write(array $record)
{
// Pre-bootstrap errors
if (!function_exists('module_implements')) {
return;
}
$request = \Drupal::requestStack()->getCurrentRequest();
// Remove unwanted stuff from the context, do not attempt to serialize
// potential PDO instances of stuff like that may lie into unserialized
// exceptions in there
$message = empty($record['formatted']) ? $record['message'] : $record['formatted'];
foreach ($record['context'] as $key => $value) {
// @todo temporary avoir Array to string conversion warnings
if (!is_array($value)) {
$record['context'][$key] = (string) $value;
}
}
// If you are dblogging stuff, using <br/> tags is advised for readability
$message = nl2br($message);
$entry = ['severity' => self::monologToDrupal($record['level']), 'type' => 'monolog', 'message' => $message, 'variables' => $record['context'], 'link' => '', 'user' => null, 'uid' => \Drupal::currentUser()->id(), 'request_uri' => $request->getRequestUri(), 'referer' => $request->headers->get('referer'), 'ip' => $request->getClientIp(), 'timestamp' => $record['datetime']->getTimestamp()];
foreach (module_implements('watchdog') as $module) {
module_invoke($module, 'watchdog', $entry);
}
}
开发者ID:makinacorpus,项目名称:drupal-sf-dic,代码行数:27,代码来源:DrupalHandler.php
示例20: render_pane_content
/**
* Render the interior contents of a single pane.
*
* This method retrieves pane content and produces a ready-to-render content
* object. It also manages pane-specific caching.
*
* @param stdClass $pane
* A Panels pane object, as loaded from the database.
* @return stdClass $content
* A renderable object, containing a subject, content, etc. Based on the
* renderable objects used by the block system.
*/
function render_pane_content(&$pane)
{
ctools_include('context');
// TODO finally safe to remove this check?
if (!is_array($this->display->context)) {
watchdog('panels', 'renderer::render_pane_content() hit with a non-array for the context', $this->display, WATCHDOG_DEBUG);
$this->display->context = array();
}
$content = FALSE;
$caching = !empty($pane->cache['method']) && empty($this->display->skip_cache);
if ($caching && ($cache = panels_get_cached_content($this->display, $this->display->args, $this->display->context, $pane))) {
$content = $cache->content;
} else {
$content = ctools_content_render($pane->type, $pane->subtype, $pane->configuration, array(), $this->display->args, $this->display->context);
foreach (module_implements('panels_pane_content_alter') as $module) {
$function = $module . '_panels_pane_content_alter';
$function($content, $pane, $this->display->args, $this->display->context);
}
if ($caching) {
$cache = new panels_cache_object();
$cache->set_content($content);
panels_set_cached_content($cache, $this->display, $this->display->args, $this->display->context, $pane);
$content = $cache->content;
}
}
// Pass long the css_id that is usually available.
if (!empty($pane->css['css_id'])) {
$content->css_id = check_plain($pane->css['css_id']);
}
// Pass long the css_class that is usually available.
if (!empty($pane->css['css_class'])) {
$content->css_class = check_plain($pane->css['css_class']);
}
return $content;
}
开发者ID:nvaidyan,项目名称:Physics-main,代码行数:47,代码来源:panels_renderer_standard.class.php
注:本文中的module_implements函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论