Witam. Kto skróci ten kod QOOP do minimum dostanie pomógł:

  1. private function replaceFunc($subject)
  2. {
  3. foreach($this->func as $t)
  4. {
  5. preg_match_all('/\{'.$t.'\([a-zA-Z,\']*\)\}/i', $subject, $res);
  6. for($j = 0; $j < sizeof($res[0]); $j++)
  7. {
  8. preg_match('/\([a-zA-Z,\']+\)/i', $res[0][$j], $match);
  9. if($match > 0)
  10. {
  11. $prep = explode(", ", substr($match[0], 1, -1));
  12. $args = array();
  13. for($i = 0; $i < sizeof($prep); $i++)
  14. {
  15. $args[] = substr($prep[$i], 1, -1);
  16. }
  17. }
  18. else
  19. {
  20. $args = array();
  21. }
  22. $subject = preg_replace('/\{'.$t.preg_quote($match[0]).'\}/i', call_user_func_array($t, $args), $subject);
  23. }
  24. }
  25. return $subject;
  26. }