當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。