Files
doc-fr/reference/strings/functions/get-html-translation-table.xml
T
Damien Seguy d8a7dfa99c synch with en
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@278208 c90b9560-bf6c-de11-be94-00142212c4b1
2009-04-03 12:06:19 +00:00

134 lines
4.0 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.21 $ -->
<!-- EN-Revision: 1.15 Maintainer: yannick Status: ready -->
<!-- Reviewed: yes -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.get-html-translation-table">
<refnamediv>
<refname>get_html_translation_table</refname>
<refpurpose>Retourne la table de traduction des entités utilisée par <function>htmlspecialchars</function> et <function>htmlentities</function></refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>get_html_translation_table</methodname>
<methodparam choice="opt"><type>int</type><parameter>table</parameter><initializer>HTML_SPECIALCHARS</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>quote_style</parameter><initializer>ENT_COMPAT</initializer></methodparam>
</methodsynopsis>
<para>
<function>get_html_translation_table</function> retourne la table
de traduction des entités utilisée en interne par les fonctions
<function>htmlspecialchars</function> et
<function>htmlentities</function>.
</para>
<note>
<para>
Les caractères spéciaux peuvent être encodés de différentes façon. E.g.
<literal>"</literal> peut être encodé comme <literal>&amp;quot;</literal>,
<literal>&amp;#34;</literal> ou <literal>&amp;#x22</literal>.
<function>get_html_translation_table</function> retourne uniquement
la forme la plus courante d'encodage.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>table</parameter></term>
<listitem>
<para>
Il existe deux constantes (<constant>HTML_ENTITIES</constant> et
<constant>HTML_SPECIALCHARS</constant>), qui vous permettent de
spécifier la table que vous souhaitez. Le paramètre <parameter>table</parameter>
vaut par défaut <constant>HTML_SPECIALCHARS</constant>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>quote_style</parameter></term>
<listitem>
<para>
Et comme dans les fonctions <function>htmlspecialchars</function> et
<function>htmlentities</function>, vous pouvez optionnellement
spécifier le type de guillemets que vous voulez utiliser. Le comportement
par défaut est le mode <constant>ENT_COMPAT</constant>. Pour la
description de ces modes, reportez-vous à
<function>htmlspecialchars</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Retourne la table de traduction, sous la forme d'un tableau.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Exemple avec la table de traduction des caractères en entités HTML</title>
<programlisting role="php">
<![CDATA[
<?php
$trans = get_html_translation_table(HTML_ENTITIES);
$str = "Hallo & <Frau> & Krämer";
$encoded = strtr($str, $trans);
echo $encoded;
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Hallo &amp;amp; &amp;lt;Frau&amp;gt; &amp;amp; Kr&amp;auml;mer
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>htmlspecialchars</function></member>
<member><function>htmlentities</function></member>
<member><function>html_entity_decode</function></member>
</simplelist>
</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:"../../../../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
-->