Esempio n. 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);
             }
         }
         //Check condition excute translate multi language(Joomfish)
         if (JAT3_AdminUtil::checkConditionJoomfish()) {
             //Include file joomfish translate
             t3import('core.admin.joomfish');
             $appJoomfish = new JAT3_AdminJoomfish();
             $appJoomfish->translate();
         }
     }
     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);
         }
     }
 }