compile.compile_custom_function.php 925 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Template Lite compile custom function - template internal module
  4. *
  5. * Type: template
  6. * Name: compile_custom_function
  7. */
  8. function compile_compile_custom_function($function, $modifiers, $arguments, &$_result, &$object)
  9. {
  10. if ($function = $object->_plugin_exists($function, "function"))
  11. {
  12. $_args = $object->_parse_arguments($arguments);
  13. foreach($_args as $key => $value)
  14. {
  15. if (is_bool($value))
  16. {
  17. $value = $value ? 'true' : 'false';
  18. }
  19. if (is_null($value))
  20. {
  21. $value = 'null';
  22. }
  23. $_args[$key] = "'$key' => $value";
  24. }
  25. $_result = '<?php echo ';
  26. if (!empty($modifiers))
  27. {
  28. $_result .= $object->_parse_modifier($function . '(array(' . implode(',', (array)$_args) . '), $this)', $modifiers) . '; ';
  29. }
  30. else
  31. {
  32. $_result .= $function . '(array(' . implode(',', (array)$_args) . '), $this);';
  33. }
  34. $_result .= '?>';
  35. return true;
  36. }
  37. else
  38. {
  39. return false;
  40. }
  41. }
  42. ?>