Skip to content

Commit

Permalink
Merge pull request nuovo#19 from pilsetnieks/master
Browse files Browse the repository at this point in the history
Extending vCard now possible
  • Loading branch information
pilsetnieks committed Feb 24, 2013
2 parents ca8246f + 7ffe5c7 commit 33349c6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions vCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ public function __construct($Path = false, $RawData = false, array $Options = nu
{
// Prepending "BEGIN:VCARD" to the raw string because we exploded on that one.
// If there won't be the BEGIN marker in the new object, it will fail.

$SinglevCardRawData = 'BEGIN:VCARD'."\n".$SinglevCardRawData;
$this -> Data[] = new vCard(false, $SinglevCardRawData);

$ClassName = get_class($this);
$this -> Data[] = new $ClassName(false, $SinglevCardRawData);
}
}
else
Expand Down Expand Up @@ -181,7 +182,8 @@ public function __construct($Path = false, $RawData = false, array $Options = nu

if ((strpos($Key, 'agent') === 0) && (stripos($Value, 'begin:vcard') !== false))
{
$Value = new vCard(false, str_replace('-wrap-', "\n", $Value));
$ClassName = get_class($this);
$Value = new $ClassName(false, str_replace('-wrap-', "\n", $Value));
if (!isset($this -> Data[$Key]))
{
$this -> Data[$Key] = array();
Expand Down

0 comments on commit 33349c6

Please sign in to comment.