svn: /phpdoc/en/trunk/reference/yaf/ yaf-plugin-abstract.xml yaf_dispatcher/catchexception.xml yaf_plugin_abstract/dispatchloopshutdown.xml
yaf_plugin_abstract/routershutdown.xml yaf_plugin_abstract/routerstartup.xml

From: Date: Sat, 26 Nov 2011 11:35:46 +0000
Subject: svn: /phpdoc/en/trunk/reference/yaf/ yaf-plugin-abstract.xml yaf_dispatcher/catchexception.xml yaf_plugin_abstract/dispatchloopshutdown.xml
yaf_plugin_abstract/routershutdown.xml yaf_plugin_abstract/routerstartup.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-9080@lists.php.net to get a copy of this message
laruence Sat, 26 Nov 2011 11:35:46 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=319950 Log: update docs Changed paths: U phpdoc/en/trunk/reference/yaf/yaf-plugin-abstract.xml U phpdoc/en/trunk/reference/yaf/yaf_dispatcher/catchexception.xml U phpdoc/en/trunk/reference/yaf/yaf_plugin_abstract/dispatchloopshutdown.xml U phpdoc/en/trunk/reference/yaf/yaf_plugin_abstract/routershutdown.xml U phpdoc/en/trunk/reference/yaf/yaf_plugin_abstract/routerstartup.xml Modified: phpdoc/en/trunk/reference/yaf/yaf-plugin-abstract.xml =================================================================== --- phpdoc/en/trunk/reference/yaf/yaf-plugin-abstract.xml 2011-11-26 11:11:27 UTC (rev 319949) +++ phpdoc/en/trunk/reference/yaf/yaf-plugin-abstract.xml 2011-11-26 11:35:46 UTC (rev 319950) @@ -4,7 +4,7 @@ <phpdoc:classref xml:id="class.yaf-plugin-abstract" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"> <title>The Yaf_Plugin_Abstract class</title> - <titleabbrev>Plugin for Yaf</titleabbrev> + <titleabbrev>Yaf_Plugin_Abstract</titleabbrev> <partintro> @@ -12,8 +12,19 @@ <section xml:id="yaf-plugin-abstract.intro"> &reftitle.intro; <para> - + Plugins allow for easy extensibility and customization of the framework. </para> + <para> + Plugins are classes. The actual class definition will vary based on the + component -- you may need to implement this interface, but the fact + remains that the plugin is itself a class. + </para> + <para> + A plugin could be loaded into Yaf by using + <methodname>Yaf_Dispatcher::registerPlugin</methodname>, after + registerd, All the methods which the plugin implemented according to this + interface, will be called at the proper time. + </para> </section> <!-- }}} --> Modified: phpdoc/en/trunk/reference/yaf/yaf_dispatcher/catchexception.xml =================================================================== --- phpdoc/en/trunk/reference/yaf/yaf_dispatcher/catchexception.xml 2011-11-26 11:11:27 UTC (rev 319949) +++ phpdoc/en/trunk/reference/yaf/yaf_dispatcher/catchexception.xml 2011-11-26 11:35:46 UTC (rev 319950) @@ -90,6 +90,7 @@ </screen> </example> </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <simplelist> Modified: phpdoc/en/trunk/reference/yaf/yaf_plugin_abstract/dispatchloopshutdown.xml =================================================================== --- phpdoc/en/trunk/reference/yaf/yaf_plugin_abstract/dispatchloopshutdown.xml 2011-11-26 11:11:27 UTC (rev 319949) +++ phpdoc/en/trunk/reference/yaf/yaf_plugin_abstract/dispatchloopshutdown.xml 2011-11-26 11:35:46 UTC (rev 319950) @@ -15,7 +15,9 @@ <methodparam><type>Yaf_Response_Abstract</type><parameter>response</parameter></methodparam> </methodsynopsis> <para> - + This is the latest hook in Yaf plugin hook system, if a custom plugin + implement this method, then it will be called after the dispatch loop + finished. </para> &warn.undocumented.func; @@ -51,6 +53,16 @@ </para> </refsect1> + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <member><methodname>Yaf_Plugin_Abstract::routerStartup</methodname></member> + <member><methodname>Yaf_Plugin_Abstract::routerShutdown</methodname></member> + <member><methodname>Yaf_Plugin_Abstract::dispatchLoopStartup</methodname></member> + <member><methodname>Yaf_Plugin_Abstract::preDispatch</methodname></member> + <member><methodname>Yaf_Plugin_Abstract::postDispatch</methodname></member> + </simplelist> + </refsect1> </refentry> Modified: phpdoc/en/trunk/reference/yaf/yaf_plugin_abstract/routershutdown.xml =================================================================== --- phpdoc/en/trunk/reference/yaf/yaf_plugin_abstract/routershutdown.xml 2011-11-26 11:11:27 UTC (rev 319949) +++ phpdoc/en/trunk/reference/yaf/yaf_plugin_abstract/routershutdown.xml 2011-11-26 11:35:46 UTC (rev 319950) @@ -15,7 +15,8 @@ <methodparam><type>Yaf_Response_Abstract</type><parameter>response</parameter></methodparam> </methodsynopsis> <para> - + This hook will be trigged after the route process finished, this hook + is usually used for login check. </para> &warn.undocumented.func; @@ -51,7 +52,52 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <example> + <title><function>Yaf_Plugin_Abstract::routerShutdown</function>example</title> + <programlisting role="php"> +<![CDATA[ +<?php +class UserInitPlugin extends Yaf_Plugin_Abstract { + public function routerShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) { + $controller = $request->getControllerName(); + + /** + * Use access controller is unecessary for APIs + */ + if (in_array(strtolower($controller), array( + 'api', + ))) { + return TRUE; + } + + if (Yaf_Session::getInstance()->has("login")) { + return TRUE; + } + + /* Use access check failed, need to login */ + $response->redirect("http://yourdomain.com/login/"); + return FALSE; + } +?> +]]> + </programlisting> + </example> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <member><methodname>Yaf_Plugin_Abstract::routerStartup</methodname></member> + <member><methodname>Yaf_Plugin_Abstract::dispatchLoopStartup</methodname></member> + <member><methodname>Yaf_Plugin_Abstract::preDispatch</methodname></member> + <member><methodname>Yaf_Plugin_Abstract::postDispatch</methodname></member> + <member><methodname>Yaf_Plugin_Abstract::dispatchLoopShutdown</methodname></member> + </simplelist> + </refsect1> + </refentry> <!-- Keep this comment at the end of the file Modified: phpdoc/en/trunk/reference/yaf/yaf_plugin_abstract/routerstartup.xml =================================================================== --- phpdoc/en/trunk/reference/yaf/yaf_plugin_abstract/routerstartup.xml 2011-11-26 11:11:27 UTC (rev 319949) +++ phpdoc/en/trunk/reference/yaf/yaf_plugin_abstract/routerstartup.xml 2011-11-26 11:35:46 UTC (rev 319950) @@ -4,7 +4,7 @@ <refentry xml:id="yaf-plugin-abstract.routerstartup" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>Yaf_Plugin_Abstract::routerStartup</refname> - <refpurpose>The routerStartup purpose</refpurpose> + <refpurpose>RouterStartup hook</refpurpose> </refnamediv> <refsect1 role="description"> @@ -15,7 +15,8 @@ <methodparam><type>Yaf_Response_Abstract</type><parameter>response</parameter></methodparam> </methodsynopsis> <para> - + This is the earliest hook in Yaf plugin hook system, if a custom plugin + implement this method, then it will be called before routing a request. </para> &warn.undocumented.func; @@ -51,7 +52,18 @@ </para> </refsect1> + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <member><methodname>Yaf_Plugin_Abstract::routerShutdown</methodname></member> + <member><methodname>Yaf_Plugin_Abstract::dispatchLoopStartup</methodname></member> + <member><methodname>Yaf_Plugin_Abstract::preDispatch</methodname></member> + <member><methodname>Yaf_Plugin_Abstract::postDispatch</methodname></member> + <member><methodname>Yaf_Plugin_Abstract::dispatchLoopShutdown</methodname></member> + </simplelist> + </refsect1> + </refentry> <!-- Keep this comment at the end of the file

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