本文整理汇总了PHP中EE_Registry::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP EE_Registry::factory方法的具体用法?PHP EE_Registry::factory怎么用?PHP EE_Registry::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EE_Registry
的用法示例。
在下文中一共展示了EE_Registry::factory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _init_queue_and_generator
/**
* This method sets (or resets) the various properties for use.
*
* - $_queue = holds the messages queue
* - $_generator = holds the messages generator
*/
protected function _init_queue_and_generator()
{
$this->_generator = EE_Registry::factory('EE_Messages_Generator');
$this->_queue = $this->_generator->generation_queue();
}
示例2: _create_new_templates
/**
* @param \EE_messenger $messenger
* @param \EE_message_type $message_type
* @param $GRP_ID
* @param $global
* @return array|mixed
*/
protected static function _create_new_templates(EE_messenger $messenger, EE_message_type $message_type, $GRP_ID, $global)
{
//if we're creating a custom template then we don't need to use the defaults class
if (!$global) {
return EEH_MSG_Template::_create_custom_template_group($messenger, $message_type, $GRP_ID);
}
/** @type EE_Messages_Template_Defaults $Message_Template_Defaults */
$Message_Template_Defaults = EE_Registry::factory('EE_Messages_Template_Defaults', array($messenger, $message_type, $GRP_ID));
//generate templates
$success = $Message_Template_Defaults->create_new_templates();
//if creating the template failed. Then we should deactivate the related message_type for the messenger because
//its not active if it doesn't have a template. Note this is only happening for GLOBAL template creation
//attempts.
if (!$success) {
/** @var EE_Message_Resource_Manager $message_resource_manager */
$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
$message_resource_manager->deactivate_message_type_for_messenger($message_type->name, $messenger->name);
}
/**
* $success is in an array in the following format
* array(
* 'GRP_ID' => $new_grp_id,
* 'MTP_context' => $first_context_in_new_templates,
* )
*/
return $success;
}