Skip to content

Commit

Permalink
Add a example locale file and update the add locale readme file.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.php.net/repository/pear/packages/Validate/trunk@201316 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
helgi committed Nov 26, 2005
1 parent 3dd12f2 commit a09f8bb
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.ADD_LOCALE
Expand Up @@ -16,3 +16,19 @@ be fullfilled:

Only the current active leads of Validate can agree or
not to publish a subpackage (actually pajoye, dufuz).

If you need an starting point then take a look at Example_Locale.php in
the docs dir (http://cvs.php.net/pear/Validate/docs/)
You can take that file to have something to start from and also to have
three functions to start implementing before doing your first release.

To make things even easier then you just go in there and replace [Your Name]
with your real name <example@example.org> with your email (but still keeping
the <> around the email) and [LocaleName] should be replaced with your locale
name, like say HU or IS or such.

Now you just have to implement those functions and write further info for each
function where relevant (some countries have more requirements than others
and the end developer has to know those things, urls to those infos are also fine)
and if you have any extra functions in mind then just go and implement
those also! ;)
109 changes: 109 additions & 0 deletions docs/Example_Locale.php
@@ -0,0 +1,109 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2005 [Your Name] |
// +----------------------------------------------------------------------+
// | This source file is subject to the New BSD license, That is bundled |
// | with this package in the file LICENSE, and is available through |
// | the world-wide-web at |
// | http://www.opensource.org/licenses/bsd-license.php |
// | If you did not receive a copy of the new BSDlicense and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | pajoye@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Author: Tomas V.V.Cox <cox@idecnet.com> |
// | Pierre-Alain Joye <pajoye@php.net> |
// +----------------------------------------------------------------------+
//
/**
* Specific validation methods for data used in the [LocaleName]
*
* @category Validate
* @package Validate_[LocaleName]
* @author [Your Name] <example@example.org>
* @copyright 1997-2005 [Your name]
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version CVS: $Id$
* @link http://pear.php.net/package/Validate_[LocaleName]
*/

/**
* Data validation class for the [LocaleName]
*
* This class provides methods to validate:
* - SSN
* - Postal code
* - Telephone number
*
* @category Validate
* @package Validate_[LocaleName]
* @author [Your Name] <example@example.org>
* @copyright 1997-2005 [Your name]
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @version Release: @package_version@
* @link http://pear.php.net/package/Validate_[LocaleName]
*/
class Validate_[LocaleName]
{
/**
* validates a postcode
*
* [Further info goes here]
*
* @access public
* @author [Your name] <example@example.org>
* @param string the postcode to be validated
* @param bool optional; strong checks (e.g. against a list of postcodes) (not implanted)
*
* @return bool true on success false on failure
*/
function postalCode($postcode, $strong = false)
{
if (ctype_digit($number)) {
return true;
}

return false;
}

/**
* Validates a social security number
*
* [Further info goes here]
*
* @access public
* @author [Your name] <example@example.org>
* @param string $ssn SSN
*
* @return bool true on success false on failure
*/
function ssn($ssn)
{
if (ctype_digit($number)) {
return true;
}

return false;
}

/**
* Validate a phone number
*
* [Further info goes here]
*
* @access public
* @author [Your name] <example@example.org>
* @param string $number the tel number
*
* @return bool true on success false on failure
*/
function phoneNumber($number)
{
if (ctype_digit($number)) {
return true;
}

return false;
}
}
?>

0 comments on commit a09f8bb

Please sign in to comment.