Beispiel #1
0
    function gantry_setup(){
        gantry_import('core.gantry');
        gantry_import('core.utilities.gantrycache');

        global $gantry;

        $app = JFactory::getApplication();
        $template = $app->getTemplate();
        $template_params = null;

        if (is_readable( JPATH_SITE.DS."templates".DS.$template.DS.'params.ini' ) )
		{
			$content = file_get_contents(JPATH_SITE.DS."templates".DS.$template.DS.'params.ini');
			$template_params = new JParameter($content);
		}
        $conf = & JFactory :: getConfig();

        if (!empty($template_params) && ($template_params->get("cache-enabled", 0) == 1)) {
            $cache = GantryCache::getInstance($app->isAdmin());
            $cache->setLifetime($template_params->get('cache-time', $conf->getValue('config.cachetime') * 60));
            $cache->addWatchFile(JPATH_SITE.'/templates/'.$template.'/params.ini');
            $cache->addWatchFile(JPATH_SITE.'/templates/'.$template.'/templateDetails.xml');
            $gantry = $cache->call('Gantry-'.$template, array('Gantry','getInstance'));
        }
        else {
            $gantry = Gantry::getInstance();
        }
         $gantry->init();
    }
Beispiel #2
0
 /**
  *
  */
 function gantry_setup()
 {
     gantry_import('core.gantry');
     gantry_import('core.utilities.gantrycache');
     jimport('joomla.html.parameter');
     /** @var $gantry Gantry */
     global $gantry;
     $template = gantry_getTemplate();
     $template_name = $template->template;
     if ($template->params->get('master') != 'true') {
         $template->params = gantry_getTemplateParams($template->params->get('master'));
     }
     $conf = JFactory::getConfig();
     $app = JFactory::getApplication();
     if ($template->params->get("cache.enabled", 1) == 1) {
         $cache = GantryCache::getCache(GantryCache::GROUP_NAME);
         $cache->addWatchFile(JPATH_SITE . '/templates/' . $template_name . '/templateDetails.xml');
         $cache->addWatchFile(JPATH_SITE . '/templates/' . $template_name . '/template-options.xml');
         $gantry = $cache->call('Gantry-' . $template_name, array('Gantry', 'getInstance'), array($template_name));
     } else {
         $gantry = Gantry::getInstance($template_name);
     }
     $gantry->init();
 }
Beispiel #3
0
 function gantry_setup()
 {
     gantry_import('core.gantry');
     gantry_import('core.utilities.gantrycache');
     jimport('joomla.html.parameter');
     global $gantry;
     $template = gantry_getTemplate();
     $template_name = $template->template;
     if ($template->params->get('master') != 'true') {
         $template->params = gantry_getTemplateParams($template->params->get('master'));
     }
     $conf =& JFactory::getConfig();
     if ($template->params->get("cache-enabled", 0) == 1) {
         $cache = GantryCache::getInstance($app->isAdmin());
         $cache->setLifetime($template->params->get('cache-time', $conf->getValue('config.cachetime') * 60));
         $cache->addWatchFile(JPATH_SITE . '/templates/' . $template_name . '/templateDetails.xml');
         $cache->addWatchFile(JPATH_SITE . '/templates/' . $template_name . '/template-options.xml');
         $gantry = $cache->call('Gantry-' . $template_name, array('Gantry', 'getInstance'), array($template_name));
     } else {
         $gantry = Gantry::getInstance($template_name);
     }
     $gantry->init();
 }
Beispiel #4
0
function gantry_construct()
{
    global $gantry, $gantry_path, $wp_query, $current_blog;
    $gantry_templatepath = get_template_directory() . '/templateDetails.xml';
    if (!file_exists($gantry_templatepath)) {
        define('NONGANTRY_TEMPLATE', 'NONGANTRY_TEMPLATE');
        return;
    }
    if (!defined('GANTRY_VERSION')) {
        /**
         * @name GANTRY_VERSION
         */
        define('GANTRY_VERSION', '1.26');
        if (!defined('DS')) {
            define('DS', DIRECTORY_SEPARATOR);
        }
        // Turn on sessions for Wordpress
        if (!defined('GANTRY_SESSIONS_ENABLED')) {
            if (!session_id()) {
                define('GANTRY_SESSIONS_ENABLED', true);
                session_start();
            }
        }
        $options = get_option(get_template() . "-template-options");
        $cache_enabled = $options['cache']['enabled'];
        $cache_lifetime = $options['cache']['time'];
        load_plugin_textdomain('gantry', false, basename($gantry_path) . '/languages');
        // Get the gantry instance
        gantry_import('core.gantry');
        if ($cache_enabled) {
            gantry_import('core.utilities.gantrycache');
            $cache = GantryCache::getInstance();
            $cache->setLifetime($cache_lifetime);
            $cache->init();
            $gantry = $cache->get('gantry', 'gantry', array('Gantry', 'getInstance'));
        } else {
            $gantry = Gantry::getInstance();
        }
        // Load the widget positions for the template
        $gantry->_loadWidgetPositions();
        add_filter('query_vars', array('GantryTemplateDetails', 'add_url_vars'));
    }
}