svn: /pear/peardoc/trunk/en/package/ networking/net-checkip2/check-ip.xml networking/net-checkip2/class.xml networking/net-checkip2/convert.xml networking-entities.xml
[email protected] (Till Klampaeckel)
| Newsgroups | php.pear.doc |
|---|---|
| Message-ID | <[email protected]> |
till Tue, 06 Oct 2009 16:33:29 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=289254
Log:
* adding docs for Net_CheckIP2
* still broken (class.xml)
Changed paths:
A + pear/peardoc/trunk/en/package/networking/net-checkip2/
(from pear/peardoc/trunk/en/package/networking/net-checkip/:r289252)
U pear/peardoc/trunk/en/package/networking/net-checkip2/check-ip.xml
A + pear/peardoc/trunk/en/package/networking/net-checkip2/class.xml
(from pear/peardoc/trunk/en/package/networking/net-checkip/check-ip.xml:r289252)
A + pear/peardoc/trunk/en/package/networking/net-checkip2/convert.xml
(from pear/peardoc/trunk/en/package/networking/net-checkip/check-ip.xml:r289252)
U pear/peardoc/trunk/en/package/networking-entities.xml
Property changes on: pear/peardoc/trunk/en/package/networking/net-checkip2
___________________________________________________________________
Added: svn:mergeinfo
+
Modified: pear/peardoc/trunk/en/package/networking/net-checkip2/check-ip.xml
===================================================================
--- pear/peardoc/trunk/en/package/networking/net-checkip/check-ip.xml 2009-10-06 15:27:14 UTC (rev 289252)
+++ pear/peardoc/trunk/en/package/networking/net-checkip2/check-ip.xml 2009-10-06 16:33:29 UTC (rev 289254)
@@ -1,27 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
-<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.networking.net-checkip.check-ip">
+<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.networking.net-checkip2.check-ip">
<refnamediv>
- <refname>Net_CheckIP::check_ip()</refname>
+ <refname>Net_CheckIP2::isValid()</refname>
<refpurpose>Validation of IPv4 addresses</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>
- require_once 'Net/CheckIP.php';
+ require_once 'Net/CheckIP2.php';
</funcsynopsisinfo>
<funcprototype>
- <funcdef>boolean <function>Net_CheckIP::check_ip</function></funcdef>
+ <funcdef>boolean <function>Net_CheckIP2::isValid</function></funcdef>
<paramdef choice="req">string <parameter>$ip</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
- <refsection xml:id="package.networking.net-queckip.check-ip.desc">
+ <refsection xml:id="package.networking.net-checkip2.check-ip.desc">
&title.desc;
<para>
This function can validate if a given string has a valid IPv4 syntax.
</para>
</refsection>
- <refsection xml:id="package.networking.net-checkip.check-ip.parameter">
+ <refsection xml:id="package.networking.net-checkip2.check-ip.parameter">
&title.param;
<para>
<itemizedlist>
@@ -33,25 +33,25 @@
</itemizedlist>
</para>
</refsection>
- <refsection xml:id="package.networking.net-checkip.check-ip.return">
+ <refsection xml:id="package.networking.net-checkip2.check-ip.return">
&title.returns;
<para>
<parameter>boolean</parameter> - &true;, if syntax is valid
</para>
</refsection>
- <refsection xml:id="package.networking.net-checkip.check-ip.note">
+ <refsection xml:id="package.networking.net-checkip2.check-ip.note">
&title.note;
¬e.canstatic;
</refsection>
- <refsection xml:id="package.networking.net-checkip.check-ip.example">
+ <refsection xml:id="package.networking.net-checkip2.check-ip.example">
&title.example;
- <example><info><title>Using <function>check_ip</function></title></info>
+ <example><info><title>Using <function>isValid</function></title></info>
<programlisting role="php">
<![CDATA[
-require_once "Net_CheckIP/CheckIP.php";
+require_once 'Net_CheckIP2/CheckIP.php';
-if (Net_CheckIP::check_ip("your_ip_goes_here")) {
+if (Net_CheckIP::isValid("your_ip_goes_here")) {
// Syntax of the IP is ok
}
]]>
Copied: pear/peardoc/trunk/en/package/networking/net-checkip2/class.xml (from rev 289252, pear/peardoc/trunk/en/package/networking/net-checkip/check-ip.xml)
===================================================================
--- pear/peardoc/trunk/en/package/networking/net-checkip2/class.xml (rev 0)
+++ pear/peardoc/trunk/en/package/networking/net-checkip2/class.xml 2009-10-06 16:33:29 UTC (rev 289254)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<chapter xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ version="lillet"
+ xml:id="package.networking.net-checkip2.class"
+ xmlns:phd="http://www.php.net/ns/phd"
+>
+ <info>
+ <title>Class networks</title>
+ </info>
+
+ <para>
+ <classname>Net_CheckIP2</classname> has a getClass method which helps the developer
+ to determine if the IP is within an class A, B or C network.
+ </para>
+
+ <para>
+ In case getClass is unable to determine the class, or the IP is invalid, false is
+ returned.
+ </para>
+
+ <example>
+ <info>
+ <title>getClass</title>
+ </info>
+ <programlisting role="php"><![CDATA[
+require_once 'Net/CheckIP.php';
+$ip = '127.0.0.1';
+
+$classNetwork = Net_CheckIP::getClass($ip);
+if ($classNetwork === false) {
+ die('Unable to determine the class. The IP might be invalid also.');
+}
+switch ($classNetwork) {
+case Net_CheckIP2::CLASS_A:
+ echo 'Class A network.';
+ break;
+case Net_CheckIP2::CLASS_B:
+ echo 'Class B network.';
+ break;
+case Net_CheckIP2::CLASS_C:
+ echo 'Class C network.';
+ break;
+}
+ ]]></programlisting>
+ </example>
+
+</chapter>
\ No newline at end of file
Property changes on: pear/peardoc/trunk/en/package/networking/net-checkip2/class.xml
___________________________________________________________________
Added: cvs2svn:cvs-rev
+ 1.5
Added: svn:mergeinfo
+
Copied: pear/peardoc/trunk/en/package/networking/net-checkip2/convert.xml (from rev 289252, pear/peardoc/trunk/en/package/networking/net-checkip/check-ip.xml)
===================================================================
--- pear/peardoc/trunk/en/package/networking/net-checkip2/convert.xml (rev 0)
+++ pear/peardoc/trunk/en/package/networking/net-checkip2/convert.xml 2009-10-06 16:33:29 UTC (rev 289254)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<chapter xmlns="http://docbook.org/ns/docbook"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ version="lillet"
+ xml:id="package.networking.net-checkip2.convert"
+>
+
+ <info>
+ <title>From Net_CheckIP to Net_CheckIP2</title>
+ </info>
+
+ <para>
+ <classname>Net_CheckIP2</classname> is meant to replace the <classname>Net_CheckIP
+ </classname> package with a couple small changes:
+ </para>
+
+ <example>
+ <info>
+ <title>Old</title>
+ </info>
+ <programlisting role="php"><![CDATA[
+require_once 'Net/CheckIP.php';
+$ip = '127.0.0.1';
+if (Net_CheckIP::check_ip($ip) {
+ echo 'This is a valid IPv4 address!';
+}
+ ]]></programlisting>
+ </example>
+
+ <example>
+ <info>
+ <title>New</title>
+ </info>
+ <programlisting role="php"><![CDATA[
+require_once 'Net/CheckIP2.php';
+$ip = '127.0.0.1';
+if (Net_CheckIP2::isValid($ip) {
+ echo 'This is a valid IPv4 address!';
+}
+ ]]></programlisting>
+ </example>
+
+</chapter>
\ No newline at end of file
Property changes on: pear/peardoc/trunk/en/package/networking/net-checkip2/convert.xml
___________________________________________________________________
Added: cvs2svn:cvs-rev
+ 1.5
Added: svn:mergeinfo
+
Modified: pear/peardoc/trunk/en/package/networking-entities.xml
===================================================================
--- pear/peardoc/trunk/en/package/networking-entities.xml 2009-10-06 16:06:34 UTC (rev 289253)
+++ pear/peardoc/trunk/en/package/networking-entities.xml 2009-10-06 16:33:29 UTC (rev 289254)
@@ -1,4 +1,5 @@
&package.networking.net-checkip;
+&package.networking.net-checkip2;
&package.networking.net-dns;
&package.networking.net-dnsbl;
&package.networking.net-finger;