/** * tabs prepare content method * * Method is called by the view * * @param object The article object. Note $article->text is also available * @param object The article params * @param int The 'page' number */ public function onAfterRender() { $app = JFactory::getApplication(); if ($app->isAdmin()) { return; } $document = JFactory::getDocument(); $styles = $document->_styleSheets; $scripts = $document->_scripts; $this->_body = JResponse::getBody(); $disable_tab = $this->params->get('disable_tab', 0); if ($disable_tab) { $this->_body = $this->removeCode($this->_body); JResponse::setBody($this->_body); return; } if (JString::strpos($this->_body, '{jatabs') === false) { $HSmethodDIRECT = false; } else { $HSmethodDIRECT = true; } if ($HSmethodDIRECT) { if (!defined("JAMOOTAB_PLUGIN_HEADTAG")) { $this->stylesheet(); } require_once 'plugins/system/jatabs/jatabs/parser.php'; $parser = new ReplaceCallbackParserTabs('jatabs'); $this->_body = $parser->parse($this->_body, array(&$this, 'Jatabs_replacer_DIRECT')); } if ($this->_styles) { $this->_body = str_replace('</head>', "\t" . implode(' ', $this->_styles) . "\n</head>", $this->_body); } $document = JFactory::getDocument(); $styles_1 = $document->_styleSheets; $scripts_1 = $document->_scripts; $styles_diff = array_diff_key($styles_1, $styles); $scripts_diff = array_diff_key($scripts_1, $scripts); if ($styles_diff) { foreach ($styles_diff as $strSrc => $strAttr) { $headtag = '<link href="' . $strSrc . '" type="text/css" rel="stylesheet" />'; $this->_body = str_replace('</head>', "\t" . $headtag . "\n</head>", $this->_body); } } if ($scripts_diff) { foreach ($scripts_diff as $strSrc => $strType) { $headtag = '<script src="' . $strSrc . '" type="text/javascript" ></script>'; $this->_body = str_replace('</head>', "\t" . $headtag . "\n</head>", $this->_body); } } JResponse::setBody($this->_body); }
/** * tabs prepare content method * * Method is called by the view * * @param object The article object. Note $article->text is also available * @param object The article params * @param int The 'page' number */ public function onAfterRender() { $app = JFactory::getApplication(); if ($app->isAdmin()) { return; } $document = JFactory::getDocument(); $styles = $document->_styleSheets; $scripts = $document->_scripts; if ($document->_script) { $document->_script = array(); } $this->_body = JResponse::getBody(); $disable_tab = $this->params->get('disable_tab', 0); if ($disable_tab) { $this->_body = $this->removeCode($this->_body); JResponse::setBody($this->_body); return; } if (JString::strpos($this->_body, '{jatabs') === false) { $HSmethodDIRECT = false; } else { $HSmethodDIRECT = true; } $flag = false; if ($HSmethodDIRECT) { if (!defined("JAMOOTAB_PLUGIN_HEADTAG")) { $this->stylesheet(); } require_once JPATH_ROOT . '/plugins/system/jatabs/jatabs/parser.php'; $parser = new ReplaceCallbackParserTabs('jatabs'); $string_jatabs = preg_split('#(.*?)textarea(.*?)#i', $this->_body, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); foreach ($string_jatabs as $value_jatabs) { if (JString::strpos($value_jatabs, '<p>{jatabs')) { $string_backup = $value_jatabs; $flag = true; break; } } if ($flag == true) { $this->_body = str_replace($string_backup, "JATABSJOOMLART", $this->_body); } $this->_body = $parser->parse($this->_body, array(&$this, 'Jatabs_replacer_DIRECT')); if ($flag == true) { $this->_body = str_replace("JATABSJOOMLART", $string_backup, $this->_body); } } if ($this->_styles) { $this->_body = str_replace('</head>', "\t" . implode(' ', $this->_styles) . "\n</head>", $this->_body); } $document = JFactory::getDocument(); $styles_1 = $document->_styleSheets; $scripts_1 = $document->_scripts; $styles_diff = array_diff_key($styles_1, $styles); $scripts_diff = array_diff_key($scripts_1, $scripts); if ($styles_diff) { foreach ($styles_diff as $strSrc => $strAttr) { $headtag = '<link href="' . $strSrc . '" type="text/css" rel="stylesheet" />'; $this->_body = str_replace('</head>', "\t" . $headtag . "\n</head>", $this->_body); } } if ($scripts_diff) { foreach ($scripts_diff as $strSrc => $strType) { $headtag = '<script src="' . $strSrc . '" type="text/javascript" ></script>'; $this->_body = str_replace('</head>', "\t" . $headtag . "\n</head>", $this->_body); } } if ($document->_script) { foreach ($document->_script as $strDeclartion) { $headtag = '<script type="text/javascript">' . $strDeclartion . '</script>'; $this->_body = str_replace('</head>', "\t" . $headtag . "\n</head>", $this->_body); } } JResponse::setBody($this->_body); }