| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | class FuseboxFactory { |
|---|
| 53 | |
|---|
| 54 | var $lexCompPool; |
|---|
| 55 | var $verbLexPool; |
|---|
| 56 | var $fuseboxLexicon; |
|---|
| 57 | |
|---|
| 58 | function FuseboxFactory() { |
|---|
| 59 | if ( isset($GLOBALS['attributes']['fusebox.debug']) && $GLOBALS['attributes']['fusebox.debug'] == 'true' ) echo '<ul><li>Starting $'.__CLASS__.'->'.__FUNCTION__.'()'; |
|---|
| 60 | |
|---|
| 61 | $this->lexCompPool = 0; |
|---|
| 62 | $this->verbLexPool = 0; |
|---|
| 63 | |
|---|
| 64 | $this->fuseboxLexicon = array(); |
|---|
| 65 | $this->fuseboxLexicon['namespace'] = "\$fusebox"; |
|---|
| 66 | $this->fuseboxLexicon['path'] = "verbs/"; |
|---|
| 67 | |
|---|
| 68 | if ( isset($GLOBALS['attributes']['fusebox.debug']) && $GLOBALS['attributes']['fusebox.debug'] == 'true' ) echo '</li><li>Ending $'.__CLASS__.'->'.__FUNCTION__.'()</li></ul>'; |
|---|
| 69 | return $this; |
|---|
| 70 | |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | function &create ( |
|---|
| 74 | $verb, |
|---|
| 75 | &$action, |
|---|
| 76 | $attributes, |
|---|
| 77 | $children, |
|---|
| 78 | $global=false |
|---|
| 79 | ) { |
|---|
| 80 | if ( isset($GLOBALS['attributes']['fusebox.debug']) && $GLOBALS['attributes']['fusebox.debug'] == 'true' ) echo '<ul><li>Starting $'.__CLASS__.'->'.__FUNCTION__.'()'; |
|---|
| 81 | $verbObject = ""; |
|---|
| 82 | $_fbc =& $action->getCircuit(); |
|---|
| 83 | $_fba =& $_fbc->getApplication(); |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | if ( $global ) { |
|---|
| 87 | if ( in_array($verb,array("do","fuseaction")) ) { |
|---|
| 88 | |
|---|
| 89 | if ( $verb == "do" and $_fba->strictMode ) { |
|---|
| 90 | __cfthrow(array( 'type'=>"fusebox.badGrammar.deprecated", |
|---|
| 91 | 'message'=>"Deprecated feature", |
|---|
| 92 | 'detail'=>"Using the 'do' verb in a global pre/post process was deprecated in Fusebox 4.1." |
|---|
| 93 | )); |
|---|
| 94 | } |
|---|
| 95 | } else { |
|---|
| 96 | |
|---|
| 97 | __cfthrow(array( 'type'=>"fusebox.badGrammar.illegalVerb", |
|---|
| 98 | 'message'=>"Illegal verb encountered", |
|---|
| 99 | 'detail'=>"The '{$verb}' verb is illegal in a global pre/post process." |
|---|
| 100 | )); |
|---|
| 101 | } |
|---|
| 102 | } else { |
|---|
| 103 | if ( in_array($verb,array("fuseaction")) ) { |
|---|
| 104 | |
|---|
| 105 | __cfthrow(array( 'type'=>"fusebox.badGrammar.illegalVerb", |
|---|
| 106 | 'message'=>"Illegal verb encountered", |
|---|
| 107 | 'detail'=>"The '{$verb}' verb is only legal in a global pre/post process." |
|---|
| 108 | )); |
|---|
| 109 | } |
|---|
| 110 | } |
|---|
| 111 | if ( count(explode(":",str_replace(".",":",$verb))) == 2 ) { |
|---|
| 112 | |
|---|
| 113 | require_once("fuseboxVerb.php"); |
|---|
| 114 | if ( !isPHP5() ) { eval('$verbObject =& new FuseboxVerb($action, $verb, $attributes, $children);'); } else { $verbObject = new FuseboxVerb($action, $verb, $attributes, $children); } |
|---|
| 115 | } elseif ( in_array($verb,array("do","fuseaction")) ) { |
|---|
| 116 | |
|---|
| 117 | require_once("fuseboxDoFuseaction.php"); |
|---|
| 118 | if ( !isPHP5() ) { eval('$verbObject =& new FuseboxDoFuseaction($action,$attributes,$children,$verb);'); } else { $verbObject = new FuseboxDoFuseaction($action,$attributes,$children,$verb); } |
|---|
| 119 | } else { |
|---|
| 120 | |
|---|
| 121 | require_once("fuseboxVerb.php"); |
|---|
| 122 | if ( !isPHP5() ) { |
|---|
| 123 | eval('$verbObject =& new FuseboxVerb($action, $this->fuseboxLexicon["namespace"] . ":" . $verb,$attributes, $children);'); |
|---|
| 124 | } else { |
|---|
| 125 | $verbObject = new FuseboxVerb($action, $this->fuseboxLexicon['namespace'] . ":" . $verb, |
|---|
| 126 | $attributes, $children); |
|---|
| 127 | } |
|---|
| 128 | } |
|---|
| 129 | if ( isset($GLOBALS['attributes']['fusebox.debug']) && $GLOBALS['attributes']['fusebox.debug'] == 'true' ) echo '</li><li>Ending $'.__CLASS__.'->'.__FUNCTION__.'()</li></ul>'; |
|---|
| 130 | return $verbObject; |
|---|
| 131 | } |
|---|
| 132 | |
|---|
| 133 | function &createLexiconCompiler() { |
|---|
| 134 | |
|---|
| 135 | if ( isset($GLOBALS['attributes']['fusebox.debug']) && $GLOBALS['attributes']['fusebox.debug'] == 'true' ) echo '<ul><li>Starting $'.__CLASS__.'->'.__FUNCTION__.'()'; |
|---|
| 136 | if ( !is_object($this->lexCompPool) ) { |
|---|
| 137 | require_once("fuseboxLexiconCompiler.php"); |
|---|
| 138 | if ( !isPHP5() ) { eval('$obj =& new FuseboxLexiconCompiler();'); } else { $obj = new FuseboxLexiconCompiler(); } |
|---|
| 139 | } else { |
|---|
| 140 | $obj =& $this->lexCompPool; |
|---|
| 141 | $this->lexCompPool =& $obj->_next; |
|---|
| 142 | } |
|---|
| 143 | |
|---|
| 144 | if ( isset($GLOBALS['attributes']['fusebox.debug']) && $GLOBALS['attributes']['fusebox.debug'] == 'true' ) echo '</li><li>Ending $'.__CLASS__.'->'.__FUNCTION__.'()</li></ul>'; |
|---|
| 145 | return $obj; |
|---|
| 146 | |
|---|
| 147 | } |
|---|
| 148 | |
|---|
| 149 | function freeLexiconCompiler ( |
|---|
| 150 | $lexComp |
|---|
| 151 | ) { |
|---|
| 152 | |
|---|
| 153 | if ( isset($GLOBALS['attributes']['fusebox.debug']) && $GLOBALS['attributes']['fusebox.debug'] == 'true' ) echo '<ul><li>Starting $'.__CLASS__.'->'.__FUNCTION__.'()'; |
|---|
| 154 | $lexComp->_next =& $this->lexCompPool; |
|---|
| 155 | $this->lexCompPool =& $lexComp; |
|---|
| 156 | |
|---|
| 157 | if ( isset($GLOBALS['attributes']['fusebox.debug']) && $GLOBALS['attributes']['fusebox.debug'] == 'true' ) echo '</li><li>Ending $'.__CLASS__.'->'.__FUNCTION__.'()</li></ul>'; |
|---|
| 158 | } |
|---|
| 159 | |
|---|
| 160 | function getBuiltinLexicon() { |
|---|
| 161 | |
|---|
| 162 | if ( isset($GLOBALS['attributes']['fusebox.debug']) && $GLOBALS['attributes']['fusebox.debug'] == 'true' ) echo '<ul><li>Starting $'.__CLASS__.'->'.__FUNCTION__.'()'; |
|---|
| 163 | if ( isset($GLOBALS['attributes']['fusebox.debug']) && $GLOBALS['attributes']['fusebox.debug'] == 'true' ) echo '</li><li>Ending $'.__CLASS__.'->'.__FUNCTION__.'()</li></ul>'; |
|---|
| 164 | return $this->fuseboxLexicon; |
|---|
| 165 | |
|---|
| 166 | } |
|---|
| 167 | |
|---|
| 168 | } |
|---|
| 169 | ?> |
|---|