You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

smarty_internal_runtime_hhvm.php 823B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * Runtime Extension Hhvm
  4. *
  5. * include patch for modified compiled or cached templates
  6. * HHVM does not check if file was modified when including same file multiple times
  7. *
  8. * @package Smarty
  9. * @subpackage PluginsInternal
  10. * @author Uwe Tews
  11. */
  12. class Smarty_Internal_Runtime_Hhvm
  13. {
  14. /**
  15. * @param \Smarty_Internal_Template $_template
  16. * @param string $file file name
  17. *
  18. * @return mixed
  19. */
  20. static function includeHhvm(Smarty_Internal_Template $_template, $file)
  21. {
  22. $_smarty_tpl = $_template;
  23. $tmp_file = $file . preg_replace('![^\w]+!', '_', uniqid(rand(), true)) . '.php';
  24. file_put_contents($tmp_file, file_get_contents($file));
  25. $result = @include $tmp_file;
  26. @unlink($tmp_file);
  27. return $result;
  28. }
  29. }