newsletter-bundle/src/Resources/contao/modules/ModuleNewsletterReader.php
protected function compile()
	{
		/** @var PageModel $objPage */
		global $objPage;

		$this->Template->content = '';
		$this->Template->referer = 'javascript:history.go(-1)';
		$this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];

		$objNewsletter = NewsletterModel::findSentByParentAndIdOrAlias(Input::get('items'), $this->nl_channels);

		if (null === $objNewsletter)
		{
			throw new PageNotFoundException('Page not found: ' . Environment::get('uri'));
		}

		// Overwrite the page title (see #2853 and #4955)
		if ($objNewsletter->subject != '')
		{
			$objPage->pageTitle = strip_tags(StringUtil::stripInsertTags($objNewsletter->subject));
		}

		// Add enclosure
		if ($objNewsletter->addFile)
		{
			$this->addEnclosuresToTemplate($this->Template, $objNewsletter->row(), 'files');
		}

		// Support plain text newsletters (thanks to Hagen Klemp)
		if ($objNewsletter->sendText)
		{
			$strContent = nl2br_html5($objNewsletter->text);
		}
		else
		{
			$strContent = str_ireplace(' align="center"', '', $objNewsletter->content);
		}

		// Parse simple tokens and insert tags
		$strContent = $this->replaceInsertTags($strContent);
		$strContent = StringUtil::parseSimpleTokens($strContent, array());

		// Encode e-mail addresses
		$strContent = StringUtil::encodeEmail($strContent);

		$this->Template->content = $strContent;
		$this->Template->subject = $objNewsletter->subject;
	}
protected function compile()
	{
		/** @var PageModel $objPage */
		global $objPage;

		$this->Template->content = '';
		$this->Template->referer = 'javascript:history.go(-1)';
		$this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];

		$objNewsletter = NewsletterModel::findSentByParentAndIdOrAlias(Input::get('items'), $this->nl_channels);

		if (null === $objNewsletter)
		{
			throw new PageNotFoundException('Page not found: ' . Environment::get('uri'));
		}

		// Overwrite the page title (see #2853 and #4955)
		if ($objNewsletter->subject != '')
		{
			$objPage->pageTitle = strip_tags(StringUtil::stripInsertTags($objNewsletter->subject));
		}

		// Add enclosure
		if ($objNewsletter->addFile)
		{
			$this->addEnclosuresToTemplate($this->Template, $objNewsletter->row(), 'files');
		}

		// Support plain text newsletters (thanks to Hagen Klemp)
		if ($objNewsletter->sendText)
		{
			$strContent = nl2br_html5($objNewsletter->text);
		}
		else
		{
			$strContent = str_ireplace(' align="center"', '', $objNewsletter->content);
		}

		// Parse simple tokens and insert tags
		$strContent = $this->replaceInsertTags($strContent);
		$strContent = StringUtil::parseSimpleTokens($strContent, array());

		// Encode e-mail addresses
		$strContent = StringUtil::encodeEmail($strContent);

		$this->Template->content = $strContent;
		$this->Template->subject = $objNewsletter->subject;
	}
protected function compile ( ) { /** @var PageModel $objPage */ global $ objPage ; $ this -> Template -> content = '' ; $ this -> Template -> referer = 'javascript:history.go(-1)' ; $ this -> Template -> back = $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'goBack' ] ; $ objNewsletter = NewsletterModel :: findSentByParentAndIdOrAlias ( Input :: get ( 'items' ) , $ this -> nl_channels ) ; if ( null === $ objNewsletter ) { throw new PageNotFoundException ( 'Page not found: ' . Environment :: get ( 'uri' ) ) ; } // Overwrite the page title (see #2853 and #4955) if ( $ objNewsletter -> subject != '' ) { $ objPage -> pageTitle = strip_tags ( StringUtil :: stripInsertTags ( $ objNewsletter -> subject ) ) ; } // Add enclosure if ( $ objNewsletter -> addFile ) { $ this -> addEnclosuresToTemplate ( $ this -> Template , $ objNewsletter -> row ( ) , 'files' ) ; } // Support plain text newsletters (thanks to Hagen Klemp) if ( $ objNewsletter -> sendText ) { $ strContent = nl2br_html5 ( $ objNewsletter -> text ) ; } else { $ strContent = str_ireplace ( ' align="center"' , '' , $ objNewsletter -> content ) ; } // Parse simple tokens and insert tags $ strContent = $ this -> replaceInsertTags ( $ strContent ) ; $ strContent = StringUtil :: parseSimpleTokens ( $ strContent , array ( ) ) ; // Encode e-mail addresses $ strContent = StringUtil :: encodeEmail ( $ strContent ) ; $ this -> Template -> content = $ strContent ; $ this -> Template -> subject = $ objNewsletter -> subject ; }
Generate the module
Generate the module