Skip to content

Commit 33349c6

Browse files
committed
Merge pull request #19 from pilsetnieks/master
Extending vCard now possible
2 parents ca8246f + 7ffe5c7 commit 33349c6

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

vCard.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,10 @@ public function __construct($Path = false, $RawData = false, array $Options = nu
134134
{
135135
// Prepending "BEGIN:VCARD" to the raw string because we exploded on that one.
136136
// If there won't be the BEGIN marker in the new object, it will fail.
137-
138137
$SinglevCardRawData = 'BEGIN:VCARD'."\n".$SinglevCardRawData;
139-
$this -> Data[] = new vCard(false, $SinglevCardRawData);
138+
139+
$ClassName = get_class($this);
140+
$this -> Data[] = new $ClassName(false, $SinglevCardRawData);
140141
}
141142
}
142143
else
@@ -181,7 +182,8 @@ public function __construct($Path = false, $RawData = false, array $Options = nu
181182

182183
if ((strpos($Key, 'agent') === 0) && (stripos($Value, 'begin:vcard') !== false))
183184
{
184-
$Value = new vCard(false, str_replace('-wrap-', "\n", $Value));
185+
$ClassName = get_class($this);
186+
$Value = new $ClassName(false, str_replace('-wrap-', "\n", $Value));
185187
if (!isset($this -> Data[$Key]))
186188
{
187189
$this -> Data[$Key] = array();

0 commit comments

Comments
 (0)