svn: /phpdoc/en/trunk/reference/yaf/ book.xml yaf-application.xml yaf-bootstrap-abstract.xml yaf-config-abstract.xml yaf-controller-abstract.xml
yaf-dispatcher.xml yaf-request-simple.xml yaf_router/getcurrentroute.xml

From: Date: Thu, 01 Dec 2011 08:24:44 +0000
Subject: svn: /phpdoc/en/trunk/reference/yaf/ book.xml yaf-application.xml yaf-bootstrap-abstract.xml yaf-config-abstract.xml yaf-controller-abstract.xml
yaf-dispatcher.xml yaf-request-simple.xml yaf_router/getcurrentroute.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-9108@lists.php.net to get a copy of this message
laruence Thu, 01 Dec 2011 08:24:44 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=320216 Log: Add doc for yaf_router::getcurrentroute Add missed Yaf_Bootstrap_Abstract Changed paths: U phpdoc/en/trunk/reference/yaf/book.xml U phpdoc/en/trunk/reference/yaf/yaf-application.xml U phpdoc/en/trunk/reference/yaf/yaf-bootstrap-abstract.xml U phpdoc/en/trunk/reference/yaf/yaf-config-abstract.xml U phpdoc/en/trunk/reference/yaf/yaf-controller-abstract.xml U phpdoc/en/trunk/reference/yaf/yaf-dispatcher.xml U phpdoc/en/trunk/reference/yaf/yaf-request-simple.xml U phpdoc/en/trunk/reference/yaf/yaf_router/getcurrentroute.xml Modified: phpdoc/en/trunk/reference/yaf/book.xml =================================================================== --- phpdoc/en/trunk/reference/yaf/book.xml 2011-12-01 08:05:29 UTC (rev 320215) +++ phpdoc/en/trunk/reference/yaf/book.xml 2011-12-01 08:24:44 UTC (rev 320216) @@ -23,6 +23,7 @@ &reference.yaf.examples; &reference.yaf.yaf-application; &reference.yaf.yaf-dispatcher; + &reference.yaf.yaf-bootstrap-abstract; &reference.yaf.yaf-config-abstract; &reference.yaf.yaf-config-ini; &reference.yaf.yaf-config-simple; Modified: phpdoc/en/trunk/reference/yaf/yaf-application.xml =================================================================== --- phpdoc/en/trunk/reference/yaf/yaf-application.xml 2011-12-01 08:05:29 UTC (rev 320215) +++ phpdoc/en/trunk/reference/yaf/yaf-application.xml 2011-12-01 08:24:44 UTC (rev 320216) @@ -45,6 +45,7 @@ <!-- {{{ Class synopsis --> <classsynopsisinfo> <ooclass> + <modifier>final</modifier> <classname>Yaf_Application</classname> </ooclass> </classsynopsisinfo> Modified: phpdoc/en/trunk/reference/yaf/yaf-bootstrap-abstract.xml =================================================================== --- phpdoc/en/trunk/reference/yaf/yaf-bootstrap-abstract.xml 2011-12-01 08:05:29 UTC (rev 320215) +++ phpdoc/en/trunk/reference/yaf/yaf-bootstrap-abstract.xml 2011-12-01 08:24:44 UTC (rev 320216) @@ -37,13 +37,10 @@ <!-- {{{ Class synopsis --> <classsynopsisinfo> <ooclass> + <modifier>abstract</modifier> <classname>Yaf_Bootstrap_Abstract</classname> </ooclass> </classsynopsisinfo> -<!-- }}} --> - - <classsynopsisinfo role="comment">&Methods;</classsynopsisinfo> - <xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.yaf-bootstrap-abstract')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" /> </classsynopsis> <!-- }}} --> @@ -51,8 +48,6 @@ </partintro> - &reference.yaf.entities.yaf-bootstrap-abstract; - </phpdoc:classref> <!-- Keep this comment at the end of the file Modified: phpdoc/en/trunk/reference/yaf/yaf-config-abstract.xml =================================================================== --- phpdoc/en/trunk/reference/yaf/yaf-config-abstract.xml 2011-12-01 08:05:29 UTC (rev 320215) +++ phpdoc/en/trunk/reference/yaf/yaf-config-abstract.xml 2011-12-01 08:24:44 UTC (rev 320216) @@ -27,6 +27,7 @@ <!-- {{{ Class synopsis --> <classsynopsisinfo> <ooclass> + <modifier>abstract</modifier> <classname>Yaf_Config_Abstract</classname> </ooclass> </classsynopsisinfo> Modified: phpdoc/en/trunk/reference/yaf/yaf-controller-abstract.xml =================================================================== --- phpdoc/en/trunk/reference/yaf/yaf-controller-abstract.xml 2011-12-01 08:05:29 UTC (rev 320215) +++ phpdoc/en/trunk/reference/yaf/yaf-controller-abstract.xml 2011-12-01 08:24:44 UTC (rev 320216) @@ -49,6 +49,7 @@ <!-- {{{ Class synopsis --> <classsynopsisinfo> <ooclass> + <modifier>abstract</modifier> <classname>Yaf_Controller_Abstract</classname> </ooclass> </classsynopsisinfo> Modified: phpdoc/en/trunk/reference/yaf/yaf-dispatcher.xml =================================================================== --- phpdoc/en/trunk/reference/yaf/yaf-dispatcher.xml 2011-12-01 08:05:29 UTC (rev 320215) +++ phpdoc/en/trunk/reference/yaf/yaf-dispatcher.xml 2011-12-01 08:24:44 UTC (rev 320216) @@ -27,6 +27,7 @@ <!-- {{{ Class synopsis --> <classsynopsisinfo> <ooclass> + <modifier>final</modifier> <classname>Yaf_Dispatcher</classname> </ooclass> </classsynopsisinfo> Modified: phpdoc/en/trunk/reference/yaf/yaf-request-simple.xml =================================================================== --- phpdoc/en/trunk/reference/yaf/yaf-request-simple.xml 2011-12-01 08:05:29 UTC (rev 320215) +++ phpdoc/en/trunk/reference/yaf/yaf-request-simple.xml 2011-12-01 08:24:44 UTC (rev 320216) @@ -12,7 +12,8 @@ <section xml:id="yaf-request-simple.intro"> &reftitle.intro; <para> - + <classname>Yaf_Request_Simple</classname> is particularlly used for test + puporse. ie. simulate some espacial request under CLI mode. </para> </section> <!-- }}} --> Modified: phpdoc/en/trunk/reference/yaf/yaf_router/getcurrentroute.xml =================================================================== --- phpdoc/en/trunk/reference/yaf/yaf_router/getcurrentroute.xml 2011-12-01 08:05:29 UTC (rev 320215) +++ phpdoc/en/trunk/reference/yaf/yaf_router/getcurrentroute.xml 2011-12-01 08:24:44 UTC (rev 320216) @@ -4,7 +4,7 @@ <refentry xml:id="yaf-router.getcurrentroute" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Yaf_Router::getCurrentRoute</refname> - <refpurpose>Get the name of activated route</refpurpose> + <refpurpose>Get the effective route name</refpurpose> </refnamediv> <refsect1 role="description"> @@ -14,7 +14,13 @@ <void /> </methodsynopsis> <para> - + Get the name of the route which is effective in the route process. + <note> + <para> + You should call this method after the route process finished, since + before that, this method will always return NULL. + </para> + </note> </para> &warn.undocumented.func; @@ -29,11 +35,99 @@ <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> - + String, the name of the effective route. </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <example> + <title>Register some routes in Bootstrap</title> + <programlisting role="php"> +<![CDATA[ +<?php +class Bootstrap extends Yaf_Bootstrap_Abstract{ + public function _initConfig() { + $config = Yaf_Application::app()->getConfig(); + Yaf_Registry::set("config", $config); + } + public function _initRoute(Yaf_Dispatcher $dispatcher) { + $router = $dispatcher->getRouter(); + $rewrite_route = new Yaf_Route_Rewrite( + "/product/list/:page", + array( + "controller" => "product", + "action" => "list", + ) + ); + + $regex_route = new Yaf_Route_Rewrite( + "#^/product/info/(\d+)", + array( + "controller" => "product", + "action" => "info", + ) + ); + + $router->addRoute('rewrite', $rewrite_route)->addRoute('regex', $regex_route); + } + + /** + * register plugin + */ + public function __initPlugins(Yaf_Dispatcher $dispatcher) { + $dispatcher->registerPlugin(new DummyPlugin()); + } +?> +]]> + </programlisting> + </example> + <example> + <title>plugin Dummy.php (under APPLICATION_PATH/plugins)</title> + <programlisting role="php"> +<![CDATA[ +<?php +class DummyPlugin extends Yaf_Plugin_Abstract { + + public function routerShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) { + var_dump(Yaf_Dispatcher::getInstance()->getRouter()->getCurrentRoute()); + } +?> +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +/* for http://yourdomain.com/product/list/1 + * DummyPlugin will output: + */ +string(7) "rewrite" + +/* for http://yourdomain.com/product/info/34 + * DummyPlugin will output: + */ +string(5) "regex" + +/* for other request URI + * DummyPlugin will output: + */ +string(8) "_default" +]]> + </screen> + </example> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <member><classname>Yaf_Bootstrap_Abstract</classname></member> + <member><classname>Yaf_Plugin_Abstract</classname></member> + <member><methodname>Yaf_Router::addRoute</methodname></member> + </simplelist> + </refsect1> + </refentry> <!-- Keep this comment at the end of the file

« previous php.doc.cvs (#9108) next »