// Implode recursive a multi-dimension array, taken from www.php.net
function implode_r (string $glue, array $array, string $array_name = NULL) {
$return = [];
- while (list($key,$value) = @each($array)) {
+ foreach ($array as $key => $value) {
if (is_array($value)) {
// Is an array again, so call recursive
$return[] = implode_r($glue, $value, (string) $key);
}
// Secures a string by escaping it and passing it through strip_tags,htmlentities-chain
-function crackerTrackerSecureString ($str) {
+function crackerTrackerSecureString (string $str) {
// First escape it
$str = crackerTrackerEscapeString($str);
}
// Is the file there and readable?
-function isCrackerTrackerFileFound ($FQFN) {
+function isCrackerTrackerFileFound (string $FQFN) {
// Simply check it
return ((file_exists($FQFN)) && (is_readable($FQFN)));
}
// Loads a given "template" (this is more an include file)
-function crackerTrackerLoadTemplate ($template) {
+function crackerTrackerLoadTemplate (string $template) {
// Create the full-qualified filename (FQFN)
$FQFN = sprintf('%s/libs/templates/%s.tpl.php',
$GLOBALS['ctracker_base_path'],
}
// Loads a given "template" (this is more an include file)
-function crackerTrackerLoadLocalizedTemplate ($template) {
+function crackerTrackerLoadLocalizedTemplate (string $template) {
// Create the full-qualified filename (FQFN)
$FQFN = sprintf('%s/libs/templates/%s/%s.tpl.php',
$GLOBALS['ctracker_base_path'],
}
// Loads a given email template and passes through $content
-function crackerTrackerLoadEmailTemplate ($template, array $content = [], $language = NULL) {
+function crackerTrackerLoadEmailTemplate (string $template, array $content = [], string $language = NULL) {
// Init language
crackerTrackerLanguage();
}
// Getter for message
-function getCrackerTrackerLocalized ($message) {
+function getCrackerTrackerLocalized (string $message) {
// Default message
$output = '!' . $message . '!';
}
// Tries to find a message and outputs it
-function crackerTrackerOutputLocalized ($message) {
+function crackerTrackerOutputLocalized (string $message) {
// Output it
print getCrackerTrackerLocalized($message);
}
// Compiles the given code
-function crackerTrackerCompileCode ($code) {
+function crackerTrackerCompileCode (string $code) {
// Find all $content[foo]
preg_match_all('/\$(content|GLOBALS)((\[([a-zA-Z0-9-_]+)\])*)/', $code, $matches);
}
// "Getter" for language
-function getCrackerTrackerLanguage ($lang = NULL) {
+function getCrackerTrackerLanguage (string $lang = NULL) {
// Default is from browser
$language = $GLOBALS['ctracker_language'];
* @link http://support.microsoft.com/kb/q176113/
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function crackerTrackerSendRawRedirect ($url) {
+function crackerTrackerSendRawRedirect (string $url) {
// Better remove any data by ctracker
unsetCtrackerData();
}
// Sanitizes string
-function crackerTrackerSanitize ($str) {
+function crackerTrackerSanitize (string $str) {
return str_replace(array('//', '/./'), array('/', '/'), $str);
}