X-Git-Url: https://git.p6c8.net/jirafeau.git/blobdiff_plain/0e38a24b7a276704431ca70c440ff49f4d53d341..4a53554259c43793bb7035489da0e6bd79993b6e:/lib/functions.php?ds=sidebyside diff --git a/lib/functions.php b/lib/functions.php index 47fbc40..a89d8b8 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1359,3 +1359,31 @@ 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###/' + ); + $replacements = array( + '[ORGANISATION PROVIDING THIS WEBSITE]', + 'contact@[THIS WEBSITE]' + ); + $content = preg_replace($patterns, $replacements, $content); + + if (true === $htmllinebreaks) { + $content = nl2br($content); + } + + return $content; +} \ No newline at end of file