root / phpframework / trunk / fuseboxClassDefinition.php

Revision 340, 4.7 kB (checked in by scorfield, 2 years ago)

Initial import of Fusebox 5.0.0 for PHP.

  • Property svn:executable set to *
Line 
1<?php
2/*
3Fusebox Software License
4Version 1.0
5
6Copyright (c) 2003, 2004, 2005, 2006 The Fusebox Corporation. All rights reserved.
7
8Redistribution and use in source and binary forms, with or without modification, are permitted
9provided that the following conditions are met:
10
111. Redistributions of source code must retain the above copyright notice, this list of conditions
12   and the following disclaimer.
13
142. Redistributions in binary form or otherwise encrypted form must reproduce the above copyright
15   notice, this list of conditions and the following disclaimer in the documentation and/or other
16   materials provided with the distribution.
17
183. The end-user documentation included with the redistribution, if any, must include the following
19   acknowledgment:
20
21   "This product includes software developed by the Fusebox Corporation (http://www.fusebox.org/)."
22
23   Alternately, this acknowledgment may appear in the software itself, if and wherever such
24   third-party acknowledgments normally appear.
25
264. The names "Fusebox" and "Fusebox Corporation" must not be used to endorse or promote products
27   derived from this software without prior written (non-electronic) permission. For written
28   permission, please contact fusebox@fusebox.org.
29
305. Products derived from this software may not be called "Fusebox", nor may "Fusebox" appear in
31   their name, without prior written (non-electronic) permission of the Fusebox Corporation. For
32   written permission, please contact fusebox@fusebox.org.
33
34If one or more of the above conditions are violated, then this license is immediately revoked and
35can be re-instated only upon prior written authorization of the Fusebox Corporation.
36
37THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
38LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39DISCLAIMED. IN NO EVENT SHALL THE FUSEBOX CORPORATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY
40DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
42BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
43STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
44OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45
46-------------------------------------------------------------------------------
47
48This software consists of voluntary contributions made by many individuals on behalf of the
49Fusebox Corporation. For more information on Fusebox, please see <http://www.fusebox.org/>.
50
51*/
52class FuseboxClassDefinition { //I represent a class declaration in the fusebox XML file.
53
54    var $type;
55    var $classpath;
56    var $constructor;
57    var $customAttributes;
58   
59    function FuseboxClassDefinition /*I am the constructor.*/ (
60            $type, //I am 'component' or 'java' etc, the type of the declared class.
61            $classpath, //I am the package-qualified name of the declared class
62            $constructor = '', //I am the name of the method that should be used to construct the declared class.
63            $customAttribs = array() //I am the set of custom attributes specified in the class declaration.
64        ) {
65        if ( isset($GLOBALS['attributes']['fusebox.debug']) && $GLOBALS['attributes']['fusebox.debug'] == 'true' ) echo '<ul><li>Starting $'.__CLASS__.'->'.__FUNCTION__.'()';
66   
67        /* FB41 compatibility means these must be public data */
68        $this->type = $type;
69        $this->classpath = $classpath;
70        $this->constructor = $constructor;
71        $this->customAttributes = $customAttribs;
72       
73        if ( isset($GLOBALS['attributes']['fusebox.debug']) && $GLOBALS['attributes']['fusebox.debug'] == 'true' ) echo '</li><li>Ending $'.__CLASS__.'->'.__FUNCTION__.'()</li></ul>';
74        return $this;
75       
76    }
77   
78    function getCustomAttributes /*I return the custom (namespace-qualified) attributes for this fuseaction tag.*/ (
79            $ns //I am the namespace prefix whose attributes should be returned.
80        ) {
81       
82        if ( isset($GLOBALS['attributes']['fusebox.debug']) && $GLOBALS['attributes']['fusebox.debug'] == 'true' ) echo '<ul><li>Starting $'.__CLASS__.'->'.__FUNCTION__.'()';
83        if ( isset($GLOBALS['attributes']['fusebox.debug']) && $GLOBALS['attributes']['fusebox.debug'] == 'true' ) echo '</li><li>Ending $'.__CLASS__.'->'.__FUNCTION__.'()</li></ul>';
84        if ( array_key_exists($ns,$this->customAttributes) ) {
85            /* we structCopy() this so folks can't poke values back into the metadata! */
86            //return $structCopy(variables.customAttributes[$ns]);
87            return $this->customAttributes[$ns];
88        } else {
89            return array();
90        }
91       
92    }
93   
94}
95?>
Note: See TracBrowser for help on using the browser.