? zipcodeNEW.module
? zipcode_hu.patch
Index: zipcode.hu.inc
===================================================================
RCS file: zipcode.hu.inc
diff -N zipcode.hu.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ zipcode.hu.inc	7 Feb 2010 12:56:25 -0000
@@ -0,0 +1,44 @@
+<?php
+// $Id$
+
+// Copyright 2008 Thierry GUEGAN http://www.arvoriad.com 
+
+/**
+ * @file
+ * CCK Field for Hungarian zipcodes.
+ */
+ 
+/**  
+ * Verification for Hungarian zipcodes.  
+ *
+ * @param string $text
+ * @return boolean Returns boolean FALSE if the zipcode is not valid. 
+ * On success, returns a string containting the zipcode with some formatting.
+ */
+function valid_hu_zipcode($zipcodestring) {
+  $zipcodestring = trim($zipcodestring);
+
+  if (!preg_match('/^[1-9]\d{3}$/', $zipcodestring)) { 
+  	return FALSE; 
+  }
+  //right now just do a quick check ==> has to be improved 
+  //need to check more precisely by doing a query on a zipcode table, ...
+  else 
+  {
+	return TRUE;
+  }
+} 
+	
+/**
+ * Formatting for zipcode.  
+ *
+ * @param string $zipcodestring
+ * @return string Returns a string containting the zipcode with some formatting.
+ */
+function format_hu_zipcode($zipcodestring) {
+
+  $zipcodestring = trim($zipcodestring);
+  //do some formatting 
+  return $zipcodestring;
+}
+
