cvs: peardoc /en/package/validate/validate_ca intro.xml validations.xml
| From: | Christophe Gesch� | Date: | Mon, 21 Aug 2006 22:10:26 +0000 |
| Subject: | cvs: peardoc /en/package/validate/validate_ca intro.xml validations.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-8342@lists.php.net to get a copy of this message | ||
moosh Mon Aug 21 22:10:26 2006 UTC
Added files:
/peardoc/en/package/validate/validate_ca intro.xml validations.xml
Log:
- doc for Validate_CA
http://cvs.php.net/viewvc.cgi/peardoc/en/package/validate/validate_ca/intro.xml?view=markup&rev=1.1 Index: peardoc/en/package/validate/validate_ca/intro.xml +++ peardoc/en/package/validate/validate_ca/intro.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <!-- $Id: intro.xml,v 1.1 2006/08/21 22:10:25 moosh Exp $ --> <!-- package-release: beta --> <refentry id="package.validate.validate_ca.intro"> <refnamediv> <refname>Introduction</refname> <refpurpose>Introduction to validate_CA</refpurpose> </refnamediv> <refsect1 id="package.validate.validate_ca.intro.desc"> &title.desc; <para> The package offers some methods to validate specific data for Canada </para> <para> </para> </refsect1> <refsect1 id="package.validate.validate_ca.intro.usage"> <title>Usage</title> <refsect2 id="package.validate.validate_ca.intro.usage.general"> <title>General usage</title> <para> Every module of Validate follows the same philosophy. Propose some validation method retuning boolean result. Some methods have some optional parameters to set a stronger check. </para> </refsect2> <refsect2 id="package.validate.validate_ca.intro.usage.sample"> <title>sample</title> <para> <programlisting role="php"> <![CDATA[ <?php // Include the package require_once 'Validate/CA.php'; ?> ]]> </programlisting> </para> </refsect2> </refsect1> </refentry> <!-- 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: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/peardoc/en/package/validate/validate_ca/validations.xml?view=markup&rev=1.1 Index: peardoc/en/package/validate/validate_ca/validations.xml +++ peardoc/en/package/validate/validate_ca/validations.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <!-- $Id: validations.xml,v 1.1 2006/08/21 22:10:25 moosh Exp $ --> <!-- package-release: beta --> <refentry id="package.validate.validate_ca.validations"> <refnamediv> <refname>List of aivailable validations</refname> <refpurpose>aivailable validation in validate_ca</refpurpose> </refnamediv> <refsect1 id="package.validate.validate_ca.validations.ssn"> <title>Validate a canadian social security number</title> <para> The canadian social security number is on the SIS card of all canadian. </para> <para> A check digit is the last one, computed the standard _get_control_number function. </para> <refsect2 id="package.validate.validate_ca.validations.ssn.sample"> <title>sample</title> <para> <programlisting role="php"> <![CDATA[ <?php // Include the package require_once('Validate/CA.php'); $badSsn = '012345674'; $result = Validate_CA::ssn($badSsn); echo 'Test ' . $badSsn .' : <br />'; var_export($result); echo '<br /><br />'; $goodSsn = '123456782'; $result = Validate_CA::ssn($goodSsn); echo 'Test ' . $goodSsn .' : <br />'; var_export($result); ?> ]]> </programlisting> </para> <para> Output : <screen> <computeroutput> Test 012345674 : false Test 123456782 : true </computeroutput> </screen> </para> </refsect2> </refsect1> <refsect1 id="package.validate.validate_ca.validations.postcode"> <title>Validate a canadian postcode</title> <para> The postal code is a six-character, uniformly structured alphanumeric code in the form of ANA NAN where <quote>A</quote> represents an alphabetic character and <quote>N</quote> represents a numeric character. </para> <para> The postal code is made up of two segments: </para> <para> The first, the Forward Sortation Area (FSA), is a combination of three characters (alpha - numeric - alpha). </para> <para> It identifies a major geographic area in an urban or a rural location. </para> <para> The third character of the FSA segment (M4B), in conjunction with the first two characters, describes an exact area of a city or town or other geographic area. </para> <para> The second segment, Local Delivery Unit (LDU), is a combination of three characters (numeric - alpha - numeric). </para> <para> It identifies the smallest delivery unit within a forward sortation area. </para> <para> The LDU, identified by the last three characters of the postal code, allows for a final sort within an FSA. </para> <para> In Urban Areas, the last three digits may indicate a specific city block (one side of a street between two intersecting streets), a single building or, in some cases, a large volume mail receiver. </para> <para> In Rural Areas, the last three digits (LDU), together with the FSA, identify a specific Rural community. </para> <para> First parameter of the method is the post code to validate. </para> <para> An optional parameter for limite the request to a province. </para> <refsect2 id="package.validate.validate_ca.validations.postcode.sample"> <title>sample</title> <para> <programlisting role="php"> <![CDATA[ <?php // Include the package require_once('Validate/CA.php'); $badPostCode = '48103'; $result = Validate_CA::postCode($badPostCode); echo 'Test ' . $badPostCode .' : <br />'; var_export($result); echo '<br /><br />'; $goodPostCode = 'H2M 2J1'; $result = Validate_CA::postCode($goodPostCode); echo 'Test ' . $goodPostCode .' : <br />'; var_export($result); ?> ]]> </programlisting> </para> <para> Output : <screen> <computeroutput> Test 48103 : false Test H2M 2J1 : true </computeroutput> </screen> </para> </refsect2> <refsect2 id="package.validate.validate_ca.validations.postcode.sample.witharea"> <title>sample using province parameter</title> <para> H2M 2J1 like a good post code, but province don't exit. <programlisting role="php"> <![CDATA[ <?php // Include the package require_once('Validate/CA.php'); $postCode = 'H2M 2J1'; // in Montreal area $result = Validate_CA::postalCode($postCode); echo 'Test ' . $postCode .' : <br />'; var_export($result); echo '<br /><br />'; $result = Validate_CA::postalCode($postCode,'QC'); // QC for Montreal echo 'Test ' . $postCode .' in QC: <br />'; var_export($result); echo '<br /><br />'; $result = Validate_CA::postalCode($postCode,'AB'); // AB for Toronto echo 'Test ' . $postCode .' in AB: <br />'; var_export($result); ?> ]]> </programlisting> </para> <para> Output : <screen> <computeroutput> Test H2M 2J1 : true Test H2M 2J1 in QC: true Test H2M 2J1 in AB: false </computeroutput> </screen> </para> </refsect2> </refsect1> <refsect1 id="package.validate.validate_ca.validations.phonenumber"> <title>Validate a phonenumber</title> <para> Canada and the United States share the same numbering plan, hence you can also call Validate_US::phoneNumber() </para> <para> Can allow only seven digit numbers. </para> <para> Also allows the formats, (xxx) xxx-xxxx, xxx xxx-xxxx, and now x (xxx) xxx-xxxx or various combination without spaces or dashes. </para> <refsect2 id="package.validate.validate_ca.validations.phonenumber.sample"> <title>sample</title> <para> <programlisting role="php"> <![CDATA[ <?php // Include the package require_once('Validate/CA.php'); $phoneNumber = '467875098x'; $result = Validate_CA::phoneNumber($phoneNumber); echo 'Test ' . $phoneNumber .' : <br />'; var_export($result); echo '<br />'; $phoneNumber = '4678750987'; $result = Validate_CA::phoneNumber($phoneNumber); echo 'Test ' . $phoneNumber .' : <br />'; var_export($result); ?> ]]> </programlisting> </para> <para> Output : <screen> <computeroutput> Test 467875098x : false Test 4678750987 : true </computeroutput> </screen> </para> </refsect2> <refsect2 id="package.validate.validate_ca.validations.vat.phonenumber.noprefix"> <title>sample</title> <para> See now with the parameter </para> <para> <programlisting role="php"> <![CDATA[ <?php // Include the package require_once('Validate/CA.php'); $phoneNumber = '8750987'; $result = Validate_CA::phoneNumber($phoneNumber,false); echo 'Test ' . $phoneNumber .' : <br />'; var_export($result); echo '<br /><br />'; $phoneNumber = '8750987'; echo 'Test ' . $phoneNumber .' : <br />'; echo 'With $requireAreaCode false <br />'; $result = Validate_CA::phoneNumber($phoneNumber,false); var_export($result); echo '<br />'; echo 'With $requireAreaCode true<br />'; $result = Validate_CA::phoneNumber($phoneNumber,true); var_export($result); echo '<br /><br />'; $phoneNumber = '(467)8750987'; echo 'Test ' . $phoneNumber .' : <br />'; echo 'With $requireAreaCode false <br />'; $result = Validate_CA::phoneNumber($phoneNumber,false); var_export($result); echo '<br />'; echo 'With $requireAreaCode true<br />'; $result = Validate_CA::phoneNumber($phoneNumber,true); var_export($result); ?> ]]> </programlisting> </para> <para> Output : <screen> <computeroutput> Test 8750987 : true Test 8750987 : With $requireAreaCode false true With $requireAreaCode true false Test (467)8750987 : With $requireAreaCode false false With $requireAreaCode true true </computeroutput> </screen> </para> </refsect2> </refsect1> </refentry> <!-- 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: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->
http://cvs.php.net/viewvc.cgi/peardoc/en/package/validate/validate_ca/intro.xml?view=markup&rev=1.1 Index: peardoc/en/package/validate/validate_ca/intro.xml +++ peardoc/en/package/validate/validate_ca/intro.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <!-- $Id: intro.xml,v 1.1 2006/08/21 22:10:25 moosh Exp $ --> <!-- package-release: beta --> <refentry id="package.validate.validate_ca.intro"> <refnamediv> <refname>Introduction</refname> <refpurpose>Introduction to validate_CA</refpurpose> </refnamediv> <refsect1 id="package.validate.validate_ca.intro.desc"> &title.desc; <para> The package offers some methods to validate specific data for Canada </para> <para> </para> </refsect1> <refsect1 id="package.validate.validate_ca.intro.usage"> <title>Usage</title> <refsect2 id="package.validate.validate_ca.intro.usage.general"> <title>General usage</title> <para> Every module of Validate follows the same philosophy. Propose some validation method retuning boolean result. Some methods have some optional parameters to set a stronger check. </para> </refsect2> <refsect2 id="package.validate.validate_ca.intro.usage.sample"> <title>sample</title> <para> <programlisting role="php"> <![CDATA[ <?php // Include the package require_once 'Validate/CA.php'; ?> ]]> </programlisting> </para> </refsect2> </refsect1> </refentry> <!-- 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: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/peardoc/en/package/validate/validate_ca/validations.xml?view=markup&rev=1.1 Index: peardoc/en/package/validate/validate_ca/validations.xml +++ peardoc/en/package/validate/validate_ca/validations.xml <?xml version="1.0" encoding="iso-8859-1" ?> <!-- $Revision: 1.1 $ --> <!-- $Id: validations.xml,v 1.1 2006/08/21 22:10:25 moosh Exp $ --> <!-- package-release: beta --> <refentry id="package.validate.validate_ca.validations"> <refnamediv> <refname>List of aivailable validations</refname> <refpurpose>aivailable validation in validate_ca</refpurpose> </refnamediv> <refsect1 id="package.validate.validate_ca.validations.ssn"> <title>Validate a canadian social security number</title> <para> The canadian social security number is on the SIS card of all canadian. </para> <para> A check digit is the last one, computed the standard _get_control_number function. </para> <refsect2 id="package.validate.validate_ca.validations.ssn.sample"> <title>sample</title> <para> <programlisting role="php"> <![CDATA[ <?php // Include the package require_once('Validate/CA.php'); $badSsn = '012345674'; $result = Validate_CA::ssn($badSsn); echo 'Test ' . $badSsn .' : <br />'; var_export($result); echo '<br /><br />'; $goodSsn = '123456782'; $result = Validate_CA::ssn($goodSsn); echo 'Test ' . $goodSsn .' : <br />'; var_export($result); ?> ]]> </programlisting> </para> <para> Output : <screen> <computeroutput> Test 012345674 : false Test 123456782 : true </computeroutput> </screen> </para> </refsect2> </refsect1> <refsect1 id="package.validate.validate_ca.validations.postcode"> <title>Validate a canadian postcode</title> <para> The postal code is a six-character, uniformly structured alphanumeric code in the form of ANA NAN where <quote>A</quote> represents an alphabetic character and <quote>N</quote> represents a numeric character. </para> <para> The postal code is made up of two segments: </para> <para> The first, the Forward Sortation Area (FSA), is a combination of three characters (alpha - numeric - alpha). </para> <para> It identifies a major geographic area in an urban or a rural location. </para> <para> The third character of the FSA segment (M4B), in conjunction with the first two characters, describes an exact area of a city or town or other geographic area. </para> <para> The second segment, Local Delivery Unit (LDU), is a combination of three characters (numeric - alpha - numeric). </para> <para> It identifies the smallest delivery unit within a forward sortation area. </para> <para> The LDU, identified by the last three characters of the postal code, allows for a final sort within an FSA. </para> <para> In Urban Areas, the last three digits may indicate a specific city block (one side of a street between two intersecting streets), a single building or, in some cases, a large volume mail receiver. </para> <para> In Rural Areas, the last three digits (LDU), together with the FSA, identify a specific Rural community. </para> <para> First parameter of the method is the post code to validate. </para> <para> An optional parameter for limite the request to a province. </para> <refsect2 id="package.validate.validate_ca.validations.postcode.sample"> <title>sample</title> <para> <programlisting role="php"> <![CDATA[ <?php // Include the package require_once('Validate/CA.php'); $badPostCode = '48103'; $result = Validate_CA::postCode($badPostCode); echo 'Test ' . $badPostCode .' : <br />'; var_export($result); echo '<br /><br />'; $goodPostCode = 'H2M 2J1'; $result = Validate_CA::postCode($goodPostCode); echo 'Test ' . $goodPostCode .' : <br />'; var_export($result); ?> ]]> </programlisting> </para> <para> Output : <screen> <computeroutput> Test 48103 : false Test H2M 2J1 : true </computeroutput> </screen> </para> </refsect2> <refsect2 id="package.validate.validate_ca.validations.postcode.sample.witharea"> <title>sample using province parameter</title> <para> H2M 2J1 like a good post code, but province don't exit. <programlisting role="php"> <![CDATA[ <?php // Include the package require_once('Validate/CA.php'); $postCode = 'H2M 2J1'; // in Montreal area $result = Validate_CA::postalCode($postCode); echo 'Test ' . $postCode .' : <br />'; var_export($result); echo '<br /><br />'; $result = Validate_CA::postalCode($postCode,'QC'); // QC for Montreal echo 'Test ' . $postCode .' in QC: <br />'; var_export($result); echo '<br /><br />'; $result = Validate_CA::postalCode($postCode,'AB'); // AB for Toronto echo 'Test ' . $postCode .' in AB: <br />'; var_export($result); ?> ]]> </programlisting> </para> <para> Output : <screen> <computeroutput> Test H2M 2J1 : true Test H2M 2J1 in QC: true Test H2M 2J1 in AB: false </computeroutput> </screen> </para> </refsect2> </refsect1> <refsect1 id="package.validate.validate_ca.validations.phonenumber"> <title>Validate a phonenumber</title> <para> Canada and the United States share the same numbering plan, hence you can also call Validate_US::phoneNumber() </para> <para> Can allow only seven digit numbers. </para> <para> Also allows the formats, (xxx) xxx-xxxx, xxx xxx-xxxx, and now x (xxx) xxx-xxxx or various combination without spaces or dashes. </para> <refsect2 id="package.validate.validate_ca.validations.phonenumber.sample"> <title>sample</title> <para> <programlisting role="php"> <![CDATA[ <?php // Include the package require_once('Validate/CA.php'); $phoneNumber = '467875098x'; $result = Validate_CA::phoneNumber($phoneNumber); echo 'Test ' . $phoneNumber .' : <br />'; var_export($result); echo '<br />'; $phoneNumber = '4678750987'; $result = Validate_CA::phoneNumber($phoneNumber); echo 'Test ' . $phoneNumber .' : <br />'; var_export($result); ?> ]]> </programlisting> </para> <para> Output : <screen> <computeroutput> Test 467875098x : false Test 4678750987 : true </computeroutput> </screen> </para> </refsect2> <refsect2 id="package.validate.validate_ca.validations.vat.phonenumber.noprefix"> <title>sample</title> <para> See now with the parameter </para> <para> <programlisting role="php"> <![CDATA[ <?php // Include the package require_once('Validate/CA.php'); $phoneNumber = '8750987'; $result = Validate_CA::phoneNumber($phoneNumber,false); echo 'Test ' . $phoneNumber .' : <br />'; var_export($result); echo '<br /><br />'; $phoneNumber = '8750987'; echo 'Test ' . $phoneNumber .' : <br />'; echo 'With $requireAreaCode false <br />'; $result = Validate_CA::phoneNumber($phoneNumber,false); var_export($result); echo '<br />'; echo 'With $requireAreaCode true<br />'; $result = Validate_CA::phoneNumber($phoneNumber,true); var_export($result); echo '<br /><br />'; $phoneNumber = '(467)8750987'; echo 'Test ' . $phoneNumber .' : <br />'; echo 'With $requireAreaCode false <br />'; $result = Validate_CA::phoneNumber($phoneNumber,false); var_export($result); echo '<br />'; echo 'With $requireAreaCode true<br />'; $result = Validate_CA::phoneNumber($phoneNumber,true); var_export($result); ?> ]]> </programlisting> </para> <para> Output : <screen> <computeroutput> Test 8750987 : true Test 8750987 : With $requireAreaCode false true With $requireAreaCode true false Test (467)8750987 : With $requireAreaCode false false With $requireAreaCode true true </computeroutput> </screen> </para> </refsect2> </refsect1> </refentry> <!-- 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: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->