コード例 #1
0
ファイル: t3.php プロジェクト: GitIPFire/Homeworks
 function onBeforeRender()
 {
     if (T3::detect()) {
         $japp = JFactory::getApplication();
         if ($japp->isAdmin()) {
             $t3app = T3::getApp();
             $t3app->addAssets();
         } else {
             $params = $japp->getTemplate(true)->params;
             if (defined('T3_THEMER') && $params->get('themermode', 1)) {
                 T3::import('admin/theme');
                 T3AdminTheme::addAssets();
             }
             //check for ajax action and render t3ajax type to before head type
             if (class_exists('T3Ajax')) {
                 T3Ajax::render();
             }
         }
     }
 }
コード例 #2
0
ファイル: t3.php プロジェクト: lazarch/t3
 function onBeforeRender()
 {
     if (defined('T3_PLUGIN') && T3::detect()) {
         $japp = JFactory::getApplication();
         JDispatcher::getInstance()->trigger('onT3BeforeRender');
         if ($japp->isAdmin()) {
             $t3app = T3::getApp();
             $t3app->addAssets();
         } else {
             $params = $japp->getTemplate(true)->params;
             if (defined('T3_THEMER') && $params->get('themermode', 1)) {
                 T3::import('admin/theme');
                 T3AdminTheme::addAssets();
             }
             //check for ajax action and render t3ajax type to before head type
             if (class_exists('T3Ajax')) {
                 T3Ajax::render();
             }
             // allow load module/modules in component using jdoc:include
             $doc = JFactory::getDocument();
             $main_content = $doc->getBuffer('component');
             if ($main_content) {
                 // parse jdoc
                 if (preg_match_all('#<jdoc:include\\ type="([^"]+)"(.*)\\/>#iU', $main_content, $matches)) {
                     $replace = array();
                     $with = array();
                     // Step through the jdocs in reverse order.
                     for ($i = 0; $i < count($matches[0]); $i++) {
                         $type = $matches[1][$i];
                         $attribs = empty($matches[2][$i]) ? array() : JUtility::parseAttributes($matches[2][$i]);
                         $name = isset($attribs['name']) ? $attribs['name'] : null;
                         $replace[] = $matches[0][$i];
                         $with[] = $doc->getBuffer($type, $name, $attribs);
                     }
                     $main_content = str_replace($replace, $with, $main_content);
                     // update buffer
                     $doc->setBuffer($main_content, 'component');
                 }
             }
         }
     }
 }