Exemplo n.º 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);
 }
Exemplo n.º 2
0
 public function onAfterRender()
 {
     // only in html and feeds
     if (JFactory::getDocument()->getType() !== 'html' && !NNFrameworkFunctions::isFeed()) {
         return;
     }
     $html = JResponse::getBody();
     if ($html == '') {
         return;
     }
     if (NNFrameworkFunctions::isFeed()) {
         $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);
 }
Exemplo n.º 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);
 }