コード例 #1
0
 /**
  * Convert emoji to short bytes.
  *
  * @param array|string $content
  *
  * @return array|string
  */
 public function reverseTransform($content)
 {
     if (is_array($content)) {
         foreach ($content as &$convert) {
             $convert = $this->reverseTransform($convert);
         }
     } else {
         $content = EmojiHelper::toShort($content);
     }
     return $content;
 }
コード例 #2
0
ファイル: CopyRepository.php プロジェクト: dongilbert/mautic
 /**
  * @param $hash
  * @param $subject
  * @param $body
  */
 public function saveCopy($hash, $subject, $body)
 {
     $db = $this->getEntityManager()->getConnection();
     try {
         $body = EmojiHelper::toShort($body);
         $subject = EmojiHelper::toShort($subject);
         $db->insert(MAUTIC_TABLE_PREFIX . 'email_copies', ['id' => $hash, 'body' => $body, 'subject' => $subject, 'date_created' => (new \DateTime())->setTimezone(new \DateTimeZone('UTC'))->format('Y-m-d H:i:s')]);
         return true;
     } catch (\Exception $e) {
         error_log($e);
         return false;
     }
 }
コード例 #3
0
ファイル: EmailSubscriber.php プロジェクト: Jornve/mautic
 /**
  * Process if an email is resent
  *
  * @param MauticEvents\EmailEvent $event
  */
 public function onEmailResend(MauticEvents\EmailEvent $event)
 {
     $message = $event->getMessage();
     if (isset($message->leadIdHash)) {
         $model = $this->factory->getModel('email');
         $stat = $model->getEmailStatus($message->leadIdHash);
         if ($stat !== null) {
             $stat->upRetryCount();
             $retries = $stat->getRetryCount();
             if (true || $retries > 3) {
                 //tried too many times so just fail
                 $reason = $this->factory->getTranslator()->trans('mautic.email.dnc.retries', array("%subject%" => EmojiHelper::toShort($message->getSubject())));
                 $model->setDoNotContact($stat, $reason);
             } else {
                 //set it to try again
                 $event->tryAgain();
             }
             $em = $this->factory->getEntityManager();
             $em->persist($stat);
             $em->flush();
         }
     }
 }
コード例 #4
0
ファイル: Stat.php プロジェクト: emtudo/mautic
 /**
  * @deprecated 1.2.3 - to be removed in 2.0
  *
  * @param mixed $copy
  *
  * @return Stat
  */
 public function setCopy($copy)
 {
     // Ensure it's clean of emoji
     $copy = EmojiHelper::toShort($copy);
     $this->copy = $copy;
     return $this;
 }
コード例 #5
0
ファイル: EmailSubscriber.php プロジェクト: dongilbert/mautic
 /**
  * Process if an email is resent.
  *
  * @param Events\QueueEmailEvent $event
  */
 public function onEmailResend(Events\QueueEmailEvent $event)
 {
     $message = $event->getMessage();
     if (isset($message->leadIdHash)) {
         $stat = $this->emailModel->getEmailStatus($message->leadIdHash);
         if ($stat !== null) {
             $stat->upRetryCount();
             $retries = $stat->getRetryCount();
             if (true || $retries > 3) {
                 //tried too many times so just fail
                 $reason = $this->translator->trans('mautic.email.dnc.retries', ['%subject%' => EmojiHelper::toShort($message->getSubject())]);
                 $this->emailModel->setDoNotContact($stat, $reason);
             } else {
                 //set it to try again
                 $event->tryAgain();
             }
             $this->em->persist($stat);
             $this->em->flush();
         }
     }
 }
コード例 #6
0
ファイル: Email.php プロジェクト: Jandersolutions/mautic
 /**
  * @param $content
  *
  * @return $this
  */
 public function setContent($content)
 {
     // Ensure safe emoji
     $content = EmojiHelper::toShort($content);
     $this->isChanged('content', $content);
     $this->content = $content;
     return $this;
 }
コード例 #7
0
ファイル: Copy.php プロジェクト: Yame-/mautic
 /**
  * @param mixed $subject
  *
  * @return Copy
  */
 public function setSubject($subject)
 {
     // Ensure it's clean of emoji
     $subject = EmojiHelper::toShort($subject);
     $this->subject = $subject;
     return $this;
 }