当前位置: 首页>>代码示例>>PHP>>正文


PHP module_implements函数代码示例

本文整理汇总了PHP中module_implements函数的典型用法代码示例。如果您正苦于以下问题:PHP module_implements函数的具体用法?PHP module_implements怎么用?PHP module_implements使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了module_implements函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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['admin@example.com'] = 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


注:本文中的module_implements函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。