本文整理汇总了PHP中KunenaFactory::getAdminTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaFactory::getAdminTemplate方法的具体用法?PHP KunenaFactory::getAdminTemplate怎么用?PHP KunenaFactory::getAdminTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaFactory
的用法示例。
在下文中一共展示了KunenaFactory::getAdminTemplate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($config = array())
{
$name = isset($config['name']) ? $config['name'] : $this->getName();
$this->document = JFactory::getDocument();
$this->document->setBase('');
$this->profiler = KunenaProfiler::instance('Kunena');
$this->app = JFactory::getApplication();
$this->me = KunenaUserHelper::getMyself();
$this->config = KunenaFactory::getConfig();
$this->ktemplate = KunenaFactory::getTemplate();
// Set the default template search path
if ($this->app->isSite() && !isset($config['template_path'])) {
$config['template_path'] = $this->ktemplate->getTemplatePaths("html/{$name}", true);
}
if ($this->app->isAdmin()) {
$templateAdmin = KunenaFactory::getAdminTemplate();
$templateAdmin->initialize();
$config['template_path'] = $templateAdmin->getTemplatePaths($name);
}
parent::__construct($config);
if ($this->app->isSite()) {
// Add another template file lookup path specific to the current template
$fallback = JPATH_THEMES . "/{$this->app->getTemplate()}/html/com_kunena/{$this->ktemplate->name}/{$this->getName()}";
$this->addTemplatePath($fallback);
}
// Use our own browser side cache settings.
JResponse::allowCache(false);
JResponse::setHeader('Expires', 'Mon, 1 Jan 2001 00:00:00 GMT', true);
JResponse::setHeader('Last-Modified', gmdate("D, d M Y H:i:s") . ' GMT', true);
JResponse::setHeader('Cache-Control', 'no-store, must-revalidate, post-check=0, pre-check=0', true);
}
示例2: factory
/**
* Returns layout class.
*
* <code>
* // Output pagination/pages layout with current cart instance.
* echo KunenaLayout::factory('Pagination/Pages')->set('pagination', $this->pagination);
* </code>
*
* @param mixed $paths String or array of strings.
* @param string $base Base path.
* @return KunenaLayout
*/
public static function factory($paths, $base = 'pages')
{
$paths = (array) $paths;
$app = JFactory::getApplication();
// Add all paths for the template overrides.
if ($app->isAdmin()) {
$template = KunenaFactory::getAdminTemplate();
} else {
$template = KunenaFactory::getTemplate();
}
$templatePaths = array();
foreach ($paths as $path) {
if (!$path) {
continue;
}
$path = (string) preg_replace('|\\\\|', '/', strtolower($path));
$lookup = $template->getTemplatePaths("{$base}/{$path}", true);
foreach ($lookup as $loc) {
array_unshift($templatePaths, $loc);
}
}
// Go through all the matching layouts.
$path = 'Undefined';
foreach ($paths as $path) {
if (!$path) {
continue;
}
// Attempt to load layout class if it doesn't exist.
$class = 'KunenaPage' . (string) preg_replace('/[^A-Z0-9_]/i', '', $path);
$fpath = (string) preg_replace('|\\\\|', '/', strtolower($path));
if (!class_exists($class)) {
$filename = JPATH_BASE . "/components/com_kunena/page/{$fpath}.php";
if (!is_file($filename)) {
continue;
}
require_once $filename;
}
// Create layout object.
return new $class($fpath, $templatePaths);
}
// Create default layout object.
return new KunenaLayoutPage($path, $templatePaths);
}
示例3: factory
/**
* Returns layout class.
*
* <code>
* // Output pagination/pages layout with current cart instance.
* echo KunenaLayout::factory('pagination/pages')->set('pagination', $this->pagination);
* </code>
*
* @param mixed $paths String or array of strings.
* @return KunenaLayout
*/
public static function factory($paths)
{
if (!is_array($paths)) {
$paths = (array) $paths;
}
$app = JFactory::getApplication();
// Add all paths for the template overrides.
$templatePaths = new SplPriorityQueue();
if ($app->isAdmin()) {
$template = KunenaFactory::getAdminTemplate();
$base = 'layouts';
} else {
$template = KunenaFactory::getTemplate();
$base = 'html/layouts';
}
foreach ($paths as $path) {
if (!$path) {
continue;
}
$lookup = $template->getTemplatePaths("{$base}/{$path}", true);
foreach ($lookup as $loc) {
$templatePaths->insert($loc, 1);
}
}
// Go through all the matching layouts.
foreach ($paths as $path) {
if (!$path) {
continue;
}
// Attempt to load layout class if it doesn't exist.
$class = 'KunenaLayout' . (string) preg_replace('/[^A-Z0-9_]/i', '', $path);
if (!class_exists($class)) {
$filename = JPATH_BASE . "/components/com_kunena/layouts/{$path}/layout.php";
if (!is_file($filename)) {
continue;
}
require_once $filename;
}
// Create layout object.
return new $class($templatePaths);
}
// Create default layout object.
return new KunenaLayout($templatePaths);
}