@@ -6,8 +6,8 @@ discard block |
||
| 6 | 6 | * @author Jeroen Desloovere <[email protected]> |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
| 10 | -require_once __DIR__ . '/../src/VCard.php'; |
|
| 9 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
| 10 | +require_once __DIR__.'/../src/VCard.php'; |
|
| 11 | 11 | |
| 12 | 12 | use JeroenDesloovere\VCard\VCard; |
| 13 | 13 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $vcard->addAddress(null, null, 'street', 'worktown', null, 'workpostcode', 'Belgium'); |
| 34 | 34 | $vcard->addURL('http://www.jeroendesloovere.be'); |
| 35 | 35 | |
| 36 | -$vcard->addPhoto(__DIR__ . '/assets/landscape.jpeg'); |
|
| 36 | +$vcard->addPhoto(__DIR__.'/assets/landscape.jpeg'); |
|
| 37 | 37 | |
| 38 | 38 | // return vcard as a string |
| 39 | 39 | //return $vcard->getOutput(); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | return $vcard->download(); |
| 43 | 43 | |
| 44 | 44 | // echo message |
| 45 | -echo 'A personal vCard is saved in this folder: ' . __DIR__; |
|
| 45 | +echo 'A personal vCard is saved in this folder: '.__DIR__; |
|
| 46 | 46 | |
| 47 | 47 | // or |
| 48 | 48 | |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * The raw VCard content. |
| 40 | - * |
|
| 40 | + * |
|
| 41 | 41 | * @var string |
| 42 | 42 | */ |
| 43 | 43 | protected $content; |
@@ -154,7 +154,7 @@ |
||
| 154 | 154 | $cardData->fullname = $value; |
| 155 | 155 | break; |
| 156 | 156 | case 'N': |
| 157 | - foreach($this->parseName($value) as $key => $val) { |
|
| 157 | + foreach ($this->parseName($value) as $key => $val) { |
|
| 158 | 158 | $cardData->{$key} = $val; |
| 159 | 159 | } |
| 160 | 160 | break; |
@@ -84,12 +84,12 @@ discard block |
||
| 84 | 84 | $type = 'WORK;POSTAL' |
| 85 | 85 | ) { |
| 86 | 86 | // init value |
| 87 | - $value = $name . ';' . $extended . ';' . $street . ';' . $city . ';' . $region . ';' . $zip . ';' . $country; |
|
| 87 | + $value = $name.';'.$extended.';'.$street.';'.$city.';'.$region.';'.$zip.';'.$country; |
|
| 88 | 88 | |
| 89 | 89 | // set property |
| 90 | 90 | $this->setProperty( |
| 91 | 91 | 'address', |
| 92 | - 'ADR' . (($type != '') ? ';' . $type : '') . $this->getCharsetString(), |
|
| 92 | + 'ADR'.(($type != '') ? ';'.$type : '').$this->getCharsetString(), |
|
| 93 | 93 | $value |
| 94 | 94 | ); |
| 95 | 95 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | $this->setProperty( |
| 125 | 125 | 'company', |
| 126 | - 'ORG' . $this->getCharsetString(), |
|
| 126 | + 'ORG'.$this->getCharsetString(), |
|
| 127 | 127 | $company |
| 128 | 128 | ); |
| 129 | 129 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | { |
| 149 | 149 | $this->setProperty( |
| 150 | 150 | 'email', |
| 151 | - 'EMAIL;INTERNET' . (($type != '') ? ';' . $type : ''), |
|
| 151 | + 'EMAIL;INTERNET'.(($type != '') ? ';'.$type : ''), |
|
| 152 | 152 | $address |
| 153 | 153 | ); |
| 154 | 154 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | { |
| 166 | 166 | $this->setProperty( |
| 167 | 167 | 'jobtitle', |
| 168 | - 'TITLE' . $this->getCharsetString(), |
|
| 168 | + 'TITLE'.$this->getCharsetString(), |
|
| 169 | 169 | $jobtitle |
| 170 | 170 | ); |
| 171 | 171 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | $type = strtoupper(str_replace('image/', '', $mimetype)); |
| 201 | 201 | |
| 202 | - $property .= ";ENCODING=b;TYPE=" . $type; |
|
| 202 | + $property .= ";ENCODING=b;TYPE=".$type; |
|
| 203 | 203 | } else { |
| 204 | 204 | if (filter_var($url, FILTER_VALIDATE_URL) !== FALSE) { |
| 205 | 205 | $propertySuffix = ';VALUE=URL'; |
@@ -220,9 +220,9 @@ discard block |
||
| 220 | 220 | throw new VCardMediaException('Returned data isn\'t an image.'); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - $propertySuffix .= ';TYPE=' . strtoupper($fileType); |
|
| 223 | + $propertySuffix .= ';TYPE='.strtoupper($fileType); |
|
| 224 | 224 | |
| 225 | - $property = $property . $propertySuffix; |
|
| 225 | + $property = $property.$propertySuffix; |
|
| 226 | 226 | $value = $url; |
| 227 | 227 | } else { |
| 228 | 228 | $value = $url; |
@@ -266,10 +266,10 @@ discard block |
||
| 266 | 266 | $this->setFilename($values); |
| 267 | 267 | |
| 268 | 268 | // set property |
| 269 | - $property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix; |
|
| 269 | + $property = $lastName.';'.$firstName.';'.$additional.';'.$prefix.';'.$suffix; |
|
| 270 | 270 | $this->setProperty( |
| 271 | 271 | 'name', |
| 272 | - 'N' . $this->getCharsetString(), |
|
| 272 | + 'N'.$this->getCharsetString(), |
|
| 273 | 273 | $property |
| 274 | 274 | ); |
| 275 | 275 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | // set property |
| 279 | 279 | $this->setProperty( |
| 280 | 280 | 'fullname', |
| 281 | - 'FN' . $this->getCharsetString(), |
|
| 281 | + 'FN'.$this->getCharsetString(), |
|
| 282 | 282 | trim(implode(' ', $values)) |
| 283 | 283 | ); |
| 284 | 284 | } |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | { |
| 297 | 297 | $this->setProperty( |
| 298 | 298 | 'note', |
| 299 | - 'NOTE' . $this->getCharsetString(), |
|
| 299 | + 'NOTE'.$this->getCharsetString(), |
|
| 300 | 300 | $note |
| 301 | 301 | ); |
| 302 | 302 | |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | { |
| 318 | 318 | $this->setProperty( |
| 319 | 319 | 'phoneNumber', |
| 320 | - 'TEL' . (($type != '') ? ';' . $type : ''), |
|
| 320 | + 'TEL'.(($type != '') ? ';'.$type : ''), |
|
| 321 | 321 | $number |
| 322 | 322 | ); |
| 323 | 323 | |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | { |
| 355 | 355 | $this->setProperty( |
| 356 | 356 | 'url', |
| 357 | - 'URL' . (($type != '') ? ';' . $type : ''), |
|
| 357 | + 'URL'.(($type != '') ? ';'.$type : ''), |
|
| 358 | 358 | $url |
| 359 | 359 | ); |
| 360 | 360 | |
@@ -371,13 +371,13 @@ discard block |
||
| 371 | 371 | // init string |
| 372 | 372 | $string = "BEGIN:VCARD\r\n"; |
| 373 | 373 | $string .= "VERSION:3.0\r\n"; |
| 374 | - $string .= "REV:" . date("Y-m-d") . "T" . date("H:i:s") . "Z\r\n"; |
|
| 374 | + $string .= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n"; |
|
| 375 | 375 | |
| 376 | 376 | // loop all properties |
| 377 | 377 | $properties = $this->getProperties(); |
| 378 | 378 | foreach ($properties as $property) { |
| 379 | 379 | // add to string |
| 380 | - $string .= $this->fold($property['key'] . ':' . $this->escape($property['value']) . "\r\n"); |
|
| 380 | + $string .= $this->fold($property['key'].':'.$this->escape($property['value'])."\r\n"); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | // add to string |
@@ -395,19 +395,19 @@ discard block |
||
| 395 | 395 | public function buildVCalendar() |
| 396 | 396 | { |
| 397 | 397 | // init dates |
| 398 | - $dtstart = date("Ymd") . "T" . date("Hi") . "00"; |
|
| 399 | - $dtend = date("Ymd") . "T" . date("Hi") . "01"; |
|
| 398 | + $dtstart = date("Ymd")."T".date("Hi")."00"; |
|
| 399 | + $dtend = date("Ymd")."T".date("Hi")."01"; |
|
| 400 | 400 | |
| 401 | 401 | // init string |
| 402 | 402 | $string = "BEGIN:VCALENDAR\n"; |
| 403 | 403 | $string .= "VERSION:2.0\n"; |
| 404 | 404 | $string .= "BEGIN:VEVENT\n"; |
| 405 | - $string .= "DTSTART;TZID=Europe/London:" . $dtstart . "\n"; |
|
| 406 | - $string .= "DTEND;TZID=Europe/London:" . $dtend . "\n"; |
|
| 405 | + $string .= "DTSTART;TZID=Europe/London:".$dtstart."\n"; |
|
| 406 | + $string .= "DTEND;TZID=Europe/London:".$dtend."\n"; |
|
| 407 | 407 | $string .= "SUMMARY:Click attached contact below to save to your contacts\n"; |
| 408 | - $string .= "DTSTAMP:" . $dtstart . "Z\n"; |
|
| 408 | + $string .= "DTSTAMP:".$dtstart."Z\n"; |
|
| 409 | 409 | $string .= "ATTACH;VALUE=BINARY;ENCODING=BASE64;FMTTYPE=text/directory;\n"; |
| 410 | - $string .= " X-APPLE-FILENAME=" . $this->getFilename() . "." . $this->getFileExtension() . ":\n"; |
|
| 410 | + $string .= " X-APPLE-FILENAME=".$this->getFilename().".".$this->getFileExtension().":\n"; |
|
| 411 | 411 | |
| 412 | 412 | // base64 encode it so that it can be used as an attachemnt to the "dummy" calendar appointment |
| 413 | 413 | $b64vcard = base64_encode($this->buildVCard()); |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | { |
| 535 | 535 | $charsetString = ''; |
| 536 | 536 | if ($this->charset == 'utf-8') { |
| 537 | - $charsetString = ';CHARSET=' . $this->charset; |
|
| 537 | + $charsetString = ';CHARSET='.$this->charset; |
|
| 538 | 538 | } |
| 539 | 539 | return $charsetString; |
| 540 | 540 | } |
@@ -579,8 +579,8 @@ discard block |
||
| 579 | 579 | */ |
| 580 | 580 | public function getHeaders($asAssociative) |
| 581 | 581 | { |
| 582 | - $contentType = $this->getContentType() . '; charset=' . $this->getCharset(); |
|
| 583 | - $contentDisposition = 'attachment; filename=' . $this->getFilename() . '.' . $this->getFileExtension(); |
|
| 582 | + $contentType = $this->getContentType().'; charset='.$this->getCharset(); |
|
| 583 | + $contentDisposition = 'attachment; filename='.$this->getFilename().'.'.$this->getFileExtension(); |
|
| 584 | 584 | $contentLength = strlen($this->getOutput()); |
| 585 | 585 | $connection = 'close'; |
| 586 | 586 | |
@@ -594,10 +594,10 @@ discard block |
||
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | return array( |
| 597 | - 'Content-type: ' . $contentType, |
|
| 598 | - 'Content-Disposition: ' . $contentDisposition, |
|
| 599 | - 'Content-Length: ' . $contentLength, |
|
| 600 | - 'Connection: ' . $connection, |
|
| 597 | + 'Content-type: '.$contentType, |
|
| 598 | + 'Content-Disposition: '.$contentDisposition, |
|
| 599 | + 'Content-Length: '.$contentLength, |
|
| 600 | + 'Connection: '.$connection, |
|
| 601 | 601 | ); |
| 602 | 602 | } |
| 603 | 603 | |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | */ |
| 676 | 676 | public function save() |
| 677 | 677 | { |
| 678 | - $file = $this->getFilename() . '.' . $this->getFileExtension(); |
|
| 678 | + $file = $this->getFilename().'.'.$this->getFileExtension(); |
|
| 679 | 679 | |
| 680 | 680 | file_put_contents( |
| 681 | 681 | $file, |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | |
| 729 | 729 | // overwrite filename or add to filename using a prefix in between |
| 730 | 730 | $this->filename = ($overwrite) ? |
| 731 | - $value : $this->filename . $separator . $value; |
|
| 731 | + $value : $this->filename.$separator.$value; |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | /** |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | if (!in_array($element, $this->multiplePropertiesForElementAllowed) |
| 745 | 745 | && isset($this->definedElements[$element]) |
| 746 | 746 | ) { |
| 747 | - throw new Exception('You can only set "' . $element . '" once.'); |
|
| 747 | + throw new Exception('You can only set "'.$element.'" once.'); |
|
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | // we define that we set this element |