X-Git-Url: https://git.p6c8.net/jirafeau_project.git/blobdiff_plain/0e38a24b7a276704431ca70c440ff49f4d53d341..6a04487fc7086450c76a7f846019113063550a65:/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