Beispiel #1
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);
         }
     }
 }
Beispiel #2
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);
         }
     }
 }
Beispiel #3
0
 function loadScipt()
 {
     if (JAT3_AdminUtil::checkCondition()) {
         JHTML::script('', JURI::root() . T3_CORE . '/admin/assets/js/ja_tabs.js', true);
         JHTML::script('', JURI::root() . T3_CORE . '/admin/assets/js/jat3.js');
         JHTML::script('', JURI::root() . T3_CORE . '/admin/assets/js/ja.moo.extends.js');
         JHTML::script('', JURI::root() . T3_CORE . '/admin/assets/js/japageidsettings.js');
         JHTML::script('', JURI::root() . T3_CORE . '/admin/assets/js/ja.upload.js');
         JHTML::script('', JURI::root() . T3_CORE . '/element/assets/js/japaramhelper.js');
         JHTML::script('', JURI::root() . T3_CORE . '/element/assets/js/jathemesettings.js');
         JHTML::_('behavior.modal');
     }
 }