예제 #1
0
파일: helper.php 프로젝트: justinlyon/scc
 function showPopup()
 {
     global $mainframe;
     jimport('joomla.application.helper');
     $client = JApplicationHelper::getClientInfo($mainframe->getClientID());
     // settings from config.xml
     $dumpConfig =& JComponentHelper::getParams('com_dump');
     $w = $dumpConfig->get('popupwidth', 500);
     $h = $dumpConfig->get('popupheight', 500);
     // build the url
     $url = JURI::base(true) . '/index.php?option=com_dump&view=tree&tmpl=component';
     /* @TODO remove this and implement this in a later version using JRoute
        // only add Itemid in Site
        if ( $mainframe->isSite() ) {
            $url .= '&Itemid=' . DumpHelper::getComponentItemid( 'com_dump' );
        }
        */
     // create the javascript
     // We can't use $document, because it's already rendered
     $nl = "\n";
     $script = $nl . '<!-- J!Dump -->' . $nl . '<script type="text/javascript">' . $nl . '// <!--' . $nl . 'window.open( "' . $url . '", "dump_' . $client->name . '", "height=' . $h . ',width=' . $w . ',toolbar=0,status=0,menubar=0,scrollbars=1,resizable=1");' . $nl . '// -->' . $nl . '</script>' . $nl . '<!-- / J!Dump -->';
     // add the code to the header (thanks jenscski)
     // JResponse::appendBody( $script );
     $body = JResponse::getBody();
     $body = str_replace('</head>', $script . '</head>', $body);
     JResponse::setBody($body);
 }
예제 #2
0
 public function __construct()
 {
     $this->body = JResponse::getBody();
     $this->bInfo = null;
     $buf = $this->parseIt();
     JResponse::setBody($buf);
 }
예제 #3
0
function _modifyResponsiveTemplate()
{
    // Get the current HTML body.
    $body = trim(JResponse::getBody());
    // Correct doctype declaration.
    $doctype = '<!doctype html>';
    // Modified flag.
    $modified = false;
    // Found doctype declaration.
    if (preg_match('#<\\!doctype(.*?)>#is', $body, $match)) {
        // Make sure it's the correct type.
        if (strtolower($match[0]) != $doctype) {
            $body = str_replace($match[0], $doctype, $body);
            $modified = true;
        }
    } else {
        // No doctype declaration, just add it.
        $body = $doctype . "\n" . $body;
        $modified = true;
    }
    // Set the new body only if we've modified it.
    if ($modified) {
        JResponse::setBody($body);
    }
}
예제 #4
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);
 }
예제 #5
0
 /**
  *
  * Process data after render
  * @return string
  */
 function onAfterRender()
 {
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         return;
     }
     $body = JResponse::getBody();
     $plgParams = $this->plgParams;
     $disable_map = $plgParams->get('disable_map', 0);
     if ($disable_map) {
         $body = $this->removeCode($body);
         JResponse::setBody($body);
         return;
     }
     if (!preg_match($this->_plgCodeNew, $body) && !preg_match($this->_plgCode, $body)) {
         return;
     }
     $body = $this->stylesheet($this->plugin, $body);
     //ignore short-code that placed in text/editor field
     $pattern = '#value\\s*=\\s*"[^"]*?{jamap.*?}(\\s*{/jamap})?[^"]*?"#';
     $pattern2 = '#<textarea[^>]*?>[\\s\\S]*?{jamap.*?}(\\s*{/jamap})?[\\s\\S]*?</textarea>#';
     $body = preg_replace_callback($pattern, array($this, 'escapeMap'), $body);
     $body = preg_replace_callback($pattern2, array($this, 'escapeMap'), $body);
     //generate map
     $body = preg_replace_callback($this->_plgCodeNew, array($this, 'genMap'), $body);
     $body = preg_replace_callback($this->_plgCode, array($this, 'genMap'), $body);
     //restore short codes
     $body = str_replace(array('{[jamap]', '{/[jamap]}'), array('{jamap', '{/jamap}'), $body);
     JResponse::setBody($body);
 }
예제 #6
0
	function addCustomTagsToDocument($tags)
	{
		if (empty($tags)) return ;
		
		$content = '';
		if (AriJoomlaUtils::isJoomla15())
		{
			$content = JResponse::getBody();
		}
		else
		{
			$content = @ob_get_contents();
			@ob_clean();
		}

		$content = preg_replace('/(<\/head\s*>)/i', join('', $tags) . '$1', $content);
		
		if (AriJoomlaUtils::isJoomla15())
		{
			JResponse::setBody($content); 
		}
		else
		{
			echo $content;
		}
	}
예제 #7
0
 /**
  * Run on the joomla onAfterRender trigger
  */
 public function onAfterRender()
 {
     // Use this plugin only in site application
     if (JFactory::getApplication()->isSite()) {
         //check if pdf is to be output
         $printpdf = JRequest::getInt('pdf');
         if ($printpdf == 1) {
             //get document html from joomla cycle
             $data = JResponse::getBody();
             //convert paths in html to full paths
             $this->fullPaths($data);
             //setup dompdf objects
             $pdf = $this->engine;
             //create pdf using dompdf engine
             $pdf->load_html($data);
             $pdf->set_paper($this->params->get('size', 'letter'), $this->params->get('orientation', 'portrait'));
             $pdf->render();
             //get and set pdf title to page title
             $this->setName(JFactory::getDocument()->getTitle());
             //present pdf to user
             $pdf->stream($this->getName() . '.pdf');
             return '';
         }
     }
 }
예제 #8
0
 function onAfterRender()
 {
     $plugin =& JPluginHelper::getPlugin('system', 'phocapdffabrik');
     $pluginP = new JParameter($plugin->params);
     $pdfDestination = $pluginP->get('pdf_destination', 'S');
     /*global $mainframe;
     	 if ($mainframe->isAdmin()) {
     	 return;
     	 }*/
     // IE 7 bug
     include_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_phocapdf' . DS . 'helpers' . DS . 'phocapdfbrowser.php';
     $document =& JFactory::getDocument();
     $doctype = $document->getType();
     if ($doctype == 'html') {
         $bodySite = JResponse::getBody();
         if ($pdfDestination == 'I' || $pdfDestination == 'D') {
             // Remome OnClick
             $bodySite = preg_replace_callback('/<a(.+)href="(.*)format=pdf(.*)"(.+)onclick="(.*)"/Ui', array('plgSystemPhocaPDFFabrik', 'phocaPDFCallbackOnClick'), $bodySite);
         } else {
             //$bodySite    = preg_replace_callback('/<a(.+)href="(.*)format=pdf(.*)"/Ui', array('plgSystemPhocaPDFFabrik', 'phocaPDFCallback'), $bodySite);
             // IE 7 bug
             $bodySite = preg_replace_callback('/<a(.+)href="(.*)format=pdf(.*)"(.+)onclick="(.*)"/Ui', array('plgSystemPhocaPDFFabrik', 'phocaPDFCallbackOnClickIE'), $bodySite);
         }
         JResponse::setBody($bodySite);
     }
     return true;
 }
예제 #9
0
 public function onAfterRender()
 {
     $fbml = '<html xmlns:fb="http://ogp.me/ns/fb#" ';
     $html = JResponse::getBody();
     $html = JString::str_ireplace('<html', $fbml, $html);
     JResponse::setBody($html);
 }
예제 #10
0
 function onAfterRender()
 {
     global $mainframe;
     $jatypo = JRequest::getCmd('jatypo');
     if (!$mainframe->isAdmin() && !$jatypo) {
         return;
     }
     $tmpl = dirname(__FILE__) . DS . 'jatypo' . DS . 'tmpl' . DS . 'default.php';
     $html = $this->loadTemplate($tmpl);
     //$html = file_get_contents ($tmpl);
     //if (preg_match ('/<body[^>]*>(.*)<\/body>/s', $html, $matches)) $html = $matches[1];
     $buffer = JResponse::getBody();
     if ($mainframe->isAdmin()) {
         if (preg_match('/id=\\"editor-xtd-buttons\\"/', $buffer)) {
             //exist editor
             //$html = "<div id=\"jatypo-wrap\">$html</div>";
             $buffer = preg_replace('/<\\/body>/', "\n{$html}\n</body>", $buffer);
             JResponse::setBody($buffer);
         }
         return;
     }
     //replace body by the sample
     $buffer = preg_replace('/<body([^>]*)>.*<\\/body>/s', "<body\\1>{$html}</body>", $buffer);
     JResponse::setBody($buffer);
 }
예제 #11
0
 function onAfterRender()
 {
     if (class_exists('JEventDispatcher', false)) {
         $dispatcher = JEventDispatcher::getInstance();
     } else {
         $dispatcher = JDispatcher::getInstance();
     }
     $dispatcher->trigger('onNextendBeforeCompileHead');
     ob_start();
     if (class_exists('N2AssetsManager')) {
         echo N2AssetsManager::getCSS();
         echo N2AssetsManager::getJs();
     }
     $head = ob_get_clean();
     if ($head != '') {
         $application = JFactory::getApplication();
         if (class_exists('JApplicationWeb') && method_exists($application, 'getBody')) {
             $body = $application->getBody();
             $mode = 'JApplicationWeb';
         } else {
             $body = JResponse::getBody();
             $mode = 'JResponse';
         }
         $body = preg_replace('/<\\/head>/', $head . '</head>', $body, 1);
         switch ($mode) {
             case 'JResponse':
                 JResponse::setBody($body);
                 break;
             default:
                 $application->setBody($body);
         }
     }
 }
예제 #12
0
 public function _renderStatus()
 {
     $date = JFactory::getDate();
     $jparam = new JConfig();
     if (!JFile::exists(JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_community' . DS . 'community.xml')) {
         return false;
     }
     if (JFile::exists($jparam->tmp_path . DS . 'jomsocialupdate.ini')) {
         $lastcheckdate = JFile::read($jparam->tmp_path . DS . 'jomsocialupdate.ini');
     } else {
         $lastcheckdate = $date->toFormat();
     }
     JFile::write($jparam->tmp_path . DS . 'jomsocialupdate.ini', $lastcheckdate);
     $dayInterval = 1;
     // days
     $currentdate = $date->toFormat();
     $checkVersion = strtotime($currentdate) > strtotime($lastcheckdate) + $dayInterval * 60 * 60 * 24;
     // Load language
     $lang = JFactory::getLanguage();
     $lang->load('com_community', JPATH_ROOT . DS . 'administrator');
     $button = $this->_getButton($checkVersion);
     $html = JResponse::getBody();
     $html = str_replace('<div id="module-status">', '<div id="module-status">' . $button, $html);
     // Load AJAX library for the back end.
     $jax = new JAX(rtrim(JURI::root(), '/') . '/plugins/system/pc_includes');
     $jax->setReqURI(rtrim(JURI::root(), '/') . '/administrator/index.php');
     $jaxScript = $jax->getScript();
     JResponse::setBody($html . $jaxScript);
 }
예제 #13
0
 function onAfterRender()
 {
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     // we don't care about /administrator or pages that aren't html
     if ($app->isAdmin() || JRequest::getVar('format') == 'raw' || $app->isSite() && $doc->getType() != 'html') {
         return true;
     }
     // default favicon and individual menu-item assignments
     $default = (int) $this->params->get('default', 0);
     $assignmentsobject = (array) $this->params->get('assignments');
     $assignments = array();
     foreach ($assignmentsobject as $key => $assignment) {
         $assignments[$key] = (array) $assignment;
     }
     // no default and no assignments = no point
     if (!$default && !count($assignments)) {
         return true;
     }
     $favicon = $this->getFavicon($default, $assignments);
     // no favicon found and no valid default
     if (!$favicon) {
         return true;
     }
     $buffer = JResponse::getBody();
     $link = '<link href="' . $favicon . '" rel="shortcut icon" type="image/vnd.microsoft.icon" />';
     preg_match('/<link href=.* rel="shortcut icon" type=.*\\/>/', $buffer, $position, PREG_OFFSET_CAPTURE);
     if (isset($position[0]) && isset($position[0][0]) && strlen($position[0][0])) {
         $buffer = str_replace($position[0][0], $link, $buffer);
     } else {
         $buffer = str_replace("</head>", "\t{$link}\n</head>", $buffer);
     }
     JResponse::setBody($buffer);
 }
예제 #14
0
function _modifyResponsiveTemplate()
{
    $buffer = JResponse::getBody();
    $buffer = trim($buffer);
    $lines = RSFormProHelper::explode($buffer);
    $line = $lines[0];
    if (strtolower($line) != '<!doctype html>') {
        // single line
        if (strpos($line, '>') !== false) {
            $buffer = str_replace($line, '<!doctype html>', $buffer);
        } else {
            // should be on multiple lines
            $i = 0;
            while (strpos($line, '>') === false) {
                $i++;
                $line = $lines[$i];
            }
            // bail out, we might be modifying something else
            if (strpos($line, '<') !== false) {
                return;
            }
            // remove the first lines...
            for ($j = 0; $j <= $i; $j++) {
                unset($lines[$j]);
            }
            // add this on the first line
            array_unshift($lines, '<!doctype html>');
            // join the new buffer
            $buffer = implode("\r\n", $lines);
        }
        JResponse::setBody($buffer);
    }
}
예제 #15
0
 /**
  * Registers a handler to filter the final output
  *
  * @param  callable  $handler  A function( $body ) { return $bodyChanged; }
  * @return self                To allow chaining.
  */
 public function registerOnAfterRenderBodyFilter($handler)
 {
     $this->registerEvent('onAfterRender', function () use($handler) {
         \JResponse::setBody($handler(\JResponse::getBody()));
     });
     return $this;
 }
예제 #16
0
파일: helper.php 프로젝트: sangkasi/joomla
 function onAfterRender()
 {
     if (!$this->params->pass) {
         return;
     }
     $document =& JFactory::getDocument();
     $docType = $document->getType();
     // only in html
     if ($docType != 'html') {
         return;
     }
     $html = JResponse::getBody();
     if ($this->params->pass > 1) {
         $this->removeCloseLinks($html);
         if ($this->params->pass == 3) {
             $this->tmplLinks($html);
         }
     } else {
         $this->handleLinks($html);
     }
     if ($this->params->enable_syntax) {
         $this->handleSyntax($html);
     }
     JResponse::setBody($html);
 }
예제 #17
0
 function onAfterRender()
 {
     $buffer = JResponse::getBody();
     $buffer = preg_replace('#<head>([\\s\\S]+?)<\\/head>#', '<head>$1' . $this->loadStyles() . '</head>', $buffer);
     JResponse::setBody($buffer);
     return true;
 }
예제 #18
0
function setStyle()
{
    $app = JFactory::getApplication();
    $doc = JFactory::getDocument();
    if ($doc->getType() != 'html') {
        return;
    }
    //include_once AK_LIB_PATH.DS.'dom'.DS.'simple_html_dom.php';
    $body = JResponse::getBody();
    $body = explode('</head>', $body);
    $base = JURI::root();
    $style = "\n";
    if ($app->isSite()) {
        if (JVERSION < 3.0) {
            $style .= '<link rel="stylesheet" href="' . AK_ADMIN_CSS_URL . '/system.css" type="text/css" />' . "\n";
        }
        $style .= '<link rel="stylesheet" href="' . AK_CSS_URL . '/custom-typo.css" type="text/css" />' . "\n";
        $style .= '<link rel="stylesheet" href="' . AK_CSS_URL . '/custom.css" type="text/css" />' . "\n";
    } else {
        if (JVERSION < 3.0) {
            $style .= '<link rel="stylesheet" href="' . AK_ADMIN_CSS_URL . '/system.css" type="text/css" />' . "\n";
        }
        $style .= '<link rel="stylesheet" href="' . AK_CSS_URL . '/custom-admin.css" type="text/css" />' . "\n";
    }
    $body[0] .= $style;
    //Fold content
    $replace['{fold}'] = '<div class="ak-fold-warp"><div class="ak-fold-outter"><div class="ak-fold-inner">';
    $replace['{/fold}'] = '</div></div><div class="ak-fold-button"></div></div><div class="clearfix"></div>';
    if ($app->isSite()) {
        $body[1] = strtr($body[1], $replace);
    }
    $body = implode('</head>', $body);
    JResponse::setBody($body);
}
예제 #19
0
 function onAfterRender()
 {
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         return;
     }
     // Initialise variables
     $id = $this->params->get('id', '');
     $webvisor = $this->params->get('webvisor', '');
     $clickMap = $this->params->get('clickMap', '');
     $linksOut = $this->params->get('linksOut', '');
     $accurateTrackBounce = $this->params->get('accurateTrackBounce', '');
     $noIndex = $this->params->get('noIndex', '');
     $noIndexWrapper = $this->params->get('noindexWrapper', '1');
     //getting body code and storing as buffer
     $buffer = JResponse::getBody();
     //embed Yandex Metrika code
     $webvisor = $webvisor ? 'true' : 'false';
     $clickMap = $clickMap ? 'true' : 'false';
     $linksOut = $linksOut ? 'true' : 'false';
     $accurateTrackBounce = $accurateTrackBounce ? 'true' : 'false';
     $noIndex = $noIndex ? 'ut:"noindex",' : '';
     $javascript = '<!-- Yandex.Metrika counter --><script type="text/javascript">(function (d, w, c) { (w[c] = w[c] || []).push(function() { try { w.yaCounter' . $id . ' = new Ya.Metrika({id:' . $id . ', clickmap:' . $clickMap . ', trackLinks:' . $linksOut . ', accurateTrackBounce:' . $accurateTrackBounce . ',' . $noIndex . ' webvisor:' . $webvisor . '}); } catch(e) {} }); var n = d.getElementsByTagName("script")[0], s = d.createElement("script"), f = function () { n.parentNode.insertBefore(s, n); }; s.type = "text/javascript"; s.async = true; s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js"; if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f); } else { f(); } })(document, window, "yandex_metrika_callbacks");</script><noscript><div><img src="//mc.yandex.ru/watch/' . $id . '" style="position:absolute; left:-9999px;" alt="" /></div></noscript><!-- /Yandex.Metrika counter -->';
     if ($noIndexWrapper) {
         $javascript = '<!--noindex-->' . $javascript . '<!--/noindex-->';
     }
     $buffer = preg_replace("/<\\/body>/", $javascript . "\n\n</body>", $buffer);
     //output the buffer
     JResponse::setBody($buffer);
     return true;
 }
예제 #20
0
 private function _renderStatus()
 {
     $date = JFactory::getDate();
     $jparam = new JConfig();
     if (!JFile::exists(JPATH_ROOT . '/administrator/components/com_community/community.xml')) {
         return false;
     }
     if (JFile::exists(JPATH_ROOT . '/administrator/components/com_community/jomsocialupdate.ini')) {
         $lastcheckdate = JFile::read(JPATH_ROOT . '/administrator/components/com_community/jomsocialupdate.ini');
     } else {
         $lastcheckdate = $date->format('Y-m-d H:i:s');
     }
     JFile::write(JPATH_ROOT . '/administrator/components/com_community/jomsocialupdate.ini', $lastcheckdate);
     $dayInterval = 1;
     // days
     $currentdate = $date->format('Y-m-d H:i:s');
     $checkVersion = strtotime($currentdate) > strtotime($lastcheckdate) + $dayInterval * 60 * 60 * 24;
     // Load language
     $lang = JFactory::getLanguage();
     $lang->load('com_community', JPATH_ROOT . '/administrator');
     $button = $this->_getButton($checkVersion);
     $html = JResponse::getBody();
     $html = str_replace('<div id="module-status">', '<div id="module-status">' . $button, $html);
     // Load AJAX library for the back end.
     $jaxScript = '';
     $noHTML = JRequest::getInt('no_html', 0);
     $format = JRequest::getWord('format', 'html');
     if (!$noHTML && $format == 'html') {
         require_once AZRUL_SYSTEM_PATH . '/pc_includes/ajax.php';
         $jax = new JAX(AZRUL_SYSTEM_LIVE . '/pc_includes');
         $jax->setReqURI(rtrim(JURI::root(), '/') . '/administrator/index.php');
         $jaxScript = $jax->getScript();
     }
     JResponse::setBody($html . $jaxScript);
 }
예제 #21
0
파일: sef.php 프로젝트: joebushi/joomla
 /**
  * Converting the site URL to fit to the HTTP request
  */
 function onAfterRender()
 {
     $app =& JFactory::getApplication();
     if ($app->getName() != 'site') {
         return true;
     }
     //Replace src links
     $base = JURI::base(true) . '/';
     $buffer = JResponse::getBody();
     $regex = '#href="index.php\\?([^"]*)#m';
     $buffer = preg_replace_callback($regex, array('plgSystemSEF', 'route'), $buffer);
     $protocols = '[a-zA-Z0-9]+:';
     //To check for all unknown protocals (a protocol must contain at least one alpahnumeric fillowed by :
     $regex = '#(src|href)="(?!/|' . $protocols . '|\\#|\')([^"]*)"#m';
     $buffer = preg_replace($regex, "\$1=\"{$base}\$2\"", $buffer);
     $regex = '#(onclick="window.open\\(\')(?!/|' . $protocols . '|\\#)([^/]+[^\']*?\')#m';
     $buffer = preg_replace($regex, '$1' . $base . '$2', $buffer);
     // ONMOUSEOVER / ONMOUSEOUT
     $regex = '#(onmouseover|onmouseout)="this.src=([\']+)(?!/|' . $protocols . '|\\#|\')([^"]+)"#m';
     $buffer = preg_replace($regex, '$1="this.src=$2' . $base . '$3$4"', $buffer);
     // Background image
     $regex = '#style\\s*=\\s*[\'\\"](.*):\\s*url\\s*\\([\'\\"]?(?!/|' . $protocols . '|\\#)([^\\)\'\\"]+)[\'\\"]?\\)#m';
     $buffer = preg_replace($regex, 'style="$1: url(\'' . $base . '$2$3\')', $buffer);
     // OBJECT <param name="xx", value="yy"> -- fix it only inside the <param> tag
     $regex = '#(<param\\s+)name\\s*=\\s*"(movie|src|url)"[^>]\\s*value\\s*=\\s*"(?!/|' . $protocols . '|\\#|\')([^"]*)"#m';
     $buffer = preg_replace($regex, '$1name="$2" value="' . $base . '$3"', $buffer);
     // OBJECT <param value="xx", name="yy"> -- fix it only inside the <param> tag
     $regex = '#(<param\\s+[^>]*)value\\s*=\\s*"(?!/|' . $protocols . '|\\#|\')([^"]*)"\\s*name\\s*=\\s*"(movie|src|url)"#m';
     $buffer = preg_replace($regex, '<param value="' . $base . '$2" name="$3"', $buffer);
     // OBJECT data="xx" attribute -- fix it only in the object tag
     $regex = '#(<object\\s+[^>]*)data\\s*=\\s*"(?!/|' . $protocols . '|\\#|\')([^"]*)"#m';
     $buffer = preg_replace($regex, '$1data="' . $base . '$2"$3', $buffer);
     JResponse::setBody($buffer);
     return true;
 }
 function onAfterRender()
 {
     $type = $this->params->get('type', '');
     $trackerCode = $this->params->get('code', '');
     $domain = $this->params->get('domain', 'auto');
     $verify = $this->params->get('verify', '');
     $javascript = '';
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         return;
     }
     $buffer = JResponse::getBody();
     if ($verify) {
         $javascript .= "\n\n<meta name=\"google-site-verification\" content=\"" . $verify . "\" />\n\n";
     }
     if ($type == 'asynchronous') {
         $javascript .= "<script type=\"text/javascript\">\n            " . $enhancedOutput . "\n var _gaq = _gaq || [];\n _gaq.push(['_setAccount', '" . $trackerCode . "']);\n";
         $javascript .= "_gaq.push(['_trackPageview']);\n (function() {\n  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n })();\n</script>\n<!-- Asynchonous Google Analytics Plugin by PB Web Development -->";
     }
     if ($type == 'universal') {
         $javascript .= "\n<script>\n  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n  ga('create', '" . $trackerCode . "', '" . $domain . "');\n  ga('send', 'pageview');\n\n</script>\n<!-- Universal Google Analytics Plugin by PB Web Development -->\n";
     }
     $buffer = preg_replace("/<\\/head>/", "\n\n" . $javascript . "\n\n</head>", $buffer);
     JResponse::setBody($buffer);
     return true;
 }
예제 #23
0
 function onAfterRender()
 {
     if ((defined('JCOMMENTS_CSS') || defined('JCOMMENTS_JS')) && !defined('JCOMMENTS_SHOW')) {
         $app =& JFactory::getApplication();
         if ($app->getName() != 'site') {
             return true;
         }
         $buffer = JResponse::getBody();
         $regexpJS = '#(\\<script(\\stype=\\"text\\/javascript\\")? src="[^\\"]*\\/com_jcomments\\/[^\\>]*\\>\\<\\/script\\>[\\s\\r\\n]*?)#ismU';
         $regexpCSS = '#(\\<link rel="stylesheet" href="[^\\"]*\\/com_jcomments\\/[^>]*>[\\s\\r\\n]*?)#ismU';
         $jcommentsTestJS = '#(JCommentsEditor|new JComments)#ismU';
         $jcommentsTestCSS = '#(comment-link|jcomments-links)#ismU';
         $jsFound = preg_match($jcommentsTestJS, $buffer);
         $cssFound = preg_match($jcommentsTestCSS, $buffer);
         if (!$jsFound) {
             // remove JavaScript if JComments isn't loaded
             $buffer = preg_replace($regexpJS, '', $buffer);
         }
         if (!$cssFound && !$jsFound) {
             // remove CSS if JComments isn't loaded
             $buffer = preg_replace($regexpCSS, '', $buffer);
         }
         if ($buffer != '') {
             JResponse::setBody($buffer);
         }
     }
     return true;
 }
예제 #24
0
 function onAfterRender()
 {
     $fbml = '<html xmlns:fb="http://www.facebook.com/2008/fbml"';
     $html = JResponse::getBody();
     $html = JString::str_ireplace('<html', $fbml, $html);
     JResponse::setBody($html);
 }
예제 #25
0
파일: svg_helper.php 프로젝트: JozefAB/qk
 function onAfterRender()
 {
     $app =& JFactory::getApplication();
     if ($app->getName() != 'site') {
         return true;
     }
     $buffer = JResponse::getBody();
     if (strripos($buffer, '_svg.png') !== false) {
         include 'plugins/system/svg_helper/Modernizr/modernizr-server.php';
         if (isset($_COOKIE['svg-check']) && strripos($_COOKIE['svg-check'], 'svg:1') !== false) {
             $buffer = str_replace('_svg.png', '_png.svg', $buffer);
         }
     }
     /* Older versions compatibility start */
     $extension = $this->params->get('extension');
     if (strripos($buffer, $extension) !== false) {
         include 'plugins/system/svg_helper/Modernizr/modernizr-server.php';
         if ($this->params->get('enable_replacement') == 1) {
             if (isset($_COOKIE['svg-check']) && strripos($_COOKIE['svg-check'], 'svg:1') !== false) {
                 $buffer = str_replace($extension, 'svg', $buffer);
             } else {
                 $buffer = str_replace($extension, 'png', $buffer);
             }
         }
     }
     /* Older versions compatibility end */
     if ($buffer != '') {
         JResponse::setBody($buffer);
     }
     return true;
 }
예제 #26
0
파일: gk.parser.php 프로젝트: Roma48/mayak
 public function __construct()
 {
     jimport('joomla.environment.response');
     $this->body = JResponse::getBody();
     $this->bInfo = null;
     $buf = $this->parseIt();
     JResponse::setBody($buf);
 }
예제 #27
0
 function onAfterRender()
 {
     $app = JFactory::getApplication();
     t3import('core.admin.util');
     $util = new JAT3_AdminUtil();
     if ($app->isAdmin()) {
         ob_start();
         $util->show_button_clearCache();
         $content = ob_get_clean();
         $buffer = JResponse::getBody();
         $buffer = preg_replace('/<\\/body>/', $content . "\n</body>", $buffer);
         JResponse::setBody($buffer);
     }
     if ($util->checkPermission()) {
         if (JAT3_AdminUtil::checkCondition_for_Menu()) {
             // HTML= Parser lib
             require_once T3Path::path(T3_CORE) . DS . 'libs' . DS . "html_parser.php";
             $_body = JResponse::getBody();
             require_once T3Path::path(T3_CORE) . DS . 'admin' . DS . "util.php";
             // Replace content
             $jat3core = new JAT3_AdminUtil();
             $_body = $jat3core->replaceContent($_body);
             if ($_body) {
                 JResponse::setBody($_body);
             }
         }
     }
     if (!T3Common::detect()) {
         return;
     }
     if ($util->checkPermission()) {
         if ($util->checkCondition()) {
             $params = T3Path::path(T3_CORE) . DS . 'admin' . DS . 'index.php';
             if (file_exists($params)) {
                 ob_start();
                 include $params;
                 $content = ob_get_clean();
                 $buffer = JResponse::getBody();
                 $buffer = preg_replace('/<\\/body>/', $content . "\n</body>", $buffer);
                 JResponse::setBody($buffer);
             }
         }
         return;
     }
     if (!$app->isAdmin()) {
         //Expires date set to very long
         //JResponse::setHeader( 'Expires', gmdate( 'D, d M Y H:i:s', time() + 3600000 ) . ' GMT', true );
         //JResponse::setHeader( 'Last-Modified', gmdate( 'D, d M Y H:i:s', time()) . ' GMT', true );
         JResponse::setHeader('Expires', '', true);
         JResponse::setHeader('Cache-Control', 'private', true);
         //Update cache in case of the whole page is cached
         $key = T3Cache::getPageKey();
         if (($data = T3Cache::get($key)) && !preg_match('#<jdoc:include\\ type="([^"]+)" (.*)\\/>#iU', $data)) {
             $buffer = JResponse::getBody();
             T3Cache::store($buffer, $key);
         }
     }
 }
예제 #28
0
파일: editor.php 프로젝트: irovast/eyedock
 function onAfterRender()
 {
     $buffer = JResponse::getBody();
     $search = array('#<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">#', '#<link href="(.*?)templates[^"]+"[^>]+>#', '#<body[^>]*>#', '#\\n{4}+#');
     $replace = array('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">', '', '<body>', '');
     $buffer = preg_replace(str_replace('/', '\\/', $search), $replace, $buffer);
     JResponse::setBody($buffer);
     return true;
 }
예제 #29
0
 function onAfterRender()
 {
     $body = JResponse::getBody();
     if (!$body || $body == '') {
         return true;
     }
     $body = $this->installOptions($body);
     JResponse::setBody($body);
 }
예제 #30
0
 public function onApplicationAfterRender(ArrayObject $args)
 {
     // only insert the js when editing a menu item
     if (KInput::get('task', 'get', 'cmd') == 'edit') {
         $buffer = JResponse::getBody();
         $buffer = str_replace('new Accordion', 'document.accordion = new Accordion', $buffer);
         JResponse::setBody($buffer);
     }
 }