com doc/zh: sync to en: added params intro for setRedirect: reference/yaf/tutorials.xml reference/yaf/yaf_plugin_abstra ct/routershutdown.xml
reference/yaf/yaf_response_abstra ct/setredirect.xml

From: Date: Mon, 08 Feb 2021 08:44:04 +0000
Subject: com doc/zh: sync to en: added params intro for setRedirect: reference/yaf/tutorials.xml reference/yaf/yaf_plugin_abstra ct/routershutdown.xml
reference/yaf/yaf_response_abstra ct/setredirect.xml
Groups: php.doc.zh 
Request: Send a blank email to doc-zh+get-5969@lists.php.net to get a copy of this message
Commit: fe9b6f0997f73dd7ae7d4b28eca38fd8e22a35f9 Author: Bole Chen <avenger@php.net> Mon, 8 Feb 2021 16:44:04 +0800 Parents: 48c7f37081e0354dbab007a0be5f3cc96a204839 Branches: master Link: http://git.php.net/?p=doc/zh.git;a=commitdiff;h=fe9b6f0997f73dd7ae7d4b28eca38fd8e22a35f9 Log: sync to en: added params intro for setRedirect Changed paths: M reference/yaf/tutorials.xml M reference/yaf/yaf_plugin_abstract/routershutdown.xml M reference/yaf/yaf_response_abstract/setredirect.xml

diff --git a/reference/yaf/tutorials.xml b/reference/yaf/tutorials.xml index d75d7559..7e25113c 100644 --- a/reference/yaf/tutorials.xml +++ b/reference/yaf/tutorials.xml @@ -1,185 +1,185 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- $Revision$ --> -<!-- EN-Revision: aeac24ae67f87e60b05c8e66f03616d434c9be95 Maintainer: Carbyn Wu Status: ready --> -<!-- Reviewed: no --> - -<chapter xml:id="yaf.tutorials" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> - &reftitle.examples; - - <section role="examples"> - <example> - <title>一个典型的应用目录结构</title> - <screen> -<![CDATA[ -- index.php -- .htaccess -+ conf - |- application.ini //application config -- application/ - - Bootstrap.php - + controllers - - Index.php //default controller - + views - |+ index - - index.phtml //view template for default action - + modules - - library - - models - - plugins -]]> - </screen> - </example> - </section> - - <section role="examples"> - <example> - <title>入口文件</title> - <para>顶层目录下的index.php是整个应用的唯一入口,应该把所有请求都重定向到这个文件(在Apache+php_mod模式下可以使用.htaccess)。</para> - <programlisting role="php"> -<![CDATA[ -<?php -define("APPLICATION_PATH", dirname(__FILE__)); - -$app = new Yaf_Application(APPLICATION_PATH . "/conf/application.ini"); -$app->bootstrap() //call bootstrap methods defined in Bootstrap.php - ->run(); -?> -]]> - </programlisting> - </example> - </section> - - <section role="examples"> - <example> - <title>重写规则</title> - <screen> -<![CDATA[ -#for apache (.htaccess) -RewriteEngine On -RewriteCond %{REQUEST_FILENAME} !-f -RewriteRule .* index.php - -#for nginx -server { - listen ****; - server_name domain.com; - root document_root; - index index.php index.html index.htm; - - if (!-e $request_filename) { - rewrite ^/(.*) /index.php/$1 last; - } -} - -#for lighttpd -$HTTP["host"] =~ "(www.)?domain.com$" { - url.rewrite = ( - "^/(.+)/?$" => "/index.php/$1", - ) -} -]]> - </screen> - </example> - </section> - - <section role="examples"> - <example> - <title>应用配置文件</title> - <programlisting role="ini"> -<![CDATA[ -[yaf] -;APPLICATION_PATH is the constant defined in index.php -application.directory=APPLICATION_PATH "/application/" - -;product section inherit from yaf section -[product:yaf] -foo=bar -]]> - </programlisting> - </example> - </section> - - <section role="examples"> - <example> - <title>默认控制器</title> - <programlisting role="php"> -<![CDATA[ -<?php -class IndexController extends Yaf_Controller_Abstract { - /* default action */ - public function indexAction() { - $this->_view->word = "hello world"; - //or - // $this->getView()->word = "hello world"; - } -} -?> -]]> - </programlisting> - </example> - </section> - - <section role="examples"> - <example> - <title>默认视图文件</title> - <programlisting role="php"> -<![CDATA[ -<html> - <head> - <title>Hello World</title> - </head> - <body> - <?php echo $word;?> - </body> -</html> -]]> - </programlisting> - </example> - </section> - - <section role="examples"> - <example> - <title>运行应用</title> - &example.outputs.similar; - <screen> -<![CDATA[ -<html> - <head> - <title>Hello World</title> - </head> - <body> - hello world - </body> -</html> -]]> - </screen> - <note> - <para> - 在yaf@github上有Yaf代码生成器,你也可以用它来生成上面的例子。 - </para> - </note> - </example> - </section> - -</chapter> - -<!-- Keep this comment at the end of the file -Local variables: -mode: sgml -sgml-omittag:t -sgml-shorttag:t -sgml-minimize-attributes:nil -sgml-always-quote-attributes:t -sgml-indent-step:1 -sgml-indent-data:t -indent-tabs-mode:nil -sgml-parent-document:nil -sgml-default-dtd-file:"~/.phpdoc/manual.ced" -sgml-exposed-tags:nil -sgml-local-catalogs:nil -sgml-local-ecat-files:nil -End: -vim600: syn=xml fen fdm=syntax fdl=2 si -vim: et tw=78 syn=sgml -vi: ts=1 sw=1 ---> +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision$ --> +<!-- EN-Revision: df549f5248a477d03a8b4ae538d47c8852b12890 Maintainer: Carbyn Wu Status: ready --> +<!-- Reviewed: no --> + +<chapter xml:id="yaf.tutorials" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + &reftitle.examples; + + <section role="examples"> + <example> + <title>一个典型的应用目录结构</title> + <screen> +<![CDATA[ +- index.php +- .htaccess ++ conf + |- application.ini //application config +- application/ + - Bootstrap.php + + controllers + - Index.php //default controller + + views + |+ index + - index.phtml //view template for default action + + modules + - library + - models + - plugins +]]> + </screen> + </example> + </section> + + <section role="examples"> + <example> + <title>入口文件</title> + <para>顶层目录下的 index.php 是整个应用的唯一入口,应该把所有请求都重定向到这个文件(在 Apache + php_mod 模式下可以使用 .htaccess)。</para> + <programlisting role="php"> +<![CDATA[ +<?php +define("APPLICATION_PATH", dirname(__FILE__)); + +$app = new Yaf_Application(APPLICATION_PATH . "/conf/application.ini"); +$app->bootstrap() //call bootstrap methods defined in Bootstrap.php + ->run(); +?> +]]> + </programlisting> + </example> + </section> + + <section role="examples"> + <example> + <title>重写规则</title> + <screen> +<![CDATA[ +#for apache (.htaccess) +RewriteEngine On +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule .* index.php + +#for nginx +server { + listen ****; + server_name domain.com; + root document_root; + index index.php index.html index.htm; + + if (!-e $request_filename) { + rewrite ^/(.*) /index.php$1 last; + } +} + +#for lighttpd +$HTTP["host"] =~ "(www.)?domain.com$" { + url.rewrite = ( + "^/(.+)/?$" => "/index.php/$1", + ) +} +]]> + </screen> + </example> + </section> + + <section role="examples"> + <example> + <title>应用配置文件</title> + <programlisting role="ini"> +<![CDATA[ +[yaf] +;APPLICATION_PATH is the constant defined in index.php +application.directory=APPLICATION_PATH "/application/" + +;product section inherit from yaf section +[product:yaf] +foo=bar +]]> + </programlisting> + </example> + </section> + + <section role="examples"> + <example> + <title>默认控制器</title> + <programlisting role="php"> +<![CDATA[ +<?php +class IndexController extends Yaf_Controller_Abstract { + /* default action */ + public function indexAction() { + $this->_view->word = "hello world"; + //or + // $this->getView()->word = "hello world"; + } +} +?> +]]> + </programlisting> + </example> + </section> + + <section role="examples"> + <example> + <title>默认视图文件</title> + <programlisting role="php"> +<![CDATA[ +<html> + <head> + <title>Hello World</title> + </head> + <body> + <?php echo $word;?> + </body> +</html> +]]> + </programlisting> + </example> + </section> + + <section role="examples"> + <example> + <title>运行应用</title> + &example.outputs.similar; + <screen> +<![CDATA[ +<html> + <head> + <title>Hello World</title> + </head> + <body> + hello world + </body> +</html> +]]> + </screen> + <note> + <para> + 在 yaf@github 上有 Yaf 代码生成器,你也可以用它来生成上面的例子。 + </para> + </note> + </example> + </section> + +</chapter> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> diff --git a/reference/yaf/yaf_plugin_abstract/routershutdown.xml b/reference/yaf/yaf_plugin_abstract/routershutdown.xml index 0f254cc1..ff0c935f 100644 --- a/reference/yaf/yaf_plugin_abstract/routershutdown.xml +++ b/reference/yaf/yaf_plugin_abstract/routershutdown.xml @@ -1,121 +1,120 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- $Revision$ --> - -<refentry xml:id="yaf-plugin-abstract.routershutdown" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> - <refnamediv> - <refname>Yaf_Plugin_Abstract::routerShutdown</refname> - <refpurpose>The routerShutdown purpose</refpurpose> - </refnamediv> - - <refsect1 role="description"> - &reftitle.description; - <methodsynopsis> - <modifier>public</modifier> <type>void</type><methodname>Yaf_Plugin_Abstract::routerShutdown</methodname> - <methodparam><type>Yaf_Request_Abstract</type><parameter>request</parameter></methodparam> - <methodparam><type>Yaf_Response_Abstract</type><parameter>response</parameter></methodparam> - </methodsynopsis> - <para> - 这个钩子在路由结束之后触发,通常被用于登陆检查。 - </para> - - &warn.undocumented.func; - - </refsect1> - - <refsect1 role="parameters"> - &reftitle.parameters; - <variablelist> - <varlistentry> - <term><parameter>request</parameter></term> - <listitem> - <para> - - </para> - </listitem> - </varlistentry> - <varlistentry> - <term><parameter>response</parameter></term> - <listitem> - <para> - - </para> - </listitem> - </varlistentry> - </variablelist> - </refsect1> - - <refsect1 role="returnvalues"> - &reftitle.returnvalues; - <para> - - </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 -Local variables: -mode: sgml -sgml-omittag:t -sgml-shorttag:t -sgml-minimize-attributes:nil -sgml-always-quote-attributes:t -sgml-indent-step:1 -sgml-indent-data:t -indent-tabs-mode:nil -sgml-parent-document:nil -sgml-default-dtd-file:"~/.phpdoc/manual.ced" -sgml-exposed-tags:nil -sgml-local-catalogs:nil -sgml-local-ecat-files:nil -End: -vim600: syn=xml fen fdm=syntax fdl=2 si -vim: et tw=78 syn=sgml -vi: ts=1 sw=1 ---> +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision$ --> +<!-- EN-Revision: df549f5248a477d03a8b4ae538d47c8852b12890 Maintainer: avenger Status: ready --> + +<refentry xml:id="yaf-plugin-abstract.routershutdown" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>Yaf_Plugin_Abstract::routerShutdown</refname> + <refpurpose>The routerShutdown purpose</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <modifier>public</modifier> <type>void</type><methodname>Yaf_Plugin_Abstract::routerShutdown</methodname> + <methodparam><type>Yaf_Request_Abstract</type><parameter>request</parameter></methodparam> + <methodparam><type>Yaf_Response_Abstract</type><parameter>response</parameter></methodparam> + </methodsynopsis> + <para> + 这个钩子在路由结束之后触发,通常被用于登陆检查。 + </para> + + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <variablelist> + <varlistentry> + <term><parameter>request</parameter></term> + <listitem> + <para> + + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>response</parameter></term> + <listitem> + <para> + + </para> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + + </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->setRedirect("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 +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> diff --git a/reference/yaf/yaf_response_abstract/setredirect.xml b/reference/yaf/yaf_response_abstract/setredirect.xml index d358dfea..e4ddf8f0 100644 --- a/reference/yaf/yaf_response_abstract/setredirect.xml +++ b/reference/yaf/yaf_response_abstract/setredirect.xml @@ -1,58 +1,66 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- $Revision$ --> - -<refentry xml:id="yaf-response-abstract.setredirect" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> - <refnamediv> - <refname>Yaf_Response_Abstract::setRedirect</refname> - <refpurpose>The setRedirect purpose</refpurpose> - </refnamediv> - - <refsect1 role="description"> - &reftitle.description; - <methodsynopsis> - <modifier>public</modifier> <type>void</type><methodname>Yaf_Response_Abstract::setRedirect</methodname> - <void /> - </methodsynopsis> - <para> - - </para> - - &warn.undocumented.func; - - </refsect1> - - <refsect1 role="parameters"> - &reftitle.parameters; - &no.function.parameters; - </refsect1> - - <refsect1 role="returnvalues"> - &reftitle.returnvalues; - <para> - - </para> - </refsect1> - - -</refentry> - -<!-- Keep this comment at the end of the file -Local variables: -mode: sgml -sgml-omittag:t -sgml-shorttag:t -sgml-minimize-attributes:nil -sgml-always-quote-attributes:t -sgml-indent-step:1 -sgml-indent-data:t -indent-tabs-mode:nil -sgml-parent-document:nil -sgml-default-dtd-file:"~/.phpdoc/manual.ced" -sgml-exposed-tags:nil -sgml-local-catalogs:nil -sgml-local-ecat-files:nil -End: -vim600: syn=xml fen fdm=syntax fdl=2 si -vim: et tw=78 syn=sgml -vi: ts=1 sw=1 ---> +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision$ --> +<!-- EN-Revision: df549f5248a477d03a8b4ae538d47c8852b12890 Maintainer: avenger Status: ready --> + +<refentry xml:id="yaf-response-abstract.setredirect" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>Yaf_Response_Abstract::setRedirect</refname> + <refpurpose>The setRedirect purpose</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <modifier>public</modifier> <type>bool</type><methodname>Yaf_Response_Abstract::setRedirect</methodname> + <methodparam><type>string</type><parameter>url</parameter></methodparam> + </methodsynopsis> + <para> + + </para> + + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <variablelist> + <varlistentry> + <term><parameter>url</parameter></term> + <listitem> + <para> + 要跳转到的地址 + </para> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + + </para> + </refsect1> + + +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +-->
« previous php.doc.zh (#5969) next »