| [ Index ] |
PHP Cross Reference of Web Application Component Toolkit |
[Summary view] [Print] [Text view]
1 <?php 2 //-------------------------------------------------------------------------------- 3 // Copyright 2003 Procata, Inc. 4 // Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html) 5 //-------------------------------------------------------------------------------- 6 /** 7 * @package WACT_TAG 8 * @version $Id: import.tag.php,v 1.23 2004/11/18 04:22:47 jeffmoore Exp $ 9 */ 10 11 /** 12 * Include the VarFileCompiler 13 */ 14 require_once WACT_ROOT . 'template/compiler/varfilecompiler.inc.php'; 15 require_once WACT_ROOT . 'template/compiler/property/constant.inc.php'; 16 17 /** 18 * Register tag 19 */ 20 $taginfo =& new TagInfo('core:IMPORT', 'CoreImportTag'); 21 $taginfo->setCompilerAttributes(array('file')); 22 $taginfo->setEndTag(ENDTAG_FORBIDDEN); 23 TagDictionary::registerTag($taginfo, __FILE__); 24 25 /** 26 * Imports a property definition file into the DataSource (e.g. a configuration file) 27 * @see http://wact.sourceforge.net/index.php/CoreImportTag 28 * @access protected 29 * @package WACT_TAG 30 */ 31 class CoreImportTag extends SilentCompilerDirectiveTag { 32 /** 33 * @return void 34 * @access protected 35 */ 36 function CheckNestingLevel() { 37 if ($this->findParentByClass('CoreImportTag')) { 38 RaiseError('compiler', 'BADSELFNESTING', array( 39 'tag' => $this->tag, 40 'file' => $this->SourceFile, 41 'line' => $this->StartingLineNo)); 42 } 43 } 44 45 /** 46 * @return int PARSER_FORBID_PARSING 47 * @access protected 48 */ 49 function preParse() { 50 $file = $this->getAttribute('file'); 51 if (empty($file)) { 52 RaiseError('compiler', 'MISSINGREQUIREATTRIBUTE', array( 53 'tag' => $this->tag, 54 'attribute' => 'file', 55 'file' => $this->SourceFile, 56 'line' => $this->StartingLineNo)); 57 } 58 59 $sourcefile = ResolveTemplateSourceFileName($file, TMPL_IMPORT, $this->SourceFile); 60 if (empty($sourcefile)) { 61 RaiseError('compiler', 'MISSINGFILE', array( 62 'tag' => $this->tag, 63 'srcfile' => $file, 64 'file' => $this->SourceFile, 65 'line' => $this->StartingLineNo)); 66 } 67 68 $DataSource =& $this->getDataSource(); 69 foreach(parseVarFile($sourcefile) as $name => $value) { 70 $property =& new ConstantProperty($value); 71 $DataSource->registerProperty($name, $property); 72 } 73 74 return PARSER_FORBID_PARSING; 75 } 76 } 77 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sun Nov 28 19:36:09 2004 | Cross-referenced by PHPXref 0.5 |