Esempio n. 1
0
 function getItem()
 {
     global $mainframe;
     jimport('joomla.filesystem.path');
     if (!$this->template) {
         return JError::raiseWarning(500, 'Template not specified');
     }
     $tBaseDir = JPath::clean(JPATH_RSGALLERY2_SITE . '/templates');
     if (!is_dir($tBaseDir . '/' . $this->template)) {
         return JError::raiseWarning(500, 'Template not found');
     }
     $lang =& JFactory::getLanguage();
     $lang->load('tpl_' . $this->template, JPATH_RSGALLERY2_SITE);
     $ini = JPATH_RSGALLERY2_SITE . '/templates/' . $this->template . '/params.ini';
     $xml = JPATH_RSGALLERY2_SITE . '/templates/' . $this->template . '/templateDetails.xml';
     $row = TemplatesHelper::parseXMLTemplateFile($tBaseDir, $this->template);
     jimport('joomla.filesystem.file');
     // Read the ini file
     if (JFile::exists($ini)) {
         $content = JFile::read($ini);
     } else {
         $content = null;
     }
     $params = new JParameter($content, $xml, 'template');
     // Set FTP credentials, if given
     jimport('joomla.client.helper');
     $ftp =& JClientHelper::setCredentialsFromRequest('ftp');
     $item = new stdClass();
     $item->params = $params;
     $item->row = $row;
     $item->type = $this->_type;
     $item->template = $this->template;
     return $item;
 }
 /**
  * Override parent getItems to add extra XML metadata.
  *
  * @return  array
  *
  * @since   1.6
  */
 public function getItems()
 {
     $items = parent::getItems();
     foreach ($items as &$item) {
         $client = JApplicationHelper::getClientInfo($item->client_id);
         $item->xmldata = TemplatesHelper::parseXMLTemplateFile($client->path, $item->element);
     }
     return $items;
 }
Esempio n. 3
0
 function parseXMLTemplateFiles($templateBaseDir)
 {
     // Read the template folder to find templates
     jimport('joomla.filesystem.folder');
     $templateDirs = JFolder::folders($templateBaseDir);
     $rows = array();
     // Check that the directory contains an xml file
     foreach ($templateDirs as $templateDir) {
         if (!($data = TemplatesHelper::parseXMLTemplateFile($templateBaseDir, $templateDir))) {
             continue;
         } else {
             $rows[] = $data;
         }
     }
     return $rows;
 }
/**
 * @package     Joomla.Administrator
 * @subpackage  com_templates
 *
 * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
?>

<div class="pull-left">
	<?php 
echo JHtml::_('templates.thumb', $this->template->element, $this->template->client_id);
?>
</div>
<h2><?php 
echo ucfirst($this->template->element);
?>
</h2>
<?php 
$client = JApplicationHelper::getClientInfo($this->template->client_id);
?>
<p><?php 
$this->template->xmldata = TemplatesHelper::parseXMLTemplateFile($client->path, $this->template->element);
?>
</p>
<p><?php 
echo JText::_($this->template->xmldata->description);
?>
</p>
Esempio n. 5
0
 public static function editTemplate()
 {
     jimport('joomla.filesystem.path');
     // Initialize some variables
     $db =& JFactory::getDBO();
     $cid = JRequest::getVar('cid', array(), 'method', 'array');
     $cid = array(JFilterInput::clean(@$cid[0], 'cmd'));
     $template = $cid[0];
     $option = JRequest::getCmd('option');
     $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int'));
     if (!$cid[0]) {
         return JError::raiseWarning(500, JText::_('Template not specified'));
     }
     $tBaseDir = JPath::clean($client->path . DS . 'templates');
     if (!is_dir($tBaseDir . DS . $template)) {
         return JError::raiseWarning(500, JText::_('Template not found'));
     }
     $lang =& JFactory::getLanguage();
     $lang->load('tpl_' . $template, JPATH_ADMINISTRATOR);
     $ini = $client->path . DS . 'templates' . DS . $template . DS . 'params.ini';
     $xml = $client->path . DS . 'templates' . DS . $template . DS . 'templateDetails.xml';
     $row = TemplatesHelper::parseXMLTemplateFile($tBaseDir, $template);
     jimport('joomla.filesystem.file');
     // Read the ini file
     if (JFile::exists($ini)) {
         $content = JFile::read($ini);
     } else {
         $content = null;
     }
     $params = new JParameter($content, $xml, 'template');
     $default = TemplatesHelper::isTemplateDefault($row->directory, $client->id);
     if (TemplatesHelper::isTemplateDefault($row->directory, $client->id)) {
         $row->default = 1;
     } else {
         $row->default = 0;
     }
     // Set FTP credentials, if given
     jimport('joomla.client.helper');
     $ftp =& JClientHelper::setCredentialsFromRequest('ftp');
     require_once JPATH_COMPONENT . DS . 'admin.templates.html.php';
     TemplatesView::editTemplate($row, array(), $params, $option, $client, $ftp, $template);
 }
Esempio n. 6
0
</legend>

					<div class="input-wrap">
						<?php 
echo Html::templates('thumb', $this->template->element, $this->template->client_id);
?>

						<h2><?php 
echo ucfirst($this->template->element);
?>
</h2>
						<?php 
//$client = JApplicationHelper::getClientInfo($this->template->client_id);
?>
						<p><?php 
$this->template->xmldata = TemplatesHelper::parseXMLTemplateFile($this->template->protected ? PATH_CORE : PATH_APP, $this->template->element);
?>
</p>
						<p><?php 
echo Lang::txt($this->template->xmldata->description);
?>
</p>
					</div>
				</fieldset>
				<fieldset class="adminform" id="template-manager-files">
					<legend><?php 
echo Lang::txt('COM_TEMPLATES_TEMPLATE_MASTER_FILES');
?>
</legend>

					<ul class="item-list layout">