X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/blobdiff_plain/0e38a24b7a276704431ca70c440ff49f4d53d341..caa57721c5e41cd31fb86a765f53f9302fb8039e:/lib/functions.php?ds=sidebyside diff --git a/lib/functions.php b/lib/functions.php index 47fbc40..6c9c832 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1359,3 +1359,33 @@ jirafeau_alias_delete ($alias, $password) return 'Ok'; } +/** + * Replace markers in templates. + * + * Available markers have the scheme "###MARKERNAME###". + * + * @param $content string Template text with markers + * @param $htmllinebreaks boolean Convert linebreaks to BR-Tags + * @return Template with replaced markers + */ +function +jirafeau_replace_markers ($content, $htmllinebreaks = false) +{ + $patterns = array( + '/###ORGANISATION###/', + '/###CONTACTPERSON###/', + '/###WEBROOT###/' + ); + $replacements = array( + $GLOBALS['cfg']['organisation'], + $GLOBALS['cfg']['contactperson'], + $GLOBALS['cfg']['web_root'] + ); + $content = preg_replace($patterns, $replacements, $content); + + if (true === $htmllinebreaks) { + $content = nl2br($content); + } + + return $content; +} \ No newline at end of file