本文整理汇总了PHP中TemplatesHelper::isTemplateDefault方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplatesHelper::isTemplateDefault方法的具体用法?PHP TemplatesHelper::isTemplateDefault怎么用?PHP TemplatesHelper::isTemplateDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TemplatesHelper
的用法示例。
在下文中一共展示了TemplatesHelper::isTemplateDefault方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listing
//.........这里部分代码省略.........
$obj = new stdClass();
$obj->path = $plugins_folder . DS . $file;
$obj->filename = $file;
$obj->folder = $plugins_folder;
$obj->client_id = $client_id;
$obj->type = 'plugin';
$obj->view = '';
$obj->type_name = 'hikashoppayment';
$obj->file = substr($file, 0, strlen($file) - 4);
$clientTemplates[] = $obj;
}
}
}
}
if (!empty($clientTemplates)) {
$client = JApplicationHelper::getClientInfo($client_id);
$tBaseDir = $client->path . DS . 'templates';
if (version_compare(JVERSION, '1.6', '<')) {
$joomlaTemplates = TemplatesHelper::parseXMLTemplateFiles($tBaseDir);
} else {
$query = 'SELECT * FROM ' . hikashop_table('extensions', false) . ' WHERE type=\'template\' AND client_id=' . (int) $client_id;
$db = JFactory::getDBO();
$db->setQuery($query);
$joomlaTemplates = $db->loadObjectList();
foreach ($joomlaTemplates as $k => $v) {
$joomlaTemplates[$k]->assigned = $joomlaTemplates[$k]->protected;
$joomlaTemplates[$k]->published = $joomlaTemplates[$k]->enabled;
$joomlaTemplates[$k]->directory = $joomlaTemplates[$k]->element;
}
}
for ($i = 0; $i < count($joomlaTemplates); $i++) {
if (version_compare(JVERSION, '1.6', '<')) {
$joomlaTemplates[$i]->assigned = TemplatesHelper::isTemplateAssigned($joomlaTemplates[$i]->directory);
$joomlaTemplates[$i]->published = TemplatesHelper::isTemplateDefault($joomlaTemplates[$i]->directory, $client->id);
}
if ($joomlaTemplates[$i]->published || $joomlaTemplates[$i]->assigned) {
if (!empty($pageInfo->filter->template) && $joomlaTemplates[$i]->directory != $pageInfo->filter->template) {
continue;
}
$templateValues[$joomlaTemplates[$i]->directory] = $joomlaTemplates[$i]->directory;
$templateFolder = $tBaseDir . DS . $joomlaTemplates[$i]->directory . DS;
foreach ($clientTemplates as $template) {
$templatePerJoomlaTemplate = clone $template;
$templatePerJoomlaTemplate->template = $joomlaTemplates[$i]->directory;
$templatePerJoomlaTemplate->component = $component_name;
$templatePerJoomlaTemplate->override = $templateFolder . 'html' . DS . $template->type_name . DS;
if ($template->type == 'component') {
$templatePerJoomlaTemplate->override .= $template->view . DS;
}
$templatePerJoomlaTemplate->override .= $template->filename;
$templatePerJoomlaTemplate->overriden = false;
if (file_exists($templatePerJoomlaTemplate->override)) {
$templatePerJoomlaTemplate->overriden = true;
}
$templatePerJoomlaTemplate->id = $templatePerJoomlaTemplate->client_id . '|' . $templatePerJoomlaTemplate->template . '|' . $templatePerJoomlaTemplate->type . '|' . $templatePerJoomlaTemplate->type_name . '|' . $templatePerJoomlaTemplate->view . '|' . $templatePerJoomlaTemplate->filename;
$key = $templatePerJoomlaTemplate->client_id . '|' . $templatePerJoomlaTemplate->template . '|' . $templatePerJoomlaTemplate->type_name . '|' . $templatePerJoomlaTemplate->view . '|' . $templatePerJoomlaTemplate->filename;
if (!empty($pageInfo->filter->viewType) && $templatePerJoomlaTemplate->view != $pageInfo->filter->viewType) {
continue;
}
$templates[$key] = $templatePerJoomlaTemplate;
}
if (JFolder::exists($templateFolder . 'html' . DS . $component . DS)) {
$folders = JFolder::folders($templateFolder . 'html' . DS . $component . DS);
if (!empty($folders)) {
foreach ($folders as $folder) {
$files = JFolder::files($templateFolder . 'html' . DS . $component . DS . $folder);
示例2: editTemplate
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);
}