Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit a09f8bb193f1203038024b16ab236cef5173d152 1 parent 3dd12f2
@helgi helgi authored
Showing with 125 additions and 0 deletions.
  1. +16 −0 README.ADD_LOCALE
  2. +109 −0 docs/Example_Locale.php
View
16 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 <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! ;)
View
109 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;
+ }
+}
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.