From a09f8bb193f1203038024b16ab236cef5173d152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helgi=20=C3=9Eormar=20=C3=9Eorbj=C3=B6rnsson?= Date: Sat, 26 Nov 2005 10:51:30 +0000 Subject: [PATCH] Add a example locale file and update the add locale readme file. git-svn-id: http://svn.php.net/repository/pear/packages/Validate/trunk@201316 c90b9560-bf6c-de11-be94-00142212c4b1 --- README.ADD_LOCALE | 16 ++++++ docs/Example_Locale.php | 109 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 docs/Example_Locale.php diff --git a/README.ADD_LOCALE b/README.ADD_LOCALE index d886ba6..d78b199 100644 --- a/README.ADD_LOCALE +++ b/README.ADD_LOCALE @@ -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 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! ;) diff --git a/docs/Example_Locale.php b/docs/Example_Locale.php new file mode 100644 index 0000000..6880bef --- /dev/null +++ b/docs/Example_Locale.php @@ -0,0 +1,109 @@ + | +// | Pierre-Alain Joye | +// +----------------------------------------------------------------------+ +// +/** + * Specific validation methods for data used in the [LocaleName] + * + * @category Validate + * @package Validate_[LocaleName] + * @author [Your Name] + * @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] + * @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] + * @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] + * @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] + * @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; + } +} +?>