aboutsummaryrefslogtreecommitdiff
path: root/ratatoeskr/sys/translation.php
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2020-04-26 16:33:36 +0200
committerLaria Carolin Chabowski <laria@laria.me>2020-04-26 16:33:36 +0200
commit82d40e32363c4e96996eca7ee44ade879589aa0e (patch)
tree44c819d2472697de1e8eb404148f4a087109b27e /ratatoeskr/sys/translation.php
parent11c7214cb58be4100422b8f905bc629a8906e6ff (diff)
downloadratatoeskr-cms-82d40e32363c4e96996eca7ee44ade879589aa0e.tar.gz
ratatoeskr-cms-82d40e32363c4e96996eca7ee44ade879589aa0e.tar.bz2
ratatoeskr-cms-82d40e32363c4e96996eca7ee44ade879589aa0e.zip
Expand tabs and remove trailing whitespace
Diffstat (limited to 'ratatoeskr/sys/translation.php')
-rw-r--r--ratatoeskr/sys/translation.php76
1 files changed, 38 insertions, 38 deletions
diff --git a/ratatoeskr/sys/translation.php b/ratatoeskr/sys/translation.php
index 1104bdb..4ca6ec8 100644
--- a/ratatoeskr/sys/translation.php
+++ b/ratatoeskr/sys/translation.php
@@ -2,7 +2,7 @@
/*
* File: ratatoeskr/sys/translation.php
* Load translation.
- *
+ *
* License:
* This file is part of Ratatöskr.
* Ratatöskr is licensed unter the MIT / X11 License.
@@ -13,55 +13,55 @@ require_once(dirname(__FILE__) . "/utils.php");
require_once(dirname(__FILE__) . "/init_ste.php");
if(!defined("SETUP"))
- require_once(dirname(__FILE__) . "/models.php");
+ require_once(dirname(__FILE__) . "/models.php");
if(!defined("TRANSLATION_PLUGIN_LOADED"))
{
- $ste->register_tag(
- "get_translation",
- function($ste, $params, $sub)
- {
- global $translation;
- if((!isset($translation)) or empty($params["for"]) or (!isset($translation[$params["for"]])))
- return "";
- $rv = $translation[$params["for"]];
- return (!empty($params["raw"])) ? $rv : htmlesc($rv);
- }
- );
- define("TRANSLATION_PLUGIN_LOADED", True);
+ $ste->register_tag(
+ "get_translation",
+ function($ste, $params, $sub)
+ {
+ global $translation;
+ if((!isset($translation)) or empty($params["for"]) or (!isset($translation[$params["for"]])))
+ return "";
+ $rv = $translation[$params["for"]];
+ return (!empty($params["raw"])) ? $rv : htmlesc($rv);
+ }
+ );
+ define("TRANSLATION_PLUGIN_LOADED", True);
}
/*
* Function: load_language
* Load a language (i.e. set the global $translation variable).
- *
+ *
* Parameters:
- * $lang - The language (2-Letter code, e.g. "en", "de", "it" ...) to load. NULL for default (from database).
+ * $lang - The language (2-Letter code, e.g. "en", "de", "it" ...) to load. NULL for default (from database).
*/
function load_language($lang=NULL)
{
- if(!defined("SETUP"))
- {
- global $ratatoeskr_settings;
- if($lang === NULL)
- $lang = $ratatoeskr_settings["default_language"];
- }
- else
- {
- if($lang === NULL)
- $lang = "en";
- }
-
- /*
- * Because we will include an file defined by the $lang param, we will
- * only allow alphabetic characters, so this function should not be
- * vulnerable to LFI-Exploits...
- */
- $lang = implode("", array_filter(str_split($lang, 1), "ctype_alpha"));
-
- require(dirname(__FILE__) . "/../translations/$lang.php");
-
- $GLOBALS["translation"] = $translation;
+ if(!defined("SETUP"))
+ {
+ global $ratatoeskr_settings;
+ if($lang === NULL)
+ $lang = $ratatoeskr_settings["default_language"];
+ }
+ else
+ {
+ if($lang === NULL)
+ $lang = "en";
+ }
+
+ /*
+ * Because we will include an file defined by the $lang param, we will
+ * only allow alphabetic characters, so this function should not be
+ * vulnerable to LFI-Exploits...
+ */
+ $lang = implode("", array_filter(str_split($lang, 1), "ctype_alpha"));
+
+ require(dirname(__FILE__) . "/../translations/$lang.php");
+
+ $GLOBALS["translation"] = $translation;
}
?>