Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added charsetString variable #51

Merged
merged 2 commits into from
Mar 16, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 36 additions & 6 deletions src/VCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ class VCard
*/
public $charset = 'utf-8';

/**
* Charset string
*
* @var string
*/
private $charsetString = '';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed


/**
* Add address
*
Expand Down Expand Up @@ -89,7 +96,7 @@ public function addAddress(
// set property
$this->setProperty(
'address',
'ADR' . (($type != '') ? ';' . $type : ''),
'ADR' . (($type != '') ? ';' . $type : '') . $this->getCharsetString(),
$value
);

Expand Down Expand Up @@ -123,7 +130,7 @@ public function addCompany($company)
{
$this->setProperty(
'company',
'ORG',
'ORG' . $this->getCharsetString(),
$company
);

Expand Down Expand Up @@ -165,7 +172,7 @@ public function addJobtitle($jobtitle)
{
$this->setProperty(
'jobtitle',
'TITLE',
'TITLE' . $this->getCharsetString(),
$jobtitle
);

Expand Down Expand Up @@ -246,7 +253,7 @@ public function addName(
$property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix;
$this->setProperty(
'name',
'N',
'N' . $this->getCharsetString(),
$property
);

Expand All @@ -255,7 +262,7 @@ public function addName(
// set property
$this->setProperty(
'fullname',
'FN',
'FN' . $this->getCharsetString(),
trim(implode(' ', $values))
);
}
Expand All @@ -273,7 +280,7 @@ public function addNote($note)
{
$this->setProperty(
'note',
'NOTE',
'NOTE' . $this->getCharsetString(),
$note
);

Expand Down Expand Up @@ -487,6 +494,16 @@ public function getCharset()
return $this->charset;
}

/**
* Get charset string
*
* @return string
*/
public function getCharsetString()
{
return $this->charsetString;
}

/**
* Get content type
*
Expand Down Expand Up @@ -640,6 +657,19 @@ public function setCharset($charset)
$this->charset = $charset;
}

/**
* Set charset string
*
* @param string $charset The charset for one property
* @return void
*/
public function setCharsetString($charset)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jako, please remove this function and integrate this code into ->getCharsetString(), since we already have our $this->charset; and ->setCharset($charset), your setCharsetString seems obsolete.

{
if ($charset) {
$this->charsetString = ';CHARSET=' . $charset;
}
}

/**
* Set filename
*
Expand Down