|
@@ -18,41 +18,47 @@
|
|
|
<itemizedlist>
|
|
<itemizedlist>
|
|
|
<listitem>
|
|
<listitem>
|
|
|
<para>
|
|
<para>
|
|
|
- <emphasis><property>quotestyle</property></emphasis>: Equivalent to the PHP
|
|
|
|
|
- <varname>htmlentities</varname> native function parameter <emphasis>quote_style</emphasis>.
|
|
|
|
|
- This allows you to define what will be done with 'single' and "double" quotes. It accepts
|
|
|
|
|
- constants: (ENT_COMPAT, ENT_QUOTES, ENT_NOQUOTES) with the default being ENT_COMPAT.
|
|
|
|
|
|
|
+ <emphasis><property>quotestyle</property></emphasis>: Equivalent to the
|
|
|
|
|
+ <acronym>PHP</acronym> htmlentities native function parameter
|
|
|
|
|
+ <emphasis>quote_style</emphasis>. This allows you to define what will be done
|
|
|
|
|
+ with 'single' and "double" quotes. The following constants are accepted:
|
|
|
|
|
+
|
|
|
|
|
+ <constant>ENT_COMPAT</constant>, <constant>ENT_QUOTES</constant>
|
|
|
|
|
+ <constant>ENT_NOQUOTES</constant> with the default being
|
|
|
|
|
+ <constant>ENT_COMPAT</constant>.
|
|
|
</para>
|
|
</para>
|
|
|
</listitem>
|
|
</listitem>
|
|
|
<listitem>
|
|
<listitem>
|
|
|
<para>
|
|
<para>
|
|
|
- <emphasis><property>charset</property></emphasis>: Equivalent to the PHP
|
|
|
|
|
- <varname>htmlentities</varname> native function parameter <emphasis>charset</emphasis>.
|
|
|
|
|
- This defines the character set to be used in filtering. Unlike the PHP native function
|
|
|
|
|
- the default is 'UTF-8'. See "http://php.net/htmlentities" for a list of supported character sets.
|
|
|
|
|
|
|
+ <emphasis><property>charset</property></emphasis>: Equivalent to the
|
|
|
|
|
+ <acronym>PHP</acronym> htmlentities native function parameter
|
|
|
|
|
+ <emphasis>charset</emphasis>. This defines the character set to be used in
|
|
|
|
|
+ filtering. Unlike the <acronym>PHP</acronym> native function the default is
|
|
|
|
|
+ 'UTF-8'. See "http://php.net/htmlentities" for a list of supported character
|
|
|
|
|
+ sets.
|
|
|
</para>
|
|
</para>
|
|
|
|
|
|
|
|
<note>
|
|
<note>
|
|
|
<para>
|
|
<para>
|
|
|
- This option can also be set via the <varname>$options</varname> parameter as a Zend_Config
|
|
|
|
|
- object or array. The option key will be accepted as either <varname>charset</varname> or
|
|
|
|
|
- <varname>encoding</varname>.
|
|
|
|
|
|
|
+ This option can also be set via the <varname>$options</varname> parameter as a
|
|
|
|
|
+ <classname>Zend_Config</classname> object or array. The option key will be
|
|
|
|
|
+ accepted as either charset or encoding.
|
|
|
</para>
|
|
</para>
|
|
|
</note>
|
|
</note>
|
|
|
</listitem>
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
<listitem>
|
|
|
<para>
|
|
<para>
|
|
|
- <emphasis><property>doublequote</property></emphasis>: Equivalent to the PHP
|
|
|
|
|
- <varname>htmlentities</varname> native function parameter <emphasis>double_encode</emphasis>.
|
|
|
|
|
- If set to <varname>false</varname> existing html entities will not be encoded. The default is
|
|
|
|
|
- to convert everything (<varname>true</varname>).
|
|
|
|
|
|
|
+ <emphasis><property>doublequote</property></emphasis>: Equivalent to the
|
|
|
|
|
+ <acronym>PHP</acronym> htmlentities native function parameter
|
|
|
|
|
+ <emphasis>double_encode</emphasis>. If set to false existing html entities will
|
|
|
|
|
+ not be encoded. The default is to convert everything (true).
|
|
|
</para>
|
|
</para>
|
|
|
|
|
|
|
|
<note>
|
|
<note>
|
|
|
<para>
|
|
<para>
|
|
|
This option must be set via the <varname>$options</varname> parameter or the
|
|
This option must be set via the <varname>$options</varname> parameter or the
|
|
|
- setDoubleEncode() method.
|
|
|
|
|
|
|
+ <methodname>setDoubleEncode()</methodname> method.
|
|
|
</para>
|
|
</para>
|
|
|
</note>
|
|
</note>
|
|
|
</listitem>
|
|
</listitem>
|
|
@@ -69,8 +75,7 @@
|
|
|
<programlisting language="php"><![CDATA[
|
|
<programlisting language="php"><![CDATA[
|
|
|
$filter = new Zend_Filter_HtmlEntities();
|
|
$filter = new Zend_Filter_HtmlEntities();
|
|
|
|
|
|
|
|
-$return = $filter->filter('<');
|
|
|
|
|
-// returns '<'
|
|
|
|
|
|
|
+print $filter->filter('<');
|
|
|
]]></programlisting>
|
|
]]></programlisting>
|
|
|
</sect3>
|
|
</sect3>
|
|
|
|
|
|
|
@@ -78,22 +83,22 @@ $return = $filter->filter('<');
|
|
|
<title>Quote Style</title>
|
|
<title>Quote Style</title>
|
|
|
|
|
|
|
|
<para>
|
|
<para>
|
|
|
- <classname>Zend_Filter_HtmlEntities</classname> allows changing the quote style used. This can be useful
|
|
|
|
|
- when you want to leave double, single, or both types of quotes un-filtered. See the following example:
|
|
|
|
|
|
|
+ <classname>Zend_Filter_HtmlEntities</classname> allows changing the quote style used.
|
|
|
|
|
+ This can be useful when you want to leave double, single, or both types of quotes
|
|
|
|
|
+ un-filtered. See the following example:
|
|
|
</para>
|
|
</para>
|
|
|
|
|
|
|
|
<programlisting language="php"><![CDATA[
|
|
<programlisting language="php"><![CDATA[
|
|
|
$filter = new Zend_Filter_HtmlEntities(array('quotestyle' => ENT_QUOTES));
|
|
$filter = new Zend_Filter_HtmlEntities(array('quotestyle' => ENT_QUOTES));
|
|
|
|
|
|
|
|
$input = "A 'single' and " . '"double"';
|
|
$input = "A 'single' and " . '"double"';
|
|
|
-$return = $filter->filter($input);
|
|
|
|
|
-// returns
|
|
|
|
|
-//A 'single' and "double"
|
|
|
|
|
|
|
+print $filter->filter($input);
|
|
|
]]></programlisting>
|
|
]]></programlisting>
|
|
|
|
|
|
|
|
<para>
|
|
<para>
|
|
|
- The above example returns <emphasis>A 'single' and "double"</emphasis>. Notice that 'single' as well
|
|
|
|
|
- as "double" quotes are filtered.
|
|
|
|
|
|
|
+ The above example returns
|
|
|
|
|
+ <emphasis>A 'single' and "double"</emphasis>. Notice that 'single'
|
|
|
|
|
+ as well as "double" quotes are filtered.
|
|
|
</para>
|
|
</para>
|
|
|
|
|
|
|
|
<programlisting language="php"><![CDATA[
|
|
<programlisting language="php"><![CDATA[
|
|
@@ -101,27 +106,24 @@ $filter = new Zend_Filter_HtmlEntities(array('quotestyle' => ENT_COMPAT));
|
|
|
|
|
|
|
|
$input = "A 'single' and " . '"double"';
|
|
$input = "A 'single' and " . '"double"';
|
|
|
$return = $filter->filter($input);
|
|
$return = $filter->filter($input);
|
|
|
-// returns
|
|
|
|
|
-//A 'single' and "double"
|
|
|
|
|
|
|
+print "A 'single' and "double""
|
|
|
]]></programlisting>
|
|
]]></programlisting>
|
|
|
|
|
|
|
|
<para>
|
|
<para>
|
|
|
- The above example returns <emphasis>>A 'single' and "double"</emphasis>. Notice that "double"
|
|
|
|
|
- quotes are filtered while 'single' quotes are not altered.
|
|
|
|
|
|
|
+ The above example returns <emphasis>>A 'single' and "double"</emphasis>.
|
|
|
|
|
+ Notice that "double" quotes are filtered while 'single' quotes are not altered.
|
|
|
</para>
|
|
</para>
|
|
|
|
|
|
|
|
<programlisting language="php"><![CDATA[
|
|
<programlisting language="php"><![CDATA[
|
|
|
$filter = new Zend_Filter_HtmlEntities(array('quotestyle' => ENT_NOQUOTES));
|
|
$filter = new Zend_Filter_HtmlEntities(array('quotestyle' => ENT_NOQUOTES));
|
|
|
|
|
|
|
|
$input = "A 'single' and " . '"double"';
|
|
$input = "A 'single' and " . '"double"';
|
|
|
-$return = $filter->filter($input);
|
|
|
|
|
-// returns:
|
|
|
|
|
-//A 'single' and "double"
|
|
|
|
|
|
|
+print $filter->filter($input);
|
|
|
]]></programlisting>
|
|
]]></programlisting>
|
|
|
|
|
|
|
|
<para>
|
|
<para>
|
|
|
- The above example returns <emphasis>A 'single' and "double"</emphasis>. Notice that neither "double" or
|
|
|
|
|
- 'single' quotes are altered.
|
|
|
|
|
|
|
+ The above example returns <emphasis>A 'single' and "double"</emphasis>. Notice that
|
|
|
|
|
+ neither "double" or 'single' quotes are altered.
|
|
|
</para>
|
|
</para>
|
|
|
|
|
|
|
|
</sect3>
|
|
</sect3>
|
|
@@ -130,50 +132,52 @@ $return = $filter->filter($input);
|
|
|
<title>Helper Methods</title>
|
|
<title>Helper Methods</title>
|
|
|
|
|
|
|
|
<para>
|
|
<para>
|
|
|
- To change or retrieve the <property>quotestyle</property> after instantiation, the two methods
|
|
|
|
|
- <methodname>setQuoteStyle</methodname> and <methodname>getQuoteStyle</methodname> may be used respectively
|
|
|
|
|
- <methodname>setQuoteStyle</methodname> accepts one parameter ($quoteStyle); the following constants are
|
|
|
|
|
- acceptable: (ENT_COMPAT, ENT_QUOTES, ENT_NOQUOTES).
|
|
|
|
|
|
|
+ To change or retrieve the <property>quotestyle</property> after instantiation, the two
|
|
|
|
|
+ methods <methodname>setQuoteStyle()</methodname> and
|
|
|
|
|
+ <methodname>getQuoteStyle()</methodname> may be used respectively
|
|
|
|
|
+ <methodname>setQuoteStyle()</methodname> accepts one parameter
|
|
|
|
|
+ <varname>$quoteStyle</varname>; The following constants are accepted:
|
|
|
|
|
+
|
|
|
|
|
+ <constant>ENT_COMPAT</constant>, <constant>ENT_QUOTES</constant>,
|
|
|
|
|
+ <constant>ENT_NOQUOTES</constant>
|
|
|
</para>
|
|
</para>
|
|
|
|
|
|
|
|
<programlisting language="php"><![CDATA[
|
|
<programlisting language="php"><![CDATA[
|
|
|
$filter = new Zend_Filter_HtmlEntities();
|
|
$filter = new Zend_Filter_HtmlEntities();
|
|
|
|
|
|
|
|
$filter->setQuoteStyle(ENT_QUOTES);
|
|
$filter->setQuoteStyle(ENT_QUOTES);
|
|
|
-$return = $filter->getQuoteStyle(ENT_QUOTES);
|
|
|
|
|
-// returns 3
|
|
|
|
|
|
|
+print $filter->getQuoteStyle(ENT_QUOTES);
|
|
|
]]></programlisting>
|
|
]]></programlisting>
|
|
|
|
|
|
|
|
- <para>
|
|
|
|
|
- To change or retrieve the <property>charset</property> after instantiation, the two methods
|
|
|
|
|
- <methodname>setCharSet</methodname> and <methodname>getCharSet</methodname> may be used respectively.
|
|
|
|
|
- <methodname>setCharSet</methodname> accepts one parameter ($charSet); See "http://php.net/htmlentities"
|
|
|
|
|
- for a list of supported character sets.
|
|
|
|
|
|
|
+ <para>
|
|
|
|
|
+ To change or retrieve the <property>charset</property> after instantiation, the two
|
|
|
|
|
+ methods <methodname>setCharSet()</methodname> and <methodname>getCharSet()</methodname>
|
|
|
|
|
+ may be used respectively. <methodname>setCharSet()</methodname> accepts one parameter
|
|
|
|
|
+ <varname>$charSet</varname>; See "http://php.net/htmlentities" for a list of supported
|
|
|
|
|
+ character sets.
|
|
|
</para>
|
|
</para>
|
|
|
|
|
|
|
|
<programlisting language="php"><![CDATA[
|
|
<programlisting language="php"><![CDATA[
|
|
|
$filter = new Zend_Filter_HtmlEntities();
|
|
$filter = new Zend_Filter_HtmlEntities();
|
|
|
|
|
|
|
|
$filter->setQuoteStyle(ENT_QUOTES);
|
|
$filter->setQuoteStyle(ENT_QUOTES);
|
|
|
-$return = $filter->getQuoteStyle(ENT_QUOTES);
|
|
|
|
|
-// returns 3
|
|
|
|
|
|
|
+print $filter->getQuoteStyle(ENT_QUOTES);
|
|
|
]]></programlisting>
|
|
]]></programlisting>
|
|
|
|
|
|
|
|
- <para>
|
|
|
|
|
- To change or retrieve the <property>doublequote</property> option after instantiation, the two methods
|
|
|
|
|
- <methodname>setDoubleQuote</methodname> and <methodname>getDoubleQuote</methodname> may be used respectively.
|
|
|
|
|
- <methodname>setDoubleQuote</methodname> accepts one boolean parameter ($doubleQuote).
|
|
|
|
|
|
|
+ <para>
|
|
|
|
|
+ To change or retrieve the <property>doublequote</property> option after instantiation,
|
|
|
|
|
+ the two methods <methodname>setDoubleQuote()</methodname> and
|
|
|
|
|
+ <methodname>getDoubleQuote()</methodname> may be used respectively.
|
|
|
|
|
+ <methodname>setDoubleQuote()</methodname> accepts one boolean parameter
|
|
|
|
|
+ <varname>$doubleQuote</varname>.
|
|
|
</para>
|
|
</para>
|
|
|
|
|
|
|
|
<programlisting language="php"><![CDATA[
|
|
<programlisting language="php"><![CDATA[
|
|
|
$filter = new Zend_Filter_HtmlEntities();
|
|
$filter = new Zend_Filter_HtmlEntities();
|
|
|
|
|
|
|
|
$filter->setQuoteStyle(ENT_QUOTES);
|
|
$filter->setQuoteStyle(ENT_QUOTES);
|
|
|
-$return = $filter->getQuoteStyle(ENT_QUOTES);
|
|
|
|
|
-// returns 3
|
|
|
|
|
|
|
+print $filter->getQuoteStyle(ENT_QUOTES);
|
|
|
]]></programlisting>
|
|
]]></programlisting>
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
</sect3>
|
|
</sect3>
|
|
|
|
|
|
|
|
</sect2>
|
|
</sect2>
|