示例#1
0
 public function onAfterRender()
 {
     // only in html and feeds
     if (JFactory::getDocument()->getType() !== 'html' && JFactory::getDocument()->getType() !== 'feed') {
         return;
     }
     $html = JResponse::getBody();
     if ($html == '') {
         return;
     }
     if (JFactory::getDocument()->getType() != 'html') {
         $this->helpers->get('replace')->replaceTags($html, 'body');
         $this->helpers->get('clean')->cleanLeftoverJunk($html);
         JResponse::setBody($html);
         return;
     }
     // only do stuff in body
     list($pre, $body, $post) = nnText::getBody($html);
     $this->helpers->get('replace')->replaceTags($body, 'body');
     $html = $pre . $body . $post;
     $this->helpers->get('clean')->cleanLeftoverJunk($html);
     // replace head with newly generated head
     // this is necessary because the plugins might have added scripts/styles to the head
     $this->helpers->get('head')->updateHead($html);
     JResponse::setBody($html);
 }
示例#2
0
 public function onAfterRender()
 {
     // only in html and feeds
     if (JFactory::getDocument()->getType() !== 'html' && JFactory::getDocument()->getType() !== 'feed') {
         return;
     }
     $html = JResponse::getBody();
     if ($html == '') {
         return;
     }
     if (JFactory::getDocument()->getType() != 'html') {
         $this->replaceTags($html);
     } else {
         // only do stuff in body
         list($pre, $body, $post) = nnText::getBody($html);
         $this->replaceTags($body);
         $html = $pre . $body . $post;
     }
     $this->cleanLeftoverJunk($html);
     JResponse::setBody($html);
 }
示例#3
0
 /**
  * onAfterRender
  */
 public function onAfterRender()
 {
     // only in html and feeds
     if (JFactory::getDocument()->getType() !== 'html' && JFactory::getDocument()->getType() !== 'feed') {
         return;
     }
     // Grab the body (but be gentle)
     $html = JResponse::getBody();
     if ($html == '') {
         return;
     }
     list($pre, $body, $post) = nnText::getBody($html);
     $this->protect($body);
     $this->replaceInTheRest($body);
     nnProtect::unprotect($body);
     $this->cleanTagsFromHead($pre);
     $html = $pre . $body . $post;
     $this->cleanLeftoverJunk($html);
     // Throw the body back (less gentle)
     JResponse::setBody($html);
 }
示例#4
0
 function onAfterRender()
 {
     // only in html
     if (JFactory::getDocument()->getType() !== 'html' && JFactory::getDocument()->getType() !== 'feed') {
         return;
     }
     $html = JResponse::getBody();
     if ($html == '') {
         return;
     }
     if (strpos($html, '{' . $this->params->tag) === false) {
         if (!$this->params->hasitems) {
             // remove style and script if no items are found
             $html = preg_replace('#\\s*<' . 'link [^>]*href="[^"]*/(tooltips/css|css/tooltips)/[^"]*\\.css[^"]*"[^>]* />#s', '', $html);
             $html = preg_replace('#\\s*<' . 'script [^>]*src="[^"]*/(tooltips/js|js/tooltips)/[^"]*\\.js[^"]*"[^>]*></script>#s', '', $html);
             $html = preg_replace('#/\\* START: Tooltips .*?/\\* END: Tooltips [a-z]* \\*/\\s*#s', '', $html);
         }
     } else {
         // only do stuff in body
         list($pre, $body, $post) = nnText::getBody($html);
         $this->protect($body);
         $this->replaceTags($body);
         $html = $pre . $body . $post;
         $this->unprotect($html);
     }
     $this->cleanLeftoverJunk($html);
     JResponse::setBody($html);
 }
示例#5
0
文件: helper.php 项目: naka211/jydsk
 function onAfterRender()
 {
     // not in pdf's
     if (JFactory::getDocument()->getType() == 'pdf') {
         return;
     }
     $html = JResponse::getBody();
     if ($html == '') {
         return;
     }
     if (JFactory::getDocument()->getType() != 'html') {
         $this->replaceTags($html);
         $this->cleanLeftoverJunk($html);
     } else {
         // only do stuff in body
         list($pre, $body, $post) = nnText::getBody($html);
         $this->protect($body);
         $this->replaceTags($body);
         $html = $pre . $body . $post;
         $this->cleanLeftoverJunk($html);
         NNProtect::unprotect($html);
         // replace head with newly generated head
         // this is necessary because the plugins might have added scripts/styles to the head
         $orig_document = clone JFactory::getDocument();
         $this->updateHead($html, $orig_document);
         unset($orig_document);
     }
     JResponse::setBody($html);
 }
示例#6
0
	function onAfterRender()
	{
		// not in pdf's
		if (JFactory::getDocument()->getType() == 'pdf')
		{
			return;
		}

		$html = JResponse::getBody();
		if ($html == '')
		{
			return;
		}

		if (JFactory::getDocument()->getType() != 'html')
		{
			$this->replaceTags($html);
		}
		else
		{
			// only do stuff in body
			list($pre, $body, $post) = nnText::getBody($html);
			$this->protect($body);
			$this->replaceTags($body);
			$html = $pre . $body . $post;
		}

		$this->cleanLeftoverJunk($html);
		NNProtect::unprotect($html);

		JResponse::setBody($html);
	}
 function onAfterRender()
 {
     // only in html and feeds
     if (JFactory::getDocument()->getType() !== 'html' && ($this->params->protect_in_feeds && JFactory::getDocument()->getType() !== 'feed')) {
         return;
     }
     $html = JResponse::getBody();
     if ($html == '') {
         return;
     }
     // only do stuff in body
     list($pre, $body, $post) = nnText::getBody($html);
     $this->protectEmails($body);
     $html = $pre . $body . $post;
     if (JFactory::getDocument()->getType() == 'html') {
         if (strpos($html, 'addCloakedMailto') === false) {
             // remove style and script if no emails are found
             $html = preg_replace('#/\\* START: ' . $this->name . ' .*?/\\* END: ' . $this->name . ' [a-z]* \\*/\\s*#s', '', $html);
         } else {
             // correct attribut ids in possible cached modules/content
             $html = preg_replace('# data-ep-a[a-z0-9]{4}=#s', ' ' . $this->params->atrr_pre . '=', $html);
             $html = preg_replace('# data-ep-b[a-z0-9]{4}=#s', ' ' . $this->params->atrr_post . '=', $html);
             NNProtect::removeInlineComments($html, $this->name);
         }
     }
     JResponse::setBody($html);
 }