hirokawa Fri Mar 9 07:33:05 2001 EDT Added files: /phpdoc/ja/pear about.xml pear.xml standards.xml Modified files: /phpdoc/en/functions classobj.xml info.xml var.xml /phpdoc/ja language-defs.ent /phpdoc/ja/chapters install.xml /phpdoc/ja/functions array.xml classobj.xml filesystem.xml funchand.xml info.xml oci8.xml pdf.xml var.xml zlib.xml Log: added pear/* , fixed typos, added some functions.
Index: phpdoc/en/functions/classobj.xml diff -u phpdoc/en/functions/classobj.xml:1.13 phpdoc/en/functions/classobj.xml:1.14 --- phpdoc/en/functions/classobj.xml:1.13 Wed Mar 7 15:15:13 2001 +++ phpdoc/en/functions/classobj.xml Fri Mar 9 07:33:03 2001 @@ -270,7 +270,7 @@ </informalexample> </para> <simpara> - See also <function>call_user_func_array</function>. + See also <function>call_user_func_array</function>, <function>call_user_func</function>, <function>call_user_method_array</function>. </simpara> Index: phpdoc/en/functions/info.xml diff -u phpdoc/en/functions/info.xml:1.39 phpdoc/en/functions/info.xml:1.40 --- phpdoc/en/functions/info.xml:1.39 Wed Mar 7 03:24:23 2001 +++ phpdoc/en/functions/info.xml Fri Mar 9 07:33:03 2001 @@ -1230,7 +1230,7 @@ <title>Description</title> <funcsynopsis> <funcprototype> - <funcdef>string <function>zendversion</function></funcdef> + <funcdef>string <function>zend_version</function></funcdef> <paramdef>void<parameter></parameter></paramdef> </funcprototype> </funcsynopsis> @@ -1238,7 +1238,7 @@ Returns a string containing the version of the currently running PHP parser. <example> - <title>zendversion() example</title> + <title><function>zend_version</function> example</title> <programlisting role="php"> // prints e.g. 'Zend engine version: 1.0.4' echo "Zend engine version: ".zend_version(); Index: phpdoc/en/functions/var.xml diff -u phpdoc/en/functions/var.xml:1.35 phpdoc/en/functions/var.xml:1.36 --- phpdoc/en/functions/var.xml:1.35 Wed Mar 7 15:15:13 2001 +++ phpdoc/en/functions/var.xml Fri Mar 9 07:33:03 2001 @@ -146,7 +146,7 @@ <refnamediv> <refname>get_defined_vars</refname> <refpurpose> - Returns an array of all defined functions + Returns an array of all defined variables </refpurpose> </refnamediv> <refsect1> Index: phpdoc/ja/language-defs.ent diff -u phpdoc/ja/language-defs.ent:1.3 phpdoc/ja/language-defs.ent:1.4 --- phpdoc/ja/language-defs.ent:1.3 Sat Dec 16 19:37:13 2000 +++ phpdoc/ja/language-defs.ent Fri Mar 9 07:33:03 2001 @@ -5,5 +5,6 @@ <!ENTITY Features "機能"> <!ENTITY FunctionReference "関数リファレンス"> <!ENTITY Appendixes "付録"> +<!ENTITY PEAR "PEAR: the PHP Extension and Application Repository"> <!ENTITY available "available in"> Index: phpdoc/ja/chapters/install.xml diff -u phpdoc/ja/chapters/install.xml:1.26 phpdoc/ja/chapters/install.xml:1.27 --- phpdoc/ja/chapters/install.xml:1.26 Thu Mar 1 07:24:44 2001 +++ phpdoc/ja/chapters/install.xml Fri Mar 9 07:33:03 2001 @@ -4147,7 +4147,7 @@ . . . - .#注意 この次の行は全ての'ObjectType'の後で、'AddLog'行の前とする必要があります + .// 注意 +この次の行は全ての'ObjectType'の後で、'AddLog'行の前とする必要があります Service fn="php4_execute" type="magnus-internal/x-httpd-php" . . @@ -4359,6 +4359,11 @@ 正されることもないでしょう。バグのレポートは、<ulink url="&url.php.bugs;" >&url.php.bugs;</ulink>にあるバグ追跡システ ムを使用しても行うことができます。 + </simpara> + <simpara> + バグレポートを投稿する前に <ulink + url="&url.php.bugdosdonts;">Bugs-Dos-And-Donts</ulink> を参照下 + さい! </simpara> </sect2> Index: phpdoc/ja/functions/array.xml diff -u phpdoc/ja/functions/array.xml:1.20 phpdoc/ja/functions/array.xml:1.21 --- phpdoc/ja/functions/array.xml:1.20 Tue Feb 20 07:13:13 2001 +++ phpdoc/ja/functions/array.xml Fri Mar 9 07:33:03 2001 @@ -969,6 +969,42 @@ </refsect1> </refentry> + <refentry id="function.array-sum"> + <refnamediv> + <refname>array_sum</refname> + <refpurpose> + 配列の中の値の合計を計算する + </refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>mixed <function>array_sum</function></funcdef> + <paramdef>array <parameter>arr</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>array_sum</function> +は、配列の中の値の合計を整数または + floatとして返します。 + </para> + <para> + <example> + <title><function>array_sum</function> の例</title> + <programlisting role="php"> +$a = array(2,4,6,8); +echo "sum(a) = ".array_sum($a)."\n"; +// 出力: sum(a) = 20 + +$b = array("a"=>1.2,"b"=>2.3,"c"=>3.4); +echo "sum(b) = ".array_sum($b)."\n"; +// 出力: sum(b) = 6.9 + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.array-unique"> <refnamediv> <refname>array_unique</refname> Index: phpdoc/ja/functions/classobj.xml diff -u phpdoc/ja/functions/classobj.xml:1.8 phpdoc/ja/functions/classobj.xml:1.9 --- phpdoc/ja/functions/classobj.xml:1.8 Thu Jan 4 22:29:04 2001 +++ phpdoc/ja/functions/classobj.xml Fri Mar 9 07:33:03 2001 @@ -161,6 +161,50 @@ </sect1> </partintro> + <refentry id="function.call-user-method-array"> + <refnamediv> + <refname>call_user_method_array</refname> + <refpurpose> + パラメータの配列を指定してユーザメソッドをコールする + </refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>mixed + <function>call_user_method_array</function> + </funcdef> + <paramdef>string + <parameter>method_name</parameter> + </paramdef> + <paramdef>object + <parameter>obj</parameter> + </paramdef> + <paramdef>array + <parameter><optional>paramarr</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + パラメータ <parameter>paramarr</parameter> を使用してユーザ定義オ + ブジェクト <parameter>obj</parameter>から + <parameter>method_name</parameter>で参照されるメソッドをコールし + ます。 + </para> + <para> + <function>call_user_func_array</function>, + <function>call_user_func</function>, + <function>call_user_method</function>も参照下さい。 + </para> + <note> + <para> + この関数は、PHP +4.0.4pl1のリリース後にCVSコードに追加されました。 + </para> + </note> + </refsect1> + </refentry> + <refentry id="function.call-user-method"> <refnamediv> <refname>call_user_method</refname> @@ -230,7 +274,9 @@ </informalexample> </para> <simpara> - <function>call_user_func</function>も参照下さい。 + <function>call_user_func_array</function>, + <function>call_user_func</function>, + <function>call_user_method_array</function> も参照下さい。 </simpara> </refsect1> </refentry> Index: phpdoc/ja/functions/filesystem.xml diff -u phpdoc/ja/functions/filesystem.xml:1.26 phpdoc/ja/functions/filesystem.xml:1.27 --- phpdoc/ja/functions/filesystem.xml:1.26 Thu Jan 4 22:29:04 2001 +++ phpdoc/ja/functions/filesystem.xml Fri Mar 9 07:33:03 2001 @@ -1146,7 +1146,7 @@ </itemizedlist> <parameter>mode</parameter> は文字'b'を指定することもできます。 これはバイナリとテキストのファイル形式が異なるシステムでのみ有効です。 - (つまり、UNIXでは不要です。)必要がない場合、無視されます。 + +(Windowsの場合です。UNIXでは不要です。)不要の場合、無視されます。 </para> <para> オプションの2番目の引数を使用して、これに"1"を設定する @@ -1291,6 +1291,23 @@ </programlisting> </informalexample> </para> + <note> + <para> + +バイナリとテキストファイルの形式が異なるシステム(すなわち + Windows)では、<function>fopen</function>の mode パラメータに'b' + を指定してファイルをオープンする必要があります。 + </para> + </note> + <para> + <informalexample> + <programlisting role="php"> +$filename = "c:\\files\\somepic.gif"; +$fd = fopen ($filename, "rb"); +$contents = fread ($fd, filesize ($filename)); +fclose ($fd); + </programlisting> + </informalexample> + </para> <simpara> <function>fwrite</function>, <function>fopen</function>, <function>fsockopen</function>, <function>popen</function>, @@ -1804,6 +1821,25 @@ </para> <para> <function>is_readable</function>も参照下さい。 + </para> + </refsect1> + </refentry> + + <refentry id="function.is-writeable"> + <refnamediv> + <refname>is_writeable</refname> + <refpurpose>ファイルが書き込み可能かどうか確認する</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool <function>is_writeable</function></funcdef> + <paramdef>string <parameter>filename</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + この関数は、<function>is_writable</function>のエイリアスです。 </para> </refsect1> </refentry> Index: phpdoc/ja/functions/funchand.xml diff -u phpdoc/ja/functions/funchand.xml:1.5 phpdoc/ja/functions/funchand.xml:1.6 --- phpdoc/ja/functions/funchand.xml:1.5 Thu Mar 1 07:24:45 2001 +++ phpdoc/ja/functions/funchand.xml Fri Mar 9 07:33:03 2001 @@ -8,6 +8,65 @@ </para> </partintro> + <refentry id="function.call-user-func-array"> + <refnamediv> + <refname>call_user_func_array</refname> + <refpurpose> + パラメータの配列を指定してユーザ関数をコールする + </refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>mixed + <function>call_user_func_array</function> + </funcdef> + <paramdef>string + <parameter>function_name</parameter> + </paramdef> + <paramdef>array + <parameter><optional>paramarr</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>paramarr</parameter> にパラメータを指定して、 + <parameter>function_name</parameter>で指定したユーザ定義関数をコー + ルします。例えば次のようになります。 + <informalexample> + <programlisting role="php"> +function debug($var, $val) + echo "***DEBUGGING\nVARIABLE: $var\nVALUE:"; + if (is_array($val) || is_object($val) || is_resource($val)) + print_r($val); + else + echo "\n$val\n"; + echo "***\n"; +} + +$c = mysql_connect(); +$host = $HTTP_SERVER_VARS["SERVER_NAME"]; + +call_user_func_array ('debug', array("host", $host)); +call_user_func_array ('debug', array("c", $c)); +call_user_func_array ('debug', array("HTTP_POST_VARS", $HTTP_POST_VARS)); + </programlisting> + </informalexample> + </para> + <para> + <function>call_user_func</function>, + <function>call_user_method</function>, + <function>call_user_method_array</function>も参照下さい。 + </para> + <note> + <para> + この関数は、PHP +4.0.4pl1のリリース後にCVSコードに追加されました。 + </para> + </note> + </refsect1> + </refentry> + <refentry id="function.call-user-func"> <refnamediv> <refname>call_user_func</refname> @@ -50,6 +109,11 @@ </programlisting> </informalexample> </para> + <para> + <function>call_user_func_array</function>, + <function>call_user_method</function>, + <function>call_user_method_array</function>も参照下さい。 + </para> </refsect1> </refentry> @@ -385,6 +449,74 @@ </refsect1> </refentry> + <refentry id="function.get-defined-functions"> + <refnamediv> + <refname>get_defined_functions</refname> + <refpurpose> + 定義済みの全ての関数を配列で返す + </refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>get_defined_functions</function></funcdef> + <paramdef>void <parameter></parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + +この関数は、組込(内部)関数およびユーザ定義関数を共に含む定義済み + +の全ての関数のリストを有する多次元配列を返します。内部関数は、 + <varname>$arr["internal"]</varname>、ユーザ定義関数は + <varname>$arr["user"]</varname> によりアクセス可能となります。(以 + 下の例を参照) + <informalexample> + <programlisting role="php"> +function myrow($id, $data) { + return +"<tr><th>$id</th><td>$data</td></tr>\n"; +} + +$arr = get_defined_functions(); + +print_r($arr); + </programlisting> + </informalexample> + </para> + <para> + この例の出力は、以下のようになります。 + <informalexample> + <programlisting> +Array +( + [internal] => Array + ( + [0] => zend_version + [1] => func_num_args + [2] => func_get_arg + [3] => func_get_args + [4] => strlen + [5] => strcmp + [6] => strncmp + ... + [750] => bcscale + [751] => bccomp + ) + + [user] => Array + ( + [0] => myrow + ) + +) + </programlisting> + </informalexample> + </para> + <para> + <function>get_defined_vars</function>も参照下さい。 + </para> + </refsect1> + </refentry> + <refentry id="function.register-shutdown-function"> <refnamediv> <refname>register_shutdown_function</refname> Index: phpdoc/ja/functions/info.xml diff -u phpdoc/ja/functions/info.xml:1.20 phpdoc/ja/functions/info.xml:1.21 --- phpdoc/ja/functions/info.xml:1.20 Thu Jan 4 22:29:04 2001 +++ phpdoc/ja/functions/info.xml Fri Mar 9 07:33:03 2001 @@ -786,7 +786,8 @@ </para> <para> <function>phpinfo</function>,<function>phpcredits</function>, - <function>php_logo_guid</function>も参照下さい。 + <function>php_logo_guid</function>,<function>zend_version</function> + も参照下さい。 </para> </refsect1> </refentry> @@ -1199,6 +1200,38 @@ <function>require_once</function>、 <function>include_once</function>、 <function>get_required_files</function>も参照下さい。 + </para> + </refsect1> + </refentry> + + <refentry id="function.zend-version"> + <refnamediv> + <refname>zend_version</refname> + +<refpurpose>カレントのZendエンジンのバージョンを取得する</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>zend_version</function></funcdef> + <paramdef>void<parameter></parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + +PHPパーサを現在実行中のZendのバージョンを文字列として返します。 + <example> + <title><function>zend_version</function>の例</title> + <programlisting role="php"> +// 例えば、'Zend engine version: 1.0.4' を出力 +echo "Zend engine version: ".zend_version(); + </programlisting> + </example> + </para> + <para> + <function>phpinfo</function>, + <function>phpcredits</function>, + <function>php_logo_guid</function> + <function>phpversion</function>も参照下さい。 </para> </refsect1> </refentry> Index: phpdoc/ja/functions/oci8.xml diff -u phpdoc/ja/functions/oci8.xml:1.11 phpdoc/ja/functions/oci8.xml:1.12 --- phpdoc/ja/functions/oci8.xml:1.11 Thu Jan 4 22:29:04 2001 +++ phpdoc/ja/functions/oci8.xml Fri Mar 9 07:33:03 2001 @@ -56,6 +56,41 @@ Webサーバーのユーザ用に環境変数を設定した後、Webサーバーのユーザ (nobody, www)をグループoracleに追加して下さい。 </para> + <note> + +<title>Webサーバが起動しないか、起動時にクラッシュする場合</title> + <para> + +Apacheがpthreadライブラリにリンクされているかどうか次のように確認 + して下さい。 + </para> + <para> + <informalexample> + <programlisting> +> ldd /www/apache/bin/httpd + libpthread.so.0 => /lib/libpthread.so.0 (0x4001c000) + libm.so.6 => /lib/libm.so.6 (0x4002f000) + libcrypt.so.1 => /lib/libcrypt.so.1 (0x4004c000) + libdl.so.2 => /lib/libdl.so.2 (0x4007a000) + libc.so.6 => /lib/libc.so.6 (0x4007e000) + /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) + </programlisting> + </informalexample> + </para> + <para> + libpthread +がこの一覧にない場合、Apacheを再インストールする必要が + あります。 + </para> + <para> + <informalexample> + <programlisting> +> cd /usr/src/apache_1.3.xx +> make clean +> LIBS=-lpthread ./config.status +> make +> make install + </programlisting> + </informalexample> + </para> + </note> <para> <example> <title>OCIに関するヒント</title> Index: phpdoc/ja/functions/pdf.xml diff -u phpdoc/ja/functions/pdf.xml:1.18 phpdoc/ja/functions/pdf.xml:1.19 --- phpdoc/ja/functions/pdf.xml:1.18 Sat Mar 3 16:53:36 2001 +++ phpdoc/ja/functions/pdf.xml Fri Mar 9 07:33:03 2001 @@ -434,7 +434,7 @@ PDF_end_page($pdf); - # 変化を見るために待つ + /* 変化を見るために待つ */ sleep(1); } @@ -1128,16 +1128,16 @@ </refsect1> </refentry> - <refentry id="function.pdf-endpattern"> + <refentry id="function.pdf-end-pattern"> <refnamediv> - <refname>PDF_endpattern</refname> + <refname>PDF_end_pattern</refname> <refpurpose>パターンを終了する</refpurpose> </refnamediv> <refsect1> <title>説明</title> <funcsynopsis> <funcprototype> - <funcdef>void <function>PDF_endpattern</function></funcdef> + <funcdef>void <function>PDF_end_pattern</function></funcdef> <paramdef>int <parameter>pdf object</parameter></paramdef> </funcprototype> </funcsynopsis> Index: phpdoc/ja/functions/var.xml diff -u phpdoc/ja/functions/var.xml:1.22 phpdoc/ja/functions/var.xml:1.23 --- phpdoc/ja/functions/var.xml:1.22 Thu Jan 4 22:29:05 2001 +++ phpdoc/ja/functions/var.xml Fri Mar 9 07:33:04 2001 @@ -60,7 +60,7 @@ <informalexample> <programlisting role="php"> $var = 0; -if ( empty($var) ) { #trueと評価された場合 +if ( empty($var) ) { // trueと評価された場合 print '$var is either 0 or not at all set'; } if ( !isset($var) ) { // falseと評価された場合 @@ -140,6 +140,89 @@ </refsect1> </refentry> + <refentry id="function.get-defined-vars"> + <refnamediv> + <refname>get_defined_vars</refname> + <refpurpose> + 全ての定義済の変数を配列で返す + </refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>get_defined_vars</function></funcdef> + <paramdef>void <parameter></parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + +この関数は、環境変数、サーバ変数、ユーザが定義した変数を含む全て + の定義済の変数のリストを有する多次元の配列を返します。 + <informalexample> + <programlisting role="php"> +$b = array(1,1,2,3,5,8); + +$arr = get_defined_vars(); + +// $b を出力 +print_r($arr["b"]); + +// PHPインタプリタのパスを出力 (CGIとして使用された場合) +// 例えば、/usr/local/bin/php +echo $arr["_"]; + +// コマンドラインパラメータがある場合に出力 +print_r($arr["argv"]); + +// サーバ変数を全て表示 +print_r($arr["HTTP_SERVER_VARS"]); + +// 変数の配列で利用可能なキーを全て出力 +print_r(array_keys(get_defined_vars())); + </programlisting> + </informalexample> + </para> + <para> + <function>get_defined_functions</function>も参照下さい。 + </para> + </refsect1> + </refentry> + + <refentry id="function.get-resource-type"> + <refnamediv> + <refname>get_resource_type</refname> + <refpurpose>リソース型を返す</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>get_resource_type</function></funcdef> + <paramdef>resource <parameter>$handle</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + +この関数は、指定したリソースの型を表す文字列を返します。パラメー + タが、有効なリソースでない場合はエラーとなります。 + <informalexample> + <programlisting role="php"> +$c = mysql_connect(); +echo get_resource_type($c)."\n"; +// mysql link を出力 + +$fp = fopen("foo","w"); +echo get_resource_type($fp)."\n"; +// file を出力 + +$doc = new_xmldoc("1.0"); +echo get_resource_type($doc->doc)."\n"; +// domxml document を出力 + </programlisting> + </informalexample> + </para> + </refsect1> + </refentry> + <refentry id="function.intval"> <refnamediv> <refname>intval</refname> @@ -388,6 +471,40 @@ </refsect1> </refentry> + <refentry id="function.is-null"> + <refnamediv> + <refname>is_null</refname> + <refpurpose> + 変数がヌルかどうか調べる + </refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool <function>is_null</function></funcdef> + <paramdef>mixed <parameter>var</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <parameter>var</parameter> がヌルの場合にtrue、その他にfalseを返 + します。 + </para> + <para> + <function>is_bool</function>, + <function>is_double</function>, + <function>is_numeric</function>, + <function>is_float</function>, + <function>is_int</function>, + <function>is_real</function>, + <function>is_string</function>, + <function>is_object</function>, + <function>is_array</function>, + <function>is_integer</function>も参照下さい。 + </para> + </refsect1> + </refentry> + <refentry id="function.is-numeric"> <refnamediv> <refname>is_numeric</refname> @@ -509,6 +626,82 @@ </refsect1> </refentry> + <refentry id="function.is-scalar"> + <refnamediv> + <refname>is_scalar</refname> + <refpurpose> + 変数がスカラーかどうかを調べる + </refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool + <function>is_scalar</function> + </funcdef> + <paramdef>mixed + <parameter>var</parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>is_scalar</function> returns true if the variable + given by the <parameter>var</parameter> parameter is a scalar, + otherwise it returns false. + </para> + <para> + Scalar variables are those containing an integer, float, string + or boolean. For example: + <informalexample> + <programlisting role="php"> +function show_var($var) { + if (is_scalar($var)) + echo $var; + else + var_dump($var); +} + +$pi = 3.1416; +$proteins = array("hemoglobin", "cytochrome c oxidase", "ferredoxin"); + +show_var($pi); +// prints: 3.1416 + +show_var($proteins) +// prints: +// array(3) { +// [0]=> +// string(10) "hemoglobin" +// [1]=> +// string(20) "cytochrome c oxidase" +// [2]=> +// string(10) "ferredoxin" +// } + </programlisting> + </informalexample> + </para> + <note> + <para> + この関数は、PHP 4.0.4pl1 +のリリースコード後にCVSコードに追加され + ました。4.0.4pl1 + </para> + </note> + <para> + <function>is_bool</function>, + <function>is_double</function>, + <function>is_numeric</function>, + <function>is_float</function>, + <function>is_int</function>, + <function>is_real</function>, + <function>is_string</function>, + <function>is_object</function>, + <function>is_array</function>, + <function>is_integer</function> も参照下さい。 + </para> + </refsect1> + </refentry> + <refentry id="function.is-string"> <refnamediv> <refname>is_string</refname> Index: phpdoc/ja/functions/zlib.xml diff -u phpdoc/ja/functions/zlib.xml:1.9 phpdoc/ja/functions/zlib.xml:1.10 --- phpdoc/ja/functions/zlib.xml:1.9 Thu Mar 1 07:24:45 2001 +++ phpdoc/ja/functions/zlib.xml Fri Mar 9 07:33:04 2001 @@ -626,10 +626,10 @@ </funcprototype> </funcsynopsis> <para> - この関数は、入力<parameter>data</parameter>をdeflateアルゴリズム - によりgzip圧縮されたものを返し、エラーの場合にfalseを返します。 - オプションのパラメータ<parameter>level</parameter>には、 - 0で圧縮無し、9で最大限の圧縮を指定できます。 + +この関数は、入力<parameter>data</parameter>をZLIBデータフォーマッ + +トを持いてcompress圧縮されたものを返し、エラーの場合にfalseを返し + +ます。オプションのパラメータ<parameter>level</parameter>には、0で + 圧縮無し、9で最大限の圧縮を指定できます。 </para> <note> <para> @@ -672,6 +672,130 @@ </para> <para> <function>gzcompress</function>も参照下さい。 + </para> + </refsect1> + </refentry> + + <refentry id="function.gzdeflate"> + <refnamediv> + <refname>gzdeflate</refname> + <refpurpose>文字列を deflate 圧縮する</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>gzdeflate</function></funcdef> + <paramdef>string <parameter>data</parameter></paramdef> + <paramdef>int + <parameter><optional>level</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + この関数は、入力 <parameter>data</parameter> をDEFLATEデータフォー + +マットを用いて圧縮したものを返します。エラーの場合にはfalseを返し + +ます。オプションのパラメータ<parameter>level</parameter>には、圧 + +縮しない場合に0、最大限の圧縮をする場合に9を指定可能です。 + </para> + <para> + DEFLATE圧縮アルゴリズムの詳細については、ドキュメント + "<ulink url="&url.rfc1951;">DEFLATE Compressed Data Format + Specification version 1.3</ulink>" (RFC 1951)を参照下さい。 + </para> + <para> + <function>gzinflate</function>, + <function>gzcompress</function>, + <function>gzuncompress</function>, + <function>gzencode</function>も参照下さい。 + </para> + </refsect1> + </refentry> + + <refentry id="function.gzinflate"> + <refnamediv> + <refname>gzinflate</refname> + <refpurpose>deflate圧縮された文字列を解凍する</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>gzinflate</function></funcdef> + <paramdef>string <parameter>data</parameter></paramdef> + <paramdef>int + <parameter><optional>length</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + この関数は、<function>gzdeflate</function>により圧縮された + <parameter>data</parameter> +を引数とし、圧縮前の元のデータを返し + +ます。エラーの場合にはfalseを返します。この関数は、解凍されたデー + タが圧縮された入力 <parameter>data</parameter> の長さの256倍、ま + +たはオプションのパラメータ<parameter>length</parameter>以上の長さ + である場合にエラーを返します。 + </para> + <para> + <function>gzcompress</function>. + <function>gzuncompress</function>, + <function>gzdeflate</function>, + <function>gzencode</function>も参照下さい。 + </para> + </refsect1> + </refentry> + + <refentry id="function.gzencode"> + <refnamediv> + <refname>gzencode</refname> + <refpurpose>gzip 圧縮された文字列を作成</refpurpose> + </refnamediv> + <refsect1> + <title>説明</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>gzencode</function></funcdef> + <paramdef>string <parameter>data</parameter></paramdef> + <paramdef>int + <parameter><optional>level</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + この関数は、入力 <parameter>data</parameter>を + <command>gzip</command> +プログラムの出力と互換性のある形式で圧縮 + +して返します。エラーが発生した場合は、falseを返します。オプション + のパラメータ<parameter>level</parameter> +には、圧縮をしない場合に + +0、最大限の圧縮を行う場合に9を指定可能です。指定されない場合のデ + フォルト圧縮レベルは1になります。 + </para> + <para> + +返されるデータには、標準的な.gzファイルとするために適当なヘッダと + データ構造が含まれます。例を以下に示します。 + <example> + <title>gzipファイルを作成する</title> + <programlisting role="php"> +<?php +$data = implode("", "bigfile.txt"); +$gzdata = gzencode($data, 9); +$fp = fopen("bigfile.txt.gz", "w"); +fwrite($fp, $gzdata); +fclose($fp); +?> + </programlisting> + </example> + </para> + <para> + +GZIPファイルフォーマットに関する詳細な情報については、次のドキュ + メントを参照下さい。 + <ulink url="&url.rfc1952">GZIP file format specification + version 4.3</ulink> (RFC 1952) + </para> + <para> + <function>gzcompress</function>. + <function>gzuncompress</function>, + <function>gzdeflate</function>, + <function>gzinflate</function>も参照下さい。 </para> </refsect1> </refentry> Index: phpdoc/ja/pear/about.xml +++ phpdoc/ja/pear/about.xml <chapter id="pear.about"> <title>PEARについて</title> <simpara> PEAR は、1999/11/21 に生まれた <ulink url="&url.malinimg;">Malin Bakken</ulink>に捧げられています。(最初のPEARのコードは、彼女が生ま れたちょうど二時間後にかかれました。) </simpara> <sect1 id="pear-whatis"> <title>PEARとは?</title> <simpara> PEAR は、TeXの CTAN および Perlの CPANにヒントを得たPHP拡張および PHPライブラリのコード用のコードレポジトリです。 </simpara> <para> PEARの目的は次のようなものです。 <itemizedlist> <listitem> <simpara> ライブラリコードの作者に他の開発者とコードを共有するための確実 な手段を提供する </simpara> </listitem> <listitem> <simpara> PHPコミュニティにコードを共有するためのインフラを提供する </simpara> </listitem> <listitem> <simpara> 開発者が移植性の高い再使用可能なコードを書きやすくするために標 準を定義する </simpara> </listitem> <listitem> <simpara> コードの維持管理と配布のためのツールを提供する </simpara> </listitem> </itemizedlist> </para> </sect1> </chapter> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/ja/pear/pear.xml +++ phpdoc/ja/pear/pear.xml <reference id="ref.pear"> <title>PEAR リファレンスマニュアル</title> <titleabbrev>PEAR</titleabbrev> <partintro> <simpara> 本章は、PHPに付属する PEARコンポーネントに関するリファレンスです。 ここでは、<link linkend="language.oop">オブジェクトとクラス</link> に既に慣れていることを前提とします。 </simpara> </partintro> <refentry id="class.pear"> <refnamediv> <refname>PEAR</refname> <refpurpose>PEAR ベースクラス</refpurpose> </refnamediv> <refsynopsisdiv> <synopsis>class <replaceable>classname</replaceable> extends <classname>PEAR</classname> { ... }</synopsis> </refsynopsisdiv> <refsect1> <title>説明</title> <simpara> PEARベースクラスは、多くのPEARクラスで使用される標準的な機能を提 供します。通常、PEARクラスのインスタンスを直接作成することはあり ません。このクラスのサブクラス化して使用して下さい。 </simpara> <para> 主な機能を以下に示します。 <itemizedlist> <listitem> <simpara>オブジェクト終了処理 "デストラクタ"</simpara> </listitem> <listitem> <simpara>エラー処理</simpara> </listitem> </itemizedlist> </para> <refsect2> <title>PEAR "デストラクタ"</title> <simpara> If you inherit <classname>PEAR</classname> in a class called <replaceable>ClassName</replaceable>, you can define a method in it called called _<replaceable>ClassName</replaceable> (the class name with an underscore prepended) that will be invoked when the request is over. This is not a destructor in the sense that you can "delete" an object and have the destructor called, but in the sense that PHP gives you a callback in the object when it is done executing. See <link linkend="example.pear.destructors">the example</link> below. </simpara> </refsect2> <refsect2> <title>PEARのエラー処理</title> <simpara> PEAR's base class also provides a way of passing around more complex errors than a true/false value or a numeric code. A PEAR error is an object that is either an instance of the class <classname>PEAR_Error</classname>, or some class inheriting <classname>PEAR_Error</classname>. </simpara> <simpara> One of the design criteria of PEAR's errors is that it should not force a particular type of output on the user, it should be possible to handle errors without any output at all if that is desireable. This makes it possible to handle errors gracefully, also when your output format is different from HTML (for example WML or some other XML format). </simpara> <simpara> The error object can be configured to do a number of things when it is created, such as printing an error message, printing the message and exiting, raising an error with PHP's <function>trigger_error</function> function, invoke a callback, or none of the above. This is typically specified in <classname>PEAR_Error</classname>'s constructor, but all of the parameters are optional, and you can set up defaults for errors generated from each object based on the <classname>PEAR</classname> class. See the <link linkend="example.pear.error1">PEAR error examples</link> for how to use it and the <classname>PEAR_Error</classname> reference for the full details. </simpara> </refsect2> </refsect1> <refsect1> <title>例</title> <para> The example below shows how to use the PEAR's "poor man's kinda emulated destructors" to implement a simple class that holds the contents of a file, lets you append data to the object and flushes the data back to the file at the end of the request: <example id="example.pear.destructors"> <title>PEAR: emulated destructors</title> <programlisting role="php"> require_once "PEAR.php"; class FileContainer extends PEAR { var $file = ''; var $contents = ''; var $modified = 0; function FileContainer($file) { $this->PEAR(); // this calls the parent class constructor $fp = fopen($file, "r"); if (!is_resource($fp)) { return; } while (!empty($data = fread($fp, 2048))) { $this->contents .= $data; } fclose($fp); } function append($str) { $this->contents .= $str; $this->modified++; } // The "destructor" is named like the constructor // but with an underscore in front. function _FileContainer() { if ($this->modified) { $fp = fopen($this->file, "w"); if (!is_resource($fp)) { return; } fwrite($fp, $this->contents); fclose($fp); } } } $fileobj = new FileContainer("testfile"); $fileobj->append("this ends up at the end of the file\n"); // When the request is done and PHP shuts down, $fileobj's // "destructor" is called and updates the file on disk. </programlisting> </example> <note> <simpara> PEAR "destructors" use PHP's shutdown callbacks (<function>register_shutdown_function</function>), and you can't output anything from these when PHP is running in a web server. So anything printed in a "destructor" gets lost except when PHP is used in command-line mode. Bummer. </simpara> </note> </para> <simpara> The next examples illustrate different ways of using PEAR's error handling mechanism. </simpara> <para> <example id="example.pear.error1"> <title>PEAR error の例 (1)</title> <programlisting role="php"> function mysockopen($host = "localhost", $port = 8090) { $fp = fsockopen($host, $port, $errno, $errstr); if (!is_resource($fp)) { return new PEAR_Error($errstr, $errno); } return $fp; } $sock = mysockopen(); if (PEAR::isError($sock)) { print "mysockopen error: ".$sock->getMessage()."<BR>\n" } </programlisting> </example> </para> <simpara> This example shows a wrapper to <function>fsockopen</function> that delivers the error code and message (if any) returned by fsockopen in a PEAR error object. Notice that <function>PEAR::isError</function> is used to detect whether a value is a PEAR error. </simpara> <simpara> PEAR_Error's mode of operation in this example is simply returning the error object and leaving the rest to the user (programmer). This is the default error mode. </simpara> <simpara> In the next example we're showing how to use default error modes: </simpara> <para> <example id="example.pear.error2"> <title>PEAR error example (2)</title> <programlisting role="php"> class TCP_Socket extends PEAR { var $sock; function TCP_Socket() { $this->PEAR(); } function connect($host, $port) { $sock = fsockopen($host, $port, $errno, $errstr); if (!is_resource($sock)) { return $this->raiseError($errstr, $errno); } } } $sock = new TCP_Socket; $sock->setErrorHandling(PEAR_ERROR_DIE); $sock->connect("localhost", 8090); print "still alive<BR>\n"; </programlisting> </example> </para> <simpara> Here, we set the default error mode to <constant>PEAR_ERROR_DIE</constant>, and since we don't specify any error mode in the raiseError call (that'd be the third parameter), raiseError uses the default error mode and exits if fsockopen fails. </simpara> </refsect1> </refentry> <refentry id="class.pear-error"> <refnamediv> <refname>PEAR_Error</refname> <refpurpose>PEARエラー処理機能の基底クラス</refpurpose> </refnamediv> <refsynopsisdiv> <synopsis>$err = new <classname>PEAR_Error</classname>($msg);</synopsis> </refsynopsisdiv> <refsect1> <title>エラーモード</title> <para> An error object has a mode of operation that can be set with one of the following constants: <variablelist id="pear.error-modes"> <varlistentry id="constant.pear-error-return"> <term>PEAR_ERROR_RETURN</term> <listitem> <simpara> Just return the object, don't do anything special in PEAR_Error's constructor. </simpara> </listitem> </varlistentry> <varlistentry id="constant.pear-error-print"> <term>PEAR_ERROR_PRINT</term> <listitem> <simpara> Print the error message in the constructor. The execution is not interrupted. </simpara> </listitem> </varlistentry> <varlistentry id="constant.pear-error-trigger"> <term>PEAR_ERROR_TRIGGER</term> <listitem> <simpara> Use PHP's <function>trigger_error</function> function to raise an internal error in PHP. The execution is aborted if you have defined your own PHP error handler or if you set the error severity to E_USER_ERROR. </simpara> </listitem> </varlistentry> <varlistentry id="constant.pear-error-die"> <term>PEAR_ERROR_DIE</term> <listitem> <simpara> Print the error message and exit. Execution is of course aborted. </simpara> </listitem> </varlistentry> <varlistentry id="constant.pear-error-callback"> <term>PEAR_ERROR_CALLBACK</term> <listitem> <simpara> Use a callback function or method to handle errors. Execution is aborted. </simpara> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1> <title>プロパティ</title> <simpara></simpara> </refsect1> <refsect1> <title>メソッド</title> <funcsynopsis> <funcprototype> <funcdef><function>PEAR_Error::PEAR_Error</function></funcdef> <paramdef> <parameter><optional>message</optional></parameter> <parameter><optional>code</optional></parameter> <parameter><optional>mode</optional></parameter> <parameter><optional>options</optional></parameter> <parameter><optional>userinfo</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <refsect2> <title>説明</title> <para> PEAR_Error constructor. Parameters: <variablelist> <varlistentry> <term>message</term> <listitem> <simpara> error message, defaults to "unknown error" </simpara> </listitem> </varlistentry> <varlistentry> <term>code</term> <listitem> <simpara> error code (optional) </simpara> </listitem> </varlistentry> <varlistentry> <term>mode</term> <listitem> <simpara> Mode of operation. See the <link linkend="pear.error-modes">error modes</link> section for details. </simpara> </listitem> </varlistentry> <varlistentry> <term>options</term> <listitem> <simpara> If the mode of can have any options specified, use this parameter. Currently the "trigger" and "callback" modes are the only using the options parameter. For trigger mode, this parameter is one of <constant>E_USER_NOTICE</constant>, <constant>E_USER_WARNING</constant> or <constant>E_USER_ERROR</constant>. For callback mode, this parameter should contain either the callback function name (string), or a two-element (object, string) array representing an object and a method name. </simpara> </listitem> </varlistentry> </variablelist> </para> </refsect2> </refsect1> </refentry> </reference> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: --> Index: phpdoc/ja/pear/standards.xml +++ phpdoc/ja/pear/standards.xml <chapter id="pear.standards"> <title>PEAR コーディング標準</title> <sect1 id="pear.standards.indenting"> <title>インデント</title> <para> Use an indent of 4 spaces, with no tabs. If you use Emacs to edit PEAR code, you should set indent-tabs-mode to nil. Here is an example mode hook that will set up Emacs according to these guidelines (you will need to ensure that it is called when you are editing php files): <programlisting role="elisp"> (defun php-mode-hook () (setq tab-width 4 c-basic-offset 4 c-hanging-comment-ender-p nil indent-tabs-mode nil)) </programlisting> </para> <para>Here are vim rules for the same thing: <programlisting role="vim"> set expandtab set shiftwidth=4 set tabstop=4 </programlisting> </para> </sect1> <sect1 id="pear.standards.control"> <title>制御構造</title> <para> These include if, for, while, switch, etc. Here is an example if statement, since it is the most complicated of them: <programlisting role="php"> if ((condition1) || (condition2)) { action1; } elseif ((condition3) && (condition4)) { action2; } else { defaultaction; } </programlisting> </para> <simpara> Control statements should have one space between the control keyword and opening parenthesis, to distinguish them from function calls. </simpara> <simpara> You are strongly encouraged to always use curly braces even in situations where they are technically optional. Having them increases readability and decreases the likelihood of logic errors being introduced when new lines are added. </simpara> <para> For switch statements: <programlisting role="php"> switch (condition) { case 1: action1; break; case 2: action2; break; default: defaultaction; break; } </programlisting> </para> </sect1> <sect1 id="pear.standards.funcalls"> <title>関数のコール</title> <para> Functions should be called with no spaces between the function name, the opening parenthesis, and the first parameter; spaces between commas and each parameter, and no space between the last parameter, the closing parenthesis, and the semicolon. Here's an example: <programlisting role="php"> $var = foo($bar, $baz, $quux); </programlisting> </para> <para> As displayed above, there should be one space on either side of an equals sign used to assign the return value of a function to a variable. In the case of a block of related assignments, more space may be inserted to promote readability: <programlisting role="php"> $short = foo($bar); $long_variable = foo($baz); </programlisting> </para> </sect1> <sect1 id="pear.standards.funcdef"> <title>関数の定義</title> <para> Function declaractions follow the "one true brace" convention: <programlisting role="php"> function fooFunction($arg1, $arg2 = '') { if (condition) { statement; } return $val; } </programlisting> </para> <para> Arguments with default values go at the end of the argument list. Always attempt to return a meaningful value from a function if one is appropriate. Here is a slightly longer example: <programlisting role="php"> function connect(&$dsn, $persistent = false) { if (is_array($dsn)) { $dsninfo = &$dsn; } else { $dsninfo = DB::parseDSN($dsn); } if (!$dsninfo || !$dsninfo['phptype']) { return $this->raiseError(); } return true; } </programlisting> </para> </sect1> <sect1 id="pear.standards.comments"> <title>コメント</title> <para> Inline documentation for classes should follow the PHPDoc convention, similar to Javadoc. More information about PHPDoc can be found here: <ulink url="&url.phpdoc;">&url.phpdoc;</ulink> </para> <para> Non-documentation comments are strongly encouraged. A general rule of thumb is that if you look at a section of code and think "Wow, I don't want to try and describe that", you need to comment it before you forget how it works. </para> <para> C++ style comments (/* */) and standard C comments (// ) are both fine. Use of perl/shell style comments (# ) is discouraged. </para> </sect1> <sect1 id="pear.standards.including"> <title>コードの読み込み</title> <para> Anywhere you are unconditionally including a class file, use <function>require_once</function>. Anywhere you are conditionally including a class file (for example, factory methods), use <function>include_once</function>. Either of these will ensure that class files are included only once. They share the same file list, so you don't need to worry about mixing them - a file included with <function>require_once</function> will not be included again by <function>include_once</function>. <note> <simpara> <function>include_once</function> and <function>require_once</function> are statements, not functions. You don't <emphasis>need</emphasis> parentheses around the filename to be included. </simpara> </note> </para> </sect1> <sect1 id="pear.standards.tags"> <title>PHPコードのタグ</title> <para> <emphasis>Always</emphasis> use <literal><?php ?></literal> to delimit PHP code, not the <literal><? ?></literal> shorthand. This is required for PEAR compliance and is also the most portable way to include PHP code on differing operating systems and setups. </para> </sect1> <sect1 id="pear.standards.header"> <title>ヘッダのコメント部</title> <para> All source code files in the core PEAR distribution should contain the following comment block as the header: <programlisting role="php"> /* vim: set expandtab tabstop=4 shiftwidth=4: */ // +----------------------------------------------------------------------+ // | PHP version 4.0 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | [EMAIL PROTECTED] so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Original Author <[EMAIL PROTECTED]> | // | Your Name <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // // $Id$ </programlisting> </para> <para> There's no hard rule to determine when a new code contributer should be added to the list of authors for a given source file. In general, their changes should fall into the "substantial" category (meaning somewhere around 10% to 20% of code changes). Exceptions could be made for rewriting functions or contributing new logic. </para> <para> Simple code reorganization or bug fixes would not justify the addition of a new individual to the list of authors. </para> <para> Files not in the core PEAR repository should have a similar block stating the copyright, the license, and the authors. All files should include the modeline comments to encourage consistency. </para> </sect1> <sect1 id="pear.standards.cvstags"> <title>CVS タグ</title> <para> Include the $Id$ CVS vendor tag in each file. As each file is edited, add this tag if it's not yet present (or replace existing forms such as "Last Modified:", etc.). <note> <simpara> We have a custom $Horde tag in Horde cvs to track our versions seperately; we could do the same and make a $PEAR tag, that would remain even if PEAR files were put into another source control system, etc...] </simpara> </note> </para> </sect1> <sect1 id="pear.standards.exampleurls"> <title>URLの例</title> <para> Use "example.com" for all example URLs, per RFC 2606. </para> </sect1> <sect1 id="pear.standards.constants"> <title>定数の名前</title> <para> Constants should always be uppercase, with underscores to seperate words. Prefix constant names with the name of the class/package they are used in. For example, the constants used by the <literal>DB::</literal> package all begin with "<literal>DB_</literal>". </para> </sect1> </chapter> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: -->