示例#1
0
 function init_layout()
 {
     $t3 = T3Template::getInstance();
     if (!$t3->_html) {
         $t3->loadLayout();
     }
 }
示例#2
0
function custom_body_class()
{
    $cls = '';
    $tpl = T3Template::getInstance();
    if (!$tpl->countModules('slideshow')) {
        $cls .= 'no-slideshow';
    }
    if (!$tpl->countModules('user7 + user8 + user9 + user10')) {
        $cls .= ' no-botsl';
    }
    return $cls;
}
示例#3
0
 /**
  * Get page key from URI, browser (version), params (cookie params)
  *
  * @return mixed  NULL if devmode/noncache or string key code
  */
 public static function getPageKey()
 {
     static $key = null;
     if ($key) {
         return $key;
     }
     // No cache in devmode
     $t3cache = T3Cache::getT3Cache();
     if ($t3cache->_devmode) {
         return null;
     }
     // No cache when disable T3 cache
     $config = T3Common::get_template_based_params();
     if ($config->get('cache', 0) == 0) {
         return null;
     }
     // TODO: need to move in cache page code at the end of onAfterRender
     $mainframe = JFactory::getApplication();
     $messages = $mainframe->getMessageQueue();
     // Ignore cache when there're some message
     if (is_array($messages) && count($messages)) {
         return null;
     }
     // If user log-in, ignore cache
     $user = JFactory::getUser();
     if (!$user->get('guest') || $_SERVER['REQUEST_METHOD'] != 'GET') {
         return null;
     }
     // If ie6, ignore cache
     $isIE6 = T3Template::isIE6();
     if ($isIE6) {
         return null;
     }
     // Don't cache when offline
     $cfg = JFactory::getConfig();
     if ($cfg->get('offline')) {
         return null;
     }
     $uri = JRequest::getURI();
     //$browser = T3Common::getBrowserSortName() . "-" . T3Common::getBrowserMajorVersion();
     $mobile = T3Common::mobile_device_detect();
     $params = T3Parameter::getInstance();
     $cparams = '';
     foreach ($params->_params_cookie as $k => $v) {
         $cparams .= $k . "=" . $v . '&';
     }
     //$key = "page - URI: $uri; Browser: $browser; Params: $cparams";
     $key = "page - URI: {$uri}; Mobile: {$mobile}; Params: {$cparams}";
     //T3Common::log($key . '  ' . T3Common::getBrowserSortName() . "-" . T3Common::getBrowserMajorVersion());
     return $key;
 }
示例#4
0
 /**
  * Implement after render event
  *
  * @return null
  */
 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 = str_replace('</body>', $content . "\n</body>", $buffer);
         JResponse::setBody($buffer);
     }
     if ($util->checkPermission()) {
         if (JAT3_AdminUtil::checkCondition_for_Menu()) {
             // HTML= Parser lib
             include_once T3Path::path(T3_CORE) . DS . 'libs' . DS . "html_parser.php";
             include_once T3Path::path(T3_CORE) . DS . 'admin' . DS . "util.php";
             $_body = JResponse::getBody();
             // 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()) {
             // Load t3 language file for template admin to avoid to be override by other extensions language
             $extension = 'plg_' . $this->_type . '_' . $this->_name;
             $lang = JFactory::getLanguage();
             $lang->load(strtolower($extension), JPATH_ADMINISTRATOR, null, true, false);
             $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
         $t3template = T3Template::getInstance();
         $key = T3Cache::getPageKey();
         //if (($data = T3Cache::get ( $key )) && !preg_match('#<jdoc:include\ type="([^"]+)" (.*)\/>#iU', $data)) {
         if ($key != null && $t3template->nonecache == false) {
             $time = time();
             JResponse::setHeader('Last-Modified', gmdate('D, d M Y H:i:s', $time) . ' GMT', true);
             JResponse::setHeader('ETag', md5($key), true);
             $time = sprintf('%20d', $time);
             $buffer = $time . JResponse::getBody();
             $t3cache = T3Cache::getT3Cache();
             $t3cache->store($buffer, $key);
         }
     }
 }
示例#5
0
 /**
  * Render position name
  * @param   string  $condition
  * @return  string  the position value
  */
 function getPosname($condition)
 {
     return parent::getPosname($condition) . '" data-original="' . $condition;
 }
示例#6
0
 function init_layout()
 {
     $doc = JFactory::getDocument();
     $t3 = T3Template::getInstance($doc);
     if (!$t3->_html) {
         $t3->loadLayout();
     }
 }
示例#7
0
 /**
  * Add class into body tag
  *
  * @param string $class  Class name
  *
  * @return void
  */
 function addBodyClass($class)
 {
     $t3 = T3Template::getInstance($doc);
     $t3->addBodyClass($class);
 }
示例#8
0
<?php

/*
 * ------------------------------------------------------------------------
 * JA T3 Blank template for joomla 2.5
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2011 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * ------------------------------------------------------------------------
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
if (class_exists('T3Template')) {
    $tmpl = T3Template::getInstance();
    $tmpl->setTemplate($this);
    $tmpl->render();
    return;
} else {
    //Need to install or enable JAT3 Plugin
    echo JText::_('MISSING_JAT3_FRAMEWORK_PLUGIN');
}
    /**
     *
     * JT3 Framework render
     */
    public function render()
    {
        $replace = array();
        $matches = array();
        parent::loadLayout();
        $data = $this->_html;
        if (preg_match_all('#<jdoc:include\\ type="([^"]+)" (.*)\\/>#iU', $data, $matches)) {
            $cache_exclude = parent::getParam('cache_exclude');
            $cache_exclude = new JRegistry($cache_exclude);
            $nc_com = explode(',', $cache_exclude->get('component'));
            $nc_pos = explode(',', $cache_exclude->get('position'));
            $replace = array();
            $matches[0] = array_reverse($matches[0]);
            $matches[1] = array_reverse($matches[1]);
            $matches[2] = array_reverse($matches[2]);
            $count = count($matches[1]);
            $option = JRequest::getCmd('option');
            $headindex = -1;
            //for none cache items
            $nonecachesearch = array();
            $nonecachereplace = array();
            //search for item load in template (css, images, js)
            $regex = '/(href|src)=("|\')([^"\']*\\/templates\\/' . T3_ACTIVE_TEMPLATE . '\\/([^"\']*))\\2/';
            for ($i = 0; $i < $count; $i++) {
                $attribs = JUtility::parseAttributes($matches[2][$i]);
                $type = $matches[1][$i];
                $name = isset($attribs['name']) ? $attribs['name'] : null;
                //no cache => no cache for all jdoc include except head
                //cache: exclude modules positions & components listed in cache exclude param
                //check if head
                if ($type == 'head') {
                    $headindex = $i;
                } else {
                    $content = parent::getBuffer($type, $name, $attribs);
                    $renderer = $this->loadRenderer('module');
                    $poweradmin = JRequest::getCmd('poweradmin', 0);
                    $vsm_changeposition = JRequest::getCmd('vsm_changeposition', 0);
                    //Add a div wrapper for showing block information
                    if ($poweradmin == 1) {
                        //If the page requested to render position only
                        if ($vsm_changeposition == 1) {
                            if ($type == 'modules') {
                                $content = '<div class="jsn-element-container_inner">' . '<div class="jsn-poweradmin-position clearafter" id="' . $name . '-jsnposition">
												<p>' . $name . '</p>
											</div>
											</div>
										    ';
                            } else {
                                if ($type == 'module') {
                                    $key = "mod.{$name}";
                                } else {
                                    if ($type == 'component') {
                                        $content = '<div class="jsn-component-container" id="jsnrender-component"><div class="jsn-show-component-container"><p>' . parent::getTitle() . '</p></div></div>';
                                    } else {
                                        $key = "{$type}.{$name}";
                                    }
                                }
                            }
                        } else {
                            if ($type == 'modules') {
                                $buffer = '';
                                foreach (JModuleHelper::getModules($name) as $mod) {
                                    $buffer .= '<div class="poweradmin-module-item" id="' . $mod->id . '-jsnposition" ><div id="moduleid-' . $mod->id . '-content">' . $renderer->render($mod, $attribs) . '</div></div>';
                                }
                                $content = '<div class="jsn-element-container_inner">' . '<div class="jsn-poweradmin-position clearafter" id="' . $name . '-jsnposition">
											' . $buffer . '
											</div>
											</div>
										    ';
                            } else {
                                if ($type == 'module') {
                                    $key = "mod.{$name}";
                                } else {
                                    if ($type == 'component') {
                                        $app = JFactory::getApplication();
                                        $itemid = JRequest::getVar('itemid', '');
                                        $menu = $app->getMenu();
                                        if ($itemid) {
                                            $menuItem = $menu->getItem($itemid);
                                        } else {
                                            $menuItem = $menu->getActive();
                                        }
                                        $uri = JURI::getInstance();
                                        $route = JRouter::getInstance('site');
                                        $params = $route->parse($uri);
                                        if (empty($params['id']) && !empty($menuItem->id)) {
                                            $uri->parse($menuItem->link);
                                            $params = $route->parse($uri);
                                        }
                                        if (!empty($params['option'])) {
                                            $key = array_search($params['option'], array('', 'com_content', 'com_categories', 'com_banner', 'com_weblinks', 'com_contact', 'com_newsfeeds', 'com_search', 'com_redirect'));
                                            if ($key) {
                                                if (!empty($params['id'])) {
                                                    if ($params['view'] == 'category') {
                                                        $editLink = 'option=com_categories&task=category.edit&id=' . $params['id'] . '&extension=' . $params['option'] . '&tmpl=component';
                                                        $task = 'category.apply';
                                                    } else {
                                                        switch ($key) {
                                                            case 1:
                                                                //com_content
                                                                $editLink = 'option=com_content&task=article.edit&id=' . $params['id'] . '&tmpl=component';
                                                                $task = 'article.apply';
                                                                break;
                                                            case 2:
                                                                //com_categories
                                                                $editLink = 'option=com_categories&task=category.edit&id=' . $params['id'] . '&tmpl=component';
                                                                $task = 'category.apply';
                                                                break;
                                                            case 3:
                                                                if ($params['view'] == 'client') {
                                                                    $editLink = 'option=com_banners&task=client.edit&id=' . $params['id'] . '&tmpl=component';
                                                                    $task = 'client.apply';
                                                                } else {
                                                                    $editLink = 'option=com_banners&task=banner.edit&id=' . $params['id'] . '&tmpl=component';
                                                                    $task = 'bannber.apply';
                                                                }
                                                                break;
                                                            case 4:
                                                                $editLink = 'option=com_weblinks&task=weblink.edit&id=' . $params['id'] . '&tmpl=component';
                                                                $task = 'weblink.apply';
                                                                break;
                                                            case 5:
                                                                $editLink = 'option=com_contact&task=contact.edit&id=' . $params['id'] . '&tmpl=component';
                                                                $task = 'contact.apply';
                                                                break;
                                                            case 6:
                                                                $editLink = 'option=com_newsfeeds&task=newsfeed.edit&id=' . $params['id'] . '&tmpl=component';
                                                                $task = 'newsfeed.apply';
                                                                break;
                                                            case 7:
                                                                $editLink = 'option=com_search&task=search.edit&id=' . $params['id'] . '&tmpl=component';
                                                                $task = 'search.apply';
                                                                break;
                                                            case 8:
                                                                $editLink = 'option=com_redirect&task=link.edit&id=' . $params['id'] . '&tmpl=component';
                                                                $task = 'link.apply';
                                                                break;
                                                        }
                                                    }
                                                } else {
                                                    $editLink = 'option=com_menus&task=item.edit&id=' . $menuItem->id . '&tmpl=component';
                                                    $task = 'item.save';
                                                }
                                            } else {
                                                //in feature
                                                $editLink = '';
                                                $task = '';
                                            }
                                        } else {
                                            $editLink = '';
                                            $task = '';
                                        }
                                        $content = '<div class="jsn-component-container" id="jsnrender-component">' . '<div class="jsn-show-component-container">' . '<div class="jsn-show-component">' . '<span id="tableshow" itemid="' . $menuItem->id . '" editlink="' . base64_encode($editLink) . '" title="' . parent::getTitle() . '" task="' . $task . '"></span>' . '</div>' . '</div>' . $content . '</div>';
                                    } else {
                                        $key = "{$type}.{$name}";
                                    }
                                }
                            }
                        }
                    }
                    //process url
                    $content = preg_replace_callback($regex, array($this, 'processReplateURL'), $content);
                }
                if (!parent::getParam('cache') || $type == 'head' || $type == 'modules' && in_array($name, $nc_pos) || $type == 'component' && in_array($option, $nc_com)) {
                    $replace[$i] = $matches[0][$i];
                    $nonecachesearch[] = $replace[$i];
                    $nonecachereplace[] = $content;
                } else {
                    $replace[$i] = $content;
                }
            }
            //update head
            if ($headindex > -1) {
                T3Head::proccess();
                $head = parent::getBuffer('head');
                $replace[$headindex] = $head;
            }
            //replace all cache content
            $data = str_replace($matches[0], $replace, $data);
            //update cache
            $key = T3Cache::getPageKey();
            if ($key) {
                T3Cache::store($data, $key);
            }
            //replace none cache content
            $data = str_replace($nonecachesearch, $nonecachereplace, $data);
        } else {
            $token = JUtility::getToken();
            $search = '#<input type="hidden" name="[0-9a-f]{32}" value="1" />#';
            $replacement = '<input type="hidden" name="' . $token . '" value="1" />';
            $data = preg_replace($search, $replacement, $data);
        }
        echo $data;
    }
示例#10
0
<?php

// no direct access
defined('_JEXEC') or die('Restricted access');
if (class_exists('T3Template')) {
    $tmpl = T3Template::getInstance($this);
    $tmpl->render();
    return;
} else {
    //Need to install or enable JAT3 Plugin
    echo JText::_('Missing jat3 framework plugin');
}
示例#11
0
 public static function init_layout()
 {
     $doc = JFactory::getDocument();
     $t3 = T3Template::getInstance($doc);
     if (version_compare(JVERSION, '3.0', 'ge')) {
         JHtml::_('behavior.framework', true);
     }
     if (!$t3->_html) {
         $t3->loadLayout();
     }
 }