/** * Check IE browser * * @return bool TRUE if IE, otherwise FALSE */ function isIE() { $bname = T3Common::getBrowserSortName(); return $bname == 'ie'; }
function getPageKey() { static $key = null; if ($key) { return $key; } $t3cache = T3Cache::getInstance(); if ($t3cache->_devmode) { return null; } //no cache in devmode $mainframe =& JFactory::getApplication(); $messages = $mainframe->getMessageQueue(); // Ignore cache when there're some message if (is_array($messages) && count($messages)) { $key = null; return null; } $user =& JFactory::getUser(); if ($user->get('aid') || $_SERVER['REQUEST_METHOD'] != 'GET') { $key = null; return null; //no cache for page } $string = 'page'; $uri = JRequest::getURI(); //t3import ('core.libs.Browser'); //$browser = new Browser(); //$string .= $browser->getBrowser().":".$browser->getVersion(); $browser = T3Common::getBrowserSortName() . "-" . T3Common::getBrowserMajorVersion(); $params = T3Parameter::getInstance(); $cparams = ''; foreach ($params->_params_cookie as $k => $v) { $cparams .= $k . "=" . $v . '&'; } $string = "page - URI: {$uri}; Browser: {$browser}; Params: {$cparams}"; $key = md5($string); //Insert into cache db /* $query = "insert `#__t3_cache` (`key`, `raw`, `uri`, `browser`, `params`, `counter`) values('$key', '$string', '$uri', '$browser', '$cparams', 1) ON DUPLICATE KEY UPDATE `counter`=`counter`+1;"; $db =& JFactory::getDBO(); @$db->setQuery( $query ); @$db->query(); */ return $key; }
$this->genBlockEnd($this->getBlocksXML('middle')); ?> </div> <?php //Add fix height for main area if (T3Common::node_attributes($this->getBlocksXML('middle'), 'fixheight')) { $this->showBlock('fixheight'); } ?> <!-- //MAIN CONTAINER --> <?php $blks =& $this->getBlocksXML('bottom'); $blocks =& T3Common::node_children($blks, 'block'); foreach ($blocks as $block) { if (T3Common::getBrowserSortName() == 'ie' && T3Common::getBrowserMajorVersion() == 7) { echo "<br class=\"clearfix\"/>"; } $this->showBlock($block); } ?> </div> <?php if ($this->isIE6()) { ?> <?php $this->showBlock('ie6/ie6warning'); } ?>
function proccess() { $document =& JFactory::getDocument(); //proccess stylesheets $themes = T3Common::get_active_themes(); //$themes[] = array('core', 'default'); //default now move to template root folder //$themes[] = array('engine', 'default'); $themes = array_reverse($themes); $scripts = array(); $css_urls = array(); $css_urls['site'] = array(); foreach ($themes as $theme) { $css_urls[$theme[0] . '.' . $theme[1]] = array(); } foreach ($themes as $theme) { $css_urls[$theme[0] . '.' . $theme[1] . '-browser'] = array(); } if (T3Common::isRTL()) { foreach ($themes as $theme) { $css_urls[$theme[0] . '.' . $theme[1] . '-rtl'] = array(); } } $bname = T3Common::getBrowserSortName(); $bver = T3Common::getBrowserMajorVersion(); $optimize_css = T3Parameter::get('optimize_css', 2); $optimize_js = T3Parameter::get('optimize_js', 2); foreach ($document->_styleSheets as $strSrc => $strAttr) { $path = T3Head::cleanUrl($strSrc); if (!$path) { //External url $css_urls['site'][] = array('', $strSrc); continue; } $intemplate = false; if (preg_match('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', $path)) { $path = preg_replace('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', '', $path); $intemplate = true; } /* if (!$intemplate && $optimize_css < 2) // don't read file content => keep original link { $css_urls['site'][] = array ('', $strSrc); continue; } */ $paths = array(); $paths[] = array('', $path, $strSrc); //The third element is the original url //if ($intemplate) { //only load other css files if in T3v2 template $ext = ''; if (preg_match('#\\.[^.]+$#', $path, $matches)) { $ext = $matches[0]; } //$file_info = pathinfo($path); //$ext = $file_info['extension']; if ($ext) { $paths[] = array('-browser', str_replace($ext, "-{$bname}{$ext}", $path)); $paths[] = array('-browser', str_replace($ext, "-{$bname}{$bver}{$ext}", $path)); if (T3Common::isRTL()) { $paths[] = array('-rtl', str_replace($ext, "-rtl{$ext}", $path)); $paths[] = array('-rtl', str_replace($ext, "-{$bname}-rtl{$ext}", $path)); $paths[] = array('-rtl', str_replace($ext, "-{$bname}{$bver}-rtl{$ext}", $path)); } } //} foreach ($paths as $path) { // if ($intemplate) { if ($urls = T3Path::get($path[1], true)) { foreach ($urls as $theme => $url) { $css_urls[$theme . $path[0]][$url[0]] = $url; } } } else { if (is_file(T3Path::path($path[1]))) { $css_urls['site'][T3Path::path($path[1])] = array(T3Path::path($path[1]), count($path) > 2 ? $path[2] : T3Path::url($path[1])); } //use original url ($path[2]) if exists } } } //remove current stylesheets $document->_styleSheets = array(); foreach ($document->_scripts as $strSrc => $strType) { $srcurl = T3Head::cleanUrl($strSrc); if (!$srcurl) { $scrips[] = array('', $strSrc); continue; } if (preg_match('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', $srcurl)) { //in template $srcurl = preg_replace('/^templates\\/' . T3_ACTIVE_TEMPLATE . '\\//', '', $srcurl); $path = str_replace('/', DS, $srcurl); if ($url = T3Path::get($path)) { $scrips[] = $url; } } else { if ($optimize_js < 1) { $scrips[] = array('', $strSrc); continue; } $path = str_replace('/', DS, $srcurl); $scrips[] = array(JPATH_SITE . DS . $path, JURI::base(true) . '/' . $srcurl); } } //remove current scripts $document->_scripts = array(); $css_urls = T3Head::optimizecss($css_urls); //if ($url) $css_urls = array(array(array('', $url))); //re-add stylesheet to head foreach ($css_urls as $urls) { foreach ($urls as $url) { $document->addStylesheet($url[1]); } } $scrips = T3Head::optimizejs($scrips); //re-add stylesheet to head foreach ($scrips as $url) { $document->addScript($url[1]); } }