WS, preparation for the new doc style

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@209052 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Philip Olson 2006-03-10 04:54:53 +00:00
parent df33b55366
commit 521b262238
9 changed files with 452 additions and 457 deletions

View file

@ -1,49 +1,49 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/url.xml, last change in rev 1.2 -->
<refentry id="function.base64-decode">
<refnamediv>
<refname>base64_decode</refname>
<refpurpose>Decodes data encoded with MIME base64</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>base64_decode</methodname>
<methodparam><type>string</type><parameter>encoded_data</parameter></methodparam>
</methodsynopsis>
<para>
<function>base64_decode</function> decodes
<parameter>encoded_data</parameter> and returns the original
data or &false; on failure. The returned data may be binary.
</para>
<para>
<example>
<title><function>base64_decode</function> example</title>
<programlisting role="php">
<!-- $Revision: 1.8 $ -->
<refentry id="function.base64-decode">
<refnamediv>
<refname>base64_decode</refname>
<refpurpose>Decodes data encoded with MIME base64</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>base64_decode</methodname>
<methodparam><type>string</type><parameter>encoded_data</parameter></methodparam>
</methodsynopsis>
<para>
<function>base64_decode</function> decodes
<parameter>encoded_data</parameter> and returns the original
data or &false; on failure. The returned data may be binary.
</para>
<para>
<example>
<title><function>base64_decode</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$str = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==';
echo base64_decode($str);
?>
]]>
</programlisting>
<para>
This example will produce:
</para>
<screen>
</programlisting>
<para>
This example will produce:
</para>
<screen>
<![CDATA[
This is an encoded string
]]>
</screen>
</example>
</para>
<para>
See also <function>base64_encode</function> and
<ulink url="&url.rfc;2045">RFC 2045</ulink> section 6.8.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
See also <function>base64_encode</function> and
<ulink url="&url.rfc;2045">RFC 2045</ulink> section 6.8.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,57 +1,57 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/url.xml, last change in rev 1.2 -->
<refentry id="function.base64-encode">
<refnamediv>
<refname>base64_encode</refname>
<refpurpose>Encodes data with MIME base64</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>base64_encode</methodname>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
<function>base64_encode</function> returns
<parameter>data</parameter> encoded with base64. This encoding
is designed to make binary data survive transport through
transport layers that are not 8-bit clean, such as mail bodies.
</para>
<para>
Base64-encoded data takes about 33% more space than the original
data.
</para>
<para>
<example>
<title><function>base64_encode</function> example</title>
<programlisting role="php">
<!-- $Revision: 1.8 $ -->
<refentry id="function.base64-encode">
<refnamediv>
<refname>base64_encode</refname>
<refpurpose>Encodes data with MIME base64</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>base64_encode</methodname>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
<function>base64_encode</function> returns
<parameter>data</parameter> encoded with base64. This encoding
is designed to make binary data survive transport through
transport layers that are not 8-bit clean, such as mail bodies.
</para>
<para>
Base64-encoded data takes about 33% more space than the original
data.
</para>
<para>
<example>
<title><function>base64_encode</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$str = 'This is an encoded string';
echo base64_encode($str);
$str = 'This is an encoded string';
echo base64_encode($str);
?>
]]>
</programlisting>
<para>
This example will produce:
</para>
<screen>
</programlisting>
<para>
This example will produce:
</para>
<screen>
<![CDATA[
VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==
]]>
</screen>
</example>
</para>
<para>
See also
<function>base64_decode</function>,
<function>chunk_split</function>,
<function>convert_uuencode</function> and
<ulink url="&url.rfc;2045">RFC 2045</ulink> section 6.8.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
See also
<function>base64_decode</function>,
<function>chunk_split</function>,
<function>convert_uuencode</function> and
<ulink url="&url.rfc;2045">RFC 2045</ulink> section 6.8.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,40 +1,39 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.7 $ -->
<refentry id="function.get-headers">
<refnamediv>
<refname>get_headers</refname>
<refpurpose>
Fetches all the headers sent by the server in response to a HTTP request
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>get_headers</methodname>
<methodparam><type>string</type><parameter>url</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam>
</methodsynopsis>
<para>
<function>get_headers</function> returns an array with the headers sent
by the server in response to a HTTP request. Returns &false; on failure
and an error of level <constant>E_WARNING</constant> will be issued.
</para>
<para>
If the optional <parameter>format</parameter> parameter is set to 1,
<function>get_headers</function> parses the response and sets the array's
keys.
</para>
<note>
<para>
Since PHP 5.1.3 this function uses the default stream context, which can
be set/changed with the <function>stream_context_get_default</function>
function.
</para>
</note>
<para>
<example>
<title><function>get_headers</function> example</title>
<programlisting role="php">
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<refentry id="function.get-headers">
<refnamediv>
<refname>get_headers</refname>
<refpurpose>Fetches all the headers sent by the server in response to a HTTP request</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>get_headers</methodname>
<methodparam><type>string</type><parameter>url</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam>
</methodsynopsis>
<para>
<function>get_headers</function> returns an array with the headers sent
by the server in response to a HTTP request. Returns &false; on failure
and an error of level <constant>E_WARNING</constant> will be issued.
</para>
<para>
If the optional <parameter>format</parameter> parameter is set to 1,
<function>get_headers</function> parses the response and sets the array's
keys.
</para>
<note>
<para>
Since PHP 5.1.3 this function uses the default stream context, which can
be set/changed with the <function>stream_context_get_default</function>
function.
</para>
</note>
<para>
<example>
<title><function>get_headers</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$url = 'http://www.example.com';
@ -44,9 +43,9 @@ print_r(get_headers($url));
print_r(get_headers($url, 1));
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Array
(
@ -74,11 +73,11 @@ Array
[Content-Type] => text/html
)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,37 +1,34 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
<refentry id="function.get-meta-tags">
<refnamediv>
<refname>get_meta_tags</refname>
<refpurpose>
Extracts all meta tag content attributes from a file and returns
an array
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>get_meta_tags</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>use_include_path</parameter></methodparam>
</methodsynopsis>
<para>
Opens <parameter>filename</parameter> and parses it line by line
for &lt;meta&gt; tags in the file. This can be a local file or
an <acronym>URL</acronym>. The parsing stops at
<literal>&lt;/head&gt;</literal>.
</para>
<para>
Setting <parameter>use_include_path</parameter> to &true; will result
in PHP trying to open the file along the standard include path
as per the <link linkend="ini.include-path">include_path</link>
directive. This is used for local files, not URLs.
</para>
<para>
<example>
<title>What <function>get_meta_tags</function> parses</title>
<programlisting role="html">
<!-- $Revision: 1.8 $ -->
<refentry id="function.get-meta-tags">
<refnamediv>
<refname>get_meta_tags</refname>
<refpurpose>Extracts all meta tag content attributes from a file and returns an array</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>get_meta_tags</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>use_include_path</parameter></methodparam>
</methodsynopsis>
<para>
Opens <parameter>filename</parameter> and parses it line by line
for &lt;meta&gt; tags in the file. This can be a local file or
an <acronym>URL</acronym>. The parsing stops at
<literal>&lt;/head&gt;</literal>.
</para>
<para>
Setting <parameter>use_include_path</parameter> to &true; will result
in PHP trying to open the file along the standard include path
as per the <link linkend="ini.include-path">include_path</link>
directive. This is used for local files, not URLs.
</para>
<para>
<example>
<title>What <function>get_meta_tags</function> parses</title>
<programlisting role="html">
<![CDATA[
<meta name="author" content="name">
<meta name="keywords" content="php documentation">
@ -39,24 +36,24 @@
<meta name="geo.position" content="49.33;-86.59">
</head> <!-- parsing stops here -->
]]>
</programlisting>
</example>
(pay attention to line endings - PHP uses a native function to
parse the input, so a Mac file won't work on Unix).
</para>
<para>
The value of the name property becomes the key, the value of the
content property becomes the value of the returned array, so you
can easily use standard array functions to traverse it or access
single values. Special characters in the value of the name
property are substituted with '_', the rest is converted to lower
case. If two meta tags have the same name, only the last one
is returned.
</para>
<para>
<example>
<title>What <function>get_meta_tags</function> returns</title>
<programlisting role="php">
</programlisting>
</example>
(pay attention to line endings - PHP uses a native function to
parse the input, so a Mac file won't work on Unix).
</para>
<para>
The value of the name property becomes the key, the value of the
content property becomes the value of the returned array, so you
can easily use standard array functions to traverse it or access
single values. Special characters in the value of the name
property are substituted with '_', the rest is converted to lower
case. If two meta tags have the same name, only the last one
is returned.
</para>
<para>
<example>
<title>What <function>get_meta_tags</function> returns</title>
<programlisting role="php">
<![CDATA[
<?php
// Assuming the above tags are at www.example.com
@ -70,21 +67,21 @@ echo $tags['description']; // a php manual
echo $tags['geo_position']; // 49.33;-86.59
?>
]]>
</programlisting>
</example>
</para>
<note>
<para>
As of PHP 4.0.5, <function>get_meta_tags</function> supports
unquoted HTML attributes.
</para>
</note>
<para>
See also <function>htmlentities</function> and
<function>urlencode</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<note>
<para>
As of PHP 4.0.5, <function>get_meta_tags</function> supports
unquoted HTML attributes.
</para>
</note>
<para>
See also <function>htmlentities</function> and
<function>urlencode</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,76 +1,76 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.10 $ -->
<refentry id="function.http-build-query">
<refnamediv>
<refname>http_build_query</refname>
<refpurpose>Generate URL-encoded query string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>http_build_query</methodname>
<methodparam><type>array</type><parameter>formdata</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>numeric_prefix</parameter></methodparam>
</methodsynopsis>
<simpara>
Generates a URL-encoded query string from the associative (or indexed) array provided.
<parameter>formdata</parameter> may be an array or object containing properties.
A <parameter>formdata</parameter> array may be a simple one-dimensional structure,
or an array of arrays (who in turn may contain other arrays). If numeric indices
are used in the base array and a <parameter>numeric_prefix</parameter> is provided,
it will be prepended to the numeric index for elements in the base array only.
This is to allow for legal variable names when the data is decoded by PHP
or another CGI application later on.
</simpara>
<note>
<para>
<link linkend="ini.arg-separator.output">arg_separator.output</link> is
used to separate arguments.
</para>
</note>
<example>
<title>Simple usage of <function>http_build_query</function></title>
<programlisting role="php">
<!-- $Revision: 1.11 $ -->
<refentry id="function.http-build-query">
<refnamediv>
<refname>http_build_query</refname>
<refpurpose>Generate URL-encoded query string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>http_build_query</methodname>
<methodparam><type>array</type><parameter>formdata</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>numeric_prefix</parameter></methodparam>
</methodsynopsis>
<simpara>
Generates a URL-encoded query string from the associative (or indexed) array provided.
<parameter>formdata</parameter> may be an array or object containing properties.
A <parameter>formdata</parameter> array may be a simple one-dimensional structure,
or an array of arrays (who in turn may contain other arrays). If numeric indices
are used in the base array and a <parameter>numeric_prefix</parameter> is provided,
it will be prepended to the numeric index for elements in the base array only.
This is to allow for legal variable names when the data is decoded by PHP
or another CGI application later on.
</simpara>
<note>
<para>
<link linkend="ini.arg-separator.output">arg_separator.output</link> is
used to separate arguments.
</para>
</note>
<example>
<title>Simple usage of <function>http_build_query</function></title>
<programlisting role="php">
<![CDATA[
<?php
$data = array('foo'=>'bar',
'baz'=>'boom',
'cow'=>'milk',
'php'=>'hypertext processor');
echo http_build_query($data); // foo=bar&baz=boom&cow=milk&php=hypertext+processor
?>
]]>
</programlisting>
</example>
</programlisting>
</example>
<example>
<title><function>http_build_query</function> with numerically index elements.</title>
<programlisting role="php">
<example>
<title><function>http_build_query</function> with numerically index elements.</title>
<programlisting role="php">
<![CDATA[
<?php
$data = array('foo', 'bar', 'baz', 'boom', 'cow' => 'milk', 'php' =>'hypertext processor');
echo http_build_query($data);
/* Outputs:
0=foo&1=bar&2=baz&3=boom&cow=milk&php=hypertext+processor
*/
echo http_build_query($data, 'myvar_');
/* Outputs:
myvar_0=foo&myvar_1=bar&myvar_2=baz&myvar_3=boom&cow=milk&php=hypertext+processor
*/
?>
]]>
</programlisting>
</example>
</programlisting>
</example>
<example>
<title><function>http_build_query</function> with complex arrays</title>
<programlisting role="php">
<example>
<title><function>http_build_query</function> with complex arrays</title>
<programlisting role="php">
<![CDATA[
<?php
$data = array('user'=>array('name'=>'Bob Smith',
@ -83,47 +83,46 @@ $data = array('user'=>array('name'=>'Bob Smith',
'sally'=>array('age'=>8,
'sex'=>'F')),
'CEO');
echo http_build_query($data, 'flags_');
?>
]]>
</programlisting>
<para>
this will output : (word wrapped for readability)
</para>
<screen>
</programlisting>
<para>
this will output : (word wrapped for readability)
</para>
<screen>
<![CDATA[
user[name]=Bob+Smith&user[age]=47&user[sex]=M&user[dob]=5%1F12%1F1956&
pastimes[0]=golf&pastimes[1]=opera&pastimes[2]=poker&pastimes[3]=rap&
children[bobby][age]=12&children[bobby][sex]=M&children[sally][age]=8&
children[sally][sex]=F&flags_0=CEO
]]>
</screen>
</screen>
<para>
<note>
<para>
<note>
<para>
Only the numerically indexed element in the base array "CEO" received a
prefix. The other numeric indices, found under pastimes, do not
require a string prefix to be legal variable names.
</para>
</note>
Only the numerically indexed element in the base array "CEO" received a
prefix. The other numeric indices, found under pastimes, do not
require a string prefix to be legal variable names.
</para>
</example>
<example>
<title>Using <function>http_build_query</function> with an object</title>
<programlisting role="php">
</note>
</para>
</example>
<example>
<title>Using <function>http_build_query</function> with an object</title>
<programlisting role="php">
<![CDATA[
<?php
class myClass {
var $foo;
var $baz;
function myClass()
{
$this->foo = 'bar';
$this->baz = 'boom';
}
var $foo;
var $baz;
function myClass() {
$this->foo = 'bar';
$this->baz = 'boom';
}
}
$data = new myClass();
@ -132,18 +131,18 @@ echo http_build_query($data); // foo=bar&baz=boom
?>
]]>
</programlisting>
</example>
</programlisting>
</example>
<simpara>
See also:
<function>parse_str</function>,
<function>parse_url</function>,
<function>urlencode</function>, and
<function>array_walk</function>
</simpara>
</refsect1>
</refentry>
<simpara>
See also:
<function>parse_str</function>,
<function>parse_url</function>,
<function>urlencode</function>, and
<function>array_walk</function>
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,26 +1,26 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/url.xml, last change in rev 1.6 -->
<refentry id="function.rawurldecode">
<refnamediv>
<refname>rawurldecode</refname>
<refpurpose>Decode URL-encoded strings</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>rawurldecode</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
Returns a string in which the sequences with percent
(<literal>%</literal>) signs followed by two hex digits have been
replaced with literal characters.
</para>
<para>
<example>
<title><function>rawurldecode</function> example</title>
<programlisting role="php">
<!-- $Revision: 1.5 $ -->
<refentry id="function.rawurldecode">
<refnamediv>
<refname>rawurldecode</refname>
<refpurpose>Decode URL-encoded strings</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>rawurldecode</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
Returns a string in which the sequences with percent
(<literal>%</literal>) signs followed by two hex digits have been
replaced with literal characters.
</para>
<para>
<example>
<title><function>rawurldecode</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
@ -28,22 +28,22 @@ echo rawurldecode('foo%20bar%40baz'); // foo bar@baz
?>
]]>
</programlisting>
</example>
</para>
<note>
<para>
<function>rawurldecode</function> does not decode plus symbols ('+')
into spaces. <function>urldecode</function> does.
</para>
</note>
<simpara>
See also <function>rawurlencode</function>,
<function>urldecode</function> and
<function>urlencode</function>.
</simpara>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<note>
<para>
<function>rawurldecode</function> does not decode plus symbols ('+')
into spaces. <function>urldecode</function> does.
</para>
</note>
<simpara>
See also <function>rawurlencode</function>,
<function>urldecode</function> and
<function>urlencode</function>.
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,64 +1,64 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/url.xml, last change in rev 1.6 -->
<refentry id="function.rawurlencode">
<refnamediv>
<refname>rawurlencode</refname>
<refpurpose>URL-encode according to RFC 1738</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>rawurlencode</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
Returns a string in which all non-alphanumeric characters except
<literal>-_.</literal> have been replaced with a percent
(<literal>%</literal>) sign followed by two hex digits. This is
the encoding described in RFC 1738 for protecting literal
characters from being interpreted as special URL delimiters, and
for protecting URLs from being mangled by transmission media
with character conversions (like some email systems). For
example, if you want to include a password in an FTP URL:
</para>
<para>
<example>
<title><function>rawurlencode</function> example 1</title>
<programlisting role="php">
<!-- $Revision: 1.9 $ -->
<refentry id="function.rawurlencode">
<refnamediv>
<refname>rawurlencode</refname>
<refpurpose>URL-encode according to RFC 1738</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>rawurlencode</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
Returns a string in which all non-alphanumeric characters except
<literal>-_.</literal> have been replaced with a percent
(<literal>%</literal>) sign followed by two hex digits. This is
the encoding described in RFC 1738 for protecting literal
characters from being interpreted as special URL delimiters, and
for protecting URLs from being mangled by transmission media
with character conversions (like some email systems). For
example, if you want to include a password in an FTP URL:
</para>
<para>
<example>
<title><function>rawurlencode</function> example 1</title>
<programlisting role="php">
<![CDATA[
<?php
echo '<a href="ftp://user:', rawurlencode('foo @+%/'),
'@ftp.example.com/x.txt">';
?>
]]>
</programlisting>
</example>
</para>
<para>
Or, if you pass information in a PATH_INFO component of the URL:
</para>
<para>
<example>
<title><function>rawurlencode</function> example 2</title>
<programlisting role="php">
</programlisting>
</example>
</para>
<para>
Or, if you pass information in a PATH_INFO component of the URL:
</para>
<para>
<example>
<title><function>rawurlencode</function> example 2</title>
<programlisting role="php">
<![CDATA[
<?php
echo '<a href="http://example.com/department_list_script/',
rawurlencode('sales and marketing/Miami'), '">';
?>
]]>
</programlisting>
</example>
</para>
<simpara>
See also <function>rawurldecode</function>,
<function>urldecode</function>,
<function>urlencode</function> and
<ulink url="&url.rfc;1738">RFC 1738</ulink>.
</simpara>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<simpara>
See also <function>rawurldecode</function>,
<function>urldecode</function>,
<function>urlencode</function> and
<ulink url="&url.rfc;1738">RFC 1738</ulink>.
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,23 +1,23 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/url.xml, last change in rev 1.2 -->
<refentry id="function.urldecode">
<refnamediv>
<refname>urldecode</refname>
<refpurpose>Decodes URL-encoded string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>urldecode</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
Decodes any <literal>%<replaceable>##</replaceable></literal>
encoding in the given string. The decoded string is returned.
<example>
<title><function>urldecode</function> example</title>
<programlisting role="php">
<!-- $Revision: 1.4 $ -->
<refentry id="function.urldecode">
<refnamediv>
<refname>urldecode</refname>
<refpurpose>Decodes URL-encoded string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>urldecode</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
Decodes any <literal>%<replaceable>##</replaceable></literal>
encoding in the given string. The decoded string is returned.
<example>
<title><function>urldecode</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$a = explode('&', $QUERY_STRING);
@ -30,16 +30,16 @@ while ($i < count($a)) {
}
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>urlencode</function>,
<function>rawurlencode</function> and
<function>rawurldecode</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>urlencode</function>,
<function>rawurlencode</function> and
<function>rawurldecode</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,78 +1,78 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/url.xml, last change in rev 1.2 -->
<refentry id="function.urlencode">
<refnamediv>
<refname>urlencode</refname>
<refpurpose>URL-encodes string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>urlencode</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
Returns a string in which all non-alphanumeric characters except
<literal>-_.</literal> have been replaced with a percent
(<literal>%</literal>) sign followed by two hex digits and spaces
encoded as plus (<literal>+</literal>) signs. It is encoded the
same way that the posted data from a WWW form is encoded, that is
the same way as in
<literal>application/x-www-form-urlencoded</literal> media type.
This differs from the RFC1738 encoding (see
<function>rawurlencode</function>) in that for historical
reasons, spaces are encoded as plus (+) signs. This function is
convenient when encoding a string to be used in a query part of
a URL, as a convenient way to pass variables to the next page:
<example>
<title><function>urlencode</function> example</title>
<programlisting role="php">
<!-- $Revision: 1.9 $ -->
<refentry id="function.urlencode">
<refnamediv>
<refname>urlencode</refname>
<refpurpose>URL-encodes string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>urlencode</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
Returns a string in which all non-alphanumeric characters except
<literal>-_.</literal> have been replaced with a percent
(<literal>%</literal>) sign followed by two hex digits and spaces
encoded as plus (<literal>+</literal>) signs. It is encoded the
same way that the posted data from a WWW form is encoded, that is
the same way as in
<literal>application/x-www-form-urlencoded</literal> media type.
This differs from the RFC1738 encoding (see
<function>rawurlencode</function>) in that for historical
reasons, spaces are encoded as plus (+) signs. This function is
convenient when encoding a string to be used in a query part of
a URL, as a convenient way to pass variables to the next page:
<example>
<title><function>urlencode</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
echo '<a href="mycgi?foo=', urlencode($userinput), '">';
?>
]]>
</programlisting>
</example>
</para>
<para>
Note: Be careful about variables that may match HTML entities.
Things like &amp;amp, &amp;copy and &amp;pound are parsed by the
browser and the actual entity is used instead of the desired
variable name. This is an obvious hassle that the W3C has been
telling people about for years. The reference is here:
<ulink url="&url.argsep;">&url.argsep;</ulink>. PHP supports
changing the argument separator to the W3C-suggested semi-colon
through the arg_separator .ini directive. Unfortunately most user
agents do not send form data in this semi-colon separated format.
A more portable way around this is to use &amp;amp; instead of
&amp; as the separator. You don't need to change PHP's
arg_separator for this. Leave it as &amp;, but simply encode
your URLs using <function>htmlentities</function> or
<function>htmlspecialchars</function>.
</para>
<para>
<example>
<title><function>urlencode</function> and <function>htmlentities</function> example</title>
<programlisting role="php">
</programlisting>
</example>
</para>
<para>
Note: Be careful about variables that may match HTML entities.
Things like &amp;amp, &amp;copy and &amp;pound are parsed by the
browser and the actual entity is used instead of the desired
variable name. This is an obvious hassle that the W3C has been
telling people about for years. The reference is here:
<ulink url="&url.argsep;">&url.argsep;</ulink>. PHP supports
changing the argument separator to the W3C-suggested semi-colon
through the arg_separator .ini directive. Unfortunately most user
agents do not send form data in this semi-colon separated format.
A more portable way around this is to use &amp;amp; instead of
&amp; as the separator. You don't need to change PHP's
arg_separator for this. Leave it as &amp;, but simply encode
your URLs using <function>htmlentities</function> or
<function>htmlspecialchars</function>.
</para>
<para>
<example>
<title><function>urlencode</function> and <function>htmlentities</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$query_string = 'foo=' . urlencode($foo) . '&bar=' . urlencode($bar);
echo '<a href="mycgi?' . htmlentities($query_string) . '">';
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>urldecode</function>,
<function>htmlentities</function>,
<function>rawurldecode</function> and
<function>rawurlencode</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>urldecode</function>,
<function>htmlentities</function>,
<function>rawurldecode</function> and
<function>rawurlencode</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables: