Browse Source

Added category parsing

tags/v2.0.4
Christoph Haas 3 years ago
parent
commit
35a157ead9
2 changed files with 20 additions and 1 deletions
  1. +7
    -1
      php/composer.json
  2. +13
    -0
      php/module.contact.php

+ 7
- 1
php/composer.json View File

@@ -1,5 +1,11 @@
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/h44z/vcard"
}
],
"require": {
"jeroendesloovere/vcard": "1.2.*"
"jeroendesloovere/vcard": "dev-patchcategories"
}
}

+ 13
- 0
php/module.contact.php View File

@@ -397,6 +397,11 @@ class ContactModule extends Module
$vCard->addNote($notes);
}
if (!empty($this->getProp($messageProps, "categories"))) {
$categories = array_map('trim', explode(';', trim($this->getProp($messageProps, "categories"), " ;")));
$vCard->addCategories($categories);
}
$hasPicture = $this->getProp($messageProps, "has_picture");
if (!empty($hasPicture) && $hasPicture === true) {
$attachNum = -1;
@@ -921,6 +926,14 @@ class ContactModule extends Module
if (isset($vCard->note)) {
$properties["notes"] = $vCard->note;
}
if (isset($vCard->categories) && count($vCard->categories) > 0) {
$categories = array();
foreach ($vCard->categories as $category) {
$categories[] = $category;
}
$properties["categories"] = $categories;
}
if (isset($vCard->rawPhoto) || isset($vCard->photo)) {
if (!is_writable(TMP_PATH . "/")) {
error_log("Can not write to export tmp directory!");

Loading…
Cancel
Save