]> git.sur5r.net Git - contagged/blobdiff - inc/Contact_Vcard_Parse.php
Upgrade smarty from 2.6.18 to 2.6.30
[contagged] / inc / Contact_Vcard_Parse.php
index da1f16f139184a473e778ea1f052dd50225def4f..2c2cc59434be261a3b9ce966f9b1c0bac9bd9b44 100644 (file)
 // | obtain it through the world-wide-web, please send a note to          | 
 // | license@php.net so we can mail you a copy immediately.               | 
 // +----------------------------------------------------------------------+ 
-// | Authors: Paul M. Jones <pmjones@ciaweb.net>                          | 
+// | Authors: Paul M. Jones <pmjones@php.net>                             | 
 // +----------------------------------------------------------------------+ 
 // 
-// $Id: Contact_Vcard_Parse.php,v 1.1 2004/06/01 08:48:59 gohr Exp $ 
+// $Id: Contact_Vcard_Parse.php,v 1.4 2005/05/28 15:40:17 pmjones Exp $ 
 
 
 /**
 * </code>
 * 
 *
-* @author Paul M. Jones <pmjones@ciaweb.net>
+* @author Paul M. Jones <pmjones@php.net>
 * 
 * @package Contact_Vcard_Parse
 * 
-* @version 1.30
+* @version 1.31
 * 
 */
 
@@ -273,6 +273,7 @@ class Contact_Vcard_Parse {
     * Used to make string human-readable after being a vCard value.
     * 
     * Converts...
+    *     \: => :
     *     \; => ;
     *     \, => ,
     *     literal \n => newline
@@ -293,6 +294,7 @@ class Contact_Vcard_Parse {
                 $text[$key] = $val;
             }
         } else {
+            $text = str_replace('\:', ':', $text);
             $text = str_replace('\;', ';', $text);
             $text = str_replace('\,', ',', $text);
             $text = str_replace('\n', "\n", $text);
@@ -496,7 +498,7 @@ class Contact_Vcard_Parse {
         $split = $this->splitBySemi($text);
         
         // only return first element (the typedef)
-        return $split[0];
+        return strtoupper($split[0]);
     }
     
     
@@ -698,7 +700,8 @@ class Contact_Vcard_Parse {
     
     function _parseN($text)
     {
-        $tmp = $this->splitBySemi($text);
+       // make sure there are always at least 5 elements
+        $tmp = array_pad($this->splitBySemi($text), 5, '');
         return array(
             $this->splitByComma($tmp[0]), // family (last)
             $this->splitByComma($tmp[1]), // given (first)
@@ -728,7 +731,8 @@ class Contact_Vcard_Parse {
     
     function _parseADR($text)
     {
-        $tmp = $this->splitBySemi($text);
+       // make sure there are always at least 7 elements
+        $tmp = array_pad($this->splitBySemi($text), 7, '');
         return array(
             $this->splitByComma($tmp[0]), // pob
             $this->splitByComma($tmp[1]), // extend
@@ -825,7 +829,8 @@ class Contact_Vcard_Parse {
     
     function _parseGEO($text)
     {
-        $tmp = $this->splitBySemi($text);
+       // make sure there are always at least 2 elements
+        $tmp = array_pad($this->splitBySemi($text), 2, '');
         return array(
             array($tmp[0]), // lat
             array($tmp[1])  // lon