diff options
author | Imbasaur <yarrusg@gmail.com> | 2016-04-13 17:05:59 +0200 |
---|---|---|
committer | Imbasaur <yarrusg@gmail.com> | 2016-04-13 17:05:59 +0200 |
commit | 99f275e5bb033cca33eee87b0e914645730f13d1 (patch) | |
tree | ad845419d56304f2bf014744f0878186f7155a3c /app/Core/Template.php | |
parent | 13d5bd8e48bd6c0109d1272da58a8879bf9a6737 (diff) | |
parent | cd5bf9d4d214ec9282b706c26bb27cabf150ee63 (diff) |
Merge pull request #1 from fguillot/master
Diffstat (limited to 'app/Core/Template.php')
-rw-r--r-- | app/Core/Template.php | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/app/Core/Template.php b/app/Core/Template.php index f85c7f28..1874d44a 100644 --- a/app/Core/Template.php +++ b/app/Core/Template.php @@ -7,6 +7,21 @@ namespace Kanboard\Core; * * @package core * @author Frederic Guillot + * + * @property \Kanboard\Helper\AppHelper $app + * @property \Kanboard\Helper\AssetHelper $asset + * @property \Kanboard\Helper\DateHelper $dt + * @property \Kanboard\Helper\FileHelper $file + * @property \Kanboard\Helper\FormHelper $form + * @property \Kanboard\Helper\HookHelper $hook + * @property \Kanboard\Helper\ModelHelper $model + * @property \Kanboard\Helper\SubtaskHelper $subtask + * @property \Kanboard\Helper\TaskHelper $task + * @property \Kanboard\Helper\TextHelper $text + * @property \Kanboard\Helper\UrlHelper $url + * @property \Kanboard\Helper\UserHelper $user + * @property \Kanboard\Helper\LayoutHelper $layout + * @property \Kanboard\Helper\ProjectHeaderHelper $projectHeader */ class Template { @@ -84,25 +99,26 @@ class Template /** * Find template filename * - * Core template name: 'task/show' - * Plugin template name: 'myplugin:task/show' + * Core template: 'task/show' or 'kanboard:task/show' + * Plugin template: 'myplugin:task/show' * * @access public - * @param string $template_name + * @param string $template * @return string */ - public function getTemplateFile($template_name) + public function getTemplateFile($template) { - $template_name = isset($this->overrides[$template_name]) ? $this->overrides[$template_name] : $template_name; + $plugin = ''; + $template = isset($this->overrides[$template]) ? $this->overrides[$template] : $template; + + if (strpos($template, ':') !== false) { + list($plugin, $template) = explode(':', $template); + } - if (strpos($template_name, ':') !== false) { - list($plugin, $template) = explode(':', $template_name); - $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'plugins'; - $path .= DIRECTORY_SEPARATOR.ucfirst($plugin).DIRECTORY_SEPARATOR.'Template'.DIRECTORY_SEPARATOR.$template.'.php'; - } else { - $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Template'.DIRECTORY_SEPARATOR.$template_name.'.php'; + if ($plugin !== 'kanboard' && $plugin !== '') { + return implode(DIRECTORY_SEPARATOR, array(__DIR__, '..', '..', 'plugins', ucfirst($plugin), 'Template', $template.'.php')); } - return $path; + return implode(DIRECTORY_SEPARATOR, array(__DIR__, '..', 'Template', $template.'.php')); } } |