Преглед изворни кода

[DOCUMENTATION]Japanese new Zend_Filter-Null

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18248 44c647ce-9c0f-0410-b52a-842ac1e357ba
yoshida@zend.co.jp пре 16 година
родитељ
комит
b790788125

+ 141 - 0
documentation/manual/ja/module_specs/Zend_Filter-Null.xml

@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<!-- EN-Revision: 18216 -->
+<sect2 id="zend.filter.set.null">
+    <title>Null</title>
+
+    <para>
+        もし指定の基準を満たす場合、
+        このフィルタは与えられた入力を <constant>NULL</constant>に変更します。
+        データベースとともに作業するとき、これはしばしば必要です
+        そして、ブールや他のあらゆるタイプの代わりに <constant>NULL</constant>値を持つことを望みます。
+    </para>
+
+    <sect3 id="zend.filter.set.null.default">
+        <title>Zend_Filter_Null の既定の振る舞い</title>
+
+        <para>
+            デフォルトではこのフィルタは<acronym>PHP</acronym>の
+            <methodname>empty()</methodname>メソッドのように動作します。
+            言い換えると、もし<methodname>empty()</methodname>がブールの true を返す場合、
+            <constant>NULL</constant>値が返されます。
+        </para>
+
+        <programlisting language="php"><![CDATA[
+$filter = new Zend_Filter_Null();
+$value  = '';
+$result = $filter->filter($value);
+// 空文字列の代わりに null を返します
+]]></programlisting>
+
+        <para>
+            これは、何の設定もなしに、
+            <classname>Zend_Filter_Null</classname>は全ての入力を受け付けて、
+            <methodname>empty()</methodname>と同じ場合に
+            <constant>NULL</constant>を返すことを意味します。
+        </para>
+
+        <para>
+            他の値ではいずれも変更無しにそのまま返されます。
+        </para>
+    </sect3>
+
+    <sect3 id="zend.filter.set.null.types">
+        <title>Zend_Filter_Null の振る舞いの変更</title>
+
+        <para>
+            しばしば、<methodname>empty()</methodname>に基づくフィルタでは十分ではありません。
+            そのため、<classname>Zend_Filter_Null</classname>では、
+            いずれのタイプが変換されるか否か設定できます。
+        </para>
+
+        <para>
+            下記のタイプが操作できます。
+        </para>
+
+        <itemizedlist>
+            <listitem>
+                <para>
+                    <emphasis>boolean</emphasis>: ブールの
+                    <emphasis><constant>FALSE</constant></emphasis> 値を
+                    <constant>NULL</constant> に変換します。
+                </para>
+            </listitem>
+
+            <listitem>
+                <para>
+                    <emphasis>integer</emphasis>: 整数値の <emphasis>0</emphasis> を
+                    <constant>NULL</constant>.に変換します。
+                </para>
+            </listitem>
+
+            <listitem>
+                <para>
+                    <emphasis>empty_array</emphasis>: 空の <emphasis>array</emphasis> を
+                    <constant>NULL</constant>.に変換します。
+                </para>
+            </listitem>
+
+            <listitem>
+                <para>
+                    <emphasis>string</emphasis>: 空文字列 <emphasis>''</emphasis> を
+                    <constant>NULL</constant>.に変換します。
+                </para>
+            </listitem>
+
+            <listitem>
+                <para>
+                    <emphasis>zero</emphasis>: 単一の文字、ゼロ (<emphasis>'0'</emphasis>)
+                    を含む文字列を <constant>NULL</constant>.に変換します。
+                </para>
+            </listitem>
+
+            <listitem>
+                <para>
+                    <emphasis>all</emphasis>: 上記のタイプ全てを
+                    <constant>NULL</constant>.に変換します。
+                    (これが既定の振る舞いです)
+                </para>
+            </listitem>
+        </itemizedlist>
+
+        <para>
+            上記のタイプのうちのいずれをフィルタするかを選択する方法が、いくつかあります。
+            1つまたは複数のタイプを与えて、それに追加できます。
+            配列を与えたり、定数を使えます。
+            または、原文の文字列を与えられます。
+            下記の例をご覧ください。
+        </para>
+
+        <programlisting language="php"><![CDATA[
+// false を null に変換
+$filter = new Zend_Filter_Null(Zend_Filter_Null::BOOLEAN);
+
+// false 及び 0 を null に変換
+$filter = new Zend_Filter_Null(
+    Zend_Filter_Null::BOOLEAN + Zend_Filter_Null::INTEGER
+);
+
+// false 及び 0 を null に変換
+$filter = new Zend_Filter_Null( array(
+    Zend_Filter_Null::BOOLEAN,
+    Zend_Filter_Null::INTEGER
+));
+
+// false 及び 0 を null に変換
+$filter = new Zend_Filter_Null(array(
+    'boolean',
+    'integer',
+));
+]]></programlisting>
+
+        <para>
+            希望のタイプをセットするために、
+            <classname>Zend_Config</classname> のインスタンスを与えることもできます。
+            タイプをセットするには、後で <methodname>setType()</methodname> を使います。
+        </para>
+    </sect3>
+</sect2>
+<!--
+vim:se ts=4 sw=4 et:
+-->

+ 1 - 3
documentation/manual/ja/module_specs/Zend_Filter-Set.xml

@@ -81,9 +81,7 @@
 
     <xi:include href="Zend_Filter-LocalizedToNormalized.xml" />
     <xi:include href="Zend_Filter-NormalizedToLocalized.xml" />
-    <xi:include href="Zend_Filter-Null.xml">
-        <xi:fallback><xi:include href="../../en/module_specs/Zend_Filter-Null.xml" /></xi:fallback>
-    </xi:include>
+    <xi:include href="Zend_Filter-Null.xml" />
 
     <sect2 id="zend.filter.set.stripnewlines">
         <title>StripNewlines</title>