Commit 381f2d6e authored by Dan Untenzu's avatar Dan Untenzu Committed by Jérôme Jutteau

[FEATURE] Replace markers in templates

Add a function to allow a simple marker replacement,
eg. for the Terms of Service page.

Markers have the scheme "###MARKERNAME###".
parent e1c30044
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment