private function parseConstants()
{
// constants that should be protected from usage in the template
$notPublicConstants = array('DB_TYPE', 'DB_DATABASE', 'DB_HOSTNAME', 'DB_PORT', 'DB_USERNAME', 'DB_PASSWORD');
// get all defined constants
$constants = get_defined_constants(true);
// init var
$realConstants = array();
// remove protected constants aka constants that should not be used in the template
foreach ($constants['user'] as $key => $value) {
if (!in_array($key, $notPublicConstants)) {
$realConstants[$key] = $value;
}
}
// we should only assign constants if there are constants to assign
if (!empty($realConstants)) {
$this->assign($realConstants);
}
// we use some abbreviations and common terms, these should also be assigned
$this->assign('LANGUAGE', BL::getWorkingLanguage());
// check on url object
if (Model::getContainer()->has('url')) {
$url = Model::get('url');
if ($url instanceof Url) {
// assign the current module
$this->assign('MODULE', $url->getModule());
// assign the current action
if ($url->getAction() != '') {
$this->assign('ACTION', $url->getAction());
}
if ($url->getModule() == 'Core') {
$this->assign('BACKEND_MODULE_PATH', BACKEND_PATH . '/' . $url->getModule());
} else {
$this->assign('BACKEND_MODULE_PATH', BACKEND_MODULES_PATH . '/' . $url->getModule());
}
}
}
// is the user object filled?
if (Authentication::getUser()->isAuthenticated()) {
// assign the authenticated users secret key
$this->assign('SECRET_KEY', Authentication::getUser()->getSecretKey());
// assign the authenticated users preferred interface language
$this->assign('INTERFACE_LANGUAGE', (string) Authentication::getUser()->getSetting('interface_language'));
}
// assign some variable constants (such as site-title)
$this->assign('SITE_TITLE', Model::get('fork.settings')->get('Core', 'site_title_' . BL::getWorkingLanguage(), SITE_DEFAULT_TITLE));
}