本文整理汇总了PHP中MS_Factory::set_singleton方法的典型用法代码示例。如果您正苦于以下问题:PHP MS_Factory::set_singleton方法的具体用法?PHP MS_Factory::set_singleton怎么用?PHP MS_Factory::set_singleton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MS_Factory
的用法示例。
在下文中一共展示了MS_Factory::set_singleton方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store_singleton
/**
* Set the singleton instance if it is not yet defined.
*
* @since 1.0.0
*/
public function store_singleton()
{
if ($this->_in_cache) {
return;
}
MS_Factory::set_singleton($this);
}
示例2: add_simulation_membership
/**
* Add the simulated relationship to the current users memberships.
*
* @since 1.0.0
*/
public function add_simulation_membership($subscriptions)
{
$subscription = false;
if (!isset($subscriptions[$this->membership_id])) {
$this->start_simulation();
$subscription = MS_Model_Relationship::create_ms_relationship($this->membership_id, 0, 'simulation');
}
if (is_a($subscription, 'MS_Model_Relationship')) {
$membership = $subscription->get_membership();
if (MS_Model_Membership::PAYMENT_TYPE_PERMANENT == $membership->payment_type) {
$subscription->expire_date = '2999-12-31';
}
$key = 'ms_model_relationship--1';
MS_Factory::set_singleton($subscription, $key);
$this->_subscription = $subscription;
$subscriptions[$this->membership_id] = $subscription;
}
return $subscriptions;
}