function XBBCodeFilter::pair_tags in Extensible BBCode 5
Same name and namespace in other branches
- 6 xbbcode.filter.inc \XBBCodeFilter::pair_tags()
1 call to XBBCodeFilter::pair_tags()
File
- ./
xbbcode-filter.php, line 51
Class
Code
function pair_tags($text) {
$this->pair_id = 0;
$this->tagpairs = array();
$pattern = '/\\[(\\/)?([a-z0-9]+)([= ][^\\[\\]]*[^\\-])?\\]/ie';
$replace = '$this->pair_tag(\'$2\',\'$1\',\'$3\');';
foreach (array_keys($this->weighted_tags) as $weight) {
$this->current_weight = $weight;
// tell the pairing function which tags to pair up in this round.
$text = preg_replace($pattern, $replace, $text);
// invoke the pairing function
}
if (variable_get('xbbcode_filter_' . $this->format . '_autoclose', false)) {
$text .= $this
->closure(element_children($this->tagpairs));
}
$pairs = $this->tagpairs['#complete'];
// get the completed pairs
return array(
$text,
$pairs,
);
// return the text and the pairs.
}