Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function _parse_extensions($content)
- {
- // Replace single tags ONLY using a Negative Lookahead
- if (preg_match_all('%(?!{ext:(\w+?).*?\}.*?{/ext:\1}){ext:(\w+)\s?(.*?)}%s', $content, $matches, PREG_SET_ORDER))
- {
- foreach($matches as $match)
- {
- if ( $extension = Cms::getExtension('cms_' . $match[2] . '_ext'))
- {
- $class = new $extension['class']();
- $params = $this->parse_params($match[3]);
- $class->initialize($params, null, $this);
- $out = $class->parse();
- $content = str_replace($match[0], $out, $content);
- }
- }
- }
- // Check if we have a set of loop tags
- if (preg_match_all('%(?={ext:(\w+?).*?}.*?{/ext:\1}){ext:(.*?)\s(.*?)}(.*?){/ext:.*?}%s', $content, $matches, PREG_SET_ORDER))
- {
- debug($matches); exit;
- foreach($matches as $match)
- {
- if ( $extension = Cms::getExtension('cms_' . $match[1] . '_ext'))
- {
- $class = new $extension['class']();
- $params = $this->parse_params($match[2]);
- $class->initialize($params, trim($match[3]), $this);
- $out = $class->parse();
- $content = str_replace($match[0], $out, $content);
- }
- }
- }
- return $content;
- }
Add Comment
Please, Sign In to add comment