Files
doc-fr/reference/strings/functions/htmlentities.xml
Hannes Magnusson 069f6629d8 - Bunch of build fixes
- Upgrade to DocBook5:
  - All id attributes are now xml:id
  - Add docbook namespace to all root elements
  - Replace <ulink /> with <link xlink:href />
  - Minor markup fixes here and there


git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@238217 c90b9560-bf6c-de11-be94-00142212c4b1
2007-06-21 17:05:05 +00:00

128 lines
4.1 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.15 $ -->
<!-- EN-Revision: 1.11 Maintainer: yannick Status: ready -->
<!-- Reviewed: yes -->
<refentry xml:id="function.htmlentities" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>htmlentities</refname>
<refpurpose>
Convertit tous les caractères éligibles en entités HTML
</refpurpose>
</refnamediv>
<refsect1>
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>htmlentities</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>quote_style</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>charset</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>double_encode</parameter></methodparam>
</methodsynopsis>
<para>
<methodname>htmlentities</methodname> est identique à la fonction
<function>htmlspecialchars</function>, sauf que tous les caractères
qui ont des équivalents en entités HTML sont effectivement
traduits.
</para>
<para>
Comme <function>htmlspecialchars</function>, cette
fonction prend un deuxième argument optionnel, qui indique
comment doivent être traités les guillemets doubles et simples.
Vous pouvez utiliser l'une des constantes suivantes la valeur par
défaut étant <constant>ENT_COMPAT</constant> :
<table>
<title>Constantes disponibles pour <parameter>quote_style</parameter></title>
<tgroup cols="2">
<thead>
<row>
<entry>Nom</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><constant>ENT_COMPAT</constant></entry>
<entry>Convertit les guillemets doubles, et ignore les guillemets simples</entry>
</row>
<row>
<entry><constant>ENT_QUOTES</constant></entry>
<entry>Convertit les guillemets doubles et les guillemets simples</entry>
</row>
<row>
<entry><constant>ENT_NOQUOTES</constant></entry>
<entry>Ignore les guillemets doubles et les guillemets simples</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
Comme <function>htmlspecialchars</function>, cette fonction prend un
troisième argument optionnel qui définit le jeu de caractères
utilisé durant la conversion. Actuellement, le jeu de caractères
ISO-8859-1 est utilisé par défaut.
</para>
&reference.strings.charsets;
<para>
Lorsque <parameter>double_encode</parameter> est désactivé, &php; n'encodera pas
les entités html existantes. Par défaut, tout est convertie.
</para>
<para>
Le paramètre <parameter>double_quote</parameter> a été ajouté en &php; 5.2.3,
le paramètre <parameter>charset</parameter> en 4.1.0 et
le paramètre <parameter>quote</parameter> en &php; 4.0.3.
</para>
<para>
Si vous voulez réaliser l'opération inverse, vous devez utiliser
la fonction <function>html_entity_decode</function>.
</para>
<para>
<example>
<title>Exemple avec <function>htmlentities</function></title>
<programlisting role="php">
<![CDATA[
<?php
$str = 'Un \'apostrophe\' en <strong>gras</strong>';
// Affiche : Un 'apostrophe' en &lt;strong&gt;gras&lt;/strong&gt;
echo htmlentities($str);
// Affiche : Un &#039;apostrophe&#039; en &lt;strong&gt;gras&lt;/strong&gt;
echo htmlentities($str, ENT_QUOTES);
?>
]]>
</programlisting>
</example>
</para>
<para>
Voir aussi
<function>html_entity_decode</function>,
<function>get_html_translation_table</function>,
<function>htmlspecialchars</function>,
<function>nl2br</function> et
<function>urlencode</function>.
</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
-->