public function __construct() { parent::__construct(); // init vars $this->assets = array(); $this->options = array('base_path' => $this['system']->path, 'base_url' => rtrim($this['path']->url('site:'), '/')); }
function __construct() { parent::__construct(); // init vars $this->_document = JFactory::getDocument(); $this->_renderer = $this->_document->loadRenderer('module'); }
public function __construct() { parent::__construct(); // load data $this->file = $this['system']->cache_path . sprintf('/%s.php', basename($this['path']->path('template:'))); $this->data = $this['data']->create(file_exists($this->file) ? file_get_contents($this->file) : null); }
public function __construct() { parent::__construct(); // init vars $this->path = rtrim(str_replace(DIRECTORY_SEPARATOR, '/', ABSPATH), '/'); $this->url = rtrim(site_url(), '/'); $this->cache_path = rtrim(str_replace(DIRECTORY_SEPARATOR, '/', get_template_directory()), '/') . '/cache'; $this->cache_time = 86400; $this->menu_item_options = $this['option']->get('menu-items', array()); // get config if (defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE) { $settings = $this['option']->get('warp_theme_options', array()); } else { $settings = ($file = $this['path']->path('template:config')) ? file_get_contents($file) : array(); } // set config or load defaults if (count($settings)) { $this->config = $this['data']->create($settings); } else { $this->config = $this['data']->create(file_get_contents($this['path']->path('template:config.default'))); } // set cache directory if (!file_exists($this->cache_path)) { mkdir($this->cache_path, 0755); } }
public function __construct() { parent::__construct(); // init vars $this->assets = array(); $this->options = array('base_path' => $this['system']->path, 'base_url' => $this['system']->url); }
function __construct() { parent::__construct(); // load legacy helpers first (eg. xml helper) if (version_compare(PHP_VERSION, '5.0', '<')) { $this->warp->path->register($this->warp->path->path('warp:libraries/legacy/helpers'), 'helpers'); } }
public function __construct() { parent::__construct(); // check available library support foreach ($this->transports as $classname) { $transport = new $classname(); if ($transport->available()) { $this->transport = $transport; break; } } }
public function __construct() { parent::__construct(); // get application and config from system $app = $this['system']->application; $config = $this['system']->config; $data = $config->getArrayCopy(); // set profiles if ($config->has('profile_data')) { $itemid = $app->input->getInt('Itemid', 0); $profiles = array('default'); // add default profile if ($default = $config->get('profile_default')) { $profiles[] = $default; } // add dynamic profile ? if ($config->get('profile_dynamic')) { if ($var = $app->input->get($this->_profile)) { $app->setUserState('_current_profile', $var); } if ($dynamic = $app->getUserState('_current_profile')) { $profiles[] = $dynamic; } } // add menu item profile ? if ($config->has('profile_map') && isset($config['profile_map'][$itemid])) { $profiles[] = $config['profile_map'][$itemid]; } // merge profile data foreach (array_unique($profiles) as $profile) { if (isset($config['profile_data'][$profile])) { $data = array_merge($data, $config['profile_data'][$profile]); } } } // set data $this->_data = $this['data']->create($data); }
public function __construct() { parent::__construct(); // get config from system $config = $this['system']->config; $data = $config->getArrayCopy(); // set profiles if ($config->has('profile_data')) { $profiles = array('default'); // add default profile if ($default = $config->get('profile_default')) { $profiles[] = $default; } // add dynamic profile ? if ($config->get('profile_dynamic')) { if (!session_id()) { session_start(); } if (isset($_GET[$this->_profile])) { $_SESSION['_current_preset'] = preg_replace('/[^A-Z0-9-]/i', '', $_GET[$this->_profile]); } if (isset($_SESSION['_current_preset'])) { $profiles[] = $_SESSION['_current_preset']; } } // get wordpress query $query = $this['system']->getQuery(); // add query profile ? if ($config->has('profile_map')) { foreach (array_reverse($query) as $q) { if (isset($config['profile_map'][$q])) { $profiles[] = $config['profile_map'][$q]; break; } } } // merge profile data foreach (array_unique($profiles) as $profile) { if (isset($config['profile_data'][$profile])) { $data = array_merge($data, $config['profile_data'][$profile]); } } } // set data $this->_data = $this['data']->create($data); }
public function __construct() { parent::__construct(); // init vars $this->application = JFactory::getApplication(); $this->document = JFactory::getDocument(); $this->language = JFactory::getLanguage(); $this->path = JPATH_ROOT; $this->url = rtrim(JURI::root(false), '/'); $this->cache_path = $this->path . '/cache/template'; $this->cache_time = max(JFactory::getConfig()->getValue('config.cachetime') * 60, 86400); // set config or load defaults $file = $this['path']->path('template:config'); $this->config = $this['data']->create(file_get_contents($file ? $file : $this['path']->path('template:config.default'))); // set cache directory if (!file_exists($this->cache_path)) { JFolder::create($this->cache_path); } }
function __construct() { parent::__construct(); // init helpers $path =& $this->getHelper('path'); $config =& $this->getHelper('config'); // init vars $jconfig =& JFactory::getConfig(); $this->application =& JFactory::getApplication(); $this->document =& JFactory::getDocument(); $this->language =& JFactory::getLanguage(); $this->path = JPATH_ROOT; $this->url = JURI::root(true); $this->cache_path = $this->path . '/cache/template'; $this->cache_time = max($jconfig->getValue('config.cachetime') * 60, 86400); // set cache directory if (!file_exists($this->cache_path)) { JFolder::create($this->cache_path); } // set paths $path->register($this->path . '/administrator', 'admin'); $path->register($this->path, 'site'); $path->register($this->path . '/cache/template', 'cache'); $path->register($path->path('warp:systems/joomla.1.5/menus'), 'menu'); // set translations $this->language->load('tpl_warp', $path->path('warp:systems/joomla.1.5'), null, true); if ($this->application->isSite()) { // set config $config->set('language', $this->document->language); $config->set('direction', $this->document->direction); $config->set('actual_date', JHTML::_('date', 'now', JText::_('DATE_FORMAT_LC'))); // get template params if ($file = $path->path('template:params.ini')) { $params = new JParameter(file_get_contents($file)); $config->loadArray($params->toArray()); } // get page class suffix params $params = $this->application->getParams(); $config->parseString($params->get('pageclass_sfx')); // dynamic presets ? if ($config->get('allow_dynamic_preset')) { if ($var = JRequest::getVar($this->warp->preset_var, null, 'default', 'alnum')) { $this->application->setUserState('_current_preset', $var); } $config->set('_current_preset', $this->application->getUserState('_current_preset')); } } if ($this->application->isAdmin()) { // get helper $xml =& $this->getHelper('xml'); $http =& $this->getHelper('http'); // get xml's $tmpl_xml =& $xml->load($path->path('template:templateDetails.xml'), 'xml'); $warp_xml =& $xml->load($path->path('warp:warp.xml'), 'xml'); // update check if ($url = $warp_xml->document->getElement('updateUrl')) { // get template info $template = $tmpl_xml->document->getElement('name'); $version = $tmpl_xml->document->getElement('version'); $url = sprintf('%s?application=%s&version=%s&format=raw', $url->data(), $template->data() . '_j15', $version->data()); // check cache $file = $this->cache_path . sprintf('/%s.php', $template->data()); $cache = file_exists($file) ? @unserialize(file_get_contents($file)) : null; if (!is_array($cache) || !isset($cache['check']) || !isset($cache['data'])) { $cache = array('check' => null, 'data' => null); } // only check once a day if ($cache['check'] != date('Y-m-d') . ' ' . $version->data()) { if ($request = $http->get($url)) { $cache = array('check' => date('Y-m-d') . ' ' . $version->data(), 'data' => $request['body']); @file_put_contents($file, serialize($cache)); } } // decode response and set message if (($response = json_decode($cache['data'])) && isset($response->status, $response->message) && $response->status == 'update-available') { $this->application->enqueueMessage($response->message, 'notice'); } } } }
public function __construct() { parent::__construct(); // load menu class require_once $this['path']->path('warp:classes/menu.php'); }
public function __construct() { parent::__construct(); // load class require_once($this['path']->path('classes:data.php')); }
public function __construct() { parent::__construct(); // set options $this->options = get_option('warp_widget_options', array()); }
function __construct() { parent::__construct(); // init helpers $path = $this->getHelper('path'); $event = $this->getHelper('event'); // init vars $this->application = JFactory::getApplication(); $this->document = JFactory::getDocument(); $this->language = JFactory::getLanguage(); $this->path = JPATH_ROOT; $this->url = JURI::root(true); $this->cache_path = $this->path . '/cache/template'; $this->cache_time = max(JFactory::getConfig()->getValue('config.cachetime') * 60, 86400); // set cache directory if (!file_exists($this->cache_path)) { JFolder::create($this->cache_path); } // set paths $path->register($this->path . '/administrator', 'admin'); $path->register($this->path, 'site'); $path->register($this->path . '/cache/template', 'cache'); $path->register($path->path('warp:systems/joomla/menus'), 'menu'); // set translations $this->language->load('tpl_warp', $path->path('warp:systems/joomla'), null, true); // set event $event->bind('render.template', array($this, 'init')); // is admin ? if ($this->application->isAdmin()) { // get helper $xml = $this->getHelper('xml'); $http = $this->getHelper('http'); // get xml's $tmpl_xml = $xml->load($path->path('template:templateDetails.xml'), 'xml'); $warp_xml = $xml->load($path->path('warp:warp.xml'), 'xml'); // update check if ($url = $warp_xml->document->getElement('updateUrl')) { // get template info $template = $tmpl_xml->document->getElement('name'); $version = $tmpl_xml->document->getElement('version'); $url = sprintf('%s?application=%s&version=%s&format=raw', $url->data(), $template->data() . '_j25', $version->data()); // check cache $file = $this->cache_path . sprintf('/%s.php', $template->data()); $cache = file_exists($file) ? @unserialize(file_get_contents($file)) : null; if (!is_array($cache) || !isset($cache['check']) || !isset($cache['data'])) { $cache = array('check' => null, 'data' => null); } // only check once a day if ($cache['check'] != date('Y-m-d') . ' ' . $version->data()) { if ($request = $http->get($url)) { $cache = array('check' => date('Y-m-d') . ' ' . $version->data(), 'data' => $request['body']); @file_put_contents($file, serialize($cache)); } } // decode response and set message if (($response = json_decode($cache['data'])) && isset($response->status, $response->message) && $response->status == 'update-available') { $this->application->enqueueMessage($response->message, 'notice'); } } } }
public function __construct() { parent::__construct(); // set prefix $this->prefix = basename($this['path']->path('template:')); }