コード例 #1
0
 /**
  * Send registration email to new user
  * Email will contain activation link
  * and instructions to activate the account
  *
  * @return Register
  */
 protected function sendActivationEmail()
 {
     $Tr = $this->Registry->Tr;
     $activationLink = $this->makeActivationLink();
     $siteName = $this->Registry->Ini->SITE_NAME;
     $body = $Tr->get('email.body.registration', array('{site_title}' => $siteName, '{username}' => $this->username, '{password}' => $this->pwd, '{link}' => $activationLink));
     $body = \Lampcms\Utf8String::leftAlign($body, 2);
     $subject = $Tr->get('email.subject.registration', array('{site_title}' => $siteName));
     /**
      * By default Mailer::mail sends email from shutdown function (returns immediately, sends later)
      */
     $this->Registry->Mailer->mail($this->email, $subject, $body);
     return $this;
 }
コード例 #2
0
ファイル: Mailer.php プロジェクト: codigoirreverente/LampCMS
 /**
  * Translate the $item into $locale language
  *
  * @param string $locale
  * @param mixed string|object of type TranslatableInterface $item
  *
  * @return string translated string
  * @throws \Lampcms\DevException
  */
 public function translate($locale, $item)
 {
     if (is_string($item)) {
         return $item;
     }
     if (!is_object($item) || !$item instanceof TranslatableInterface) {
         throw new DevException('$item can only be a string or instance of TranslatableInterface. Was: ' . (!is_object($item) ? gettype($item) : get_class($item)));
     }
     $Tr = $this->getTranslator($locale);
     return \Lampcms\Utf8String::leftAlign($Tr->get($item->getString(), $item->getVars()));
 }