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


PHP manager::is_enabled方法代码示例

本文整理汇总了PHP中manager::is_enabled方法的典型用法代码示例。如果您正苦于以下问题:PHP manager::is_enabled方法的具体用法?PHP manager::is_enabled怎么用?PHP manager::is_enabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在manager的用法示例。


在下文中一共展示了manager::is_enabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generate

 /**
  * Generate an e-mail address for the Inbound Message handler, storing a private
  * key for the data object if one was not specified.
  *
  * @param int $userid The ID of the user to generated an address for.
  * @param string $userkey The unique key for this user. If not specified this will be retrieved using
  * get_user_key(). This key must have been created using get_user_key(). This parameter is provided as a performance
  * optimisation for when generating multiple addresses for the same user.
  * @return string|null The generated address, or null if an address could not be generated.
  */
 public function generate($userid, $userkey = null)
 {
     global $CFG;
     // Ensure that Inbound Message is enabled and that there is enough information to proceed.
     if (!manager::is_enabled()) {
         return null;
     }
     if ($userkey == null) {
         $userkey = get_user_key('messageinbound_handler', $userid);
     }
     // Ensure that the minimum requirements are in place.
     if (!isset($this->handler) || !$this->handler) {
         throw new \coding_exception('Inbound Message handler not specified.');
     }
     // Ensure that the requested handler is actually enabled.
     if (!$this->handler->enabled) {
         return null;
     }
     if (!isset($this->datavalue)) {
         throw new \coding_exception('Inbound Message data item has not been specified.');
     }
     $data = array(self::pack_int($this->handler->id), self::pack_int($userid), self::pack_int($this->datavalue), pack('H*', substr(md5($this->fetch_data_key() . $userkey), 0, self::HASHSIZE)));
     $subaddress = base64_encode(implode($data));
     return $CFG->messageinbound_mailbox . '+' . $subaddress . '@' . $CFG->messageinbound_domain;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:35,代码来源:address_manager.php


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