1: | <?php
|
2: | |
3: | |
4: | |
5: | |
6: | |
7: | |
8: | |
9: |
|
10: |
|
11: | |
12: | |
13: | |
14: | |
15: | |
16: |
|
17: | class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase
|
18: | {
|
19: | |
20: | |
21: | |
22: | |
23: | |
24: |
|
25: | public $required_attributes = array('file');
|
26: |
|
27: | |
28: | |
29: | |
30: | |
31: | |
32: |
|
33: | public $shorttag_order = array('file', 'section');
|
34: |
|
35: | |
36: | |
37: | |
38: | |
39: | |
40: |
|
41: | public $optional_attributes = array('section', 'scope');
|
42: |
|
43: | |
44: | |
45: | |
46: | |
47: | |
48: |
|
49: | public $option_flags = array('nocache', 'noscope');
|
50: |
|
51: | |
52: | |
53: | |
54: | |
55: |
|
56: | public $valid_scopes = array(
|
57: | 'local' => Smarty::SCOPE_LOCAL, 'parent' => Smarty::SCOPE_PARENT,
|
58: | 'root' => Smarty::SCOPE_ROOT, 'tpl_root' => Smarty::SCOPE_TPL_ROOT,
|
59: | 'smarty' => Smarty::SCOPE_SMARTY, 'global' => Smarty::SCOPE_SMARTY
|
60: | );
|
61: |
|
62: | |
63: | |
64: | |
65: | |
66: | |
67: | |
68: | |
69: | |
70: |
|
71: | public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
|
72: | {
|
73: |
|
74: | $_attr = $this->getAttributes($compiler, $args);
|
75: | if ($_attr[ 'nocache' ] === true) {
|
76: | $compiler->trigger_template_error('nocache option not allowed', null, true);
|
77: | }
|
78: |
|
79: | $conf_file = $_attr[ 'file' ];
|
80: | if (isset($_attr[ 'section' ])) {
|
81: | $section = $_attr[ 'section' ];
|
82: | } else {
|
83: | $section = 'null';
|
84: | }
|
85: |
|
86: | if ($_attr[ 'noscope' ]) {
|
87: | $_scope = -1;
|
88: | } else {
|
89: | $_scope = $compiler->convertScope($_attr, $this->valid_scopes);
|
90: | }
|
91: |
|
92: | $_output =
|
93: | "<?php\n\$_smarty_tpl->smarty->ext->configLoad->_loadConfigFile(\$_smarty_tpl, {$conf_file}, {$section}, {$_scope});\n?>\n";
|
94: | return $_output;
|
95: | }
|
96: | }
|
97: | |