/**
  * Constructor
  *
  * @param string|null $template_name
  *
  * @return Gantry
  */
 public function __construct($template_name = null)
 {
     // load the base gantry path
     $this->gantryPath = $this->cleanPath(realpath(dirname(__FILE__) . '/' . ".."));
     // set the base class vars
     $doc = JFactory::getDocument();
     $this->document =& $doc;
     $this->browser = new GantryBrowser();
     $this->platform = new GantryPlatform();
     $this->basePath = $this->cleanPath(JPATH_ROOT);
     if ($template_name == null) {
         $this->templateName = $this->getCurrentTemplate();
     } else {
         $this->templateName = $template_name;
     }
     $this->templatePath = $this->cleanPath(JPATH_ROOT . '/' . 'templates' . '/' . $this->templateName);
     $this->layoutPath = $this->templatePath . '/' . 'html' . '/' . 'layouts.php';
     $this->custom_dir = $this->templatePath . '/' . 'custom';
     $this->custom_presets_file = $this->custom_dir . '/' . 'presets.ini';
     $this->baseUrl = JURI::root(true) . "/";
     $this->templateUrl = $this->baseUrl . 'templates' . "/" . $this->templateName;
     if (version_compare(JVERSION, '1.5', '>=') && version_compare(JVERSION, '1.6', '<')) {
         $this->gantryUrl = $this->baseUrl . 'components/com_gantry';
     } else {
         if (version_compare(JVERSION, '1.6', '>=')) {
             $this->gantryUrl = $this->baseUrl . 'libraries/gantry';
         }
     }
     $this->defaultMenuItem = $this->getDefaultMenuItem();
     $this->currentMenuItem = $this->defaultMenuItem;
     $this->loadConfig();
     // Load up the template details
     $this->_template = new GantryTemplate();
     $this->_template->init($this);
     $this->_base_params_checksum = $this->_template->getMasterParamsHash();
     // Put a base copy of the saved params in the working params
     $this->_working_params = $this->_template->getParams();
     $this->_param_names = array_keys($this->_template->getParams());
     $this->template_prefix = $this->_working_params['template_prefix']['value'];
     // set the GRID_SYSTEM define;
     if (!defined('GRID_SYSTEM')) {
         define('GRID_SYSTEM', $this->get('grid_system', $this->default_grid));
     }
     // process the presets
     if (!empty($this->presets)) {
         // check for custom presets
         $this->customPresets();
         $this->_preset_names = array_keys($this->presets);
         //$wp_keys = array_keys($this->_template->params);
         //$this->_param_names = array_diff($wp_keys, $this->_preset_names);
     }
     $this->loadLayouts();
     $this->loadFeatures();
     $this->loadAjaxModels();
     $this->loadAdminAjaxModels();
     $this->loadStyles();
     //$this->_checkAjaxTool();
     //$this->_checkLanguageFiles();
     // set up the positions object for all gird systems defined
     foreach (array_keys($this->mainbodySchemasCombos) as $grid) {
         $this->positions[$grid] = GantryPositions::getInstance($grid);
     }
     // add GRID_SYSTEM class to body
     $this->addBodyClass("col" . GRID_SYSTEM);
 }
Beispiel #2
0
 /**
  * Constructor
  * @return void
  */
 function Gantry()
 {
     //global $mainframe;
     global $gantry_path;
     // load the base gantry path
     $this->gantryPath = $gantry_path;
     $this->gantryUrl = WP_PLUGIN_URL . '/' . basename($this->gantryPath);
     // set the base class vars
     //$doc =& JFactory::getDocument();
     //$this->document =& $doc;
     $this->basePath = ABSPATH;
     $this->templateName = $this->_getCurrentTemplate();
     $this->templatePath = get_template_directory();
     $this->custom_dir = $this->templatePath . DS . 'custom';
     $this->custom_menuitemparams_dir = $this->custom_dir . DS . 'menuitemparams';
     $this->custom_presets_file = $this->custom_dir . DS . 'presets.ini';
     $urlinfo = parse_url(get_option('siteurl'));
     $this->baseUrl = $urlinfo["path"] . "/";
     $urlinfo = parse_url(get_bloginfo('template_url'));
     $this->templateUrl = $urlinfo["path"];
     $this->_loadConfig();
     // Load up the template details
     $this->_templateDetails = GantrySingleton::getInstance('GantryTemplateDetails');
     $this->_templateDetails->init($this);
     $this->templateInfo =& GantryTemplateInfo::getInstance();
     $this->_base_params_checksum = $this->_templateDetails->getParamsHash();
     gantry_import('core.gantryplatform');
     $this->platform = new GantryPlatform();
     // set base ignored query string params    dont pass these back
     $this->_ignoreQueryParams[] = 'reset-settings';
     //TODO  Add Filter
     // Put a base copy of the saved params in the working params
     $this->_working_params = $this->_templateDetails->params;
     $this->_param_names = array_keys($this->_templateDetails->params);
     $this->template_prefix = $this->_working_params['template_prefix']['value'];
     // set the GRID_SYSTEM define;
     if (!defined('GRID_SYSTEM')) {
         define('GRID_SYSTEM', $this->get('grid_system', $this->default_grid));
     }
     // process the presets
     if (!empty($this->presets)) {
         // check for custom presets
         $this->_customPresets();
         $this->_preset_names = array_keys($this->presets);
         //$wp_keys = array_keys($this->_templateDetails->params);
         //$this->_param_names = array_diff($wp_keys, $this->_preset_names);
     }
     $this->_loadLayouts();
     $this->_loadGizmos();
     $this->_loadAjaxModels();
     $this->_loadAdminAjaxModels();
     // set up the positions object for all gird systems defined
     foreach (array_keys($this->mainbodySchemasCombos) as $grid) {
         $this->positions[$grid] = GantryPositions::getInstance($grid);
     }
     $this->_override_engine = $this->_loadOverrideEngine();
     //		// add GRID_SYSTEM class to body
     $this->addBodyClass("col" . GRID_SYSTEM);
 }