@@ -16,92 +16,92 @@ |
||
| 16 | 16 | |
| 17 | 17 | trait TemplateOutput |
| 18 | 18 | { |
| 19 | - /** @var Smarty */ |
|
| 20 | - private $smarty; |
|
| 19 | + /** @var Smarty */ |
|
| 20 | + private $smarty; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * @return SiteConfiguration |
|
| 24 | - */ |
|
| 25 | - protected abstract function getSiteConfiguration(); |
|
| 22 | + /** |
|
| 23 | + * @return SiteConfiguration |
|
| 24 | + */ |
|
| 25 | + protected abstract function getSiteConfiguration(); |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Assigns a Smarty variable |
|
| 29 | - * |
|
| 30 | - * @param array|string $name the template variable name(s) |
|
| 31 | - * @param mixed $value the value to assign |
|
| 32 | - */ |
|
| 33 | - final protected function assign($name, $value) |
|
| 34 | - { |
|
| 35 | - $this->smarty->assign($name, $value); |
|
| 36 | - } |
|
| 27 | + /** |
|
| 28 | + * Assigns a Smarty variable |
|
| 29 | + * |
|
| 30 | + * @param array|string $name the template variable name(s) |
|
| 31 | + * @param mixed $value the value to assign |
|
| 32 | + */ |
|
| 33 | + final protected function assign($name, $value) |
|
| 34 | + { |
|
| 35 | + $this->smarty->assign($name, $value); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Sets up the variables used by the main Smarty base template. |
|
| 40 | - * |
|
| 41 | - * This list is getting kinda long. |
|
| 42 | - */ |
|
| 43 | - final protected function setUpSmarty() |
|
| 44 | - { |
|
| 45 | - $this->smarty = new Smarty\Smarty(); |
|
| 46 | - $this->smarty->addPluginsDir($this->getSiteConfiguration()->getFilePath() . '/smarty-plugins'); |
|
| 47 | - $this->smarty->registerPlugin('modifier', 'implode', 'implode'); |
|
| 38 | + /** |
|
| 39 | + * Sets up the variables used by the main Smarty base template. |
|
| 40 | + * |
|
| 41 | + * This list is getting kinda long. |
|
| 42 | + */ |
|
| 43 | + final protected function setUpSmarty() |
|
| 44 | + { |
|
| 45 | + $this->smarty = new Smarty\Smarty(); |
|
| 46 | + $this->smarty->addPluginsDir($this->getSiteConfiguration()->getFilePath() . '/smarty-plugins'); |
|
| 47 | + $this->smarty->registerPlugin('modifier', 'implode', 'implode'); |
|
| 48 | 48 | |
| 49 | - $this->assign('currentUser', User::getCommunity()); |
|
| 50 | - $this->assign('skin', 'auto'); |
|
| 51 | - $this->assign('currentDomain', null); |
|
| 52 | - $this->assign('loggedIn', false); |
|
| 53 | - $this->assign('baseurl', $this->getSiteConfiguration()->getBaseUrl()); |
|
| 54 | - $this->assign('resourceCacheEpoch', $this->getSiteConfiguration()->getResourceCacheEpoch()); |
|
| 49 | + $this->assign('currentUser', User::getCommunity()); |
|
| 50 | + $this->assign('skin', 'auto'); |
|
| 51 | + $this->assign('currentDomain', null); |
|
| 52 | + $this->assign('loggedIn', false); |
|
| 53 | + $this->assign('baseurl', $this->getSiteConfiguration()->getBaseUrl()); |
|
| 54 | + $this->assign('resourceCacheEpoch', $this->getSiteConfiguration()->getResourceCacheEpoch()); |
|
| 55 | 55 | |
| 56 | - $this->assign('siteNoticeText', ''); |
|
| 57 | - $this->assign('siteNoticeVersion', 0); |
|
| 58 | - $this->assign('siteNoticeState', 'd-none'); |
|
| 59 | - $this->assign('toolversion', Environment::getToolVersion()); |
|
| 56 | + $this->assign('siteNoticeText', ''); |
|
| 57 | + $this->assign('siteNoticeVersion', 0); |
|
| 58 | + $this->assign('siteNoticeState', 'd-none'); |
|
| 59 | + $this->assign('toolversion', Environment::getToolVersion()); |
|
| 60 | 60 | |
| 61 | - // default these |
|
| 62 | - $this->assign('onlineusers', array()); |
|
| 63 | - $this->assign('typeAheadBlock', ''); |
|
| 64 | - $this->assign('extraJs', array()); |
|
| 61 | + // default these |
|
| 62 | + $this->assign('onlineusers', array()); |
|
| 63 | + $this->assign('typeAheadBlock', ''); |
|
| 64 | + $this->assign('extraJs', array()); |
|
| 65 | 65 | |
| 66 | - // nav menu access control |
|
| 67 | - $this->assign('nav__canRequests', false); |
|
| 68 | - $this->assign('nav__canLogs', false); |
|
| 69 | - $this->assign('nav__canUsers', false); |
|
| 70 | - $this->assign('nav__canSearch', false); |
|
| 71 | - $this->assign('nav__canStats', false); |
|
| 72 | - $this->assign('nav__canBan', false); |
|
| 73 | - $this->assign('nav__canEmailMgmt', false); |
|
| 74 | - $this->assign('nav__canWelcomeMgmt', false); |
|
| 75 | - $this->assign('nav__canSiteNoticeMgmt', false); |
|
| 76 | - $this->assign('nav__canUserMgmt', false); |
|
| 77 | - $this->assign('nav__canViewRequest', false); |
|
| 78 | - $this->assign('nav__canJobQueue', false); |
|
| 79 | - $this->assign('nav__canFlaggedComments', false); |
|
| 80 | - $this->assign('nav__canDomainMgmt', false); |
|
| 81 | - $this->assign('nav__canQueueMgmt', false); |
|
| 82 | - $this->assign('nav__canFormMgmt', false); |
|
| 83 | - $this->assign('nav__canErrorLog', false); |
|
| 66 | + // nav menu access control |
|
| 67 | + $this->assign('nav__canRequests', false); |
|
| 68 | + $this->assign('nav__canLogs', false); |
|
| 69 | + $this->assign('nav__canUsers', false); |
|
| 70 | + $this->assign('nav__canSearch', false); |
|
| 71 | + $this->assign('nav__canStats', false); |
|
| 72 | + $this->assign('nav__canBan', false); |
|
| 73 | + $this->assign('nav__canEmailMgmt', false); |
|
| 74 | + $this->assign('nav__canWelcomeMgmt', false); |
|
| 75 | + $this->assign('nav__canSiteNoticeMgmt', false); |
|
| 76 | + $this->assign('nav__canUserMgmt', false); |
|
| 77 | + $this->assign('nav__canViewRequest', false); |
|
| 78 | + $this->assign('nav__canJobQueue', false); |
|
| 79 | + $this->assign('nav__canFlaggedComments', false); |
|
| 80 | + $this->assign('nav__canDomainMgmt', false); |
|
| 81 | + $this->assign('nav__canQueueMgmt', false); |
|
| 82 | + $this->assign('nav__canFormMgmt', false); |
|
| 83 | + $this->assign('nav__canErrorLog', false); |
|
| 84 | 84 | |
| 85 | - // Navigation badges for concern areas. |
|
| 86 | - $this->assign("nav__numAdmin", 0); |
|
| 87 | - $this->assign("nav__numFlaggedComments", 0); |
|
| 88 | - $this->assign("nav__numJobQueueFailed", 0); |
|
| 85 | + // Navigation badges for concern areas. |
|
| 86 | + $this->assign("nav__numAdmin", 0); |
|
| 87 | + $this->assign("nav__numFlaggedComments", 0); |
|
| 88 | + $this->assign("nav__numJobQueueFailed", 0); |
|
| 89 | 89 | |
| 90 | - // debug helpers |
|
| 91 | - $this->assign('showDebugCssBreakpoints', $this->getSiteConfiguration()->getDebuggingCssBreakpointsEnabled()); |
|
| 90 | + // debug helpers |
|
| 91 | + $this->assign('showDebugCssBreakpoints', $this->getSiteConfiguration()->getDebuggingCssBreakpointsEnabled()); |
|
| 92 | 92 | |
| 93 | - $this->assign('page', $this); |
|
| 94 | - } |
|
| 93 | + $this->assign('page', $this); |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * Fetches a rendered Smarty template |
|
| 98 | - * |
|
| 99 | - * @param $template string Template file path, relative to /templates/ |
|
| 100 | - * |
|
| 101 | - * @return string Templated HTML |
|
| 102 | - */ |
|
| 103 | - final protected function fetchTemplate($template) |
|
| 104 | - { |
|
| 105 | - return $this->smarty->fetch($template); |
|
| 106 | - } |
|
| 96 | + /** |
|
| 97 | + * Fetches a rendered Smarty template |
|
| 98 | + * |
|
| 99 | + * @param $template string Template file path, relative to /templates/ |
|
| 100 | + * |
|
| 101 | + * @return string Templated HTML |
|
| 102 | + */ |
|
| 103 | + final protected function fetchTemplate($template) |
|
| 104 | + { |
|
| 105 | + return $this->smarty->fetch($template); |
|
| 106 | + } |
|
| 107 | 107 | } |