[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Smarty Internal Plugin Compile Config Load 4 * 5 * Compiles the {config load} tag 6 * 7 * @package Smarty 8 * @subpackage Compiler 9 * @author Uwe Tews 10 */ 11 12 /** 13 * Smarty Internal Plugin Compile Config Load Class 14 * 15 * @package Smarty 16 * @subpackage Compiler 17 */ 18 class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase { 19 20 /** 21 * Attribute definition: Overwrites base class. 22 * 23 * @var array 24 * @see Smarty_Internal_CompileBase 25 */ 26 public $required_attributes = array('file'); 27 /** 28 * Attribute definition: Overwrites base class. 29 * 30 * @var array 31 * @see Smarty_Internal_CompileBase 32 */ 33 public $shorttag_order = array('file','section'); 34 /** 35 * Attribute definition: Overwrites base class. 36 * 37 * @var array 38 * @see Smarty_Internal_CompileBase 39 */ 40 public $optional_attributes = array('section', 'scope'); 41 42 /** 43 * Compiles code for the {config_load} tag 44 * 45 * @param array $args array with attributes from parser 46 * @param object $compiler compiler object 47 * @return string compiled code 48 */ 49 public function compile($args, $compiler) 50 { 51 static $_is_legal_scope = array('local' => true,'parent' => true,'root' => true,'global' => true); 52 // check and get attributes 53 $_attr = $this->getAttributes($compiler, $args); 54 55 if ($_attr['nocache'] === true) { 56 $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno); 57 } 58 59 60 // save posible attributes 61 $conf_file = $_attr['file']; 62 if (isset($_attr['section'])) { 63 $section = $_attr['section']; 64 } else { 65 $section = 'null'; 66 } 67 $scope = 'local'; 68 // scope setup 69 if (isset($_attr['scope'])) { 70 $_attr['scope'] = trim($_attr['scope'], "'\""); 71 if (isset($_is_legal_scope[$_attr['scope']])) { 72 $scope = $_attr['scope']; 73 } else { 74 $compiler->trigger_template_error('illegal value for "scope" attribute', $compiler->lex->taglineno); 75 } 76 } 77 // create config object 78 $_output = "<?php \$_config = new Smarty_Internal_Config($conf_file, \$_smarty_tpl->smarty, \$_smarty_tpl);"; 79 $_output .= "\$_config->loadConfigVars($section, '$scope'); ?>"; 80 return $_output; 81 } 82 83 } 84 85 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |