/**
  * @depends testGetByContentTypeReturnsNullWithNoneSetAndNoDefault
  */
 public function testGetByContentTypeReturnsDefaultWithNoneSet()
 {
     $isHtmlContent = false;
     $unsubscribeUrlPlaceHolder = static::resolveUnsubscribeMergeTagContent($isHtmlContent);
     $manageSubscriptionsUrlPlaceHolder = static::resolveManageSubscriptionMergeTagContent($isHtmlContent);
     $recipientMention = 'This email was sent to [[PRIMARY^EMAIL]].';
     StringUtil::prependNewLine($unsubscribeUrlPlaceHolder, $isHtmlContent);
     StringUtil::prependNewLine($manageSubscriptionsUrlPlaceHolder, $isHtmlContent);
     StringUtil::prependNewLine($recipientMention, $isHtmlContent);
     $defaultFooter = $unsubscribeUrlPlaceHolder . $manageSubscriptionsUrlPlaceHolder . $recipientMention;
     $plainTextFooter = GlobalMarketingFooterUtil::getContentByType($isHtmlContent);
     $this->assertNotNull($plainTextFooter);
     $this->assertEquals($defaultFooter, $plainTextFooter);
     $isHtmlContent = true;
     $unsubscribeUrlPlaceHolder = static::resolveUnsubscribeMergeTagContent($isHtmlContent);
     $manageSubscriptionsUrlPlaceHolder = static::resolveManageSubscriptionMergeTagContent($isHtmlContent);
     $recipientMention = 'This email was sent to [[PRIMARY^EMAIL]].';
     StringUtil::prependNewLine($unsubscribeUrlPlaceHolder, $isHtmlContent);
     StringUtil::prependNewLine($manageSubscriptionsUrlPlaceHolder, $isHtmlContent);
     StringUtil::prependNewLine($recipientMention, $isHtmlContent);
     $defaultFooter = $unsubscribeUrlPlaceHolder . $manageSubscriptionsUrlPlaceHolder . $recipientMention;
     $richTextFooter = GlobalMarketingFooterUtil::getContentByType($isHtmlContent);
     $this->assertNotNull($richTextFooter);
     $this->assertEquals($defaultFooter, $richTextFooter);
 }
 protected static function resolveDefaultValue($isHtmlContent)
 {
     $unsubscribeUrlPlaceHolder = static::UNSUBSCRIBE_URL_PLACEHOLDER;
     $manageSubscriptionsUrlPlaceHolder = static::MANAGE_SUBSCRIPTIONS_URL_PLACEHOLDER;
     StringUtil::prependNewLine($unsubscribeUrlPlaceHolder, $isHtmlContent);
     StringUtil::prependNewLine($manageSubscriptionsUrlPlaceHolder, $isHtmlContent);
     $content = $unsubscribeUrlPlaceHolder . $manageSubscriptionsUrlPlaceHolder;
     return $content;
 }
 /**
  * @depends testGetByContentTypeReturnsNullWithNoneSetAndNoDefault
  */
 public function testGetByContentTypeReturnsDefaultWithNoneSet()
 {
     $isHtmlContent = false;
     $unsubscribeUrlPlaceHolder = UnsubscribeAndManageSubscriptionsPlaceholderUtil::UNSUBSCRIBE_URL_PLACEHOLDER;
     $manageSubscriptionsUrlPlaceHolder = UnsubscribeAndManageSubscriptionsPlaceholderUtil::MANAGE_SUBSCRIPTIONS_URL_PLACEHOLDER;
     StringUtil::prependNewLine($unsubscribeUrlPlaceHolder, $isHtmlContent);
     StringUtil::prependNewLine($manageSubscriptionsUrlPlaceHolder, $isHtmlContent);
     $defaultFooter = $unsubscribeUrlPlaceHolder . $manageSubscriptionsUrlPlaceHolder;
     $plainTextFooter = UnsubscribeAndManageSubscriptionsPlaceholderUtil::getContentByType($isHtmlContent);
     $this->assertNotNull($plainTextFooter);
     $this->assertEquals($defaultFooter, $plainTextFooter);
     $isHtmlContent = true;
     $unsubscribeUrlPlaceHolder = UnsubscribeAndManageSubscriptionsPlaceholderUtil::UNSUBSCRIBE_URL_PLACEHOLDER;
     $manageSubscriptionsUrlPlaceHolder = UnsubscribeAndManageSubscriptionsPlaceholderUtil::MANAGE_SUBSCRIPTIONS_URL_PLACEHOLDER;
     StringUtil::prependNewLine($unsubscribeUrlPlaceHolder, $isHtmlContent);
     StringUtil::prependNewLine($manageSubscriptionsUrlPlaceHolder, $isHtmlContent);
     $defaultFooter = $unsubscribeUrlPlaceHolder . $manageSubscriptionsUrlPlaceHolder;
     $richTextFooter = UnsubscribeAndManageSubscriptionsPlaceholderUtil::getContentByType($isHtmlContent);
     $this->assertNotNull($richTextFooter);
     $this->assertEquals($defaultFooter, $richTextFooter);
 }
 protected static function appendDefaultFooter(&$content, $isHtmlContent)
 {
     $placeholderContent = static::resolveDefaultFooterPlaceholderContentByType($isHtmlContent);
     StringUtil::prependNewLine($placeholderContent, $isHtmlContent);
     $content .= $placeholderContent;
 }
Пример #5
0
 /**
  * @param string $content
  * @param int $personId
  * @param int $marketingListId
  * @param int $modelId
  * @param $modelType
  * @param bool $isHtmlContent
  * @param bool $replaceExisting
  * @param bool $preview
  */
 public static function resolveUnsubscribeAndManageSubscriptionPlaceholders(&$content, $personId, $marketingListId, $modelId, $modelType, $isHtmlContent, $replaceExisting = false, $preview = false)
 {
     $hash = static::resolveHashForUnsubscribeAndManageSubscriptionsUrls($personId, $marketingListId, $modelId, $modelType, !$preview);
     $unsubscribeUrl = static::resolveUnsubscribeUrl($hash, $preview);
     $manageSubscriptionsUrl = static::resolveManageSubscriptionsUrl($hash, $preview);
     static::resolvePlaceholderUrlsForHtmlContent($unsubscribeUrl, $manageSubscriptionsUrl, $isHtmlContent);
     if ($replaceExisting) {
         static::resolveUnsubscribeAndManageSubscriptionPlaceholdersToUrls($content, $unsubscribeUrl, $manageSubscriptionsUrl);
     } else {
         $placeholderContent = static::resolveDefaultFooterPlaceholderContentByType($isHtmlContent);
         static::resolveUnsubscribeAndManageSubscriptionPlaceholdersToUrls($placeholderContent, $unsubscribeUrl, $manageSubscriptionsUrl);
         StringUtil::prependNewLine($placeholderContent, $isHtmlContent);
         $content .= $placeholderContent;
     }
 }