function collapse_text_prepare in Collapse Text 6.2
Implementation of hook_filter($op='prepare').
1 call to collapse_text_prepare()
- collapse_text_filter in ./
collapse_text.module - Implementation of hook_filter().
File
- ./
collapse_text.module, line 109 - collapse_text is an input filter that allows text to be collapsible
Code
function collapse_text_prepare($text) {
// fix any html style (ie, '<>' delimited) tags into our '[]' style delimited tags
$text = preg_replace('/(?<!\\\\) # not preceded by a backslash
< # an open bracket
( # start capture
\\/? # optional backslash
collapse # the string collapse
[^>]* # everything up to the closing angle bracket; note that you cannot use one inside the tag!
) # stop capture
> # close bracket
/ix', '[$1]', $text);
$text = preg_replace_callback('/(?<!\\\\) # not preceded by a backslash
\\[ # open bracket
collapse # the string collapse
[^\\]]* # everything up to a closing straight bracket; note that you cannot use one inside a tag!
\\] # closing bracket
/ix', '_collapse_text_filter_prepare_regex_callback', $text);
return $text;
}