Guest User

Untitled

a guest
Jul 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. function _parse_extensions($content)
  2. {
  3. // Replace single tags ONLY using a Negative Lookahead
  4. if (preg_match_all('%(?!{ext:(\w+?).*?\}.*?{/ext:\1}){ext:(\w+)\s?(.*?)}%s', $content, $matches, PREG_SET_ORDER))
  5. {
  6. foreach($matches as $match)
  7. {
  8. if ( $extension = Cms::getExtension('cms_' . $match[2] . '_ext'))
  9. {
  10. $class = new $extension['class']();
  11. $params = $this->parse_params($match[3]);
  12. $class->initialize($params, null, $this);
  13. $out = $class->parse();
  14. $content = str_replace($match[0], $out, $content);
  15. }
  16. }
  17. }
  18. // Check if we have a set of loop tags
  19. if (preg_match_all('%(?={ext:(\w+?).*?}.*?{/ext:\1}){ext:(.*?)\s(.*?)}(.*?){/ext:.*?}%s', $content, $matches, PREG_SET_ORDER))
  20. {
  21. debug($matches); exit;
  22. foreach($matches as $match)
  23. {
  24. if ( $extension = Cms::getExtension('cms_' . $match[1] . '_ext'))
  25. {
  26. $class = new $extension['class']();
  27. $params = $this->parse_params($match[2]);
  28. $class->initialize($params, trim($match[3]), $this);
  29. $out = $class->parse();
  30. $content = str_replace($match[0], $out, $content);
  31. }
  32. }
  33. }
  34. return $content;
  35. }
Add Comment
Please, Sign In to add comment