[ Index ]

PHP Cross Reference of Web Application Component Toolkit

title

Body

[close]

/framework/template/compiler/property/ -> dictionary.inc.php (source)

   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_TEMPLATE
   8  * @version $Id: dictionary.inc.php,v 1.2 2004/11/18 04:22:46 jeffmoore Exp $
   9  */
  10  
  11  require_once WACT_ROOT . 'template/compiler/common/dictionary.inc.php';
  12  
  13  class PropertyInfo {
  14      var $Property;
  15      var $Tag;
  16      var $PropertyClass;
  17      var $File;
  18      
  19  	function PropertyInfo($property, $tag, $class) {
  20          $this->Property = $property;
  21          $this->Tag = $tag;
  22          $this->PropertyClass = $class;
  23      }
  24  
  25      function load() {
  26          if (!class_exists($this->PropertyClass) && isset($this->File)) {
  27              require_once $this->File;
  28          }
  29      }
  30  }
  31  
  32  //--------------------------------------------------------------------------------
  33  /**
  34  * The PropertyDictionary, which exists as a global variable, acting as a registry
  35  * of compile time properties.
  36  * @see http://wact.sourceforge.net/index.php/PropertyDictionary
  37  * @access protected
  38  * @package WACT_TEMPLATE
  39  */
  40  class PropertyDictionary extends CompilerArtifactDictionary {
  41  
  42      /**
  43      * @var array
  44      * @access private
  45      */
  46      var $PropertyInformation = array();
  47  
  48      function PropertyDictionary() {
  49          parent::CompilerArtifactDictionary();
  50      }    
  51      
  52      /**
  53      * Registers a property in the dictionary, called from the global registerProperty()
  54      * function.
  55      * @param string Tag name
  56      * @param string Property class name
  57      * @return void
  58      * @access protected
  59      */
  60  	function _registerProperty(&$PropertyInfo) {
  61          $tag = strtolower($PropertyInfo->Tag);
  62          $this->PropertyInformation[$tag][] =& $PropertyInfo;
  63      }
  64  
  65      /**
  66      * Registers information about a compile time propert in the global property dictionary.
  67      * This function is called from the respective compile time component class
  68      * file.
  69      * @return void
  70      * @access protected
  71      */
  72      function registerProperty(&$PropertyInfo, $file) {
  73          $PropertyInfo->File = $file;
  74          $GLOBALS['PropertyDictionary']->_registerProperty($PropertyInfo);
  75      }
  76  
  77      /**
  78      * Gets the list of Property Classes registered to a specific tag class.
  79      * @param string name of a tag
  80      * @return array list of propertiess
  81      * @access protected
  82      */
  83  	function getPropertyList($tag) {
  84          $tag = strtolower($tag);
  85          if (isset($this->PropertyInformation[$tag])) {
  86              return $this->PropertyInformation[$tag];
  87          } else {
  88              return array();
  89          }
  90      }
  91  
  92      /**
  93      * Returns the global instance of the property dictionary
  94      * Used so less direct references scattered around to global location
  95      * @static
  96      * @return PropertyDictionary
  97      * @access protected
  98      */
  99      function &getInstance() {
 100          return parent::_getInstance('PropertyDictionary', 'PropertyDictionary', 'prop');
 101      }
 102  }
 103  ?>


Generated: Sun Nov 28 19:36:09 2004 Cross-referenced by PHPXref 0.5