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


PHP CBPTXT::setLanguage方法代码示例

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


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

示例1: sendNewStatusEmail

 /**
  * Sends appropriate email depending on status.
  * Should be called only once upon each change of this something,
  *
  * @param  UserTable  $user
  * @param  string     $cause            'PaidSubscription' (first activation only), 'SubscriptionActivated' (renewals, cancellation reversals), 'SubscriptionDeactivated', 'Denied'
  * @param  string     $reason           'N' new subscription, 'R' renewal, 'U'=update )
  * @param int         $autorenewed      0: not auto-renewing (manually renewed), 1: automatically renewed (if $reason == 'R')
  */
 public function sendNewStatusEmail($user, $cause, $reason, $autorenewed = 0)
 {
     global $_CB_framework;
     if (!is_object($user)) {
         return;
     }
     $emailkind = null;
     if ($this->status == 'A' && $cause == 'PaidSubscription' && $reason != 'R') {
         $emailkind = 'thankyou';
     } elseif ($this->status == 'A' && $cause == 'PaidSubscription' && $reason == 'R' && $autorenewed == 0) {
         $emailkind = 'renewal';
     } elseif ($this->status == 'A' && $cause == 'PaidSubscription' && $reason == 'R' && $autorenewed == 1) {
         $emailkind = 'autorenewal';
     } elseif ($this->status == 'X' && $cause == 'Denied') {
         $emailkind = 'expiration';
     } elseif ($this->status == 'C' && $cause == 'Denied' && $user->id == $_CB_framework->myId() && $_CB_framework->getUi() == 1) {
         $emailkind = 'cancelled';
         // by the user only in frontend
     } elseif ($cause == 'Pending' && $reason != 'R' && $autorenewed == 0) {
         $emailkind = 'pendingfirst';
     } elseif ($cause == 'Pending' && $reason == 'R' && $autorenewed == 0) {
         $emailkind = 'pendingrenewal';
     }
     if ($emailkind) {
         // email to user only if activated for the first time:
         $plan = $this->getPlan();
         if (!$plan) {
             return;
         }
         cbimport('cb.tabs');
         // for cbNotification and comprofilerMail()
         cbimport('language.front');
         // for _UE_EMAILFOOTER translation
         $savedLanguage = CBPTXT::setLanguage($user->getUserLanguage());
         $mailHtml = $plan->get($emailkind . 'emailhtml') == '1' ? 1 : 0;
         $mailSubject = $this->getPersonalized($emailkind . 'emailsubject', false, false);
         $mailBody = $this->getPersonalized($emailkind . 'emailbody', $mailHtml);
         $mailCC = trim($plan->get($emailkind . 'emailcc'));
         $mailBCC = trim($plan->get($emailkind . 'emailbcc'));
         $mailAttachments = trim($plan->get($emailkind . 'emailattachments'));
         if ($mailCC != '') {
             $mailCC = preg_split('/ *, */', $mailCC);
         } else {
             $mailCC = null;
         }
         if ($mailBCC != '') {
             $mailBCC = preg_split('/ *, */', $mailBCC);
         } else {
             $mailBCC = null;
         }
         if ($mailAttachments != '') {
             $mailAttachments = preg_split('/ *, */', $mailAttachments);
         } else {
             $mailAttachments = null;
         }
         if ($mailSubject || $mailBody) {
             $notifier = new cbNotification();
             $notifier->sendFromSystem($user, $mailSubject, $mailBody, true, $mailHtml, $mailCC, $mailBCC, $mailAttachments);
         }
         CBPTXT::setLanguage($savedLanguage);
     }
     //TBD: 	else email in case of deactivation
 }
开发者ID:jasonrgd,项目名称:Digital-Publishing-Platform-Joomla,代码行数:72,代码来源:cbpaidSomething.php


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