forked from sabre-io/vobject
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
djmaze
committed
Nov 14, 2023
1 parent
154a84d
commit cb9ebb8
Showing
4 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
namespace Sabre\VObject\Property; | ||
|
||
use Sabre\VObject\Property; | ||
//use Sabre\VObject\Property\Text; | ||
|
||
/** | ||
* XCrypto property. | ||
* | ||
* This object encodes X-CRYPTO values, as defined in KDE KAddressBook | ||
* | ||
* @copyright Copyright (C) SnappyMail (https://snappymail.eu/) | ||
* @author DJMaze (https://snappymail.eu/) | ||
* @license http://sabre.io/license/ Modified BSD License | ||
* | ||
* https://github.com/sabre-io/vobject/issues/589 | ||
*/ | ||
|
||
class XCrypto extends Property | ||
//class XCrypto extends Text | ||
{ | ||
/** | ||
* Returns the type of value. | ||
* | ||
* This corresponds to the VALUE= parameter. Every property also has a | ||
* 'default' valueType. | ||
* | ||
* @return string | ||
*/ | ||
public function getValueType() | ||
{ | ||
return 'X-CRYPTO'; | ||
} | ||
|
||
/** | ||
* Sets a raw value coming from a mimedir (iCalendar/vCard) file. | ||
* | ||
* This has been 'unfolded', so only 1 line will be passed. Unescaping is | ||
* not yet done, but parameters are not included. | ||
* | ||
* @param string $val | ||
*/ | ||
public function setRawMimeDirValue($val) | ||
{ | ||
error_log("setRawMimeDirValue({$val})"); | ||
// $this->setValue(MimeDir::unescapeValue($val, $this->delimiter)); | ||
} | ||
|
||
/** | ||
* Returns a raw mime-dir representation of the value. | ||
* | ||
* @return string | ||
*/ | ||
public function getRawMimeDirValue() | ||
{ | ||
$result = []; | ||
foreach ($this->parameters as $parameter) { | ||
$result[] = strtolower($parameter->name) . '=' . $parameter->getValue(); | ||
} | ||
return implode(',', $result); | ||
} | ||
|
||
public function xmlSerialize(\Sabre\Xml\Writer $writer): void | ||
{ | ||
$writer->startElement(strtolower($this->name)); | ||
foreach ($this->parameters as $parameter) { | ||
$writer->startElement(strtolower($parameter->name)); | ||
$writer->write($parameter); | ||
$writer->endElement(); | ||
} | ||
$writer->endElement(); | ||
} | ||
} |