本文整理汇总了PHP中nnText::getBody方法的典型用法代码示例。如果您正苦于以下问题:PHP nnText::getBody方法的具体用法?PHP nnText::getBody怎么用?PHP nnText::getBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nnText
的用法示例。
在下文中一共展示了nnText::getBody方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAfterRender
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: onAfterRender
/**
* 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);
}
示例3: onAfterRender
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);
}
示例4: onAfterRender
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);
}
示例5: onAfterRender
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);
}
示例6: onAfterRender
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);
}