Просмотр исходного кода

[ZF-8957] Zend_Filter:

- added section for Zend_Filter_Alnum

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22136 44c647ce-9c0f-0410-b52a-842ac1e357ba
thomas 15 лет назад
Родитель
Сommit
94bb63d9fe

+ 85 - 0
documentation/manual/en/module_specs/Zend_Filter-Alnum.xml

@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<sect2 id="zend.filter.set.alnum">
+    <title>Alnum</title>
+
+    <para>
+        <classname>Zend_Filter_Alnum</classname> is a filter which returns only alphabetic
+        characters and digits. All other characters are supressed.
+    </para>
+
+    <sect3 id="zend.validate.set.alnum.options">
+        <title>Supported options for Zend_Filter_Alnum</title>
+
+        <para>
+            The following options are supported for <classname>Zend_Filter_Alnum</classname>:
+        </para>
+
+        <itemizedlist>
+            <listitem>
+                <para>
+                    <emphasis><property>allowwhitespace</property></emphasis>: If this option is set
+                    then whitespace characters are allowed. Otherwise they are supressed. Per
+                    default whitespaces are not allowed.
+                </para>
+            </listitem>
+        </itemizedlist>
+    </sect3>
+
+    <sect3 id="zend.filter.set.alnum.basic">
+        <title>Basic usage</title>
+
+        <para>
+            See the following example for the default behaviour of this filter.
+        </para>
+
+        <programlisting language="php"><![CDATA[
+$filter = new Zend_Filter_Alnum();
+$return = $filter->filter('This is (my) content: 123');
+// returns 'Thisismycontent123'
+]]></programlisting>
+
+        <para>
+            The above example returns 'Thisismycontent123'. As you see all whitespaces and also the
+            brackets are filtered.
+        </para>
+
+        <note>
+            <para>
+                <classname>Zend_Filter_Alnum</classname> works on almost all languages. But actually
+                there are three exceptions: Chinese, Japanese and Korean. Within these languages the
+                english alphabet is use instead of the characters from these languages. The language
+                itself is detected by using <classname>Zend_Locale</classname>.
+            </para>
+        </note>
+    </sect3>
+
+    <sect3 id="zend.filter.set.alnum.whitespace">
+        <title>Allow whitespaces</title>
+
+        <para>
+            <classname>Zend_Filter_Alnum</classname> can also allow whitespaces. This can be usefull
+            when you want to strip special chars from a text. See the following example:
+        </para>
+
+        <programlisting language="php"><![CDATA[
+$filter = new Zend_Filter_Alnum(array('allowwhitespace' => true));
+$return = $filter->filter('This is (my) content: 123');
+// returns 'This is my content 123'
+]]></programlisting>
+
+        <para>
+            The above example returns 'This is my content 123'. As you see only the brackets are
+            filtered whereas the whitespaces are not touched.
+        </para>
+
+        <para>
+            To change <property>allowWhiteSpace</property> afterwards you can use
+            <methodname>setAllowWhiteSpace</methodname> and
+            <methodname>getAllowWhiteSpace</methodname>.
+        </para>
+    </sect3>
+</sect2>
+<!--
+vim:se ts=4 sw=4 et:
+-->

+ 1 - 18
documentation/manual/en/module_specs/Zend_Filter-Set.xml

@@ -7,24 +7,7 @@
         Zend Framework comes with a standard set of filters, which are ready for you to use.
     </para>
 
-    <sect2 id="zend.filter.set.alnum">
-        <title>Alnum</title>
-
-        <para>
-            Returns the string <varname>$value</varname>, removing all but alphabetic and digit
-            characters. This filter includes an option to also allow white space characters.
-        </para>
-
-        <note>
-            <para>
-                The alphabetic characters mean characters that makes up words in each language.
-                However, the english alphabet is treated as the alphabetic characters in following
-                languages: Chinese, Japanese, Korean. The language is specified by
-                <classname>Zend_Locale</classname>.
-            </para>
-        </note>
-
-    </sect2>
+    <xi:include href="Zend_Filter-Alnum.xml" />
 
     <sect2 id="zend.filter.set.alpha">
         <title>Alpha</title>