Skip to content

Commit

Permalink
initial translation in yaf/yaf_dispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardolara committed Dec 6, 2024
1 parent 71a73f3 commit a437388
Show file tree
Hide file tree
Showing 23 changed files with 1,705 additions and 0 deletions.
106 changes: 106 additions & 0 deletions reference/yaf/yaf_dispatcher/autorender.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 4d17b7b4947e7819ff5036715dd706be87ae4def Maintainer: leonardolara Status: ready -->

<refentry xml:id="yaf-dispatcher.autorender" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Yaf_Dispatcher::autoRender</refname>
<refpurpose>Ativa/desativa a renderização automática</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>Yaf_Dispatcher</type><methodname>Yaf_Dispatcher::autoRender</methodname>
<methodparam choice="opt"><type>bool</type><parameter>flag</parameter></methodparam>
</methodsynopsis>
<para>
<classname>Yaf_Dispatcher</classname> será renderizado automaticamente após
despachar uma solicitação recebida, pode-se evitar a renderização chamando
este método com <parameter>flag</parameter> igual a &true;.
<note>
<para>
Pode-se simplesmente retornar &false; em uma ação para evitar a renderização automática
dessa ação.
</para>
</note>
</para>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>flag</parameter></term>
<listitem>
<para>
bool
<note>
<para>
Desde a versão 2.2.0, se este parâmetro não for informado, o estado
atual será retornado.
</para>
</note>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>

</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example>
<title>Exemplo de <function>Yaf_Dispatcher::autoRender</function></title>
<programlisting role="php">
<![CDATA[
<?php
class IndexController extends Yaf_Controller_Abstract {
/* O método init() será chamado assim que um controlador for inicializado */
public function init() {
if ($this->getRequest()->isXmlHttpRequest()) {
// Não chama render para solicitação ajax,
// uma string json será gerada
Yaf_Dispatcher::getInstance()->autoRender(FALSE);
}
}
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
]]>
</screen>
</example>
</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
-->
120 changes: 120 additions & 0 deletions reference/yaf/yaf_dispatcher/catchexception.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 4d17b7b4947e7819ff5036715dd706be87ae4def Maintainer: leonardolara Status: ready -->

<refentry xml:id="yaf-dispatcher.catchexception" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Yaf_Dispatcher::catchException</refname>
<refpurpose>Ativa/desativa a captura de exceções</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>Yaf_Dispatcher</type><methodname>Yaf_Dispatcher::catchException</methodname>
<methodparam choice="opt"><type>bool</type><parameter>flag</parameter></methodparam>
</methodsynopsis>
<para>
Enquanto application.dispatcher.throwException estiver On (pode-se também chamar
<methodname>Yaf_Dispatcher::throwException(TRUE)</methodname> para habilitá-lo), Yaf lançará uma Exception quando
ocorrer um erro, em vez de emitir um erro.
</para>
<para>
Se <methodname>Yaf_Dispatcher::catchException</methodname> for ativado (também pode ser ativado definindo
<link linkend="configuration.yaf.dispatcher.catchexception">application.dispatcher.catchException</link>),
todas as exceções não capturadas serão ser capturadas por ErrorController::error se estiver definido.
</para>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>flag</parameter></term>
<listitem>
<para>
Booleano.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>

</para>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example>
<title>Exemplo de <function>Yaf_Dispatcher::catchException</function></title>
<programlisting role="php">
<![CDATA[
/* Definido um ErrorController */
<?php
class ErrorController extends Yaf_Controller_Abstract {
/**
* Também pode-se chamar Yaf_Request_Abstract::getException para obter a
* exceção não capturada.
*/
public function errorAction($exception) {
/* ocorre o erro */
switch ($exception->getCode()) {
case YAF_ERR_NOTFOUND_MODULE:
case YAF_ERR_NOTFOUND_CONTROLLER:
case YAF_ERR_NOTFOUND_ACTION:
case YAF_ERR_NOTFOUND_VIEW:
echo 404, ":", $exception->getMessage();
break;
default :
$message = $exception->getMessage();
echo 0, ":", $exception->getMessage();
break;
}
}
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
/* Agora, se ocorrer algum erro, supondo que um controlador inexistente seja acessado (ou que uma exceção seja lançada pelo usuário): */
404:Could not find controller script **/aplicacao/controladores/controlador_nao_existente.php
]]>
</screen>
</example>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><methodname>Yaf_Dispatcher::throwException</methodname></member>
<member><methodname>Yaf_Dispatcher::setErrorHandler</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
-->
56 changes: 56 additions & 0 deletions reference/yaf/yaf_dispatcher/construct.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 4d17b7b4947e7819ff5036715dd706be87ae4def Maintainer: leonardolara Status: ready -->

<refentry xml:id="yaf-dispatcher.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Yaf_Dispatcher::__construct</refname>
<refpurpose>Construtor de Yaf_Dispatcher</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<constructorsynopsis>
<modifier>public</modifier> <methodname>Yaf_Dispatcher::__construct</methodname>
<void />
</constructorsynopsis>
<para>

</para>

</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
-->
61 changes: 61 additions & 0 deletions reference/yaf/yaf_dispatcher/disableview.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 4d17b7b4947e7819ff5036715dd706be87ae4def Maintainer: leonardolara Status: ready -->

<refentry xml:id="yaf-dispatcher.disableview" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Yaf_Dispatcher::disableView</refname>
<refpurpose>Desativa a renderização de visualização</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>Yaf_Dispatcher::disableView</methodname>
<void />
</methodsynopsis>
<para>
Desativa o mecanismo de visualização, usado em alguns aplicativos em que o próprio usuário gerará a saída.
<note>
<para>
Pode-se simplesmente retornar &false; em uma ação para evitar a renderização automática
dessa ação.
</para>
</note>
</para>
</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
-->
Loading

0 comments on commit a437388

Please sign in to comment.