Skip to content

Instantly share code, notes, and snippets.

@sjewo
Created May 27, 2013 15:26
Show Gist options
  • Save sjewo/5657630 to your computer and use it in GitHub Desktop.
Save sjewo/5657630 to your computer and use it in GitHub Desktop.
Action for redaxo CMS which escapes \r,\f,\n only for latex code in square brackets \[ \].
<?php
// escape \r,\f,\n in latex code in square brackets \[ \]
$REX_ACTION['VALUE']['1']=preg_replace_callback(
'#\\[(.+?)\\]#s',
function ($matches) {
$search = array('\\n','\\r','\\f');
$replace = array('\\\\n','\\\\r','\\\\f');
return str_replace($search, $replace, $matches[0]);
},
$REX_ACTION['VALUE']['1']);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment