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

[ZF-8967, ZF-8968] Zend_Validate:

- added section for Zend_Validate_Alpha
- added section for Zend_Validate_Alnum

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

+ 102 - 0
documentation/manual/en/module_specs/Zend_Validate-Alnum.xml

@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<sect2 id="zend.validate.set.alnum">
+    <title>Alnum</title>
+
+    <para>
+        <classname>Zend_Validate_Alnum</classname> allows you to validate if a given value contains
+        only alphabetical characters and digits. There is no length limitation for the input
+        you want to validate.
+    </para>
+
+    <sect3 id="zend.validate.set.alnum.options">
+        <title>Supported options for Zend_Validate_Alnum</title>
+
+        <para>
+            The following options are supported for <classname>Zend_Validate_Alnum</classname>:
+        </para>
+
+        <itemizedlist>
+            <listitem>
+                <para>
+                    <emphasis><property>allowWhiteSpace</property></emphasis>: If whitespace
+                    characters are allowed. This option defaults to <constant>FALSE</constant>
+                </para>
+            </listitem>
+    </sect3>
+
+    <sect3 id="zend.validate.set.alnum.basic">
+        <title>Basic usage</title>
+
+        <para>
+            A basic example is the following one:
+        </para>
+
+        <programlisting language="php"><![CDATA[
+$validator = new Zend_Validate_Alnum();
+if ($validator->isValid('Abcd12')) {
+    // value contains only allowed chars
+} else {
+    // false
+}
+]]></programlisting>
+    </sect3>
+
+    <sect3 id="zend.validate.set.alnum.whitespace">
+        <title>Using whitespaces</title>
+
+        <para>
+            Per default whitespaces are not accepted because they are not part of the alphabet.
+            Still, there is a way to accept them as input. This allows to validate complete
+            sentences or phrases.
+        </para>
+
+        <para>
+            To allow the usage of whitespaces you need to give the
+            <property>allowWhiteSpace</property> option. This can be done while creating an instance
+            of the validator, or afterwards by using <methodname>setAllowWhiteSpace()</methodname>.
+            To get the actual state you can use <methodname>getAllowWhiteSpace()</methodname>.
+        </para>
+
+        <programlisting language="php"><![CDATA[
+$validator = new Zend_Validate_Alnum(array('allowWhiteSpace' => true));
+if ($validator->isValid('Abcd and 12')) {
+    // value contains only allowed chars
+} else {
+    // false
+}
+]]></programlisting>
+    </sect3>
+
+    <sect3 id="zend.validate.set.alnum.languages">
+        <title>Using different languages</title>
+
+        <para>
+            When using <classname>Zend_Validate_Alnum</classname> then the language which the user
+            sets within his browser will be used to set the allowed characters. This means when your
+            user sets <emphasis>de</emphasis> for german then he can also enter characters like
+            <emphasis>ä</emphasis>, <emphasis>ö</emphasis> and <emphasis>ü</emphasis> additionally
+            to the characters from the english alphabet.
+        </para>
+
+        <para>
+            Which characters are allowed depends completly on the used language as every language
+            defines it's own set of characters.
+        </para>
+
+        <para>
+            There are actually 3 languages which are not accepted in their own script. These
+            languages are <emphasis>korean</emphasis>, <emphasis>japanese</emphasis> and
+            <emphasis>chinese</emphasis> because this languages are using an alphabet where a
+            single character is build by using multiple characters.
+        </para>
+
+        <para>
+            In the case you are using these languages, the input will only be validated by using
+            the english alphabet.
+        </para>
+    </sect3>
+</sect2>
+<!--
+vim:se ts=4 sw=4 et:
+-->

+ 103 - 0
documentation/manual/en/module_specs/Zend_Validate-Alpha.xml

@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<sect2 id="zend.validate.set.alpha">
+    <title>Alpha</title>
+
+    <para>
+        <classname>Zend_Validate_Alpha</classname> allows you to validate if a given value contains
+        only alphabetical characters. There is no length limitation for the input you want to
+        validate. This validator is related to the <classname>Zend_Validate_Alnum</classname>
+        validator with the exception that it does not accept digits.
+    </para>
+
+    <sect3 id="zend.validate.set.alpha.options">
+        <title>Supported options for Zend_Validate_Alpha</title>
+
+        <para>
+            The following options are supported for <classname>Zend_Validate_Alpha</classname>:
+        </para>
+
+        <itemizedlist>
+            <listitem>
+                <para>
+                    <emphasis><property>allowWhiteSpace</property></emphasis>: If whitespace
+                    characters are allowed. This option defaults to <constant>FALSE</constant>
+                </para>
+            </listitem>
+    </sect3>
+
+    <sect3 id="zend.validate.set.alpha.basic">
+        <title>Basic usage</title>
+
+        <para>
+            A basic example is the following one:
+        </para>
+
+        <programlisting language="php"><![CDATA[
+$validator = new Zend_Validate_Alpha();
+if ($validator->isValid('Abcd')) {
+    // value contains only allowed chars
+} else {
+    // false
+}
+]]></programlisting>
+    </sect3>
+
+    <sect3 id="zend.validate.set.alpha.whitespace">
+        <title>Using whitespaces</title>
+
+        <para>
+            Per default whitespaces are not accepted because they are not part of the alphabet.
+            Still, there is a way to accept them as input. This allows to validate complete
+            sentences or phrases.
+        </para>
+
+        <para>
+            To allow the usage of whitespaces you need to give the
+            <property>allowWhiteSpace</property> option. This can be done while creating an instance
+            of the validator, or afterwards by using <methodname>setAllowWhiteSpace()</methodname>.
+            To get the actual state you can use <methodname>getAllowWhiteSpace()</methodname>.
+        </para>
+
+        <programlisting language="php"><![CDATA[
+$validator = new Zend_Validate_Alpha(array('allowWhiteSpace' => true));
+if ($validator->isValid('Abcd and efg')) {
+    // value contains only allowed chars
+} else {
+    // false
+}
+]]></programlisting>
+    </sect3>
+
+    <sect3 id="zend.validate.set.alpha.languages">
+        <title>Using different languages</title>
+
+        <para>
+            When using <classname>Zend_Validate_Alpha</classname> then the language which the user
+            sets within his browser will be used to set the allowed characters. This means when your
+            user sets <emphasis>de</emphasis> for german then he can also enter characters like
+            <emphasis>ä</emphasis>, <emphasis>ö</emphasis> and <emphasis>ü</emphasis> additionally
+            to the characters from the english alphabet.
+        </para>
+
+        <para>
+            Which characters are allowed depends completly on the used language as every language
+            defines it's own set of characters.
+        </para>
+
+        <para>
+            There are actually 3 languages which are not accepted in their own script. These
+            languages are <emphasis>korean</emphasis>, <emphasis>japanese</emphasis> and
+            <emphasis>chinese</emphasis> because this languages are using an alphabet where a
+            single character is build by using multiple characters.
+        </para>
+
+        <para>
+            In the case you are using these languages, the input will only be validated by using
+            the english alphabet.
+        </para>
+    </sect3>
+</sect2>
+<!--
+vim:se ts=4 sw=4 et:
+-->

+ 2 - 29
documentation/manual/en/module_specs/Zend_Validate-Set.xml

@@ -8,35 +8,8 @@
         use.
     </para>
 
-    <sect2 id="zend.validate.set.alnum">
-        <title>Alnum</title>
-
-        <para>
-            Returns <constant>TRUE</constant> if and only if <varname>$value</varname> contains only
-            alphabetic and digit characters. This validator includes an option to also consider
-            white space characters as valid.
-        </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>
-
-    <sect2 id="zend.validate.set.alpha">
-        <title>Alpha</title>
-
-        <para>
-            Returns <constant>TRUE</constant> if and only if <varname>$value</varname> contains only
-            alphabetic characters. This validator includes an option to also consider white space
-            characters as valid.
-        </para>
-    </sect2>
-
+    <xi:include href="Zend_Validate-Alnum.xml" />
+    <xi:include href="Zend_Validate-Alpha.xml" />
     <xi:include href="Zend_Validate-Barcode.xml" />
     <xi:include href="Zend_Validate-Between.xml" />
     <xi:include href="Zend_Validate-Callback.xml" />