コード例 #1
0
 public function renderGlobalHeaders()
 {
     if (!self::$globalHeadersRendered) {
         RokCommon_Header::addScript(RokCommon_Composite::get($this->context_base . '.assets.js')->getUrl('mootools-mobile.js'));
         RokCommon_Header::addScript(RokCommon_Composite::get($this->context_base . '.assets.js')->getUrl('rokmediaqueries.js'));
         RokCommon_Header::addScript(RokCommon_Composite::get($this->context_base . '.assets.js')->getUrl('roksprocket.js'));
         $app = JFactory::getApplication();
         $menus = $app->getMenu('site');
         $active = $menus->getActive();
         if ($active === null) {
             $active = $menus->getDefault();
         }
         $ns = array();
         $ns[] = "if (typeof RokSprocket == 'undefined') RokSprocket = {};";
         $ns[] = "Object.merge(RokSprocket, {";
         $ns[] = "\tSiteURL: '" . str_replace('&', '&', JRoute::_(JURI::root(true), true)) . "',";
         $ns[] = "\tCurrentURL: '" . str_replace('&', '&', JRoute::_(JURI::current(true), true)) . "',";
         $ns[] = "\tAjaxURL: '" . str_replace('&', '&', JRoute::_(JURI::root(true) . '/index.php?option=com_roksprocket&task=ajax&format=raw&ItemId=' . $active->id)) . "'";
         $ns[] = "});";
         RokCommon_Header::addInlineScript(implode("\n", $ns) . "\n");
         self::$globalHeadersRendered = true;
     }
 }
コード例 #2
0
try {
    if (defined('ROKSPROCKET')) {
        $lang = JFactory::getLanguage();
        $lang->load('com_roksprocket', JPATH_BASE, $lang->getDefault(), false, false);
        $lang->load('com_roksprocket', JPATH_BASE, null, false, false);
        $lang->load('com_roksprocket', JPATH_SITE . '/components/com_roksprocket', $lang->getDefault(), false, false);
        $lang->load('com_roksprocket', JPATH_SITE . '/components/com_roksprocket', null, false, false);
        RokCommon_ClassLoader::addPath(dirname(__FILE__) . '/lib');
        $container = RokCommon_Service::getContainer();
        foreach ($container['roksprocket.layouts'] as $type => $layoutinfo) {
            foreach ($layoutinfo->paths as $layoutpath) {
                if (is_dir($layoutpath . '/language')) {
                    $lang->load('roksprocket_layout_' . $type, $layoutpath, $lang->getDefault(), true, false);
                    $lang->load('roksprocket_layout_' . $type, $layoutpath, null, true, false);
                }
            }
        }
        /** @var $logger logger */
        $logger = $container->logger;
        $module_parameters = RokCommon_Registry_Converter::convert($params);
        $module_parameters->set('module_id', $module->id);
        $roksprocket = new ModRokSprocket($module_parameters);
        $items = $roksprocket->getData();
        echo $content_items = $roksprocket->render($items);
        /** @var $header RokCommon_Header_Joomla */
        $header = $container->getService('header');
        $header->populate();
    }
} catch (Exception $e) {
    JError::raiseWarning(100, $e->getMessage());
}