X-Git-Url: https://git.p6c8.net/jirafeau.git/blobdiff_plain/e1c30044b1fa083d89b4bf8f0265fb2785583411..381f2d6ec29c08264a6fcf5066ff97cc32698595:/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