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