Browse Source

ZF-8958 #comment added manual chapter/section with description and examples for Zend_Filter_Alpha.


git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22240 44c647ce-9c0f-0410-b52a-842ac1e357ba
wilmoore 15 years ago
parent
commit
a72bf7228a

+ 88 - 0
documentation/manual/en/module_specs/Zend_Filter-Alpha.xml

@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<sect2 id="zend.filter.set.alpha">
+    <title>Alnum</title>
+
+    <para>
+        <classname>Zend_Filter_Alpha</classname> is a filter which returns the string <varname>$value</varname>,
+        removing all but alphabetic characters. This filter includes an option to also allow white space characters.
+    </para>
+
+    <sect3 id="zend.filter.set.alpha.options">
+        <title>Supported options for Zend_Filter_Alpha</title>
+
+        <para>
+            The following options are supported for <classname>Zend_Filter_Alpha</classname>:
+        </para>
+
+        <itemizedlist>
+            <listitem>
+                <para>
+                    <emphasis><property>allowwhitespace</property></emphasis>: If this option is set
+                    then whitespace characters are allowed. Otherwise they are suppressed. Per default
+                    whitespace characters are not allowed.
+                </para>
+            </listitem>
+        </itemizedlist>
+    </sect3>
+
+    <sect3 id="zend.filter.set.alpha.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_Alpha();
+$return = $filter->filter('This is (my) content: 123');
+// returns 'Thisismycontent'
+]]></programlisting>
+
+        <para>
+            The above example returns 'Thisismycontent'. Notice that the whitespace characters and
+            brackets are removed.
+        </para>
+
+        <note>
+            <para>
+                <classname>Zend_Filter_Alpha</classname> works on most languages; however, there are
+                three exceptions: Chinese, Japanese and Korean. With these languages the english alphabet
+                is used. The language is detected through the use of <classname>Zend_Locale</classname>.
+            </para>
+        </note>
+    </sect3>
+
+    <sect3 id="zend.filter.set.alpha.whitespace">
+        <title>Allow whitespace characters</title>
+
+        <para>
+            <classname>Zend_Filter_Alpha</classname> can also allow whitespace characters. This can be
+            useful when you want to strip special characters from a string. See the following example:
+        </para>
+
+        <programlisting language="php"><![CDATA[
+$filter = new Zend_Filter_Alpha(array('allowwhitespace' => true));
+$return = $filter->filter('This is (my) content: 123');
+// returns 'This is my content '
+]]></programlisting>
+
+        <para>
+            The above example returns 'This is my content '. Notice that the parenthesis, colon, and
+            numbers have all been removed while the whitespace characters remain.
+        </para>
+
+        <para>
+            To change <property>allowWhiteSpace</property> after instantiation the method
+            <methodname>setAllowWhiteSpace</methodname> may be used.
+        </para>
+
+        <para>
+            To query the current value of <property>allowWhiteSpace</property> the method
+            <methodname>getAllowWhiteSpace</methodname> may be used.
+        </para>
+    </sect3>
+</sect2>
+<!--
+vim:se ts=4 sw=4 et:
+-->

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

@@ -8,15 +8,7 @@
     </para>
 
     <xi:include href="Zend_Filter-Alnum.xml" />
-
-    <sect2 id="zend.filter.set.alpha">
-        <title>Alpha</title>
-
-        <para>
-            Returns the string <varname>$value</varname>, removing all but alphabetic characters.
-            This filter includes an option to also allow white space characters.
-        </para>
-    </sect2>
+    <xi:include href="Zend_Filter-Alpha.xml" />
 
     <sect2 id="zend.filter.set.basename">
         <title>BaseName</title>