protected static function getFinalTemplateName($template, $module_file = null) { if (!isset($module_file)) { $module_file = self::getModuleAndTemplate($template); } if (($template_name = Caspar::getI18n()->hasTranslatedTemplate($template, true)) === false) { $template_name = \CASPAR_MODULES_PATH . $module_file['module'] . DS . 'templates' . DS . "_{$module_file['file']}.inc.php"; } return $template_name; }
/** * Sanitize a string * * @param string $string The string to sanitize * * @return string the sanitized string */ protected function __sanitize_string($string) { try { $charset = class_exists('Caspar') ? Caspar::getI18n()->getCharset() : 'utf-8'; } catch (Exception $e) { $charset = 'utf-8'; } return htmlspecialchars($string, ENT_QUOTES, $charset); }
/** * Forward the user with HTTP status code 403 and an (optional) message * based on a boolean check * * @param boolean $condition * @param string $message[optional] The message */ public function forward403unless($condition, $message = null) { if (!$condition) { $message = $message === null ? Caspar::getI18n()->__("You are not allowed to access to this page") : $message; $this->getResponse()->setHttpStatus(403); $this->message = $message; $this->getResponse()->setTemplate('main/forbidden'); } }