Merge branch 'fixes/fix-get-file-id-agenda' into releases/release-h2f
This commit is contained in:
commit
737e30fe71
@ -30,13 +30,13 @@ class VCalendarHelpers
|
||||
$datetimeString = $matches[2];
|
||||
$datetimeValue = new DateTime($datetimeString, new DateTimeZone($dateTz));
|
||||
return $datetimeValue;
|
||||
}
|
||||
catch(Exception $e){
|
||||
} catch (Exception $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetStartAndEndTimeFromVCalendarString(string $vCalendarString){
|
||||
public static function GetStartAndEndTimeFromVCalendarString(string $vCalendarString)
|
||||
{
|
||||
$startTimeValue = "";
|
||||
$endTimeValue = "";
|
||||
if ($vCalendarString != "") {
|
||||
@ -55,28 +55,33 @@ class VCalendarHelpers
|
||||
];
|
||||
}
|
||||
|
||||
public static function ReadVCalendarDataBlob($vCalendarData){
|
||||
public static function ReadVCalendarDataBlob($vCalendarData)
|
||||
{
|
||||
if (is_resource($vCalendarData)) {
|
||||
return stream_get_contents($vCalendarData);
|
||||
}
|
||||
return $vCalendarData;
|
||||
}
|
||||
|
||||
public static function hasAttachment(string $vCalendarString) : bool{
|
||||
public static function hasAttachment(string $vCalendarString): bool
|
||||
{
|
||||
return str_contains($vCalendarString, 'ATTACH;FMTTYPE');
|
||||
}
|
||||
public static function extractAttachments(string $vCalendarString): array {
|
||||
public static function extractAttachments(string $vCalendarString): array
|
||||
{
|
||||
$attachments = [];
|
||||
preg_match_all('/ATTACH;FMTTYPE=([^;]+);FILENAME=([^;]+);X-NC-FILE-ID=([^;]+);/', $vCalendarString, $matches, PREG_SET_ORDER);
|
||||
$vCalendarString = preg_replace("/\r\n|\n|\r/", "\n", $vCalendarString);
|
||||
$vCalendarString = preg_replace("/\n[ \t]/", "", $vCalendarString);
|
||||
preg_match_all('/ATTACH;FMTTYPE=([^;]+);FILENAME=([^;]+);X-NC-FILE-ID=(\d+)/', $vCalendarString, $matches, PREG_SET_ORDER);
|
||||
foreach ($matches as $match) {
|
||||
$attachments[] = [
|
||||
'type' =>explode("/" , $match[1])[0], // Extrait 'image' de 'image/png'
|
||||
'mime_type' =>$match[1], // Extrait 'image' de 'image/png'
|
||||
'type' => explode("/", $match[1])[0],
|
||||
'mime_type' => $match[1],
|
||||
'name' => trim($match[2], '/'),
|
||||
'file_id' => (int) $match[3],
|
||||
];
|
||||
}
|
||||
|
||||
return $attachments;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user