// | 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
*
*/
* Used to make string human-readable after being a vCard value.
*
* Converts...
+ * \: => :
* \; => ;
* \, => ,
* literal \n => newline
$text[$key] = $val;
}
} else {
+ $text = str_replace('\:', ':', $text);
$text = str_replace('\;', ';', $text);
$text = str_replace('\,', ',', $text);
$text = str_replace('\n', "\n", $text);
$split = $this->splitBySemi($text);
// only return first element (the typedef)
- return $split[0];
+ return strtoupper($split[0]);
}
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)
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
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