Explorar o código

ZF-9044 made options stackIndeX and 'class' when registering fc plugins in zend_app fc resource plugin. Updated documention 'stack' was missing.

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20842 44c647ce-9c0f-0410-b52a-842ac1e357ba
freak %!s(int64=16) %!d(string=hai) anos
pai
achega
1a3a6b57e5

+ 2 - 2
documentation/manual/en/module_specs/Zend_Application-AvailableResources-Frontcontroller.xml

@@ -80,7 +80,7 @@
                 class names. The resource will instantiate each class (with no constructor
                 arguments) and then register the instance with the front controller. If you want to
                 register a plugin with a particular stack index, you need to provide an array with
-                two keys <property>class</property> and <property>index</property>.
+                two keys <property>class</property> and <property>stackIndex</property>.
             </para>
         </listitem>
 
@@ -117,7 +117,7 @@ resources.frontController.baseUrl = "/subdir"
 resources.frontController.plugins.foo = "My_Plugin_Foo"
 resources.frontController.plugins.bar = "My_Plugin_Bar"
 resources.frontController.plugins.baz.class = "My_Plugin_Baz"
-resources.frontController.plugins.baz.index = 123
+resources.frontController.plugins.baz.stackIndex = 123
 resources.frontController.env = APPLICATION_ENV
 ]]></programlisting>
     </example>

+ 11 - 9
library/Zend/Application/Resource/Frontcontroller.php

@@ -96,15 +96,17 @@ class Zend_Application_Resource_Frontcontroller extends Zend_Application_Resourc
                 case 'plugins':
                     foreach ((array) $value as $pluginClass) {
                     	$stackIndex = null;
-                    	if(is_array($pluginClass) && 
-                    	   isset($pluginClass['class']))
-                    	{
-                    		if(isset($pluginClass['stackindex'])) {
-                    			$stackIndex = $pluginClass['stackindex'];
-                    		}
-
-                    		$pluginClass = $pluginClass['class'];
-                    	}
+                    	if(is_array($pluginClass)) {
+                    	    $pluginClass = array_change_key_case($pluginClass, CASE_LOWER);
+                            if(isset($pluginClass['class']))
+                            {
+                                if(isset($pluginClass['stackindex'])) {
+                                    $stackIndex = $pluginClass['stackindex'];
+                                }
+
+                                $pluginClass = $pluginClass['class'];
+                            }
+                        }
 
                         $plugin = new $pluginClass();
                         $front->registerPlugin($plugin, $stackIndex);

+ 1 - 1
tests/Zend/Application/Resource/FrontcontrollerTest.php

@@ -312,7 +312,7 @@ class Zend_Application_Resource_FrontcontrollerTest extends PHPUnit_Framework_Te
                   'stackindex' => 10),
             'Zend_Controller_Plugin_ActionStack',
             array('class' => 'Zend_Controller_Plugin_PutHandler',
-                  'stackindex' => 5),
+                  'stackIndex' => 5),
         );
 
         $expected = array(