| 1: | <?php
|
| 2: |
|
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: |
|
| 12: | class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File
|
| 13: | {
|
| 14: | |
| 15: | |
| 16: | |
| 17: | |
| 18: |
|
| 19: | public $uncompiled = true;
|
| 20: |
|
| 21: | |
| 22: | |
| 23: | |
| 24: | |
| 25: |
|
| 26: | public $hasCompiledHandler = true;
|
| 27: |
|
| 28: | |
| 29: | |
| 30: | |
| 31: | |
| 32: |
|
| 33: | protected $short_open_tag;
|
| 34: |
|
| 35: | |
| 36: | |
| 37: |
|
| 38: | public function __construct()
|
| 39: | {
|
| 40: | $this->short_open_tag = function_exists('ini_get') ? ini_get('short_open_tag') : 1;
|
| 41: | }
|
| 42: |
|
| 43: | |
| 44: | |
| 45: | |
| 46: | |
| 47: | |
| 48: | |
| 49: | |
| 50: |
|
| 51: | public function getContent(Smarty_Template_Source $source)
|
| 52: | {
|
| 53: | if ($source->exists) {
|
| 54: | return '';
|
| 55: | }
|
| 56: | throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
|
| 57: | }
|
| 58: |
|
| 59: | |
| 60: | |
| 61: | |
| 62: | |
| 63: | |
| 64: |
|
| 65: | public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
|
| 66: | {
|
| 67: | $compiled->filepath = $_template->source->filepath;
|
| 68: | $compiled->timestamp = $_template->source->timestamp;
|
| 69: | $compiled->exists = $_template->source->exists;
|
| 70: | $compiled->file_dependency[ $_template->source->uid ] =
|
| 71: | array(
|
| 72: | $compiled->filepath,
|
| 73: | $compiled->timestamp,
|
| 74: | $_template->source->type,
|
| 75: | );
|
| 76: | }
|
| 77: |
|
| 78: | |
| 79: | |
| 80: | |
| 81: | |
| 82: | |
| 83: | |
| 84: | |
| 85: | |
| 86: |
|
| 87: | public function renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template)
|
| 88: | {
|
| 89: | if (!$source->smarty->allow_php_templates) {
|
| 90: | throw new SmartyException('PHP templates are disabled');
|
| 91: | }
|
| 92: | if (!$source->exists) {
|
| 93: | throw new SmartyException(
|
| 94: | "Unable to load template '{$source->type}:{$source->name}'" .
|
| 95: | ($_template->_isSubTpl() ? " in '{$_template->parent->template_resource}'" : '')
|
| 96: | );
|
| 97: | }
|
| 98: |
|
| 99: | extract($_template->getTemplateVars());
|
| 100: |
|
| 101: | if (function_exists('ini_set')) {
|
| 102: | ini_set('short_open_tag', '1');
|
| 103: | }
|
| 104: | |
| 105: | |
| 106: | |
| 107: | |
| 108: | |
| 109: |
|
| 110: | $_smarty_template = $_template;
|
| 111: | include $source->filepath;
|
| 112: | if (function_exists('ini_set')) {
|
| 113: | ini_set('short_open_tag', $this->short_open_tag);
|
| 114: | }
|
| 115: | }
|
| 116: | }
|
| 117: | |