Version Description
Download this release
Release Info
Developer | calvinyeh |
Plugin | All-in-One Event Calendar |
Version | 2.5.40 |
Comparing to | |
See all releases |
Code changes from version 2.5.39 to 2.5.40
- all-in-one-event-calendar.php +2 -2
- app/config/constants.php +1 -1
- app/model/event/instance.php +12 -9
- language/all-in-one-event-calendar.mo +0 -0
- language/all-in-one-event-calendar.po +3 -3
- language/all-in-one-event-calendar.pot +2 -2
- lib/bootstrap/loader-map.php +12 -0
- lib/iCal/iCalcnv-3.0/iCalcnv.class.php +87 -88
- lib/iCal/iCalcreator-2.24.2/README.md +0 -23
- lib/iCal/iCalcreator-2.24.2/docs/AGPLv3.txt +0 -661
- lib/iCal/iCalcreator-2.24.2/docs/summary.html +0 -755
- lib/iCal/iCalcreator-2.24.2/releaseNotes-2.24.2 +0 -7
- lib/iCal/iCalcreator-2.24.2/src/calendarComponent.php +0 -1398
- lib/iCal/iCalcreator-2.24.2/src/iCal.tz.inc.php +0 -325
- lib/iCal/iCalcreator-2.24.2/src/iCalBase.php +0 -444
- lib/iCal/iCalcreator-2.24.2/src/iCalXML.php +0 -1253
- lib/iCal/iCalcreator-2.24.2/src/iCaldateTime.php +0 -162
- lib/iCal/iCalcreator-2.24.2/src/iCalvCard.php +0 -199
- lib/iCal/iCalcreator-2.24.2/src/timezoneHandler.php +0 -438
- lib/iCal/iCalcreator-2.24.2/src/traits/ACTIONtrait.php +0 -77
- lib/iCal/iCalcreator-2.24.2/src/traits/ATTACHtrait.php +0 -87
- lib/iCal/iCalcreator-2.24.2/src/traits/ATTENDEEtrait.php +0 -80
- lib/iCal/iCalcreator-2.24.2/src/traits/CALSCALEtrait.php +0 -67
- lib/iCal/iCalcreator-2.24.2/src/traits/CATEGORIEStrait.php +0 -98
- lib/iCal/iCalcreator-2.24.2/src/traits/CLASStrait.php +0 -77
- lib/iCal/iCalcreator-2.24.2/src/traits/COMMENTtrait.php +0 -91
- lib/iCal/iCalcreator-2.24.2/src/traits/COMPLETEDtrait.php +0 -84
- lib/iCal/iCalcreator-2.24.2/src/traits/CONTACTtrait.php +0 -89
- lib/iCal/iCalcreator-2.24.2/src/traits/CREATEDtrait.php +0 -76
- lib/iCal/iCalcreator-2.24.2/src/traits/DESCRIPTIONtrait.php +0 -91
- lib/iCal/iCalcreator-2.24.2/src/traits/DTENDtrait.php +0 -89
- lib/iCal/iCalcreator-2.24.2/src/traits/DTSTAMPtrait.php +0 -74
- lib/iCal/iCalcreator-2.24.2/src/traits/DTSTARTtrait.php +0 -91
- lib/iCal/iCalcreator-2.24.2/src/traits/DUEtrait.php +0 -89
- lib/iCal/iCalcreator-2.24.2/src/traits/DURATIONtrait.php +0 -107
- lib/iCal/iCalcreator-2.24.2/src/traits/EXDATEtrait.php +0 -86
- lib/iCal/iCalcreator-2.24.2/src/traits/EXRULEtrait.php +0 -78
- lib/iCal/iCalcreator-2.24.2/src/traits/FREEBUSYtrait.php +0 -188
- lib/iCal/iCalcreator-2.24.2/src/traits/GEOtrait.php +0 -85
- lib/iCal/iCalcreator-2.24.2/src/traits/LAST_MODIFIEDtrait.php +0 -76
- lib/iCal/iCalcreator-2.24.2/src/traits/LOCATIONtrait.php +0 -79
- lib/iCal/iCalcreator-2.24.2/src/traits/METHODtrait.php +0 -68
- lib/iCal/iCalcreator-2.24.2/src/traits/ORGANIZERtrait.php +0 -88
- lib/iCal/iCalcreator-2.24.2/src/traits/PERCENT_COMPLETEtrait.php +0 -80
- lib/iCal/iCalcreator-2.24.2/src/traits/PRIORITYtrait.php +0 -79
- lib/iCal/iCalcreator-2.24.2/src/traits/PRODIDtrait.php +0 -81
- lib/iCal/iCalcreator-2.24.2/src/traits/RDATEtrait.php +0 -89
- lib/iCal/iCalcreator-2.24.2/src/traits/RECURRENCE_IDtrait.php +0 -92
- lib/iCal/iCalcreator-2.24.2/src/traits/RELATED_TOtrait.php +0 -89
- lib/iCal/iCalcreator-2.24.2/src/traits/REPEATtrait.php +0 -78
- lib/iCal/iCalcreator-2.24.2/src/traits/REQUEST_STATUStrait.php +0 -107
- lib/iCal/iCalcreator-2.24.2/src/traits/RESOURCEStrait.php +0 -103
- lib/iCal/iCalcreator-2.24.2/src/traits/RRULEtrait.php +0 -77
- lib/iCal/iCalcreator-2.24.2/src/traits/SEQUENCEtrait.php +0 -78
- lib/iCal/iCalcreator-2.24.2/src/traits/STATUStrait.php +0 -76
- lib/iCal/iCalcreator-2.24.2/src/traits/SUMMARYtrait.php +0 -78
- lib/iCal/iCalcreator-2.24.2/src/traits/TRANSPtrait.php +0 -77
- lib/iCal/iCalcreator-2.24.2/src/traits/TRIGGERtrait.php +0 -213
- lib/iCal/iCalcreator-2.24.2/src/traits/TZIDtrait.php +0 -78
- lib/iCal/iCalcreator-2.24.2/src/traits/TZNAMEtrait.php +0 -89
- lib/iCal/iCalcreator-2.24.2/src/traits/TZOFFSETFROMtrait.php +0 -77
- lib/iCal/iCalcreator-2.24.2/src/traits/TZOFFSETTOtrait.php +0 -77
- lib/iCal/iCalcreator-2.24.2/src/traits/TZURLtrait.php +0 -77
- lib/iCal/iCalcreator-2.24.2/src/traits/UIDtrait.php +0 -73
- lib/iCal/iCalcreator-2.24.2/src/traits/URLtrait.php +0 -81
- lib/iCal/iCalcreator-2.24.2/src/traits/VERSIONtrait.php +0 -72
- lib/iCal/iCalcreator-2.24.2/src/traits/X_PROPtrait.php +0 -143
- lib/iCal/iCalcreator-2.24.2/src/util/util.php +0 -2230
- lib/iCal/iCalcreator-2.24.2/src/util/utilAttendee.php +0 -254
- lib/iCal/iCalcreator-2.24.2/src/util/utilGeo.php +0 -65
- lib/iCal/iCalcreator-2.24.2/src/util/utilRecur.php +0 -873
- lib/iCal/iCalcreator-2.24.2/src/util/utilRedirect.php +0 -129
- lib/iCal/iCalcreator-2.24.2/src/util/utilRexdate.php +0 -536
- lib/iCal/iCalcreator-2.24.2/src/util/utilSelect.php +0 -786
- lib/iCal/iCalcreator-2.24.2/src/valarm.php +0 -145
- lib/iCal/iCalcreator-2.24.2/src/vcalendar.php +0 -1060
- lib/iCal/iCalcreator-2.24.2/src/vcalendarSortHandler.php +0 -299
- lib/iCal/iCalcreator-2.24.2/src/vevent.php +0 -190
- lib/iCal/iCalcreator-2.24.2/src/vfreebusy.php +0 -119
- lib/iCal/iCalcreator-2.24.2/src/vjournal.php +0 -155
- lib/iCal/iCalcreator-2.24.2/src/vtimezone.php +0 -195
- lib/iCal/iCalcreator-2.24.2/src/vtodo.php +0 -193
- lib/iCal/iCalcreator-2.26.9/README.md +34 -0
- lib/iCal/{iCalcreator-2.24.2 → iCalcreator-2.26.9}/autoload.php +24 -25
- lib/iCal/{iCalcreator-2.24.2 → iCalcreator-2.26.9}/composer.json +6 -5
- lib/iCal/iCalcreator-2.26.9/docs/lgpl.txt +165 -0
- lib/iCal/iCalcreator-2.26.9/docs/summary.html +682 -0
- lib/iCal/{iCalcreator-2.24.2 → iCalcreator-2.26.9}/docs/using.html +1357 -1134
all-in-one-event-calendar.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: A calendar system with month, week, day, agenda views, upcoming events widget, color-coded categories, recurrence, and import/export of .ics feeds.
|
6 |
* Author: Time.ly Network Inc.
|
7 |
* Author URI: https://time.ly/
|
8 |
-
* Version: 2.5.
|
9 |
* Text Domain: all-in-one-event-calendar
|
10 |
* Domain Path: /language
|
11 |
*/
|
@@ -72,7 +72,7 @@ require $ai1ec_base_dir . DIRECTORY_SEPARATOR . 'lib' .
|
|
72 |
DIRECTORY_SEPARATOR . 'global-functions.php';
|
73 |
|
74 |
require $ai1ec_base_dir . DIRECTORY_SEPARATOR . 'lib' .
|
75 |
-
DIRECTORY_SEPARATOR . 'iCal' . DIRECTORY_SEPARATOR . 'iCalcreator-2.
|
76 |
|
77 |
require $ai1ec_base_dir . DIRECTORY_SEPARATOR . 'app' .
|
78 |
DIRECTORY_SEPARATOR . 'controller' . DIRECTORY_SEPARATOR . 'extension.php';
|
5 |
* Description: A calendar system with month, week, day, agenda views, upcoming events widget, color-coded categories, recurrence, and import/export of .ics feeds.
|
6 |
* Author: Time.ly Network Inc.
|
7 |
* Author URI: https://time.ly/
|
8 |
+
* Version: 2.5.40
|
9 |
* Text Domain: all-in-one-event-calendar
|
10 |
* Domain Path: /language
|
11 |
*/
|
72 |
DIRECTORY_SEPARATOR . 'global-functions.php';
|
73 |
|
74 |
require $ai1ec_base_dir . DIRECTORY_SEPARATOR . 'lib' .
|
75 |
+
DIRECTORY_SEPARATOR . 'iCal' . DIRECTORY_SEPARATOR . 'iCalcreator-2.26.9' . DIRECTORY_SEPARATOR . 'autoload.php';
|
76 |
|
77 |
require $ai1ec_base_dir . DIRECTORY_SEPARATOR . 'app' .
|
78 |
DIRECTORY_SEPARATOR . 'controller' . DIRECTORY_SEPARATOR . 'extension.php';
|
app/config/constants.php
CHANGED
@@ -50,7 +50,7 @@ function ai1ec_initiate_constants( $ai1ec_base_dir, $ai1ec_base_url ) {
|
|
50 |
// = Plugin Version =
|
51 |
// ==================
|
52 |
if ( ! defined( 'AI1EC_VERSION' ) ) {
|
53 |
-
define( 'AI1EC_VERSION', '2.5.
|
54 |
}
|
55 |
|
56 |
// ================
|
50 |
// = Plugin Version =
|
51 |
// ==================
|
52 |
if ( ! defined( 'AI1EC_VERSION' ) ) {
|
53 |
+
define( 'AI1EC_VERSION', '2.5.40' );
|
54 |
}
|
55 |
|
56 |
// ================
|
app/model/event/instance.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
use
|
4 |
|
5 |
/**
|
6 |
* Event instance management model.
|
@@ -105,17 +105,19 @@ class Ai1ec_Event_Instance extends Ai1ec_Base {
|
|
105 |
= $this->_parsed_date_array( $_start, $timezone );
|
106 |
$enddate['year'] = $enddate['year'] + 10;
|
107 |
$exclude_dates = array();
|
|
|
108 |
$recurrence_dates = array();
|
109 |
-
|
|
|
110 |
$recurrence_dates = $this->_populate_recurring_dates(
|
111 |
-
$
|
112 |
$startdate,
|
113 |
$timezone
|
114 |
);
|
115 |
}
|
116 |
-
if ( $
|
117 |
$exclude_dates = $this->_populate_recurring_dates(
|
118 |
-
$
|
119 |
$startdate,
|
120 |
$timezone
|
121 |
);
|
@@ -128,13 +130,13 @@ class Ai1ec_Event_Instance extends Ai1ec_Base {
|
|
128 |
);
|
129 |
unset($exception_rules['EXDATE']);
|
130 |
if ( ! empty( $exception_rules ) ) {
|
131 |
-
$exception_rules =
|
132 |
$exception_rules
|
133 |
);
|
134 |
$result = array();
|
135 |
date_default_timezone_set( $timezone );
|
136 |
// The first array is the result and it is passed by reference
|
137 |
-
|
138 |
$exclude_dates,
|
139 |
$exception_rules,
|
140 |
$wdate,
|
@@ -163,16 +165,17 @@ class Ai1ec_Event_Instance extends Ai1ec_Base {
|
|
163 |
$event->get( 'recurrence_rules' )
|
164 |
);
|
165 |
|
166 |
-
$recurrence_rules =
|
167 |
if ( $recurrence_rules ) {
|
168 |
date_default_timezone_set( $timezone );
|
169 |
-
|
170 |
$recurrence_dates,
|
171 |
$recurrence_rules,
|
172 |
$wdate,
|
173 |
$startdate,
|
174 |
$enddate
|
175 |
);
|
|
|
176 |
// Get start date time
|
177 |
$startHour = isset( $startdate['hour'] ) ? sprintf( "%02d", $startdate['hour'] ) : '00';
|
178 |
$startMinute = isset( $startdate['min'] ) ? sprintf( "%02d", $startdate['min'] ) : '00';
|
1 |
<?php
|
2 |
|
3 |
+
use Kigkonsult\Icalcreator\Util\UtilRecur;
|
4 |
|
5 |
/**
|
6 |
* Event instance management model.
|
105 |
= $this->_parsed_date_array( $_start, $timezone );
|
106 |
$enddate['year'] = $enddate['year'] + 10;
|
107 |
$exclude_dates = array();
|
108 |
+
$exception_rules = $event->get( 'exception_dates' );
|
109 |
$recurrence_dates = array();
|
110 |
+
$recurrence_rules = $event->get( 'recurrence_dates' );
|
111 |
+
if ( $recurrence_rules ) {
|
112 |
$recurrence_dates = $this->_populate_recurring_dates(
|
113 |
+
$recurrence_rules,
|
114 |
$startdate,
|
115 |
$timezone
|
116 |
);
|
117 |
}
|
118 |
+
if ( $exception_rules ) {
|
119 |
$exclude_dates = $this->_populate_recurring_dates(
|
120 |
+
$exception_rules,
|
121 |
$startdate,
|
122 |
$timezone
|
123 |
);
|
130 |
);
|
131 |
unset($exception_rules['EXDATE']);
|
132 |
if ( ! empty( $exception_rules ) ) {
|
133 |
+
$exception_rules = UtilRecur::setRexrule(
|
134 |
$exception_rules
|
135 |
);
|
136 |
$result = array();
|
137 |
date_default_timezone_set( $timezone );
|
138 |
// The first array is the result and it is passed by reference
|
139 |
+
UtilRecur::recur2date(
|
140 |
$exclude_dates,
|
141 |
$exception_rules,
|
142 |
$wdate,
|
165 |
$event->get( 'recurrence_rules' )
|
166 |
);
|
167 |
|
168 |
+
$recurrence_rules = UtilRecur::setRexrule( $recurrence_rules );
|
169 |
if ( $recurrence_rules ) {
|
170 |
date_default_timezone_set( $timezone );
|
171 |
+
UtilRecur::recur2date(
|
172 |
$recurrence_dates,
|
173 |
$recurrence_rules,
|
174 |
$wdate,
|
175 |
$startdate,
|
176 |
$enddate
|
177 |
);
|
178 |
+
|
179 |
// Get start date time
|
180 |
$startHour = isset( $startdate['hour'] ) ? sprintf( "%02d", $startdate['hour'] ) : '00';
|
181 |
$startMinute = isset( $startdate['min'] ) ? sprintf( "%02d", $startdate['min'] ) : '00';
|
language/all-in-one-event-calendar.mo
CHANGED
Binary file
|
language/all-in-one-event-calendar.po
CHANGED
@@ -2,13 +2,13 @@
|
|
2 |
# This file is distributed under the same license as the All-in-One Event Calendar by Time.ly package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: All-in-One Event Calendar by Time.ly 2.5.
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/all-in-one-event-calendar\n"
|
7 |
-
"POT-Creation-Date: 2019-05-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"PO-Revision-Date: 2019-05-
|
12 |
"Last-Translator: Timely <support@time.ly>\n"
|
13 |
"Language-Team:\n"
|
14 |
|
2 |
# This file is distributed under the same license as the All-in-One Event Calendar by Time.ly package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: All-in-One Event Calendar by Time.ly 2.5.40\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/all-in-one-event-calendar\n"
|
7 |
+
"POT-Creation-Date: 2019-05-07 22:37:08+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2019-05-07 22:37+0000\n"
|
12 |
"Last-Translator: Timely <support@time.ly>\n"
|
13 |
"Language-Team:\n"
|
14 |
|
language/all-in-one-event-calendar.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the same license as the All-in-One Event Calendar by Time.ly package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: All-in-One Event Calendar by Time.ly 2.5.
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/all-in-one-event-calendar\n"
|
7 |
-
"POT-Creation-Date: 2019-05-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
2 |
# This file is distributed under the same license as the All-in-One Event Calendar by Time.ly package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: All-in-One Event Calendar by Time.ly 2.5.40\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/all-in-one-event-calendar\n"
|
7 |
+
"POT-Creation-Date: 2019-05-07 22:37:08+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
lib/bootstrap/loader-map.php
CHANGED
@@ -2929,6 +2929,12 @@
|
|
2929 |
'c' => '__TwigTemplate_5438397cd9464722671fd647af1253048c35b31f97a6d5372f3c78b5bc143543',
|
2930 |
'i' => 'g',
|
2931 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
2932 |
'__TwigTemplate_5ca1499a9c32090a9a368a28b4c13261022bf5d11f22b5211fb873b104fc70e4' =>
|
2933 |
array (
|
2934 |
'f' => AI1EC_PATH . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'twig' . DIRECTORY_SEPARATOR . '5c' . DIRECTORY_SEPARATOR . 'a1' . DIRECTORY_SEPARATOR . '499a9c32090a9a368a28b4c13261022bf5d11f22b5211fb873b104fc70e4.php',
|
@@ -4926,6 +4932,12 @@
|
|
4926 |
'c' => '__TwigTemplate_5438397cd9464722671fd647af1253048c35b31f97a6d5372f3c78b5bc143543',
|
4927 |
'i' => 'g',
|
4928 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
4929 |
'twig.5c.a1.499a9c32090a9a368a28b4c13261022bf5d11f22b5211fb873b104fc70e4' =>
|
4930 |
array (
|
4931 |
'f' => AI1EC_PATH . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'twig' . DIRECTORY_SEPARATOR . '5c' . DIRECTORY_SEPARATOR . 'a1' . DIRECTORY_SEPARATOR . '499a9c32090a9a368a28b4c13261022bf5d11f22b5211fb873b104fc70e4.php',
|
2929 |
'c' => '__TwigTemplate_5438397cd9464722671fd647af1253048c35b31f97a6d5372f3c78b5bc143543',
|
2930 |
'i' => 'g',
|
2931 |
),
|
2932 |
+
'__TwigTemplate_57450188512a8737525f2a834d1b88782d9a19e5e6d3a9e57df3dbed47bab219' =>
|
2933 |
+
array (
|
2934 |
+
'f' => AI1EC_PATH . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'twig' . DIRECTORY_SEPARATOR . '57' . DIRECTORY_SEPARATOR . '45' . DIRECTORY_SEPARATOR . '0188512a8737525f2a834d1b88782d9a19e5e6d3a9e57df3dbed47bab219.php',
|
2935 |
+
'c' => '__TwigTemplate_57450188512a8737525f2a834d1b88782d9a19e5e6d3a9e57df3dbed47bab219',
|
2936 |
+
'i' => 'g',
|
2937 |
+
),
|
2938 |
'__TwigTemplate_5ca1499a9c32090a9a368a28b4c13261022bf5d11f22b5211fb873b104fc70e4' =>
|
2939 |
array (
|
2940 |
'f' => AI1EC_PATH . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'twig' . DIRECTORY_SEPARATOR . '5c' . DIRECTORY_SEPARATOR . 'a1' . DIRECTORY_SEPARATOR . '499a9c32090a9a368a28b4c13261022bf5d11f22b5211fb873b104fc70e4.php',
|
4932 |
'c' => '__TwigTemplate_5438397cd9464722671fd647af1253048c35b31f97a6d5372f3c78b5bc143543',
|
4933 |
'i' => 'g',
|
4934 |
),
|
4935 |
+
'twig.57.45.0188512a8737525f2a834d1b88782d9a19e5e6d3a9e57df3dbed47bab219' =>
|
4936 |
+
array (
|
4937 |
+
'f' => AI1EC_PATH . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'twig' . DIRECTORY_SEPARATOR . '57' . DIRECTORY_SEPARATOR . '45' . DIRECTORY_SEPARATOR . '0188512a8737525f2a834d1b88782d9a19e5e6d3a9e57df3dbed47bab219.php',
|
4938 |
+
'c' => '__TwigTemplate_57450188512a8737525f2a834d1b88782d9a19e5e6d3a9e57df3dbed47bab219',
|
4939 |
+
'i' => 'g',
|
4940 |
+
),
|
4941 |
'twig.5c.a1.499a9c32090a9a368a28b4c13261022bf5d11f22b5211fb873b104fc70e4' =>
|
4942 |
array (
|
4943 |
'f' => AI1EC_PATH . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'twig' . DIRECTORY_SEPARATOR . '5c' . DIRECTORY_SEPARATOR . 'a1' . DIRECTORY_SEPARATOR . '499a9c32090a9a368a28b4c13261022bf5d11f22b5211fb873b104fc70e4.php',
|
lib/iCal/iCalcnv-3.0/iCalcnv.class.php
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
* iCalcnv ver 3.0
|
5 |
* copyright (c) 2011 Kjell-Inge Gustafsson kigkonsult
|
@@ -88,51 +87,51 @@ class iCalcnv {
|
|
88 |
$fp = false;
|
89 |
$string_to_parse = $this->getConfig( 'string_to_parse' );
|
90 |
if( $string_to_parse ) {
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
} else {
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
}
|
137 |
$rows = array();
|
138 |
while ( FALSE !== ( $row = fgetcsv( $fp, FALSE, $conf['sep'], $conf['del'] )))
|
@@ -141,38 +140,38 @@ class iCalcnv {
|
|
141 |
ini_set( 'auto_detect_line_endings', false );
|
142 |
$cntrows = count( $rows );
|
143 |
/** iCalcreator checks when setting directory and filename */
|
144 |
-
$calendar = new
|
145 |
if( FALSE !== ( $unique_id = $this->getConfig( 'unique_id' )))
|
146 |
$calendar->setConfig( 'unique_id', $unique_id );
|
147 |
if( ! $this->getConfig( 'outputobj' ) ) {
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
}
|
177 |
$timeexec['fileOk'] = microtime( TRUE );
|
178 |
/** info rows */
|
@@ -238,16 +237,16 @@ class iCalcnv {
|
|
238 |
if( 'VTIMEZONE' == $compname ) {
|
239 |
if( $comp )
|
240 |
$calendar->setComponent( $comp );
|
241 |
-
$comp = new
|
242 |
$actcomp = & $comp;
|
243 |
$cntprops += 1;
|
244 |
}
|
245 |
elseif( 'STANDARD' == $compname ) {
|
246 |
-
$subcomp = new
|
247 |
$actcomp = & $subcomp;
|
248 |
}
|
249 |
elseif( 'DAYLIGHT' == $compname ) {
|
250 |
-
$subcomp = new
|
251 |
$actcomp = & $subcomp;
|
252 |
}
|
253 |
else {
|
@@ -333,13 +332,13 @@ class iCalcnv {
|
|
333 |
if( in_array( $compname, $allowedComps )) {
|
334 |
if( $comp )
|
335 |
$calendar->setComponent( $comp );
|
336 |
-
$className = '
|
337 |
$comp = new $className;
|
338 |
$actcomp = & $comp;
|
339 |
$cntprops += 1;
|
340 |
}
|
341 |
elseif( 'VALARM' == $compname ) {
|
342 |
-
$subcomp = new
|
343 |
$actcomp = & $subcomp;
|
344 |
}
|
345 |
else {
|
@@ -439,7 +438,7 @@ class iCalcnv {
|
|
439 |
/** return calendar, save or send the file */
|
440 |
if( $this->getConfig( 'outputobj' ) ) {
|
441 |
if( $this->log ) {
|
442 |
-
$this->log->log( "INPUT FILE:'$inputdirFile' returning iCalcreator
|
443 |
$this->log->flush();
|
444 |
}
|
445 |
return $calendar;
|
@@ -734,11 +733,11 @@ class iCalcnv {
|
|
734 |
if( $this->log )
|
735 |
$this->log->log( "found (1): '$dirFile'", PEAR_LOG_DEBUG );
|
736 |
if( $this->getConfig( 'extension_check' ) ) {
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
}
|
743 |
$dirFile = $this->getConfig( $operation.'directory' ).DIRECTORY_SEPARATOR.$dirFile;
|
744 |
$fileParts = pathinfo( $dirFile );
|
@@ -818,7 +817,7 @@ class iCalcnv {
|
|
818 |
if( $calendar )
|
819 |
$calnl = $calendar->getConfig( 'nl' );
|
820 |
else { /** iCalcreator set config, read and parse input iCal file */
|
821 |
-
$calendar = new
|
822 |
if( FALSE !== ( $unique_id = $this->getConfig( 'unique_id' )))
|
823 |
$calendar->setConfig( 'unique_id', $unique_id );
|
824 |
$calnl = $calendar->getConfig( 'nl' );
|
@@ -1392,7 +1391,7 @@ class iCalcnv {
|
|
1392 |
if( $calendar )
|
1393 |
$calnl = $calendar->getConfig( 'nl' );
|
1394 |
else { /** iCalcreator set config, read and parse input iCal file */
|
1395 |
-
$calendar = new
|
1396 |
if( FALSE !== ( $unique_id = $this->getConfig( 'unique_id' )))
|
1397 |
$calendar->setConfig( 'unique_id', $unique_id );
|
1398 |
$calnl = $calendar->getConfig( 'nl' );
|
@@ -1869,4 +1868,4 @@ class iCalcnv {
|
|
1869 |
return TRUE;
|
1870 |
}
|
1871 |
}
|
1872 |
-
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* iCalcnv ver 3.0
|
4 |
* copyright (c) 2011 Kjell-Inge Gustafsson kigkonsult
|
87 |
$fp = false;
|
88 |
$string_to_parse = $this->getConfig( 'string_to_parse' );
|
89 |
if( $string_to_parse ) {
|
90 |
+
$fp = fopen( 'php://temp/maxmemory:' . 1024*1024, 'rw' );
|
91 |
+
fputs( $fp, $string_to_parse );
|
92 |
+
fseek( $fp, 0 );
|
93 |
} else {
|
94 |
+
/** check input/output directory and filename */
|
95 |
+
$inputdirFile = $outputdirFile = '';
|
96 |
+
$inputFileParts = $outputFileParts = array();
|
97 |
+
$remoteInput = $remoteOutput = FALSE;
|
98 |
+
if( FALSE === $this->_fixIO( 'input', 'csv', $inputdirFile, $inputFileParts, $remoteInput )) {
|
99 |
+
if( $this->log ) {
|
100 |
+
$this->log->log( number_format(( microtime( TRUE ) - $timeexec['start'] ), 5 ).' sec', PEAR_LOG_ERR );
|
101 |
+
$this->log->log( "ERROR 2, invalid input ($inputdirFile)", PEAR_LOG_ERR );
|
102 |
+
$this->log->flush();
|
103 |
+
}
|
104 |
+
return FALSE;
|
105 |
+
}
|
106 |
+
if( FALSE === $this->_fixIO( 'output', FALSE, $outputdirFile, $outputFileParts, $remoteOutput )) {
|
107 |
+
if( FALSE === $this->setConfig( 'outputfilename', $inputFileParts['filename'].'.ics' )) {
|
108 |
+
if( $this->log ) {
|
109 |
+
$this->log->log( number_format(( microtime( TRUE ) - $timeexec['start'] ), 5 ).' sec', PEAR_LOG_ERR );
|
110 |
+
$this->log->log( 'ERROR 3,invalid output ('.$inputFileParts['filename'].'.csv)', PEAR_LOG_ERR );
|
111 |
+
$this->log->flush();
|
112 |
+
}
|
113 |
+
return FALSE;
|
114 |
+
}
|
115 |
+
$outputdirFile = $this->getConfig ('outputdirectory' ).DIRECTORY_SEPARATOR.$inputFileParts['filename'].'.ics';
|
116 |
+
$outputFileParts = pathinfo( $outputdirFile );
|
117 |
+
if( $this->log )
|
118 |
+
$this->log->log( "output set to '$outputdirFile'", PEAR_LOG_NOTICE );
|
119 |
+
}
|
120 |
+
if( $this->log ) {
|
121 |
+
$this->log->log( "INPUT..FILE:$inputdirFile", PEAR_LOG_NOTICE );
|
122 |
+
$this->log->log( "OUTPUT.FILE:$outputdirFile", PEAR_LOG_NOTICE );
|
123 |
+
}
|
124 |
+
/** read csv file into input array */
|
125 |
+
ini_set( 'auto_detect_line_endings', true );
|
126 |
+
$fp = fopen( $inputdirFile, "r" );
|
127 |
+
if( FALSE === $fp ) {
|
128 |
+
if( $this->log ) {
|
129 |
+
$this->log->log( "ERROR 4, unable to read file: '$inputdirFile'", PEAR_LOG_ERR );
|
130 |
+
$this->log->log( number_format(( microtime( TRUE ) - $timeexec['start'] ), 5 ).' sec', PEAR_LOG_DEBUG );
|
131 |
+
$this->log->flush();
|
132 |
+
}
|
133 |
+
return FALSE;
|
134 |
+
}
|
135 |
}
|
136 |
$rows = array();
|
137 |
while ( FALSE !== ( $row = fgetcsv( $fp, FALSE, $conf['sep'], $conf['del'] )))
|
140 |
ini_set( 'auto_detect_line_endings', false );
|
141 |
$cntrows = count( $rows );
|
142 |
/** iCalcreator checks when setting directory and filename */
|
143 |
+
$calendar = new Kigkonsult\Icalcreator\Vcalendar();
|
144 |
if( FALSE !== ( $unique_id = $this->getConfig( 'unique_id' )))
|
145 |
$calendar->setConfig( 'unique_id', $unique_id );
|
146 |
if( ! $this->getConfig( 'outputobj' ) ) {
|
147 |
+
if( $remoteOutput ) {
|
148 |
+
if( FALSE === $calendar->setConfig( 'url', $outputdirFile )) {
|
149 |
+
if( $this->log ) {
|
150 |
+
$this->log->log( "ERROR 5, iCalcreator: invalid url: '$outputdirFile'", PEAR_LOG_ERR );
|
151 |
+
$this->log->log( number_format(( microtime( TRUE ) - $timeexec['start'] ), 5 ).' sec', PEAR_LOG_DEBUG );
|
152 |
+
$this->log->flush();
|
153 |
+
}
|
154 |
+
return FALSE;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
else {
|
158 |
+
if( FALSE === $calendar->setConfig( 'directory', $outputFileParts['dirname'] )) {
|
159 |
+
if( $this->log ) {
|
160 |
+
$this->log->log( "ERROR 6, INPUT FILE:'$inputdirFile' iCalcreator: invalid directory: '".$outputFileParts['dirname']."'", PEAR_LOG_ERR );
|
161 |
+
$this->log->log( number_format(( microtime( TRUE ) - $timeexec['start'] ), 5 ).' sec', PEAR_LOG_DEBUG );
|
162 |
+
$this->log->flush();
|
163 |
+
}
|
164 |
+
return FALSE;
|
165 |
+
}
|
166 |
+
if( FALSE === $calendar->setConfig( 'filename', $outputFileParts['basename'] )) {
|
167 |
+
if( $this->log ) {
|
168 |
+
$this->log->log( "ERROR 7, INPUT FILE:'$inputdirFile' iCalcreator: invalid filename: '".$outputFileParts['basename']."'", PEAR_LOG_ERR );
|
169 |
+
$this->log->log( number_format(( microtime( TRUE ) - $timeexec['start'] ), 5 ).' sec',PEAR_LOG_DEBUG );
|
170 |
+
$this->log->flush();
|
171 |
+
}
|
172 |
+
return FALSE;
|
173 |
+
}
|
174 |
+
}
|
175 |
}
|
176 |
$timeexec['fileOk'] = microtime( TRUE );
|
177 |
/** info rows */
|
237 |
if( 'VTIMEZONE' == $compname ) {
|
238 |
if( $comp )
|
239 |
$calendar->setComponent( $comp );
|
240 |
+
$comp = new Kigkonsult\Icalcreator\Vtimezone();
|
241 |
$actcomp = & $comp;
|
242 |
$cntprops += 1;
|
243 |
}
|
244 |
elseif( 'STANDARD' == $compname ) {
|
245 |
+
$subcomp = new Kigkonsult\Icalcreator\Vtimezone( 'STANDARD' );
|
246 |
$actcomp = & $subcomp;
|
247 |
}
|
248 |
elseif( 'DAYLIGHT' == $compname ) {
|
249 |
+
$subcomp = new Kigkonsult\Icalcreator\Vtimezone( 'DAYLIGHT' );
|
250 |
$actcomp = & $subcomp;
|
251 |
}
|
252 |
else {
|
332 |
if( in_array( $compname, $allowedComps )) {
|
333 |
if( $comp )
|
334 |
$calendar->setComponent( $comp );
|
335 |
+
$className = 'Kigkonsult\\Icalcreator\\' . ucwords( $rows[$row][0] );
|
336 |
$comp = new $className;
|
337 |
$actcomp = & $comp;
|
338 |
$cntprops += 1;
|
339 |
}
|
340 |
elseif( 'VALARM' == $compname ) {
|
341 |
+
$subcomp = new Kigkonsult\Icalcreator\Valarm();
|
342 |
$actcomp = & $subcomp;
|
343 |
}
|
344 |
else {
|
438 |
/** return calendar, save or send the file */
|
439 |
if( $this->getConfig( 'outputobj' ) ) {
|
440 |
if( $this->log ) {
|
441 |
+
$this->log->log( "INPUT FILE:'$inputdirFile' returning iCalcreator Vcalendar instance", PEAR_LOG_NOTICE );
|
442 |
$this->log->flush();
|
443 |
}
|
444 |
return $calendar;
|
733 |
if( $this->log )
|
734 |
$this->log->log( "found (1): '$dirFile'", PEAR_LOG_DEBUG );
|
735 |
if( $this->getConfig( 'extension_check' ) ) {
|
736 |
+
if( $ext && ( strtolower( $ext ) !== strtolower( substr( $dirFile, -3 )))) {
|
737 |
+
if( $this->log )
|
738 |
+
$this->log->log( "ERROR 1, '$ext' wanted, invalid file extension found ($dirFile)", PEAR_LOG_ERR );
|
739 |
+
return FALSE;
|
740 |
+
}
|
741 |
}
|
742 |
$dirFile = $this->getConfig( $operation.'directory' ).DIRECTORY_SEPARATOR.$dirFile;
|
743 |
$fileParts = pathinfo( $dirFile );
|
817 |
if( $calendar )
|
818 |
$calnl = $calendar->getConfig( 'nl' );
|
819 |
else { /** iCalcreator set config, read and parse input iCal file */
|
820 |
+
$calendar = new Kigkonsult\Icalcreator\Vcalendar();
|
821 |
if( FALSE !== ( $unique_id = $this->getConfig( 'unique_id' )))
|
822 |
$calendar->setConfig( 'unique_id', $unique_id );
|
823 |
$calnl = $calendar->getConfig( 'nl' );
|
1391 |
if( $calendar )
|
1392 |
$calnl = $calendar->getConfig( 'nl' );
|
1393 |
else { /** iCalcreator set config, read and parse input iCal file */
|
1394 |
+
$calendar = new Kigkonsult\Icalcreator\Vcalendar();
|
1395 |
if( FALSE !== ( $unique_id = $this->getConfig( 'unique_id' )))
|
1396 |
$calendar->setConfig( 'unique_id', $unique_id );
|
1397 |
$calnl = $calendar->getConfig( 'nl' );
|
1868 |
return TRUE;
|
1869 |
}
|
1870 |
}
|
1871 |
+
|
lib/iCal/iCalcreator-2.24.2/README.md
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
# iCalcreator
|
2 |
-
|
3 |
-
is the PHP class package managing
|
4 |
-
|
5 |
-
> iCal (rfc2445/rfc5445) information
|
6 |
-
|
7 |
-
operating on calendar and
|
8 |
-
calendar events, reports, todos and journaling data.
|
9 |
-
|
10 |
-
iCalcreator supports systems like
|
11 |
-
|
12 |
-
* calendars
|
13 |
-
* CMS
|
14 |
-
* project management systems
|
15 |
-
* other applications...
|
16 |
-
|
17 |
-
Builds :
|
18 |
-
|
19 |
-
- stable 2.24.2 *(master)*
|
20 |
-
|
21 |
-
- next 2.26 - review releaseNotes-2.26 !
|
22 |
-
|
23 |
-
- old 2.22.5 - unsupported
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/docs/AGPLv3.txt
DELETED
@@ -1,661 +0,0 @@
|
|
1 |
-
GNU AFFERO GENERAL PUBLIC LICENSE
|
2 |
-
Version 3, 19 November 2007
|
3 |
-
|
4 |
-
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5 |
-
Everyone is permitted to copy and distribute verbatim copies
|
6 |
-
of this license document, but changing it is not allowed.
|
7 |
-
|
8 |
-
Preamble
|
9 |
-
|
10 |
-
The GNU Affero General Public License is a free, copyleft license for
|
11 |
-
software and other kinds of works, specifically designed to ensure
|
12 |
-
cooperation with the community in the case of network server software.
|
13 |
-
|
14 |
-
The licenses for most software and other practical works are designed
|
15 |
-
to take away your freedom to share and change the works. By contrast,
|
16 |
-
our General Public Licenses are intended to guarantee your freedom to
|
17 |
-
share and change all versions of a program--to make sure it remains free
|
18 |
-
software for all its users.
|
19 |
-
|
20 |
-
When we speak of free software, we are referring to freedom, not
|
21 |
-
price. Our General Public Licenses are designed to make sure that you
|
22 |
-
have the freedom to distribute copies of free software (and charge for
|
23 |
-
them if you wish), that you receive source code or can get it if you
|
24 |
-
want it, that you can change the software or use pieces of it in new
|
25 |
-
free programs, and that you know you can do these things.
|
26 |
-
|
27 |
-
Developers that use our General Public Licenses protect your rights
|
28 |
-
with two steps: (1) assert copyright on the software, and (2) offer
|
29 |
-
you this License which gives you legal permission to copy, distribute
|
30 |
-
and/or modify the software.
|
31 |
-
|
32 |
-
A secondary benefit of defending all users' freedom is that
|
33 |
-
improvements made in alternate versions of the program, if they
|
34 |
-
receive widespread use, become available for other developers to
|
35 |
-
incorporate. Many developers of free software are heartened and
|
36 |
-
encouraged by the resulting cooperation. However, in the case of
|
37 |
-
software used on network servers, this result may fail to come about.
|
38 |
-
The GNU General Public License permits making a modified version and
|
39 |
-
letting the public access it on a server without ever releasing its
|
40 |
-
source code to the public.
|
41 |
-
|
42 |
-
The GNU Affero General Public License is designed specifically to
|
43 |
-
ensure that, in such cases, the modified source code becomes available
|
44 |
-
to the community. It requires the operator of a network server to
|
45 |
-
provide the source code of the modified version running there to the
|
46 |
-
users of that server. Therefore, public use of a modified version, on
|
47 |
-
a publicly accessible server, gives the public access to the source
|
48 |
-
code of the modified version.
|
49 |
-
|
50 |
-
An older license, called the Affero General Public License and
|
51 |
-
published by Affero, was designed to accomplish similar goals. This is
|
52 |
-
a different license, not a version of the Affero GPL, but Affero has
|
53 |
-
released a new version of the Affero GPL which permits relicensing under
|
54 |
-
this license.
|
55 |
-
|
56 |
-
The precise terms and conditions for copying, distribution and
|
57 |
-
modification follow.
|
58 |
-
|
59 |
-
TERMS AND CONDITIONS
|
60 |
-
|
61 |
-
0. Definitions.
|
62 |
-
|
63 |
-
"This License" refers to version 3 of the GNU Affero General Public License.
|
64 |
-
|
65 |
-
"Copyright" also means copyright-like laws that apply to other kinds of
|
66 |
-
works, such as semiconductor masks.
|
67 |
-
|
68 |
-
"The Program" refers to any copyrightable work licensed under this
|
69 |
-
License. Each licensee is addressed as "you". "Licensees" and
|
70 |
-
"recipients" may be individuals or organizations.
|
71 |
-
|
72 |
-
To "modify" a work means to copy from or adapt all or part of the work
|
73 |
-
in a fashion requiring copyright permission, other than the making of an
|
74 |
-
exact copy. The resulting work is called a "modified version" of the
|
75 |
-
earlier work or a work "based on" the earlier work.
|
76 |
-
|
77 |
-
A "covered work" means either the unmodified Program or a work based
|
78 |
-
on the Program.
|
79 |
-
|
80 |
-
To "propagate" a work means to do anything with it that, without
|
81 |
-
permission, would make you directly or secondarily liable for
|
82 |
-
infringement under applicable copyright law, except executing it on a
|
83 |
-
computer or modifying a private copy. Propagation includes copying,
|
84 |
-
distribution (with or without modification), making available to the
|
85 |
-
public, and in some countries other activities as well.
|
86 |
-
|
87 |
-
To "convey" a work means any kind of propagation that enables other
|
88 |
-
parties to make or receive copies. Mere interaction with a user through
|
89 |
-
a computer network, with no transfer of a copy, is not conveying.
|
90 |
-
|
91 |
-
An interactive user interface displays "Appropriate Legal Notices"
|
92 |
-
to the extent that it includes a convenient and prominently visible
|
93 |
-
feature that (1) displays an appropriate copyright notice, and (2)
|
94 |
-
tells the user that there is no warranty for the work (except to the
|
95 |
-
extent that warranties are provided), that licensees may convey the
|
96 |
-
work under this License, and how to view a copy of this License. If
|
97 |
-
the interface presents a list of user commands or options, such as a
|
98 |
-
menu, a prominent item in the list meets this criterion.
|
99 |
-
|
100 |
-
1. Source Code.
|
101 |
-
|
102 |
-
The "source code" for a work means the preferred form of the work
|
103 |
-
for making modifications to it. "Object code" means any non-source
|
104 |
-
form of a work.
|
105 |
-
|
106 |
-
A "Standard Interface" means an interface that either is an official
|
107 |
-
standard defined by a recognized standards body, or, in the case of
|
108 |
-
interfaces specified for a particular programming language, one that
|
109 |
-
is widely used among developers working in that language.
|
110 |
-
|
111 |
-
The "System Libraries" of an executable work include anything, other
|
112 |
-
than the work as a whole, that (a) is included in the normal form of
|
113 |
-
packaging a Major Component, but which is not part of that Major
|
114 |
-
Component, and (b) serves only to enable use of the work with that
|
115 |
-
Major Component, or to implement a Standard Interface for which an
|
116 |
-
implementation is available to the public in source code form. A
|
117 |
-
"Major Component", in this context, means a major essential component
|
118 |
-
(kernel, window system, and so on) of the specific operating system
|
119 |
-
(if any) on which the executable work runs, or a compiler used to
|
120 |
-
produce the work, or an object code interpreter used to run it.
|
121 |
-
|
122 |
-
The "Corresponding Source" for a work in object code form means all
|
123 |
-
the source code needed to generate, install, and (for an executable
|
124 |
-
work) run the object code and to modify the work, including scripts to
|
125 |
-
control those activities. However, it does not include the work's
|
126 |
-
System Libraries, or general-purpose tools or generally available free
|
127 |
-
programs which are used unmodified in performing those activities but
|
128 |
-
which are not part of the work. For example, Corresponding Source
|
129 |
-
includes interface definition files associated with source files for
|
130 |
-
the work, and the source code for shared libraries and dynamically
|
131 |
-
linked subprograms that the work is specifically designed to require,
|
132 |
-
such as by intimate data communication or control flow between those
|
133 |
-
subprograms and other parts of the work.
|
134 |
-
|
135 |
-
The Corresponding Source need not include anything that users
|
136 |
-
can regenerate automatically from other parts of the Corresponding
|
137 |
-
Source.
|
138 |
-
|
139 |
-
The Corresponding Source for a work in source code form is that
|
140 |
-
same work.
|
141 |
-
|
142 |
-
2. Basic Permissions.
|
143 |
-
|
144 |
-
All rights granted under this License are granted for the term of
|
145 |
-
copyright on the Program, and are irrevocable provided the stated
|
146 |
-
conditions are met. This License explicitly affirms your unlimited
|
147 |
-
permission to run the unmodified Program. The output from running a
|
148 |
-
covered work is covered by this License only if the output, given its
|
149 |
-
content, constitutes a covered work. This License acknowledges your
|
150 |
-
rights of fair use or other equivalent, as provided by copyright law.
|
151 |
-
|
152 |
-
You may make, run and propagate covered works that you do not
|
153 |
-
convey, without conditions so long as your license otherwise remains
|
154 |
-
in force. You may convey covered works to others for the sole purpose
|
155 |
-
of having them make modifications exclusively for you, or provide you
|
156 |
-
with facilities for running those works, provided that you comply with
|
157 |
-
the terms of this License in conveying all material for which you do
|
158 |
-
not control copyright. Those thus making or running the covered works
|
159 |
-
for you must do so exclusively on your behalf, under your direction
|
160 |
-
and control, on terms that prohibit them from making any copies of
|
161 |
-
your copyrighted material outside their relationship with you.
|
162 |
-
|
163 |
-
Conveying under any other circumstances is permitted solely under
|
164 |
-
the conditions stated below. Sublicensing is not allowed; section 10
|
165 |
-
makes it unnecessary.
|
166 |
-
|
167 |
-
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
168 |
-
|
169 |
-
No covered work shall be deemed part of an effective technological
|
170 |
-
measure under any applicable law fulfilling obligations under article
|
171 |
-
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
172 |
-
similar laws prohibiting or restricting circumvention of such
|
173 |
-
measures.
|
174 |
-
|
175 |
-
When you convey a covered work, you waive any legal power to forbid
|
176 |
-
circumvention of technological measures to the extent such circumvention
|
177 |
-
is effected by exercising rights under this License with respect to
|
178 |
-
the covered work, and you disclaim any intention to limit operation or
|
179 |
-
modification of the work as a means of enforcing, against the work's
|
180 |
-
users, your or third parties' legal rights to forbid circumvention of
|
181 |
-
technological measures.
|
182 |
-
|
183 |
-
4. Conveying Verbatim Copies.
|
184 |
-
|
185 |
-
You may convey verbatim copies of the Program's source code as you
|
186 |
-
receive it, in any medium, provided that you conspicuously and
|
187 |
-
appropriately publish on each copy an appropriate copyright notice;
|
188 |
-
keep intact all notices stating that this License and any
|
189 |
-
non-permissive terms added in accord with section 7 apply to the code;
|
190 |
-
keep intact all notices of the absence of any warranty; and give all
|
191 |
-
recipients a copy of this License along with the Program.
|
192 |
-
|
193 |
-
You may charge any price or no price for each copy that you convey,
|
194 |
-
and you may offer support or warranty protection for a fee.
|
195 |
-
|
196 |
-
5. Conveying Modified Source Versions.
|
197 |
-
|
198 |
-
You may convey a work based on the Program, or the modifications to
|
199 |
-
produce it from the Program, in the form of source code under the
|
200 |
-
terms of section 4, provided that you also meet all of these conditions:
|
201 |
-
|
202 |
-
a) The work must carry prominent notices stating that you modified
|
203 |
-
it, and giving a relevant date.
|
204 |
-
|
205 |
-
b) The work must carry prominent notices stating that it is
|
206 |
-
released under this License and any conditions added under section
|
207 |
-
7. This requirement modifies the requirement in section 4 to
|
208 |
-
"keep intact all notices".
|
209 |
-
|
210 |
-
c) You must license the entire work, as a whole, under this
|
211 |
-
License to anyone who comes into possession of a copy. This
|
212 |
-
License will therefore apply, along with any applicable section 7
|
213 |
-
additional terms, to the whole of the work, and all its parts,
|
214 |
-
regardless of how they are packaged. This License gives no
|
215 |
-
permission to license the work in any other way, but it does not
|
216 |
-
invalidate such permission if you have separately received it.
|
217 |
-
|
218 |
-
d) If the work has interactive user interfaces, each must display
|
219 |
-
Appropriate Legal Notices; however, if the Program has interactive
|
220 |
-
interfaces that do not display Appropriate Legal Notices, your
|
221 |
-
work need not make them do so.
|
222 |
-
|
223 |
-
A compilation of a covered work with other separate and independent
|
224 |
-
works, which are not by their nature extensions of the covered work,
|
225 |
-
and which are not combined with it such as to form a larger program,
|
226 |
-
in or on a volume of a storage or distribution medium, is called an
|
227 |
-
"aggregate" if the compilation and its resulting copyright are not
|
228 |
-
used to limit the access or legal rights of the compilation's users
|
229 |
-
beyond what the individual works permit. Inclusion of a covered work
|
230 |
-
in an aggregate does not cause this License to apply to the other
|
231 |
-
parts of the aggregate.
|
232 |
-
|
233 |
-
6. Conveying Non-Source Forms.
|
234 |
-
|
235 |
-
You may convey a covered work in object code form under the terms
|
236 |
-
of sections 4 and 5, provided that you also convey the
|
237 |
-
machine-readable Corresponding Source under the terms of this License,
|
238 |
-
in one of these ways:
|
239 |
-
|
240 |
-
a) Convey the object code in, or embodied in, a physical product
|
241 |
-
(including a physical distribution medium), accompanied by the
|
242 |
-
Corresponding Source fixed on a durable physical medium
|
243 |
-
customarily used for software interchange.
|
244 |
-
|
245 |
-
b) Convey the object code in, or embodied in, a physical product
|
246 |
-
(including a physical distribution medium), accompanied by a
|
247 |
-
written offer, valid for at least three years and valid for as
|
248 |
-
long as you offer spare parts or customer support for that product
|
249 |
-
model, to give anyone who possesses the object code either (1) a
|
250 |
-
copy of the Corresponding Source for all the software in the
|
251 |
-
product that is covered by this License, on a durable physical
|
252 |
-
medium customarily used for software interchange, for a price no
|
253 |
-
more than your reasonable cost of physically performing this
|
254 |
-
conveying of source, or (2) access to copy the
|
255 |
-
Corresponding Source from a network server at no charge.
|
256 |
-
|
257 |
-
c) Convey individual copies of the object code with a copy of the
|
258 |
-
written offer to provide the Corresponding Source. This
|
259 |
-
alternative is allowed only occasionally and noncommercially, and
|
260 |
-
only if you received the object code with such an offer, in accord
|
261 |
-
with subsection 6b.
|
262 |
-
|
263 |
-
d) Convey the object code by offering access from a designated
|
264 |
-
place (gratis or for a charge), and offer equivalent access to the
|
265 |
-
Corresponding Source in the same way through the same place at no
|
266 |
-
further charge. You need not require recipients to copy the
|
267 |
-
Corresponding Source along with the object code. If the place to
|
268 |
-
copy the object code is a network server, the Corresponding Source
|
269 |
-
may be on a different server (operated by you or a third party)
|
270 |
-
that supports equivalent copying facilities, provided you maintain
|
271 |
-
clear directions next to the object code saying where to find the
|
272 |
-
Corresponding Source. Regardless of what server hosts the
|
273 |
-
Corresponding Source, you remain obligated to ensure that it is
|
274 |
-
available for as long as needed to satisfy these requirements.
|
275 |
-
|
276 |
-
e) Convey the object code using peer-to-peer transmission, provided
|
277 |
-
you inform other peers where the object code and Corresponding
|
278 |
-
Source of the work are being offered to the general public at no
|
279 |
-
charge under subsection 6d.
|
280 |
-
|
281 |
-
A separable portion of the object code, whose source code is excluded
|
282 |
-
from the Corresponding Source as a System Library, need not be
|
283 |
-
included in conveying the object code work.
|
284 |
-
|
285 |
-
A "User Product" is either (1) a "consumer product", which means any
|
286 |
-
tangible personal property which is normally used for personal, family,
|
287 |
-
or household purposes, or (2) anything designed or sold for incorporation
|
288 |
-
into a dwelling. In determining whether a product is a consumer product,
|
289 |
-
doubtful cases shall be resolved in favor of coverage. For a particular
|
290 |
-
product received by a particular user, "normally used" refers to a
|
291 |
-
typical or common use of that class of product, regardless of the status
|
292 |
-
of the particular user or of the way in which the particular user
|
293 |
-
actually uses, or expects or is expected to use, the product. A product
|
294 |
-
is a consumer product regardless of whether the product has substantial
|
295 |
-
commercial, industrial or non-consumer uses, unless such uses represent
|
296 |
-
the only significant mode of use of the product.
|
297 |
-
|
298 |
-
"Installation Information" for a User Product means any methods,
|
299 |
-
procedures, authorization keys, or other information required to install
|
300 |
-
and execute modified versions of a covered work in that User Product from
|
301 |
-
a modified version of its Corresponding Source. The information must
|
302 |
-
suffice to ensure that the continued functioning of the modified object
|
303 |
-
code is in no case prevented or interfered with solely because
|
304 |
-
modification has been made.
|
305 |
-
|
306 |
-
If you convey an object code work under this section in, or with, or
|
307 |
-
specifically for use in, a User Product, and the conveying occurs as
|
308 |
-
part of a transaction in which the right of possession and use of the
|
309 |
-
User Product is transferred to the recipient in perpetuity or for a
|
310 |
-
fixed term (regardless of how the transaction is characterized), the
|
311 |
-
Corresponding Source conveyed under this section must be accompanied
|
312 |
-
by the Installation Information. But this requirement does not apply
|
313 |
-
if neither you nor any third party retains the ability to install
|
314 |
-
modified object code on the User Product (for example, the work has
|
315 |
-
been installed in ROM).
|
316 |
-
|
317 |
-
The requirement to provide Installation Information does not include a
|
318 |
-
requirement to continue to provide support service, warranty, or updates
|
319 |
-
for a work that has been modified or installed by the recipient, or for
|
320 |
-
the User Product in which it has been modified or installed. Access to a
|
321 |
-
network may be denied when the modification itself materially and
|
322 |
-
adversely affects the operation of the network or violates the rules and
|
323 |
-
protocols for communication across the network.
|
324 |
-
|
325 |
-
Corresponding Source conveyed, and Installation Information provided,
|
326 |
-
in accord with this section must be in a format that is publicly
|
327 |
-
documented (and with an implementation available to the public in
|
328 |
-
source code form), and must require no special password or key for
|
329 |
-
unpacking, reading or copying.
|
330 |
-
|
331 |
-
7. Additional Terms.
|
332 |
-
|
333 |
-
"Additional permissions" are terms that supplement the terms of this
|
334 |
-
License by making exceptions from one or more of its conditions.
|
335 |
-
Additional permissions that are applicable to the entire Program shall
|
336 |
-
be treated as though they were included in this License, to the extent
|
337 |
-
that they are valid under applicable law. If additional permissions
|
338 |
-
apply only to part of the Program, that part may be used separately
|
339 |
-
under those permissions, but the entire Program remains governed by
|
340 |
-
this License without regard to the additional permissions.
|
341 |
-
|
342 |
-
When you convey a copy of a covered work, you may at your option
|
343 |
-
remove any additional permissions from that copy, or from any part of
|
344 |
-
it. (Additional permissions may be written to require their own
|
345 |
-
removal in certain cases when you modify the work.) You may place
|
346 |
-
additional permissions on material, added by you to a covered work,
|
347 |
-
for which you have or can give appropriate copyright permission.
|
348 |
-
|
349 |
-
Notwithstanding any other provision of this License, for material you
|
350 |
-
add to a covered work, you may (if authorized by the copyright holders of
|
351 |
-
that material) supplement the terms of this License with terms:
|
352 |
-
|
353 |
-
a) Disclaiming warranty or limiting liability differently from the
|
354 |
-
terms of sections 15 and 16 of this License; or
|
355 |
-
|
356 |
-
b) Requiring preservation of specified reasonable legal notices or
|
357 |
-
author attributions in that material or in the Appropriate Legal
|
358 |
-
Notices displayed by works containing it; or
|
359 |
-
|
360 |
-
c) Prohibiting misrepresentation of the origin of that material, or
|
361 |
-
requiring that modified versions of such material be marked in
|
362 |
-
reasonable ways as different from the original version; or
|
363 |
-
|
364 |
-
d) Limiting the use for publicity purposes of names of licensors or
|
365 |
-
authors of the material; or
|
366 |
-
|
367 |
-
e) Declining to grant rights under trademark law for use of some
|
368 |
-
trade names, trademarks, or service marks; or
|
369 |
-
|
370 |
-
f) Requiring indemnification of licensors and authors of that
|
371 |
-
material by anyone who conveys the material (or modified versions of
|
372 |
-
it) with contractual assumptions of liability to the recipient, for
|
373 |
-
any liability that these contractual assumptions directly impose on
|
374 |
-
those licensors and authors.
|
375 |
-
|
376 |
-
All other non-permissive additional terms are considered "further
|
377 |
-
restrictions" within the meaning of section 10. If the Program as you
|
378 |
-
received it, or any part of it, contains a notice stating that it is
|
379 |
-
governed by this License along with a term that is a further
|
380 |
-
restriction, you may remove that term. If a license document contains
|
381 |
-
a further restriction but permits relicensing or conveying under this
|
382 |
-
License, you may add to a covered work material governed by the terms
|
383 |
-
of that license document, provided that the further restriction does
|
384 |
-
not survive such relicensing or conveying.
|
385 |
-
|
386 |
-
If you add terms to a covered work in accord with this section, you
|
387 |
-
must place, in the relevant source files, a statement of the
|
388 |
-
additional terms that apply to those files, or a notice indicating
|
389 |
-
where to find the applicable terms.
|
390 |
-
|
391 |
-
Additional terms, permissive or non-permissive, may be stated in the
|
392 |
-
form of a separately written license, or stated as exceptions;
|
393 |
-
the above requirements apply either way.
|
394 |
-
|
395 |
-
8. Termination.
|
396 |
-
|
397 |
-
You may not propagate or modify a covered work except as expressly
|
398 |
-
provided under this License. Any attempt otherwise to propagate or
|
399 |
-
modify it is void, and will automatically terminate your rights under
|
400 |
-
this License (including any patent licenses granted under the third
|
401 |
-
paragraph of section 11).
|
402 |
-
|
403 |
-
However, if you cease all violation of this License, then your
|
404 |
-
license from a particular copyright holder is reinstated (a)
|
405 |
-
provisionally, unless and until the copyright holder explicitly and
|
406 |
-
finally terminates your license, and (b) permanently, if the copyright
|
407 |
-
holder fails to notify you of the violation by some reasonable means
|
408 |
-
prior to 60 days after the cessation.
|
409 |
-
|
410 |
-
Moreover, your license from a particular copyright holder is
|
411 |
-
reinstated permanently if the copyright holder notifies you of the
|
412 |
-
violation by some reasonable means, this is the first time you have
|
413 |
-
received notice of violation of this License (for any work) from that
|
414 |
-
copyright holder, and you cure the violation prior to 30 days after
|
415 |
-
your receipt of the notice.
|
416 |
-
|
417 |
-
Termination of your rights under this section does not terminate the
|
418 |
-
licenses of parties who have received copies or rights from you under
|
419 |
-
this License. If your rights have been terminated and not permanently
|
420 |
-
reinstated, you do not qualify to receive new licenses for the same
|
421 |
-
material under section 10.
|
422 |
-
|
423 |
-
9. Acceptance Not Required for Having Copies.
|
424 |
-
|
425 |
-
You are not required to accept this License in order to receive or
|
426 |
-
run a copy of the Program. Ancillary propagation of a covered work
|
427 |
-
occurring solely as a consequence of using peer-to-peer transmission
|
428 |
-
to receive a copy likewise does not require acceptance. However,
|
429 |
-
nothing other than this License grants you permission to propagate or
|
430 |
-
modify any covered work. These actions infringe copyright if you do
|
431 |
-
not accept this License. Therefore, by modifying or propagating a
|
432 |
-
covered work, you indicate your acceptance of this License to do so.
|
433 |
-
|
434 |
-
10. Automatic Licensing of Downstream Recipients.
|
435 |
-
|
436 |
-
Each time you convey a covered work, the recipient automatically
|
437 |
-
receives a license from the original licensors, to run, modify and
|
438 |
-
propagate that work, subject to this License. You are not responsible
|
439 |
-
for enforcing compliance by third parties with this License.
|
440 |
-
|
441 |
-
An "entity transaction" is a transaction transferring control of an
|
442 |
-
organization, or substantially all assets of one, or subdividing an
|
443 |
-
organization, or merging organizations. If propagation of a covered
|
444 |
-
work results from an entity transaction, each party to that
|
445 |
-
transaction who receives a copy of the work also receives whatever
|
446 |
-
licenses to the work the party's predecessor in interest had or could
|
447 |
-
give under the previous paragraph, plus a right to possession of the
|
448 |
-
Corresponding Source of the work from the predecessor in interest, if
|
449 |
-
the predecessor has it or can get it with reasonable efforts.
|
450 |
-
|
451 |
-
You may not impose any further restrictions on the exercise of the
|
452 |
-
rights granted or affirmed under this License. For example, you may
|
453 |
-
not impose a license fee, royalty, or other charge for exercise of
|
454 |
-
rights granted under this License, and you may not initiate litigation
|
455 |
-
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
456 |
-
any patent claim is infringed by making, using, selling, offering for
|
457 |
-
sale, or importing the Program or any portion of it.
|
458 |
-
|
459 |
-
11. Patents.
|
460 |
-
|
461 |
-
A "contributor" is a copyright holder who authorizes use under this
|
462 |
-
License of the Program or a work on which the Program is based. The
|
463 |
-
work thus licensed is called the contributor's "contributor version".
|
464 |
-
|
465 |
-
A contributor's "essential patent claims" are all patent claims
|
466 |
-
owned or controlled by the contributor, whether already acquired or
|
467 |
-
hereafter acquired, that would be infringed by some manner, permitted
|
468 |
-
by this License, of making, using, or selling its contributor version,
|
469 |
-
but do not include claims that would be infringed only as a
|
470 |
-
consequence of further modification of the contributor version. For
|
471 |
-
purposes of this definition, "control" includes the right to grant
|
472 |
-
patent sublicenses in a manner consistent with the requirements of
|
473 |
-
this License.
|
474 |
-
|
475 |
-
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
476 |
-
patent license under the contributor's essential patent claims, to
|
477 |
-
make, use, sell, offer for sale, import and otherwise run, modify and
|
478 |
-
propagate the contents of its contributor version.
|
479 |
-
|
480 |
-
In the following three paragraphs, a "patent license" is any express
|
481 |
-
agreement or commitment, however denominated, not to enforce a patent
|
482 |
-
(such as an express permission to practice a patent or covenant not to
|
483 |
-
sue for patent infringement). To "grant" such a patent license to a
|
484 |
-
party means to make such an agreement or commitment not to enforce a
|
485 |
-
patent against the party.
|
486 |
-
|
487 |
-
If you convey a covered work, knowingly relying on a patent license,
|
488 |
-
and the Corresponding Source of the work is not available for anyone
|
489 |
-
to copy, free of charge and under the terms of this License, through a
|
490 |
-
publicly available network server or other readily accessible means,
|
491 |
-
then you must either (1) cause the Corresponding Source to be so
|
492 |
-
available, or (2) arrange to deprive yourself of the benefit of the
|
493 |
-
patent license for this particular work, or (3) arrange, in a manner
|
494 |
-
consistent with the requirements of this License, to extend the patent
|
495 |
-
license to downstream recipients. "Knowingly relying" means you have
|
496 |
-
actual knowledge that, but for the patent license, your conveying the
|
497 |
-
covered work in a country, or your recipient's use of the covered work
|
498 |
-
in a country, would infringe one or more identifiable patents in that
|
499 |
-
country that you have reason to believe are valid.
|
500 |
-
|
501 |
-
If, pursuant to or in connection with a single transaction or
|
502 |
-
arrangement, you convey, or propagate by procuring conveyance of, a
|
503 |
-
covered work, and grant a patent license to some of the parties
|
504 |
-
receiving the covered work authorizing them to use, propagate, modify
|
505 |
-
or convey a specific copy of the covered work, then the patent license
|
506 |
-
you grant is automatically extended to all recipients of the covered
|
507 |
-
work and works based on it.
|
508 |
-
|
509 |
-
A patent license is "discriminatory" if it does not include within
|
510 |
-
the scope of its coverage, prohibits the exercise of, or is
|
511 |
-
conditioned on the non-exercise of one or more of the rights that are
|
512 |
-
specifically granted under this License. You may not convey a covered
|
513 |
-
work if you are a party to an arrangement with a third party that is
|
514 |
-
in the business of distributing software, under which you make payment
|
515 |
-
to the third party based on the extent of your activity of conveying
|
516 |
-
the work, and under which the third party grants, to any of the
|
517 |
-
parties who would receive the covered work from you, a discriminatory
|
518 |
-
patent license (a) in connection with copies of the covered work
|
519 |
-
conveyed by you (or copies made from those copies), or (b) primarily
|
520 |
-
for and in connection with specific products or compilations that
|
521 |
-
contain the covered work, unless you entered into that arrangement,
|
522 |
-
or that patent license was granted, prior to 28 March 2007.
|
523 |
-
|
524 |
-
Nothing in this License shall be construed as excluding or limiting
|
525 |
-
any implied license or other defenses to infringement that may
|
526 |
-
otherwise be available to you under applicable patent law.
|
527 |
-
|
528 |
-
12. No Surrender of Others' Freedom.
|
529 |
-
|
530 |
-
If conditions are imposed on you (whether by court order, agreement or
|
531 |
-
otherwise) that contradict the conditions of this License, they do not
|
532 |
-
excuse you from the conditions of this License. If you cannot convey a
|
533 |
-
covered work so as to satisfy simultaneously your obligations under this
|
534 |
-
License and any other pertinent obligations, then as a consequence you may
|
535 |
-
not convey it at all. For example, if you agree to terms that obligate you
|
536 |
-
to collect a royalty for further conveying from those to whom you convey
|
537 |
-
the Program, the only way you could satisfy both those terms and this
|
538 |
-
License would be to refrain entirely from conveying the Program.
|
539 |
-
|
540 |
-
13. Remote Network Interaction; Use with the GNU General Public License.
|
541 |
-
|
542 |
-
Notwithstanding any other provision of this License, if you modify the
|
543 |
-
Program, your modified version must prominently offer all users
|
544 |
-
interacting with it remotely through a computer network (if your version
|
545 |
-
supports such interaction) an opportunity to receive the Corresponding
|
546 |
-
Source of your version by providing access to the Corresponding Source
|
547 |
-
from a network server at no charge, through some standard or customary
|
548 |
-
means of facilitating copying of software. This Corresponding Source
|
549 |
-
shall include the Corresponding Source for any work covered by version 3
|
550 |
-
of the GNU General Public License that is incorporated pursuant to the
|
551 |
-
following paragraph.
|
552 |
-
|
553 |
-
Notwithstanding any other provision of this License, you have
|
554 |
-
permission to link or combine any covered work with a work licensed
|
555 |
-
under version 3 of the GNU General Public License into a single
|
556 |
-
combined work, and to convey the resulting work. The terms of this
|
557 |
-
License will continue to apply to the part which is the covered work,
|
558 |
-
but the work with which it is combined will remain governed by version
|
559 |
-
3 of the GNU General Public License.
|
560 |
-
|
561 |
-
14. Revised Versions of this License.
|
562 |
-
|
563 |
-
The Free Software Foundation may publish revised and/or new versions of
|
564 |
-
the GNU Affero General Public License from time to time. Such new versions
|
565 |
-
will be similar in spirit to the present version, but may differ in detail to
|
566 |
-
address new problems or concerns.
|
567 |
-
|
568 |
-
Each version is given a distinguishing version number. If the
|
569 |
-
Program specifies that a certain numbered version of the GNU Affero General
|
570 |
-
Public License "or any later version" applies to it, you have the
|
571 |
-
option of following the terms and conditions either of that numbered
|
572 |
-
version or of any later version published by the Free Software
|
573 |
-
Foundation. If the Program does not specify a version number of the
|
574 |
-
GNU Affero General Public License, you may choose any version ever published
|
575 |
-
by the Free Software Foundation.
|
576 |
-
|
577 |
-
If the Program specifies that a proxy can decide which future
|
578 |
-
versions of the GNU Affero General Public License can be used, that proxy's
|
579 |
-
public statement of acceptance of a version permanently authorizes you
|
580 |
-
to choose that version for the Program.
|
581 |
-
|
582 |
-
Later license versions may give you additional or different
|
583 |
-
permissions. However, no additional obligations are imposed on any
|
584 |
-
author or copyright holder as a result of your choosing to follow a
|
585 |
-
later version.
|
586 |
-
|
587 |
-
15. Disclaimer of Warranty.
|
588 |
-
|
589 |
-
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
590 |
-
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
591 |
-
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
592 |
-
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
593 |
-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
594 |
-
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
595 |
-
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
596 |
-
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
597 |
-
|
598 |
-
16. Limitation of Liability.
|
599 |
-
|
600 |
-
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
601 |
-
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
602 |
-
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
603 |
-
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
604 |
-
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
605 |
-
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
606 |
-
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
607 |
-
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
608 |
-
SUCH DAMAGES.
|
609 |
-
|
610 |
-
17. Interpretation of Sections 15 and 16.
|
611 |
-
|
612 |
-
If the disclaimer of warranty and limitation of liability provided
|
613 |
-
above cannot be given local legal effect according to their terms,
|
614 |
-
reviewing courts shall apply local law that most closely approximates
|
615 |
-
an absolute waiver of all civil liability in connection with the
|
616 |
-
Program, unless a warranty or assumption of liability accompanies a
|
617 |
-
copy of the Program in return for a fee.
|
618 |
-
|
619 |
-
END OF TERMS AND CONDITIONS
|
620 |
-
|
621 |
-
How to Apply These Terms to Your New Programs
|
622 |
-
|
623 |
-
If you develop a new program, and you want it to be of the greatest
|
624 |
-
possible use to the public, the best way to achieve this is to make it
|
625 |
-
free software which everyone can redistribute and change under these terms.
|
626 |
-
|
627 |
-
To do so, attach the following notices to the program. It is safest
|
628 |
-
to attach them to the start of each source file to most effectively
|
629 |
-
state the exclusion of warranty; and each file should have at least
|
630 |
-
the "copyright" line and a pointer to where the full notice is found.
|
631 |
-
|
632 |
-
<one line to give the program's name and a brief idea of what it does.>
|
633 |
-
Copyright (C) <year> <name of author>
|
634 |
-
|
635 |
-
This program is free software: you can redistribute it and/or modify
|
636 |
-
it under the terms of the GNU Affero General Public License as published by
|
637 |
-
the Free Software Foundation, either version 3 of the License, or
|
638 |
-
(at your option) any later version.
|
639 |
-
|
640 |
-
This program is distributed in the hope that it will be useful,
|
641 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
642 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
643 |
-
GNU Affero General Public License for more details.
|
644 |
-
|
645 |
-
You should have received a copy of the GNU Affero General Public License
|
646 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
647 |
-
|
648 |
-
Also add information on how to contact you by electronic and paper mail.
|
649 |
-
|
650 |
-
If your software can interact with users remotely through a computer
|
651 |
-
network, you should also make sure that it provides a way for users to
|
652 |
-
get its source. For example, if your program is a web application, its
|
653 |
-
interface could display a "Source" link that leads users to an archive
|
654 |
-
of the code. There are many ways you could offer source, and different
|
655 |
-
solutions will be better for different programs; see section 13 for the
|
656 |
-
specific requirements.
|
657 |
-
|
658 |
-
You should also get your employer (if you work as a programmer) or school,
|
659 |
-
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
660 |
-
For more information on this, and how to apply and follow the GNU AGPL, see
|
661 |
-
<http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/docs/summary.html
DELETED
@@ -1,755 +0,0 @@
|
|
1 |
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
|
2 |
-
<!--
|
3 |
-
iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
|
5 |
-
This file is a part of iCalcreator.
|
6 |
-
|
7 |
-
Copyright (c) 2007-2018 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
Package iCalcreator
|
10 |
-
Version 2.24.2
|
11 |
-
License Subject matter of licence is the software iCalcreator.
|
12 |
-
The above copyright, link, package and version notices,
|
13 |
-
this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
invoked in iCalcreator shall be included in all copies or
|
15 |
-
substantial portions of the iCalcreator.
|
16 |
-
iCalcreator can be used either under the terms of
|
17 |
-
a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
or the GNU Affero General Public License, version 3:
|
19 |
-
iCalcreator is free software: you can redistribute it and/or
|
20 |
-
modify it under the terms of the GNU Affero General Public License
|
21 |
-
as published by the Free Software Foundation, either version 3 of
|
22 |
-
the License, or (at your option) any later version.
|
23 |
-
iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
GNU Affero General Public License for more details.
|
27 |
-
You should have received a copy of the GNU Affero General Public
|
28 |
-
License along with this program.
|
29 |
-
If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
-->
|
31 |
-
<html>
|
32 |
-
<head>
|
33 |
-
<title>iCalcreator 2.24.2 summary</title>
|
34 |
-
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
35 |
-
<meta name="author" content="Kjell-Inge Gustafsson, kigkonsult, All rights reserved">
|
36 |
-
<meta name="copyright" content="2017-2017 Kjell-Inge Gustafsson, kigkonsult">
|
37 |
-
<meta name="keywords" content="ical, calendar, calender, xcal, xml, icalender, rfc2445, rfc5545, vcalender, php, create">
|
38 |
-
<meta name="description" content="iCalcreator 2.24.2 summary" />
|
39 |
-
<style type="text/css">
|
40 |
-
* {
|
41 |
-
FONT-FAMILY : "Bitstream Vera Sans", Helvetica, "Lucida Grande","Lucida Sans Unicode", Lucida, Arial, Geneva, sans-serif;
|
42 |
-
BACKGROUND-COLOR: white;
|
43 |
-
COLOR : black;
|
44 |
-
FONT-SIZE : small;
|
45 |
-
}
|
46 |
-
body {
|
47 |
-
MARGIN-LEFT : 10px;
|
48 |
-
WIDTH : 750px;
|
49 |
-
}
|
50 |
-
a {
|
51 |
-
BACKGROUND-COLOR: inherit;
|
52 |
-
}
|
53 |
-
a.ref {
|
54 |
-
BACKGROUND-COLOR: inherit;
|
55 |
-
FONT-SIZE : 8pt;
|
56 |
-
LETTER-SPACING : 0.1em;
|
57 |
-
}
|
58 |
-
h1 {
|
59 |
-
BACKGROUND-COLOR: silver;
|
60 |
-
BORDER : thin solid black;
|
61 |
-
FONT-SIZE : x-large;
|
62 |
-
FONT-WEIGHT : bold;
|
63 |
-
DISPLAY : block;
|
64 |
-
}
|
65 |
-
h2 {
|
66 |
-
FONT-SIZE : large;
|
67 |
-
}
|
68 |
-
h3 {
|
69 |
-
FONT-SIZE : medium;
|
70 |
-
}
|
71 |
-
h4 {
|
72 |
-
FONT-SIZE : small;
|
73 |
-
FONT-WEIGHT : bold;
|
74 |
-
}
|
75 |
-
h5 {
|
76 |
-
FONT-SIZE : small;
|
77 |
-
FONT-WEIGHT : normal;
|
78 |
-
TEXT-DECORATION : underline;
|
79 |
-
}
|
80 |
-
table {
|
81 |
-
border-collapse : collapse;
|
82 |
-
width : 100%;
|
83 |
-
}
|
84 |
-
.bb {
|
85 |
-
BORDER-BOTTOM : gray dotted thin;
|
86 |
-
}
|
87 |
-
.blb {
|
88 |
-
BORDER-LEFT : gray dotted thin;
|
89 |
-
BORDER-BOTTOM : gray dotted thin;
|
90 |
-
TEXT-ALIGN : center;
|
91 |
-
}
|
92 |
-
.bl {
|
93 |
-
BORDER-LEFT : gray dotted thin;
|
94 |
-
}
|
95 |
-
.center {
|
96 |
-
TEXT-ALIGN : center;
|
97 |
-
}
|
98 |
-
p.comment {
|
99 |
-
FONT-FAMILY : monospace;
|
100 |
-
FONT-SIZE : 9pt;
|
101 |
-
FONT-WEIGHT : 500;
|
102 |
-
WHITE-SPACE : pre-wrap; /* css-3 */
|
103 |
-
WHITE-SPACE : -moz-pre-wrap; /* Mozilla, since 1999 */
|
104 |
-
WHITE-SPACE : -pre-wrap; /* Opera 4-6 */
|
105 |
-
WHITE-SPACE : -o-pre-wrap; /* Opera 7 */
|
106 |
-
WORD-WRAP : break-word; /* Internet Explorer 5.5+ */
|
107 |
-
}
|
108 |
-
span.comment {
|
109 |
-
BACKGROUND-COLOR: inherit;
|
110 |
-
FONT-FAMILY : Areal;
|
111 |
-
FONT-SIZE : 8pt;
|
112 |
-
LETTER-SPACING : 0.2em;
|
113 |
-
}
|
114 |
-
p.example {
|
115 |
-
BACKGROUND-COLOR: #DCDCDC;
|
116 |
-
font-family : monospace;
|
117 |
-
FONT-SIZE : 9pt;
|
118 |
-
LETTER-SPACING : 0.1em;
|
119 |
-
LINE-HEIGHT : 1.5em;
|
120 |
-
WHITE-SPACE : pre-wrap; /* css-3 */
|
121 |
-
WHITE-SPACE : -moz-pre-wrap; /* Mozilla, since 1999 */
|
122 |
-
WHITE-SPACE : -pre-wrap; /* Opera 4-6 */
|
123 |
-
WHITE-SPACE : -o-pre-wrap; /* Opera 7 */
|
124 |
-
WORD-WRAP : break-word; /* Internet Explorer 5.5+ */
|
125 |
-
}
|
126 |
-
p.format, span.format {
|
127 |
-
BORDER : gray dotted thin;
|
128 |
-
FONT-FAMILY : Helvetica;
|
129 |
-
FONT-SIZE : 9pt;
|
130 |
-
LETTER-SPACING : 0.2em;
|
131 |
-
LINE-HEIGHT : 2em;
|
132 |
-
WHITE-SPACE : pre-wrap; /* css-3 */
|
133 |
-
WHITE-SPACE : -moz-pre-wrap; /* Mozilla, since 1999 */
|
134 |
-
WHITE-SPACE : -pre-wrap; /* Opera 4-6 */
|
135 |
-
WHITE-SPACE : -o-pre-wrap; /* Opera 7 */
|
136 |
-
WORD-WRAP : break-word; /* Internet Explorer 5.5+ */
|
137 |
-
}
|
138 |
-
.header {
|
139 |
-
BACKGROUND-COLOR: silver;
|
140 |
-
BORDER : thin solid black;
|
141 |
-
FONT-SIZE : xx-large;
|
142 |
-
}
|
143 |
-
p.label {
|
144 |
-
FONT-FAMILY : Arial;
|
145 |
-
FONT-WEIGHT : bold;
|
146 |
-
LETTER-SPACING : 0.1em;
|
147 |
-
}
|
148 |
-
p.quotes {
|
149 |
-
BACKGROUND-COLOR: #F5F5F5;
|
150 |
-
FONT-FAMILY : Arial;
|
151 |
-
FONT-STYLE : italic;
|
152 |
-
LETTER-SPACING : 0.1em;
|
153 |
-
}
|
154 |
-
sup {
|
155 |
-
BACKGROUND-COLOR: transparent;
|
156 |
-
FONT-SIZE : x-small;
|
157 |
-
FONT-WEIGHT : bold;
|
158 |
-
VERTICAL-ALIGN : super;
|
159 |
-
}
|
160 |
-
.ref {
|
161 |
-
BACKGROUND-COLOR: transparent;
|
162 |
-
FONT-SIZE : 8pt;
|
163 |
-
LETTER-SPACING : 0.1em;
|
164 |
-
}
|
165 |
-
.top {
|
166 |
-
VERTICAL-ALIGN : top;
|
167 |
-
}
|
168 |
-
</style>
|
169 |
-
</head>
|
170 |
-
<body>
|
171 |
-
|
172 |
-
<h1>iCalcreator v2.24.2</h1>
|
173 |
-
<p>
|
174 |
-
iCalcreator v2.24.2<br>
|
175 |
-
Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved.<br>
|
176 |
-
<a href="http://kigkonsult.se/iCalcreator/index.php" title="kigkonsult.se/iCalcreator" target="_blank">kigkonsult.se iCalcreator</a><br>
|
177 |
-
<a href="http://kigkonsult.se/contact/index.php" title="kigkonsult.se contact" target="_blank">kigkonsult.se contact</a>
|
178 |
-
</p>
|
179 |
-
|
180 |
-
<h4>Preface</h2>
|
181 |
-
<p>
|
182 |
-
This document describes a <b>short summary</b> usage of iCalcreator, a <em>PHP</em> software implementation of standards rfc5545/rfc5546 (rfc2445/rfc2446) to manage iCal formatted files.
|
183 |
-
</p>
|
184 |
-
<p>
|
185 |
-
This document is provided by kigkonsult for informational purposes
|
186 |
-
and is provided on an "as is" basis without any warranties expressed or implied.
|
187 |
-
</p>
|
188 |
-
<p>
|
189 |
-
Information in this document is subject to change without notice and does
|
190 |
-
not represent a commitment on the part of kigkonsult.
|
191 |
-
The software described in this document is provided under a <a href="#Copyright_and_Licence">license agreement</a>.
|
192 |
-
The software may be used only in accordance with the terms of that <a href="#Copyright_and_Licence">license agreement</a>.
|
193 |
-
It is against the law to copy or use the software except as specifically allowed in the <a href="#Copyright_and_Licence">license agreement</a>.
|
194 |
-
</p>
|
195 |
-
<p>
|
196 |
-
It is the users responsibility to ensure the suitability of the software before using it.
|
197 |
-
In no circumstances will kigkonsult be responsible for
|
198 |
-
the use of the software's outcomes or results or any loss
|
199 |
-
or damage of data or programs as a result of using the software.
|
200 |
-
</p>
|
201 |
-
<p>
|
202 |
-
The use of the software implies acceptance of these terms and the <a href="#Copyright_and_Licence">license agreement</a>.
|
203 |
-
</p>
|
204 |
-
<p>
|
205 |
-
This document makes previous versions obsolete.
|
206 |
-
</p>
|
207 |
-
|
208 |
-
<h4>The software</h2>
|
209 |
-
<p>
|
210 |
-
iCalcreator is a <em>PHP</em> class package managing iCal files, supporting (non-)calendar
|
211 |
-
systems and applications to process and communicate calendar information like
|
212 |
-
events, agendas, tasks, reports, totos and journaling information.
|
213 |
-
</p>
|
214 |
-
<p>
|
215 |
-
For iCalcreator 2.24.2 version (and later), <em>PHP</em> version >= 5.4 is required.
|
216 |
-
</p>
|
217 |
-
|
218 |
-
<h4>iCal</h4>
|
219 |
-
<p>
|
220 |
-
A short iCal description is found at <a href="http://en.wikipedia.org/wiki/ICalendar#Core_object" title="iCalendar From Wikipedia, the free encyclopedia" target="_blank">Wikipedia</a>.
|
221 |
-
If You are not familiar with iCal, read this first!
|
222 |
-
</p>
|
223 |
-
<p>
|
224 |
-
The <strong>iCalendar</strong> format, <strong>iCal</strong>, are described in
|
225 |
-
</p>
|
226 |
-
<dl>
|
227 |
-
<dt><a href="http://kigkonsult.se/downloads/dl.php?f=rfc5545" title="Download RFC5545 in text format" target="_blank">rfc5545</a>
|
228 |
-
<dd>"Internet Calendaring and Scheduling Core Object Specification (<strong>iCalendar</strong>)"
|
229 |
-
<dt><a href="http://kigkonsult.se/downloads/dl.php?f=rfc5546" title="Download RFC5546 in text format" target="_blank">rfc5546</a>
|
230 |
-
<dd>"iCalendar Transport-Independent Interoperability Protocol (iTIP)"<br>Scheduling Events, BusyTime, To-dos and Journal Entries
|
231 |
-
<p class="quotes">. ..allows for the capture and exchange of information normally stored
|
232 |
-
within a calendaring and scheduling application.</p>
|
233 |
-
and
|
234 |
-
<p class="quotes">. ..is an exchange format between applications or systems.</p>
|
235 |
-
</dl>
|
236 |
-
<p><a href="http://kigkonsult.se/downloads/dl.php?f=rfc5545" title="Download RFC5545 in text format" target="_blank">rfc5545</a> and
|
237 |
-
<a href="http://kigkonsult.se/downloads/dl.php?f=rfc5546" title="Download RFC5546 in text format" target="_blank">rfc5546</a>
|
238 |
-
obsoletes, respectively,
|
239 |
-
<a href="http://kigkonsult.se/downloads/dl.php?f=rfc2445" title="Download RFC2445 in text format" target="_blank">rfc2445</a> and
|
240 |
-
<a href="http://kigkonsult.se/downloads/dl.php?f=rfc2446" title="Download RFC2446 in text format" target="_blank">rfc2446</a>.
|
241 |
-
</p>
|
242 |
-
|
243 |
-
<h4>xCal</h4>
|
244 |
-
<p>
|
245 |
-
iCalcreator also supports xCal (iCal xml),
|
246 |
-
<a href="http://kigkonsult.se/downloads/dl.php?f=rfc6321" title="Download RFC6321 in text format" target="_blank">rfc6321</a>,
|
247 |
-
The XML Format for <strong>iCalendar</strong>.
|
248 |
-
</p>
|
249 |
-
|
250 |
-
<h4>SUPPORT</h4>
|
251 |
-
<p>
|
252 |
-
For previous iCalcreator releases support upon (paid) request only.
|
253 |
-
</p>
|
254 |
-
<p>
|
255 |
-
Use the contact <a href="http://kigkonsult.se/contact/index.php" title="kigkonsult.se/contact" target="_blank">page</a>
|
256 |
-
for queries, improvement/development issues or professional support and development.
|
257 |
-
Please note that paid support or consulting service has the highest priority.
|
258 |
-
</p>
|
259 |
-
<p>
|
260 |
-
kigkonsult offer professional services for software support, design and new/re-development, customizations and adaptations
|
261 |
-
of <em>PHP</em>/<em>MySQL</em> solutions with focus on software lifecycle management, including long term utility, reliability and maintainability.
|
262 |
-
</p>
|
263 |
-
|
264 |
-
<h4>DONATE</h4>
|
265 |
-
<p>
|
266 |
-
You can show your appreciation for our free software,
|
267 |
-
and can support future development by making a donation to the kigkonsult GPL/LGPL projects.
|
268 |
-
</p>
|
269 |
-
<p>
|
270 |
-
Make a donation of any size by clicking <a href="http://kigkonsult.se/contact/index.php#Donate" title="Donate" target="_blank">here</a>.
|
271 |
-
Thanks in advance!
|
272 |
-
</p>
|
273 |
-
|
274 |
-
<h4>Contact</h4>
|
275 |
-
<p>
|
276 |
-
Use the <a href="http://kigkonsult.se/contact/index.php" title="kigkonsult.se/contact" target="_blank">contact page</a>
|
277 |
-
for queries, improvement/development issues or professional support and development.
|
278 |
-
Please note that paid support or consulting service has the highest priority.
|
279 |
-
</p>
|
280 |
-
|
281 |
-
<h4>Downloads and usage examples</h4>
|
282 |
-
<p>
|
283 |
-
At <a href="http://kigkonsult.se/iCalcreator/index.php" title="kigkonsult iCalcreator" target="_blank">kigkonsult.se</a> you can download the
|
284 |
-
<a href="http://kigkonsult.se/downloads/index.php#iCalcreator" title="iCalcreator complete manual" target="_blank">complete manual</a>
|
285 |
-
and review and explore iCalcreator usage at the
|
286 |
-
<a href="http://kigkonsult.se/test/index.php" title="kigkonsult.se iCalcreator implement and test examples" target="_blank">coding and test</a> pages.
|
287 |
-
</p>
|
288 |
-
|
289 |
-
<h4>INSTALL</h4>
|
290 |
-
<dl>
|
291 |
-
<dt>Composer (https://getcomposer.org/)
|
292 |
-
<dd>
|
293 |
-
<dd>composer require kigkonsult/iCalcreator
|
294 |
-
<dd>
|
295 |
-
<dt>or
|
296 |
-
<dd> include the (download) iCalcreator folder to your include-path<br>
|
297 |
-
<dd> or unpack to your application-(include)-folder
|
298 |
-
<dd>Add
|
299 |
-
<dd><span class="format">require_once "[path/]autoload.php";</span>
|
300 |
-
<dd>to your <em>PHP</em>-script.
|
301 |
-
<dd>The iCalcreator invoker has changed since previous version!
|
302 |
-
<dd>You may also need to set the default timezone.
|
303 |
-
</dl>
|
304 |
-
|
305 |
-
|
306 |
-
<h4>Notes</h4>
|
307 |
-
<p>
|
308 |
-
When creating a new calendar(/component) object instance, review config settings.
|
309 |
-
</p>
|
310 |
-
<p>
|
311 |
-
You will find a complete iCalcreator function list (ex. getProperty, deleteProperty) in
|
312 |
-
<a href="http://kigkonsult.se/downloads/index.php#iCalcreator" title="iCalcreator complete manual" target="_blank">iCalcreator manual</a>.
|
313 |
-
</p>
|
314 |
-
<p>
|
315 |
-
Note, to ease up usage, you will find convenient holders for component names,
|
316 |
-
properties, config keys etc in top of the "util" class file (src/util/util.php).
|
317 |
-
</p>
|
318 |
-
|
319 |
-
<h2>CREATE</h2>
|
320 |
-
|
321 |
-
<p class="example">
|
322 |
-
|
323 |
-
// <span class="comment">define time zone</span>
|
324 |
-
$tz = "Europe/Stockholm";
|
325 |
-
// <span class="comment">set Your unique id, </span>
|
326 |
-
// <span class="comment">required if any component UID is missing</span>
|
327 |
-
$config = array( kigkonsult\iCalcreator\util\util::$UNIQUE_ID => "kigkonsult.se",
|
328 |
-
// <span class="comment">opt. set "calendar" timezone</span>
|
329 |
-
kigkonsult\iCalcreator\util\util::$TZID => $tz );
|
330 |
-
// <span class="comment">create a new calendar object instance</span>
|
331 |
-
$calendar= new kigkonsult\iCalcreator\vcalendar( $config );
|
332 |
-
|
333 |
-
// <span class="comment">required of some calendar software</span>
|
334 |
-
$calendar->setProperty( kigkonsult\iCalcreator\util\util::$METHOD,
|
335 |
-
"PUBLISH" );
|
336 |
-
$calendar->setProperty( "x-wr-calname",
|
337 |
-
"Calendar Sample" );
|
338 |
-
$calendar->setProperty( "X-WR-CALDESC",
|
339 |
-
"Calendar Description" );
|
340 |
-
$calendar->setProperty( "X-WR-TIMEZONE",
|
341 |
-
$tz );
|
342 |
-
// <span class="comment">create an calendar event component</span>
|
343 |
-
$vevent = $calendar->newVevent();
|
344 |
-
// <span class="comment">set event start</span>
|
345 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$DTSTART,
|
346 |
-
array( "year" => 2017,
|
347 |
-
"month" => 4,
|
348 |
-
"day" => 1,
|
349 |
-
"hour" => 19,
|
350 |
-
"min" => 0,
|
351 |
-
"sec" => 0 ));
|
352 |
-
// <span class="comment">set event end</span>
|
353 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$DTEND,
|
354 |
-
array( "year" => 2017,
|
355 |
-
"month" => 4,
|
356 |
-
"day" => 1,
|
357 |
-
"hour" => 22,
|
358 |
-
"min" => 30,
|
359 |
-
"sec" => 0 ));
|
360 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$LOCATION,
|
361 |
-
"Central Placa" );
|
362 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$SUMMARY,
|
363 |
-
"PHP summit" );
|
364 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$DESCRIPTION,
|
365 |
-
"This is a description" );
|
366 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$COMMENT,
|
367 |
-
"This is a comment" );
|
368 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$ATTENDEE,
|
369 |
-
"attendee1@icaldomain.net" );
|
370 |
-
|
371 |
-
// <span class="comment">create an event alarm</span>
|
372 |
-
$valarm = $vevent->newValarm();
|
373 |
-
$valarm->setProperty( kigkonsult\iCalcreator\util\util::$ACTION,
|
374 |
-
"DISPLAY" );
|
375 |
-
// <span class="comment">reuse the event description</span>
|
376 |
-
$valarm->setProperty( kigkonsult\iCalcreator\util\util::$DESCRIPTION,
|
377 |
-
$vevent->getProperty(
|
378 |
-
kigkonsult\iCalcreator\util\util::$DESCRIPTION
|
379 |
-
)
|
380 |
-
);
|
381 |
-
// <span class="comment">a local date</span>
|
382 |
-
$d = sprintf( '%04d%02d%02d %02d%02d%02d', 2017, 3, 31, 15, 0, 0 );
|
383 |
-
// <span class="comment">create alarm trigger (in UTC datetime)</span>
|
384 |
-
kigkonsult\iCalcreator\timezoneHandler::transformDateTime( $d,
|
385 |
-
$tz,
|
386 |
-
"UTC",
|
387 |
-
"Ymd\THis\Z" );
|
388 |
-
$valarm->setProperty( kigkonsult\iCalcreator\util\util::$TRIGGER,
|
389 |
-
$d );
|
390 |
-
|
391 |
-
// <span class="comment">create another calendar event component</span>
|
392 |
-
$vevent = $calendar->newVevent();
|
393 |
-
// <span class="comment">alt. date format, here for an all-day event</span>
|
394 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$DTSTART,
|
395 |
-
"20170401",
|
396 |
-
array("VALUE" => "DATE"));
|
397 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$ORGANIZER,
|
398 |
-
"boss@icaldomain.com" );
|
399 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$SUMMARY,
|
400 |
-
"ALL-DAY event" );
|
401 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$DESCRIPTION,
|
402 |
-
"This is a description for an all-day event" );
|
403 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$RESOURCES,
|
404 |
-
"Full attension" );
|
405 |
-
// <span class="comment">weekly, four occasions</span>
|
406 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$RRULE,
|
407 |
-
array( "FREQ" => "WEEKLY",
|
408 |
-
"count" => 4));
|
409 |
-
// <span class="comment">supporting parse of strict rfc5545 formatted text</span>
|
410 |
-
$vevent->parse( "LOCATION:1CP Conference Room 4350" );
|
411 |
-
|
412 |
-
// <span class="comment">all calendar components are described in <a href="http://kigkonsult.se/downloads/dl.php?f=rfc5545" title="RFC5545" target="_blank">rfc5545</a></span>
|
413 |
-
// <span class="comment">a complete iCalcreator function list (ex. setProperty) in <a href="http://kigkonsult.se/downloads/index.php#iCalcreator" title="iCalcreator complete manual" target="_blank">iCalcreator manual</a></span>
|
414 |
-
|
415 |
-
// <span class="comment">create timezone component(-s)</span>
|
416 |
-
// <span class="comment">based on all start dates in events (i.e. all dtstarts)</span>
|
417 |
-
// <span class="comment">X-LIC-LOCATION required of some calendar software</span>
|
418 |
-
$xprops = array( "X-LIC-LOCATION" => $tz );
|
419 |
-
kigkonsult\iCalcreator\timezoneHandler::createTimezone( $v,
|
420 |
-
$tz,
|
421 |
-
$xprops );
|
422 |
-
|
423 |
-
</p>
|
424 |
-
|
425 |
-
<h2>PARSE</h2>
|
426 |
-
<h4>iCal, rfc5545 / rfc2445 </h4>
|
427 |
-
<p>How to create iCalcreator object instance</p>
|
428 |
-
<p class="example">
|
429 |
-
|
430 |
-
// <span class="comment">set Your unique id, </span>
|
431 |
-
// <span class="comment">required if any component UID is missing</span>
|
432 |
-
$config = array( kigkonsult\iCalcreator\util\util::$UNIQUE_ID => "kigkonsult.se" );
|
433 |
-
|
434 |
-
// <span class="comment">create a new calendar object instance</span>
|
435 |
-
$calendar= new kigkonsult\iCalcreator\vcalendar( $config );
|
436 |
-
|
437 |
-
</p>
|
438 |
-
<p>and then parse a local iCal file</p>
|
439 |
-
<p class="example">
|
440 |
-
|
441 |
-
// <span class="comment">set directory and file name</span>
|
442 |
-
$config = array( kigkonsult\iCalcreator\util\util::$DIRECTORY => "calendars",
|
443 |
-
kigkonsult\iCalcreator\util\util::$FILENAME => "file.ics" );
|
444 |
-
$calendar->setConfig( $config );
|
445 |
-
$calendar->parse();
|
446 |
-
// <span class="comment">continue process (edit, parse, select) $calendar</span>
|
447 |
-
|
448 |
-
</p>
|
449 |
-
|
450 |
-
<p>or parse a remote iCal file (resource)</p>
|
451 |
-
<p class="example">
|
452 |
-
|
453 |
-
// <span class="comment">support parse of remote files</span>
|
454 |
-
$calendar->setConfig( kigkonsult\iCalcreator\util\util::$URL,
|
455 |
-
"http://www.aDomain.net/file.ics" );
|
456 |
-
$calendar->parse();
|
457 |
-
|
458 |
-
// <span class="comment">ensure start date order</span>
|
459 |
-
// <span class="comment">(opt., NOT required after parse)</span>
|
460 |
-
$calendar->sort();
|
461 |
-
|
462 |
-
// <span class="comment">continue process (edit, parse, select) $calendar</span>
|
463 |
-
|
464 |
-
</p>
|
465 |
-
<dl>
|
466 |
-
<dt>On error
|
467 |
-
<dd>the setConfig method returns FALSE (ex. unvalid directory/filename).
|
468 |
-
<dd>the parse method returns FALSE.
|
469 |
-
</dl>
|
470 |
-
|
471 |
-
<h4>xCal, rfc6321 (XML)</h4>
|
472 |
-
<p>
|
473 |
-
How to convert (file) XML resource to an iCalcreator object instance.
|
474 |
-
</p>
|
475 |
-
<p class="example">
|
476 |
-
|
477 |
-
// <span class="comment">set Your unique id, </span>
|
478 |
-
// <span class="comment">required if any component UID is missing</span>
|
479 |
-
$config = array( kigkonsult\iCalcreator\util\util::$UNIQUE_ID => "kigkonsult.se" );
|
480 |
-
|
481 |
-
// <span class="comment">use a local xCal file</span>
|
482 |
-
$filename = "xmlfile.xml";
|
483 |
-
// <span class="comment"> or a remote xCal resource</span>
|
484 |
-
/* $filename = 'http://kigkonsult.se/xcal.php?a=1&b=2&c=3'; */
|
485 |
-
if( ! ( $calendar = kigkonsult\iCalcreator\iCalXML::XMLfile2iCal( $filename, $config )))
|
486 |
-
exit( "Error when parsing $filename" );
|
487 |
-
|
488 |
-
// <span class="comment">continue process (edit, parse, select) $calendar</span>
|
489 |
-
|
490 |
-
</p>
|
491 |
-
|
492 |
-
|
493 |
-
<h2>EDIT</h2>
|
494 |
-
<p class="example">
|
495 |
-
|
496 |
-
// <span class="comment">create a new calendar object instance</span>
|
497 |
-
$config = array( kigkonsult\iCalcreator\util\util::$UNIQUE_ID => "kigkonsult.se" );
|
498 |
-
$calendar = new kigkonsult\iCalcreator\vcalendar( $config );
|
499 |
-
|
500 |
-
// <span class="comment">parse a calendar file</span>
|
501 |
-
$config = array( kigkonsult\iCalcreator\util\util::$DIRECTORY => "calendars",
|
502 |
-
kigkonsult\iCalcreator\util\util::$FILENAME => "file.ics" );
|
503 |
-
$calendar->setConfig( $config );
|
504 |
-
$calendar->parse();
|
505 |
-
// <span class="comment">required of some calendar software</span>
|
506 |
-
$calendar->setProperty( kigkonsult\iCalcreator\util\util::$METHOD,
|
507 |
-
"PUBLISH" );
|
508 |
-
$calendar->setProperty( "x-wr-calname",
|
509 |
-
"Calendar Sample" );
|
510 |
-
$calendar->setProperty( "X-WR-CALDESC",
|
511 |
-
"Calendar Description" );
|
512 |
-
$calendar->setProperty( "X-WR-TIMEZONE",
|
513 |
-
"Europe/Stockholm" );
|
514 |
-
|
515 |
-
// <span class="comment">read events, one by one</span>
|
516 |
-
while( $vevent = $calendar->getComponent( kigkonsult\iCalcreator\util\util::$LCVEVENT )) {
|
517 |
-
|
518 |
-
// <span class="comment">uid (unique id/key for component), required, one occurrence </span>
|
519 |
-
$uid = $vevent->getProperty( kigkonsult\iCalcreator\util\util::$UID );
|
520 |
-
|
521 |
-
// <span class="comment">dtstart required, one occurrence</span>
|
522 |
-
$dtstart = $vevent->getProperty( kigkonsult\iCalcreator\util\util::$DTSTART );
|
523 |
-
|
524 |
-
// <span class="comment">opt. description</span>
|
525 |
-
if( $description = $vevent->getProperty( kigkonsult\iCalcreator\util\util::$DESCRIPTION,
|
526 |
-
1 )) {
|
527 |
-
|
528 |
-
// <span class="comment">edit the description</span>
|
529 |
-
|
530 |
-
// <span class="comment">update/replace the description</span>
|
531 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$DESCRIPTION, $description, FALSE, 1 );
|
532 |
-
}
|
533 |
-
|
534 |
-
// <span class="comment">optional comments</span>
|
535 |
-
while( $comment = $vevent->getProperty( kigkonsult\iCalcreator\util\util::$COMMENT )) {
|
536 |
-
.. .
|
537 |
-
}
|
538 |
-
|
539 |
-
// <span class="comment">remove all ATTENDEE properties .. .</span>
|
540 |
-
while( $vevent->deleteProperty( kigkonsult\iCalcreator\util\util::$ATTENDEE ))
|
541 |
-
continue;
|
542 |
-
|
543 |
-
// <span class="comment">update/replace event in calendar</span>
|
544 |
-
// <span class="comment"> with UID as key</span>
|
545 |
-
$calendar->setComponent ( $vevent, $uid );
|
546 |
-
}
|
547 |
-
|
548 |
-
</p>
|
549 |
-
<br>
|
550 |
-
<br>
|
551 |
-
|
552 |
-
<h2>SELECT</h2>
|
553 |
-
<p>
|
554 |
-
(setup)
|
555 |
-
</p>
|
556 |
-
<p class="example">
|
557 |
-
|
558 |
-
// <span class="comment">create a new calendar object instance</span>
|
559 |
-
$config = array( kigkonsult\iCalcreator\util\util::$UNIQUE_ID => "kigkonsult.se" );
|
560 |
-
$calendar = new kigkonsult\iCalcreator\vcalendar( $config );
|
561 |
-
|
562 |
-
// <span class="comment">iCalcreator also support remote files</span>
|
563 |
-
$calendar->setConfig( kigkonsult\iCalcreator\util\util::$URL,
|
564 |
-
"http://www.aDomain.net/file.ics" );
|
565 |
-
$calendar->parse();
|
566 |
-
|
567 |
-
// <span class="comment">required of some calendar software</span>
|
568 |
-
$calendar->setProperty( kigkonsult\iCalcreator\util\util::$METHOD,
|
569 |
-
"PUBLISH" );
|
570 |
-
$calendar->setProperty( "x-wr-calname",
|
571 |
-
"Calendar Sample" );
|
572 |
-
$calendar->setProperty( "X-WR-CALDESC",
|
573 |
-
"Calendar Description" );
|
574 |
-
$calendar->setProperty( "X-WR-TIMEZONE",
|
575 |
-
"Europe/Stockholm" );
|
576 |
-
|
577 |
-
</p>
|
578 |
-
<h4>Ex. calendar date based select</h4>
|
579 |
-
<p class="example">
|
580 |
-
|
581 |
-
// <span class="comment">select components occurring today</span>
|
582 |
-
// <span class="comment">(including components with recurrence pattern)</span>
|
583 |
-
$eventArray = $calendar->selectComponents();
|
584 |
-
foreach( $eventArray as $year => $yearArray) {
|
585 |
-
foreach( $yearArray as $month => $monthArray ) {
|
586 |
-
foreach( $monthArray as $day => $dailyEventsArray ) {
|
587 |
-
foreach( $dailyEventsArray as $vevent ) {
|
588 |
-
|
589 |
-
// <span class="comment">if event is a member of a recurrence set</span>
|
590 |
-
// <span class="comment">returns array( </span>
|
591 |
-
// <span class="comment"> "x-current-dtstart"</span>
|
592 |
-
// <span class="comment"> , (string) date(</span>
|
593 |
-
// <span class="comment"> "Y-m-d [H:i:s][timezone/UTC offset]"))</span>
|
594 |
-
$currddate = $event->getProperty(
|
595 |
-
kigkonsult\iCalcreator\util\util::$X_CURRENT_DTSTART
|
596 |
-
);
|
597 |
-
|
598 |
-
// <span class="comment">orig. dtstart</span>
|
599 |
-
$dtstart = $vevent->getProperty( kigkonsult\iCalcreator\util\util::$DTSTART );
|
600 |
-
$summary = $vevent->getProperty( kigkonsult\iCalcreator\util\util::$SUMMARY );
|
601 |
-
$description = $vevent->getProperty( kigkonsult\iCalcreator\util\util::$DESCRIPTION );
|
602 |
-
.. .
|
603 |
-
.. .
|
604 |
-
}
|
605 |
-
}
|
606 |
-
}
|
607 |
-
}
|
608 |
-
|
609 |
-
</p>
|
610 |
-
<h4>Ex. calendar select specific property values</h4>
|
611 |
-
<p class="example">
|
612 |
-
|
613 |
-
// <span class="comment">fetch specific property from calendar perspective</span>
|
614 |
-
// <span class="comment">(unique) values and occurrences : </span>
|
615 |
-
// <span class="comment">ATTENDEE, CATEGORIES, CONTACT,</span>
|
616 |
-
// <span class="comment">DTSTART, LOCATION, ORGANIZER,</span>
|
617 |
-
// <span class="comment">PRIORITY, RESOURCES, STATUS,</span>
|
618 |
-
// <span class="comment">SUMMARY, UID, URL,</span>
|
619 |
-
// <span class="comment">GEOLOCATION<sup>*</sup></span>
|
620 |
-
$valueOccur = $calendar->getProperty( kigkonsult\iCalcreator\util\util::$RESOURCES );
|
621 |
-
foreach( $valueOccur as $uniqueValue => $occurCnt ) {
|
622 |
-
|
623 |
-
echo "The RESOURCES value <b>$uniqueValue</b> occurs <b>$occurCnt</b> times<br />";
|
624 |
-
|
625 |
-
}
|
626 |
-
|
627 |
-
</p>
|
628 |
-
<p>
|
629 |
-
<sup>*</sup>) Using the non-standard directive "GEOLOCATION", iCalcreator returns output supporting
|
630 |
-
ISO6709 "Standard representation of geographic point location by coordinates",
|
631 |
-
by combining the "LOCATION" and "GEO" property values (only if "GEO" is set).
|
632 |
-
</p>
|
633 |
-
<h4>Ex. select calendar components based on specific property value</h4>
|
634 |
-
<p class="example">
|
635 |
-
|
636 |
-
// <span class="comment">selects components</span>
|
637 |
-
// <span class="comment">based on specific property value(-s)</span>
|
638 |
-
// <span class="comment">ATTENDEE, CATEGORIES, CONTACT,</span>
|
639 |
-
// <span class="comment">LOCATION, ORGANIZER,</span>
|
640 |
-
// <span class="comment">PRIORITY, RESOURCES, STATUS,</span>
|
641 |
-
// <span class="comment">SUMMARY, URL, UID</span>
|
642 |
-
$selectSpec = array( kigkonsult\iCalcreator\util\util::$CATEGORIES => "course1" );
|
643 |
-
$specComps = $calendar->selectComponents( $selectSpec );
|
644 |
-
foreach( $specComps as $comp ) {
|
645 |
-
.. .
|
646 |
-
}
|
647 |
-
|
648 |
-
</p>
|
649 |
-
<br>
|
650 |
-
<br>
|
651 |
-
|
652 |
-
<h2>OUTPUT</h2>
|
653 |
-
<p>(setup)</p>
|
654 |
-
<p class="example">
|
655 |
-
|
656 |
-
// <span class="comment">create a new calendar object instance</span>
|
657 |
-
$config = array( kigkonsult\iCalcreator\util\util::$UNIQUE_ID => "kigkonsult.se" );
|
658 |
-
$calendar= new kigkonsult\iCalcreator\vcalendar( $config );
|
659 |
-
|
660 |
-
// <span class="comment">required of some calendar software</span>
|
661 |
-
$calendar->setProperty( kigkonsult\iCalcreator\util\util::$METHOD,
|
662 |
-
"PUBLISH" );
|
663 |
-
$calendar->setProperty( "x-wr-calname",
|
664 |
-
"Calendar Sample" );
|
665 |
-
$calendar->setProperty( "X-WR-CALDESC",
|
666 |
-
"Calendar Description" );
|
667 |
-
$calendar->setProperty( "X-WR-TIMEZONE",
|
668 |
-
"Europe/Stockholm" );
|
669 |
-
|
670 |
-
// <span class="comment">continue process (edit, parse, select) $calendar</span>
|
671 |
-
|
672 |
-
</p>
|
673 |
-
<h5>opt 1</h5>
|
674 |
-
<p>
|
675 |
-
Redirect calendar file to browser.
|
676 |
-
</p>
|
677 |
-
<p class="example">
|
678 |
-
|
679 |
-
$calendar->returnCalendar();
|
680 |
-
exit;
|
681 |
-
|
682 |
-
</p>
|
683 |
-
|
684 |
-
<h5>opt 2</h5>
|
685 |
-
<p>
|
686 |
-
Save calendar to file.
|
687 |
-
</p>
|
688 |
-
<p class="example">
|
689 |
-
|
690 |
-
// <span class="comment">set output directory and file name</span>
|
691 |
-
$config = array( kigkonsult\iCalcreator\util\util::$DIRECTORY => "depot",
|
692 |
-
kigkonsult\iCalcreator\util\util::$FILENAME => "calendar.ics" );
|
693 |
-
$calendar->setConfig( $config );
|
694 |
-
$calendar->saveCalendar();
|
695 |
-
|
696 |
-
</p>
|
697 |
-
|
698 |
-
<h5>opt 3, xCal</h5>
|
699 |
-
<p>
|
700 |
-
Create well-formed XML, rfc6321 (as string).
|
701 |
-
</p>
|
702 |
-
<p class="example">
|
703 |
-
|
704 |
-
$xmlstr = kigkonsult\iCalcreator\iCalXML::iCal2XML( $calendar);
|
705 |
-
|
706 |
-
</p>
|
707 |
-
|
708 |
-
<h5>opt 4, json</h5>
|
709 |
-
<p>
|
710 |
-
Create a json string.
|
711 |
-
</p>
|
712 |
-
<p class="example">
|
713 |
-
$xmlstr = kigkonsult\iCalcreator\iCalXML::iCal2XML( $calendar);
|
714 |
-
$json = json_encode( simplexml_load_string( $xmlstr ));
|
715 |
-
|
716 |
-
</p>
|
717 |
-
|
718 |
-
|
719 |
-
<br>
|
720 |
-
<br>
|
721 |
-
|
722 |
-
|
723 |
-
<a name="Copyright_and_Licence"></a>
|
724 |
-
<h2>COPYRIGHT AND LICENSE</h2>
|
725 |
-
|
726 |
-
<table>
|
727 |
-
<tr><td>Copyright<td>(c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
728 |
-
<tr><td>Link <td>http://kigkonsult.se/iCalcreator/index.php
|
729 |
-
<tr><td>Package <td>iCalcreator
|
730 |
-
<tr><td>Version <td>2.24.2
|
731 |
-
<tr><td class="top">License <td>
|
732 |
-
Subject matter of licence is the software iCalcreator.<br>
|
733 |
-
The above copyright, link, package and version notices,
|
734 |
-
this licence notice and the [rfc5545] PRODID as implemented and
|
735 |
-
invoked in iCalcreator shall be included in all copies or
|
736 |
-
substantial portions of the iCalcreator.<br>
|
737 |
-
iCalcreator can be used either under the terms of
|
738 |
-
a proprietary license, available at <a href="https://kigkonsult.se/"><https://kigkonsult.se/></a><br>
|
739 |
-
or the GNU Affero General Public License, version 3:<br>
|
740 |
-
iCalcreator is free software: you can redistribute it and/or
|
741 |
-
modify it under the terms of the GNU Affero General Public License
|
742 |
-
as published by the Free Software Foundation, either version 3 of
|
743 |
-
the License, or (at your option) any later version.<br>
|
744 |
-
iCalcreator is distributed in the hope that it will be useful,
|
745 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
746 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
747 |
-
GNU Affero General Public License for more details.<br>
|
748 |
-
You should have received a copy of the GNU Affero General Public
|
749 |
-
License along with this program.
|
750 |
-
If not, see <a href="http://www.gnu.org/licenses/"><http://www.gnu.org/licenses/></a>.
|
751 |
-
</table>
|
752 |
-
<br>
|
753 |
-
<br>
|
754 |
-
</body>
|
755 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/releaseNotes-2.24.2
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
|
2 |
-
iCalcreator 2.24.2 releaseNotes
|
3 |
-
|
4 |
-
Bug fixed and updates:
|
5 |
-
|
6 |
-
PHP 7.2 adaptations
|
7 |
-
utilSelect: Modified recurrence summary is lost
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/calendarComponent.php
DELETED
@@ -1,1398 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
use kigkonsult\iCalcreator\util\utilGeo;
|
34 |
-
/**
|
35 |
-
* Parent class for calendar components
|
36 |
-
*
|
37 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
38 |
-
* @since 2.2.11 - 2015-03-31
|
39 |
-
*/
|
40 |
-
class calendarComponent extends iCalBase {
|
41 |
-
/**
|
42 |
-
* @var string component type
|
43 |
-
*/
|
44 |
-
public $objName = null;
|
45 |
-
/**
|
46 |
-
* @var int component number
|
47 |
-
*/
|
48 |
-
public $cno = 0;
|
49 |
-
/**
|
50 |
-
* Constructor for calendar component object
|
51 |
-
*
|
52 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
53 |
-
* @since 2.20.23 - 2017-02-21
|
54 |
-
*/
|
55 |
-
public function __construct() {
|
56 |
-
static $BS = '\\';
|
57 |
-
if( isset( $this->timezonetype ))
|
58 |
-
$this->objName = $this->timezonetype;
|
59 |
-
else {
|
60 |
-
$className = get_called_class();
|
61 |
-
$this->objName = substr( $className, strrpos( $className, $BS ) + 1 );
|
62 |
-
}
|
63 |
-
if( in_array( $this->objName, util::$VCOMPS ))
|
64 |
-
$this->dtstamp = util::makeDtstamp();
|
65 |
-
}
|
66 |
-
/**
|
67 |
-
* Return unique instance number
|
68 |
-
*
|
69 |
-
* @return int
|
70 |
-
*/
|
71 |
-
protected static function getObjectNo() {
|
72 |
-
static $objectNo = 0;
|
73 |
-
return ++$objectNo;
|
74 |
-
}
|
75 |
-
/**
|
76 |
-
* Delete component property value
|
77 |
-
*
|
78 |
-
* Return false at successfull removal of non-multiple property
|
79 |
-
* Return false at successfull removal of last multiple property part
|
80 |
-
* otherwise true (there is more to remove)
|
81 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
82 |
-
* @since 2.8.8 - 2011-03-15
|
83 |
-
* @param mixed $propName bool false => X-property
|
84 |
-
* @param int $propix specific property in case of multiply occurences
|
85 |
-
* @return bool
|
86 |
-
*/
|
87 |
-
public function deleteProperty( $propName=null, $propix=null ) {
|
88 |
-
if( $this->notExistProp( $propName ))
|
89 |
-
return false;
|
90 |
-
$propName = strtoupper( $propName );
|
91 |
-
if( in_array( $propName, util::$MPROPS2 )) {
|
92 |
-
if( is_null( $propix ))
|
93 |
-
$propix = ( isset( $this->propdelix[$propName] ) &&
|
94 |
-
( util::$X_PROP != $propName ))
|
95 |
-
? $this->propdelix[$propName] + 2 : 1;
|
96 |
-
$this->propdelix[$propName] = --$propix;
|
97 |
-
}
|
98 |
-
switch( $propName ) {
|
99 |
-
case util::$ACTION:
|
100 |
-
$this->action = null;
|
101 |
-
return false;
|
102 |
-
break;
|
103 |
-
case util::$ATTACH:
|
104 |
-
return util::deletePropertyM( $this->attach,
|
105 |
-
$this->propdelix[$propName] );
|
106 |
-
break;
|
107 |
-
case util::$ATTENDEE:
|
108 |
-
return util::deletePropertyM( $this->attendee,
|
109 |
-
$this->propdelix[$propName] );
|
110 |
-
break;
|
111 |
-
case util::$CATEGORIES:
|
112 |
-
return util::deletePropertyM( $this->categories,
|
113 |
-
$this->propdelix[$propName] );
|
114 |
-
break;
|
115 |
-
case util::$CLASS:
|
116 |
-
$this->class = null;
|
117 |
-
return false;
|
118 |
-
break;
|
119 |
-
case util::$COMMENT:
|
120 |
-
return util::deletePropertyM( $this->comment,
|
121 |
-
$this->propdelix[$propName] );
|
122 |
-
break;
|
123 |
-
case util::$COMPLETED:
|
124 |
-
$this->completed = null;
|
125 |
-
return false;
|
126 |
-
break;
|
127 |
-
case util::$CONTACT:
|
128 |
-
return util::deletePropertyM( $this->contact,
|
129 |
-
$this->propdelix[$propName] );
|
130 |
-
break;
|
131 |
-
case util::$CREATED:
|
132 |
-
$this->created = null;
|
133 |
-
return false;
|
134 |
-
break;
|
135 |
-
case util::$DESCRIPTION:
|
136 |
-
return util::deletePropertyM( $this->description,
|
137 |
-
$this->propdelix[$propName] );
|
138 |
-
break;
|
139 |
-
case util::$DTEND:
|
140 |
-
$this->dtend = null;
|
141 |
-
return false;
|
142 |
-
break;
|
143 |
-
case util::$DTSTAMP:
|
144 |
-
if( in_array( $this->objName, util::$LCSUBCOMPS ))
|
145 |
-
return false;
|
146 |
-
$this->dtstamp = null;
|
147 |
-
return false;
|
148 |
-
break;
|
149 |
-
case util::$DTSTART:
|
150 |
-
$this->dtstart = null;
|
151 |
-
return false;
|
152 |
-
break;
|
153 |
-
case util::$DUE:
|
154 |
-
$this->due = null;
|
155 |
-
return false;
|
156 |
-
break;
|
157 |
-
case util::$DURATION:
|
158 |
-
$this->duration = null;
|
159 |
-
return false;
|
160 |
-
break;
|
161 |
-
case util::$EXDATE:
|
162 |
-
return util::deletePropertyM( $this->exdate,
|
163 |
-
$this->propdelix[$propName] );
|
164 |
-
break;
|
165 |
-
case util::$EXRULE:
|
166 |
-
return util::deletePropertyM( $this->exrule,
|
167 |
-
$this->propdelix[$propName] );
|
168 |
-
break;
|
169 |
-
case util::$FREEBUSY:
|
170 |
-
return util::deletePropertyM( $this->freebusy,
|
171 |
-
$this->propdelix[$propName] );
|
172 |
-
break;
|
173 |
-
case util::$GEO:
|
174 |
-
$this->geo = null;
|
175 |
-
return false;
|
176 |
-
break;
|
177 |
-
case util::$LAST_MODIFIED:
|
178 |
-
$this->lastmodified = null;
|
179 |
-
return false;
|
180 |
-
break;
|
181 |
-
case util::$LOCATION:
|
182 |
-
$this->location = null;
|
183 |
-
return false;
|
184 |
-
break;
|
185 |
-
case util::$ORGANIZER:
|
186 |
-
$this->organizer = null;
|
187 |
-
return false;
|
188 |
-
break;
|
189 |
-
case util::$PERCENT_COMPLETE:
|
190 |
-
$this->percentcomplete = null;
|
191 |
-
return false;
|
192 |
-
break;
|
193 |
-
case util::$PRIORITY:
|
194 |
-
$this->priority = null;
|
195 |
-
return false;
|
196 |
-
break;
|
197 |
-
case util::$RDATE:
|
198 |
-
return util::deletePropertyM( $this->rdate,
|
199 |
-
$this->propdelix[$propName] );
|
200 |
-
break;
|
201 |
-
case util::$RECURRENCE_ID:
|
202 |
-
$this->recurrenceid = null;
|
203 |
-
return false;
|
204 |
-
break;
|
205 |
-
case util::$RELATED_TO:
|
206 |
-
return util::deletePropertyM( $this->relatedto,
|
207 |
-
$this->propdelix[$propName] );
|
208 |
-
break;
|
209 |
-
case util::$REPEAT:
|
210 |
-
$this->repeat = null;
|
211 |
-
return false;
|
212 |
-
break;
|
213 |
-
case util::$REQUEST_STATUS:
|
214 |
-
return util::deletePropertyM( $this->requeststatus,
|
215 |
-
$this->propdelix[$propName] );
|
216 |
-
break;
|
217 |
-
case util::$RESOURCES:
|
218 |
-
return util::deletePropertyM( $this->resources,
|
219 |
-
$this->propdelix[$propName] );
|
220 |
-
break;
|
221 |
-
case util::$RRULE:
|
222 |
-
return util::deletePropertyM( $this->rrule,
|
223 |
-
$this->propdelix[$propName] );
|
224 |
-
break;
|
225 |
-
case util::$SEQUENCE:
|
226 |
-
$this->sequence = null;
|
227 |
-
return false;
|
228 |
-
break;
|
229 |
-
case util::$STATUS:
|
230 |
-
$this->status = null;
|
231 |
-
return false;
|
232 |
-
break;
|
233 |
-
case util::$SUMMARY:
|
234 |
-
$this->summary = null;
|
235 |
-
return false;
|
236 |
-
break;
|
237 |
-
case util::$TRANSP:
|
238 |
-
$this->transp = null;
|
239 |
-
return false;
|
240 |
-
break;
|
241 |
-
case util::$TRIGGER:
|
242 |
-
$this->trigger = null;
|
243 |
-
return false;
|
244 |
-
break;
|
245 |
-
case util::$TZID:
|
246 |
-
$this->tzid = null;
|
247 |
-
return false;
|
248 |
-
break;
|
249 |
-
case util::$TZNAME:
|
250 |
-
return util::deletePropertyM( $this->tzname,
|
251 |
-
$this->propdelix[$propName] );
|
252 |
-
break;
|
253 |
-
case util::$TZOFFSETFROM:
|
254 |
-
$this->tzoffsetfrom = null;
|
255 |
-
return false;
|
256 |
-
break;
|
257 |
-
case util::$TZOFFSETTO:
|
258 |
-
$this->tzoffsetto = null;
|
259 |
-
return false;
|
260 |
-
break;
|
261 |
-
case util::$TZURL:
|
262 |
-
$this->tzurl = null;
|
263 |
-
return false;
|
264 |
-
break;
|
265 |
-
case util::$UID:
|
266 |
-
if( in_array( $this->objName, util::$LCSUBCOMPS ))
|
267 |
-
return false;
|
268 |
-
$this->uid = null;
|
269 |
-
return false;
|
270 |
-
break;
|
271 |
-
case util::$URL:
|
272 |
-
$this->url = null;
|
273 |
-
return false;
|
274 |
-
break;
|
275 |
-
default:
|
276 |
-
return parent::deleteXproperty( $propName,
|
277 |
-
$this->xprop,
|
278 |
-
$propix,
|
279 |
-
$this->propdelix );
|
280 |
-
}
|
281 |
-
return true;
|
282 |
-
}
|
283 |
-
/**
|
284 |
-
* Return true if property NOT exists within component
|
285 |
-
*
|
286 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
287 |
-
* @since 2.5.1 - 2008-10-15
|
288 |
-
* @param string $propName
|
289 |
-
* @return bool
|
290 |
-
*/
|
291 |
-
public function notExistProp( $propName ) {
|
292 |
-
static $LASTMODIFIED = 'lastmodified';
|
293 |
-
static $PERCENTCOMPLETE = 'percentcomplete';
|
294 |
-
static $RECURRENCEID = 'recurrenceid';
|
295 |
-
static $RELATEDTO = 'relatedto';
|
296 |
-
static $REQUESTSTATUS = 'requeststatus';
|
297 |
-
if( empty( $propName ))
|
298 |
-
return false; // when deleting x-prop, an empty propName may be used=allowed
|
299 |
-
switch( strtoupper( $propName )) {
|
300 |
-
case util::$LAST_MODIFIED :
|
301 |
-
if( ! property_exists( $this, $LASTMODIFIED ))
|
302 |
-
return true;
|
303 |
-
break;
|
304 |
-
case util::$PERCENT_COMPLETE :
|
305 |
-
if( ! property_exists( $this, $PERCENTCOMPLETE ))
|
306 |
-
return true;
|
307 |
-
break;
|
308 |
-
case util::$RECURRENCE_ID :
|
309 |
-
if( ! property_exists( $this, $RECURRENCEID ))
|
310 |
-
return true;
|
311 |
-
break;
|
312 |
-
case util::$RELATED_TO :
|
313 |
-
if( ! property_exists( $this, $RELATEDTO ))
|
314 |
-
return true;
|
315 |
-
break;
|
316 |
-
case util::$REQUEST_STATUS :
|
317 |
-
if( ! property_exists( $this, $REQUESTSTATUS ))
|
318 |
-
return true;
|
319 |
-
break;
|
320 |
-
default :
|
321 |
-
if( ! util::isXprefixed( $propName ) &&
|
322 |
-
! property_exists( $this, strtolower( $propName )))
|
323 |
-
return true;
|
324 |
-
break;
|
325 |
-
}
|
326 |
-
return false;
|
327 |
-
}
|
328 |
-
/**
|
329 |
-
* Return component property value/params
|
330 |
-
*
|
331 |
-
* Return array with keys VALUE/PARAMS rf arg $inclParam is true
|
332 |
-
* If property has multiply values, consequtive function calls are needed
|
333 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
334 |
-
* @since 2.21.13 - 2015-03-29
|
335 |
-
* @param string $propName
|
336 |
-
* @param int $propix specific property in case of multiply occurences
|
337 |
-
* @param bool $inclParam
|
338 |
-
* @param bool $specform
|
339 |
-
* @return mixed
|
340 |
-
*/
|
341 |
-
public function getProperty( $propName=null,
|
342 |
-
$propix=null,
|
343 |
-
$inclParam=false,
|
344 |
-
$specform=false ) {
|
345 |
-
if( 0 == strcasecmp( util::$GEOLOCATION, $propName )) {
|
346 |
-
if( false === ( $geo = $this->getProperty( util::$GEO )))
|
347 |
-
return false;
|
348 |
-
$loc = $this->getProperty( util::$LOCATION );
|
349 |
-
$content = ( empty( $loc )) ? null : $loc . util::$SP1;
|
350 |
-
return $content .
|
351 |
-
utilGeo::geo2str2( $geo[utilGeo::$LATITUDE],
|
352 |
-
utilGeo::$geoLatFmt ) .
|
353 |
-
utilGeo::geo2str2( $geo[utilGeo::$LONGITUDE],
|
354 |
-
utilGeo::$geoLongFmt ) . util::$L;
|
355 |
-
}
|
356 |
-
if( $this->notExistProp( $propName ))
|
357 |
-
return false;
|
358 |
-
$propName = ( $propName ) ? strtoupper( $propName ) : util::$X_PROP;
|
359 |
-
if( in_array( $propName, util::$MPROPS2 )) {
|
360 |
-
if( empty( $propix ))
|
361 |
-
$propix = ( isset( $this->propix[$propName] ))
|
362 |
-
? $this->propix[$propName] + 2 : 1;
|
363 |
-
$this->propix[$propName] = --$propix;
|
364 |
-
}
|
365 |
-
switch( $propName ) {
|
366 |
-
case util::$ATTACH:
|
367 |
-
util::recountMvalPropix( $this->attach, $propix );
|
368 |
-
$this->propix[$propName] = $propix;
|
369 |
-
if( ! isset( $this->attach[$propix] )) {
|
370 |
-
unset( $this->propix[$propName] );
|
371 |
-
return false;
|
372 |
-
}
|
373 |
-
return ( $inclParam ) ? $this->attach[$propix]
|
374 |
-
: $this->attach[$propix][util::$LCvalue];
|
375 |
-
break;
|
376 |
-
case util::$ATTENDEE:
|
377 |
-
util::recountMvalPropix( $this->attendee, $propix );
|
378 |
-
$this->propix[$propName] = $propix;
|
379 |
-
if( ! isset( $this->attendee[$propix] )) {
|
380 |
-
unset( $this->propix[$propName] );
|
381 |
-
return false;
|
382 |
-
}
|
383 |
-
return ( $inclParam ) ? $this->attendee[$propix]
|
384 |
-
: $this->attendee[$propix][util::$LCvalue];
|
385 |
-
break;
|
386 |
-
case util::$CATEGORIES:
|
387 |
-
util::recountMvalPropix( $this->categories, $propix );
|
388 |
-
$this->propix[$propName] = $propix;
|
389 |
-
if( ! isset( $this->categories[$propix] )) {
|
390 |
-
unset( $this->propix[$propName] );
|
391 |
-
return false;
|
392 |
-
}
|
393 |
-
return ( $inclParam ) ? $this->categories[$propix]
|
394 |
-
: $this->categories[$propix][util::$LCvalue];
|
395 |
-
break;
|
396 |
-
case util::$CLASS:
|
397 |
-
if( isset( $this->class[util::$LCvalue] ))
|
398 |
-
return ( $inclParam ) ? $this->class
|
399 |
-
: $this->class[util::$LCvalue];
|
400 |
-
break;
|
401 |
-
case util::$COMMENT:
|
402 |
-
util::recountMvalPropix( $this->comment, $propix );
|
403 |
-
$this->propix[$propName] = $propix;
|
404 |
-
if( ! isset( $this->comment[$propix] )) {
|
405 |
-
unset( $this->propix[$propName] );
|
406 |
-
return false;
|
407 |
-
}
|
408 |
-
return ( $inclParam ) ? $this->comment[$propix]
|
409 |
-
: $this->comment[$propix][util::$LCvalue];
|
410 |
-
break;
|
411 |
-
case util::$COMPLETED:
|
412 |
-
if( isset( $this->completed[util::$LCvalue] ))
|
413 |
-
return ( $inclParam ) ? $this->completed
|
414 |
-
: $this->completed[util::$LCvalue];
|
415 |
-
break;
|
416 |
-
case util::$CONTACT:
|
417 |
-
util::recountMvalPropix( $this->contact, $propix );
|
418 |
-
$this->propix[$propName] = $propix;
|
419 |
-
if( ! isset( $this->contact[$propix] )) {
|
420 |
-
unset( $this->propix[$propName] );
|
421 |
-
return false;
|
422 |
-
}
|
423 |
-
return ( $inclParam ) ? $this->contact[$propix]
|
424 |
-
: $this->contact[$propix][util::$LCvalue];
|
425 |
-
break;
|
426 |
-
case util::$CREATED:
|
427 |
-
if( isset( $this->created[util::$LCvalue] ))
|
428 |
-
return ( $inclParam ) ? $this->created
|
429 |
-
: $this->created[util::$LCvalue];
|
430 |
-
break;
|
431 |
-
case util::$DESCRIPTION:
|
432 |
-
util::recountMvalPropix( $this->description, $propix );
|
433 |
-
$this->propix[$propName] = $propix;
|
434 |
-
if( ! isset( $this->description[$propix] )) {
|
435 |
-
unset( $this->propix[$propName] );
|
436 |
-
return false;
|
437 |
-
}
|
438 |
-
return ( $inclParam ) ? $this->description[$propix]
|
439 |
-
: $this->description[$propix][util::$LCvalue];
|
440 |
-
break;
|
441 |
-
case util::$DTEND:
|
442 |
-
if( isset( $this->dtend[util::$LCvalue] ))
|
443 |
-
return ( $inclParam ) ? $this->dtend
|
444 |
-
: $this->dtend[util::$LCvalue];
|
445 |
-
break;
|
446 |
-
case util::$DTSTAMP:
|
447 |
-
if( in_array( $this->objName, util::$LCSUBCOMPS ))
|
448 |
-
return false;
|
449 |
-
if( ! isset( $this->dtstamp[util::$LCvalue] ))
|
450 |
-
$this->dtstamp = util::makeDtstamp();
|
451 |
-
return ( $inclParam ) ? $this->dtstamp
|
452 |
-
: $this->dtstamp[util::$LCvalue];
|
453 |
-
break;
|
454 |
-
case util::$DTSTART:
|
455 |
-
if( isset( $this->dtstart[util::$LCvalue] ))
|
456 |
-
return ( $inclParam ) ? $this->dtstart
|
457 |
-
: $this->dtstart[util::$LCvalue];
|
458 |
-
break;
|
459 |
-
case util::$DUE:
|
460 |
-
if( isset( $this->due[util::$LCvalue] ))
|
461 |
-
return ( $inclParam ) ? $this->due
|
462 |
-
: $this->due[util::$LCvalue];
|
463 |
-
break;
|
464 |
-
case util::$DURATION:
|
465 |
-
if( ! isset( $this->duration[util::$LCvalue] ))
|
466 |
-
return false;
|
467 |
-
$value = ( $specform &&
|
468 |
-
isset( $this->dtstart[util::$LCvalue] ) &&
|
469 |
-
isset( $this->duration[util::$LCvalue] ))
|
470 |
-
? util::duration2date( $this->dtstart[util::$LCvalue], $this->duration[util::$LCvalue] )
|
471 |
-
: $this->duration[util::$LCvalue];
|
472 |
-
$params = ( $specform &&
|
473 |
-
$inclParam &&
|
474 |
-
isset( $this->dtstart[util::$LCparams][util::$TZID] ))
|
475 |
-
? array_merge((array) $this->duration[util::$LCparams], $this->dtstart[util::$LCparams] )
|
476 |
-
: $this->duration[util::$LCparams];
|
477 |
-
return ( $inclParam ) ? [util::$LCvalue => $value,
|
478 |
-
util::$LCparams => $params]
|
479 |
-
: $value;
|
480 |
-
break;
|
481 |
-
case util::$EXDATE:
|
482 |
-
util::recountMvalPropix( $this->exdate, $propix );
|
483 |
-
$this->propix[$propName] = $propix;
|
484 |
-
if( ! isset( $this->exdate[$propix] )) {
|
485 |
-
unset( $this->propix[$propName] );
|
486 |
-
return false;
|
487 |
-
}
|
488 |
-
return ( $inclParam ) ? $this->exdate[$propix]
|
489 |
-
: $this->exdate[$propix][util::$LCvalue];
|
490 |
-
break;
|
491 |
-
case util::$EXRULE:
|
492 |
-
util::recountMvalPropix( $this->exrule, $propix );
|
493 |
-
$this->propix[$propName] = $propix;
|
494 |
-
if( ! isset( $this->exrule[$propix] )) {
|
495 |
-
unset( $this->propix[$propName] );
|
496 |
-
return false;
|
497 |
-
}
|
498 |
-
return ( $inclParam ) ? $this->exrule[$propix]
|
499 |
-
: $this->exrule[$propix][util::$LCvalue];
|
500 |
-
break;
|
501 |
-
case util::$FREEBUSY:
|
502 |
-
util::recountMvalPropix( $this->freebusy, $propix );
|
503 |
-
$this->propix[$propName] = $propix;
|
504 |
-
if( ! isset( $this->freebusy[$propix] )) {
|
505 |
-
unset( $this->propix[$propName] );
|
506 |
-
return false;
|
507 |
-
}
|
508 |
-
return ( $inclParam ) ? $this->freebusy[$propix]
|
509 |
-
: $this->freebusy[$propix][util::$LCvalue];
|
510 |
-
break;
|
511 |
-
case util::$GEO:
|
512 |
-
if( isset( $this->geo[util::$LCvalue] ))
|
513 |
-
return ( $inclParam ) ? $this->geo
|
514 |
-
: $this->geo[util::$LCvalue];
|
515 |
-
break;
|
516 |
-
case util::$LAST_MODIFIED:
|
517 |
-
if( isset( $this->lastmodified[util::$LCvalue] ))
|
518 |
-
return ( $inclParam ) ? $this->lastmodified
|
519 |
-
: $this->lastmodified[util::$LCvalue];
|
520 |
-
break;
|
521 |
-
case util::$LOCATION:
|
522 |
-
if( isset( $this->location[util::$LCvalue] ))
|
523 |
-
return ( $inclParam ) ? $this->location
|
524 |
-
: $this->location[util::$LCvalue];
|
525 |
-
break;
|
526 |
-
case util::$ORGANIZER:
|
527 |
-
if( isset( $this->organizer[util::$LCvalue] ))
|
528 |
-
return ( $inclParam ) ? $this->organizer
|
529 |
-
: $this->organizer[util::$LCvalue];
|
530 |
-
break;
|
531 |
-
case util::$PERCENT_COMPLETE:
|
532 |
-
if( isset( $this->percentcomplete[util::$LCvalue] ))
|
533 |
-
return ( $inclParam ) ? $this->percentcomplete
|
534 |
-
: $this->percentcomplete[util::$LCvalue];
|
535 |
-
break;
|
536 |
-
case util::$PRIORITY:
|
537 |
-
if( isset( $this->priority[util::$LCvalue] ))
|
538 |
-
return ( $inclParam ) ? $this->priority
|
539 |
-
: $this->priority[util::$LCvalue];
|
540 |
-
break;
|
541 |
-
case util::$RDATE:
|
542 |
-
util::recountMvalPropix( $this->rdate, $propix );
|
543 |
-
$this->propix[$propName] = $propix;
|
544 |
-
if( ! isset( $this->rdate[$propix] )) {
|
545 |
-
unset( $this->propix[$propName] );
|
546 |
-
return false;
|
547 |
-
}
|
548 |
-
return ( $inclParam ) ? $this->rdate[$propix]
|
549 |
-
: $this->rdate[$propix][util::$LCvalue];
|
550 |
-
break;
|
551 |
-
case util::$RECURRENCE_ID:
|
552 |
-
if( isset( $this->recurrenceid[util::$LCvalue] ))
|
553 |
-
return ( $inclParam ) ? $this->recurrenceid
|
554 |
-
: $this->recurrenceid[util::$LCvalue];
|
555 |
-
break;
|
556 |
-
case util::$RELATED_TO:
|
557 |
-
util::recountMvalPropix( $this->relatedto, $propix );
|
558 |
-
$this->propix[$propName] = $propix;
|
559 |
-
if( ! isset( $this->relatedto[$propix] )) {
|
560 |
-
unset( $this->propix[$propName] );
|
561 |
-
return false;
|
562 |
-
}
|
563 |
-
return ( $inclParam ) ? $this->relatedto[$propix]
|
564 |
-
: $this->relatedto[$propix][util::$LCvalue];
|
565 |
-
break;
|
566 |
-
case util::$REQUEST_STATUS:
|
567 |
-
util::recountMvalPropix( $this->requeststatus, $propix );
|
568 |
-
$this->propix[$propName] = $propix;
|
569 |
-
if( ! isset( $this->requeststatus[$propix] )) {
|
570 |
-
unset( $this->propix[$propName] );
|
571 |
-
return false;
|
572 |
-
}
|
573 |
-
return ( $inclParam ) ? $this->requeststatus[$propix]
|
574 |
-
: $this->requeststatus[$propix][util::$LCvalue];
|
575 |
-
break;
|
576 |
-
case util::$RESOURCES:
|
577 |
-
util::recountMvalPropix( $this->resources, $propix );
|
578 |
-
$this->propix[$propName] = $propix;
|
579 |
-
if( ! isset( $this->resources[$propix] )) {
|
580 |
-
unset( $this->propix[$propName] );
|
581 |
-
return false;
|
582 |
-
}
|
583 |
-
return ( $inclParam ) ? $this->resources[$propix]
|
584 |
-
: $this->resources[$propix][util::$LCvalue];
|
585 |
-
break;
|
586 |
-
case util::$RRULE:
|
587 |
-
util::recountMvalPropix( $this->rrule, $propix );
|
588 |
-
$this->propix[$propName] = $propix;
|
589 |
-
if( ! isset( $this->rrule[$propix] )) {
|
590 |
-
unset( $this->propix[$propName] );
|
591 |
-
return false;
|
592 |
-
}
|
593 |
-
return ( $inclParam ) ? $this->rrule[$propix]
|
594 |
-
: $this->rrule[$propix][util::$LCvalue];
|
595 |
-
break;
|
596 |
-
case util::$SEQUENCE:
|
597 |
-
if( isset( $this->sequence[util::$LCvalue] ))
|
598 |
-
return ( $inclParam ) ? $this->sequence
|
599 |
-
: $this->sequence[util::$LCvalue];
|
600 |
-
break;
|
601 |
-
case util::$STATUS:
|
602 |
-
if( isset( $this->status[util::$LCvalue] ))
|
603 |
-
return ( $inclParam ) ? $this->status
|
604 |
-
: $this->status[util::$LCvalue];
|
605 |
-
break;
|
606 |
-
case util::$SUMMARY:
|
607 |
-
if( isset( $this->summary[util::$LCvalue] ))
|
608 |
-
return ( $inclParam ) ? $this->summary
|
609 |
-
: $this->summary[util::$LCvalue];
|
610 |
-
break;
|
611 |
-
case util::$TRANSP:
|
612 |
-
if( isset( $this->transp[util::$LCvalue] ))
|
613 |
-
return ( $inclParam ) ? $this->transp
|
614 |
-
: $this->transp[util::$LCvalue];
|
615 |
-
break;
|
616 |
-
case util::$TZNAME:
|
617 |
-
util::recountMvalPropix( $this->tzname, $propix );
|
618 |
-
$this->propix[$propName] = $propix;
|
619 |
-
if( ! isset( $this->tzname[$propix] )) {
|
620 |
-
unset( $this->propix[$propName] );
|
621 |
-
return false;
|
622 |
-
}
|
623 |
-
return ( $inclParam ) ? $this->tzname[$propix]
|
624 |
-
: $this->tzname[$propix][util::$LCvalue];
|
625 |
-
break;
|
626 |
-
case util::$UID:
|
627 |
-
if( in_array( $this->objName, util::$LCSUBCOMPS ))
|
628 |
-
return false;
|
629 |
-
if( empty( $this->uid ))
|
630 |
-
$this->uid = util::makeUid( $this->getConfig( util::$UNIQUE_ID ));
|
631 |
-
return ( $inclParam ) ? $this->uid
|
632 |
-
: $this->uid[util::$LCvalue];
|
633 |
-
break;
|
634 |
-
case util::$URL:
|
635 |
-
if( isset( $this->url[util::$LCvalue] ))
|
636 |
-
return ( $inclParam ) ? $this->url : $this->url[util::$LCvalue];
|
637 |
-
break;
|
638 |
-
default:
|
639 |
-
if( $propName != util::$X_PROP ) {
|
640 |
-
if( ! isset( $this->xprop[$propName] ))
|
641 |
-
return false;
|
642 |
-
return ( $inclParam ) ? [$propName,
|
643 |
-
$this->xprop[$propName]]
|
644 |
-
: [$propName,
|
645 |
-
$this->xprop[$propName][util::$LCvalue]];
|
646 |
-
}
|
647 |
-
else {
|
648 |
-
if( empty( $this->xprop ))
|
649 |
-
return false;
|
650 |
-
$xpropno = 0;
|
651 |
-
foreach( $this->xprop as $xpropkey => $xpropvalue ) {
|
652 |
-
if( $propix == $xpropno )
|
653 |
-
return ( $inclParam ) ? [$xpropkey,
|
654 |
-
$this->xprop[$xpropkey]]
|
655 |
-
: [$xpropkey,
|
656 |
-
$this->xprop[$xpropkey][util::$LCvalue]];
|
657 |
-
else
|
658 |
-
$xpropno++;
|
659 |
-
}
|
660 |
-
return false; // not found ??
|
661 |
-
}
|
662 |
-
}
|
663 |
-
return false;
|
664 |
-
}
|
665 |
-
/**
|
666 |
-
* Returns calendar property unique values
|
667 |
-
*
|
668 |
-
* For ATTENDEE, CATEGORIES, CONTACT, RELATED_TO or RESOURCES (keys)
|
669 |
-
* and for each, number of occurrence (values)
|
670 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
671 |
-
* @since 2.21.11 - 2015-03-21
|
672 |
-
* @param string $propName
|
673 |
-
* @param array $output incremented result array
|
674 |
-
* @return array
|
675 |
-
*/
|
676 |
-
public function getProperties( $propName, & $output ) {
|
677 |
-
if( empty( $output ))
|
678 |
-
$output = [];
|
679 |
-
if( ! in_array( strtoupper( $propName ), util::$MPROPS1 ))
|
680 |
-
return $output;
|
681 |
-
while( false !== ( $content = $this->getProperty( $propName ))) {
|
682 |
-
if( empty( $content ))
|
683 |
-
continue;
|
684 |
-
if( is_array( $content )) {
|
685 |
-
foreach( $content as $part ) {
|
686 |
-
if( false !== strpos( $part, util::$COMMA )) {
|
687 |
-
$part = explode( util::$COMMA, $part );
|
688 |
-
foreach( $part as $thePart ) {
|
689 |
-
$thePart = trim( $thePart );
|
690 |
-
if( ! empty( $thePart )) {
|
691 |
-
if( ! isset( $output[$thePart] ))
|
692 |
-
$output[$thePart] = 1;
|
693 |
-
else
|
694 |
-
$output[$thePart] += 1;
|
695 |
-
}
|
696 |
-
}
|
697 |
-
}
|
698 |
-
else {
|
699 |
-
$part = trim( $part );
|
700 |
-
if( ! isset( $output[$part] ))
|
701 |
-
$output[$part] = 1;
|
702 |
-
else
|
703 |
-
$output[$part] += 1;
|
704 |
-
}
|
705 |
-
}
|
706 |
-
} // end if( is_array( $content ))
|
707 |
-
elseif( false !== strpos( $content, util::$COMMA )) {
|
708 |
-
$content = explode( util::$COMMA, $content );
|
709 |
-
foreach( $content as $thePart ) {
|
710 |
-
$thePart = trim( $thePart );
|
711 |
-
if( ! empty( $thePart )) {
|
712 |
-
if( ! isset( $output[$thePart] ))
|
713 |
-
$output[$thePart] = 1;
|
714 |
-
else
|
715 |
-
$output[$thePart] += 1;
|
716 |
-
}
|
717 |
-
}
|
718 |
-
} // end elseif( false !== strpos( $content, util::$COMMA ))
|
719 |
-
else {
|
720 |
-
$content = trim( $content );
|
721 |
-
if( ! empty( $content )) {
|
722 |
-
if( ! isset( $output[$content] ))
|
723 |
-
$output[$content] = 1;
|
724 |
-
else
|
725 |
-
$output[$content] += 1;
|
726 |
-
}
|
727 |
-
}
|
728 |
-
}
|
729 |
-
ksort( $output );
|
730 |
-
}
|
731 |
-
/**
|
732 |
-
* General component setProperty method
|
733 |
-
*
|
734 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
735 |
-
* @since 2.5.1 - 2008-11-05
|
736 |
-
* @param mixed $args variable number of function arguments,
|
737 |
-
* first argument is ALWAYS component name,
|
738 |
-
* second ALWAYS component value!
|
739 |
-
* @return bool
|
740 |
-
*/
|
741 |
-
public function setProperty() {
|
742 |
-
$numargs = func_num_args();
|
743 |
-
if( 1 > $numargs ) return false;
|
744 |
-
$arglist = func_get_args();
|
745 |
-
if( $this->notExistProp( $arglist[0] ))
|
746 |
-
return false;
|
747 |
-
if( ! $this->getConfig( util::$ALLOWEMPTY ) &&
|
748 |
-
( ! isset( $arglist[1] ) || empty( $arglist[1] )))
|
749 |
-
return false;
|
750 |
-
$arglist[0] = strtoupper( $arglist[0] );
|
751 |
-
for( $argix=$numargs; $argix < 12; $argix++ ) {
|
752 |
-
if( ! isset( $arglist[$argix] ))
|
753 |
-
$arglist[$argix] = null;
|
754 |
-
}
|
755 |
-
switch( $arglist[0] ) {
|
756 |
-
case util::$ACTION:
|
757 |
-
return $this->setAction( $arglist[1],
|
758 |
-
$arglist[2] );
|
759 |
-
case util::$ATTACH:
|
760 |
-
return $this->setAttach( $arglist[1],
|
761 |
-
$arglist[2],
|
762 |
-
$arglist[3] );
|
763 |
-
case util::$ATTENDEE:
|
764 |
-
return $this->setAttendee( $arglist[1],
|
765 |
-
$arglist[2],
|
766 |
-
$arglist[3] );
|
767 |
-
case util::$CATEGORIES:
|
768 |
-
return $this->setCategories( $arglist[1],
|
769 |
-
$arglist[2],
|
770 |
-
$arglist[3] );
|
771 |
-
case util::$CLASS:
|
772 |
-
return $this->setClass( $arglist[1],
|
773 |
-
$arglist[2] );
|
774 |
-
case util::$COMMENT:
|
775 |
-
return $this->setComment( $arglist[1],
|
776 |
-
$arglist[2],
|
777 |
-
$arglist[3] );
|
778 |
-
case util::$COMPLETED:
|
779 |
-
return $this->setCompleted( $arglist[1],
|
780 |
-
$arglist[2],
|
781 |
-
$arglist[3],
|
782 |
-
$arglist[4],
|
783 |
-
$arglist[5],
|
784 |
-
$arglist[6],
|
785 |
-
$arglist[7] );
|
786 |
-
case util::$CONTACT:
|
787 |
-
return $this->setContact( $arglist[1],
|
788 |
-
$arglist[2],
|
789 |
-
$arglist[3] );
|
790 |
-
case util::$CREATED:
|
791 |
-
return $this->setCreated( $arglist[1],
|
792 |
-
$arglist[2],
|
793 |
-
$arglist[3],
|
794 |
-
$arglist[4],
|
795 |
-
$arglist[5],
|
796 |
-
$arglist[6],
|
797 |
-
$arglist[7] );
|
798 |
-
case util::$DESCRIPTION:
|
799 |
-
return $this->setDescription( $arglist[1],
|
800 |
-
$arglist[2],
|
801 |
-
$arglist[3] );
|
802 |
-
case util::$DTEND:
|
803 |
-
return $this->setDtend( $arglist[1],
|
804 |
-
$arglist[2],
|
805 |
-
$arglist[3],
|
806 |
-
$arglist[4],
|
807 |
-
$arglist[5],
|
808 |
-
$arglist[6],
|
809 |
-
$arglist[7],
|
810 |
-
$arglist[8] );
|
811 |
-
case util::$DTSTAMP:
|
812 |
-
return $this->setDtstamp( $arglist[1],
|
813 |
-
$arglist[2],
|
814 |
-
$arglist[3],
|
815 |
-
$arglist[4],
|
816 |
-
$arglist[5],
|
817 |
-
$arglist[6],
|
818 |
-
$arglist[7] );
|
819 |
-
case util::$DTSTART:
|
820 |
-
return $this->setDtstart( $arglist[1],
|
821 |
-
$arglist[2],
|
822 |
-
$arglist[3],
|
823 |
-
$arglist[4],
|
824 |
-
$arglist[5],
|
825 |
-
$arglist[6],
|
826 |
-
$arglist[7],
|
827 |
-
$arglist[8] );
|
828 |
-
case util::$DUE:
|
829 |
-
return $this->setDue( $arglist[1],
|
830 |
-
$arglist[2],
|
831 |
-
$arglist[3],
|
832 |
-
$arglist[4],
|
833 |
-
$arglist[5],
|
834 |
-
$arglist[6],
|
835 |
-
$arglist[7],
|
836 |
-
$arglist[8] );
|
837 |
-
case util::$DURATION:
|
838 |
-
return $this->setDuration( $arglist[1],
|
839 |
-
$arglist[2],
|
840 |
-
$arglist[3],
|
841 |
-
$arglist[4],
|
842 |
-
$arglist[5],
|
843 |
-
$arglist[6] );
|
844 |
-
case util::$EXDATE:
|
845 |
-
return $this->setExdate( $arglist[1],
|
846 |
-
$arglist[2],
|
847 |
-
$arglist[3] );
|
848 |
-
case util::$EXRULE:
|
849 |
-
return $this->setExrule( $arglist[1],
|
850 |
-
$arglist[2],
|
851 |
-
$arglist[3] );
|
852 |
-
case util::$FREEBUSY:
|
853 |
-
return $this->setFreebusy( $arglist[1],
|
854 |
-
$arglist[2],
|
855 |
-
$arglist[3],
|
856 |
-
$arglist[4] );
|
857 |
-
case util::$GEO:
|
858 |
-
return $this->setGeo( $arglist[1],
|
859 |
-
$arglist[2],
|
860 |
-
$arglist[3] );
|
861 |
-
case util::$LAST_MODIFIED:
|
862 |
-
return $this->setLastModified( $arglist[1],
|
863 |
-
$arglist[2],
|
864 |
-
$arglist[3],
|
865 |
-
$arglist[4],
|
866 |
-
$arglist[5],
|
867 |
-
$arglist[6],
|
868 |
-
$arglist[7] );
|
869 |
-
case util::$LOCATION:
|
870 |
-
return $this->setLocation( $arglist[1],
|
871 |
-
$arglist[2] );
|
872 |
-
case util::$ORGANIZER:
|
873 |
-
return $this->setOrganizer( $arglist[1],
|
874 |
-
$arglist[2] );
|
875 |
-
case util::$PERCENT_COMPLETE:
|
876 |
-
return $this->setPercentComplete( $arglist[1],
|
877 |
-
$arglist[2] );
|
878 |
-
case util::$PRIORITY:
|
879 |
-
return $this->setPriority( $arglist[1],
|
880 |
-
$arglist[2] );
|
881 |
-
case util::$RDATE:
|
882 |
-
return $this->setRdate( $arglist[1],
|
883 |
-
$arglist[2],
|
884 |
-
$arglist[3] );
|
885 |
-
case util::$RECURRENCE_ID:
|
886 |
-
return $this->setRecurrenceid( $arglist[1],
|
887 |
-
$arglist[2],
|
888 |
-
$arglist[3],
|
889 |
-
$arglist[4],
|
890 |
-
$arglist[5],
|
891 |
-
$arglist[6],
|
892 |
-
$arglist[7],
|
893 |
-
$arglist[8] );
|
894 |
-
case util::$RELATED_TO:
|
895 |
-
return $this->setRelatedTo( $arglist[1],
|
896 |
-
$arglist[2],
|
897 |
-
$arglist[3] );
|
898 |
-
case util::$REPEAT:
|
899 |
-
return $this->setRepeat( $arglist[1],
|
900 |
-
$arglist[2] );
|
901 |
-
case util::$REQUEST_STATUS:
|
902 |
-
return $this->setRequestStatus( $arglist[1],
|
903 |
-
$arglist[2],
|
904 |
-
$arglist[3],
|
905 |
-
$arglist[4],
|
906 |
-
$arglist[5] );
|
907 |
-
case util::$RESOURCES:
|
908 |
-
return $this->setResources( $arglist[1],
|
909 |
-
$arglist[2],
|
910 |
-
$arglist[3] );
|
911 |
-
case util::$RRULE:
|
912 |
-
return $this->setRrule( $arglist[1],
|
913 |
-
$arglist[2],
|
914 |
-
$arglist[3] );
|
915 |
-
case util::$SEQUENCE:
|
916 |
-
return $this->setSequence( $arglist[1],
|
917 |
-
$arglist[2] );
|
918 |
-
case util::$STATUS:
|
919 |
-
return $this->setStatus( $arglist[1],
|
920 |
-
$arglist[2] );
|
921 |
-
case util::$SUMMARY:
|
922 |
-
return $this->setSummary( $arglist[1],
|
923 |
-
$arglist[2] );
|
924 |
-
case util::$TRANSP:
|
925 |
-
return $this->setTransp( $arglist[1],
|
926 |
-
$arglist[2] );
|
927 |
-
case util::$TRIGGER:
|
928 |
-
return $this->setTrigger( $arglist[1],
|
929 |
-
$arglist[2],
|
930 |
-
$arglist[3],
|
931 |
-
$arglist[4],
|
932 |
-
$arglist[5],
|
933 |
-
$arglist[6],
|
934 |
-
$arglist[7],
|
935 |
-
$arglist[8],
|
936 |
-
$arglist[9],
|
937 |
-
$arglist[10],
|
938 |
-
$arglist[11] );
|
939 |
-
case util::$TZID:
|
940 |
-
return $this->setTzid( $arglist[1],
|
941 |
-
$arglist[2] );
|
942 |
-
case util::$TZNAME:
|
943 |
-
return $this->setTzname( $arglist[1],
|
944 |
-
$arglist[2],
|
945 |
-
$arglist[3] );
|
946 |
-
case util::$TZOFFSETFROM:
|
947 |
-
return $this->setTzoffsetfrom( $arglist[1],
|
948 |
-
$arglist[2] );
|
949 |
-
case util::$TZOFFSETTO:
|
950 |
-
return $this->setTzoffsetto( $arglist[1],
|
951 |
-
$arglist[2] );
|
952 |
-
case util::$TZURL:
|
953 |
-
return $this->setTzurl( $arglist[1],
|
954 |
-
$arglist[2] );
|
955 |
-
case util::$UID:
|
956 |
-
return $this->setUid( $arglist[1],
|
957 |
-
$arglist[2] );
|
958 |
-
case util::$URL:
|
959 |
-
return $this->setUrl( $arglist[1],
|
960 |
-
$arglist[2] );
|
961 |
-
default:
|
962 |
-
return $this->setXprop( $arglist[0],
|
963 |
-
$arglist[1],
|
964 |
-
$arglist[2] );
|
965 |
-
}
|
966 |
-
return false;
|
967 |
-
}
|
968 |
-
/**
|
969 |
-
* Parse data into component properties
|
970 |
-
*
|
971 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
972 |
-
* @since 2.23.5 - 2017-04-14
|
973 |
-
* @param mixed $unparsedtext strict rfc2445 formatted, single property string or array of strings
|
974 |
-
* @return bool false if error occurs during parsing
|
975 |
-
*/
|
976 |
-
public function parse( $unparsedtext=null ) {
|
977 |
-
static $NLCHARS = '\n';
|
978 |
-
static $BEGIN = 'BEGIN:';
|
979 |
-
static $ENDALARM = 'END:VALARM';
|
980 |
-
static $ENDDAYLIGHT = 'END:DAYLIGHT';
|
981 |
-
static $ENDSTANDARD = 'END:STANDARD';
|
982 |
-
static $END = 'END:';
|
983 |
-
static $BEGINVALARM = 'BEGIN:VALARM';
|
984 |
-
static $BEGINSTANDARD = 'BEGIN:STANDARD';
|
985 |
-
static $BEGINDAYLIGHT = 'BEGIN:DAYLIGHT';
|
986 |
-
static $TEXTPROPS = ['CATEGORIES',
|
987 |
-
'COMMENT',
|
988 |
-
'DESCRIPTION',
|
989 |
-
'SUMMARY'];
|
990 |
-
static $X_ = 'X-';
|
991 |
-
static $DBBS = "\\";
|
992 |
-
static $SS = '/';
|
993 |
-
static $EQ = '=';
|
994 |
-
if( ! empty( $unparsedtext )) {
|
995 |
-
$arrParse = false;
|
996 |
-
if( is_array( $unparsedtext )) {
|
997 |
-
$unparsedtext = implode( $NLCHARS . util::$CRLF, $unparsedtext );
|
998 |
-
$arrParse = true;
|
999 |
-
}
|
1000 |
-
$rows = util::convEolChar( $unparsedtext );
|
1001 |
-
if( $arrParse ) {
|
1002 |
-
foreach( $rows as $lix => $row )
|
1003 |
-
$rows[$lix] = util::trimTrailNL( $row );
|
1004 |
-
}
|
1005 |
-
}
|
1006 |
-
elseif( ! isset( $this->unparsed ))
|
1007 |
-
$rows = [];
|
1008 |
-
else
|
1009 |
-
$rows = $this->unparsed;
|
1010 |
-
/* skip leading (empty/invalid) lines */
|
1011 |
-
foreach( $rows as $lix => $row ) {
|
1012 |
-
if( false !== ( $pos = stripos( $row, $BEGIN ))) {
|
1013 |
-
$rows[$lix] = substr( $row, $pos );
|
1014 |
-
break;
|
1015 |
-
}
|
1016 |
-
$tst = trim( $row );
|
1017 |
-
if(( $NLCHARS == $tst ) || empty( $tst ))
|
1018 |
-
unset( $rows[$lix] );
|
1019 |
-
}
|
1020 |
-
$this->unparsed = [];
|
1021 |
-
$comp = $this;
|
1022 |
-
$config = $this->getConfig();
|
1023 |
-
$compSync = $subSync = 0;
|
1024 |
-
foreach( $rows as $lix => $row ) {
|
1025 |
-
switch( true ) {
|
1026 |
-
case ( 0 == strcasecmp( $ENDALARM, substr( $row, 0, 10 ))) :
|
1027 |
-
if( 1 != $subSync )
|
1028 |
-
return false;
|
1029 |
-
$this->components[] = $comp;
|
1030 |
-
$subSync--;
|
1031 |
-
break;
|
1032 |
-
case ( 0 == strcasecmp( $ENDDAYLIGHT, substr( $row, 0, 12 ))) :
|
1033 |
-
if( 1 != $subSync )
|
1034 |
-
return false;
|
1035 |
-
$this->components[] = $comp;
|
1036 |
-
$subSync--;
|
1037 |
-
break;
|
1038 |
-
case ( 0 == strcasecmp( $ENDSTANDARD, substr( $row, 0, 12 ))) :
|
1039 |
-
if( 1 != $subSync )
|
1040 |
-
return false;
|
1041 |
-
array_unshift( $this->components, $comp);
|
1042 |
-
$subSync--;
|
1043 |
-
break;
|
1044 |
-
case ( 0 == strcasecmp( $END, substr( $row, 0, 4 ))) :
|
1045 |
-
if( 1 != $compSync ) // end:<component>
|
1046 |
-
return false;
|
1047 |
-
if( 0 < $subSync )
|
1048 |
-
$this->components[] = $comp;
|
1049 |
-
$compSync--;
|
1050 |
-
break 2; /* skip trailing empty lines */
|
1051 |
-
case ( 0 == strcasecmp( $BEGINVALARM, substr( $row, 0, 12 ))) :
|
1052 |
-
$comp = new valarm( $config );
|
1053 |
-
$subSync++;
|
1054 |
-
break;
|
1055 |
-
case ( 0 == strcasecmp( $BEGINSTANDARD, substr( $row, 0, 14 ))) :
|
1056 |
-
$comp = new vtimezone( util::$LCSTANDARD, $config );
|
1057 |
-
$subSync++;
|
1058 |
-
break;
|
1059 |
-
case ( 0 == strcasecmp( $BEGINDAYLIGHT, substr( $row, 0, 14 ))) :
|
1060 |
-
$comp = new vtimezone( util::$LCDAYLIGHT, $config );
|
1061 |
-
$subSync++;
|
1062 |
-
break;
|
1063 |
-
case ( 0 == strcasecmp( $BEGIN, substr( $row, 0, 6 ))) :
|
1064 |
-
$compSync++; // begin:<component>
|
1065 |
-
break;
|
1066 |
-
default :
|
1067 |
-
$comp->unparsed[] = $row;
|
1068 |
-
break;
|
1069 |
-
} // end switch( true )
|
1070 |
-
} // end foreach( $rows as $lix => $row )
|
1071 |
-
if( 0 < $subSync ) { // subcomp without END...
|
1072 |
-
$this->components[] = $comp;
|
1073 |
-
unset( $comp );
|
1074 |
-
}
|
1075 |
-
/* concatenate property values spread over several lines */
|
1076 |
-
$this->unparsed = util::concatRows( $this->unparsed );
|
1077 |
-
/* parse each property 'line' */
|
1078 |
-
foreach( $this->unparsed as $lix => $row ) {
|
1079 |
-
/* get propname */
|
1080 |
-
/* split property name and opt.params and value */
|
1081 |
-
list( $propName, $row ) = util::getPropName( $row );
|
1082 |
-
if( util::isXprefixed( $propName )) {
|
1083 |
-
$propName2 = $propName;
|
1084 |
-
$propName = $X_;
|
1085 |
-
}
|
1086 |
-
if( ! in_array( strtoupper( $propName ), util::$PROPNAMES ))
|
1087 |
-
continue; // skip non standard property names
|
1088 |
-
/* separate attributes from value */
|
1089 |
-
util::splitContent( $row, $propAttr );
|
1090 |
-
if(( $NLCHARS == strtolower( substr( $row, -2 ))) &&
|
1091 |
-
! in_array( strtoupper( $propName ), $TEXTPROPS ) &&
|
1092 |
-
( ! util::isXprefixed( $propName )))
|
1093 |
-
$row = util::trimTrailNL( $row );
|
1094 |
-
/* call setProperty( $propName.. . */
|
1095 |
-
switch( strtoupper( $propName )) {
|
1096 |
-
case util::$ATTENDEE :
|
1097 |
-
foreach( $propAttr as $pix => $attr ) {
|
1098 |
-
if( ! in_array( strtoupper( $pix ), util::$ATTENDEEPARKEYS ))
|
1099 |
-
continue; // 'MEMBER', 'DELEGATED-TO', 'DELEGATED-FROM'
|
1100 |
-
$attr2 = explode( util::$COMMA, $attr );
|
1101 |
-
if( 1 < count( $attr2 ))
|
1102 |
-
$propAttr[$pix] = $attr2;
|
1103 |
-
}
|
1104 |
-
$this->setProperty( $propName, $row, $propAttr );
|
1105 |
-
break;
|
1106 |
-
case util::$CATEGORIES :
|
1107 |
-
case util::$RESOURCES :
|
1108 |
-
if( false !== strpos( $row, util::$COMMA )) {
|
1109 |
-
$content = util::commaSplit( $row );
|
1110 |
-
if( 1 < count( $content )) {
|
1111 |
-
foreach( $content as & $contentPart )
|
1112 |
-
$contentPart = util::strunrep( $contentPart );
|
1113 |
-
$this->setProperty( $propName, $content, $propAttr );
|
1114 |
-
break;
|
1115 |
-
}
|
1116 |
-
else
|
1117 |
-
$row = reset( $content );
|
1118 |
-
} // fall trough
|
1119 |
-
case util::$COMMENT :
|
1120 |
-
case util::$CONTACT :
|
1121 |
-
case util::$DESCRIPTION :
|
1122 |
-
case util::$LOCATION :
|
1123 |
-
case util::$SUMMARY :
|
1124 |
-
if( empty( $row ))
|
1125 |
-
$propAttr = null;
|
1126 |
-
$this->setProperty( $propName, util::strunrep( $row ), $propAttr );
|
1127 |
-
break;
|
1128 |
-
case util::$REQUEST_STATUS :
|
1129 |
-
$values = explode( util::$SEMIC, $row, 3 );
|
1130 |
-
$values[1] = ( isset( $values[1] )) ? util::strunrep( $values[1] ) : null;
|
1131 |
-
$values[2] = ( isset( $values[2] )) ? util::strunrep( $values[2] ) : null;
|
1132 |
-
$this->setProperty( $propName
|
1133 |
-
, $values[0] // statcode
|
1134 |
-
, $values[1] // statdesc
|
1135 |
-
, $values[2] // extdata
|
1136 |
-
, $propAttr );
|
1137 |
-
break;
|
1138 |
-
case util::$FREEBUSY :
|
1139 |
-
$class = get_called_class();
|
1140 |
-
if( ! isset( $class::$UCFBTYPE ))
|
1141 |
-
break; // freebusy-prop in a non-freebusy component??
|
1142 |
-
$fbtype = ( isset( $propAttr[$class::$UCFBTYPE] ))
|
1143 |
-
? $propAttr[$class::$UCFBTYPE] : null; // force default
|
1144 |
-
unset( $propAttr[$class::$UCFBTYPE] );
|
1145 |
-
$values = explode( util::$COMMA, $row );
|
1146 |
-
foreach( $values as $vix => $value ) {
|
1147 |
-
$value2 = explode( $SS, $value ); // '/'
|
1148 |
-
if( 1 < count( $value2 ))
|
1149 |
-
$values[$vix] = $value2;
|
1150 |
-
}
|
1151 |
-
$this->setProperty( $propName,
|
1152 |
-
$fbtype,
|
1153 |
-
$values,
|
1154 |
-
$propAttr );
|
1155 |
-
break;
|
1156 |
-
case util::$GEO :
|
1157 |
-
$value = explode( util::$SEMIC, $row, 2 );
|
1158 |
-
if( 2 > count( $value ))
|
1159 |
-
$value[1] = null;
|
1160 |
-
$this->setProperty( $propName,
|
1161 |
-
$value[0],
|
1162 |
-
$value[1],
|
1163 |
-
$propAttr );
|
1164 |
-
break;
|
1165 |
-
case util::$EXDATE :
|
1166 |
-
$values = ( empty( $row )) ? null : explode( util::$COMMA, $row );
|
1167 |
-
$this->setProperty( $propName,
|
1168 |
-
$values,
|
1169 |
-
$propAttr );
|
1170 |
-
break;
|
1171 |
-
case util::$RDATE :
|
1172 |
-
if( empty( $row )) {
|
1173 |
-
$this->setProperty( $propName,
|
1174 |
-
$row,
|
1175 |
-
$propAttr );
|
1176 |
-
break;
|
1177 |
-
}
|
1178 |
-
$values = explode( util::$COMMA, $row );
|
1179 |
-
foreach( $values as $vix => $value ) {
|
1180 |
-
$value2 = explode( $SS, $value );
|
1181 |
-
if( 1 < count( $value2 ))
|
1182 |
-
$values[$vix] = $value2;
|
1183 |
-
}
|
1184 |
-
$this->setProperty( $propName,
|
1185 |
-
$values,
|
1186 |
-
$propAttr );
|
1187 |
-
break;
|
1188 |
-
case util::$EXRULE :
|
1189 |
-
case util::$RRULE :
|
1190 |
-
$values = explode( util::$SEMIC, $row );
|
1191 |
-
$recur = [];
|
1192 |
-
foreach( $values as $value2 ) {
|
1193 |
-
if( empty( $value2 ))
|
1194 |
-
continue; // ;-char in end position ???
|
1195 |
-
$value3 = explode( $EQ, $value2, 2 );
|
1196 |
-
$rulelabel = strtoupper( $value3[0] );
|
1197 |
-
switch( $rulelabel ) {
|
1198 |
-
case util::$BYDAY: {
|
1199 |
-
$value4 = explode( util::$COMMA, $value3[1] );
|
1200 |
-
if( 1 < count( $value4 )) {
|
1201 |
-
foreach( $value4 as $v5ix => $value5 ) {
|
1202 |
-
$value6 = [];
|
1203 |
-
$dayno = $dayname = null;
|
1204 |
-
$value5 = trim( (string) $value5 );
|
1205 |
-
if(( ctype_alpha( substr( $value5, -1 ))) &&
|
1206 |
-
( ctype_alpha( substr( $value5, -2, 1 )))) {
|
1207 |
-
$dayname = substr( $value5, -2, 2 );
|
1208 |
-
if( 2 < strlen( $value5 ))
|
1209 |
-
$dayno = substr( $value5, 0, ( strlen( $value5 ) - 2 ));
|
1210 |
-
}
|
1211 |
-
if( $dayno )
|
1212 |
-
$value6[] = $dayno;
|
1213 |
-
if( $dayname )
|
1214 |
-
$value6[util::$DAY] = $dayname;
|
1215 |
-
$value4[$v5ix] = $value6;
|
1216 |
-
}
|
1217 |
-
}
|
1218 |
-
else {
|
1219 |
-
$value4 = [];
|
1220 |
-
$dayno = $dayname = null;
|
1221 |
-
$value5 = trim( (string) $value3[1] );
|
1222 |
-
if(( ctype_alpha( substr( $value5, -1 ))) &&
|
1223 |
-
( ctype_alpha( substr( $value5, -2, 1 )))) {
|
1224 |
-
$dayname = substr( $value5, -2, 2 );
|
1225 |
-
if( 2 < strlen( $value5 ))
|
1226 |
-
$dayno = substr( $value5, 0, ( strlen( $value5 ) - 2 ));
|
1227 |
-
}
|
1228 |
-
if( $dayno )
|
1229 |
-
$value4[] = $dayno;
|
1230 |
-
if( $dayname )
|
1231 |
-
$value4[util::$DAY] = $dayname;
|
1232 |
-
}
|
1233 |
-
$recur[$rulelabel] = $value4;
|
1234 |
-
break;
|
1235 |
-
}
|
1236 |
-
default: {
|
1237 |
-
$value4 = explode( util::$COMMA, $value3[1] );
|
1238 |
-
if( 1 < count( $value4 ))
|
1239 |
-
$value3[1] = $value4;
|
1240 |
-
$recur[$rulelabel] = $value3[1];
|
1241 |
-
break;
|
1242 |
-
}
|
1243 |
-
} // end - switch $rulelabel
|
1244 |
-
} // end - foreach( $values.. .
|
1245 |
-
$this->setProperty( $propName,
|
1246 |
-
$recur,
|
1247 |
-
$propAttr );
|
1248 |
-
break;
|
1249 |
-
case $X_ :
|
1250 |
-
$propName = ( isset( $propName2 )) ? $propName2 : $propName;
|
1251 |
-
unset( $propName2 );
|
1252 |
-
case util::$ACTION :
|
1253 |
-
case util::$STATUS :
|
1254 |
-
case util::$TRANSP :
|
1255 |
-
case util::$UID :
|
1256 |
-
case util::$TZID :
|
1257 |
-
case util::$RELATED_TO :
|
1258 |
-
case util::$TZNAME :
|
1259 |
-
$row = util::strunrep( $row );
|
1260 |
-
default:
|
1261 |
-
$this->setProperty( $propName,
|
1262 |
-
$row,
|
1263 |
-
$propAttr );
|
1264 |
-
break;
|
1265 |
-
} // end switch( $propName.. .
|
1266 |
-
} // end foreach( $this->unparsed as $lix => $row )
|
1267 |
-
unset( $this->unparsed );
|
1268 |
-
if( $this->countComponents() > 0 ) {
|
1269 |
-
foreach( $this->components as $ckey => $component ) {
|
1270 |
-
if( ! empty( $this->components[$ckey] ) &&
|
1271 |
-
! empty( $this->components[$ckey]->unparsed )) {
|
1272 |
-
$this->components[$ckey]->parse();
|
1273 |
-
}
|
1274 |
-
}
|
1275 |
-
}
|
1276 |
-
return true;
|
1277 |
-
}
|
1278 |
-
/**
|
1279 |
-
* Return calendar component subcomponent from component container
|
1280 |
-
*
|
1281 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1282 |
-
* @since 2.23.14 - 2017-05-02
|
1283 |
-
* @param mixed $arg1 ordno/component type/ component uid
|
1284 |
-
* @param mixed $arg2 ordno if arg1 = component type
|
1285 |
-
* @return object
|
1286 |
-
*/
|
1287 |
-
public function getComponent ( $arg1=null, $arg2=null ) {
|
1288 |
-
static $INDEX = 'INDEX';
|
1289 |
-
if( empty( $this->components ))
|
1290 |
-
return false;
|
1291 |
-
$index = $argType = null;
|
1292 |
-
switch( true ) {
|
1293 |
-
case ( is_null( $arg1 )) :
|
1294 |
-
$argType = $INDEX;
|
1295 |
-
$index = $this->compix[$INDEX] = ( isset( $this->compix[$INDEX] ))
|
1296 |
-
? $this->compix[$INDEX] + 1 : 1;
|
1297 |
-
break;
|
1298 |
-
case ( ctype_digit( (string) $arg1 )) :
|
1299 |
-
$argType = $INDEX;
|
1300 |
-
$index = (int) $arg1;
|
1301 |
-
unset( $this->compix );
|
1302 |
-
break;
|
1303 |
-
case ( in_array( strtolower( $arg1 ), util::$LCSUBCOMPS )) : // class name
|
1304 |
-
unset( $this->compix[$INDEX] );
|
1305 |
-
$argType = strtolower( $arg1 );
|
1306 |
-
if( is_null( $arg2 ))
|
1307 |
-
$index = $this->compix[$argType] = ( isset( $this->compix[$argType] ))
|
1308 |
-
? $this->compix[$argType] + 1 : 1;
|
1309 |
-
else
|
1310 |
-
$index = (int) $arg2;
|
1311 |
-
break;
|
1312 |
-
}
|
1313 |
-
$index -= 1;
|
1314 |
-
$ckeys = array_keys( $this->components );
|
1315 |
-
if( ! empty( $index ) && ( $index > end( $ckeys )))
|
1316 |
-
return false;
|
1317 |
-
$cix2gC = 0;
|
1318 |
-
foreach( $ckeys as $cix ) {
|
1319 |
-
if( empty( $this->components[$cix] ))
|
1320 |
-
continue;
|
1321 |
-
if(( $INDEX == $argType ) && ( $index == $cix ))
|
1322 |
-
return clone $this->components[$cix];
|
1323 |
-
elseif(( strcmp( $this->components[$cix]->objName, $argType ) == 0 ) ||
|
1324 |
-
( isset( $this->components[$cix]->timezonetype ) &&
|
1325 |
-
( strcmp( $this->components[$cix]->timezonetype, $argType ) == 0 ))) {
|
1326 |
-
if( $index == $cix2gC )
|
1327 |
-
return clone $this->components[$cix];
|
1328 |
-
$cix2gC++;
|
1329 |
-
}
|
1330 |
-
}
|
1331 |
-
/* not found.. . */
|
1332 |
-
$this->compix = [];
|
1333 |
-
return false;
|
1334 |
-
}
|
1335 |
-
/**
|
1336 |
-
* Add calendar component as subcomponent to container for subcomponents
|
1337 |
-
*
|
1338 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1339 |
-
* @since 1.x.x - 2007-04-24
|
1340 |
-
* @param object $component calendar component
|
1341 |
-
*/
|
1342 |
-
public function addSubComponent ( $component ) {
|
1343 |
-
$this->setComponent( $component );
|
1344 |
-
return true;
|
1345 |
-
}
|
1346 |
-
/**
|
1347 |
-
* Return formatted output for subcomponents
|
1348 |
-
*
|
1349 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1350 |
-
* @since 2.21.11 - 2015-03-10
|
1351 |
-
* @return string
|
1352 |
-
*/
|
1353 |
-
public function createSubComponent() {
|
1354 |
-
static $DATEKEY = '%04d%02d%02d%02d%02d%02d000';
|
1355 |
-
$output = null;
|
1356 |
-
if( util::$LCVTIMEZONE == $this->objName ) { // sort : standard, daylight, in dtstart order
|
1357 |
-
$stdarr = $dlarr = [];
|
1358 |
-
foreach( $this->components as $cix => $component ) {
|
1359 |
-
if( empty( $component ))
|
1360 |
-
continue;
|
1361 |
-
$dt = $component->getProperty( util::$DTSTART );
|
1362 |
-
$key = (int) sprintf( $DATEKEY, (int) $dt[util::$LCYEAR],
|
1363 |
-
(int) $dt[util::$LCMONTH],
|
1364 |
-
(int) $dt[util::$LCDAY],
|
1365 |
-
(int) $dt[util::$LCHOUR],
|
1366 |
-
(int) $dt[util::$LCMIN],
|
1367 |
-
(int) $dt[util::$LCSEC] );
|
1368 |
-
if( util::$LCSTANDARD == $component->objName ) {
|
1369 |
-
while( isset( $stdarr[$key] ))
|
1370 |
-
$key += 1;
|
1371 |
-
$stdarr[$key] = $component;
|
1372 |
-
}
|
1373 |
-
elseif( util::$LCDAYLIGHT == $component->objName ) {
|
1374 |
-
while( isset( $dlarr[$key] ))
|
1375 |
-
$key += 1;
|
1376 |
-
$dlarr[$key] = $component;
|
1377 |
-
}
|
1378 |
-
} // end foreach(...
|
1379 |
-
$this->components = [];
|
1380 |
-
ksort( $stdarr, SORT_NUMERIC );
|
1381 |
-
foreach( $stdarr as $std )
|
1382 |
-
$this->components[] = $std;
|
1383 |
-
unset( $stdarr );
|
1384 |
-
ksort( $dlarr, SORT_NUMERIC );
|
1385 |
-
foreach( $dlarr as $dl )
|
1386 |
-
$this->components[] = $dl;
|
1387 |
-
unset( $dlarr );
|
1388 |
-
} // end if( util::$LCVTIMEZONE == $this->objName )
|
1389 |
-
$config = $this->getConfig();
|
1390 |
-
foreach( $this->components as $cix => $component ) {
|
1391 |
-
if( empty( $component ))
|
1392 |
-
continue;
|
1393 |
-
$this->components[$cix]->setConfig( $config, false, true );
|
1394 |
-
$output .= $this->components[$cix]->createComponent();
|
1395 |
-
}
|
1396 |
-
return $output;
|
1397 |
-
}
|
1398 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/iCal.tz.inc.php
DELETED
@@ -1,325 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
/**
|
32 |
-
* Additional functions to use with vtimezone components
|
33 |
-
*
|
34 |
-
* Before calling the functions, set time zone 'GMT' ('date_default_timezone_set')!
|
35 |
-
* @author Yitzchok Lavi <icalcreator@onebigsystem.com>
|
36 |
-
* adjusted for iCalcreator Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @version 1.0.2 - 2011-02-24
|
38 |
-
*/
|
39 |
-
namespace kigkonsult\iCalcreator;
|
40 |
-
use kigkonsult\iCalcreator\util\util;
|
41 |
-
/**
|
42 |
-
* Returns array with the offset information
|
43 |
-
*
|
44 |
-
* From UTC for a (UTC) datetime/timestamp in the
|
45 |
-
* timezone, according to the VTIMEZONE information in the input array.
|
46 |
-
* @param array $timezonesarray output from function getTimezonesAsDateArrays (below)
|
47 |
-
* @param string $tzid time zone identifier
|
48 |
-
* @param mixed $timestamp timestamp or a UTC datetime (in array format)
|
49 |
-
* @return array time zone data with keys for $OFFSETHIS, $OFFSETSEC and $TZNAME
|
50 |
-
*/
|
51 |
-
function getTzOffsetForDate( $timezonesarray, $tzid, $timestamp ) {
|
52 |
-
static $OFFSETHIS = 'offsetHis';
|
53 |
-
static $OFFSETSEC = 'offsetSec';
|
54 |
-
static $TZBEFORE = 'tzbefore';
|
55 |
-
static $TZAFTER = 'tzafter';
|
56 |
-
static $TZNAME = 'tzname';
|
57 |
-
if( is_array( $timestamp )) {
|
58 |
-
$timestamp = gmmktime(
|
59 |
-
$timestamp[util::$LCHOUR],
|
60 |
-
$timestamp[util::$LCMIN],
|
61 |
-
$timestamp[util::$LCSEC],
|
62 |
-
$timestamp[util::$LCMONTH],
|
63 |
-
$timestamp[util::$LCDAY],
|
64 |
-
$timestamp[util::$LCYEAR]
|
65 |
-
) ;
|
66 |
-
}
|
67 |
-
$tzoffset = [];
|
68 |
-
// something to return if all goes wrong (such as if $tzid doesn't find us an array of dates)
|
69 |
-
$tzoffset[$OFFSETHIS] = '+0000';
|
70 |
-
$tzoffset[$OFFSETSEC] = 0;
|
71 |
-
$tzoffset[$TZNAME] = '?';
|
72 |
-
if( !isset( $timezonesarray[$tzid] ))
|
73 |
-
return $tzoffset;
|
74 |
-
$tzdatearray = $timezonesarray[$tzid];
|
75 |
-
if ( is_array($tzdatearray) ) {
|
76 |
-
sort($tzdatearray); // just in case
|
77 |
-
if ( $timestamp < $tzdatearray[0][util::$LCTIMESTAMP] ) {
|
78 |
-
// our date is before the first change
|
79 |
-
$tzoffset[$OFFSETHIS] = $tzdatearray[0][$TZBEFORE][$OFFSETHIS] ;
|
80 |
-
$tzoffset[$OFFSETSEC] = $tzdatearray[0][$TZBEFORE][$OFFSETSEC] ;
|
81 |
-
$tzoffset[$TZNAME] = $tzdatearray[0][$TZBEFORE][$OFFSETHIS] ; // we don't know the tzname in this case
|
82 |
-
} elseif ( $timestamp >= $tzdatearray[count($tzdatearray)-1][util::$LCTIMESTAMP] ) {
|
83 |
-
// our date is after the last change (we do this so our scan can stop at the last record but one)
|
84 |
-
$tzoffset[$OFFSETHIS] = $tzdatearray[count($tzdatearray)-1][$TZAFTER][$OFFSETHIS] ;
|
85 |
-
$tzoffset[$OFFSETSEC] = $tzdatearray[count($tzdatearray)-1][$TZAFTER][$OFFSETSEC] ;
|
86 |
-
$tzoffset[$TZNAME] = $tzdatearray[count($tzdatearray)-1][$TZAFTER][$TZNAME] ;
|
87 |
-
} else {
|
88 |
-
// our date somewhere in between
|
89 |
-
// loop through the list of dates and stop at the one where the timestamp is before our date and the next one is after it
|
90 |
-
// we don't include the last date in our loop as there isn't one after it to check
|
91 |
-
for ( $i = 0 ; $i <= count($tzdatearray)-2 ; $i++ ) {
|
92 |
-
if(( $timestamp >= $tzdatearray[$i][util::$LCTIMESTAMP] ) &&
|
93 |
-
( $timestamp < $tzdatearray[$i+1][util::$LCTIMESTAMP] )) {
|
94 |
-
$tzoffset[$OFFSETHIS] = $tzdatearray[$i][$TZAFTER][$OFFSETHIS] ;
|
95 |
-
$tzoffset[$OFFSETSEC] = $tzdatearray[$i][$TZAFTER][$OFFSETSEC] ;
|
96 |
-
$tzoffset[$TZNAME] = $tzdatearray[$i][$TZAFTER][$TZNAME] ;
|
97 |
-
break;
|
98 |
-
}
|
99 |
-
}
|
100 |
-
}
|
101 |
-
}
|
102 |
-
return $tzoffset;
|
103 |
-
}
|
104 |
-
/**
|
105 |
-
* Return an array containing all the timezone data in the vcalendar object
|
106 |
-
*
|
107 |
-
* @param vcalendar $vcalendar iCalcreator calendar instance
|
108 |
-
* @return array time zone transition timestamp,
|
109 |
-
array before(offsetHis, offsetSec),
|
110 |
-
array after(offsetHis, offsetSec, tzname)
|
111 |
-
based on the timezone data in the vcalendar object
|
112 |
-
*/
|
113 |
-
function getTimezonesAsDateArrays( $vcalendar ) {
|
114 |
-
$timezonedata = [];
|
115 |
-
while( $vtz = $vcalendar->getComponent( util::$LCVTIMEZONE )) {
|
116 |
-
$tzid = $vtz->getProperty('tzid');
|
117 |
-
$alltzdates = [];
|
118 |
-
while ( $vtzc = $vtz->getComponent( util::$LCSTANDARD )) {
|
119 |
-
$newtzdates = expandTimezoneDates($vtzc);
|
120 |
-
$alltzdates = array_merge($alltzdates, $newtzdates);
|
121 |
-
}
|
122 |
-
while ( $vtzc = $vtz->getComponent( util::$LCDAYLIGHT )) {
|
123 |
-
$newtzdates = expandTimezoneDates($vtzc);
|
124 |
-
$alltzdates = array_merge($alltzdates, $newtzdates);
|
125 |
-
}
|
126 |
-
sort($alltzdates);
|
127 |
-
$timezonedata[$tzid] = $alltzdates;
|
128 |
-
}
|
129 |
-
return $timezonedata;
|
130 |
-
}
|
131 |
-
/**
|
132 |
-
* Returns an array containing time zone data from vtimezone standard/daylight instances
|
133 |
-
*
|
134 |
-
* @param object $vtzc an iCalcreator calendar standard/daylight instance
|
135 |
-
* @return array time zone data;
|
136 |
-
* array before(offsetHis, offsetSec),
|
137 |
-
* array after(offsetHis, offsetSec, tzname)
|
138 |
-
* @todo fix quickfix...
|
139 |
-
*/
|
140 |
-
function expandTimezoneDates($vtzc) {
|
141 |
-
static $OFFSETHIS = 'offsetHis';
|
142 |
-
static $OFFSETSEC = 'offsetSec';
|
143 |
-
static $TZBEFORE = 'tzbefore';
|
144 |
-
static $TZAFTER = 'tzafter';
|
145 |
-
static $TZNAME = 'tzname';
|
146 |
-
static $YEARLY = 'YEARLY';
|
147 |
-
static $FMTDATE = '%04d%02d%02dT%02d%02d%02d';
|
148 |
-
static $DAYNAMES = ['SU' => 'Sunday',
|
149 |
-
'MO' => 'Monday',
|
150 |
-
'TU' => 'Tuesday',
|
151 |
-
'WE' => 'Wednesday',
|
152 |
-
'TH' => 'Thursday',
|
153 |
-
'FR' => 'Friday',
|
154 |
-
'SA' => 'Saturday'];
|
155 |
-
static $MON = 'mon';
|
156 |
-
static $MDAY = 'mday';
|
157 |
-
static $HOURS = 'hours';
|
158 |
-
static $MINUTES = 'minutes';
|
159 |
-
static $SECONDS = 'seconds';
|
160 |
-
static $MINUS1WEEK = '-1 week';
|
161 |
-
static $PLUS1MONTH = '+1 month';
|
162 |
-
static $SP1WEEK = ' week';
|
163 |
-
static $SP1YEAR = ' year';
|
164 |
-
static $PLUS10YEAR = '+10 year';
|
165 |
-
$tzdates = [];
|
166 |
-
// prepare time zone "description" to attach to each change
|
167 |
-
$tzbefore = [];
|
168 |
-
$tzbefore[$OFFSETHIS] = $vtzc->getProperty(util::$TZOFFSETFROM) ;
|
169 |
-
$tzbefore[$OFFSETSEC] = util::tz2offset($tzbefore[$OFFSETHIS]);
|
170 |
-
if(( util::$MINUS != substr( (string) $tzbefore[$OFFSETSEC], 0, 1 )) &&
|
171 |
-
( util::$PLUS != substr( (string) $tzbefore[$OFFSETSEC], 0, 1 )))
|
172 |
-
$tzbefore[$OFFSETSEC] = util::$PLUS . $tzbefore[$OFFSETSEC];
|
173 |
-
$tzafter = [];
|
174 |
-
$tzafter[$OFFSETHIS] = $vtzc->getProperty(util::$TZOFFSETTO) ;
|
175 |
-
$tzafter[$OFFSETSEC] = util::tz2offset($tzafter[$OFFSETHIS]);
|
176 |
-
if(( util::$MINUS != substr( (string) $tzafter[$OFFSETSEC], 0, 1 )) &&
|
177 |
-
( util::$PLUS != substr( (string) $tzafter[$OFFSETSEC], 0, 1 )))
|
178 |
-
$tzafter[$OFFSETSEC] = util::$PLUS . $tzafter[$OFFSETSEC];
|
179 |
-
if( false === ( $tzafter[$TZNAME] = $vtzc->getProperty(util::$TZNAME)))
|
180 |
-
$tzafter[$TZNAME] = $tzafter[$OFFSETHIS];
|
181 |
-
// find out where to start from
|
182 |
-
$dtstart = $vtzc->getProperty(util::$DTSTART);
|
183 |
-
$dtstarttimestamp = mktime( $dtstart[util::$LCHOUR],
|
184 |
-
$dtstart[util::$LCMIN],
|
185 |
-
$dtstart[util::$LCSEC],
|
186 |
-
$dtstart[util::$LCMONTH],
|
187 |
-
$dtstart[util::$LCDAY],
|
188 |
-
$dtstart[util::$LCYEAR] ) ;
|
189 |
-
if( !isset( $dtstart[util::$UNPARSEDTEXT] )) // ??
|
190 |
-
$dtstart[util::$UNPARSEDTEXT] = sprintf( $FMTDATE, $dtstart[util::$LCYEAR],
|
191 |
-
$dtstart[util::$LCMONTH],
|
192 |
-
$dtstart[util::$LCDAY],
|
193 |
-
$dtstart[util::$LCHOUR],
|
194 |
-
$dtstart[util::$LCMIN],
|
195 |
-
$dtstart[util::$LCSEC] );
|
196 |
-
if ( $dtstarttimestamp == 0 ) {
|
197 |
-
// it seems that the dtstart string may not have parsed correctly
|
198 |
-
// let's set a timestamp starting from 1902, using the time part of the original string
|
199 |
-
// so that the time will change at the right time of day
|
200 |
-
// at worst we'll get midnight again
|
201 |
-
$origdtstartsplit = explode('T',$dtstart[util::$UNPARSEDTEXT]) ;
|
202 |
-
$dtstarttimestamp = strtotime('19020101',0);
|
203 |
-
$dtstarttimestamp = strtotime($origdtstartsplit[1],$dtstarttimestamp);
|
204 |
-
}
|
205 |
-
// the date (in dtstart and opt RDATE/RRULE) is ALWAYS LOCAL (not utc!!), adjust from 'utc' to 'local' timestamp
|
206 |
-
$diff = -1 * $tzbefore[$OFFSETSEC];
|
207 |
-
$dtstarttimestamp += $diff;
|
208 |
-
// add this (start) change to the array of changes
|
209 |
-
$tzdates[] = [util::$LCTIMESTAMP => $dtstarttimestamp,
|
210 |
-
$TZBEFORE => $tzbefore,
|
211 |
-
$TZAFTER => $tzafter];
|
212 |
-
$datearray = getdate($dtstarttimestamp);
|
213 |
-
// save original array to use time parts, because strtotime (used below) apparently loses the time
|
214 |
-
$changetime = $datearray ;
|
215 |
-
// generate dates according to an RRULE line
|
216 |
-
$rrule = $vtzc->getProperty(util::$RRULE) ;
|
217 |
-
if ( is_array($rrule) ) {
|
218 |
-
if ( $rrule[util::$FREQ] == $YEARLY ) {
|
219 |
-
// calculate transition dates starting from DTSTART
|
220 |
-
$offsetchangetimestamp = $dtstarttimestamp;
|
221 |
-
// calculate transition dates until 10 years in the future
|
222 |
-
$stoptimestamp = strtotime($PLUS10YEAR,time());
|
223 |
-
// if UNTIL is set, calculate until then (however far ahead)
|
224 |
-
if ( isset( $rrule[util::$UNTIL] ) && ( $rrule[util::$UNTIL] != '' )) {
|
225 |
-
$stoptimestamp = mktime(
|
226 |
-
$rrule[util::$UNTIL][util::$LCHOUR],
|
227 |
-
$rrule[util::$UNTIL][util::$LCMIN],
|
228 |
-
$rrule[util::$UNTIL][util::$LCSEC],
|
229 |
-
$rrule[util::$UNTIL][util::$LCMONTH],
|
230 |
-
$rrule[util::$UNTIL][util::$LCDAY],
|
231 |
-
$rrule[util::$UNTIL][util::$LCYEAR]
|
232 |
-
) ;
|
233 |
-
}
|
234 |
-
$count = 0 ;
|
235 |
-
$stopcount = isset( $rrule[util::$COUNT] ) ? $rrule[util::$COUNT] : 0 ;
|
236 |
-
// repeat so long as we're between DTSTART and UNTIL, or we haven't prepared COUNT dates
|
237 |
-
while( $offsetchangetimestamp < $stoptimestamp &&
|
238 |
-
( $stopcount == 0 || $count < $stopcount ) ) {
|
239 |
-
// break up the timestamp into its parts
|
240 |
-
$datearray = getdate($offsetchangetimestamp);
|
241 |
-
if ( isset( $rrule[util::$BYMONTH] ) && ( $rrule[util::$BYMONTH] != 0 )) {
|
242 |
-
// set the month
|
243 |
-
$datearray[$MON] = $rrule[util::$BYMONTH] ;
|
244 |
-
}
|
245 |
-
if ( isset( $rrule[util::$BYMONTHDAY] )) { // start quickfix...
|
246 |
-
// set first found/specific day of month
|
247 |
-
$datearray[$MDAY] = ( is_array( $rrule[util::$BYMONTHDAY] ))
|
248 |
-
? reset( $rrule[util::$BYMONTHDAY] )
|
249 |
-
: $rrule[util::$BYMONTHDAY]; // end quickfix
|
250 |
-
} elseif ( isset($rrule[util::$BYDAY]) && is_array($rrule[util::$BYDAY]) ) { // update: 'isset...'
|
251 |
-
// find the Xth WKDAY in the month
|
252 |
-
// the starting point for this process is the first of the month set above
|
253 |
-
$datearray[$MDAY] = 1 ;
|
254 |
-
// turn $datearray as it is now back into a timestamp
|
255 |
-
$offsetchangetimestamp = mktime(
|
256 |
-
$datearray[$HOURS],
|
257 |
-
$datearray[$MINUTES],
|
258 |
-
$datearray[$SECONDS],
|
259 |
-
$datearray[$MON],
|
260 |
-
$datearray[$MDAY],
|
261 |
-
$datearray[util::$LCYEAR]
|
262 |
-
);
|
263 |
-
if ($rrule[util::$BYDAY][0] > 0) {
|
264 |
-
// to find Xth WKDAY in month, we find last WKDAY in month before
|
265 |
-
// we do that by finding first WKDAY in this month and going back one week
|
266 |
-
// then we add X weeks (below)
|
267 |
-
$offsetchangetimestamp = strtotime($DAYNAMES[$rrule[util::$BYDAY][util::$DAY]],$offsetchangetimestamp);
|
268 |
-
$offsetchangetimestamp = strtotime($MINUS1WEEK,$offsetchangetimestamp);
|
269 |
-
} else {
|
270 |
-
// to find Xth WKDAY before the end of the month, we find the first WKDAY in the following month
|
271 |
-
// we do that by going forward one month and going to WKDAY there
|
272 |
-
// then we subtract X weeks (below)
|
273 |
-
$offsetchangetimestamp = strtotime($PLUS1MONTH,$offsetchangetimestamp);
|
274 |
-
$offsetchangetimestamp = strtotime($DAYNAMES[$rrule[util::$BYDAY][util::$DAY]],$offsetchangetimestamp);
|
275 |
-
}
|
276 |
-
// now move forward or back the appropriate number of weeks, into the month we want
|
277 |
-
$offsetchangetimestamp = strtotime($rrule[util::$BYDAY][0] . $SP1WEEK,$offsetchangetimestamp);
|
278 |
-
$datearray = getdate($offsetchangetimestamp);
|
279 |
-
}
|
280 |
-
// convert the date parts back into a timestamp, setting the time parts according to the
|
281 |
-
// original time data which we stored
|
282 |
-
$offsetchangetimestamp = mktime(
|
283 |
-
$changetime[$HOURS],
|
284 |
-
$changetime[$MINUTES],
|
285 |
-
$changetime[$SECONDS] + $diff,
|
286 |
-
$datearray[$MON],
|
287 |
-
$datearray[$MDAY],
|
288 |
-
$datearray[util::$LCYEAR]
|
289 |
-
);
|
290 |
-
// add this change to the array of changes
|
291 |
-
$tzdates[] = [util::$LCTIMESTAMP => $offsetchangetimestamp,
|
292 |
-
$TZBEFORE => $tzbefore,
|
293 |
-
$TZAFTER => $tzafter];
|
294 |
-
// update counters (timestamp and count)
|
295 |
-
$offsetchangetimestamp = strtotime(util::$PLUS
|
296 |
-
. (( isset( $rrule[util::$INTERVAL] ) && ( $rrule[util::$INTERVAL] != 0 ))
|
297 |
-
? $rrule[util::$INTERVAL] : 1 )
|
298 |
-
. $SP1YEAR,$offsetchangetimestamp);
|
299 |
-
$count += 1 ;
|
300 |
-
}
|
301 |
-
}
|
302 |
-
}
|
303 |
-
// generate dates according to RDATE lines
|
304 |
-
while ($rdates = $vtzc->getProperty(util::$RDATE)) {
|
305 |
-
if ( is_array($rdates) ) {
|
306 |
-
|
307 |
-
foreach ( $rdates as $rdate ) {
|
308 |
-
// convert the explicit change date to a timestamp
|
309 |
-
$offsetchangetimestamp = mktime(
|
310 |
-
$rdate[util::$LCHOUR],
|
311 |
-
$rdate[util::$LCMIN],
|
312 |
-
$rdate[util::$LCSEC] + $diff,
|
313 |
-
$rdate[util::$LCMONTH],
|
314 |
-
$rdate[util::$LCDAY],
|
315 |
-
$rdate[util::$LCYEAR]
|
316 |
-
) ;
|
317 |
-
// add this change to the array of changes
|
318 |
-
$tzdates[] = [util::$LCTIMESTAMP => $offsetchangetimestamp,
|
319 |
-
$TZBEFORE => $tzbefore,
|
320 |
-
$TZAFTER => $tzafter];
|
321 |
-
}
|
322 |
-
}
|
323 |
-
}
|
324 |
-
return $tzdates;
|
325 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/iCalBase.php
DELETED
@@ -1,444 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2018 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24.2
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* Do NOT alter or remove the constant!!
|
35 |
-
*/
|
36 |
-
if( ! defined( 'ICALCREATOR_VERSION' ))
|
37 |
-
define( 'ICALCREATOR_VERSION', 'iCalcreator 2.24.2' );
|
38 |
-
/**
|
39 |
-
* iCalcreator base class
|
40 |
-
*
|
41 |
-
* Properties and methods shared by vcalendar and calendarComponents
|
42 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
43 |
-
* @since 2.24.1 - 2018-10-22
|
44 |
-
*/
|
45 |
-
abstract class iCalBase {
|
46 |
-
use traits\X_PROPtrait;
|
47 |
-
/**
|
48 |
-
* @var array container for sub-components
|
49 |
-
* @access protected
|
50 |
-
*/
|
51 |
-
protected $components = [];
|
52 |
-
/**
|
53 |
-
* @var array $unparsed calendar/components in 'raw' text...
|
54 |
-
* @access protected
|
55 |
-
*/
|
56 |
-
protected $unparsed = null;
|
57 |
-
/**
|
58 |
-
* @var array $config configuration
|
59 |
-
* @access protected
|
60 |
-
*/
|
61 |
-
protected $config = [];
|
62 |
-
/**
|
63 |
-
* @var int component index
|
64 |
-
* @access protected
|
65 |
-
*/
|
66 |
-
protected $compix = 0;
|
67 |
-
/**
|
68 |
-
* @var array get multi property index
|
69 |
-
* @access protected
|
70 |
-
*/
|
71 |
-
protected $propix = [];
|
72 |
-
/**
|
73 |
-
* @var array delete multi property index
|
74 |
-
* @access protected
|
75 |
-
*/
|
76 |
-
protected $propdelix = [];
|
77 |
-
/**
|
78 |
-
* __clone method
|
79 |
-
*
|
80 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
81 |
-
* @since 2.23.12 - 2017-04-20
|
82 |
-
*/
|
83 |
-
public function __clone() {
|
84 |
-
foreach( $this->components as $cix => $component )
|
85 |
-
$this->components[$cix] = clone $component;
|
86 |
-
if( isset( $this->compix ))
|
87 |
-
$this->compix = [];
|
88 |
-
if( isset( $this->propix ))
|
89 |
-
$this->propix = [];
|
90 |
-
if( isset( $this->propdelix ))
|
91 |
-
$this->propdelix = [];
|
92 |
-
}
|
93 |
-
/**
|
94 |
-
* Return config value or info about subcomponents, false on not found
|
95 |
-
*
|
96 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
97 |
-
* @since 2.22.23 - 2017-02-02
|
98 |
-
* @param mixed $config
|
99 |
-
* @return mixed
|
100 |
-
*/
|
101 |
-
public function getConfig( $config = false) {
|
102 |
-
static $LCORDNO = 'ordno';
|
103 |
-
static $LCTYPE = 'type';
|
104 |
-
static $LCUID = 'uid';
|
105 |
-
static $LCPROPS = 'props';
|
106 |
-
static $LCSUB = 'sub';
|
107 |
-
if( empty( $config )) {
|
108 |
-
$return = [];
|
109 |
-
$return[util::$ALLOWEMPTY] = $this->getConfig( util::$ALLOWEMPTY );
|
110 |
-
if( false !== ( $lang = $this->getConfig( util::$LANGUAGE )))
|
111 |
-
$return[util::$LANGUAGE] = $lang;
|
112 |
-
$return[util::$TZID] = $this->getConfig( util::$TZID );
|
113 |
-
$return[util::$UNIQUE_ID] = $this->getConfig( util::$UNIQUE_ID );
|
114 |
-
return $return;
|
115 |
-
}
|
116 |
-
switch( strtoupper( $config )) {
|
117 |
-
case util::$ALLOWEMPTY:
|
118 |
-
if( isset( $this->config[util::$ALLOWEMPTY] ))
|
119 |
-
return $this->config[util::$ALLOWEMPTY];
|
120 |
-
break;
|
121 |
-
case util::$COMPSINFO:
|
122 |
-
unset( $this->compix );
|
123 |
-
$info = [];
|
124 |
-
if( ! empty( $this->components )) {
|
125 |
-
foreach( $this->components as $cix => $component ) {
|
126 |
-
if( empty( $component ))
|
127 |
-
continue;
|
128 |
-
$info[$cix][$LCORDNO] = $cix + 1;
|
129 |
-
$info[$cix][$LCTYPE] = $component->objName;
|
130 |
-
$info[$cix][$LCUID] = $component->getProperty( util::$UID );
|
131 |
-
$info[$cix][$LCPROPS] = $component->getConfig( util::$PROPINFO );
|
132 |
-
$info[$cix][$LCSUB] = $component->getConfig( util::$COMPSINFO );
|
133 |
-
}
|
134 |
-
}
|
135 |
-
return $info;
|
136 |
-
break;
|
137 |
-
case util::$LANGUAGE: // get language for calendar component as defined in [RFC 1766]
|
138 |
-
if( isset( $this->config[util::$LANGUAGE] ))
|
139 |
-
return $this->config[util::$LANGUAGE];
|
140 |
-
break;
|
141 |
-
case util::$PROPINFO:
|
142 |
-
$output = [];
|
143 |
-
if( ! in_array( $this->objName, util::$LCSUBCOMPS )) {
|
144 |
-
if( empty( $this->uid ))
|
145 |
-
$this->uid = util::makeUid( $this->getConfig( util::$UNIQUE_ID ));
|
146 |
-
|
147 |
-
$output[util::$UID] = 1;
|
148 |
-
if( empty( $this->dtstamp ))
|
149 |
-
$this->dtstamp = util::makeDtstamp();
|
150 |
-
$output[util::$DTSTAMP] = 1;
|
151 |
-
}
|
152 |
-
if( ! empty( $this->summary )) $output[util::$SUMMARY] = 1;
|
153 |
-
if( ! empty( $this->description )) $output[util::$DESCRIPTION] = count( $this->description );
|
154 |
-
if( ! empty( $this->dtstart )) $output[util::$DTSTART] = 1;
|
155 |
-
if( ! empty( $this->dtend )) $output[util::$DTEND] = 1;
|
156 |
-
if( ! empty( $this->due )) $output[util::$DUE] = 1;
|
157 |
-
if( ! empty( $this->duration )) $output[util::$DURATION] = 1;
|
158 |
-
if( ! empty( $this->rrule )) $output[util::$RRULE] = count( $this->rrule );
|
159 |
-
if( ! empty( $this->rdate )) $output[util::$RDATE] = count( $this->rdate );
|
160 |
-
if( ! empty( $this->exdate )) $output[util::$EXDATE] = count( $this->exdate );
|
161 |
-
if( ! empty( $this->exrule )) $output[util::$EXRULE] = count( $this->exrule );
|
162 |
-
if( ! empty( $this->action )) $output[util::$ACTION] = 1;
|
163 |
-
if( ! empty( $this->attach )) $output[util::$ATTACH] = count( $this->attach );
|
164 |
-
if( ! empty( $this->attendee )) $output[util::$ATTENDEE] = count( $this->attendee );
|
165 |
-
if( ! empty( $this->categories )) $output[util::$CATEGORIES] = count( $this->categories );
|
166 |
-
if( ! empty( $this->class )) $output[util::$CLASS] = 1;
|
167 |
-
if( ! empty( $this->comment )) $output[util::$COMMENT] = count( $this->comment );
|
168 |
-
if( ! empty( $this->completed )) $output[util::$COMPLETED] = 1;
|
169 |
-
if( ! empty( $this->contact )) $output[util::$CONTACT] = count( $this->contact );
|
170 |
-
if( ! empty( $this->created )) $output[util::$CREATED] = 1;
|
171 |
-
if( ! empty( $this->freebusy )) $output[util::$FREEBUSY] = count( $this->freebusy );
|
172 |
-
if( ! empty( $this->geo )) $output[util::$GEO] = 1;
|
173 |
-
if( ! empty( $this->lastmodified )) $output[util::$LAST_MODIFIED] = 1;
|
174 |
-
if( ! empty( $this->location )) $output[util::$LOCATION] = 1;
|
175 |
-
if( ! empty( $this->organizer )) $output[util::$ORGANIZER] = 1;
|
176 |
-
if( ! empty( $this->percentcomplete )) $output[util::$PERCENT_COMPLETE] = 1;
|
177 |
-
if( ! empty( $this->priority )) $output[util::$PRIORITY] = 1;
|
178 |
-
if( ! empty( $this->recurrenceid )) $output[util::$RECURRENCE_ID] = 1;
|
179 |
-
if( ! empty( $this->relatedto )) $output[util::$RELATED_TO] = count( $this->relatedto );
|
180 |
-
if( ! empty( $this->repeat )) $output[util::$REPEAT] = 1;
|
181 |
-
if( ! empty( $this->requeststatus )) $output[util::$REQUEST_STATUS] = count( $this->requeststatus );
|
182 |
-
if( ! empty( $this->resources )) $output[util::$RESOURCES] = count( $this->resources );
|
183 |
-
if( ! empty( $this->sequence )) $output[util::$SEQUENCE] = 1;
|
184 |
-
if( ! empty( $this->status )) $output[util::$STATUS] = 1;
|
185 |
-
if( ! empty( $this->transp )) $output[util::$TRANSP] = 1;
|
186 |
-
if( ! empty( $this->trigger )) $output[util::$TRIGGER] = 1;
|
187 |
-
if( ! empty( $this->tzid )) $output[util::$TZID] = 1;
|
188 |
-
if( ! empty( $this->tzname )) $output[util::$TZNAME] = count( $this->tzname );
|
189 |
-
if( ! empty( $this->tzoffsetfrom )) $output[util::$TZOFFSETFROM] = 1;
|
190 |
-
if( ! empty( $this->tzoffsetto )) $output[util::$TZOFFSETTO] = 1;
|
191 |
-
if( ! empty( $this->tzurl )) $output[util::$TZURL] = 1;
|
192 |
-
if( ! empty( $this->url )) $output[util::$URL] = 1;
|
193 |
-
if( ! empty( $this->xprop )) $output[util::$X_PROP] = count( $this->xprop );
|
194 |
-
return $output;
|
195 |
-
break;
|
196 |
-
case util::$SETPROPERTYNAMES:
|
197 |
-
return array_keys( $this->getConfig( util::$PROPINFO ));
|
198 |
-
break;
|
199 |
-
case util::$TZID:
|
200 |
-
if( isset( $this->config[util::$TZID] ))
|
201 |
-
return $this->config[util::$TZID];
|
202 |
-
break;
|
203 |
-
case util::$UNIQUE_ID:
|
204 |
-
if( empty( $this->config[util::$UNIQUE_ID] ))
|
205 |
-
$this->config[util::$UNIQUE_ID] = ( isset( $_SERVER[util::$SERVER_NAME] ))
|
206 |
-
? gethostbyname( $_SERVER[util::$SERVER_NAME] )
|
207 |
-
: util::$LOCALHOST;
|
208 |
-
return $this->config[util::$UNIQUE_ID];
|
209 |
-
break;
|
210 |
-
}
|
211 |
-
return false;
|
212 |
-
}
|
213 |
-
/**
|
214 |
-
* General component config setting
|
215 |
-
*
|
216 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
217 |
-
* @since 2.23.12 - 2017-04-22
|
218 |
-
* @param mixed $config
|
219 |
-
* @param string $value
|
220 |
-
* @param bool $softUpdate
|
221 |
-
* @return bool true on success
|
222 |
-
*/
|
223 |
-
public function setConfig( $config, $value=null, $softUpdate=null ) {
|
224 |
-
if( is_null( $softUpdate ))
|
225 |
-
$softUpdate = false;
|
226 |
-
if( is_array( $config )) {
|
227 |
-
$config = array_change_key_case( $config, CASE_UPPER );
|
228 |
-
foreach( $config as $cKey => $cValue ) {
|
229 |
-
if( false === $this->setConfig( $cKey, $cValue, $softUpdate ))
|
230 |
-
return false;
|
231 |
-
}
|
232 |
-
return true;
|
233 |
-
}
|
234 |
-
$res = false;
|
235 |
-
switch( strtoupper( $config )) {
|
236 |
-
case util::$ALLOWEMPTY:
|
237 |
-
$this->config[util::$ALLOWEMPTY] = $value;
|
238 |
-
$subcfg = [util::$ALLOWEMPTY => $value];
|
239 |
-
$res = true;
|
240 |
-
break;
|
241 |
-
case util::$LANGUAGE: // set language for component as defined in [RFC 1766]
|
242 |
-
$value = trim( $value );
|
243 |
-
if( empty( $this->config[util::$LANGUAGE] ) || ! $softUpdate )
|
244 |
-
$this->config[util::$LANGUAGE] = $value;
|
245 |
-
$subcfg = [util::$LANGUAGE => $value];
|
246 |
-
$res = true;
|
247 |
-
break;
|
248 |
-
case util::$TZID:
|
249 |
-
$this->config[util::$TZID] = trim( $value );
|
250 |
-
$subcfg = [util::$TZID => trim( $value )];
|
251 |
-
$res = true;
|
252 |
-
break;
|
253 |
-
case util::$UNIQUE_ID:
|
254 |
-
$value = trim( $value );
|
255 |
-
$this->config[util::$UNIQUE_ID] = $value;
|
256 |
-
$subcfg = [util::$UNIQUE_ID => $value];
|
257 |
-
$res = true;
|
258 |
-
break;
|
259 |
-
default: // any unvalid config key.. .
|
260 |
-
return true;
|
261 |
-
}
|
262 |
-
if( ! $res )
|
263 |
-
return false;
|
264 |
-
if( isset( $subcfg ) && ! empty( $this->components )) {
|
265 |
-
foreach( $subcfg as $cfgkey => $cfgvalue ) {
|
266 |
-
foreach( $this->components as $cix => $component ) {
|
267 |
-
$res = $this->components[$cix]->setConfig( $cfgkey, $cfgvalue, $softUpdate );
|
268 |
-
if( ! $res )
|
269 |
-
break 2;
|
270 |
-
}
|
271 |
-
}
|
272 |
-
}
|
273 |
-
return $res;
|
274 |
-
}
|
275 |
-
/**
|
276 |
-
* Return number of components
|
277 |
-
*
|
278 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
279 |
-
* @since 2.23.5 - 2017-04-13
|
280 |
-
* @return int
|
281 |
-
*/
|
282 |
-
public function countComponents() {
|
283 |
-
return ( empty( $this->components )) ? 0 : count( $this->components );
|
284 |
-
}
|
285 |
-
/**
|
286 |
-
* Return new calendar component, included in calendar or component
|
287 |
-
*
|
288 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
289 |
-
* @since 2.22.20 - 2017-04-13
|
290 |
-
* @param string $compType component type
|
291 |
-
* @return calendarComponent
|
292 |
-
*/
|
293 |
-
public function newComponent( $compType ) {
|
294 |
-
$config = $this->getConfig();
|
295 |
-
$ix = ( empty( $this->components ))
|
296 |
-
? 0
|
297 |
-
: key( array_slice( $this->components, -1, 1, TRUE )) + 1;
|
298 |
-
switch( strtolower( $compType )) {
|
299 |
-
case util::$LCVALARM :
|
300 |
-
$this->components[$ix] = new valarm( $config );
|
301 |
-
break;
|
302 |
-
case util::$LCVEVENT :
|
303 |
-
$this->components[$ix] = new vevent( $config );
|
304 |
-
break;
|
305 |
-
case util::$LCVTODO :
|
306 |
-
$this->components[$ix] = new vtodo( $config );
|
307 |
-
break;
|
308 |
-
case util::$LCVJOURNAL :
|
309 |
-
$this->components[$ix] = new vjournal( $config );
|
310 |
-
break;
|
311 |
-
case util::$LCVFREEBUSY :
|
312 |
-
$this->components[$ix] = new vfreebusy( $config );
|
313 |
-
break;
|
314 |
-
case util::$LCVTIMEZONE :
|
315 |
-
array_unshift( $this->components, new vtimezone( $config ));
|
316 |
-
$ix = 0;
|
317 |
-
break;
|
318 |
-
case util::$LCSTANDARD :
|
319 |
-
array_unshift( $this->components, new vtimezone( util::$LCSTANDARD, $config ));
|
320 |
-
$ix = 0;
|
321 |
-
break;
|
322 |
-
case util::$LCDAYLIGHT :
|
323 |
-
$this->components[$ix] = new vtimezone( util::$LCDAYLIGHT, $config );
|
324 |
-
break;
|
325 |
-
default:
|
326 |
-
return false;
|
327 |
-
}
|
328 |
-
return $this->components[$ix];
|
329 |
-
}
|
330 |
-
/**
|
331 |
-
* Delete calendar subcomponent from component container
|
332 |
-
*
|
333 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
334 |
-
* @since 2.23.12 - 2017-05-06
|
335 |
-
* @param mixed $arg1 ordno / component type / component uid
|
336 |
-
* @param mixed $arg2 ordno if arg1 = component type
|
337 |
-
* @return bool true on success
|
338 |
-
*/
|
339 |
-
public function deleteComponent( $arg1, $arg2=false ) {
|
340 |
-
static $INDEX = 'INDEX';
|
341 |
-
if( ! isset( $this->components ))
|
342 |
-
return false;
|
343 |
-
$argType = $index = null;
|
344 |
-
if ( ctype_digit( (string) $arg1 )) {
|
345 |
-
$argType = $INDEX;
|
346 |
-
$index = (int) $arg1 - 1;
|
347 |
-
}
|
348 |
-
elseif( in_array( strtolower( $arg1 ), util::$ALLCOMPS )) {
|
349 |
-
$argType = strtolower( $arg1 );
|
350 |
-
$index = ( ! empty( $arg2 ) && ctype_digit( (string) $arg2 )) ? (( int ) $arg2 - 1 ) : 0;
|
351 |
-
}
|
352 |
-
$cix2dC = 0;
|
353 |
-
$remove = false;
|
354 |
-
foreach( $this->components as $cix => $component ) {
|
355 |
-
if(( $INDEX == $argType ) && ( $index == $cix )) {
|
356 |
-
unset( $this->components[$cix] );
|
357 |
-
$remove = true;
|
358 |
-
break;
|
359 |
-
}
|
360 |
-
elseif( $argType == $component->objName ) {
|
361 |
-
if( $index == $cix2dC ) {
|
362 |
-
unset( $this->components[$cix] );
|
363 |
-
$remove = true;
|
364 |
-
break;
|
365 |
-
}
|
366 |
-
$cix2dC++;
|
367 |
-
}
|
368 |
-
elseif( ! $argType &&
|
369 |
-
( $arg1 == $component->getProperty( util::$UID ))) {
|
370 |
-
unset( $this->components[$cix] );
|
371 |
-
$remove = true;
|
372 |
-
break;
|
373 |
-
}
|
374 |
-
} // end foreach( $this->components as $cix => $component )
|
375 |
-
if( $remove ) {
|
376 |
-
$this->components = array_filter( $this->components );
|
377 |
-
return true;
|
378 |
-
}
|
379 |
-
return false;
|
380 |
-
}
|
381 |
-
/**
|
382 |
-
* Add calendar component as subcomponent to container for subcomponents
|
383 |
-
*
|
384 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
385 |
-
* @since 2.23.2 - 2015-03-18
|
386 |
-
* @param object $component calendarComponent
|
387 |
-
* @param mixed $arg1 ordno/component type/ component uid
|
388 |
-
* @param mixed $arg2 ordno if arg1 = component type
|
389 |
-
* @return bool
|
390 |
-
*/
|
391 |
-
public function setComponent( $component, $arg1=false, $arg2=false ) {
|
392 |
-
static $INDEX = 'INDEX';
|
393 |
-
if( ! isset( $this->components ))
|
394 |
-
return false;
|
395 |
-
$component->setConfig( $this->getConfig(), false, true );
|
396 |
-
if( ! in_array( strtolower( $component->objName ), util::$LCSUBCOMPS )) {
|
397 |
-
/* make sure dtstamp and uid is set */
|
398 |
-
$component->getProperty( util::$DTSTAMP );
|
399 |
-
$component->getProperty( util::$UID );
|
400 |
-
}
|
401 |
-
if( ! $arg1 ) { // plain insert, last in chain
|
402 |
-
$this->components[] = clone $component;
|
403 |
-
return true;
|
404 |
-
}
|
405 |
-
$argType = $index = null;
|
406 |
-
if ( ctype_digit( (string) $arg1 )) { // index insert/replace
|
407 |
-
$argType = $INDEX;
|
408 |
-
$index = (int) $arg1 - 1;
|
409 |
-
}
|
410 |
-
elseif( in_array( strtolower( $arg1 ), util::$MCOMPS )) {
|
411 |
-
$argType = strtolower( $arg1 );
|
412 |
-
$index = ( ctype_digit( (string) $arg2 )) ? ((int) $arg2) - 1 : 0;
|
413 |
-
}
|
414 |
-
// else if arg1 is set, arg1 must be an UID
|
415 |
-
$cix2sC = 0;
|
416 |
-
foreach( $this->components as $cix => $component2 ) {
|
417 |
-
if( empty( $component2 ))
|
418 |
-
continue;
|
419 |
-
if(( $INDEX == $argType ) && ( $index == $cix )) { // index insert/replace
|
420 |
-
$this->components[$cix] = clone $component;
|
421 |
-
return true;
|
422 |
-
}
|
423 |
-
elseif( $argType == $component2->objName ) { // component Type index insert/replace
|
424 |
-
if( $index == $cix2sC ) {
|
425 |
-
$this->components[$cix] = clone $component;
|
426 |
-
return true;
|
427 |
-
}
|
428 |
-
$cix2sC++;
|
429 |
-
}
|
430 |
-
elseif( ! $argType && ( $arg1 == $component2->getProperty( util::$UID ))) {
|
431 |
-
$this->components[$cix] = clone $component; // UID insert/replace
|
432 |
-
return true;
|
433 |
-
}
|
434 |
-
}
|
435 |
-
/* arg1=index and not found.. . insert at index .. .*/
|
436 |
-
if( $INDEX == $argType ) {
|
437 |
-
$this->components[$index] = clone $component;
|
438 |
-
ksort( $this->components, SORT_NUMERIC );
|
439 |
-
}
|
440 |
-
else /* not found.. . insert last in chain anyway .. .*/
|
441 |
-
$this->components[] = clone $component;
|
442 |
-
return true;
|
443 |
-
}
|
444 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/iCalXML.php
DELETED
@@ -1,1253 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
use kigkonsult\iCalcreator\util\utilGeo;
|
34 |
-
/**
|
35 |
-
* iCalcreator XML (rfc6321) support class
|
36 |
-
*
|
37 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
38 |
-
* @since 2.20.23 - 2017-02-25
|
39 |
-
*/
|
40 |
-
class iCalXML {
|
41 |
-
private static $vcalendar = 'vcalendar';
|
42 |
-
private static $calProps = ['version',
|
43 |
-
'prodid',
|
44 |
-
'calscale',
|
45 |
-
'method'];
|
46 |
-
private static $properties = 'properties';
|
47 |
-
private static $PARAMETERS = 'parameters';
|
48 |
-
private static $components = 'components';
|
49 |
-
private static $text = 'text';
|
50 |
-
private static $binary = 'binary';
|
51 |
-
private static $uri = 'uri';
|
52 |
-
private static $date = 'date';
|
53 |
-
private static $date_time = 'date-time';
|
54 |
-
private static $fbtype = 'fbtype';
|
55 |
-
private static $FBTYPE = 'FBTYPE';
|
56 |
-
private static $period = 'period';
|
57 |
-
private static $rstatus = 'rstatus';
|
58 |
-
private static $unknown = 'unknown';
|
59 |
-
private static $recur = 'recur';
|
60 |
-
private static $cal_address = 'cal-address';
|
61 |
-
private static $integer = 'integer';
|
62 |
-
private static $relatedStart = 'relatedStart';
|
63 |
-
private static $RELATED = 'RELATED';
|
64 |
-
private static $END = 'END';
|
65 |
-
private static $utc_offset = 'utc-offset';
|
66 |
-
private static $altrep = 'altrep';
|
67 |
-
private static $dir = 'dir';
|
68 |
-
private static $delegated_from = 'delegated-from';
|
69 |
-
private static $delegated_to = 'delegated-to';
|
70 |
-
private static $member = 'member';
|
71 |
-
private static $sent_by = 'sent-by';
|
72 |
-
private static $rsvp = 'rsvp';
|
73 |
-
private static $bysecond = 'bysecond';
|
74 |
-
private static $byminute = 'byminute';
|
75 |
-
private static $byhour = 'byhour';
|
76 |
-
private static $bymonthday = 'bymonthday';
|
77 |
-
private static $byyearday = 'byyearday';
|
78 |
-
private static $byweekno = 'byweekno';
|
79 |
-
private static $bymonth = 'bymonth';
|
80 |
-
private static $bysetpos = 'bysetpos';
|
81 |
-
private static $byday = 'byday';
|
82 |
-
private static $freq = 'freq';
|
83 |
-
private static $count = 'count';
|
84 |
-
private static $interval = 'interval';
|
85 |
-
private static $wkst = 'wkst';
|
86 |
-
private static $code = 'code';
|
87 |
-
private static $statcode = 'statcode';
|
88 |
-
private static $extdata = 'extdata';
|
89 |
-
private static $data = 'data';
|
90 |
-
private static $time = 'time';
|
91 |
-
private static $latitude = 'latitude';
|
92 |
-
private static $longitude = 'longitude';
|
93 |
-
/**
|
94 |
-
* Return iCal XML (rfc6321) output, using PHP SimpleXMLElement
|
95 |
-
*
|
96 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
97 |
-
* @since 2.18.1 - 2013-08-18
|
98 |
-
* @param vcalendar $calendar iCalcreator vcalendar instance reference
|
99 |
-
* @return string
|
100 |
-
* @static
|
101 |
-
*/
|
102 |
-
public static function iCal2XML( vcalendar $calendar ) {
|
103 |
-
static $YMDTHISZ = 'Ymd\THis\Z';
|
104 |
-
static $XMLstart = '<?xml version="1.0" encoding="utf-8"?><icalendar xmlns="urn:ietf:params:xml:ns:icalendar-2.0"><!-- created %s using kigkonsult.se %s iCal2XMl (rfc6321) --></icalendar>';
|
105 |
-
/** fix an SimpleXMLElement instance and create root element */
|
106 |
-
$xml = new \SimpleXMLElement( sprintf( $XMLstart, gmdate( $YMDTHISZ ),
|
107 |
-
ICALCREATOR_VERSION ));
|
108 |
-
$vcalendar = $xml->addChild( self::$vcalendar );
|
109 |
-
/** fix calendar properties */
|
110 |
-
$properties = $vcalendar->addChild( self::$properties );
|
111 |
-
foreach( self::$calProps as $calProp ) {
|
112 |
-
if( false !== ( $content = $calendar->getProperty( $calProp )))
|
113 |
-
self::addXMLchild( $properties,
|
114 |
-
$calProp,
|
115 |
-
self::$text,
|
116 |
-
$content );
|
117 |
-
}
|
118 |
-
while( false !== ( $content = $calendar->getProperty( false, false, true )))
|
119 |
-
self::addXMLchild( $properties,
|
120 |
-
$content[0],
|
121 |
-
self::$unknown,
|
122 |
-
$content[1][util::$LCvalue],
|
123 |
-
$content[1][util::$LCparams] );
|
124 |
-
$langCal = $calendar->getConfig( util::$LANGUAGE );
|
125 |
-
/** prepare to fix components with properties */
|
126 |
-
$components = $vcalendar->addChild( self::$components );
|
127 |
-
/** fix component properties */
|
128 |
-
while( false !== ( $component = $calendar->getComponent())) {
|
129 |
-
$compName = $component->objName;
|
130 |
-
$child = $components->addChild( $compName );
|
131 |
-
$properties = $child->addChild( self::$properties );
|
132 |
-
$langComp = $component->getConfig( util::$LANGUAGE );
|
133 |
-
$props = $component->getConfig( util::$SETPROPERTYNAMES );
|
134 |
-
foreach( $props as $pix => $prop ) {
|
135 |
-
switch( strtoupper( $prop )) {
|
136 |
-
case util::$ATTACH: // may occur multiple times, below
|
137 |
-
while( false !== ( $content = $component->getProperty( $prop,
|
138 |
-
false,
|
139 |
-
true ))) {
|
140 |
-
$type = ( util::isParamsValueSet( $content, util::$BINARY ))
|
141 |
-
? self::$binary : self::$uri;
|
142 |
-
unset( $content[util::$LCparams][util::$VALUE] );
|
143 |
-
self::addXMLchild( $properties,
|
144 |
-
$prop,
|
145 |
-
$type,
|
146 |
-
$content[util::$LCvalue],
|
147 |
-
$content[util::$LCparams] );
|
148 |
-
}
|
149 |
-
break;
|
150 |
-
case util::$ATTENDEE:
|
151 |
-
while( false !== ( $content = $component->getProperty( $prop,
|
152 |
-
false,
|
153 |
-
true ))) {
|
154 |
-
if( isset( $content[util::$LCparams][util::$CN] ) &&
|
155 |
-
! isset( $content[util::$LCparams][util::$LANGUAGE] )) {
|
156 |
-
if( $langComp )
|
157 |
-
$content[util::$LCparams][util::$LANGUAGE] = $langComp;
|
158 |
-
elseif( $langCal )
|
159 |
-
$content[util::$LCparams][util::$LANGUAGE] = $langCal;
|
160 |
-
}
|
161 |
-
self::addXMLchild( $properties,
|
162 |
-
$prop,
|
163 |
-
self::$cal_address,
|
164 |
-
$content[util::$LCvalue],
|
165 |
-
$content[util::$LCparams] );
|
166 |
-
}
|
167 |
-
break;
|
168 |
-
case util::$EXDATE:
|
169 |
-
while( false !== ( $content = $component->getProperty( $prop,
|
170 |
-
false,
|
171 |
-
true ))) {
|
172 |
-
$type = ( util::isParamsValueSet( $content, util::$DATE ))
|
173 |
-
? self::$date : self::$date_time;
|
174 |
-
unset( $content[util::$LCparams][util::$VALUE] );
|
175 |
-
self::addXMLchild( $properties,
|
176 |
-
$prop,
|
177 |
-
$type,
|
178 |
-
$content[util::$LCvalue],
|
179 |
-
$content[util::$LCparams] );
|
180 |
-
}
|
181 |
-
break;
|
182 |
-
case util::$FREEBUSY:
|
183 |
-
while( false !== ( $content = $component->getProperty( $prop,
|
184 |
-
false,
|
185 |
-
true ))) {
|
186 |
-
if( is_array( $content ) &&
|
187 |
-
isset( $content[util::$LCvalue][self::$fbtype] )) {
|
188 |
-
$content[util::$LCparams][self::$FBTYPE] = $content[util::$LCvalue][self::$fbtype];
|
189 |
-
unset( $content[util::$LCvalue][self::$fbtype] );
|
190 |
-
}
|
191 |
-
self::addXMLchild( $properties,
|
192 |
-
$prop,
|
193 |
-
self::$period,
|
194 |
-
$content[util::$LCvalue],
|
195 |
-
$content[util::$LCparams] );
|
196 |
-
}
|
197 |
-
break;
|
198 |
-
case util::$REQUEST_STATUS:
|
199 |
-
while( false !== ( $content = $component->getProperty( $prop,
|
200 |
-
false,
|
201 |
-
true ))) {
|
202 |
-
if( ! isset( $content[util::$LCparams][util::$LANGUAGE] )) {
|
203 |
-
if( $langComp )
|
204 |
-
$content[util::$LCparams][util::$LANGUAGE] = $langComp;
|
205 |
-
elseif( $langCal )
|
206 |
-
$content[util::$LCparams][util::$LANGUAGE] = $langCal;
|
207 |
-
}
|
208 |
-
self::addXMLchild( $properties,
|
209 |
-
$prop,
|
210 |
-
self::$rstatus,
|
211 |
-
$content[util::$LCvalue],
|
212 |
-
$content[util::$LCparams] );
|
213 |
-
}
|
214 |
-
break;
|
215 |
-
case util::$RDATE:
|
216 |
-
while( false !== ( $content = $component->getProperty( $prop,
|
217 |
-
false,
|
218 |
-
true ))) {
|
219 |
-
$type = self::$date_time;
|
220 |
-
if( util::isParamsValueSet( $content, util::$DATE ))
|
221 |
-
$type = self::$date;
|
222 |
-
elseif( util::isParamsValueSet( $content, util::$PERIOD ))
|
223 |
-
$type = self::$period;
|
224 |
-
unset( $content[util::$LCparams][util::$VALUE] );
|
225 |
-
self::addXMLchild( $properties,
|
226 |
-
$prop,
|
227 |
-
$type,
|
228 |
-
$content[util::$LCvalue],
|
229 |
-
$content[util::$LCparams] );
|
230 |
-
}
|
231 |
-
break;
|
232 |
-
case util::$CATEGORIES:
|
233 |
-
case util::$COMMENT:
|
234 |
-
case util::$CONTACT:
|
235 |
-
case util::$DESCRIPTION:
|
236 |
-
case util::$RELATED_TO:
|
237 |
-
case util::$RESOURCES:
|
238 |
-
while( false !== ( $content = $component->getProperty( $prop,
|
239 |
-
false,
|
240 |
-
true ))) {
|
241 |
-
if(( util::$RELATED_TO != $prop ) &&
|
242 |
-
! isset( $content[util::$LCparams][util::$LANGUAGE] )) {
|
243 |
-
if( $langComp )
|
244 |
-
$content[util::$LCparams][util::$LANGUAGE] = $langComp;
|
245 |
-
elseif( $langCal )
|
246 |
-
$content[util::$LCparams][util::$LANGUAGE] = $langCal;
|
247 |
-
}
|
248 |
-
self::addXMLchild( $properties,
|
249 |
-
$prop,
|
250 |
-
self::$text,
|
251 |
-
$content[util::$LCvalue],
|
252 |
-
$content[util::$LCparams] );
|
253 |
-
}
|
254 |
-
break;
|
255 |
-
case util::$X_PROP:
|
256 |
-
while( false !== ( $content = $component->getProperty( $prop,
|
257 |
-
false,
|
258 |
-
true )))
|
259 |
-
self::addXMLchild( $properties,
|
260 |
-
$content[0],
|
261 |
-
self::$unknown,
|
262 |
-
$content[1][util::$LCvalue],
|
263 |
-
$content[1][util::$LCparams] );
|
264 |
-
break;
|
265 |
-
case util::$CREATED: // single occurence below, if set
|
266 |
-
case util::$COMPLETED:
|
267 |
-
case util::$DTSTAMP:
|
268 |
-
case util::$LAST_MODIFIED:
|
269 |
-
case util::$DTSTART:
|
270 |
-
case util::$DTEND:
|
271 |
-
case util::$DUE:
|
272 |
-
case util::$RECURRENCE_ID:
|
273 |
-
if( false !== ( $content = $component->getProperty( $prop,
|
274 |
-
false,
|
275 |
-
true ))) {
|
276 |
-
$type = ( util::isParamsValueSet( $content, util::$DATE ))
|
277 |
-
? self::$date : self::$date_time;
|
278 |
-
unset( $content[util::$LCparams][util::$VALUE] );
|
279 |
-
if(( isset( $content[util::$LCparams][util::$TZID] ) &&
|
280 |
-
empty( $content[util::$LCparams][util::$TZID] )) ||
|
281 |
-
@is_null( $content[util::$LCparams][util::$TZID] ))
|
282 |
-
unset( $content[util::$LCparams][util::$TZID] );
|
283 |
-
self::addXMLchild( $properties,
|
284 |
-
$prop,
|
285 |
-
$type,
|
286 |
-
$content[util::$LCvalue],
|
287 |
-
$content[util::$LCparams] );
|
288 |
-
}
|
289 |
-
break;
|
290 |
-
case util::$DURATION:
|
291 |
-
if( false !== ( $content = $component->getProperty( $prop,
|
292 |
-
false,
|
293 |
-
true )))
|
294 |
-
self::addXMLchild( $properties,
|
295 |
-
$prop,
|
296 |
-
strtolower( util::$DURATION ),
|
297 |
-
$content[util::$LCvalue],
|
298 |
-
$content[util::$LCparams] );
|
299 |
-
break;
|
300 |
-
case util::$EXRULE:
|
301 |
-
case util::$RRULE:
|
302 |
-
while( false !== ( $content = $component->getProperty( $prop,
|
303 |
-
false,
|
304 |
-
true )))
|
305 |
-
self::addXMLchild( $properties,
|
306 |
-
$prop,
|
307 |
-
self::$recur,
|
308 |
-
$content[util::$LCvalue],
|
309 |
-
$content[util::$LCparams] );
|
310 |
-
break;
|
311 |
-
case util::$CLASS:
|
312 |
-
case util::$LOCATION:
|
313 |
-
case util::$STATUS:
|
314 |
-
case util::$SUMMARY:
|
315 |
-
case util::$TRANSP:
|
316 |
-
case util::$TZID:
|
317 |
-
case util::$UID:
|
318 |
-
if( false !== ( $content = $component->getProperty( $prop,
|
319 |
-
false,
|
320 |
-
true ))) {
|
321 |
-
if((( util::$LOCATION == $prop ) ||
|
322 |
-
( util::$SUMMARY == $prop )) &&
|
323 |
-
! isset( $content[util::$LCparams][util::$LANGUAGE] )) {
|
324 |
-
if( $langComp )
|
325 |
-
$content[util::$LCparams][util::$LANGUAGE] = $langComp;
|
326 |
-
elseif( $langCal )
|
327 |
-
$content[util::$LCparams][util::$LANGUAGE] = $langCal;
|
328 |
-
}
|
329 |
-
self::addXMLchild( $properties,
|
330 |
-
$prop,
|
331 |
-
self::$text,
|
332 |
-
$content[util::$LCvalue],
|
333 |
-
$content[util::$LCparams] );
|
334 |
-
}
|
335 |
-
break;
|
336 |
-
case util::$GEO:
|
337 |
-
if( false !== ( $content = $component->getProperty( $prop,
|
338 |
-
false,
|
339 |
-
true )))
|
340 |
-
self::addXMLchild( $properties,
|
341 |
-
$prop,
|
342 |
-
strtolower( util::$GEO ),
|
343 |
-
$content[util::$LCvalue],
|
344 |
-
$content[util::$LCparams] );
|
345 |
-
break;
|
346 |
-
case util::$ORGANIZER:
|
347 |
-
if( false !== ( $content = $component->getProperty( $prop,
|
348 |
-
false,
|
349 |
-
true ))) {
|
350 |
-
if( isset( $content[util::$LCparams][util::$CN] ) &&
|
351 |
-
! isset( $content[util::$LCparams][util::$LANGUAGE] )) {
|
352 |
-
if( $langComp )
|
353 |
-
$content[util::$LCparams][util::$LANGUAGE] = $langComp;
|
354 |
-
elseif( $langCal )
|
355 |
-
$content[util::$LCparams][util::$LANGUAGE] = $langCal;
|
356 |
-
}
|
357 |
-
self::addXMLchild( $properties,
|
358 |
-
$prop,
|
359 |
-
self::$cal_address,
|
360 |
-
$content[util::$LCvalue],
|
361 |
-
$content[util::$LCparams] );
|
362 |
-
}
|
363 |
-
break;
|
364 |
-
case util::$PERCENT_COMPLETE:
|
365 |
-
case util::$PRIORITY:
|
366 |
-
case util::$SEQUENCE:
|
367 |
-
if( false !== ( $content = $component->getProperty( $prop,
|
368 |
-
false,
|
369 |
-
true )))
|
370 |
-
self::addXMLchild( $properties,
|
371 |
-
$prop,
|
372 |
-
self::$integer,
|
373 |
-
$content[util::$LCvalue],
|
374 |
-
$content[util::$LCparams] );
|
375 |
-
break;
|
376 |
-
case util::$TZURL:
|
377 |
-
case util::$URL:
|
378 |
-
if( false !== ( $content = $component->getProperty( $prop,
|
379 |
-
false,
|
380 |
-
true )))
|
381 |
-
self::addXMLchild( $properties,
|
382 |
-
$prop,
|
383 |
-
self::$uri,
|
384 |
-
$content[util::$LCvalue],
|
385 |
-
$content[util::$LCparams] );
|
386 |
-
break;
|
387 |
-
} // end switch( $prop )
|
388 |
-
} // end foreach( $props as $pix => $prop )
|
389 |
-
/** fix subComponent properties, if any */
|
390 |
-
while( false !== ( $subcomp = $component->getComponent())) {
|
391 |
-
$subCompName = $subcomp->objName;
|
392 |
-
$child2 = $child->addChild( $subCompName );
|
393 |
-
$properties = $child2->addChild( self::$properties );
|
394 |
-
$langComp = $subcomp->getConfig( util::$LANGUAGE );
|
395 |
-
$subCompProps = $subcomp->getConfig( util::$SETPROPERTYNAMES );
|
396 |
-
foreach( $subCompProps as $pix2 => $prop ) {
|
397 |
-
switch( strtoupper( $prop )) {
|
398 |
-
case util::$ATTACH: // may occur multiple times, below
|
399 |
-
while( false !== ( $content = $subcomp->getProperty( $prop,
|
400 |
-
false,
|
401 |
-
true ))) {
|
402 |
-
$type = ( util::isParamsValueSet( $content, util::$BINARY ))
|
403 |
-
? self::$binary : self::$uri;
|
404 |
-
unset( $content[util::$LCparams][util::$VALUE] );
|
405 |
-
self::addXMLchild( $properties,
|
406 |
-
$prop,
|
407 |
-
$type,
|
408 |
-
$content[util::$LCvalue],
|
409 |
-
$content[util::$LCparams] );
|
410 |
-
}
|
411 |
-
break;
|
412 |
-
case util::$ATTENDEE:
|
413 |
-
while( false !== ( $content = $subcomp->getProperty( $prop,
|
414 |
-
false,
|
415 |
-
true ))) {
|
416 |
-
if( isset( $content[util::$LCparams][util::$CN] ) &&
|
417 |
-
! isset( $content[util::$LCparams][util::$LANGUAGE] )) {
|
418 |
-
if( $langComp )
|
419 |
-
$content[util::$LCparams][util::$LANGUAGE] = $langComp;
|
420 |
-
elseif( $langCal )
|
421 |
-
$content[util::$LCparams][util::$LANGUAGE] = $langCal;
|
422 |
-
}
|
423 |
-
self::addXMLchild( $properties,
|
424 |
-
$prop,
|
425 |
-
self::$cal_address,
|
426 |
-
$content[util::$LCvalue],
|
427 |
-
$content[util::$LCparams] );
|
428 |
-
}
|
429 |
-
break;
|
430 |
-
case util::$COMMENT:
|
431 |
-
case util::$TZNAME:
|
432 |
-
while( false !== ( $content = $subcomp->getProperty( $prop,
|
433 |
-
false,
|
434 |
-
true ))) {
|
435 |
-
if( ! isset( $content[util::$LCparams][util::$LANGUAGE] )) {
|
436 |
-
if( $langComp )
|
437 |
-
$content[util::$LCparams][util::$LANGUAGE] = $langComp;
|
438 |
-
elseif( $langCal )
|
439 |
-
$content[util::$LCparams][util::$LANGUAGE] = $langCal;
|
440 |
-
}
|
441 |
-
self::addXMLchild( $properties,
|
442 |
-
$prop,
|
443 |
-
self::$text,
|
444 |
-
$content[util::$LCvalue],
|
445 |
-
$content[util::$LCparams] );
|
446 |
-
}
|
447 |
-
break;
|
448 |
-
case util::$RDATE:
|
449 |
-
while( false !== ( $content = $subcomp->getProperty( $prop,
|
450 |
-
false,
|
451 |
-
true ))) {
|
452 |
-
$type = self::$date_time;
|
453 |
-
if( isset( $content[util::$LCparams][util::$VALUE] )) {
|
454 |
-
if( util::isParamsValueSet( $content, util::$DATE ))
|
455 |
-
$type = self::$date;
|
456 |
-
elseif( util::isParamsValueSet( $content, util::$PERIOD ))
|
457 |
-
$type = self::$period;
|
458 |
-
}
|
459 |
-
unset( $content[util::$LCparams][util::$VALUE] );
|
460 |
-
self::addXMLchild( $properties,
|
461 |
-
$prop,
|
462 |
-
$type,
|
463 |
-
$content[util::$LCvalue],
|
464 |
-
$content[util::$LCparams] );
|
465 |
-
}
|
466 |
-
break;
|
467 |
-
case util::$X_PROP:
|
468 |
-
while( false !== ( $content = $subcomp->getProperty( $prop,
|
469 |
-
false,
|
470 |
-
true )))
|
471 |
-
self::addXMLchild( $properties,
|
472 |
-
$content[0],
|
473 |
-
self::$unknown,
|
474 |
-
$content[1][util::$LCvalue],
|
475 |
-
$content[1][util::$LCparams] );
|
476 |
-
break;
|
477 |
-
case util::$ACTION: // single occurence below, if set
|
478 |
-
case util::$DESCRIPTION:
|
479 |
-
case util::$SUMMARY:
|
480 |
-
if( false !== ( $content = $subcomp->getProperty( $prop,
|
481 |
-
false,
|
482 |
-
true ))) {
|
483 |
-
if(( util::$ACTION != $prop ) &&
|
484 |
-
! isset( $content[util::$LCparams][util::$LANGUAGE] )) {
|
485 |
-
if( $langComp )
|
486 |
-
$content[util::$LCparams][util::$LANGUAGE] = $langComp;
|
487 |
-
elseif( $langCal )
|
488 |
-
$content[util::$LCparams][util::$LANGUAGE] = $langCal;
|
489 |
-
}
|
490 |
-
self::addXMLchild( $properties,
|
491 |
-
$prop,
|
492 |
-
self::$text,
|
493 |
-
$content[util::$LCvalue],
|
494 |
-
$content[util::$LCparams] );
|
495 |
-
}
|
496 |
-
break;
|
497 |
-
case util::$DTSTART:
|
498 |
-
if( false !== ( $content = $subcomp->getProperty( $prop,
|
499 |
-
false,
|
500 |
-
true ))) {
|
501 |
-
unset( $content[util::$LCvalue][util::$LCtz],
|
502 |
-
$content[util::$LCparams][util::$VALUE] ); // always local time
|
503 |
-
self::addXMLchild( $properties,
|
504 |
-
$prop,
|
505 |
-
self::$date_time,
|
506 |
-
$content[util::$LCvalue],
|
507 |
-
$content[util::$LCparams] );
|
508 |
-
}
|
509 |
-
break;
|
510 |
-
case util::$DURATION:
|
511 |
-
if( false !== ( $content = $subcomp->getProperty( $prop,
|
512 |
-
false,
|
513 |
-
true )))
|
514 |
-
self::addXMLchild( $properties,
|
515 |
-
$prop,
|
516 |
-
strtolower( util::$DURATION ),
|
517 |
-
$content[util::$LCvalue],
|
518 |
-
$content[util::$LCparams] );
|
519 |
-
break;
|
520 |
-
case util::$REPEAT:
|
521 |
-
if( false !== ( $content = $subcomp->getProperty( $prop,
|
522 |
-
false,
|
523 |
-
true )))
|
524 |
-
self::addXMLchild( $properties,
|
525 |
-
$prop,
|
526 |
-
self::$integer,
|
527 |
-
$content[util::$LCvalue],
|
528 |
-
$content[util::$LCparams] );
|
529 |
-
break;
|
530 |
-
case util::$TRIGGER:
|
531 |
-
if( false !== ( $content = $subcomp->getProperty( $prop,
|
532 |
-
false,
|
533 |
-
true ))) {
|
534 |
-
if( isset( $content[util::$LCvalue][util::$LCYEAR] ) &&
|
535 |
-
isset( $content[util::$LCvalue][util::$LCMONTH] ) &&
|
536 |
-
isset( $content[util::$LCvalue][util::$LCDAY] ))
|
537 |
-
$type = self::$date_time;
|
538 |
-
else {
|
539 |
-
$type = strtolower( util::$DURATION );
|
540 |
-
if( ! isset( $content[util::$LCvalue][self::$relatedStart] ) ||
|
541 |
-
( true !== $content[util::$LCvalue][self::$relatedStart] ))
|
542 |
-
$content[util::$LCparams][self::$RELATED] = self::$END;
|
543 |
-
}
|
544 |
-
self::addXMLchild( $properties,
|
545 |
-
$prop,
|
546 |
-
$type,
|
547 |
-
$content[util::$LCvalue],
|
548 |
-
$content[util::$LCparams] );
|
549 |
-
}
|
550 |
-
break;
|
551 |
-
case util::$TZOFFSETFROM:
|
552 |
-
case util::$TZOFFSETTO:
|
553 |
-
if( false !== ( $content = $subcomp->getProperty( $prop,
|
554 |
-
false,
|
555 |
-
true )))
|
556 |
-
self::addXMLchild( $properties,
|
557 |
-
$prop,
|
558 |
-
self::$utc_offset,
|
559 |
-
$content[util::$LCvalue],
|
560 |
-
$content[util::$LCparams] );
|
561 |
-
break;
|
562 |
-
case util::$RRULE:
|
563 |
-
while( false !== ( $content = $subcomp->getProperty( $prop,
|
564 |
-
false,
|
565 |
-
true )))
|
566 |
-
self::addXMLchild( $properties,
|
567 |
-
$prop,
|
568 |
-
self::$recur,
|
569 |
-
$content[util::$LCvalue],
|
570 |
-
$content[util::$LCparams] );
|
571 |
-
break;
|
572 |
-
} // switch( $prop )
|
573 |
-
} // end foreach( $subCompProps as $pix2 => $prop )
|
574 |
-
} // end while( false !== ( $subcomp = $component->getComponent()))
|
575 |
-
} // end while( false !== ( $component = $calendar->getComponent()))
|
576 |
-
return $xml->asXML();
|
577 |
-
}
|
578 |
-
/**
|
579 |
-
* Add XML (rfc6321) children to a SimpleXMLelement
|
580 |
-
*
|
581 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
582 |
-
* @since 2.23.8 - 2017-04-17
|
583 |
-
* @param SimpleXMLElement $parent a SimpleXMLelement node
|
584 |
-
* @param string $name new element node name
|
585 |
-
* @param string $type content type, subelement(-s) name
|
586 |
-
* @param string $content new subelement content
|
587 |
-
* @param array $params new element 'attributes'
|
588 |
-
* @access private
|
589 |
-
* @static
|
590 |
-
*/
|
591 |
-
private static function addXMLchild( \SimpleXMLElement & $parent, $name, $type, $content, $params=[] ) {
|
592 |
-
static $FMTYMD = '%04d-%02d-%02d';
|
593 |
-
static $FMTYMDHIS = '%04d-%02d-%02dT%02d:%02d:%02d';
|
594 |
-
static $PLUSMINUSARR = ['+', '-'];
|
595 |
-
static $BOOLEAN = 'boolean';
|
596 |
-
static $UNTIL = 'until';
|
597 |
-
static $START = 'start';
|
598 |
-
static $END = 'end';
|
599 |
-
static $BEFORE = 'before';
|
600 |
-
static $SP0 = '';
|
601 |
-
/** create new child node */
|
602 |
-
$name = strtolower( $name );
|
603 |
-
$child = $parent->addChild( $name );
|
604 |
-
if( ! empty( $params )) {
|
605 |
-
$parameters = $child->addChild( self::$PARAMETERS );
|
606 |
-
foreach( $params as $param => $parVal ) {
|
607 |
-
if( util::$VALUE == $param ) {
|
608 |
-
if( strtolower( $type ) != strtolower( $parVal ))
|
609 |
-
$type = strtolower( $parVal );
|
610 |
-
continue;
|
611 |
-
}
|
612 |
-
$param = strtolower( $param );
|
613 |
-
if( util::isXprefixed( $param )) {
|
614 |
-
$p1 = $parameters->addChild( $param );
|
615 |
-
$p2 = $p1->addChild( self::$unknown, htmlspecialchars( $parVal ));
|
616 |
-
}
|
617 |
-
else {
|
618 |
-
$p1 = $parameters->addChild( $param );
|
619 |
-
switch( $param ) {
|
620 |
-
case self::$altrep:
|
621 |
-
case self::$dir:
|
622 |
-
$ptype = self::$uri;
|
623 |
-
break;
|
624 |
-
case self::$delegated_from:
|
625 |
-
case self::$delegated_to:
|
626 |
-
case self::$member:
|
627 |
-
case self::$sent_by:
|
628 |
-
$ptype = self::$cal_address;
|
629 |
-
break;
|
630 |
-
case self::$rsvp:
|
631 |
-
$ptype = $BOOLEAN;
|
632 |
-
break ;
|
633 |
-
default:
|
634 |
-
$ptype = self::$text;
|
635 |
-
break;
|
636 |
-
}
|
637 |
-
if( is_array( $parVal )) {
|
638 |
-
foreach( $parVal as $pV )
|
639 |
-
$p2 = $p1->addChild( $ptype, htmlspecialchars( $pV ));
|
640 |
-
}
|
641 |
-
else
|
642 |
-
$p2 = $p1->addChild( $ptype, htmlspecialchars( $parVal ));
|
643 |
-
}
|
644 |
-
}
|
645 |
-
} // end if( ! empty( $params ))
|
646 |
-
if(( empty( $content ) && ( util::$ZERO != $content )) ||
|
647 |
-
( ! is_array( $content) &&
|
648 |
-
( util::$MINUS != $content[0] ) &&
|
649 |
-
( 0 > $content )))
|
650 |
-
return;
|
651 |
-
/** store content */
|
652 |
-
switch( $type ) {
|
653 |
-
case self::$binary:
|
654 |
-
$v = $child->addChild( $type, $content );
|
655 |
-
break;
|
656 |
-
case $BOOLEAN:
|
657 |
-
break;
|
658 |
-
case self::$cal_address:
|
659 |
-
$v = $child->addChild( $type, $content );
|
660 |
-
break;
|
661 |
-
case self::$date:
|
662 |
-
if( array_key_exists( util::$LCYEAR, $content ))
|
663 |
-
$content = [$content];
|
664 |
-
foreach( $content as $date ) {
|
665 |
-
$str = sprintf( $FMTYMD, (int) $date[util::$LCYEAR],
|
666 |
-
(int) $date[util::$LCMONTH],
|
667 |
-
(int) $date[util::$LCDAY] );
|
668 |
-
$v = $child->addChild( $type, $str );
|
669 |
-
}
|
670 |
-
break;
|
671 |
-
case self::$date_time:
|
672 |
-
if( array_key_exists( util::$LCYEAR, $content ))
|
673 |
-
$content = [$content];
|
674 |
-
foreach( $content as $dt ) {
|
675 |
-
if( ! isset( $dt[util::$LCHOUR] )) $dt[util::$LCHOUR] = 0;
|
676 |
-
if( ! isset( $dt[util::$LCMIN] )) $dt[util::$LCMIN] = 0;
|
677 |
-
if( ! isset( $dt[util::$LCSEC] )) $dt[util::$LCSEC] = 0;
|
678 |
-
$str = sprintf( $FMTYMDHIS, (int) $dt[util::$LCYEAR],
|
679 |
-
(int) $dt[util::$LCMONTH],
|
680 |
-
(int) $dt[util::$LCDAY],
|
681 |
-
(int) $dt[util::$LCHOUR],
|
682 |
-
(int) $dt[util::$LCMIN],
|
683 |
-
(int) $dt[util::$LCSEC] );
|
684 |
-
if( isset( $dt[util::$LCtz] ) &&
|
685 |
-
( util::$Z == $dt[util::$LCtz] ))
|
686 |
-
$str .= util::$Z;
|
687 |
-
$v = $child->addChild( $type, $str );
|
688 |
-
}
|
689 |
-
break;
|
690 |
-
case strtolower( util::$DURATION ):
|
691 |
-
$output = (( strtolower( util::$TRIGGER ) == $name ) &&
|
692 |
-
( false !== $content[$BEFORE] )) ? util::$MINUS : null;
|
693 |
-
$v = $child->addChild( $type, $output . util::duration2str( $content ));
|
694 |
-
break;
|
695 |
-
case strtolower( util::$GEO ):
|
696 |
-
if( ! empty( $content )) {
|
697 |
-
$v1 = $child->addChild( utilGeo::$LATITUDE,
|
698 |
-
utilGeo::geo2str2( $content[utilGeo::$LATITUDE],
|
699 |
-
utilGeo::$geoLatFmt ));
|
700 |
-
$v1 = $child->addChild( utilGeo::$LONGITUDE,
|
701 |
-
utilGeo::geo2str2( $content[utilGeo::$LONGITUDE],
|
702 |
-
utilGeo::$geoLongFmt ));
|
703 |
-
}
|
704 |
-
break;
|
705 |
-
case self::$integer:
|
706 |
-
$v = $child->addChild( $type, (string) $content );
|
707 |
-
break;
|
708 |
-
case self::$period:
|
709 |
-
if( ! is_array( $content ))
|
710 |
-
break;
|
711 |
-
foreach( $content as $period ) {
|
712 |
-
$v1 = $child->addChild( $type );
|
713 |
-
$str = sprintf( $FMTYMDHIS, (int) $period[0][util::$LCYEAR],
|
714 |
-
(int) $period[0][util::$LCMONTH],
|
715 |
-
(int) $period[0][util::$LCDAY],
|
716 |
-
(int) $period[0][util::$LCHOUR],
|
717 |
-
(int) $period[0][util::$LCMIN],
|
718 |
-
(int) $period[0][util::$LCSEC] );
|
719 |
-
if( isset( $period[0][util::$LCtz] ) &&
|
720 |
-
( util::$Z == $period[0][util::$LCtz] ))
|
721 |
-
$str .= util::$Z;
|
722 |
-
$v2 = $v1->addChild( $START, $str );
|
723 |
-
if( array_key_exists( util::$LCYEAR, $period[1] )) {
|
724 |
-
$str = sprintf( $FMTYMDHIS, (int) $period[1][util::$LCYEAR],
|
725 |
-
(int) $period[1][util::$LCMONTH],
|
726 |
-
(int) $period[1][util::$LCDAY],
|
727 |
-
(int) $period[1][util::$LCHOUR],
|
728 |
-
(int) $period[1][util::$LCMIN],
|
729 |
-
(int) $period[1][util::$LCSEC] );
|
730 |
-
if( isset($period[1][util::$LCtz] ) &&
|
731 |
-
( util::$Z == $period[1][util::$LCtz] ))
|
732 |
-
$str .= util::$Z;
|
733 |
-
$v2 = $v1->addChild( $END, $str );
|
734 |
-
}
|
735 |
-
else
|
736 |
-
$v2 = $v1->addChild( strtolower( util::$DURATION ),
|
737 |
-
util::duration2str( $period[1] ));
|
738 |
-
}
|
739 |
-
break;
|
740 |
-
case self::$recur:
|
741 |
-
$content = array_change_key_case( $content );
|
742 |
-
foreach( $content as $rulelabel => $rulevalue ) {
|
743 |
-
switch( $rulelabel ) {
|
744 |
-
case $UNTIL:
|
745 |
-
if( isset( $rulevalue[util::$LCHOUR] ))
|
746 |
-
$str = sprintf( $FMTYMDHIS, (int) $rulevalue[util::$LCYEAR],
|
747 |
-
(int) $rulevalue[util::$LCMONTH],
|
748 |
-
(int) $rulevalue[util::$LCDAY],
|
749 |
-
(int) $rulevalue[util::$LCHOUR],
|
750 |
-
(int) $rulevalue[util::$LCMIN],
|
751 |
-
(int) $rulevalue[util::$LCSEC] ) . util::$Z;
|
752 |
-
else
|
753 |
-
$str = sprintf( $FMTYMD, (int) $rulevalue[util::$LCYEAR],
|
754 |
-
(int) $rulevalue[util::$LCMONTH],
|
755 |
-
(int) $rulevalue[util::$LCDAY] );
|
756 |
-
$v = $child->addChild( $rulelabel, $str );
|
757 |
-
break;
|
758 |
-
case self::$bysecond:
|
759 |
-
case self::$byminute:
|
760 |
-
case self::$byhour:
|
761 |
-
case self::$bymonthday:
|
762 |
-
case self::$byyearday:
|
763 |
-
case self::$byweekno:
|
764 |
-
case self::$bymonth:
|
765 |
-
case self::$bysetpos: {
|
766 |
-
if( is_array( $rulevalue )) {
|
767 |
-
foreach( $rulevalue as $vix => $valuePart )
|
768 |
-
$v = $child->addChild( $rulelabel, $valuePart );
|
769 |
-
}
|
770 |
-
else
|
771 |
-
$v = $child->addChild( $rulelabel, $rulevalue );
|
772 |
-
break;
|
773 |
-
}
|
774 |
-
case self::$byday: {
|
775 |
-
if( isset( $rulevalue[util::$DAY] )) {
|
776 |
-
$str = ( isset( $rulevalue[0] )) ? $rulevalue[0] : null;
|
777 |
-
$str .= $rulevalue[util::$DAY];
|
778 |
-
$p = $child->addChild( $rulelabel, $str );
|
779 |
-
}
|
780 |
-
else {
|
781 |
-
foreach( $rulevalue as $valuePart ) {
|
782 |
-
if( isset( $valuePart[util::$DAY] )) {
|
783 |
-
$str = ( isset( $valuePart[0] )) ? $valuePart[0] : null;
|
784 |
-
$str .= $valuePart[util::$DAY];
|
785 |
-
$p = $child->addChild( $rulelabel, $str );
|
786 |
-
}
|
787 |
-
else
|
788 |
-
$p = $child->addChild( $rulelabel, $valuePart );
|
789 |
-
}
|
790 |
-
}
|
791 |
-
break;
|
792 |
-
}
|
793 |
-
case self::$freq:
|
794 |
-
case self::$count:
|
795 |
-
case self::$interval:
|
796 |
-
case self::$wkst:
|
797 |
-
default:
|
798 |
-
$p = $child->addChild( $rulelabel, $rulevalue );
|
799 |
-
break;
|
800 |
-
} // end switch( $rulelabel )
|
801 |
-
} // end foreach( $content as $rulelabel => $rulevalue )
|
802 |
-
break;
|
803 |
-
case self::$rstatus:
|
804 |
-
$v = $child->addChild( self::$code,
|
805 |
-
number_format((float) $content[self::$statcode],
|
806 |
-
2,
|
807 |
-
util::$DOT,
|
808 |
-
$SP0 ));
|
809 |
-
$v = $child->addChild( strtolower( util::$DESCRIPTION ),
|
810 |
-
htmlspecialchars( $content[self::$text] ));
|
811 |
-
if( isset( $content[self::$extdata] ))
|
812 |
-
$v = $child->addChild( self::$data,
|
813 |
-
htmlspecialchars( $content[self::$extdata] ));
|
814 |
-
break;
|
815 |
-
case self::$text:
|
816 |
-
if( ! is_array( $content ))
|
817 |
-
$content = [$content];
|
818 |
-
foreach( $content as $part )
|
819 |
-
$v = $child->addChild( $type, htmlspecialchars( $part ));
|
820 |
-
break;
|
821 |
-
case self::$time:
|
822 |
-
break;
|
823 |
-
case self::$uri:
|
824 |
-
$v = $child->addChild( $type, $content );
|
825 |
-
break;
|
826 |
-
case self::$utc_offset:
|
827 |
-
if( in_array( $content[0], $PLUSMINUSARR )) {
|
828 |
-
$str = $content[0];
|
829 |
-
$content = substr( $content, 1 );
|
830 |
-
}
|
831 |
-
else
|
832 |
-
$str = util::$PLUS;
|
833 |
-
$str .= substr( $content, 0, 2 ) . util::$COLON . substr( $content, 2, 2 );
|
834 |
-
if( 4 < strlen( $content ))
|
835 |
-
$str .= util::$COLON . substr( $content, 4 );
|
836 |
-
$v = $child->addChild( $type, $str );
|
837 |
-
break;
|
838 |
-
case self::$unknown:
|
839 |
-
default:
|
840 |
-
if( is_array( $content ))
|
841 |
-
$content = implode( $content );
|
842 |
-
$v = $child->addChild( self::$unknown, htmlspecialchars( $content ));
|
843 |
-
break;
|
844 |
-
}
|
845 |
-
}
|
846 |
-
/**
|
847 |
-
* Parse (rfc6321) XML file into iCalcreator instance
|
848 |
-
*
|
849 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
850 |
-
* @since 2.16.22 - 2013-06-18
|
851 |
-
* @param string $xmlfile
|
852 |
-
* @param array $iCalcfg iCalcreator config array (opt)
|
853 |
-
* @return mixediCalcreator instance or false on error
|
854 |
-
* @static
|
855 |
-
*/
|
856 |
-
public static function XMLfile2iCal( $xmlfile, $iCalcfg=[] ) {
|
857 |
-
if( false === ( $xmlstr = file_get_contents( $xmlfile )))
|
858 |
-
return false;
|
859 |
-
return self::xml2iCal( $xmlstr, $iCalcfg );
|
860 |
-
}
|
861 |
-
/**
|
862 |
-
* Parse (rfc6321) XML string into iCalcreator instance, alias of XML2iCal
|
863 |
-
*
|
864 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
865 |
-
* @since 2.16.22 - 2013-06-18
|
866 |
-
* @param string $xmlstr
|
867 |
-
* @param array $iCalcfg iCalcreator config array (opt)
|
868 |
-
* @return mixed iCalcreator instance or false on error
|
869 |
-
* @static
|
870 |
-
*/
|
871 |
-
public static function XMLstr2iCal( $xmlstr, $iCalcfg=[] ) {
|
872 |
-
return self::XML2iCal( $xmlstr, $iCalcfg);
|
873 |
-
}
|
874 |
-
/**
|
875 |
-
* Parse (rfc6321) XML string into iCalcreator instance
|
876 |
-
*
|
877 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
878 |
-
* @since 2.20.23 - 2017-02-25
|
879 |
-
* @param string $xmlstr
|
880 |
-
* @param array $iCalcfg iCalcreator config array (opt)
|
881 |
-
* @return mixed iCalcreator instance or false on error
|
882 |
-
* @static
|
883 |
-
*/
|
884 |
-
public static function XML2iCal( $xmlstr, $iCalcfg=[] ) {
|
885 |
-
static $CRLF = ["\r\n", "\n\r", "\n", "\r"];
|
886 |
-
$xmlstr = str_replace( $CRLF, null, $xmlstr );
|
887 |
-
$xml = self::XMLgetTagContent1( $xmlstr, self::$vcalendar, $endIx );
|
888 |
-
$iCal = new vcalendar( $iCalcfg );
|
889 |
-
self::XMLgetComps( $iCal, $xmlstr );
|
890 |
-
return $iCal;
|
891 |
-
}
|
892 |
-
/**
|
893 |
-
* Parse (rfc6321) XML string into iCalcreator components
|
894 |
-
*
|
895 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
896 |
-
* @since 2.23.8 - 2017-04-14
|
897 |
-
* @param object $iCal iCalcreator vcalendar or component object instance
|
898 |
-
* @param string $xml
|
899 |
-
* @return object
|
900 |
-
* @access private
|
901 |
-
* @static
|
902 |
-
*/
|
903 |
-
private static function XMLgetComps( $iCal, $xml ) {
|
904 |
-
static $PROPSTAG = '<properties>';
|
905 |
-
static $COMPSTAG = '<components>';
|
906 |
-
$len = strlen( $xml );
|
907 |
-
$sx = 0;
|
908 |
-
while((( $sx + 12 ) < $len ) &&
|
909 |
-
( $PROPSTAG != substr( $xml, $sx, 12 )) &&
|
910 |
-
( $COMPSTAG != substr( $xml, $sx, 12 )))
|
911 |
-
$sx += 1;
|
912 |
-
if(( $sx + 11 ) >= $len )
|
913 |
-
return false;
|
914 |
-
if( $PROPSTAG == substr( $xml, $sx, 12 )) {
|
915 |
-
$xml2 = self::XMLgetTagContent1( $xml, self::$properties, $endIx );
|
916 |
-
self::XMLgetProps( $iCal, $xml2 );
|
917 |
-
$xml = substr( $xml, $endIx );
|
918 |
-
}
|
919 |
-
if( $COMPSTAG == substr( $xml, 0, 12 ))
|
920 |
-
$xml = self::XMLgetTagContent1( $xml, self::$components, $endIx );
|
921 |
-
while( ! empty( $xml )) {
|
922 |
-
$xml2 = self::XMLgetTagContent2( $xml, $tagName, $endIx );
|
923 |
-
if( in_array( strtolower( $tagName ), util::$ALLCOMPS ) &&
|
924 |
-
( false !== ( $subComp = $iCal->newComponent( $tagName ))))
|
925 |
-
self::XMLgetComps( $subComp, $xml2 );
|
926 |
-
$xml = substr( $xml, $endIx);
|
927 |
-
} // end while( ! empty( $xml ))
|
928 |
-
return $iCal;
|
929 |
-
}
|
930 |
-
/**
|
931 |
-
* Parse (rfc6321) XML into iCalcreator properties
|
932 |
-
*
|
933 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
934 |
-
* @since 2.23.3 - 2017-03-19
|
935 |
-
* @param object $iCal iCalcreator calendar/component instance
|
936 |
-
* @param string $xml
|
937 |
-
* @access private
|
938 |
-
* @static
|
939 |
-
*/
|
940 |
-
private static function XMLgetProps( $iCal, $xml) {
|
941 |
-
static $PARAMENDTAG = '<parameters/>';
|
942 |
-
static $PARAMTAG = '<parameters>';
|
943 |
-
static $DATETAGST = '<date';
|
944 |
-
static $PERIODTAG = '<period>';
|
945 |
-
while( ! empty( $xml )) {
|
946 |
-
$xml2 = self::XMLgetTagContent2( $xml, $propName, $endIx );
|
947 |
-
$propName = strtoupper( $propName );
|
948 |
-
if( empty( $xml2 ) && ( util::$ZERO != $xml2 )) {
|
949 |
-
$iCal->setProperty( $propName );
|
950 |
-
$xml = substr( $xml, $endIx);
|
951 |
-
continue;
|
952 |
-
}
|
953 |
-
$params = [];
|
954 |
-
if( $PARAMENDTAG == substr( $xml2, 0, 13 ))
|
955 |
-
$xml2 = substr( $xml2, 13 );
|
956 |
-
elseif( $PARAMTAG == substr( $xml2, 0, 12 )) {
|
957 |
-
$xml3 = self::XMLgetTagContent1( $xml2, self::$PARAMETERS, $endIx2 );
|
958 |
-
while( ! empty( $xml3 )) {
|
959 |
-
$xml4 = self::XMLgetTagContent2( $xml3, $paramKey, $endIx3 );
|
960 |
-
$pType = false; // skip parameter valueType
|
961 |
-
$paramKey = strtoupper( $paramKey );
|
962 |
-
if( in_array( $paramKey, util::$ATTENDEEPARKEYS )) {
|
963 |
-
while( ! empty( $xml4 )) {
|
964 |
-
$paramValue = self::XMLgetTagContent1( $xml4, self::$cal_address, $endIx4 );
|
965 |
-
if( ! isset( $params[$paramKey] ))
|
966 |
-
$params[$paramKey] = [$paramValue];
|
967 |
-
else
|
968 |
-
$params[$paramKey][] = $paramValue;
|
969 |
-
$xml4 = substr( $xml4, $endIx4 );
|
970 |
-
}
|
971 |
-
} // end if( in_array( $paramKey, util::$ATTENDEEPARKEYS ))
|
972 |
-
else {
|
973 |
-
$paramValue = html_entity_decode( self::XMLgetTagContent2( $xml4, $pType, $endIx4 ));
|
974 |
-
if( ! isset( $params[$paramKey] ))
|
975 |
-
$params[$paramKey] = $paramValue;
|
976 |
-
else
|
977 |
-
$params[$paramKey] .= util::$COMMA . $paramValue;
|
978 |
-
}
|
979 |
-
$xml3 = substr( $xml3, $endIx3 );
|
980 |
-
}
|
981 |
-
$xml2 = substr( $xml2, $endIx2 );
|
982 |
-
} // end elseif
|
983 |
-
$valueType = false;
|
984 |
-
$value = ( ! empty( $xml2 ) || ( util::$ZERO == $xml2 ))
|
985 |
-
? self::XMLgetTagContent2( $xml2, $valueType, $endIx3 ) : null;
|
986 |
-
switch( $propName ) {
|
987 |
-
case util::$CATEGORIES:
|
988 |
-
case util::$RESOURCES:
|
989 |
-
$tValue = [];
|
990 |
-
while( ! empty( $xml2 )) {
|
991 |
-
$tValue[] = html_entity_decode( self::XMLgetTagContent2( $xml2,
|
992 |
-
$valueType,
|
993 |
-
$endIx4 ));
|
994 |
-
$xml2 = substr( $xml2, $endIx4 );
|
995 |
-
}
|
996 |
-
$value = $tValue;
|
997 |
-
break;
|
998 |
-
case util::$EXDATE: // multiple single-date(-times) may exist
|
999 |
-
case util::$RDATE:
|
1000 |
-
if( self::$period != $valueType ) {
|
1001 |
-
if( self::$date == $valueType )
|
1002 |
-
$params[util::$VALUE] = util::$DATE;
|
1003 |
-
$t = [];
|
1004 |
-
while( ! empty( $xml2 ) &&
|
1005 |
-
( $DATETAGST == substr( $xml2, 0, 5 ))) {
|
1006 |
-
$t[] = self::XMLgetTagContent2( $xml2,
|
1007 |
-
$pType,
|
1008 |
-
$endIx4 );
|
1009 |
-
$xml2 = substr( $xml2, $endIx4 );
|
1010 |
-
}
|
1011 |
-
$value = $t;
|
1012 |
-
break;
|
1013 |
-
}
|
1014 |
-
case util::$FREEBUSY:
|
1015 |
-
if( util::$RDATE == $propName )
|
1016 |
-
$params[util::$VALUE] = util::$PERIOD;
|
1017 |
-
$value = [];
|
1018 |
-
while( ! empty( $xml2 ) &&
|
1019 |
-
( $PERIODTAG == substr( $xml2, 0, 8 ))) {
|
1020 |
-
$xml3 = self::XMLgetTagContent1( $xml2,
|
1021 |
-
self::$period,
|
1022 |
-
$endIx4 ); // period
|
1023 |
-
$t = [];
|
1024 |
-
while( ! empty( $xml3 )) {
|
1025 |
-
$t[] = self::XMLgetTagContent2( $xml3,
|
1026 |
-
$pType,
|
1027 |
-
$endIx5 ); // start - end/duration
|
1028 |
-
$xml3 = substr( $xml3, $endIx5 );
|
1029 |
-
}
|
1030 |
-
$value[] = $t;
|
1031 |
-
$xml2 = substr( $xml2, $endIx4 );
|
1032 |
-
}
|
1033 |
-
break;
|
1034 |
-
case util::$TZOFFSETTO:
|
1035 |
-
case util::$TZOFFSETFROM:
|
1036 |
-
$value = str_replace( util::$COLON, null, $value );
|
1037 |
-
break;
|
1038 |
-
case util::$GEO:
|
1039 |
-
$tValue = [utilGeo::$LATITUDE => $value];
|
1040 |
-
$tValue[utilGeo::$LONGITUDE] = self::XMLgetTagContent1( substr( $xml2, $endIx3 ),
|
1041 |
-
utilGeo::$LONGITUDE,
|
1042 |
-
$endIx3 );
|
1043 |
-
$value = $tValue;
|
1044 |
-
break;
|
1045 |
-
case util::$EXRULE:
|
1046 |
-
case util::$RRULE:
|
1047 |
-
$tValue = [$valueType => $value];
|
1048 |
-
$xml2 = substr( $xml2, $endIx3 );
|
1049 |
-
$valueType = false;
|
1050 |
-
while( ! empty( $xml2 )) {
|
1051 |
-
$t = self::XMLgetTagContent2( $xml2,
|
1052 |
-
$valueType,
|
1053 |
-
$endIx4 );
|
1054 |
-
switch( strtoupper( $valueType )) {
|
1055 |
-
case util::$FREQ:
|
1056 |
-
case util::$COUNT:
|
1057 |
-
case util::$UNTIL:
|
1058 |
-
case util::$INTERVAL:
|
1059 |
-
case util::$WKST:
|
1060 |
-
$tValue[$valueType] = $t;
|
1061 |
-
break;
|
1062 |
-
case util::$BYDAY:
|
1063 |
-
if( 2 == strlen( $t ))
|
1064 |
-
$tValue[$valueType][] = [util::$DAY => $t];
|
1065 |
-
else {
|
1066 |
-
$day = substr( $t, -2 );
|
1067 |
-
$key = substr( $t, 0, ( strlen( $t ) - 2 ));
|
1068 |
-
$tValue[$valueType][] = [$key, util::$DAY => $day];
|
1069 |
-
}
|
1070 |
-
break;
|
1071 |
-
default:
|
1072 |
-
$tValue[$valueType][] = $t;
|
1073 |
-
}
|
1074 |
-
$xml2 = substr( $xml2, $endIx4 );
|
1075 |
-
}
|
1076 |
-
$value = $tValue;
|
1077 |
-
break;
|
1078 |
-
case util::$REQUEST_STATUS:
|
1079 |
-
$tValue = [];
|
1080 |
-
while( ! empty( $xml2 )) {
|
1081 |
-
$t = html_entity_decode( self::XMLgetTagContent2( $xml2,
|
1082 |
-
$valueType,
|
1083 |
-
$endIx4 ));
|
1084 |
-
$tValue[$valueType] = $t;
|
1085 |
-
$xml2 = substr( $xml2, $endIx4 );
|
1086 |
-
}
|
1087 |
-
if( ! empty( $tValue ))
|
1088 |
-
$value = $tValue;
|
1089 |
-
else
|
1090 |
-
$value = [self::$code => null,
|
1091 |
-
strtolower( util::$DESCRIPTION ) => null];
|
1092 |
-
break;
|
1093 |
-
default:
|
1094 |
-
switch( $valueType ) {
|
1095 |
-
case self::$binary :
|
1096 |
-
$params[util::$VALUE] = util::$BINARY;
|
1097 |
-
break;
|
1098 |
-
case self::$date :
|
1099 |
-
$params[util::$VALUE] = util::$DATE;
|
1100 |
-
break;
|
1101 |
-
case self::$date_time :
|
1102 |
-
$params[util::$VALUE] = util::$DATE_TIME;
|
1103 |
-
break;
|
1104 |
-
case self::$text :
|
1105 |
-
case self::$unknown :
|
1106 |
-
$value = html_entity_decode( $value );
|
1107 |
-
break;
|
1108 |
-
default :
|
1109 |
-
if( util::isXprefixed( $propName ) &&
|
1110 |
-
( self::$unknown != strtolower( $valueType )))
|
1111 |
-
$params[util::$VALUE] = strtoupper( $valueType );
|
1112 |
-
break;
|
1113 |
-
}
|
1114 |
-
break;
|
1115 |
-
} // end switch( $propName )
|
1116 |
-
if( util::$FREEBUSY == $propName ) {
|
1117 |
-
$fbtype = $params[self::$FBTYPE];
|
1118 |
-
unset( $params[self::$FBTYPE] );
|
1119 |
-
$iCal->setProperty( $propName, $fbtype, $value, $params );
|
1120 |
-
}
|
1121 |
-
elseif( util::$GEO == $propName ) {
|
1122 |
-
$iCal->setProperty( $propName, $value[self::$latitude],
|
1123 |
-
$value[self::$longitude],
|
1124 |
-
$params );
|
1125 |
-
}
|
1126 |
-
elseif( util::$REQUEST_STATUS == $propName ) {
|
1127 |
-
if( ! isset( $value[self::$data] ))
|
1128 |
-
$value[self::$data] = false;
|
1129 |
-
$iCal->setProperty( $propName, $value[self::$code],
|
1130 |
-
$value[strtolower( util::$DESCRIPTION )],
|
1131 |
-
$value[self::$data], $params );
|
1132 |
-
}
|
1133 |
-
else {
|
1134 |
-
if( empty( $value ) && ( is_array( $value ) || ( util::$ZERO > $value )))
|
1135 |
-
$value = null;
|
1136 |
-
$iCal->setProperty( $propName, $value, $params );
|
1137 |
-
}
|
1138 |
-
$xml = substr( $xml, $endIx);
|
1139 |
-
} // end while( ! empty( $xml ))
|
1140 |
-
}
|
1141 |
-
/**
|
1142 |
-
* Fetch a specific XML tag content
|
1143 |
-
*
|
1144 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1145 |
-
* @since 2.23.8 - 2017-04-17
|
1146 |
-
* @param string $xml
|
1147 |
-
* @param string $tagName
|
1148 |
-
* @param int $endIx
|
1149 |
-
* @return mixed
|
1150 |
-
* @access private
|
1151 |
-
* @static
|
1152 |
-
*/
|
1153 |
-
private static function XMLgetTagContent1( $xml, $tagName, & $endIx=0 ) {
|
1154 |
-
static $FMT0 = '<%s>';
|
1155 |
-
static $FMT1 = '<%s />';
|
1156 |
-
static $FMT2 = '<%s/>';
|
1157 |
-
static $FMT3 = '</%s>';
|
1158 |
-
$tagName = strtolower( $tagName );
|
1159 |
-
$strLen = strlen( $tagName );
|
1160 |
-
$xmlLen = strlen( $xml );
|
1161 |
-
$sx1 = 0;
|
1162 |
-
while( $sx1 < $xmlLen ) {
|
1163 |
-
if((( $sx1 + $strLen + 1 ) < $xmlLen ) &&
|
1164 |
-
( sprintf( $FMT0, $tagName ) == strtolower( substr( $xml, $sx1, ( $strLen + 2 )))))
|
1165 |
-
break;
|
1166 |
-
if((( $sx1 + $strLen + 3 ) < $xmlLen ) &&
|
1167 |
-
( sprintf( $FMT1, $tagName ) == strtolower( substr( $xml, $sx1, ( $strLen + 4 ))))) {
|
1168 |
-
$endIx = $strLen + 5;
|
1169 |
-
return null; // empty tag
|
1170 |
-
}
|
1171 |
-
if((( $sx1 + $strLen + 2 ) < $xmlLen ) &&
|
1172 |
-
( sprintf( $FMT2, $tagName ) == strtolower( substr( $xml, $sx1, ( $strLen + 3 ))))) {
|
1173 |
-
$endIx = $strLen + 4;
|
1174 |
-
return null; // empty tag
|
1175 |
-
}
|
1176 |
-
$sx1 += 1;
|
1177 |
-
} // end while...
|
1178 |
-
if( false === substr( $xml, $sx1, 1 )) {
|
1179 |
-
$endIx = ( empty( $sx )) ? 0 : $sx - 1; // ??
|
1180 |
-
return null;
|
1181 |
-
}
|
1182 |
-
$endTag = sprintf( $FMT3, $tagName );
|
1183 |
-
if( false === ( $pos = stripos( $xml, $endTag ))) { // missing end tag??
|
1184 |
-
$endIx = $xmlLen + 1;
|
1185 |
-
return null;
|
1186 |
-
}
|
1187 |
-
$endIx = $pos + $strLen + 3;
|
1188 |
-
return substr( $xml, ( $sx1 + $strLen + 2 ), ( $pos - $sx1 - 2 - $strLen ));
|
1189 |
-
}
|
1190 |
-
/**
|
1191 |
-
* Fetch next (unknown) XML tagname AND content
|
1192 |
-
*
|
1193 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1194 |
-
* @since 2.23.8 - 2017-04-17
|
1195 |
-
* @param string $xml
|
1196 |
-
* @param string $tagName
|
1197 |
-
* @param int $endIx
|
1198 |
-
* @return mixed
|
1199 |
-
* @access private
|
1200 |
-
* @static
|
1201 |
-
*/
|
1202 |
-
private static function XMLgetTagContent2( $xml, & $tagName, & $endIx ) {
|
1203 |
-
static $LT = '<';
|
1204 |
-
static $CMTSTART = '<!--';
|
1205 |
-
static $EMPTYTAGEND = '/>';
|
1206 |
-
static $GT = '>';
|
1207 |
-
static $DURATION = 'duration';
|
1208 |
-
static $DURATIONTAG = '<duration>';
|
1209 |
-
static $DURENDTAG = '</duration>';
|
1210 |
-
static $FMTTAG = '</%s>';
|
1211 |
-
$xmlLen = strlen( $xml );
|
1212 |
-
$endIx = $xmlLen + 1; // just in case.. .
|
1213 |
-
$sx1 = 0;
|
1214 |
-
while( $sx1 < $xmlLen ) {
|
1215 |
-
if( $LT == substr( $xml, $sx1, 1 )) {
|
1216 |
-
if((( $sx1 + 3 ) < $xmlLen ) &&
|
1217 |
-
( $CMTSTART == substr( $xml, $sx1, 4 ))) // skip comment
|
1218 |
-
$sx1 += 1;
|
1219 |
-
else
|
1220 |
-
break; // tagname start here
|
1221 |
-
}
|
1222 |
-
else
|
1223 |
-
$sx1 += 1;
|
1224 |
-
} // end while...
|
1225 |
-
$sx2 = $sx1;
|
1226 |
-
while( $sx2 < $xmlLen ) {
|
1227 |
-
if((( $sx2 + 1 ) < $xmlLen ) &&
|
1228 |
-
( $EMPTYTAGEND == substr( $xml, $sx2, 2 ))) { // tag with no content
|
1229 |
-
$tagName = trim( substr( $xml, ( $sx1 + 1 ), ( $sx2 - $sx1 - 1 )));
|
1230 |
-
$endIx = $sx2 + 2;
|
1231 |
-
return null;
|
1232 |
-
}
|
1233 |
-
if( $GT == substr( $xml, $sx2, 1 )) // tagname ends here
|
1234 |
-
break;
|
1235 |
-
$sx2 += 1;
|
1236 |
-
} // end while...
|
1237 |
-
$tagName = substr( $xml, ( $sx1 + 1 ), ( $sx2 - $sx1 - 1 ));
|
1238 |
-
$endIx = $sx2 + 1;
|
1239 |
-
if( $sx2 >= $xmlLen )
|
1240 |
-
return null;
|
1241 |
-
$strLen = strlen( $tagName );
|
1242 |
-
if(( $DURATION == $tagName ) &&
|
1243 |
-
( false !== ( $pos1 = stripos( $xml, $DURATIONTAG, $sx1+1 ))) &&
|
1244 |
-
( false !== ( $pos2 = stripos( $xml, $DURENDTAG, $pos1+1 ))) &&
|
1245 |
-
( false !== ( $pos3 = stripos( $xml, $DURENDTAG, $pos2+1 ))) &&
|
1246 |
-
( $pos1 < $pos2 ) && ( $pos2 < $pos3 ))
|
1247 |
-
$pos = $pos3;
|
1248 |
-
elseif( false === ( $pos = stripos( $xml, sprintf( $FMTTAG, $tagName ), $sx2 )))
|
1249 |
-
return null;
|
1250 |
-
$endIx = $pos + $strLen + 3;
|
1251 |
-
return substr( $xml, ( $sx1 + $strLen + 2 ), ( $pos - $strLen - 2 ));
|
1252 |
-
}
|
1253 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/iCaldateTime.php
DELETED
@@ -1,162 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
|
32 |
-
namespace kigkonsult\iCalcreator;
|
33 |
-
|
34 |
-
use DateTime;
|
35 |
-
use DateTimeZone;
|
36 |
-
use Exception;
|
37 |
-
use kigkonsult\iCalcreator\util\util;
|
38 |
-
|
39 |
-
/**
|
40 |
-
* iCalcreator::selectComponent dateTime support class
|
41 |
-
*
|
42 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
43 |
-
* @since 2.23.20 - 2017-02-07
|
44 |
-
*/
|
45 |
-
class iCaldateTime extends DateTime {
|
46 |
-
|
47 |
-
/**
|
48 |
-
* @var string default date[-time] format
|
49 |
-
*/
|
50 |
-
public $dateFormat = 'Y-m-d H:i:s e';
|
51 |
-
|
52 |
-
/**
|
53 |
-
* @var string default object instance date[-time] 'key'
|
54 |
-
*/
|
55 |
-
public $key = null;
|
56 |
-
|
57 |
-
/**
|
58 |
-
* @var array date[-time] origin
|
59 |
-
*/
|
60 |
-
public $SCbools = [];
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Return time (His) array
|
64 |
-
*
|
65 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
66 |
-
* @since 2.23.20 - 2017-02-07
|
67 |
-
* @return array
|
68 |
-
*/
|
69 |
-
public function getTime() {
|
70 |
-
static $H_I_S = 'H:i:s';
|
71 |
-
return explode( util::$COLON, $this->format( $H_I_S ));
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Return the timezone name
|
76 |
-
*
|
77 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
78 |
-
* @since 2.21.7 - 2015-03-07
|
79 |
-
* @return string
|
80 |
-
*/
|
81 |
-
public function getTimezoneName() {
|
82 |
-
$tz = $this->getTimezone();
|
83 |
-
return $tz->getName();
|
84 |
-
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Return formatted date
|
88 |
-
*
|
89 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
90 |
-
* @since 2.21.7 - 2015-03-07
|
91 |
-
* @param string $format
|
92 |
-
* @return string
|
93 |
-
*/
|
94 |
-
public function format( $format=null ) {
|
95 |
-
if( empty( $format ) && isset( $this->dateFormat )) {
|
96 |
-
$format = $this->dateFormat;
|
97 |
-
}
|
98 |
-
return parent::format( $format );
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Return iCaldateTime object instance based on date array and timezone(s)
|
103 |
-
*
|
104 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
105 |
-
* @since 2.23.20 - 2017-03-04
|
106 |
-
* @param array $date
|
107 |
-
* @param array $params
|
108 |
-
* @param array $tz
|
109 |
-
* @param string $dtstartTz
|
110 |
-
* @return object
|
111 |
-
* @static
|
112 |
-
*/
|
113 |
-
public static function factory( array $date, $params=null, $tz=null, $dtstartTz=null ) {
|
114 |
-
static $YMDHIS = 'YmdHis';
|
115 |
-
static $YMD = 'Ymd';
|
116 |
-
static $Y_M_D = 'Y-m-d';
|
117 |
-
if( isset( $params[util::$TZID] ) && ! empty( $params[util::$TZID] )) {
|
118 |
-
$tz = ( util::$Z == $params[util::$TZID] ) ? util::$UTC : $params[util::$TZID];
|
119 |
-
}
|
120 |
-
elseif( isset( $tz[util::$LCtz] ) && ! empty( $tz[util::$LCtz] )) {
|
121 |
-
$tz = ( util::$Z == $tz[util::$LCtz] ) ? util::$UTC : $tz[util::$LCtz];
|
122 |
-
}
|
123 |
-
else {
|
124 |
-
$tz = date_default_timezone_get();
|
125 |
-
}
|
126 |
-
$strdate = sprintf( util::$YMD, (int) $date[util::$LCYEAR],
|
127 |
-
(int) $date[util::$LCMONTH],
|
128 |
-
(int) $date[util::$LCDAY] );
|
129 |
-
if( isset( $date[util::$LCHOUR] )) {
|
130 |
-
$strdate .= util::$T . sprintf( util::$HIS, (int) $date[util::$LCHOUR],
|
131 |
-
(int) $date[util::$LCMIN],
|
132 |
-
(int) $date[util::$LCSEC] );
|
133 |
-
}
|
134 |
-
try {
|
135 |
-
$timezone = new DateTimeZone( $tz );
|
136 |
-
$iCaldateTime = new iCaldateTime( $strdate, $timezone );
|
137 |
-
}
|
138 |
-
catch( Exception $e ) {
|
139 |
-
$iCaldateTime = new iCaldateTime( $strdate );
|
140 |
-
}
|
141 |
-
if( ! empty( $dtstartTz )) {
|
142 |
-
if( util::$Z == $dtstartTz ) {
|
143 |
-
$dtstartTz = util::$UTC;
|
144 |
-
}
|
145 |
-
if( $dtstartTz != $iCaldateTime->getTimezoneName()) { // set the same timezone as dtstart
|
146 |
-
try {
|
147 |
-
$timezone = new DateTimeZone( $dtstartTz );
|
148 |
-
$iCaldateTime->setTimezone( $timezone );
|
149 |
-
}
|
150 |
-
catch( Exception $e ) {} // ??
|
151 |
-
}
|
152 |
-
}
|
153 |
-
if( util::isParamsValueSet( [util::$LCparams => $params], util::$DATE )) {
|
154 |
-
$iCaldateTime->dateFormat = $Y_M_D;
|
155 |
-
$iCaldateTime->key = $iCaldateTime->format( $YMD );
|
156 |
-
}
|
157 |
-
else {
|
158 |
-
$iCaldateTime->key = $iCaldateTime->format( $YMDHIS );
|
159 |
-
}
|
160 |
-
return $iCaldateTime;
|
161 |
-
}
|
162 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/iCalvCard.php
DELETED
@@ -1,199 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* iCalcreator vCard support class
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.20 - 2017-01-30
|
38 |
-
*/
|
39 |
-
class iCalvCard {
|
40 |
-
/**
|
41 |
-
* Convert single ATTENDEE, CONTACT or ORGANIZER (in email format) to vCard
|
42 |
-
*
|
43 |
-
* Returns vCard/true or if directory (if set) or file write is unvalid, false
|
44 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
45 |
-
* @since 2.23.8 - 2017-04-17
|
46 |
-
* @param string $email
|
47 |
-
* @param string $version vCard version (default 2.1)
|
48 |
-
* @param string $directory where to save vCards (default false)
|
49 |
-
* @param string $ext vCard file extension (default 'vcf')
|
50 |
-
* @return mixed bool true (if directory set and save ok), string (if not), false on error
|
51 |
-
* @static
|
52 |
-
*/
|
53 |
-
public static function iCal2vCard( $email, $version=null, $directory=null, $ext=null ) {
|
54 |
-
static $UCMAILTOCOLON = 'MAILTO:';
|
55 |
-
static $CRLF = "\r\n";
|
56 |
-
static $FMTFN = "FN:%s\r\n";
|
57 |
-
static $FMTN = 'N:%s';
|
58 |
-
static $V2_1 = '2.1';
|
59 |
-
static $AT = '@';
|
60 |
-
static $V4_0 = '4.0';
|
61 |
-
static $FMTEMAIL = "EMAIL:%s\r\n";
|
62 |
-
static $BEGINVCARD = "BEGIN:VCARD\r\n";
|
63 |
-
static $FMTVERSION = "VERSION:%s\r\n";
|
64 |
-
static $FMTPRODID = "PRODID:-//kigkonsult.se %s\r\n";
|
65 |
-
static $FMTREV = "REV:%s\r\n";
|
66 |
-
static $YMDTHISZ = 'Ymd\THis\Z';
|
67 |
-
static $ENDVCARD = "END:VCARD\r\n";
|
68 |
-
static $EXPR = '/[^a-z0-9.]/i';
|
69 |
-
static $FMTFNAME = '%s%s%s.%s';
|
70 |
-
static $EXTVCF = 'vcf';
|
71 |
-
if( empty( $version ))
|
72 |
-
$version = $V2_1;
|
73 |
-
if( false === ( $pos = strpos( $email, $AT )))
|
74 |
-
return false;
|
75 |
-
if( $directory ) {
|
76 |
-
if( DIRECTORY_SEPARATOR != substr( $directory, ( 0 - strlen( DIRECTORY_SEPARATOR ))))
|
77 |
-
$directory .= DIRECTORY_SEPARATOR;
|
78 |
-
if( ! is_dir( $directory ) || ! is_writable( $directory ))
|
79 |
-
return false;
|
80 |
-
}
|
81 |
-
/* prepare vCard */
|
82 |
-
$email = str_replace( $UCMAILTOCOLON, null, $email );
|
83 |
-
$name = $person = substr( $email, 0, $pos );
|
84 |
-
if( ctype_upper( $name ) || ctype_lower( $name ))
|
85 |
-
$name = [$name];
|
86 |
-
else {
|
87 |
-
if( false !== ( $pos = strpos( $name, util::$DOT ))) {
|
88 |
-
$name = explode( util::$DOT, $name );
|
89 |
-
foreach( $name as $k => $part )
|
90 |
-
$name[$k] = ucfirst( $part );
|
91 |
-
}
|
92 |
-
else { // split camelCase
|
93 |
-
$chars = $name;
|
94 |
-
$name = [$chars[0]];
|
95 |
-
$k = 0;
|
96 |
-
$len = strlen( $chars );
|
97 |
-
$x = 1;
|
98 |
-
while( $x < $len ) {
|
99 |
-
if( ctype_upper( $chars[$x] )) {
|
100 |
-
$k += 1;
|
101 |
-
$name[$k] = null;
|
102 |
-
}
|
103 |
-
$name[$k] .= $chars[$x];
|
104 |
-
$x++;
|
105 |
-
}
|
106 |
-
}
|
107 |
-
}
|
108 |
-
$FN = sprintf( $FMTFN, implode( utiL::$SP1, $name ));
|
109 |
-
$name = array_reverse( $name );
|
110 |
-
$N = sprintf( $FMTN, array_shift( $name ));
|
111 |
-
$scCnt = 0;
|
112 |
-
while( NULL != ( $part = array_shift( $name ))) {
|
113 |
-
if(( $V4_0 != $version ) || ( 4 > $scCnt ))
|
114 |
-
$scCnt += 1;
|
115 |
-
$N .= util::$SEMIC . $part;
|
116 |
-
}
|
117 |
-
while(( $V4_0 == $version ) && ( 4 > $scCnt )) {
|
118 |
-
$N .= util::$SEMIC;
|
119 |
-
$scCnt += 1;
|
120 |
-
}
|
121 |
-
$N .= $CRLF;
|
122 |
-
$EMAIL = sprintf( $FMTEMAIL, $email );
|
123 |
-
/* create vCard */
|
124 |
-
$vCard = $BEGINVCARD;
|
125 |
-
$vCard .= sprintf( $FMTVERSION, $version );
|
126 |
-
$vCard .= sprintf( $FMTPRODID, ICALCREATOR_VERSION );
|
127 |
-
$vCard .= $N;
|
128 |
-
$vCard .= $FN;
|
129 |
-
$vCard .= $EMAIL;
|
130 |
-
$vCard .= sprintf( $FMTREV, gmdate( $YMDTHISZ ));
|
131 |
-
$vCard .= $ENDVCARD;
|
132 |
-
/* save each vCard as (unique) single file */
|
133 |
-
if( ! empty( $directory )) {
|
134 |
-
if( empty( $ext ))
|
135 |
-
$ext = $EXTVCF;
|
136 |
-
$fprfx = $directory.preg_replace( $EXPR, null, $email );
|
137 |
-
$cnt = 1;
|
138 |
-
$dbl = null;
|
139 |
-
$fName = sprintf( $FMTFNAME, $fprfx, $dbl, $ext );
|
140 |
-
while( is_file ( $fName )) {
|
141 |
-
$cnt += 1;
|
142 |
-
$dbl = $cnt;
|
143 |
-
$fName = sprintf( $FMTFNAME, $fprfx, $dbl, $ext );
|
144 |
-
}
|
145 |
-
if( false === file_put_contents( $fName, $vCard ))
|
146 |
-
return false;
|
147 |
-
return true;
|
148 |
-
}
|
149 |
-
/* return vCard */
|
150 |
-
else
|
151 |
-
return $vCard;
|
152 |
-
}
|
153 |
-
/**
|
154 |
-
* Convert ATTENDEEs, CONTACTs and ORGANIZERs (in email format) to vCards
|
155 |
-
*
|
156 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
157 |
-
* @since 2.23.20 - 2017-02-20
|
158 |
-
* @param vcalendar $calendar iCalcreator vcalendar instance
|
159 |
-
* @param string $version vCard version (default 2.1)
|
160 |
-
* @param string $directory where to save vCards (default false)
|
161 |
-
* @param string $ext vCard file extension (default 'vcf')
|
162 |
-
* @return mixed bool true (if directory set and save ok), string (if not), false on error
|
163 |
-
* @static
|
164 |
-
*/
|
165 |
-
public static function iCal2vCards( vcalendar $calendar, $version=null, $directory=null, $ext=null ) {
|
166 |
-
static $vCardP = ['ATTENDEE', 'CONTACT', 'ORGANIZER'];
|
167 |
-
static $AT = '@';
|
168 |
-
static $UCMAILTOCOLON = 'MAILTO:';
|
169 |
-
$hits = [];
|
170 |
-
foreach( $vCardP as $prop ) {
|
171 |
-
$hits2 = $calendar->getProperty( $prop );
|
172 |
-
foreach( $hits2 as $propValue => $occCnt ) {
|
173 |
-
if( false === ( $pos = strpos( $propValue, $AT )))
|
174 |
-
continue;
|
175 |
-
$propValue = str_replace( $UCMAILTOCOLON, null, $propValue );
|
176 |
-
if( isset( $hits[$propValue] ))
|
177 |
-
$hits[$propValue] += $occCnt;
|
178 |
-
else
|
179 |
-
$hits[$propValue] = $occCnt;
|
180 |
-
}
|
181 |
-
}
|
182 |
-
if( empty( $hits ))
|
183 |
-
return false;
|
184 |
-
ksort( $hits );
|
185 |
-
$output = null;
|
186 |
-
foreach( $hits as $email => $skip ) {
|
187 |
-
$res = self::iCal2vCard( $email, $version, $directory, $ext );
|
188 |
-
if( ! empty( $directory ) && ! $res )
|
189 |
-
return false;
|
190 |
-
elseif( ! $res )
|
191 |
-
return $res;
|
192 |
-
else
|
193 |
-
$output .= $res;
|
194 |
-
}
|
195 |
-
if( $directory )
|
196 |
-
return true;
|
197 |
-
return ( empty( $output )) ? false : $output;
|
198 |
-
}
|
199 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/timezoneHandler.php
DELETED
@@ -1,438 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* iCalcreator timezone management class
|
35 |
-
*
|
36 |
-
* Manages loosely coupled iCalcreator vcalendar (timezone) functions
|
37 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
38 |
-
* @since 2.22.23 - 2017-04-07
|
39 |
-
*/
|
40 |
-
class timezoneHandler {
|
41 |
-
private static $FMTTIMESTAMP = '@%s';
|
42 |
-
private static $OFFSET = 'offset';
|
43 |
-
private static $TIME = 'time';
|
44 |
-
/**
|
45 |
-
* Create a calendar timezone and standard/daylight components
|
46 |
-
*
|
47 |
-
* Result when 'Europe/Stockholm' and no from/to arguments is used as timezone:
|
48 |
-
* BEGIN:VTIMEZONE
|
49 |
-
* TZID:Europe/Stockholm
|
50 |
-
* BEGIN:STANDARD
|
51 |
-
* DTSTART:20101031T020000
|
52 |
-
* TZOFFSETFROM:+0200
|
53 |
-
* TZOFFSETTO:+0100
|
54 |
-
* TZNAME:CET
|
55 |
-
* END:STANDARD
|
56 |
-
* BEGIN:DAYLIGHT
|
57 |
-
* DTSTART:20100328T030000
|
58 |
-
* TZOFFSETFROM:+0100
|
59 |
-
* TZOFFSETTO:+0200
|
60 |
-
* TZNAME:CEST
|
61 |
-
* END:DAYLIGHT
|
62 |
-
* END:VTIMEZONE
|
63 |
-
*
|
64 |
-
* Generates components for all transitions in a date range,
|
65 |
-
* based on contribution by Yitzchok Lavi <icalcreator@onebigsystem.com>
|
66 |
-
* Additional changes jpirkey
|
67 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
68 |
-
* @since 2.23.20 - 2017-06-26
|
69 |
-
* @param vcalendar $calendar iCalcreator calendar instance
|
70 |
-
* @param string $timezone valid timezone avveptable by PHP5 DateTimeZone
|
71 |
-
* @param array $xProp *[x-propName => x-propValue]
|
72 |
-
* @param int $from unix timestamp
|
73 |
-
* @param int $to unix timestamp
|
74 |
-
* @return bool
|
75 |
-
* @static
|
76 |
-
*/
|
77 |
-
public static function createTimezone( vcalendar $calendar, $timezone, $xProp=[], $from=null, $to=null ) {
|
78 |
-
static $Y = 'Y ';
|
79 |
-
static $YMD = 'Ymd';
|
80 |
-
static $T000000 = 'T000000';
|
81 |
-
static $MINUS7MONTH = '-7 month';
|
82 |
-
static $YMD2 = 'Y-m-d';
|
83 |
-
static $T235959 = 'T235959';
|
84 |
-
static $PLUS18MONTH = '+18 month';
|
85 |
-
static $TS = 'ts';
|
86 |
-
static $YMDHIS3 = 'Y-m-d-H-i-s';
|
87 |
-
static $SECONDS = 'seconds';
|
88 |
-
static $ABBR = 'abbr';
|
89 |
-
static $ISDST = 'isdst';
|
90 |
-
static $NOW = 'now';
|
91 |
-
static $YMDTHISO = 'Y-m-d\TH:i:s O';
|
92 |
-
if( empty( $timezone ))
|
93 |
-
return false;
|
94 |
-
if( ! empty( $from ) && ! is_int( $from ))
|
95 |
-
return false;
|
96 |
-
if( ! empty( $to ) && ! is_int( $to ))
|
97 |
-
return false;
|
98 |
-
try {
|
99 |
-
$newTz = new \DateTimeZone( $timezone );
|
100 |
-
$utcTz = new \DateTimeZone( util::$UTC );
|
101 |
-
}
|
102 |
-
catch( \Exception $e ) {
|
103 |
-
return false;
|
104 |
-
}
|
105 |
-
if( empty( $from ) || empty( $to )) {
|
106 |
-
$dates = array_keys( $calendar->getProperty( util::$DTSTART ));
|
107 |
-
if( empty( $dates ))
|
108 |
-
$dates = [date( $YMD )];
|
109 |
-
}
|
110 |
-
if( ! empty( $from )) {
|
111 |
-
try {
|
112 |
-
$timestamp = sprintf( self::$FMTTIMESTAMP, $from );
|
113 |
-
$dateFrom = new \DateTime( $timestamp ); // set lowest date (UTC)
|
114 |
-
}
|
115 |
-
catch( \Exception $e ) {
|
116 |
-
return false;
|
117 |
-
}
|
118 |
-
}
|
119 |
-
else {
|
120 |
-
try {
|
121 |
-
$from = reset( $dates ); // set lowest date to the lowest dtstart date
|
122 |
-
$dateFrom = new \DateTime( $from . $T000000, $newTz );
|
123 |
-
$dateFrom->modify( $MINUS7MONTH ); // set $dateFrom to seven month before the lowest date
|
124 |
-
$dateFrom->setTimezone( $utcTz ); // convert local date to UTC
|
125 |
-
}
|
126 |
-
catch( \Exception $e ) {
|
127 |
-
return false;
|
128 |
-
}
|
129 |
-
}
|
130 |
-
$dateFromYmd = $dateFrom->format( $YMD2 );
|
131 |
-
if( ! empty( $to )) {
|
132 |
-
try {
|
133 |
-
$timestamp = sprintf( self::$FMTTIMESTAMP, $to );
|
134 |
-
$dateTo = new \DateTime( $timestamp ); // set end date (UTC)
|
135 |
-
}
|
136 |
-
catch( \Exception $e ) {
|
137 |
-
return false;
|
138 |
-
}
|
139 |
-
}
|
140 |
-
else {
|
141 |
-
try {
|
142 |
-
$to = end( $dates ); // set highest date to the highest dtstart date
|
143 |
-
$dateTo = new \DateTime( $to . $T235959, $newTz );
|
144 |
-
}
|
145 |
-
catch( \Exception $e ) {
|
146 |
-
return false;
|
147 |
-
}
|
148 |
-
$dateTo->modify( $PLUS18MONTH ); // set $dateTo to 18 month after the highest date
|
149 |
-
$dateTo->setTimezone( $utcTz ); // convert local date to UTC
|
150 |
-
}
|
151 |
-
$dateToYmd = $dateTo->format( $YMD2 );
|
152 |
-
$transTemp = [];
|
153 |
-
$prevOffsetfrom = 0;
|
154 |
-
$stdIx = $dlghtIx = null;
|
155 |
-
$prevTrans = false;
|
156 |
-
$transitions = $newTz->getTransitions();
|
157 |
-
foreach( $transitions as $tix => $trans ) { // all transitions in date-time order!!
|
158 |
-
if( 0 > (int) date( $Y, $trans[$TS] )) { // skip negative year... but save offset
|
159 |
-
$prevOffsetfrom = $trans[self::$OFFSET]; // previous trans offset will be 'next' trans offsetFrom
|
160 |
-
continue;
|
161 |
-
}
|
162 |
-
try {
|
163 |
-
$timestamp = sprintf( self::$FMTTIMESTAMP, $trans[$TS] );
|
164 |
-
$date = new \DateTime( $timestamp ); // set transition date (UTC)
|
165 |
-
}
|
166 |
-
catch( \Exception $e ) {
|
167 |
-
return false;
|
168 |
-
}
|
169 |
-
$transDateYmd = $date->format( $YMD2 );
|
170 |
-
if( $transDateYmd < $dateFromYmd ) {
|
171 |
-
$prevOffsetfrom = $trans[self::$OFFSET]; // previous trans offset will be 'next' trans offsetFrom
|
172 |
-
$prevTrans = $trans; // we save it in case we don't find any that match
|
173 |
-
$prevTrans[util::$TZOFFSETFROM] = ( 0 < $tix ) ? $transitions[$tix-1][self::$OFFSET] : 0;
|
174 |
-
continue;
|
175 |
-
}
|
176 |
-
if( $transDateYmd > $dateToYmd )
|
177 |
-
break; // loop always (?) breaks here
|
178 |
-
if( ! empty( $prevOffsetfrom ) || ( 0 == $prevOffsetfrom )) {
|
179 |
-
$trans[util::$TZOFFSETFROM] = $prevOffsetfrom; // i.e. set previous offsetto as offsetFrom
|
180 |
-
$date->modify( $trans[util::$TZOFFSETFROM] . $SECONDS ); // convert utc date to local date
|
181 |
-
$d = explode( util::$MINUS, $date->format( $YMDHIS3 ));
|
182 |
-
$trans[self::$TIME] = [util::$LCYEAR => (int) $d[0], // set date to array
|
183 |
-
util::$LCMONTH => (int) $d[1], // to ease up dtstart and (opt) rdate setting
|
184 |
-
util::$LCDAY => (int) $d[2],
|
185 |
-
util::$LCHOUR => (int) $d[3],
|
186 |
-
util::$LCMIN => (int) $d[4],
|
187 |
-
util::$LCSEC => (int) $d[5]];
|
188 |
-
}
|
189 |
-
$prevOffsetfrom = $trans[self::$OFFSET];
|
190 |
-
if( true !== $trans[$ISDST] ) { // standard timezone
|
191 |
-
if( ! empty( $stdIx ) && isset( $transTemp[$stdIx][util::$TZOFFSETFROM] ) &&
|
192 |
-
( $transTemp[$stdIx][$ABBR] == $trans[$ABBR] ) &&
|
193 |
-
( $transTemp[$stdIx][util::$TZOFFSETFROM] == $trans[util::$TZOFFSETFROM] ) &&
|
194 |
-
( $transTemp[$stdIx][self::$OFFSET] == $trans[self::$OFFSET] )) {
|
195 |
-
$transTemp[$stdIx][util::$RDATE][] = $trans[self::$TIME];
|
196 |
-
continue; // check for any repeating rdate's (in order)
|
197 |
-
}
|
198 |
-
$stdIx = $tix;
|
199 |
-
} // end standard timezone
|
200 |
-
else { // daylight timezone
|
201 |
-
if( ! empty( $dlghtIx ) && isset( $transTemp[$dlghtIx][util::$TZOFFSETFROM] ) &&
|
202 |
-
( $transTemp[$dlghtIx][$ABBR] == $trans[$ABBR] ) &&
|
203 |
-
( $transTemp[$dlghtIx][util::$TZOFFSETFROM] == $trans[util::$TZOFFSETFROM] ) &&
|
204 |
-
( $transTemp[$dlghtIx][self::$OFFSET] == $trans[self::$OFFSET] )) {
|
205 |
-
$transTemp[$dlghtIx][util::$RDATE][] = $trans[self::$TIME];
|
206 |
-
continue; // check for any repeating rdate's (in order)
|
207 |
-
}
|
208 |
-
$dlghtIx = $tix;
|
209 |
-
} // end daylight timezone
|
210 |
-
$transTemp[$tix] = $trans;
|
211 |
-
} // end foreach( $transitions as $tix => $trans )
|
212 |
-
$timezoneComp = $calendar->newVtimezone();
|
213 |
-
$timezoneComp->setproperty( util::$TZID, $timezone );
|
214 |
-
if( ! empty( $xProp )) {
|
215 |
-
foreach( $xProp as $xPropName => $xPropValue )
|
216 |
-
if( util::isXprefixed( $xPropName ))
|
217 |
-
$timezoneComp->setproperty( $xPropName, $xPropValue );
|
218 |
-
}
|
219 |
-
if( empty( $transTemp )) { // if no match is found
|
220 |
-
if( $prevTrans ) { // we use the last transition (before startdate) for the tz info
|
221 |
-
try {
|
222 |
-
$timestamp = sprintf( self::$FMTTIMESTAMP, $prevTrans[$TS] );
|
223 |
-
$date = new \DateTime( $timestamp ); // set transition date (UTC)
|
224 |
-
}
|
225 |
-
catch( \Exception $e ) {
|
226 |
-
return false;
|
227 |
-
}
|
228 |
-
$date->modify( $prevTrans[util::$TZOFFSETFROM] . $SECONDS );// convert utc date to local date
|
229 |
-
$d = explode( util::$MINUS, $date->format( $YMDHIS3 )); // set arr-date to ease up dtstart setting
|
230 |
-
$prevTrans[self::$TIME] = [util::$LCYEAR => (int) $d[0],
|
231 |
-
util::$LCMONTH => (int) $d[1],
|
232 |
-
util::$LCDAY => (int) $d[2],
|
233 |
-
util::$LCHOUR => (int) $d[3],
|
234 |
-
util::$LCMIN => (int) $d[4],
|
235 |
-
util::$LCSEC => (int) $d[5]];
|
236 |
-
$transTemp[0] = $prevTrans;
|
237 |
-
} // end if( $prevTrans )
|
238 |
-
else { // or we use the timezone identifier to BUILD the standard tz info (?)
|
239 |
-
try {
|
240 |
-
$date = new \DateTime( $NOW, $newTz );
|
241 |
-
}
|
242 |
-
catch( \Exception $e ) {
|
243 |
-
return false;
|
244 |
-
}
|
245 |
-
$transTemp[0] = [self::$TIME => $date->format( $YMDTHISO ),
|
246 |
-
self::$OFFSET => $date->format( util::$Z ),
|
247 |
-
util::$TZOFFSETFROM => $date->format( util::$Z ),
|
248 |
-
$ISDST => false];
|
249 |
-
}
|
250 |
-
} // end if( empty( $transTemp ))
|
251 |
-
foreach( $transTemp as $tix => $trans ) { // create standard/daylight subcomponents
|
252 |
-
$subComp = ( true !== $trans[$ISDST] )
|
253 |
-
? $timezoneComp->newStandard()
|
254 |
-
: $timezoneComp->newDaylight();
|
255 |
-
$subComp->setProperty( util::$DTSTART, $trans[self::$TIME] );
|
256 |
-
// $subComp->setProperty( 'x-utc-timestamp', $tix.' : '.$trans[$TS] ); // test ###
|
257 |
-
if( ! empty( $trans[$ABBR] ))
|
258 |
-
$subComp->setProperty( util::$TZNAME, $trans[$ABBR] );
|
259 |
-
if( isset( $trans[util::$TZOFFSETFROM] ))
|
260 |
-
$subComp->setProperty( util::$TZOFFSETFROM, self::offsetSec2His( $trans[util::$TZOFFSETFROM] ));
|
261 |
-
$subComp->setProperty( util::$TZOFFSETTO, self::offsetSec2His( $trans[self::$OFFSET] ));
|
262 |
-
if( isset( $trans[util::$RDATE] ))
|
263 |
-
$subComp->setProperty( util::$RDATE, $trans[util::$RDATE] );
|
264 |
-
}
|
265 |
-
return true;
|
266 |
-
}
|
267 |
-
/**
|
268 |
-
* Return iCal offset [-/+]hhmm[ss] (string) from UTC offset seconds
|
269 |
-
*
|
270 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
271 |
-
* @since 2.22.23 - 2017-02-17
|
272 |
-
* @param string $seconds
|
273 |
-
* @return string
|
274 |
-
* @static
|
275 |
-
*/
|
276 |
-
public static function offsetSec2His( $seconds ) {
|
277 |
-
static $FMT = '%02d';
|
278 |
-
switch( substr( $seconds, 0, 1 )) {
|
279 |
-
case util::$MINUS :
|
280 |
-
$output = util::$MINUS;
|
281 |
-
$seconds = substr( $seconds, 1 );
|
282 |
-
break;
|
283 |
-
case util::$PLUS :
|
284 |
-
$output = util::$PLUS;
|
285 |
-
$seconds = substr( $seconds, 1 );
|
286 |
-
break;
|
287 |
-
default :
|
288 |
-
$output = util::$PLUS;
|
289 |
-
break;
|
290 |
-
}
|
291 |
-
$output .= sprintf( $FMT, ((int) floor( $seconds / 3600 ))); // hour
|
292 |
-
$seconds = $seconds % 3600;
|
293 |
-
$output .= sprintf( $FMT, ((int) floor( $seconds / 60 ))); // min
|
294 |
-
$seconds = $seconds % 60;
|
295 |
-
if( 0 < $seconds )
|
296 |
-
$output .= sprintf( $FMT, $seconds ); // sec
|
297 |
-
return $output;
|
298 |
-
}
|
299 |
-
/**
|
300 |
-
* Very basic conversion of a MS timezone to a PHP5 valid (Date-)timezone
|
301 |
-
* matching (MS) UCT offset and time zone descriptors
|
302 |
-
*
|
303 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
304 |
-
* @since 2.23.8 - 2017-04-17
|
305 |
-
* @param string $timezone to convert
|
306 |
-
* @return bool
|
307 |
-
* @static
|
308 |
-
*/
|
309 |
-
public static function ms2phpTZ( & $timezone ) {
|
310 |
-
static $REPL1 = ['GMT', 'gmt', 'utc'];
|
311 |
-
static $REPL2 = ['(', ')', '&', ',', ' '];
|
312 |
-
static $PUTC = '(UTC';
|
313 |
-
static $ENDP = ')';
|
314 |
-
static $TIMEZONE_ID = 'timezone_id';
|
315 |
-
if( empty( $timezone ))
|
316 |
-
return false;
|
317 |
-
$search = str_replace( util::$QQ, null, $timezone );
|
318 |
-
$search = str_replace( $REPL1, util::$UTC, $search );
|
319 |
-
if( $PUTC != substr( $search, 0, 4 ))
|
320 |
-
return false;
|
321 |
-
if( false === ( $pos = strpos( $search, $ENDP )))
|
322 |
-
return false;
|
323 |
-
$searchOffset = substr( $search, 4, ( $pos - 4 ));
|
324 |
-
$searchOffset = util::tz2offset( str_replace( util::$COLON,
|
325 |
-
null,
|
326 |
-
$searchOffset ));
|
327 |
-
while( util::$SP1 == $search[($pos+1)] )
|
328 |
-
$pos += 1;
|
329 |
-
$searchText = trim( str_replace( $REPL2,
|
330 |
-
util::$SP1,
|
331 |
-
substr( $search, ( $pos + 1 ))));
|
332 |
-
$searchWords = explode( util::$SP1, $searchText );
|
333 |
-
try {
|
334 |
-
$timezoneAbbreviations = \DateTimeZone::listAbbreviations();
|
335 |
-
}
|
336 |
-
catch( \Exception $e ) {
|
337 |
-
return false;
|
338 |
-
}
|
339 |
-
$hits = [];
|
340 |
-
foreach( $timezoneAbbreviations as $name => $transitions ) {
|
341 |
-
foreach( $transitions as $cnt => $transition ) {
|
342 |
-
if( empty( $transition[self::$OFFSET] ) ||
|
343 |
-
empty( $transition[$TIMEZONE_ID] ) ||
|
344 |
-
( $transition[self::$OFFSET] != $searchOffset ))
|
345 |
-
continue;
|
346 |
-
$cWords = explode( util::$L, $transition[$TIMEZONE_ID] );
|
347 |
-
$cPrio = $hitCnt = $rank = 0;
|
348 |
-
foreach( $cWords as $cWord ) {
|
349 |
-
if( empty( $cWord ))
|
350 |
-
continue;
|
351 |
-
$cPrio += 1;
|
352 |
-
$sPrio = 0;
|
353 |
-
foreach( $searchWords as $sWord ) {
|
354 |
-
if( empty( $sWord ) || ( self::$TIME == strtolower( $sWord )))
|
355 |
-
continue;
|
356 |
-
$sPrio += 1;
|
357 |
-
if( strtolower( $cWord ) == strtolower( $sWord )) {
|
358 |
-
$hitCnt += 1;
|
359 |
-
$rank += ( $cPrio + $sPrio );
|
360 |
-
}
|
361 |
-
else
|
362 |
-
$rank += 10;
|
363 |
-
}
|
364 |
-
}
|
365 |
-
if( 0 < $hitCnt ) {
|
366 |
-
$hits[$rank][] = $transition[$TIMEZONE_ID];
|
367 |
-
}
|
368 |
-
} // end foreach( $transitions as $cnt => $transition )
|
369 |
-
} // end foreach( $timezoneAbbreviations as $name => $transitions )
|
370 |
-
if( empty( $hits ))
|
371 |
-
return false;
|
372 |
-
ksort( $hits );
|
373 |
-
foreach( $hits as $rank => $tzs ) {
|
374 |
-
if( ! empty( $tzs )) {
|
375 |
-
$timezone = reset( $tzs );
|
376 |
-
return true;
|
377 |
-
}
|
378 |
-
}
|
379 |
-
return false;
|
380 |
-
}
|
381 |
-
/**
|
382 |
-
* Transforms a dateTime from a timezone to another
|
383 |
-
*
|
384 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
385 |
-
* @since 2.22.23 - 2017-03-04
|
386 |
-
* @param mixed $date date to alter
|
387 |
-
* @param string $tzFrom PHP valid 'from' timezone
|
388 |
-
* @param string $tzTo PHP valid 'to' timezone, default util::$UTC
|
389 |
-
* @param string $format date output format, default 'Ymd\THis'
|
390 |
-
* @return bool true on success, false on error
|
391 |
-
* @static
|
392 |
-
*/
|
393 |
-
public static function transformDateTime( & $date, $tzFrom, $tzTo=null, $format=null ) {
|
394 |
-
static $YMDTHIS = 'Ymd\THis';
|
395 |
-
if( is_null( $tzTo ))
|
396 |
-
$tzTo = util::$UTC;
|
397 |
-
elseif( util::$Z == $tzTo )
|
398 |
-
$tzTo = util::$UTC;
|
399 |
-
if( is_null( $format ))
|
400 |
-
$format = $YMDTHIS;
|
401 |
-
if( is_array( $date ) && isset( $date[util::$LCTIMESTAMP] )) {
|
402 |
-
try {
|
403 |
-
$timestamp = sprintf( self::$FMTTIMESTAMP, $date[util::$LCTIMESTAMP] );
|
404 |
-
$d = new \DateTime( $timestamp ); // set UTC date
|
405 |
-
$newTz = new \DateTimeZone( $tzFrom );
|
406 |
-
$d->setTimezone( $newTz ); // convert to 'from' date
|
407 |
-
}
|
408 |
-
catch( \Exception $e ) {
|
409 |
-
return false;
|
410 |
-
}
|
411 |
-
}
|
412 |
-
else {
|
413 |
-
if( util::isArrayDate( $date )) {
|
414 |
-
if( isset( $date[util::$LCtz] ))
|
415 |
-
unset( $date[util::$LCtz] );
|
416 |
-
$date = util::date2strdate( util::chkDateArr( $date ));
|
417 |
-
}
|
418 |
-
if( util::$Z == substr( $date, -1 ))
|
419 |
-
$date = substr( $date, 0, ( strlen( $date ) - 2 ));
|
420 |
-
try {
|
421 |
-
$newTz = new \DateTimeZone( $tzFrom );
|
422 |
-
$d = new \DateTime( $date, $newTz );
|
423 |
-
}
|
424 |
-
catch( \Exception $e ) {
|
425 |
-
return false;
|
426 |
-
}
|
427 |
-
}
|
428 |
-
try {
|
429 |
-
$newTz = new \DateTimeZone( $tzTo );
|
430 |
-
$d->setTimezone( $newTz );
|
431 |
-
}
|
432 |
-
catch( \Exception $e ) {
|
433 |
-
return false;
|
434 |
-
}
|
435 |
-
$date = $d->format( $format );
|
436 |
-
return true;
|
437 |
-
}
|
438 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/ACTIONtrait.php
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* ACTION property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-17
|
38 |
-
*/
|
39 |
-
trait ACTIONtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property ACTION value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $action = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property action
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createAction() {
|
51 |
-
if( empty( $this->action ))
|
52 |
-
return null;
|
53 |
-
if( empty( $this->action[util::$LCvalue] ))
|
54 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$ACTION ) : null;
|
55 |
-
return util::createElement( util::$ACTION,
|
56 |
-
util::createParams( $this->action[util::$LCparams] ),
|
57 |
-
$this->action[util::$LCvalue] );
|
58 |
-
}
|
59 |
-
/**
|
60 |
-
* Set calendar component property action
|
61 |
-
*
|
62 |
-
* @param string $value "AUDIO" / "DISPLAY" / "EMAIL" / "PROCEDURE" / iana-token / x-name
|
63 |
-
* @param mixed $params
|
64 |
-
* @return bool
|
65 |
-
*/
|
66 |
-
public function setAction( $value, $params=null ) {
|
67 |
-
if( empty( $value )) {
|
68 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
69 |
-
$value = util::$EMPTYPROPERTY;
|
70 |
-
else
|
71 |
-
return false;
|
72 |
-
}
|
73 |
-
$this->action = [util::$LCvalue => util::trimTrailNL( $value ),
|
74 |
-
util::$LCparams => util::setParams( $params )];
|
75 |
-
return true;
|
76 |
-
}
|
77 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/ATTACHtrait.php
DELETED
@@ -1,87 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* ATTACH property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait ATTACHtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property ATTACH value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $attach = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property attach
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createAttach() {
|
51 |
-
if( empty( $this->attach ))
|
52 |
-
return null;
|
53 |
-
$output = null;
|
54 |
-
foreach( $this->attach as $aix => $attachPart ) {
|
55 |
-
if( ! empty( $attachPart[util::$LCvalue] )) {
|
56 |
-
$output .= util::createElement( util::$ATTACH,
|
57 |
-
util::createParams( $attachPart[util::$LCparams] ),
|
58 |
-
$attachPart[util::$LCvalue] );
|
59 |
-
}
|
60 |
-
elseif( $this->getConfig( util::$ALLOWEMPTY ))
|
61 |
-
$output .= util::createElement( util::$ATTACH );
|
62 |
-
}
|
63 |
-
return $output;
|
64 |
-
}
|
65 |
-
/**
|
66 |
-
* Set calendar component property attach
|
67 |
-
*
|
68 |
-
* @param string $value
|
69 |
-
* @param array $params
|
70 |
-
* @param integer $index
|
71 |
-
* @return bool
|
72 |
-
*/
|
73 |
-
public function setAttach( $value, $params=null, $index=null ) {
|
74 |
-
if( empty( $value )) {
|
75 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
76 |
-
$value = util::$EMPTYPROPERTY;
|
77 |
-
else
|
78 |
-
return false;
|
79 |
-
}
|
80 |
-
util::setMval( $this->attach,
|
81 |
-
$value,
|
82 |
-
$params,
|
83 |
-
false,
|
84 |
-
$index );
|
85 |
-
return true;
|
86 |
-
}
|
87 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/ATTENDEEtrait.php
DELETED
@@ -1,80 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
use kigkonsult\iCalcreator\util\utilAttendee;
|
34 |
-
/**
|
35 |
-
* ATTENDEE property functions
|
36 |
-
*
|
37 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
38 |
-
* @since 2.22.23 - 2017-02-17
|
39 |
-
*/
|
40 |
-
trait ATTENDEEtrait {
|
41 |
-
/**
|
42 |
-
* @var array component property ATTENDEE value
|
43 |
-
* @access protected
|
44 |
-
*/
|
45 |
-
protected $attendee = null;
|
46 |
-
/**
|
47 |
-
* Return formatted output for calendar component property attendee
|
48 |
-
*
|
49 |
-
* @return string
|
50 |
-
*/
|
51 |
-
public function createAttendee() {
|
52 |
-
if( empty( $this->attendee ))
|
53 |
-
return null;
|
54 |
-
return utilAttendee::formatAttendee( $this->attendee,
|
55 |
-
$this->getConfig( util::$ALLOWEMPTY ));
|
56 |
-
}
|
57 |
-
/**
|
58 |
-
* Set calendar component property attach
|
59 |
-
* @param string $value
|
60 |
-
* @param array $params
|
61 |
-
* @param integer $index
|
62 |
-
* @return bool
|
63 |
-
*/
|
64 |
-
public function setAttendee( $value, $params=null, $index=null ) {
|
65 |
-
if( empty( $value )) {
|
66 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
67 |
-
$value = util::$EMPTYPROPERTY;
|
68 |
-
else
|
69 |
-
return false;
|
70 |
-
}
|
71 |
-
util::setMval( $this->attendee,
|
72 |
-
utilAttendee::calAddressCheck( $value, false ),
|
73 |
-
utilAttendee::prepAttendeeParams( $params,
|
74 |
-
$this->objName,
|
75 |
-
$this->getConfig( util::$LANGUAGE )),
|
76 |
-
false,
|
77 |
-
$index );
|
78 |
-
return true;
|
79 |
-
}
|
80 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/CALSCALEtrait.php
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* CALSCALE property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait CALSCALEtrait {
|
40 |
-
/**
|
41 |
-
* @var string calendar property CALSCALE
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $calscale = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar property calscale
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createCalscale() {
|
51 |
-
return ( empty( $this->calscale ))
|
52 |
-
? null
|
53 |
-
: sprintf( self::$FMTICAL, util::$CALSCALE,
|
54 |
-
$this->calscale );
|
55 |
-
}
|
56 |
-
/**
|
57 |
-
* Set calendar property calscale
|
58 |
-
*
|
59 |
-
* @param string $value
|
60 |
-
*/
|
61 |
-
public function setCalscale( $value ) {
|
62 |
-
if( empty( $value ))
|
63 |
-
return false;
|
64 |
-
$this->calscale = $value;
|
65 |
-
return true;
|
66 |
-
}
|
67 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/CATEGORIEStrait.php
DELETED
@@ -1,98 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* CATEGORIES property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait CATEGORIEStrait {
|
40 |
-
/**
|
41 |
-
* @var array component property CATEGORIES value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $categories = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property categories
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createCategories() {
|
51 |
-
if( empty( $this->categories ))
|
52 |
-
return null;
|
53 |
-
$output = null;
|
54 |
-
$lang = $this->getConfig( util::$LANGUAGE );
|
55 |
-
foreach( $this->categories as $cx => $category ) {
|
56 |
-
if( empty( $category[util::$LCvalue] )) {
|
57 |
-
if ( $this->getConfig( util::$ALLOWEMPTY ))
|
58 |
-
$output .= util::createElement( util::$CATEGORIES );
|
59 |
-
continue;
|
60 |
-
}
|
61 |
-
if( is_array( $category[util::$LCvalue] )) {
|
62 |
-
foreach( $category[util::$LCvalue] as $cix => $cValue )
|
63 |
-
$category[util::$LCvalue][$cix] = util::strrep( $cValue );
|
64 |
-
$content = implode( util::$COMMA, $category[util::$LCvalue] );
|
65 |
-
}
|
66 |
-
else
|
67 |
-
$content = util::strrep( $category[util::$LCvalue] );
|
68 |
-
$output .= util::createElement( util::$CATEGORIES,
|
69 |
-
util::createParams( $category[util::$LCparams],
|
70 |
-
[util::$LANGUAGE],
|
71 |
-
$lang ),
|
72 |
-
$content );
|
73 |
-
}
|
74 |
-
return $output;
|
75 |
-
}
|
76 |
-
/**
|
77 |
-
* Set calendar component property categories
|
78 |
-
*
|
79 |
-
* @param mixed $value
|
80 |
-
* @param array $params
|
81 |
-
* @param integer $index
|
82 |
-
* @return bool
|
83 |
-
*/
|
84 |
-
public function setCategories( $value, $params=null, $index=null ) {
|
85 |
-
if( empty( $value )) {
|
86 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
87 |
-
$value = util::$EMPTYPROPERTY;
|
88 |
-
else
|
89 |
-
return false;
|
90 |
-
}
|
91 |
-
util::setMval( $this->categories,
|
92 |
-
$value,
|
93 |
-
$params,
|
94 |
-
false,
|
95 |
-
$index );
|
96 |
-
return true;
|
97 |
-
}
|
98 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/CLASStrait.php
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* CLASS property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-17
|
38 |
-
*/
|
39 |
-
trait CLASStrait {
|
40 |
-
/**
|
41 |
-
* @var string component property CLASS value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $class = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property class
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createClass() {
|
51 |
-
if( empty( $this->class ))
|
52 |
-
return null;
|
53 |
-
if( empty( $this->class[util::$LCvalue] ))
|
54 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$CLASS ) : null;
|
55 |
-
return util::createElement( util::$CLASS,
|
56 |
-
util::createParams( $this->class[util::$LCparams] ),
|
57 |
-
$this->class[util::$LCvalue] );
|
58 |
-
}
|
59 |
-
/**
|
60 |
-
* Set calendar component property class
|
61 |
-
*
|
62 |
-
* @param string $value "PUBLIC" / "PRIVATE" / "CONFIDENTIAL" / iana-token / x-name
|
63 |
-
* @param array $params
|
64 |
-
* @return bool
|
65 |
-
*/
|
66 |
-
public function setClass( $value, $params=null ) {
|
67 |
-
if( empty( $value )) {
|
68 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
69 |
-
$value = util::$EMPTYPROPERTY;
|
70 |
-
else
|
71 |
-
return false;
|
72 |
-
}
|
73 |
-
$this->class = [util::$LCvalue => util::trimTrailNL( $value ),
|
74 |
-
util::$LCparams => util::setParams( $params )];
|
75 |
-
return true;
|
76 |
-
}
|
77 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/COMMENTtrait.php
DELETED
@@ -1,91 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* COMMENT property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait COMMENTtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property COMMENT value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $comment = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property comment
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createComment() {
|
51 |
-
if( empty( $this->comment ))
|
52 |
-
return null;
|
53 |
-
$output = null;
|
54 |
-
$lang = $this->getConfig( util::$LANGUAGE );
|
55 |
-
foreach( $this->comment as $cx => $commentPart ) {
|
56 |
-
if( empty( $commentPart[util::$LCvalue] )) {
|
57 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
58 |
-
$output .= util::createElement( util::$COMMENT );
|
59 |
-
continue;
|
60 |
-
}
|
61 |
-
$output .= util::createElement( util::$COMMENT,
|
62 |
-
util::createParams( $commentPart[util::$LCparams],
|
63 |
-
util::$ALTRPLANGARR,
|
64 |
-
$lang ),
|
65 |
-
util::strrep( $commentPart[util::$LCvalue] ));
|
66 |
-
}
|
67 |
-
return $output;
|
68 |
-
}
|
69 |
-
/**
|
70 |
-
* Set calendar component property comment
|
71 |
-
*
|
72 |
-
* @param string $value
|
73 |
-
* @param array $params
|
74 |
-
* @param integer $index
|
75 |
-
* @return bool
|
76 |
-
*/
|
77 |
-
public function setComment( $value, $params=null, $index=null ) {
|
78 |
-
if( empty( $value )) {
|
79 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
80 |
-
$value = util::$EMPTYPROPERTY;
|
81 |
-
else
|
82 |
-
return false;
|
83 |
-
}
|
84 |
-
util::setMval( $this->comment,
|
85 |
-
$value,
|
86 |
-
$params,
|
87 |
-
false,
|
88 |
-
$index );
|
89 |
-
return true;
|
90 |
-
}
|
91 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/COMPLETEDtrait.php
DELETED
@@ -1,84 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* COMPLETED property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-19
|
38 |
-
*/
|
39 |
-
trait COMPLETEDtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property COMPLETED value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $completed = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property completed
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createCompleted( ) {
|
51 |
-
if( empty( $this->completed ))
|
52 |
-
return null;
|
53 |
-
if( util::hasNodate( $this->completed ))
|
54 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$COMPLETED ) : null;
|
55 |
-
return util::createElement( util::$COMPLETED,
|
56 |
-
util::createParams( $this->completed[util::$LCparams] ),
|
57 |
-
util::date2strdate( $this->completed[util::$LCvalue], 7 ));
|
58 |
-
}
|
59 |
-
/**
|
60 |
-
* Set calendar component property completed
|
61 |
-
*
|
62 |
-
* @param mixed $year
|
63 |
-
* @param mixed $month
|
64 |
-
* @param int $day
|
65 |
-
* @param int $hour
|
66 |
-
* @param int $min
|
67 |
-
* @param int $sec
|
68 |
-
* @param array $params
|
69 |
-
* @return bool
|
70 |
-
*/
|
71 |
-
public function setCompleted( $year, $month=null, $day=null, $hour=null, $min=null, $sec=null, $params=null ) {
|
72 |
-
if( empty( $year )) {
|
73 |
-
if( $this->getConfig( util::$ALLOWEMPTY )) {
|
74 |
-
$this->completed = [util::$LCvalue => util::$EMPTYPROPERTY,
|
75 |
-
util::$LCparams => util::setParams( $params )];
|
76 |
-
return true;
|
77 |
-
}
|
78 |
-
else
|
79 |
-
return false;
|
80 |
-
}
|
81 |
-
$this->completed = util::setDate2( $year, $month, $day, $hour, $min, $sec, $params );
|
82 |
-
return true;
|
83 |
-
}
|
84 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/CONTACTtrait.php
DELETED
@@ -1,89 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* CONTACT property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait CONTACTtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property CONTACT value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $contact = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property contact
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createContact() {
|
51 |
-
if( empty( $this->contact ))
|
52 |
-
return null;
|
53 |
-
$output = null;
|
54 |
-
$lang = $this->getConfig( util::$LANGUAGE );
|
55 |
-
foreach( $this->contact as $cx => $contact ) {
|
56 |
-
if( ! empty( $contact[util::$LCvalue] ))
|
57 |
-
$output .= util::createElement( util::$CONTACT,
|
58 |
-
util::createParams( $contact[util::$LCparams],
|
59 |
-
util::$ALTRPLANGARR,
|
60 |
-
$lang ),
|
61 |
-
util::strrep( $contact[util::$LCvalue] ));
|
62 |
-
elseif( $this->getConfig( util::$ALLOWEMPTY ))
|
63 |
-
$output .= util::createElement( util::$CONTACT );
|
64 |
-
}
|
65 |
-
return $output;
|
66 |
-
}
|
67 |
-
/**
|
68 |
-
* Set calendar component property contact
|
69 |
-
*
|
70 |
-
* @param string $value
|
71 |
-
* @param array $params
|
72 |
-
* @param integer $index
|
73 |
-
* @return bool
|
74 |
-
*/
|
75 |
-
public function setContact( $value, $params=null, $index=null ) {
|
76 |
-
if( empty( $value )) {
|
77 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
78 |
-
$value = util::$EMPTYPROPERTY;
|
79 |
-
else
|
80 |
-
return false;
|
81 |
-
}
|
82 |
-
util::setMval( $this->contact,
|
83 |
-
util::trimTrailNL( $value ),
|
84 |
-
$params,
|
85 |
-
false,
|
86 |
-
$index );
|
87 |
-
return true;
|
88 |
-
}
|
89 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/CREATEDtrait.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* CREATED property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait CREATEDtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property CREATED value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $created = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property created
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createCreated() {
|
51 |
-
if( empty( $this->created ))
|
52 |
-
return null;
|
53 |
-
return util::createElement( util::$CREATED,
|
54 |
-
util::createParams( $this->created[util::$LCparams] ),
|
55 |
-
util::date2strdate( $this->created[util::$LCvalue], 7 ));
|
56 |
-
}
|
57 |
-
/**
|
58 |
-
* Set calendar component property created
|
59 |
-
*
|
60 |
-
* @param mixed $year
|
61 |
-
* @param mixed $month
|
62 |
-
* @param int $day
|
63 |
-
* @param int $hour
|
64 |
-
* @param int $min
|
65 |
-
* @param int $sec
|
66 |
-
* @param mixed $params
|
67 |
-
* @return bool
|
68 |
-
*/
|
69 |
-
public function setCreated( $year=null, $month=null, $day=null, $hour=null, $min=null, $sec=null, $params=null ) {
|
70 |
-
static $YMDTHIS = 'Ymd\THis';
|
71 |
-
if( empty( $year ))
|
72 |
-
$year = gmdate( $YMDTHIS );
|
73 |
-
$this->created = util::setDate2( $year, $month, $day, $hour, $min, $sec, $params );
|
74 |
-
return true;
|
75 |
-
}
|
76 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/DESCRIPTIONtrait.php
DELETED
@@ -1,91 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* DESCRIPTION property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait DESCRIPTIONtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property DESCRIPTION value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $description = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property description
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createDescription() {
|
51 |
-
if( empty( $this->description ))
|
52 |
-
return null;
|
53 |
-
$output = null;
|
54 |
-
$lang = $this->getConfig( util::$LANGUAGE );
|
55 |
-
foreach( $this->description as $dx => $description ) {
|
56 |
-
if( ! empty( $description[util::$LCvalue] ))
|
57 |
-
$output .= util::createElement( util::$DESCRIPTION,
|
58 |
-
util::createParams( $description[util::$LCparams],
|
59 |
-
util::$ALTRPLANGARR,
|
60 |
-
$lang ),
|
61 |
-
util::strrep( $description[util::$LCvalue] ));
|
62 |
-
elseif( $this->getConfig( util::$ALLOWEMPTY ))
|
63 |
-
$output .= util::createElement( util::$DESCRIPTION );
|
64 |
-
}
|
65 |
-
return $output;
|
66 |
-
}
|
67 |
-
/**
|
68 |
-
* Set calendar component property description
|
69 |
-
*
|
70 |
-
* @param string $value
|
71 |
-
* @param array $params
|
72 |
-
* @param integer $index
|
73 |
-
* @return bool
|
74 |
-
*/
|
75 |
-
public function setDescription( $value, $params=null, $index=null ) {
|
76 |
-
if( empty( $value )) {
|
77 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
78 |
-
$value = util::$EMPTYPROPERTY;
|
79 |
-
else
|
80 |
-
return false;
|
81 |
-
}
|
82 |
-
if( util::$LCVJOURNAL != $this->objName )
|
83 |
-
$index = 1;
|
84 |
-
util::setMval( $this->description,
|
85 |
-
$value,
|
86 |
-
$params,
|
87 |
-
false,
|
88 |
-
$index );
|
89 |
-
return true;
|
90 |
-
}
|
91 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/DTENDtrait.php
DELETED
@@ -1,89 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* DTEND property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait DTENDtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property DTEND value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $dtend = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property dtend
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createDtend() {
|
51 |
-
if( empty( $this->dtend ))
|
52 |
-
return null;
|
53 |
-
if( util::hasNodate( $this->dtend ))
|
54 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$DTEND ) : null;
|
55 |
-
return util::createElement( util::$DTEND,
|
56 |
-
util::createParams( $this->dtend[util::$LCparams] ),
|
57 |
-
util::date2strdate( $this->dtend[util::$LCvalue],
|
58 |
-
util::isParamsValueSet( $this->dtend, util::$DATE ) ? 3 : null ));
|
59 |
-
}
|
60 |
-
/**
|
61 |
-
* Set calendar component property dtend
|
62 |
-
*
|
63 |
-
* @param mixed $year
|
64 |
-
* @param mixed $month
|
65 |
-
* @param int $day
|
66 |
-
* @param int $hour
|
67 |
-
* @param int $min
|
68 |
-
* @param int $sec
|
69 |
-
* @param string $tz
|
70 |
-
* @param array $params
|
71 |
-
* @return bool
|
72 |
-
*/
|
73 |
-
public function setDtend( $year, $month=null, $day=null, $hour=null, $min=null, $sec=null, $tz=null, $params=null ) {
|
74 |
-
if( empty( $year )) {
|
75 |
-
if( $this->getConfig( util::$ALLOWEMPTY )) {
|
76 |
-
$this->dtend = [util::$LCvalue => util::$EMPTYPROPERTY,
|
77 |
-
util::$LCparams => util::setParams( $params )];
|
78 |
-
return true;
|
79 |
-
}
|
80 |
-
else
|
81 |
-
return false;
|
82 |
-
}
|
83 |
-
if( false === ( $tzid = $this->getConfig( util::$TZID )))
|
84 |
-
$tzid = null;
|
85 |
-
$this->dtend = util::setDate( $year, $month, $day, $hour, $min, $sec, $tz,
|
86 |
-
$params, null, null, $tzid );
|
87 |
-
return true;
|
88 |
-
}
|
89 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/DTSTAMPtrait.php
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* DTSTAMP property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait DTSTAMPtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property DTSTAMP value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $dtstamp = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property dtstamp
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createDtstamp() {
|
51 |
-
if( util::hasNodate( $this->dtstamp ))
|
52 |
-
$this->dtstamp = util::makeDtstamp();
|
53 |
-
return util::createElement( util::$DTSTAMP,
|
54 |
-
util::createParams( $this->dtstamp[util::$LCparams] ),
|
55 |
-
util::date2strdate( $this->dtstamp[util::$LCvalue], 7 ));
|
56 |
-
}
|
57 |
-
/**
|
58 |
-
* Set calendar component property dtstamp
|
59 |
-
*
|
60 |
-
* @param mixed $year
|
61 |
-
* @param mixed $month
|
62 |
-
* @param int $day
|
63 |
-
* @param int $hour
|
64 |
-
* @param int $min
|
65 |
-
* @param int $sec
|
66 |
-
* @param array $params
|
67 |
-
* @return bool
|
68 |
-
*/
|
69 |
-
public function setDtstamp( $year, $month=null, $day=null, $hour=null, $min=null, $sec=null, $params=null ) {
|
70 |
-
$this->dtstamp = ( empty( $year )) ? util::makeDtstamp()
|
71 |
-
: util::setDate2( $year, $month, $day, $hour, $min, $sec, $params );
|
72 |
-
return true;
|
73 |
-
}
|
74 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/DTSTARTtrait.php
DELETED
@@ -1,91 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* DTSTART property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait DTSTARTtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property DTSTART value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $dtstart = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property dtstart
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createDtstart() {
|
51 |
-
if( empty( $this->dtstart ))
|
52 |
-
return null;
|
53 |
-
if( util::hasNodate( $this->dtstart ))
|
54 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$DTSTART ): null;
|
55 |
-
if( in_array( $this->objName, util::$TZCOMPS ))
|
56 |
-
unset( $this->dtstart[util::$LCvalue][util::$LCtz], $this->dtstart[util::$LCparams][util::$TZID] );
|
57 |
-
return util::createElement( util::$DTSTART,
|
58 |
-
util::createParams( $this->dtstart[util::$LCparams] ),
|
59 |
-
util::date2strdate( $this->dtstart[util::$LCvalue],
|
60 |
-
util::isParamsValueSet( $this->dtstart, util::$DATE ) ? 3 : null ));
|
61 |
-
}
|
62 |
-
/**
|
63 |
-
* Set calendar component property dtstart
|
64 |
-
*
|
65 |
-
* @param mixed $year
|
66 |
-
* @param mixed $month
|
67 |
-
* @param int $day
|
68 |
-
* @param int $hour
|
69 |
-
* @param int $min
|
70 |
-
* @param int $sec
|
71 |
-
* @param string $tz
|
72 |
-
* @param array $params
|
73 |
-
* @return bool
|
74 |
-
*/
|
75 |
-
public function setDtstart( $year, $month=null, $day=null, $hour=null, $min=null, $sec=null, $tz=null, $params=null ) {
|
76 |
-
if( empty( $year )) {
|
77 |
-
if( $this->getConfig( util::$ALLOWEMPTY )) {
|
78 |
-
$this->dtstart = [util::$LCvalue => util::$EMPTYPROPERTY,
|
79 |
-
util::$LCparams => util::setParams( $params )];
|
80 |
-
return true;
|
81 |
-
}
|
82 |
-
else
|
83 |
-
return false;
|
84 |
-
}
|
85 |
-
if( false === ( $tzid = $this->getConfig( util::$TZID )))
|
86 |
-
$tzid = null;
|
87 |
-
$this->dtstart = util::setDate( $year, $month, $day, $hour, $min, $sec, $tz,
|
88 |
-
$params, util::$DTSTART, $this->objName, $tzid);
|
89 |
-
return true;
|
90 |
-
}
|
91 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/DUEtrait.php
DELETED
@@ -1,89 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* DUE property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait DUEtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property DUE value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $due = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property due
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createDue() {
|
51 |
-
if( empty( $this->due ))
|
52 |
-
return null;
|
53 |
-
if( util::hasNodate( $this->due ))
|
54 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$DUE ) : null;
|
55 |
-
return util::createElement( util::$DUE,
|
56 |
-
util::createParams( $this->due[util::$LCparams] ),
|
57 |
-
util::date2strdate( $this->due[util::$LCvalue],
|
58 |
-
util::isParamsValueSet( $this->due, util::$DATE ) ? 3 : null ));
|
59 |
-
}
|
60 |
-
/**
|
61 |
-
* Set calendar component property due
|
62 |
-
*
|
63 |
-
* @param mixed $year
|
64 |
-
* @param mixed $month
|
65 |
-
* @param int $day
|
66 |
-
* @param int $hour
|
67 |
-
* @param int $min
|
68 |
-
* @param int $sec
|
69 |
-
* @param string $tz
|
70 |
-
* @param array $params
|
71 |
-
* @return bool
|
72 |
-
*/
|
73 |
-
public function setDue( $year, $month=null, $day=null, $hour=null, $min=null, $sec=null, $tz=null, $params=null ) {
|
74 |
-
if( empty( $year )) {
|
75 |
-
if( $this->getConfig( util::$ALLOWEMPTY )) {
|
76 |
-
$this->due = [util::$LCvalue => util::$EMPTYPROPERTY,
|
77 |
-
util::$LCparams => util::setParams( $params )];
|
78 |
-
return true;
|
79 |
-
}
|
80 |
-
else
|
81 |
-
return false;
|
82 |
-
}
|
83 |
-
if( false === ( $tzid = $this->getConfig( util::$TZID )))
|
84 |
-
$tzid = null;
|
85 |
-
$this->due = util::setDate( $year, $month, $day, $hour, $min, $sec, $tz,
|
86 |
-
$params, null, null, $tzid );
|
87 |
-
return true;
|
88 |
-
}
|
89 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/DURATIONtrait.php
DELETED
@@ -1,107 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* DURATION property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-05
|
38 |
-
*/
|
39 |
-
trait DURATIONtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property DURATION value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $duration = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property duration
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createDuration() {
|
51 |
-
if( empty( $this->duration ))
|
52 |
-
return null;
|
53 |
-
if( ! isset( $this->duration[util::$LCvalue][util::$LCWEEK] ) &&
|
54 |
-
! isset( $this->duration[util::$LCvalue][util::$LCDAY] ) &&
|
55 |
-
! isset( $this->duration[util::$LCvalue][util::$LCHOUR] ) &&
|
56 |
-
! isset( $this->duration[util::$LCvalue][util::$LCMIN] ) &&
|
57 |
-
! isset( $this->duration[util::$LCvalue][util::$LCSEC] )) {
|
58 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
59 |
-
return util::createElement( util::$DURATION );
|
60 |
-
else
|
61 |
-
return null;
|
62 |
-
}
|
63 |
-
return util::createElement( util::$DURATION,
|
64 |
-
util::createParams( $this->duration[util::$LCparams] ),
|
65 |
-
util::duration2str( $this->duration[util::$LCvalue] ));
|
66 |
-
}
|
67 |
-
/**
|
68 |
-
* Set calendar component property duration
|
69 |
-
*
|
70 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
71 |
-
* @since 2.23.8 - 2017-04-17
|
72 |
-
* @param mixed $week
|
73 |
-
* @param mixed $day
|
74 |
-
* @param int $hour
|
75 |
-
* @param int $min
|
76 |
-
* @param int $sec
|
77 |
-
* @param array $params
|
78 |
-
* @return bool
|
79 |
-
*/
|
80 |
-
public function setDuration( $week, $day=null, $hour=null, $min=null, $sec=null, $params=null ) {
|
81 |
-
static $PLUSMINUSARR = ['+', '-'];
|
82 |
-
if( empty( $week ) && empty( $day ) && empty( $hour ) && empty( $min ) && empty( $sec )) {
|
83 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
84 |
-
$week = $day = null;
|
85 |
-
else
|
86 |
-
return false;
|
87 |
-
}
|
88 |
-
if( is_array( $week ) && ( 1 <= count( $week )))
|
89 |
-
$this->duration = [util::$LCvalue => util::duration2arr( $week ),
|
90 |
-
util::$LCparams => util::setParams( $day )];
|
91 |
-
elseif( is_string( $week ) && ( 3 <= strlen( trim( $week )))) {
|
92 |
-
$week = util::trimTrailNL( trim( $week ));
|
93 |
-
if( in_array( $week[0], $PLUSMINUSARR ))
|
94 |
-
$week = substr( $week, 1 );
|
95 |
-
$this->duration = [util::$LCvalue => util::durationStr2arr( $week ),
|
96 |
-
util::$LCparams => util::setParams( $day )];
|
97 |
-
}
|
98 |
-
else
|
99 |
-
$this->duration = [util::$LCvalue => util::duration2arr( [util::$LCWEEK => $week,
|
100 |
-
util::$LCDAY => $day,
|
101 |
-
util::$LCHOUR => $hour,
|
102 |
-
util::$LCMIN => $min,
|
103 |
-
util::$LCSEC => $sec] ),
|
104 |
-
util::$LCparams => util::setParams( $params )];
|
105 |
-
return true;
|
106 |
-
}
|
107 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/EXDATEtrait.php
DELETED
@@ -1,86 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
use kigkonsult\iCalcreator\util\utilRexdate;
|
34 |
-
/**
|
35 |
-
* EXDATE property functions
|
36 |
-
*
|
37 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
38 |
-
* @since 2.22.23 - 2017-02-05
|
39 |
-
*/
|
40 |
-
trait EXDATEtrait {
|
41 |
-
/**
|
42 |
-
* @var array component property EXDATE value
|
43 |
-
* @access protected
|
44 |
-
*/
|
45 |
-
protected $exdate = null;
|
46 |
-
/**
|
47 |
-
* Return formatted output for calendar component property exdate
|
48 |
-
*
|
49 |
-
* @return string
|
50 |
-
*/
|
51 |
-
public function createExdate() {
|
52 |
-
if( empty( $this->exdate ))
|
53 |
-
return null;
|
54 |
-
return utilRexdate::formatExdate( $this->exdate,
|
55 |
-
$this->getConfig( util::$ALLOWEMPTY ));
|
56 |
-
}
|
57 |
-
/**
|
58 |
-
* Set calendar component property exdate
|
59 |
-
*
|
60 |
-
* @param array $exdates
|
61 |
-
* @param array $params
|
62 |
-
* @param integer $index
|
63 |
-
* @return bool
|
64 |
-
*/
|
65 |
-
public function setExdate( $exdates, $params=null, $index=null ) {
|
66 |
-
if( empty( $exdates )) {
|
67 |
-
if( $this->getConfig( util::$ALLOWEMPTY )) {
|
68 |
-
util::setMval( $this->exdate,
|
69 |
-
util::$EMPTYPROPERTY,
|
70 |
-
$params,
|
71 |
-
false,
|
72 |
-
$index );
|
73 |
-
return true;
|
74 |
-
}
|
75 |
-
else
|
76 |
-
return false;
|
77 |
-
}
|
78 |
-
$input = utilRexdate::prepInputExdate( $exdates, $params );
|
79 |
-
util::setMval( $this->exdate,
|
80 |
-
$input[util::$LCvalue],
|
81 |
-
$input[util::$LCparams],
|
82 |
-
false,
|
83 |
-
$index );
|
84 |
-
return true;
|
85 |
-
}
|
86 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/EXRULEtrait.php
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
use kigkonsult\iCalcreator\util\utilRecur;
|
34 |
-
/**
|
35 |
-
* EXRULE property functions
|
36 |
-
*
|
37 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
38 |
-
* @since 2.22.23 - 2017-04-03
|
39 |
-
*/
|
40 |
-
trait EXRULEtrait {
|
41 |
-
/**
|
42 |
-
* @var array component property EXRULE value
|
43 |
-
* @access protected
|
44 |
-
*/
|
45 |
-
protected $exrule = null;
|
46 |
-
/**
|
47 |
-
* Return formatted output for calendar component property exrule
|
48 |
-
*
|
49 |
-
* @return string
|
50 |
-
*/
|
51 |
-
public function createExrule() {
|
52 |
-
return utilRecur::formatRecur( util::$EXRULE,
|
53 |
-
$this->exrule,
|
54 |
-
$this->getConfig( util::$ALLOWEMPTY ));
|
55 |
-
}
|
56 |
-
/**
|
57 |
-
* Set calendar component property exdate
|
58 |
-
*
|
59 |
-
* @param array $exruleset
|
60 |
-
* @param array $params
|
61 |
-
* @param integer $index
|
62 |
-
* @return bool
|
63 |
-
*/
|
64 |
-
public function setExrule( $exruleset, $params=null, $index=null ) {
|
65 |
-
if( empty( $exruleset )) {
|
66 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
67 |
-
$exruleset = util::$EMPTYPROPERTY;
|
68 |
-
else
|
69 |
-
return false;
|
70 |
-
}
|
71 |
-
util::setMval( $this->exrule,
|
72 |
-
utilRecur::setRexrule( $exruleset ),
|
73 |
-
$params,
|
74 |
-
false,
|
75 |
-
$index );
|
76 |
-
return true;
|
77 |
-
}
|
78 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/FREEBUSYtrait.php
DELETED
@@ -1,188 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* FREEBUSY property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-17
|
38 |
-
*/
|
39 |
-
trait FREEBUSYtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property FREEBUSY value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $freebusy = null;
|
45 |
-
/**
|
46 |
-
* @var FREEBUSY param keywords
|
47 |
-
* @access protected
|
48 |
-
* @static
|
49 |
-
*/
|
50 |
-
protected static $LCFBTYPE = 'fbtype';
|
51 |
-
protected static $UCFBTYPE = 'FBTYPE';
|
52 |
-
protected static $FREEBUSYKEYS = ['FREE', 'BUSY', 'BUSY-UNAVAILABLE', 'BUSY-TENTATIVE'];
|
53 |
-
protected static $FREE = 'FREE';
|
54 |
-
protected static $BUSY = 'BUSY';
|
55 |
-
/*
|
56 |
-
protected static $BUSY_UNAVAILABLE = 'BUSY-UNAVAILABLE';
|
57 |
-
protected static $BUSY_TENTATIVE = 'BUSY-TENTATIVE';
|
58 |
-
*/
|
59 |
-
/**
|
60 |
-
* Return formatted output for calendar component property freebusy
|
61 |
-
*
|
62 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
63 |
-
* @since 2.16.27 - 2013-07-05
|
64 |
-
* @return string
|
65 |
-
*/
|
66 |
-
public function createFreebusy() {
|
67 |
-
static $FMT = ';FBTYPE=%s';
|
68 |
-
static $SORTER = ['kigkonsult\iCalcreator\vcalendarSortHandler', 'sortRdate1'];
|
69 |
-
if( empty( $this->freebusy ))
|
70 |
-
return null;
|
71 |
-
$output = null;
|
72 |
-
foreach( $this->freebusy as $fx => $freebusyPart ) {
|
73 |
-
if( empty( $freebusyPart[util::$LCvalue] ) ||
|
74 |
-
(( 1 == count( $freebusyPart[util::$LCvalue] )) &&
|
75 |
-
isset( $freebusyPart[util::$LCvalue][self::$LCFBTYPE] ))) {
|
76 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
77 |
-
$output .= util::createElement( util::$FREEBUSY );
|
78 |
-
continue;
|
79 |
-
}
|
80 |
-
$attributes = $content = null;
|
81 |
-
if( isset( $freebusyPart[util::$LCvalue][self::$LCFBTYPE] )) {
|
82 |
-
$attributes .= sprintf( $FMT, $freebusyPart[util::$LCvalue][self::$LCFBTYPE] );
|
83 |
-
unset( $freebusyPart[util::$LCvalue][self::$LCFBTYPE] );
|
84 |
-
$freebusyPart[util::$LCvalue] = array_values( $freebusyPart[util::$LCvalue] );
|
85 |
-
}
|
86 |
-
else
|
87 |
-
$attributes .= sprintf( $FMT, self::$BUSY );
|
88 |
-
$attributes .= util::createParams( $freebusyPart[util::$LCparams] );
|
89 |
-
$fno = 1;
|
90 |
-
$cnt = count( $freebusyPart[util::$LCvalue]);
|
91 |
-
if( 1 < $cnt )
|
92 |
-
usort( $freebusyPart[util::$LCvalue], $SORTER );
|
93 |
-
foreach( $freebusyPart[util::$LCvalue] as $periodix => $freebusyPeriod ) {
|
94 |
-
$formatted = util::date2strdate( $freebusyPeriod[0] );
|
95 |
-
$content .= $formatted;
|
96 |
-
$content .= util::$L;
|
97 |
-
$cnt2 = count( $freebusyPeriod[1]);
|
98 |
-
if( array_key_exists( util::$LCYEAR, $freebusyPeriod[1] )) // date-time
|
99 |
-
$cnt2 = 7;
|
100 |
-
elseif( array_key_exists( util::$LCWEEK, $freebusyPeriod[1] )) // duration
|
101 |
-
$cnt2 = 5;
|
102 |
-
if(( 7 == $cnt2 ) && // period= -> date-time
|
103 |
-
isset( $freebusyPeriod[1][util::$LCYEAR] ) &&
|
104 |
-
isset( $freebusyPeriod[1][util::$LCMONTH] ) &&
|
105 |
-
isset( $freebusyPeriod[1][util::$LCDAY] )) {
|
106 |
-
$content .= util::date2strdate( $freebusyPeriod[1] );
|
107 |
-
}
|
108 |
-
else { // period= -> dur-time
|
109 |
-
$content .= util::duration2str( $freebusyPeriod[1] );
|
110 |
-
}
|
111 |
-
if( $fno < $cnt )
|
112 |
-
$content .= util::$COMMA;
|
113 |
-
$fno++;
|
114 |
-
} // end foreach( $freebusyPart[util::$LCvalue] as $periodix => $freebusyPeriod )
|
115 |
-
$output .= util::createElement( util::$FREEBUSY,
|
116 |
-
$attributes,
|
117 |
-
$content );
|
118 |
-
} // end foreach( $this->freebusy as $fx => $freebusyPart )
|
119 |
-
return $output;
|
120 |
-
}
|
121 |
-
/**
|
122 |
-
* Set calendar component property freebusy
|
123 |
-
*
|
124 |
-
* @param string $fbType
|
125 |
-
* @param array $fbValues
|
126 |
-
* @param array $params
|
127 |
-
* @param integer $index
|
128 |
-
* @return bool
|
129 |
-
*/
|
130 |
-
public function setFreebusy( $fbType, $fbValues, $params=null, $index=null ) {
|
131 |
-
static $PREFIXARR = ['P', '+', '-'];
|
132 |
-
if( empty( $fbValues )) {
|
133 |
-
if( $this->getConfig( util::$ALLOWEMPTY )) {
|
134 |
-
util::setMval( $this->freebusy,
|
135 |
-
util::$EMPTYPROPERTY,
|
136 |
-
$params,
|
137 |
-
false,
|
138 |
-
$index );
|
139 |
-
return true;
|
140 |
-
}
|
141 |
-
else
|
142 |
-
return false;
|
143 |
-
}
|
144 |
-
$fbType = strtoupper( $fbType );
|
145 |
-
if( ! in_array( $fbType, self::$FREEBUSYKEYS ) &&
|
146 |
-
! util::isXprefixed( $fbType ))
|
147 |
-
$fbType = self::$BUSY;
|
148 |
-
$input = [self::$LCFBTYPE => $fbType];
|
149 |
-
foreach( $fbValues as $fbPeriod ) { // periods => period
|
150 |
-
if( empty( $fbPeriod ))
|
151 |
-
continue;
|
152 |
-
$freebusyPeriod = [];
|
153 |
-
foreach( $fbPeriod as $fbMember ) { // pairs => singlepart
|
154 |
-
$freebusyPairMember = [];
|
155 |
-
if( is_array( $fbMember )) {
|
156 |
-
if( util::isArrayDate( $fbMember )) { // date-time value
|
157 |
-
$freebusyPairMember = util::chkDateArr( $fbMember, 7 );
|
158 |
-
$freebusyPairMember[util::$LCtz] = util::$Z;
|
159 |
-
}
|
160 |
-
elseif( util::isArrayTimestampDate( $fbMember )) { // timestamp value
|
161 |
-
$freebusyPairMember = util::timestamp2date( $fbMember[util::$LCTIMESTAMP], 7 );
|
162 |
-
$freebusyPairMember[util::$LCtz] = util::$Z;
|
163 |
-
}
|
164 |
-
else { // array format duration
|
165 |
-
$freebusyPairMember = util::duration2arr( $fbMember );
|
166 |
-
}
|
167 |
-
}
|
168 |
-
elseif(( 3 <= strlen( trim( $fbMember ))) && // string format duration
|
169 |
-
( in_array( $fbMember{0}, $PREFIXARR ))) {
|
170 |
-
$freebusyPairMember = util::durationStr2arr( $fbMember );
|
171 |
-
}
|
172 |
-
elseif( 8 <= strlen( trim( $fbMember ))) { // text date ex. 2006-08-03 10:12:18
|
173 |
-
$freebusyPairMember = util::strDate2ArrayDate( $fbMember, 7 );
|
174 |
-
unset( $freebusyPairMember[util::$UNPARSEDTEXT] );
|
175 |
-
$freebusyPairMember[util::$LCtz] = util::$Z;
|
176 |
-
}
|
177 |
-
$freebusyPeriod[] = $freebusyPairMember;
|
178 |
-
}
|
179 |
-
$input[] = $freebusyPeriod;
|
180 |
-
}
|
181 |
-
util::setMval( $this->freebusy,
|
182 |
-
$input,
|
183 |
-
$params,
|
184 |
-
false,
|
185 |
-
$index );
|
186 |
-
return true;
|
187 |
-
}
|
188 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/GEOtrait.php
DELETED
@@ -1,85 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
use kigkonsult\iCalcreator\util\utilGeo;
|
34 |
-
/**
|
35 |
-
* GEO property functions
|
36 |
-
*
|
37 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
38 |
-
* @since 2.22.23 - 2017-02-02
|
39 |
-
*/
|
40 |
-
trait GEOtrait {
|
41 |
-
/**
|
42 |
-
* @var array component property GEO value
|
43 |
-
* @access protected
|
44 |
-
*/
|
45 |
-
protected $geo = null;
|
46 |
-
/**
|
47 |
-
* Return formatted output for calendar component property geo
|
48 |
-
*
|
49 |
-
* @return string
|
50 |
-
*/
|
51 |
-
public function createGeo() {
|
52 |
-
if( empty( $this->geo ))
|
53 |
-
return null;
|
54 |
-
if( empty( $this->geo[util::$LCvalue] ))
|
55 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$GEO ) : null;
|
56 |
-
return util::createElement( util::$GEO,
|
57 |
-
util::createParams( $this->geo[util::$LCparams] ),
|
58 |
-
utilGeo::geo2str2( $this->geo[util::$LCvalue][utilGeo::$LATITUDE], utilGeo::$geoLatFmt ) .
|
59 |
-
util::$SEMIC .
|
60 |
-
utilGeo::geo2str2( $this->geo[util::$LCvalue][utilGeo::$LONGITUDE], utilGeo::$geoLongFmt ));
|
61 |
-
}
|
62 |
-
/**
|
63 |
-
* Set calendar component property geo
|
64 |
-
*
|
65 |
-
* @param mixed $latitude
|
66 |
-
* @param mixed $longitude
|
67 |
-
* @param array $params
|
68 |
-
* @return bool
|
69 |
-
*/
|
70 |
-
public function setGeo( $latitude, $longitude, $params=null ) {
|
71 |
-
if( isset( $latitude ) && isset( $longitude )) {
|
72 |
-
if( ! is_array( $this->geo ))
|
73 |
-
$this->geo = [];
|
74 |
-
$this->geo[util::$LCvalue][utilGeo::$LATITUDE] = floatval( $latitude );
|
75 |
-
$this->geo[util::$LCvalue][utilGeo::$LONGITUDE] = floatval( $longitude );
|
76 |
-
$this->geo[util::$LCparams] = util::setParams( $params );
|
77 |
-
}
|
78 |
-
elseif( $this->getConfig( util::$ALLOWEMPTY ))
|
79 |
-
$this->geo = [util::$LCvalue => util::$EMPTYPROPERTY,
|
80 |
-
util::$LCparams => util::setParams( $params )];
|
81 |
-
else
|
82 |
-
return false;
|
83 |
-
return true;
|
84 |
-
}
|
85 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/LAST_MODIFIEDtrait.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* LAST-MODIFIED property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait LAST_MODIFIEDtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property LAST-MODIFIED value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $lastmodified = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property last-modified
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createLastModified() {
|
51 |
-
if( empty( $this->lastmodified ))
|
52 |
-
return null;
|
53 |
-
return util::createElement( util::$LAST_MODIFIED,
|
54 |
-
util::createParams( $this->lastmodified[util::$LCparams] ),
|
55 |
-
util::date2strdate( $this->lastmodified[util::$LCvalue], 7 ));
|
56 |
-
}
|
57 |
-
/**
|
58 |
-
* Set calendar component property completed
|
59 |
-
*
|
60 |
-
* @param mixed $year
|
61 |
-
* @param mixed $month
|
62 |
-
* @param int $day
|
63 |
-
* @param int $hour
|
64 |
-
* @param int $min
|
65 |
-
* @param int $sec
|
66 |
-
* @param array $params
|
67 |
-
* @return bool
|
68 |
-
*/
|
69 |
-
public function setLastModified( $year=null, $month=null, $day=null, $hour=null, $min=null, $sec=null, $params=null ) {
|
70 |
-
static $TMDTHIS = 'Ymd\THis';
|
71 |
-
if( empty( $year ))
|
72 |
-
$year = gmdate( $TMDTHIS );
|
73 |
-
$this->lastmodified = util::setDate2( $year, $month, $day, $hour, $min, $sec, $params );
|
74 |
-
return true;
|
75 |
-
}
|
76 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/LOCATIONtrait.php
DELETED
@@ -1,79 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* LOCATION property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-17
|
38 |
-
*/
|
39 |
-
trait LOCATIONtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property LOCATION value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $location = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property location
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createLocation() {
|
51 |
-
if( empty( $this->location ))
|
52 |
-
return null;
|
53 |
-
if( empty( $this->location[util::$LCvalue] ))
|
54 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$LOCATION ) : null;
|
55 |
-
return util::createElement( util::$LOCATION,
|
56 |
-
util::createParams( $this->location[util::$LCparams],
|
57 |
-
util::$ALTRPLANGARR,
|
58 |
-
$this->getConfig( util::$LANGUAGE )),
|
59 |
-
util::strrep( $this->location[util::$LCvalue] ));
|
60 |
-
}
|
61 |
-
/**
|
62 |
-
* Set calendar component property location
|
63 |
-
*
|
64 |
-
* @param string $value
|
65 |
-
* @param array $params
|
66 |
-
* @return bool
|
67 |
-
*/
|
68 |
-
public function setLocation( $value, $params=null ) {
|
69 |
-
if( empty( $value )) {
|
70 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
71 |
-
$value = util::$EMPTYPROPERTY;
|
72 |
-
else
|
73 |
-
return false;
|
74 |
-
}
|
75 |
-
$this->location = [util::$LCvalue => util::trimTrailNL( $value ),
|
76 |
-
util::$LCparams => util::setParams( $params )];
|
77 |
-
return true;
|
78 |
-
}
|
79 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/METHODtrait.php
DELETED
@@ -1,68 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* METHOD property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait METHODtrait {
|
40 |
-
/**
|
41 |
-
* @var string calendar property METHOD
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $method = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar property method
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createMethod() {
|
51 |
-
return ( empty( $this->method ))
|
52 |
-
? null
|
53 |
-
: sprintf( self::$FMTICAL, util::$METHOD,
|
54 |
-
$this->method );
|
55 |
-
}
|
56 |
-
/**
|
57 |
-
* Set calendar property method
|
58 |
-
*
|
59 |
-
* @param string $value
|
60 |
-
* @return bool
|
61 |
-
*/
|
62 |
-
public function setMethod( $value ) {
|
63 |
-
if( empty( $value ))
|
64 |
-
return false;
|
65 |
-
$this->method = $value;
|
66 |
-
return true;
|
67 |
-
}
|
68 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/ORGANIZERtrait.php
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
use kigkonsult\iCalcreator\util\utilAttendee;
|
34 |
-
/**
|
35 |
-
* ORGANIZER property functions
|
36 |
-
*
|
37 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
38 |
-
* @since 2.22.23 - 2017-04-03
|
39 |
-
*/
|
40 |
-
trait ORGANIZERtrait {
|
41 |
-
/**
|
42 |
-
* @var array component property ORGANIZER value
|
43 |
-
* @access protected
|
44 |
-
*/
|
45 |
-
protected $organizer = null;
|
46 |
-
/**
|
47 |
-
* Return formatted output for calendar component property organizer
|
48 |
-
*
|
49 |
-
* @return string
|
50 |
-
*/
|
51 |
-
public function createOrganizer() {
|
52 |
-
if( empty( $this->organizer ))
|
53 |
-
return null;
|
54 |
-
if( empty( $this->organizer[util::$LCvalue] ))
|
55 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$ORGANIZER ) : null;
|
56 |
-
return util::createElement( util::$ORGANIZER,
|
57 |
-
util::createParams( $this->organizer[util::$LCparams],
|
58 |
-
[util::$CN,
|
59 |
-
util::$DIR,
|
60 |
-
util::$SENT_BY,
|
61 |
-
util::$LANGUAGE],
|
62 |
-
$this->getConfig( util::$LANGUAGE )),
|
63 |
-
$this->organizer[util::$LCvalue] );
|
64 |
-
}
|
65 |
-
/**
|
66 |
-
* Set calendar component property organizer
|
67 |
-
*
|
68 |
-
* @param string $value
|
69 |
-
* @param array $params
|
70 |
-
* @return bool
|
71 |
-
*/
|
72 |
-
public function setOrganizer( $value, $params=null ) {
|
73 |
-
if( empty( $value )) {
|
74 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
75 |
-
$value = util::$EMPTYPROPERTY;
|
76 |
-
else
|
77 |
-
return false;
|
78 |
-
}
|
79 |
-
$value = utilAttendee::calAddressCheck( $value, false );
|
80 |
-
$this->organizer = [util::$LCvalue => $value,
|
81 |
-
util::$LCparams => util::setParams( $params )];
|
82 |
-
if( isset( $this->organizer[util::$LCparams][util::$SENT_BY] ))
|
83 |
-
$this->organizer[util::$LCparams][util::$SENT_BY] =
|
84 |
-
utilAttendee::calAddressCheck( $this->organizer[util::$LCparams][util::$SENT_BY],
|
85 |
-
false );
|
86 |
-
return true;
|
87 |
-
}
|
88 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/PERCENT_COMPLETEtrait.php
DELETED
@@ -1,80 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* PERCENT-COMPLETE property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-05
|
38 |
-
*/
|
39 |
-
trait PERCENT_COMPLETEtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property PERCENT_COMPLETE value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $percentcomplete = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property percent-complete
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createPercentComplete() {
|
51 |
-
if( ! isset( $this->percentcomplete ) ||
|
52 |
-
( empty( $this->percentcomplete ) && ! is_numeric( $this->percentcomplete )))
|
53 |
-
return null;
|
54 |
-
if( ! isset( $this->percentcomplete[util::$LCvalue] ) ||
|
55 |
-
( empty( $this->percentcomplete[util::$LCvalue] ) &&
|
56 |
-
! is_numeric( $this->percentcomplete[util::$LCvalue] )))
|
57 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$PERCENT_COMPLETE ) : null;
|
58 |
-
return util::createElement( util::$PERCENT_COMPLETE,
|
59 |
-
util::createParams( $this->percentcomplete[util::$LCparams] ),
|
60 |
-
$this->percentcomplete[util::$LCvalue] );
|
61 |
-
}
|
62 |
-
/**
|
63 |
-
* Set calendar component property percent-complete
|
64 |
-
*
|
65 |
-
* @param int $value
|
66 |
-
* @param array $params
|
67 |
-
* @return bool
|
68 |
-
*/
|
69 |
-
public function setPercentComplete( $value, $params=null ) {
|
70 |
-
if( empty( $value ) && ! is_numeric( $value )) {
|
71 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
72 |
-
$value = util::$EMPTYPROPERTY;
|
73 |
-
else
|
74 |
-
return false;
|
75 |
-
}
|
76 |
-
$this->percentcomplete = [util::$LCvalue => $value,
|
77 |
-
util::$LCparams => util::setParams( $params )];
|
78 |
-
return true;
|
79 |
-
}
|
80 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/PRIORITYtrait.php
DELETED
@@ -1,79 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* PRIORITY property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait PRIORITYtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property PRIORITY value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $priority = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property priority
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createPriority() {
|
51 |
-
if( ! isset( $this->priority ) ||
|
52 |
-
( empty( $this->priority ) && ! is_numeric( $this->priority )))
|
53 |
-
return null;
|
54 |
-
if( ! isset( $this->priority[util::$LCvalue] ) ||
|
55 |
-
( empty( $this->priority[util::$LCvalue] ) && !is_numeric( $this->priority[util::$LCvalue] )))
|
56 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$PRIORITY ) : null;
|
57 |
-
return util::createElement( util::$PRIORITY,
|
58 |
-
util::createParams( $this->priority[util::$LCparams] ),
|
59 |
-
$this->priority[util::$LCvalue] );
|
60 |
-
}
|
61 |
-
/**
|
62 |
-
* Set calendar component property priority
|
63 |
-
*
|
64 |
-
* @param int $value
|
65 |
-
* @param array $params
|
66 |
-
* @return bool
|
67 |
-
*/
|
68 |
-
public function setPriority( $value, $params=null ) {
|
69 |
-
if( empty( $value ) && ! is_numeric( $value )) {
|
70 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
71 |
-
$value = util::$EMPTYPROPERTY;
|
72 |
-
else
|
73 |
-
return false;
|
74 |
-
}
|
75 |
-
$this->priority = [util::$LCvalue => $value,
|
76 |
-
util::$LCparams => util::setParams( $params )];
|
77 |
-
return true;
|
78 |
-
}
|
79 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/PRODIDtrait.php
DELETED
@@ -1,81 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* PRODID property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-03-15
|
38 |
-
*/
|
39 |
-
trait PRODIDtrait {
|
40 |
-
/**
|
41 |
-
* @var string calendar property PRODID
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $prodid = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar property prodid
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createProdid() {
|
51 |
-
if( ! isset( $this->prodid ))
|
52 |
-
$this->makeProdid();
|
53 |
-
return util::createElement( util::$PRODID,
|
54 |
-
null,
|
55 |
-
$this->prodid );
|
56 |
-
}
|
57 |
-
/**
|
58 |
-
* Create default value for calendar prodid,
|
59 |
-
* Do NOT alter or remove this method or the invoke of this method,
|
60 |
-
* a licence violation.
|
61 |
-
*
|
62 |
-
* [rfc5545]
|
63 |
-
* "Conformance: The property MUST be specified once in an iCalendar object.
|
64 |
-
* Description: The vendor of the implementation SHOULD assure that this
|
65 |
-
* is a globally unique identifier; using some technique such as an FPI
|
66 |
-
* value, as defined in [ISO 9070]."
|
67 |
-
*
|
68 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
69 |
-
* @since 2.22.20 - 2017-01-29
|
70 |
-
*/
|
71 |
-
public function makeProdid() {
|
72 |
-
static $FMT = '-//%s//NONSGML kigkonsult.se %s//%s';
|
73 |
-
if( false !== ( $lang = $this->getConfig( util::$LANGUAGE )))
|
74 |
-
$lang = strtoupper( $lang );
|
75 |
-
else
|
76 |
-
$lang = null;
|
77 |
-
$this->prodid = sprintf( $FMT, $this->getConfig( util::$UNIQUE_ID ),
|
78 |
-
ICALCREATOR_VERSION,
|
79 |
-
$lang );
|
80 |
-
}
|
81 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/RDATEtrait.php
DELETED
@@ -1,89 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
use kigkonsult\iCalcreator\util\utilRexdate;
|
34 |
-
/**
|
35 |
-
* RDATE property functions
|
36 |
-
*
|
37 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
38 |
-
* @since 2.22.23 - 2017-02-26
|
39 |
-
*/
|
40 |
-
trait RDATEtrait {
|
41 |
-
/**
|
42 |
-
* @var array component property RDATE value
|
43 |
-
* @access protected
|
44 |
-
*/
|
45 |
-
protected $rdate = null;
|
46 |
-
/**
|
47 |
-
* Return formatted output for calendar component property rdate
|
48 |
-
*
|
49 |
-
* @return string
|
50 |
-
*/
|
51 |
-
public function createRdate() {
|
52 |
-
if( empty( $this->rdate ))
|
53 |
-
return null;
|
54 |
-
return utilRexdate::formatRdate( $this->rdate,
|
55 |
-
$this->getConfig( util::$ALLOWEMPTY ),
|
56 |
-
$this->objName );
|
57 |
-
}
|
58 |
-
/**
|
59 |
-
* Set calendar component property rdate
|
60 |
-
*
|
61 |
-
* @param array $rdates
|
62 |
-
* @param array $params
|
63 |
-
* @param integer $index
|
64 |
-
* @return bool
|
65 |
-
*/
|
66 |
-
public function setRdate( $rdates, $params=null, $index=null ) {
|
67 |
-
if( empty( $rdates )) {
|
68 |
-
if( $this->getConfig( util::$ALLOWEMPTY )) {
|
69 |
-
util::setMval( $this->rdate,
|
70 |
-
util::$EMPTYPROPERTY,
|
71 |
-
$params,
|
72 |
-
false,
|
73 |
-
$index );
|
74 |
-
return true;
|
75 |
-
}
|
76 |
-
else
|
77 |
-
return false;
|
78 |
-
}
|
79 |
-
$input = utilRexdate::prepInputRdate( $rdates,
|
80 |
-
$params,
|
81 |
-
$this->objName );
|
82 |
-
util::setMval( $this->rdate,
|
83 |
-
$input[util::$LCvalue],
|
84 |
-
$input[util::$LCparams],
|
85 |
-
false,
|
86 |
-
$index );
|
87 |
-
return true;
|
88 |
-
}
|
89 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/RECURRENCE_IDtrait.php
DELETED
@@ -1,92 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* RECURRENCE-ID property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-05
|
38 |
-
*/
|
39 |
-
trait RECURRENCE_IDtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property RECURRENCE_ID value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $recurrenceid = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property recurrence-id
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createRecurrenceid() {
|
51 |
-
if( empty( $this->recurrenceid ))
|
52 |
-
return null;
|
53 |
-
if( empty( $this->recurrenceid[util::$LCvalue] ))
|
54 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$RECURRENCE_ID ) : null;
|
55 |
-
return util::createElement( util::$RECURRENCE_ID,
|
56 |
-
util::createParams( $this->recurrenceid[util::$LCparams] ),
|
57 |
-
util::date2strdate( $this->recurrenceid[util::$LCvalue],
|
58 |
-
util::isParamsValueSet( $this->recurrenceid, util::$DATE ) ? 3 : null ));
|
59 |
-
}
|
60 |
-
/**
|
61 |
-
* Set calendar component property recurrence-id
|
62 |
-
*
|
63 |
-
* @param mixed $year
|
64 |
-
* @param mixed $month
|
65 |
-
* @param int $day
|
66 |
-
* @param int $hour
|
67 |
-
* @param int $min
|
68 |
-
* @param int $sec
|
69 |
-
* @param string $tz
|
70 |
-
* @param array $params
|
71 |
-
* @return bool
|
72 |
-
*/
|
73 |
-
public function setRecurrenceid( $year, $month=null, $day=null,
|
74 |
-
$hour=null, $min=null, $sec=null,
|
75 |
-
$tz=null, $params=null ) {
|
76 |
-
if( empty( $year )) {
|
77 |
-
if( $this->getConfig( util::$ALLOWEMPTY )) {
|
78 |
-
$this->recurrenceid = [util::$LCvalue => util::$EMPTYPROPERTY,
|
79 |
-
util::$LCparams => null];
|
80 |
-
return true;
|
81 |
-
}
|
82 |
-
else
|
83 |
-
return false;
|
84 |
-
}
|
85 |
-
$this->recurrenceid = util::setDate( $year, $month, $day, $hour, $min, $sec, $tz,
|
86 |
-
$params,
|
87 |
-
null,
|
88 |
-
null,
|
89 |
-
$this->getConfig( util::$TZID ));
|
90 |
-
return true;
|
91 |
-
}
|
92 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/RELATED_TOtrait.php
DELETED
@@ -1,89 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* RELATED-TO property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-17
|
38 |
-
*/
|
39 |
-
trait RELATED_TOtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property RELATED_TO value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $relatedto = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property related-to
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createRelatedTo() {
|
51 |
-
if( empty( $this->relatedto ))
|
52 |
-
return null;
|
53 |
-
$output = null;
|
54 |
-
foreach( $this->relatedto as $rx => $relation ) {
|
55 |
-
if( ! empty( $relation[util::$LCvalue] ))
|
56 |
-
$output .= util::createElement( util::$RELATED_TO,
|
57 |
-
util::createParams( $relation[util::$LCparams] ),
|
58 |
-
util::strrep( $relation[util::$LCvalue] ));
|
59 |
-
elseif( $this->getConfig( util::$ALLOWEMPTY ))
|
60 |
-
$output .= util::createElement( util::$RELATED_TO );
|
61 |
-
}
|
62 |
-
return $output;
|
63 |
-
}
|
64 |
-
/**
|
65 |
-
* Set calendar component property related-to
|
66 |
-
*
|
67 |
-
* @param string $value
|
68 |
-
* @param array $params
|
69 |
-
* @param int $index
|
70 |
-
* @return bool
|
71 |
-
*/
|
72 |
-
public function setRelatedTo( $value, $params=null, $index=null ) {
|
73 |
-
static $RELTYPE = 'RELTYPE';
|
74 |
-
static $PARENT = 'PARENT';
|
75 |
-
if( empty( $value )) {
|
76 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
77 |
-
$value = util::$EMPTYPROPERTY;
|
78 |
-
else
|
79 |
-
return false;
|
80 |
-
}
|
81 |
-
util::existRem( $params, $RELTYPE, $PARENT, true ); // remove default
|
82 |
-
util::setMval( $this->relatedto,
|
83 |
-
util::trimTrailNL( $value ),
|
84 |
-
$params,
|
85 |
-
false,
|
86 |
-
$index );
|
87 |
-
return true;
|
88 |
-
}
|
89 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/REPEATtrait.php
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* REPEAT property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-05
|
38 |
-
*/
|
39 |
-
trait REPEATtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property REPEAT value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $repeat = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property repeat
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createRepeat() {
|
51 |
-
if( ! isset( $this->repeat ) ||
|
52 |
-
( empty( $this->repeat ) && ! is_numeric( $this->repeat )))
|
53 |
-
return null;
|
54 |
-
if( ! isset( $this->repeat[util::$LCvalue]) ||
|
55 |
-
( empty( $this->repeat[util::$LCvalue] ) && ! is_numeric( $this->repeat[util::$LCvalue] )))
|
56 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$REPEAT ) : null;
|
57 |
-
return util::createElement( util::$REPEAT,
|
58 |
-
util::createParams( $this->repeat[util::$LCparams] ),
|
59 |
-
$this->repeat[util::$LCvalue] );
|
60 |
-
}
|
61 |
-
/**
|
62 |
-
* Set calendar component property repeat
|
63 |
-
*
|
64 |
-
* @param string $value
|
65 |
-
* @param array $params
|
66 |
-
*/
|
67 |
-
public function setRepeat( $value, $params=null ) {
|
68 |
-
if( empty( $value ) && !is_numeric( $value )) {
|
69 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
70 |
-
$value = util::$EMPTYPROPERTY;
|
71 |
-
else
|
72 |
-
return false;
|
73 |
-
}
|
74 |
-
$this->repeat = [util::$LCvalue => $value,
|
75 |
-
util::$LCparams => util::setParams( $params )];
|
76 |
-
return true;
|
77 |
-
}
|
78 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/REQUEST_STATUStrait.php
DELETED
@@ -1,107 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* REQUEST-STATUS property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-19
|
38 |
-
*/
|
39 |
-
trait REQUEST_STATUStrait {
|
40 |
-
/**
|
41 |
-
* @var array component property REQUEST-STATUS value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $requeststatus = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property request-status
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createRequestStatus() {
|
51 |
-
static $STATCODE = 'statcode';
|
52 |
-
static $TEXT = 'text';
|
53 |
-
static $EXTDATA = 'extdata';
|
54 |
-
if( empty( $this->requeststatus ))
|
55 |
-
return null;
|
56 |
-
$output = null;
|
57 |
-
$lang = $this->getConfig( util::$LANGUAGE );
|
58 |
-
foreach( $this->requeststatus as $rx => $rStat ) {
|
59 |
-
if( empty( $rStat[util::$LCvalue][$STATCODE] )) {
|
60 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
61 |
-
$output .= util::createElement( util::$REQUEST_STATUS );
|
62 |
-
continue;
|
63 |
-
}
|
64 |
-
$content = number_format( (float) $rStat[util::$LCvalue][$STATCODE], 2, util::$DOT, null );
|
65 |
-
$content .= util::$SEMIC . util::strrep( $rStat[util::$LCvalue][$TEXT] );
|
66 |
-
if( isset( $rStat[util::$LCvalue][$EXTDATA] ))
|
67 |
-
$content .= util::$SEMIC . util::strrep( $rStat[util::$LCvalue][$EXTDATA] );
|
68 |
-
$output .= util::createElement( util::$REQUEST_STATUS,
|
69 |
-
util::createParams( $rStat[util::$LCparams],
|
70 |
-
[util::$LANGUAGE],
|
71 |
-
$lang ),
|
72 |
-
$content );
|
73 |
-
}
|
74 |
-
return $output;
|
75 |
-
}
|
76 |
-
/**
|
77 |
-
* Set calendar component property request-status
|
78 |
-
*
|
79 |
-
* @param float $statcode
|
80 |
-
* @param string $text
|
81 |
-
* @param string $extdata
|
82 |
-
* @param array $params
|
83 |
-
* @param integer $index
|
84 |
-
* @return bool
|
85 |
-
*/
|
86 |
-
public function setRequestStatus( $statcode, $text, $extdata=null, $params=null, $index=null ) {
|
87 |
-
static $STATCODE = 'statcode';
|
88 |
-
static $TEXT = 'text';
|
89 |
-
static $EXTDATA = 'extdata';
|
90 |
-
if( empty( $statcode ) || empty( $text )) {
|
91 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
92 |
-
$statcode = $text = util::$EMPTYPROPERTY;
|
93 |
-
else
|
94 |
-
return false;
|
95 |
-
}
|
96 |
-
$input = [$STATCODE => $statcode,
|
97 |
-
$TEXT => util::trimTrailNL( $text )];
|
98 |
-
if( $extdata )
|
99 |
-
$input[$EXTDATA] = util::trimTrailNL( $extdata );
|
100 |
-
util::setMval( $this->requeststatus,
|
101 |
-
$input,
|
102 |
-
$params,
|
103 |
-
false,
|
104 |
-
$index );
|
105 |
-
return true;
|
106 |
-
}
|
107 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/RESOURCEStrait.php
DELETED
@@ -1,103 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* RESOURCES property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-17
|
38 |
-
*/
|
39 |
-
trait RESOURCEStrait {
|
40 |
-
/**
|
41 |
-
* @var array component property RESOURCES value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $resources = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property resources
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createResources() {
|
51 |
-
if( empty( $this->resources ))
|
52 |
-
return null;
|
53 |
-
$output = null;
|
54 |
-
$lang = $this->getConfig( util::$LANGUAGE );
|
55 |
-
foreach( $this->resources as $rx => $resource ) {
|
56 |
-
if( empty( $resource[util::$LCvalue] )) {
|
57 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
58 |
-
$output .= util::createElement( util::$RESOURCES );
|
59 |
-
continue;
|
60 |
-
}
|
61 |
-
if( is_array( $resource[util::$LCvalue] )) {
|
62 |
-
foreach( $resource[util::$LCvalue] as $rix => $rValue )
|
63 |
-
$resource[util::$LCvalue][$rix] = util::strrep( $rValue );
|
64 |
-
$content = implode( util::$COMMA, $resource[util::$LCvalue] );
|
65 |
-
}
|
66 |
-
else
|
67 |
-
$content = util::strrep( $resource[util::$LCvalue] );
|
68 |
-
$output .= util::createElement( util::$RESOURCES,
|
69 |
-
util::createParams( $resource[util::$LCparams],
|
70 |
-
util::$ALTRPLANGARR,
|
71 |
-
$lang ),
|
72 |
-
$content );
|
73 |
-
}
|
74 |
-
return $output;
|
75 |
-
}
|
76 |
-
/**
|
77 |
-
* Set calendar component property recources
|
78 |
-
*
|
79 |
-
* @param mixed $value
|
80 |
-
* @param array $params
|
81 |
-
* @param integer $index
|
82 |
-
* @return bool
|
83 |
-
*/
|
84 |
-
public function setResources( $value, $params=null, $index=null ) {
|
85 |
-
if( empty( $value )) {
|
86 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
87 |
-
$value = util::$EMPTYPROPERTY;
|
88 |
-
else
|
89 |
-
return false;
|
90 |
-
}
|
91 |
-
if( is_array( $value ))
|
92 |
-
foreach( $value as & $valuePart )
|
93 |
-
$valuePart = util::trimTrailNL( $valuePart );
|
94 |
-
else
|
95 |
-
$value = util::trimTrailNL( $value );
|
96 |
-
util::setMval( $this->resources,
|
97 |
-
$value,
|
98 |
-
$params,
|
99 |
-
false,
|
100 |
-
$index );
|
101 |
-
return true;
|
102 |
-
}
|
103 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/RRULEtrait.php
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
use kigkonsult\iCalcreator\util\utilRecur;
|
34 |
-
/**
|
35 |
-
* RRULE property functions
|
36 |
-
*
|
37 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
38 |
-
* @since 2.22.23 - 2017-04-03
|
39 |
-
*/
|
40 |
-
trait RRULEtrait {
|
41 |
-
/**
|
42 |
-
* @var array component property RRULE value
|
43 |
-
* @access protected
|
44 |
-
*/
|
45 |
-
protected $rrule = null;
|
46 |
-
/**
|
47 |
-
* Return formatted output for calendar component property rrule
|
48 |
-
*
|
49 |
-
* @return string
|
50 |
-
*/
|
51 |
-
public function createRrule() {
|
52 |
-
return utilRecur::formatRecur( util::$RRULE,
|
53 |
-
$this->rrule,
|
54 |
-
$this->getConfig( util::$ALLOWEMPTY ));
|
55 |
-
}
|
56 |
-
/**
|
57 |
-
* Set calendar component property rrule
|
58 |
-
*
|
59 |
-
* @param array $rruleset
|
60 |
-
* @param array $params
|
61 |
-
* @param integer $index
|
62 |
-
*/
|
63 |
-
public function setRrule( $rruleset, $params=null, $index=null ) {
|
64 |
-
if( empty( $rruleset )) {
|
65 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
66 |
-
$rruleset = util::$EMPTYPROPERTY;
|
67 |
-
else
|
68 |
-
return false;
|
69 |
-
}
|
70 |
-
util::setMval( $this->rrule,
|
71 |
-
utilRecur::setRexrule( $rruleset ),
|
72 |
-
$params,
|
73 |
-
false,
|
74 |
-
$index );
|
75 |
-
return true;
|
76 |
-
}
|
77 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/SEQUENCEtrait.php
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* SEQUENCE property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-24
|
38 |
-
*/
|
39 |
-
trait SEQUENCEtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property SEQUENCE value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $sequence = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property sequence
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createSequence() {
|
51 |
-
if( ! isset( $this->sequence ) ||
|
52 |
-
( empty( $this->sequence ) && ! is_numeric( $this->sequence )))
|
53 |
-
return null;
|
54 |
-
if(( ! isset( $this->sequence[util::$LCvalue] ) ||
|
55 |
-
( empty( $this->sequence[util::$LCvalue] ) && ! is_numeric( $this->sequence[util::$LCvalue] ))) &&
|
56 |
-
( util::$ZERO != $this->sequence[util::$LCvalue] ))
|
57 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$SEQUENCE ) : null;
|
58 |
-
return util::createElement( util::$SEQUENCE,
|
59 |
-
util::createParams( $this->sequence[util::$LCparams] ),
|
60 |
-
$this->sequence[util::$LCvalue] );
|
61 |
-
}
|
62 |
-
/**
|
63 |
-
* Set calendar component property sequence
|
64 |
-
*
|
65 |
-
* @param int $value
|
66 |
-
* @param array $params
|
67 |
-
*/
|
68 |
-
public function setSequence( $value=null, $params=null ) {
|
69 |
-
if(( empty( $value ) && ! is_numeric( $value )) && ( util::$ZERO != $value ))
|
70 |
-
$value = ( isset( $this->sequence[util::$LCvalue] ) &&
|
71 |
-
( -1 < $this->sequence[util::$LCvalue] ))
|
72 |
-
? $this->sequence[util::$LCvalue] + 1
|
73 |
-
: util::$ZERO;
|
74 |
-
$this->sequence = [util::$LCvalue => $value,
|
75 |
-
util::$LCparams => util::setParams( $params )];
|
76 |
-
return true;
|
77 |
-
}
|
78 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/STATUStrait.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* STATUS property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait STATUStrait {
|
40 |
-
/**
|
41 |
-
* @var array component property STATUS value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $status = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property status
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createStatus() {
|
51 |
-
if( empty( $this->status ))
|
52 |
-
return null;
|
53 |
-
if( empty( $this->status[util::$LCvalue] ))
|
54 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$STATUS ) : null;
|
55 |
-
return util::createElement( util::$STATUS,
|
56 |
-
util::createParams( $this->status[util::$LCparams] ),
|
57 |
-
$this->status[util::$LCvalue] );
|
58 |
-
}
|
59 |
-
/**
|
60 |
-
* Set calendar component property status
|
61 |
-
*
|
62 |
-
* @param string $value
|
63 |
-
* @param array $params
|
64 |
-
*/
|
65 |
-
public function setStatus( $value, $params=null ) {
|
66 |
-
if( empty( $value )) {
|
67 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
68 |
-
$value = util::$EMPTYPROPERTY;
|
69 |
-
else
|
70 |
-
return false;
|
71 |
-
}
|
72 |
-
$this->status = [util::$LCvalue => util::trimTrailNL( $value ),
|
73 |
-
util::$LCparams => util::setParams( $params )];
|
74 |
-
return true;
|
75 |
-
}
|
76 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/SUMMARYtrait.php
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* SUMMARY property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait SUMMARYtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property SUMMARY value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $summary = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property summary
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createSummary() {
|
51 |
-
if( empty( $this->summary ))
|
52 |
-
return null;
|
53 |
-
if( empty( $this->summary[util::$LCvalue] ))
|
54 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$SUMMARY ) : null;
|
55 |
-
return util::createElement( util::$SUMMARY,
|
56 |
-
util::createParams( $this->summary[util::$LCparams],
|
57 |
-
util::$ALTRPLANGARR,
|
58 |
-
$this->getConfig( util::$LANGUAGE )),
|
59 |
-
util::strrep( $this->summary[util::$LCvalue] ));
|
60 |
-
}
|
61 |
-
/**
|
62 |
-
* Set calendar component property summary
|
63 |
-
*
|
64 |
-
* @param string $value
|
65 |
-
* @param array $params
|
66 |
-
*/
|
67 |
-
public function setSummary( $value, $params=null ) {
|
68 |
-
if( empty( $value )) {
|
69 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
70 |
-
$value = util::$EMPTYPROPERTY;
|
71 |
-
else
|
72 |
-
return false;
|
73 |
-
}
|
74 |
-
$this->summary = [util::$LCvalue => $value,
|
75 |
-
util::$LCparams => util::setParams( $params )];
|
76 |
-
return true;
|
77 |
-
}
|
78 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/TRANSPtrait.php
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* TRANSP property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-17
|
38 |
-
*/
|
39 |
-
trait TRANSPtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property TRANSP value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $transp = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property transp
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createTransp() {
|
51 |
-
if( empty( $this->transp ))
|
52 |
-
return null;
|
53 |
-
if( empty( $this->transp[util::$LCvalue] ))
|
54 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$TRANSP ) : null;
|
55 |
-
return util::createElement( util::$TRANSP,
|
56 |
-
util::createParams( $this->transp[util::$LCparams] ),
|
57 |
-
$this->transp[util::$LCvalue] );
|
58 |
-
}
|
59 |
-
/**
|
60 |
-
* Set calendar component property transp
|
61 |
-
*
|
62 |
-
* @param string $value
|
63 |
-
* @param array $params
|
64 |
-
* @return bool
|
65 |
-
*/
|
66 |
-
public function setTransp( $value, $params=null ) {
|
67 |
-
if( empty( $value )) {
|
68 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
69 |
-
$value = util::$EMPTYPROPERTY;
|
70 |
-
else
|
71 |
-
return false;
|
72 |
-
}
|
73 |
-
$this->transp = [util::$LCvalue => util::trimTrailNL( $value ),
|
74 |
-
util::$LCparams => util::setParams( $params )];
|
75 |
-
return true;
|
76 |
-
}
|
77 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/TRIGGERtrait.php
DELETED
@@ -1,213 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* TRIGGER property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-05
|
38 |
-
*/
|
39 |
-
trait TRIGGERtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property TRIGGER value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $trigger = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property trigger
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createTrigger() {
|
51 |
-
static $RELATEDSTART = 'relatedStart';
|
52 |
-
static $BEFORE = 'before';
|
53 |
-
static $RELATED_END = 'RELATED=END';
|
54 |
-
if( empty( $this->trigger ))
|
55 |
-
return null;
|
56 |
-
if( empty( $this->trigger[util::$LCvalue] ))
|
57 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$TRIGGER ) : null;
|
58 |
-
$content = $attributes = null;
|
59 |
-
if( isset( $this->trigger[util::$LCvalue][util::$LCYEAR] ) &&
|
60 |
-
isset( $this->trigger[util::$LCvalue][util::$LCMONTH] ) &&
|
61 |
-
isset( $this->trigger[util::$LCvalue][util::$LCDAY] ))
|
62 |
-
$content .= util::date2strdate( $this->trigger[util::$LCvalue] );
|
63 |
-
else {
|
64 |
-
if( true !== $this->trigger[util::$LCvalue][$RELATEDSTART] )
|
65 |
-
$attributes .= util::$SEMIC . $RELATED_END;
|
66 |
-
if( $this->trigger[util::$LCvalue][$BEFORE] )
|
67 |
-
$content .= util::$MINUS;
|
68 |
-
$content .= util::duration2str( $this->trigger[util::$LCvalue] );
|
69 |
-
}
|
70 |
-
$attributes .= util::createParams( $this->trigger[util::$LCparams] );
|
71 |
-
return util::createElement( util::$TRIGGER,
|
72 |
-
$attributes,
|
73 |
-
$content );
|
74 |
-
}
|
75 |
-
/**
|
76 |
-
* Set calendar component property trigger
|
77 |
-
*
|
78 |
-
* @param mixed $year
|
79 |
-
* @param mixed $month
|
80 |
-
* @param int $day
|
81 |
-
* @param int $week
|
82 |
-
* @param int $hour
|
83 |
-
* @param int $min
|
84 |
-
* @param int $sec
|
85 |
-
* @param bool $relatedStart
|
86 |
-
* @param bool $before
|
87 |
-
* @param array $params
|
88 |
-
* @return bool
|
89 |
-
*/
|
90 |
-
public function setTrigger( $year=null, $month=null, $day=null, $week=null, $hour=null, $min=null, $sec=null,
|
91 |
-
$relatedStart=null, $before=null, $params=null ) {
|
92 |
-
static $PREFIXARR = ['P', '+', '-'];
|
93 |
-
static $P = 'P';
|
94 |
-
static $RELATEDSTART = 'relatedStart';
|
95 |
-
static $BEFORE = 'before';
|
96 |
-
static $RELATED = 'RELATED';
|
97 |
-
static $END = 'END';
|
98 |
-
if( empty( $year ) &&
|
99 |
-
( empty( $month ) || is_array( $month )) &&
|
100 |
-
empty( $day ) && empty( $week ) && empty( $hour ) && empty( $min ) && empty( $sec )) {
|
101 |
-
if( $this->getConfig( util::$ALLOWEMPTY )) {
|
102 |
-
$this->trigger = [util::$LCvalue => util::$EMPTYPROPERTY,
|
103 |
-
util::$LCparams => util::setParams( $month )];
|
104 |
-
return true;
|
105 |
-
}
|
106 |
-
else
|
107 |
-
return false;
|
108 |
-
}
|
109 |
-
if( is_null( $relatedStart ))
|
110 |
-
$relatedStart = true;
|
111 |
-
if( is_null( $before ))
|
112 |
-
$before = true;
|
113 |
-
switch( true ) {
|
114 |
-
case( util::isArrayTimestampDate( $year )) : // timestamp UTC
|
115 |
-
$params = util::setParams( $month );
|
116 |
-
$date = util::timestamp2date( $year, 7 );
|
117 |
-
foreach( $date as $k => $v )
|
118 |
-
$$k = $v;
|
119 |
-
break;
|
120 |
-
case( is_array( $year ) && ( is_array( $month ) || empty( $month ))) :
|
121 |
-
$params = util::setParams( $month );
|
122 |
-
if( ! ( array_key_exists( util::$LCYEAR, $year ) && // exclude date-time
|
123 |
-
array_key_exists( util::$LCMONTH, $year ) &&
|
124 |
-
array_key_exists( util::$LCDAY, $year ))) { // when this must be a duration
|
125 |
-
if( isset( $params[$RELATED] ) && ( 0 == strcasecmp( $END, $params[$RELATED] )))
|
126 |
-
$relatedStart = false;
|
127 |
-
else
|
128 |
-
$relatedStart = ( array_key_exists( $RELATEDSTART, $year ) &&
|
129 |
-
( true !== $year[$RELATEDSTART] )) ? false : true;
|
130 |
-
$before = ( array_key_exists( $BEFORE, $year ) &&
|
131 |
-
( true !== $year[$BEFORE] )) ? false : true;
|
132 |
-
}
|
133 |
-
$SSYY = ( array_key_exists( util::$LCYEAR, $year )) ? $year[util::$LCYEAR] : null;
|
134 |
-
$month = ( array_key_exists( util::$LCMONTH, $year )) ? $year[util::$LCMONTH] : null;
|
135 |
-
$day = ( array_key_exists( util::$LCDAY, $year )) ? $year[util::$LCDAY] : null;
|
136 |
-
$week = ( array_key_exists( util::$LCWEEK, $year )) ? $year[util::$LCWEEK] : null;
|
137 |
-
$hour = ( array_key_exists( util::$LCHOUR, $year )) ? $year[util::$LCHOUR] : 0; //null;
|
138 |
-
$min = ( array_key_exists( util::$LCMIN, $year )) ? $year[util::$LCMIN] : 0; //null;
|
139 |
-
$sec = ( array_key_exists( util::$LCSEC, $year )) ? $year[util::$LCSEC] : 0; //null;
|
140 |
-
$year = $SSYY;
|
141 |
-
break;
|
142 |
-
case( is_string( $year ) && ( is_array( $month ) || empty( $month ))) : // duration or date in a string
|
143 |
-
$params = util::setParams( $month );
|
144 |
-
if( in_array( $year{0}, $PREFIXARR )) { // duration
|
145 |
-
$relatedStart = ( isset( $params[$RELATED] ) && ( 0 == strcasecmp( $END, $params[$RELATED] ))) ? false : true;
|
146 |
-
$before = ( util::$MINUS == $year[0] ) ? true : false;
|
147 |
-
if( $P != $year[0] )
|
148 |
-
$year = substr( $year, 1 );
|
149 |
-
$date = util::durationStr2arr( $year);
|
150 |
-
}
|
151 |
-
else // date
|
152 |
-
$date = util::strDate2ArrayDate( $year, 7 );
|
153 |
-
unset( $year, $month, $day, $date[util::$UNPARSEDTEXT] );
|
154 |
-
if( empty( $date ))
|
155 |
-
$sec = 0;
|
156 |
-
else
|
157 |
-
foreach( $date as $k => $v )
|
158 |
-
$$k = $v;
|
159 |
-
break;
|
160 |
-
default : // single values in function input parameters
|
161 |
-
$params = util::setParams( $params );
|
162 |
-
break;
|
163 |
-
} // end switch( true )
|
164 |
-
if( ! empty( $year ) && ! empty( $month ) && ! empty( $day )) { // date
|
165 |
-
$params[util::$VALUE] = util::$DATE_TIME;
|
166 |
-
$hour = ( $hour ) ? $hour : 0;
|
167 |
-
$min = ( $min ) ? $min : 0;
|
168 |
-
$sec = ( $sec ) ? $sec : 0;
|
169 |
-
$this->trigger = [util::$LCparams => $params];
|
170 |
-
$this->trigger[util::$LCvalue] = [util::$LCYEAR => $year,
|
171 |
-
util::$LCMONTH => $month,
|
172 |
-
util::$LCDAY => $day,
|
173 |
-
util::$LCHOUR => $hour,
|
174 |
-
util::$LCMIN => $min,
|
175 |
-
util::$LCSEC => $sec,
|
176 |
-
util::$LCtz => util::$Z];
|
177 |
-
return true;
|
178 |
-
}
|
179 |
-
elseif(( empty( $year ) && empty( $month )) && // duration
|
180 |
-
(( ! empty( $week ) || ( 0 == $week )) ||
|
181 |
-
( ! empty( $day ) || ( 0 == $day )) ||
|
182 |
-
( ! empty( $hour ) || ( 0 == $hour )) ||
|
183 |
-
( ! empty( $min ) || ( 0 == $min )) ||
|
184 |
-
( ! empty( $sec ) || ( 0 == $sec )))) {
|
185 |
-
unset( $params[$RELATED] ); // set at output creation (END only)
|
186 |
-
unset( $params[util::$VALUE] ); // util::$DURATION default
|
187 |
-
$this->trigger = [util::$LCparams => $params];
|
188 |
-
$this->trigger[util::$LCvalue] = [];
|
189 |
-
if( ! empty( $week ))
|
190 |
-
$this->trigger[util::$LCvalue][util::$LCWEEK] = $week;
|
191 |
-
if( ! empty( $day ))
|
192 |
-
$this->trigger[util::$LCvalue][util::$LCDAY] = $day;
|
193 |
-
if( ! empty( $hour ))
|
194 |
-
$this->trigger[util::$LCvalue][util::$LCHOUR] = $hour;
|
195 |
-
if( ! empty( $min ))
|
196 |
-
$this->trigger[util::$LCvalue][util::$LCMIN] = $min;
|
197 |
-
if( ! empty( $sec ))
|
198 |
-
$this->trigger[util::$LCvalue][util::$LCSEC] = $sec;
|
199 |
-
if( empty( $this->trigger[util::$LCvalue] )) {
|
200 |
-
$this->trigger[util::$LCvalue][util::$LCSEC] = 0;
|
201 |
-
$before = false;
|
202 |
-
}
|
203 |
-
else
|
204 |
-
$this->trigger[util::$LCvalue] = util::duration2arr( $this->trigger[util::$LCvalue] );
|
205 |
-
$relatedStart = ( false !== $relatedStart ) ? true : false;
|
206 |
-
$before = ( false !== $before ) ? true : false;
|
207 |
-
$this->trigger[util::$LCvalue][$RELATEDSTART] = $relatedStart;
|
208 |
-
$this->trigger[util::$LCvalue][$BEFORE] = $before;
|
209 |
-
return true;
|
210 |
-
}
|
211 |
-
return false;
|
212 |
-
}
|
213 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/TZIDtrait.php
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* TZID property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-05
|
38 |
-
*/
|
39 |
-
trait TZIDtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property TZID value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $tzid = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property tzid
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createTzid() {
|
51 |
-
if( empty( $this->tzid ))
|
52 |
-
return null;
|
53 |
-
if( empty( $this->tzid[util::$LCvalue] ))
|
54 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$TZID ) : null;
|
55 |
-
return util::createElement( util::$TZID,
|
56 |
-
util::createParams( $this->tzid[util::$LCparams] ),
|
57 |
-
util::strrep( $this->tzid[util::$LCvalue] ));
|
58 |
-
}
|
59 |
-
/**
|
60 |
-
* Set calendar component property tzid
|
61 |
-
*
|
62 |
-
* @since 2.23.12 - 2017-04-22
|
63 |
-
* @param string $value
|
64 |
-
* @param array $params
|
65 |
-
* @return bool
|
66 |
-
*/
|
67 |
-
public function setTzid( $value, $params=null ) {
|
68 |
-
if( empty( $value )) {
|
69 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
70 |
-
$value = util::$EMPTYPROPERTY;
|
71 |
-
else
|
72 |
-
return false;
|
73 |
-
}
|
74 |
-
$this->tzid = [util::$LCvalue => trim( util::trimTrailNL( $value )),
|
75 |
-
util::$LCparams => util::setParams( $params )];
|
76 |
-
return true;
|
77 |
-
}
|
78 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/TZNAMEtrait.php
DELETED
@@ -1,89 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* TZNAME property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-17
|
38 |
-
*/
|
39 |
-
trait TZNAMEtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property TZNAME value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $tzname = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property tzname
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createTzname() {
|
51 |
-
if( empty( $this->tzname ))
|
52 |
-
return null;
|
53 |
-
$output = null;
|
54 |
-
$lang = $this->getConfig( util::$LANGUAGE );
|
55 |
-
foreach( $this->tzname as $tzx => $theName ) {
|
56 |
-
if( ! empty( $theName[util::$LCvalue] ))
|
57 |
-
$output .= util::createElement( util::$TZNAME,
|
58 |
-
util::createParams( $theName[util::$LCparams],
|
59 |
-
[util::$LANGUAGE],
|
60 |
-
$lang ),
|
61 |
-
util::strrep( $theName[util::$LCvalue] ));
|
62 |
-
elseif( $this->getConfig( util::$ALLOWEMPTY ))
|
63 |
-
$output .= util::createElement( util::$TZNAME );
|
64 |
-
}
|
65 |
-
return $output;
|
66 |
-
}
|
67 |
-
/**
|
68 |
-
* Set calendar component property tzname
|
69 |
-
*
|
70 |
-
* @param string $value
|
71 |
-
* @param array $params
|
72 |
-
* @param integer $index
|
73 |
-
* @return bool
|
74 |
-
*/
|
75 |
-
public function setTzname( $value, $params=null, $index=null ) {
|
76 |
-
if( empty( $value )) {
|
77 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
78 |
-
$value = util::$EMPTYPROPERTY;
|
79 |
-
else
|
80 |
-
return false;
|
81 |
-
}
|
82 |
-
util::setMval( $this->tzname,
|
83 |
-
util::trimTrailNL( $value ),
|
84 |
-
$params,
|
85 |
-
false,
|
86 |
-
$index );
|
87 |
-
return true;
|
88 |
-
}
|
89 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/TZOFFSETFROMtrait.php
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* TZOFFSETFROM property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-05
|
38 |
-
*/
|
39 |
-
trait TZOFFSETFROMtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property TZOFFSETFROM value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $tzoffsetfrom = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property tzoffsetfrom
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createTzoffsetfrom() {
|
51 |
-
if( empty( $this->tzoffsetfrom ))
|
52 |
-
return null;
|
53 |
-
if( empty( $this->tzoffsetfrom[util::$LCvalue] ))
|
54 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$TZOFFSETFROM ) : null;
|
55 |
-
return util::createElement( util::$TZOFFSETFROM,
|
56 |
-
util::createParams( $this->tzoffsetfrom[util::$LCparams] ),
|
57 |
-
$this->tzoffsetfrom[util::$LCvalue] );
|
58 |
-
}
|
59 |
-
/**
|
60 |
-
* Set calendar component property tzoffsetfrom
|
61 |
-
*
|
62 |
-
* @param string $value
|
63 |
-
* @param array $params
|
64 |
-
* @return bool
|
65 |
-
*/
|
66 |
-
public function setTzoffsetfrom( $value, $params=null ) {
|
67 |
-
if( empty( $value )) {
|
68 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
69 |
-
$value = util::$EMPTYPROPERTY;
|
70 |
-
else
|
71 |
-
return false;
|
72 |
-
}
|
73 |
-
$this->tzoffsetfrom = [util::$LCvalue => $value,
|
74 |
-
util::$LCparams => util::setParams( $params )];
|
75 |
-
return true;
|
76 |
-
}
|
77 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/TZOFFSETTOtrait.php
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* TZOFFSETTO property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait TZOFFSETTOtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property TZOFFSETTO value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $tzoffsetto = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property tzoffsetto
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createTzoffsetto() {
|
51 |
-
if( empty( $this->tzoffsetto ))
|
52 |
-
return null;
|
53 |
-
if( empty( $this->tzoffsetto[util::$LCvalue] ))
|
54 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$TZOFFSETTO ) : null;
|
55 |
-
return util::createElement( util::$TZOFFSETTO,
|
56 |
-
util::createParams( $this->tzoffsetto[util::$LCparams] ),
|
57 |
-
$this->tzoffsetto[util::$LCvalue] );
|
58 |
-
}
|
59 |
-
/**
|
60 |
-
* Set calendar component property tzoffsetto
|
61 |
-
*
|
62 |
-
* @param string $value
|
63 |
-
* @param array $params
|
64 |
-
* @return bool
|
65 |
-
*/
|
66 |
-
public function setTzoffsetto( $value, $params=null ) {
|
67 |
-
if( empty( $value )) {
|
68 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
69 |
-
$value = util::$EMPTYPROPERTY;
|
70 |
-
else
|
71 |
-
return false;
|
72 |
-
}
|
73 |
-
$this->tzoffsetto = [util::$LCvalue => $value,
|
74 |
-
util::$LCparams => util::setParams( $params )];
|
75 |
-
return true;
|
76 |
-
}
|
77 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/TZURLtrait.php
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* TZURL property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-05
|
38 |
-
*/
|
39 |
-
trait TZURLtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property TZURL value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $tzurl = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property tzurl
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createTzurl() {
|
51 |
-
if( empty( $this->tzurl ))
|
52 |
-
return null;
|
53 |
-
if( empty( $this->tzurl[util::$LCvalue] ))
|
54 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$TZURL ) : null;
|
55 |
-
return util::createElement( util::$TZURL,
|
56 |
-
util::createParams( $this->tzurl[util::$LCparams] ),
|
57 |
-
$this->tzurl[util::$LCvalue] );
|
58 |
-
}
|
59 |
-
/**
|
60 |
-
* Set calendar component property tzurl
|
61 |
-
*
|
62 |
-
* @param string $value
|
63 |
-
* @param array $params
|
64 |
-
* @return bool
|
65 |
-
*/
|
66 |
-
public function setTzurl( $value, $params=null ) {
|
67 |
-
if( empty( $value )) {
|
68 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
69 |
-
$value = util::$EMPTYPROPERTY;
|
70 |
-
else
|
71 |
-
return false;
|
72 |
-
}
|
73 |
-
$this->tzurl = [util::$LCvalue => $value,
|
74 |
-
util::$LCparams => util::setParams( $params )];
|
75 |
-
return true;
|
76 |
-
}
|
77 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/UIDtrait.php
DELETED
@@ -1,73 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* UID property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.23.20 - 2017-02-17
|
38 |
-
*/
|
39 |
-
trait UIDtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property UID value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $uid = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property uid
|
47 |
-
*
|
48 |
-
* If uid is missing, uid is created
|
49 |
-
*
|
50 |
-
* @return string
|
51 |
-
*/
|
52 |
-
public function createUid() {
|
53 |
-
if( empty( $this->uid ))
|
54 |
-
$this->uid = util::makeUid( $this->getConfig( util::$UNIQUE_ID ));
|
55 |
-
return util::createElement( util::$UID,
|
56 |
-
util::createParams( $this->uid[util::$LCparams] ),
|
57 |
-
$this->uid[util::$LCvalue] );
|
58 |
-
}
|
59 |
-
/**
|
60 |
-
* Set calendar component property uid
|
61 |
-
*
|
62 |
-
* @param string $value
|
63 |
-
* @param array $params
|
64 |
-
* @return bool
|
65 |
-
*/
|
66 |
-
public function setUid( $value, $params=null ) {
|
67 |
-
if( empty( $value ) && ( util::$ZERO != $value ))
|
68 |
-
return false; // no allowEmpty check here !!!!
|
69 |
-
$this->uid = [util::$LCvalue => util::trimTrailNL( $value ),
|
70 |
-
util::$LCparams => util::setParams( $params )];
|
71 |
-
return true;
|
72 |
-
}
|
73 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/URLtrait.php
DELETED
@@ -1,81 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* URL property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-05
|
38 |
-
*/
|
39 |
-
trait URLtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property URL value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $url = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar component property url
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createUrl() {
|
51 |
-
if( empty( $this->url ))
|
52 |
-
return null;
|
53 |
-
if( empty( $this->url[util::$LCvalue] ))
|
54 |
-
return ( $this->getConfig( util::$ALLOWEMPTY )) ? util::createElement( util::$URL ) : null;
|
55 |
-
return util::createElement( util::$URL,
|
56 |
-
util::createParams( $this->url[util::$LCparams] ),
|
57 |
-
$this->url[util::$LCvalue] );
|
58 |
-
}
|
59 |
-
/**
|
60 |
-
* Set calendar component property url
|
61 |
-
*
|
62 |
-
* @param string $value
|
63 |
-
* @param array $params
|
64 |
-
* @return bool
|
65 |
-
*/
|
66 |
-
public function setUrl( $value, $params=null ) {
|
67 |
-
static $URN = 'urn';
|
68 |
-
if( ! empty( $value )) {
|
69 |
-
if( ! filter_var( $value, FILTER_VALIDATE_URL ) &&
|
70 |
-
( 0 != strcasecmp( $URN, substr( $value, 0, 3 ))))
|
71 |
-
return false;
|
72 |
-
}
|
73 |
-
elseif( $this->getConfig( util::$ALLOWEMPTY ))
|
74 |
-
$value = util::$EMPTYPROPERTY;
|
75 |
-
else
|
76 |
-
return false;
|
77 |
-
$this->url = [util::$LCvalue => $value,
|
78 |
-
util::$LCparams => util::setParams( $params )];
|
79 |
-
return true;
|
80 |
-
}
|
81 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/VERSIONtrait.php
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* VERSION property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-18
|
38 |
-
*/
|
39 |
-
trait VERSIONtrait {
|
40 |
-
/**
|
41 |
-
* Property Name: VERSION
|
42 |
-
*
|
43 |
-
* Description: A value of "2.0" corresponds to this memo.
|
44 |
-
*
|
45 |
-
* @var string calendar property VERSION
|
46 |
-
* @access protected
|
47 |
-
*/
|
48 |
-
protected $version = '2.0';
|
49 |
-
/**
|
50 |
-
* Return formatted output for calendar property version
|
51 |
-
*
|
52 |
-
* If version is missing, version is set
|
53 |
-
*
|
54 |
-
* @return string
|
55 |
-
*/
|
56 |
-
public function createVersion() {
|
57 |
-
return sprintf( self::$FMTICAL, util::$VERSION,
|
58 |
-
$this->version );
|
59 |
-
}
|
60 |
-
/**
|
61 |
-
* Set (another?) calendar version
|
62 |
-
*
|
63 |
-
* @param string $value
|
64 |
-
* @return bool
|
65 |
-
*/
|
66 |
-
public function setVersion( $value ) {
|
67 |
-
if( empty( $value ))
|
68 |
-
return false;
|
69 |
-
$this->version = $value;
|
70 |
-
return true;
|
71 |
-
}
|
72 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/traits/X_PROPtrait.php
DELETED
@@ -1,143 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\traits;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* X-property functions
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
trait X_PROPtrait {
|
40 |
-
/**
|
41 |
-
* @var array component property X-property value
|
42 |
-
* @access protected
|
43 |
-
*/
|
44 |
-
protected $xprop = null;
|
45 |
-
/**
|
46 |
-
* Return formatted output for calendar/component property x-prop
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function createXprop() {
|
51 |
-
if( empty( $this->xprop ) || !is_array( $this->xprop ))
|
52 |
-
return null;
|
53 |
-
$output = null;
|
54 |
-
$lang = $this->getConfig( util::$LANGUAGE );
|
55 |
-
foreach( $this->xprop as $label => $xpropPart ) {
|
56 |
-
if( ! isset( $xpropPart[util::$LCvalue]) ||
|
57 |
-
( empty( $xpropPart[util::$LCvalue] ) && ! is_numeric( $xpropPart[util::$LCvalue] ))) {
|
58 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
59 |
-
$output .= util::createElement( $label );
|
60 |
-
continue;
|
61 |
-
}
|
62 |
-
if( is_array( $xpropPart[util::$LCvalue] )) {
|
63 |
-
foreach( $xpropPart[util::$LCvalue] as $pix => $theXpart )
|
64 |
-
$xpropPart[util::$LCvalue][$pix] = util::strrep( $theXpart );
|
65 |
-
$xpropPart[util::$LCvalue] = implode( util::$COMMA, $xpropPart[util::$LCvalue] );
|
66 |
-
}
|
67 |
-
else
|
68 |
-
$xpropPart[util::$LCvalue] = util::strrep( $xpropPart[util::$LCvalue] );
|
69 |
-
$output .= util::createElement( $label,
|
70 |
-
util::createParams( $xpropPart[util::$LCparams],
|
71 |
-
[util::$LANGUAGE],
|
72 |
-
$lang ),
|
73 |
-
util::trimTrailNL( $xpropPart[util::$LCvalue] ));
|
74 |
-
}
|
75 |
-
return $output;
|
76 |
-
}
|
77 |
-
/**
|
78 |
-
* Set calendar property x-prop
|
79 |
-
*
|
80 |
-
* @param string $label
|
81 |
-
* @param string $value
|
82 |
-
* @param array $params optional
|
83 |
-
* @return bool
|
84 |
-
*/
|
85 |
-
public function setXprop( $label, $value, $params=false ) {
|
86 |
-
if( empty( $label ) || ! util::isXprefixed( $label ))
|
87 |
-
return false;
|
88 |
-
if( empty( $value ) && ! is_numeric( $value )) {
|
89 |
-
if( $this->getConfig( util::$ALLOWEMPTY ))
|
90 |
-
$value = util::$EMPTYPROPERTY;
|
91 |
-
else
|
92 |
-
return false;
|
93 |
-
}
|
94 |
-
$xprop = [util::$LCvalue => $value];
|
95 |
-
$xprop[util::$LCparams] = util::setParams( $params );
|
96 |
-
if( ! is_array( $this->xprop ))
|
97 |
-
$this->xprop = [];
|
98 |
-
$this->xprop[strtoupper( $label )] = $xprop;
|
99 |
-
return true;
|
100 |
-
}
|
101 |
-
/**
|
102 |
-
* Delete component property X-prop value
|
103 |
-
*
|
104 |
-
* @param string $propName
|
105 |
-
* @param array $xProp component X-property
|
106 |
-
* @param int $propix removal counter
|
107 |
-
* @param array $propdelix
|
108 |
-
* @access protected
|
109 |
-
* @static
|
110 |
-
*/
|
111 |
-
protected static function deleteXproperty( $propName=null, & $xProp, & $propix, & $propdelix ) {
|
112 |
-
$reduced = [];
|
113 |
-
if( $propName != util::$X_PROP ) {
|
114 |
-
if( ! isset( $xProp[$propName] )) {
|
115 |
-
unset( $propdelix[$propName] );
|
116 |
-
return false;
|
117 |
-
}
|
118 |
-
foreach( $xProp as $k => $xValue ) {
|
119 |
-
if(( $k != $propName ) && ! empty( $xValue ))
|
120 |
-
$reduced[$k] = $xValue;
|
121 |
-
}
|
122 |
-
}
|
123 |
-
else {
|
124 |
-
if( count( $xProp ) <= $propix ) {
|
125 |
-
unset( $propdelix[$propName] );
|
126 |
-
return false;
|
127 |
-
}
|
128 |
-
$xpropno = 0;
|
129 |
-
foreach( $xProp as $xPropKey => $xPropValue ) {
|
130 |
-
if( $propix != $xpropno )
|
131 |
-
$reduced[$xPropKey] = $xPropValue;
|
132 |
-
$xpropno++;
|
133 |
-
}
|
134 |
-
}
|
135 |
-
$xProp = $reduced;
|
136 |
-
if( empty( $xProp )) {
|
137 |
-
$xProp = null;
|
138 |
-
unset( $propdelix[$propName] );
|
139 |
-
return false;
|
140 |
-
}
|
141 |
-
return true;
|
142 |
-
}
|
143 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/util/util.php
DELETED
@@ -1,2230 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\util;
|
32 |
-
/**
|
33 |
-
* iCalcreator utility/support class
|
34 |
-
*
|
35 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
36 |
-
* @since 2.24.1 - 2018-10-22
|
37 |
-
*/
|
38 |
-
class util {
|
39 |
-
/**
|
40 |
-
* @var string iCal component (lowercase) names
|
41 |
-
* @static
|
42 |
-
*/
|
43 |
-
public static $LCVTIMEZONE = 'vtimezone';
|
44 |
-
public static $LCSTANDARD = 'standard';
|
45 |
-
public static $LCDAYLIGHT = 'daylight';
|
46 |
-
public static $LCVEVENT = 'vevent';
|
47 |
-
public static $LCVTODO = 'vtodo';
|
48 |
-
public static $LCVJOURNAL = 'vjournal';
|
49 |
-
public static $LCVFREEBUSY = 'vfreebusy';
|
50 |
-
public static $LCVALARM = 'valarm';
|
51 |
-
/**
|
52 |
-
* @var array iCal component (lowercase) collections
|
53 |
-
* @static
|
54 |
-
*/
|
55 |
-
public static $VCOMPS = ['vevent', 'vtodo', 'vjournal', 'vfreebusy'];
|
56 |
-
public static $MCOMPS = ['vevent', 'vtodo', 'vjournal', 'vfreebusy', 'valarm', 'vtimezone'];
|
57 |
-
public static $LCSUBCOMPS = ['valarm', 'vtimezone', 'standard', 'daylight'];
|
58 |
-
public static $TZCOMPS = ['vtimezone', 'standard', 'daylight'];
|
59 |
-
public static $ALLCOMPS = ['vtimezone', 'standard', 'daylight', 'vevent', 'vtodo', 'vjournal', 'vfreebusy', 'valarm'];
|
60 |
-
/**
|
61 |
-
* @var string iCal property names
|
62 |
-
* @static
|
63 |
-
*/
|
64 |
-
public static $ACTION = 'ACTION';
|
65 |
-
public static $ATTACH = 'ATTACH';
|
66 |
-
public static $ATTENDEE = 'ATTENDEE';
|
67 |
-
public static $CALSCALE = 'CALSCALE';
|
68 |
-
public static $CATEGORIES = 'CATEGORIES';
|
69 |
-
public static $CLASS = 'CLASS';
|
70 |
-
public static $COMMENT = 'COMMENT';
|
71 |
-
public static $COMPLETED = 'COMPLETED';
|
72 |
-
public static $CONTACT = 'CONTACT';
|
73 |
-
public static $CREATED = 'CREATED';
|
74 |
-
public static $DESCRIPTION = 'DESCRIPTION';
|
75 |
-
public static $DTEND = 'DTEND';
|
76 |
-
public static $DTSTAMP = 'DTSTAMP';
|
77 |
-
public static $DTSTART = 'DTSTART';
|
78 |
-
public static $DUE = 'DUE';
|
79 |
-
public static $DURATION = 'DURATION';
|
80 |
-
public static $EXDATE = 'EXDATE';
|
81 |
-
public static $EXRULE = 'EXRULE';
|
82 |
-
public static $FREEBUSY = 'FREEBUSY';
|
83 |
-
public static $GEO = 'GEO';
|
84 |
-
public static $GEOLOCATION = 'GEOLOCATION';
|
85 |
-
public static $LAST_MODIFIED = 'LAST-MODIFIED';
|
86 |
-
public static $LOCATION = 'LOCATION';
|
87 |
-
public static $METHOD = 'METHOD';
|
88 |
-
public static $ORGANIZER = 'ORGANIZER';
|
89 |
-
public static $PERCENT_COMPLETE = 'PERCENT-COMPLETE';
|
90 |
-
public static $PRIORITY = 'PRIORITY';
|
91 |
-
public static $PRODID = 'PRODID';
|
92 |
-
public static $RECURRENCE_ID = 'RECURRENCE-ID';
|
93 |
-
public static $RELATED_TO = 'RELATED-TO';
|
94 |
-
public static $REPEAT = 'REPEAT';
|
95 |
-
public static $REQUEST_STATUS = 'REQUEST-STATUS';
|
96 |
-
public static $RESOURCES = 'RESOURCES';
|
97 |
-
public static $RDATE = 'RDATE';
|
98 |
-
public static $RRULE = 'RRULE';
|
99 |
-
public static $SEQUENCE = 'SEQUENCE';
|
100 |
-
public static $STATUS = 'STATUS';
|
101 |
-
public static $SUMMARY = 'SUMMARY';
|
102 |
-
public static $TRANSP = 'TRANSP';
|
103 |
-
public static $TRIGGER = 'TRIGGER';
|
104 |
-
public static $TZID = 'TZID';
|
105 |
-
public static $TZNAME = 'TZNAME';
|
106 |
-
public static $TZOFFSETFROM = 'TZOFFSETFROM';
|
107 |
-
public static $TZOFFSETTO = 'TZOFFSETTO';
|
108 |
-
public static $TZURL = 'TZURL';
|
109 |
-
public static $UID = 'UID';
|
110 |
-
public static $URL = 'URL';
|
111 |
-
public static $VERSION = 'VERSION';
|
112 |
-
public static $X_PROP = 'X-PROP';
|
113 |
-
/**
|
114 |
-
* @var string vcalendar::selectComponents added x-property names
|
115 |
-
* @static
|
116 |
-
*/
|
117 |
-
public static $X_CURRENT_DTSTART = 'X-CURRENT-DTSTART';
|
118 |
-
public static $X_CURRENT_DTEND = 'X-CURRENT-DTEND';
|
119 |
-
public static $X_CURRENT_DUE = 'X-CURRENT-DUE';
|
120 |
-
public static $X_RECURRENCE = 'X-RECURRENCE';
|
121 |
-
public static $X_OCCURENCE = 'X-OCCURENCE';
|
122 |
-
/**
|
123 |
-
* @var array iCal component property collections
|
124 |
-
* @static
|
125 |
-
*/
|
126 |
-
public static $PROPNAMES = ['ACTION', 'ATTACH', 'ATTENDEE', 'CATEGORIES',
|
127 |
-
'CLASS', 'COMMENT', 'COMPLETED', 'CONTACT',
|
128 |
-
'CREATED', 'DESCRIPTION', 'DTEND', 'DTSTAMP',
|
129 |
-
'DTSTART', 'DUE', 'DURATION', 'EXDATE', 'EXRULE',
|
130 |
-
'FREEBUSY', 'GEO', 'LAST-MODIFIED', 'LOCATION',
|
131 |
-
'ORGANIZER', 'PERCENT-COMPLETE', 'PRIORITY',
|
132 |
-
'RECURRENCE-ID', 'RELATED-TO', 'REPEAT',
|
133 |
-
'REQUEST-STATUS', 'RESOURCES', 'RRULE', 'RDATE',
|
134 |
-
'SEQUENCE', 'STATUS', 'SUMMARY', 'TRANSP',
|
135 |
-
'TRIGGER', 'TZNAME', 'TZID', 'TZOFFSETFROM',
|
136 |
-
'TZOFFSETTO', 'TZURL', 'UID', 'URL', 'X-'];
|
137 |
-
public static $DATEPROPS = ['DTSTART', 'DTEND', 'DUE', 'CREATED', 'COMPLETED',
|
138 |
-
'DTSTAMP', 'LAST-MODIFIED', 'RECURRENCE-ID'];
|
139 |
-
public static $OTHERPROPS = ['ATTENDEE', 'CATEGORIES', 'CONTACT', 'LOCATION',
|
140 |
-
'ORGANIZER', 'PRIORITY', 'RELATED-TO', 'RESOURCES',
|
141 |
-
'STATUS', 'SUMMARY', 'UID', 'URL'];
|
142 |
-
public static $MPROPS1 = ['ATTENDEE', 'CATEGORIES', 'CONTACT',
|
143 |
-
'RELATED-TO', 'RESOURCES'];
|
144 |
-
public static $MPROPS2 = ['ATTACH', 'ATTENDEE', 'CATEGORIES',
|
145 |
-
'COMMENT', 'CONTACT', 'DESCRIPTION',
|
146 |
-
'EXDATE', 'EXRULE', 'FREEBUSY', 'RDATE',
|
147 |
-
'RELATED-TO', 'RESOURCES', 'RRULE',
|
148 |
-
'REQUEST-STATUS', 'TZNAME', 'X-PROP'];
|
149 |
-
/**
|
150 |
-
* @var string iCalcreator config keys
|
151 |
-
* @static
|
152 |
-
*/
|
153 |
-
public static $ALLOWEMPTY = 'ALLOWEMPTY';
|
154 |
-
public static $COMPSINFO = 'COMPSINFO';
|
155 |
-
public static $DELIMITER = 'DELIMITER';
|
156 |
-
public static $DIRECTORY = 'DIRECTORY';
|
157 |
-
public static $FILENAME = 'FILENAME';
|
158 |
-
public static $DIRFILE = 'DIRFILE';
|
159 |
-
public static $FILESIZE = 'FILESIZE';
|
160 |
-
public static $FILEINFO = 'FILEINFO';
|
161 |
-
public static $LANGUAGE = 'LANGUAGE';
|
162 |
-
public static $PROPINFO = 'PROPINFO';
|
163 |
-
public static $SETPROPERTYNAMES = 'SETPROPERTYNAMES';
|
164 |
-
public static $UNIQUE_ID = 'UNIQUE_ID';
|
165 |
-
/**
|
166 |
-
* @var string iCal date/time parameter key values
|
167 |
-
* @static
|
168 |
-
*/
|
169 |
-
public static $DATE = 'DATE';
|
170 |
-
public static $PERIOD = 'PERIOD';
|
171 |
-
public static $DATE_TIME = 'DATE-TIME';
|
172 |
-
public static $DEFAULTVALUEDATETIME = ['VALUE' => 'DATE-TIME'];
|
173 |
-
public static $T = 'T';
|
174 |
-
public static $Z = 'Z';
|
175 |
-
public static $UTC = 'UTC';
|
176 |
-
public static $GMT = 'GMT';
|
177 |
-
public static $LCYEAR = 'year';
|
178 |
-
public static $LCMONTH = 'month';
|
179 |
-
public static $LCDAY = 'day';
|
180 |
-
public static $LCHOUR = 'hour';
|
181 |
-
public static $LCMIN = 'min';
|
182 |
-
public static $LCSEC = 'sec';
|
183 |
-
public static $LCtz = 'tz';
|
184 |
-
public static $LCWEEK = 'week';
|
185 |
-
public static $LCTIMESTAMP = 'timestamp';
|
186 |
-
/**
|
187 |
-
* @var string iCal ATTENDEE, ORGANIZER etc param keywords
|
188 |
-
* @static
|
189 |
-
*/
|
190 |
-
public static $CUTYPE = 'CUTYPE';
|
191 |
-
public static $MEMBER = 'MEMBER';
|
192 |
-
public static $ROLE = 'ROLE';
|
193 |
-
public static $PARTSTAT = 'PARTSTAT';
|
194 |
-
public static $RSVP = 'RSVP';
|
195 |
-
public static $DELEGATED_TO = 'DELEGATED-TO';
|
196 |
-
public static $DELEGATED_FROM = 'DELEGATED-FROM';
|
197 |
-
public static $SENT_BY = 'SENT-BY';
|
198 |
-
public static $CN = 'CN';
|
199 |
-
public static $DIR = 'DIR';
|
200 |
-
public static $INDIVIDUAL = 'INDIVIDUAL';
|
201 |
-
public static $NEEDS_ACTION = 'NEEDS-ACTION';
|
202 |
-
public static $REQ_PARTICIPANT = 'REQ-PARTICIPANT';
|
203 |
-
public static $false = 'false';
|
204 |
-
/**
|
205 |
-
* @var array iCal ATTENDEE, ORGANIZER etc param collections
|
206 |
-
* @static
|
207 |
-
*/
|
208 |
-
public static $ATTENDEEPARKEYS = ['DELEGATED-FROM', 'DELEGATED-TO', 'MEMBER'];
|
209 |
-
public static $ATTENDEEPARALLKEYS = ['CUTYPE', 'MEMBER', 'ROLE', 'PARTSTAT',
|
210 |
-
'RSVP', 'DELEGATED-TO', 'DELEGATED-FROM',
|
211 |
-
'SENT-BY', 'CN', 'DIR', 'LANGUAGE'];
|
212 |
-
/**
|
213 |
-
* @var string iCal RRULE, EXRULE etc param keywords
|
214 |
-
* @static
|
215 |
-
*/
|
216 |
-
public static $FREQ = 'FREQ';
|
217 |
-
public static $UNTIL = 'UNTIL';
|
218 |
-
public static $COUNT = 'COUNT';
|
219 |
-
public static $INTERVAL = 'INTERVAL';
|
220 |
-
public static $WKST = 'WKST';
|
221 |
-
public static $BYMONTHDAY = 'BYMONTHDAY';
|
222 |
-
public static $BYYEARDAY = 'BYYEARDAY';
|
223 |
-
public static $BYWEEKNO = 'BYWEEKNO';
|
224 |
-
public static $BYMONTH = 'BYMONTH';
|
225 |
-
public static $BYSETPOS = 'BYSETPOS';
|
226 |
-
public static $BYDAY = 'BYDAY';
|
227 |
-
public static $DAY = 'DAY';
|
228 |
-
/**
|
229 |
-
* @var string misc. values
|
230 |
-
* @static
|
231 |
-
*/
|
232 |
-
public static $ALTREP = 'ALTREP';
|
233 |
-
public static $ALTRPLANGARR = ['ALTREP', 'LANGUAGE'];
|
234 |
-
public static $VALUE = 'VALUE';
|
235 |
-
public static $BINARY = 'BINARY';
|
236 |
-
public static $LCvalue = 'value';
|
237 |
-
public static $LCparams = 'params';
|
238 |
-
public static $UNPARSEDTEXT = 'unparsedtext';
|
239 |
-
public static $SERVER_NAME = 'SERVER_NAME';
|
240 |
-
public static $LOCALHOST = 'localhost';
|
241 |
-
public static $EMPTYPROPERTY = '';
|
242 |
-
public static $FMTBEGIN = "BEGIN:%s\r\n";
|
243 |
-
public static $FMTEND = "END:%s\r\n";
|
244 |
-
public static $CRLF = "\r\n";
|
245 |
-
public static $COMMA = ',';
|
246 |
-
public static $COLON = ':';
|
247 |
-
public static $QQ = '"';
|
248 |
-
public static $SEMIC = ';';
|
249 |
-
public static $MINUS = '-';
|
250 |
-
public static $PLUS = '+';
|
251 |
-
public static $SP1 = ' ';
|
252 |
-
public static $ZERO = '0';
|
253 |
-
public static $DOT = '.';
|
254 |
-
public static $L = '/';
|
255 |
-
public static $YMDHISE = '%04d-%02d-%02d %02d:%02d:%02d %s';
|
256 |
-
public static $YMD = '%04d%02d%02d';
|
257 |
-
public static $HIS = '%02d%02d%02d';
|
258 |
-
/**
|
259 |
-
* @var string util date/datetime formats
|
260 |
-
* @access private
|
261 |
-
* @static
|
262 |
-
*/
|
263 |
-
private static $YMDHIS3 = 'Y-m-d-H-i-s';
|
264 |
-
/**
|
265 |
-
* Initiates configuration, set defaults
|
266 |
-
*
|
267 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
268 |
-
* @since 2.22.23 - 2017-03-11
|
269 |
-
* @param array $config
|
270 |
-
* @return array
|
271 |
-
* @static
|
272 |
-
*/
|
273 |
-
public static function initConfig( $config ) {
|
274 |
-
$config = array_change_key_case( $config, CASE_UPPER );
|
275 |
-
if( ! isset( $config[self::$ALLOWEMPTY] ))
|
276 |
-
$config[self::$ALLOWEMPTY] = true;
|
277 |
-
if( ! isset( $config[self::$DELIMITER] ))
|
278 |
-
$config[self::$DELIMITER] = DIRECTORY_SEPARATOR;
|
279 |
-
if( ! isset( $config[self::$DIRECTORY] ))
|
280 |
-
$config[self::$DIRECTORY] = self::$DOT;
|
281 |
-
return $config;
|
282 |
-
}
|
283 |
-
/**
|
284 |
-
* Return formatted output for calendar component property
|
285 |
-
*
|
286 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
287 |
-
* @since 2.22.20 - 2017-01-30
|
288 |
-
* @param string $label property name
|
289 |
-
* @param string $attributes property attributes
|
290 |
-
* @param string $content property content
|
291 |
-
* @return string
|
292 |
-
* @static
|
293 |
-
*/
|
294 |
-
public static function createElement( $label, $attributes=null, $content=null ) {
|
295 |
-
$output = strtoupper( $label );
|
296 |
-
if( ! empty( $attributes ))
|
297 |
-
$output .= trim( $attributes );
|
298 |
-
$output .= util::$COLON . $content;
|
299 |
-
return self::size75( $output );
|
300 |
-
}
|
301 |
-
/**
|
302 |
-
* Return formatted output for calendar component property parameters
|
303 |
-
*
|
304 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
305 |
-
* @since 2.22.23 - 2017-01-29
|
306 |
-
* @param array $params
|
307 |
-
* @param array $ctrKeys
|
308 |
-
* @param string $lang
|
309 |
-
* @return string
|
310 |
-
* @static
|
311 |
-
*/
|
312 |
-
public static function createParams( $params=null, $ctrKeys=null, $lang=null ) {
|
313 |
-
static $FMTFMTTYPE = ';FMTTYPE=%s%s';
|
314 |
-
static $FMTKEQV = '%s=%s';
|
315 |
-
static $ENCODING = 'ENCODING';
|
316 |
-
static $FMTTYPE = 'FMTTYPE';
|
317 |
-
static $RANGE = 'RANGE';
|
318 |
-
static $RELTYPE = 'RELTYPE';
|
319 |
-
static $PARAMSARRAY = null;
|
320 |
-
if( is_null( $PARAMSARRAY ))
|
321 |
-
$PARAMSARRAY = [self::$ALTREP,
|
322 |
-
self::$CN,
|
323 |
-
self::$DIR,
|
324 |
-
$ENCODING,
|
325 |
-
$FMTTYPE,
|
326 |
-
self::$LANGUAGE,
|
327 |
-
$RANGE,
|
328 |
-
$RELTYPE,
|
329 |
-
self::$SENT_BY,
|
330 |
-
self::$TZID,
|
331 |
-
self::$VALUE];
|
332 |
-
static $FMTQ = '"%s"';
|
333 |
-
static $FMTQTD = ';%s=%s%s%s';
|
334 |
-
static $FMTCMN = ';%s=%s';
|
335 |
-
if( ! is_array( $params ))
|
336 |
-
$params = [];
|
337 |
-
if( ! is_array( $ctrKeys ) || empty( $ctrKeys ))
|
338 |
-
$ctrKeys = [];
|
339 |
-
if( empty( $params ) && empty( $ctrKeys ))
|
340 |
-
return null;
|
341 |
-
$attrLANG = $attr1 = $attr2 = null;
|
342 |
-
$hasCNattrKey = ( in_array( self::$CN, $ctrKeys ));
|
343 |
-
$hasLANGattrKey = ( in_array( self::$LANGUAGE, $ctrKeys ));
|
344 |
-
$CNattrExist = false;
|
345 |
-
$xparams = [];
|
346 |
-
$params = array_change_key_case( $params, CASE_UPPER );
|
347 |
-
foreach( $params as $paramKey => $paramValue ) {
|
348 |
-
if(( false !== strpos( $paramValue, self::$COLON )) ||
|
349 |
-
( false !== strpos( $paramValue, self::$SEMIC )) ||
|
350 |
-
( false !== strpos( $paramValue, self::$COMMA )))
|
351 |
-
$paramValue = sprintf( $FMTQ, $paramValue );
|
352 |
-
if( ctype_digit( (string) $paramKey )) {
|
353 |
-
$xparams[] = $paramValue;
|
354 |
-
continue;
|
355 |
-
}
|
356 |
-
if( ! in_array( $paramKey, $PARAMSARRAY ))
|
357 |
-
$xparams[$paramKey] = $paramValue;
|
358 |
-
else
|
359 |
-
$params[$paramKey] = $paramValue;
|
360 |
-
}
|
361 |
-
ksort( $xparams, SORT_STRING );
|
362 |
-
foreach( $xparams as $paramKey => $paramValue ) {
|
363 |
-
$attr2 .= util::$SEMIC;
|
364 |
-
$attr2 .= ( ctype_digit( (string) $paramKey ))
|
365 |
-
? $paramValue
|
366 |
-
: sprintf( $FMTKEQV, $paramKey, $paramValue );
|
367 |
-
}
|
368 |
-
if( isset( $params[$FMTTYPE] ) &&
|
369 |
-
! in_array( $FMTTYPE, $ctrKeys )) {
|
370 |
-
$attr1 .= sprintf( $FMTFMTTYPE, $params[$FMTTYPE],
|
371 |
-
$attr2 );
|
372 |
-
$attr2 = null;
|
373 |
-
}
|
374 |
-
if( isset( $params[$ENCODING] ) &&
|
375 |
-
! in_array( $ENCODING, $ctrKeys )) {
|
376 |
-
if( !empty( $attr2 )) {
|
377 |
-
$attr1 .= $attr2;
|
378 |
-
$attr2 = null;
|
379 |
-
}
|
380 |
-
$attr1 .= sprintf( $FMTCMN, $ENCODING,
|
381 |
-
$params[$ENCODING] );
|
382 |
-
}
|
383 |
-
if( isset( $params[self::$VALUE] ) &&
|
384 |
-
! in_array( self::$VALUE, $ctrKeys ))
|
385 |
-
$attr1 .= sprintf( $FMTCMN, self::$VALUE,
|
386 |
-
$params[self::$VALUE] );
|
387 |
-
if( isset( $params[self::$TZID] ) &&
|
388 |
-
! in_array( self::$TZID, $ctrKeys )) {
|
389 |
-
$attr1 .= sprintf( $FMTCMN, self::$TZID,
|
390 |
-
$params[self::$TZID] );
|
391 |
-
}
|
392 |
-
if( isset( $params[$RANGE] ) &&
|
393 |
-
! in_array( $RANGE, $ctrKeys ))
|
394 |
-
$attr1 .= sprintf( $FMTCMN, $RANGE,
|
395 |
-
$params[$RANGE] );
|
396 |
-
if( isset( $params[$RELTYPE] ) &&
|
397 |
-
! in_array( $RELTYPE, $ctrKeys ))
|
398 |
-
$attr1 .= sprintf( $FMTCMN, $RELTYPE,
|
399 |
-
$params[$RELTYPE] );
|
400 |
-
if( isset( $params[self::$CN] ) &&
|
401 |
-
$hasCNattrKey ) {
|
402 |
-
$attr1 = sprintf( $FMTCMN, self::$CN,
|
403 |
-
$params[self::$CN] );
|
404 |
-
$CNattrExist = true;
|
405 |
-
}
|
406 |
-
if( isset( $params[self::$DIR] ) &&
|
407 |
-
in_array( self::$DIR, $ctrKeys )) {
|
408 |
-
$delim = ( false !== strpos( $params[self::$DIR], self::$QQ ))
|
409 |
-
? null : self::$QQ;
|
410 |
-
$attr1 .= sprintf( $FMTQTD, self::$DIR,
|
411 |
-
$delim,
|
412 |
-
$params[self::$DIR],
|
413 |
-
$delim );
|
414 |
-
}
|
415 |
-
if( isset( $params[self::$SENT_BY] ) &&
|
416 |
-
in_array( self::$SENT_BY, $ctrKeys ))
|
417 |
-
$attr1 .= sprintf( $FMTCMN, self::$SENT_BY,
|
418 |
-
$params[self::$SENT_BY] );
|
419 |
-
if( isset( $params[self::$ALTREP] ) &&
|
420 |
-
in_array( self::$ALTREP, $ctrKeys )) {
|
421 |
-
$delim = ( false !== strpos( $params[self::$ALTREP], self::$QQ ))
|
422 |
-
? null : self::$QQ;
|
423 |
-
$attr1 .= sprintf( $FMTQTD, self::$ALTREP,
|
424 |
-
$delim,
|
425 |
-
$params[self::$ALTREP],
|
426 |
-
$delim );
|
427 |
-
}
|
428 |
-
if( isset( $params[self::$LANGUAGE] ) && $hasLANGattrKey )
|
429 |
-
$attrLANG .= sprintf( $FMTCMN, self::$LANGUAGE,
|
430 |
-
$params[self::$LANGUAGE] );
|
431 |
-
elseif(( $CNattrExist || $hasLANGattrKey ) && ! empty( $lang ))
|
432 |
-
$attrLANG .= sprintf( $FMTCMN, self::$LANGUAGE,
|
433 |
-
$lang );
|
434 |
-
return $attr1 . $attrLANG . $attr2;
|
435 |
-
}
|
436 |
-
/**
|
437 |
-
* Return (conformed) iCal component property parameters
|
438 |
-
*
|
439 |
-
* Trim quoted values, default parameters may be set, if missing
|
440 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
441 |
-
* @since 2.22.23 - 2017-04-08
|
442 |
-
* @param array $params
|
443 |
-
* @param array $defaults
|
444 |
-
* @return array
|
445 |
-
* @static
|
446 |
-
*/
|
447 |
-
public static function setParams( $params, $defaults=null ) {
|
448 |
-
if( ! is_array( $params ))
|
449 |
-
$params = [];
|
450 |
-
$output = [];
|
451 |
-
$params = array_change_key_case( $params, CASE_UPPER );
|
452 |
-
foreach( $params as $paramKey => $paramValue ) {
|
453 |
-
if( is_array( $paramValue )) {
|
454 |
-
foreach( $paramValue as $pkey => $pValue )
|
455 |
-
$paramValue[$pkey] = trim( $pValue, util::$QQ );
|
456 |
-
}
|
457 |
-
else
|
458 |
-
$paramValue = trim( $paramValue, util::$QQ );
|
459 |
-
if( self::$VALUE == $paramKey )
|
460 |
-
$output[self::$VALUE] = strtoupper( $paramValue );
|
461 |
-
else
|
462 |
-
$output[$paramKey] = $paramValue;
|
463 |
-
} // end foreach
|
464 |
-
if( is_array( $defaults ))
|
465 |
-
$output = array_merge( array_change_key_case( $defaults, CASE_UPPER ),
|
466 |
-
$output );
|
467 |
-
return ( 0 < count( $output )) ? $output : null;
|
468 |
-
}
|
469 |
-
/**
|
470 |
-
* Remove expected key/value from array and returns hitval (if found) else returns elseval
|
471 |
-
*
|
472 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
473 |
-
* @since 2.24.1 - 2018-10-22
|
474 |
-
* @param array $array iCal property parameters
|
475 |
-
* @param string $expkey expected key
|
476 |
-
* @param string $expval expected value
|
477 |
-
* @param int $hitVal return value if found
|
478 |
-
* @param int $elseVal return value if not found
|
479 |
-
* @param int $preSet return value if already preset
|
480 |
-
* @return int
|
481 |
-
* @static
|
482 |
-
*/
|
483 |
-
public static function existRem( & $array,
|
484 |
-
$expkey,
|
485 |
-
$expval=false,
|
486 |
-
$hitVal=null,
|
487 |
-
$elseVal=null,
|
488 |
-
$preSet=null ) {
|
489 |
-
if( $preSet )
|
490 |
-
return $preSet;
|
491 |
-
if( ! is_array( $array ) || ( 0 == count( $array )))
|
492 |
-
return $elseVal;
|
493 |
-
foreach( $array as $key => $value ) {
|
494 |
-
if( 0 == strcasecmp( $expkey, $key )) {
|
495 |
-
if( ! $expval ||
|
496 |
-
( 0 == strcasecmp( $expval, $value ))) {
|
497 |
-
unset( $array[$key] );
|
498 |
-
return $hitVal;
|
499 |
-
}
|
500 |
-
}
|
501 |
-
}
|
502 |
-
return $elseVal;
|
503 |
-
}
|
504 |
-
/**
|
505 |
-
* Delete component property value, managing components with multiple occurencies
|
506 |
-
*
|
507 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
508 |
-
* @since 2.8.8 - 2011-03-15
|
509 |
-
* @param array $multiprop component (multi-)property
|
510 |
-
* @param int $propix removal counter
|
511 |
-
* @return bool true
|
512 |
-
* @static
|
513 |
-
*/
|
514 |
-
public static function deletePropertyM( & $multiprop, & $propix ) {
|
515 |
-
if( isset( $multiprop[$propix] ))
|
516 |
-
unset( $multiprop[$propix] );
|
517 |
-
if( empty( $multiprop )) {
|
518 |
-
$multiprop = null;
|
519 |
-
unset( $propix );
|
520 |
-
return false;
|
521 |
-
}
|
522 |
-
return true;
|
523 |
-
}
|
524 |
-
/**
|
525 |
-
* Recount property propix, used at consecutive getProperty calls
|
526 |
-
*
|
527 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
528 |
-
* @since 2.23.8 - 2017-04-18
|
529 |
-
* @param array $prop component (multi-)property
|
530 |
-
* @param int $propix getter counter
|
531 |
-
* @return bool true
|
532 |
-
* @static
|
533 |
-
*/
|
534 |
-
public static function recountMvalPropix( & $prop, & $propix ) {
|
535 |
-
if( ! is_array( $prop ) || empty( $prop ))
|
536 |
-
return false;
|
537 |
-
$last = key( array_slice( $prop, -1, 1, TRUE ));
|
538 |
-
while( ! isset( $prop[$propix] ) &&
|
539 |
-
( $last > $propix ))
|
540 |
-
$propix++;
|
541 |
-
return true;
|
542 |
-
}
|
543 |
-
/**
|
544 |
-
* Check index and set (an indexed) content in a multiple value array
|
545 |
-
*
|
546 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
547 |
-
* @since 2.22.23 - 2017-04-08
|
548 |
-
* @param array $valArr
|
549 |
-
* @param mixed $value
|
550 |
-
* @param array $params
|
551 |
-
* @param array $defaults
|
552 |
-
* @param int $index
|
553 |
-
* @static
|
554 |
-
*/
|
555 |
-
public static function setMval( & $valArr,
|
556 |
-
$value,
|
557 |
-
$params=null,
|
558 |
-
$defaults=null,
|
559 |
-
$index=null ) {
|
560 |
-
if( ! is_array( $valArr ))
|
561 |
-
$valArr = [];
|
562 |
-
if( ! is_null( $params ))
|
563 |
-
$params = self::setParams( $params, $defaults );
|
564 |
-
if( is_null( $index )) { // i.e. next
|
565 |
-
$valArr[] = [self::$LCvalue => $value,
|
566 |
-
self::$LCparams => $params];
|
567 |
-
return;
|
568 |
-
}
|
569 |
-
$index = $index - 1;
|
570 |
-
if( isset( $valArr[$index] )) { // replace
|
571 |
-
$valArr[$index] = [self::$LCvalue => $value,
|
572 |
-
self::$LCparams => $params];
|
573 |
-
return;
|
574 |
-
}
|
575 |
-
$valArr[$index] = [self::$LCvalue => $value,
|
576 |
-
self::$LCparams => $params];
|
577 |
-
ksort( $valArr ); // order
|
578 |
-
return true;
|
579 |
-
}
|
580 |
-
/**
|
581 |
-
* Return datestamp for calendar component object instance dtstamp
|
582 |
-
*
|
583 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
584 |
-
* @since 2.22.23 - 2017-02-17
|
585 |
-
* @return array
|
586 |
-
* @static
|
587 |
-
*/
|
588 |
-
public static function makeDtstamp() {
|
589 |
-
$date = explode( self::$MINUS, gmdate( self::$YMDHIS3, time()));
|
590 |
-
return [self::$LCvalue => [self::$LCYEAR => $date[0],
|
591 |
-
self::$LCMONTH => $date[1],
|
592 |
-
self::$LCDAY => $date[2],
|
593 |
-
self::$LCHOUR => $date[3],
|
594 |
-
self::$LCMIN => $date[4],
|
595 |
-
self::$LCSEC => $date[5],
|
596 |
-
self::$LCtz => self::$Z],
|
597 |
-
self::$LCparams => null];
|
598 |
-
}
|
599 |
-
/**
|
600 |
-
* Return an unique id for a calendar component object instance
|
601 |
-
*
|
602 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
603 |
-
* @since 2.22.23 - 2017-02-17
|
604 |
-
* @param string $unique_id
|
605 |
-
* @return array
|
606 |
-
* @static
|
607 |
-
*/
|
608 |
-
public static function makeUid( $unique_id ) {
|
609 |
-
static $FMT = '%s-%s@%s';
|
610 |
-
static $TMDTHIS = 'Ymd\THisT';
|
611 |
-
return [self::$LCvalue => sprintf( $FMT, date( $TMDTHIS ),
|
612 |
-
substr( microtime(), 2, 4) . self::getRandChars( 6 ),
|
613 |
-
$unique_id ),
|
614 |
-
self::$LCparams => null];
|
615 |
-
}
|
616 |
-
/**
|
617 |
-
* Return a random (and unique) sequence of characters
|
618 |
-
*
|
619 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
620 |
-
* @since 2.22.23 - 2017-02-18
|
621 |
-
* @param int $cnt
|
622 |
-
* @return string
|
623 |
-
* @access private
|
624 |
-
* @static
|
625 |
-
*/
|
626 |
-
private static function getRandChars( $cnt ) {
|
627 |
-
$cnt = (int) floor( $cnt / 2 );
|
628 |
-
$x = 0;
|
629 |
-
do {
|
630 |
-
$randChars = bin2hex( openssl_random_pseudo_bytes( $cnt, $cStrong ));
|
631 |
-
$x += 1;
|
632 |
-
} while(( 3 > $x ) && ( false == $cStrong ));
|
633 |
-
return $randChars;
|
634 |
-
}
|
635 |
-
/**
|
636 |
-
* Return true if a date property has NO date parts
|
637 |
-
*
|
638 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
639 |
-
* @since 2.22.23 - 2017-02-17
|
640 |
-
* @param array $content
|
641 |
-
* @return bool
|
642 |
-
* @static
|
643 |
-
*/
|
644 |
-
public static function hasNodate( $content ) {
|
645 |
-
return( ! isset( $content[self::$LCvalue][self::$LCYEAR] ) &&
|
646 |
-
! isset( $content[self::$LCvalue][self::$LCMONTH] ) &&
|
647 |
-
! isset( $content[self::$LCvalue][self::$LCDAY] ) &&
|
648 |
-
! isset( $content[self::$LCvalue][self::$LCHOUR] ) &&
|
649 |
-
! isset( $content[self::$LCvalue][self::$LCMIN] ) &&
|
650 |
-
! isset( $content[self::$LCvalue][self::$LCSEC] ));
|
651 |
-
}
|
652 |
-
/**
|
653 |
-
* Return true if property parameter VALUE is set to argument, otherwise false
|
654 |
-
*
|
655 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
656 |
-
* @since 2.22.23 - 2017-02-12
|
657 |
-
* @param array $content
|
658 |
-
* @param string $arg
|
659 |
-
* @return bool
|
660 |
-
* @static
|
661 |
-
*/
|
662 |
-
public static function isParamsValueSet( array $content, $arg ) {
|
663 |
-
return ( isset( $content[self::$LCparams][self::$VALUE] ) &&
|
664 |
-
( $arg == $content[self::$LCparams][self::$VALUE] ));
|
665 |
-
}
|
666 |
-
/**
|
667 |
-
* Return bool true if name is X-prefixed
|
668 |
-
*
|
669 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
670 |
-
* @since 2.22.23 - 2017-02-17
|
671 |
-
* @param string $name
|
672 |
-
* @return bool
|
673 |
-
* @static
|
674 |
-
*/
|
675 |
-
public static function isXprefixed( $name ) {
|
676 |
-
static $X_ = 'X-';
|
677 |
-
return ( 0 == strcasecmp( $X_, substr( $name, 0, 2 )));
|
678 |
-
}
|
679 |
-
/**
|
680 |
-
* Return bool true if object class is a DateTime (sub-)class
|
681 |
-
*
|
682 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
683 |
-
* @since 2.23.5 - 2017-04-14
|
684 |
-
* @param object $object
|
685 |
-
* @return bool
|
686 |
-
* @static
|
687 |
-
*/
|
688 |
-
public static function isDateTimeClass( $object ) {
|
689 |
-
static $DATETIMEobj = 'DateTime';
|
690 |
-
return ( is_object( $object ) &&
|
691 |
-
( 0 == strcasecmp( $DATETIMEobj, substr( get_class( $object ), -8 ))));
|
692 |
-
}
|
693 |
-
/**
|
694 |
-
* Return property name and opt.params and property value
|
695 |
-
*
|
696 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
697 |
-
* @since 2.23.8 - 2017-04-16
|
698 |
-
* @param string $row
|
699 |
-
* @return string
|
700 |
-
* @static
|
701 |
-
*/
|
702 |
-
public static function getPropName( $row ) {
|
703 |
-
static $COLONSEMICARR = [':', ';'];
|
704 |
-
$propName = null;
|
705 |
-
$cix = 0;
|
706 |
-
$len = strlen( $row );
|
707 |
-
while( $cix < $len ) {
|
708 |
-
if( in_array( $row[$cix], $COLONSEMICARR ))
|
709 |
-
break;
|
710 |
-
$propName .= $row[$cix];
|
711 |
-
$cix++;
|
712 |
-
} // end while...
|
713 |
-
if( isset( $row[$cix] ))
|
714 |
-
$row = substr( $row, $cix);
|
715 |
-
else {
|
716 |
-
$propName = self::trimTrailNL( $propName ); // property without colon and content
|
717 |
-
$row = null;
|
718 |
-
}
|
719 |
-
return [$propName, $row];
|
720 |
-
}
|
721 |
-
/**
|
722 |
-
* Return array from content split by '\,'
|
723 |
-
*
|
724 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
725 |
-
* @since 2.23.8 - 2017-04-16
|
726 |
-
* @param string $content
|
727 |
-
* @return array
|
728 |
-
* @static
|
729 |
-
*/
|
730 |
-
public static function commaSplit( $content ) {
|
731 |
-
static $DBBS = "\\";
|
732 |
-
$output = [0 => null];
|
733 |
-
$cix = $lix = 0;
|
734 |
-
$len = strlen( $content );
|
735 |
-
while( $lix < $len ) {
|
736 |
-
if(( self::$COMMA == $content[$lix] ) &&
|
737 |
-
( $DBBS != $content[( $lix - 1 )]))
|
738 |
-
$output[++$cix] = null;
|
739 |
-
else
|
740 |
-
$output[$cix] .= $content[$lix];
|
741 |
-
$lix++;
|
742 |
-
}
|
743 |
-
return array_filter( $output );
|
744 |
-
}
|
745 |
-
/**
|
746 |
-
* Return concatenated calendar rows, one row for each property
|
747 |
-
*
|
748 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
749 |
-
* @since 2.22.23 - 2017-02-17
|
750 |
-
* @param array $rows
|
751 |
-
* @return array
|
752 |
-
* @static
|
753 |
-
*/
|
754 |
-
public static function concatRows( $rows ) {
|
755 |
-
$output = [];
|
756 |
-
$cnt = count( $rows );
|
757 |
-
for( $i = 0; $i < $cnt; $i++ ) {
|
758 |
-
$line = rtrim( $rows[$i], self::$CRLF );
|
759 |
-
while( isset( $rows[$i+1] ) &&
|
760 |
-
! empty( $rows[$i+1] ) &&
|
761 |
-
( self::$SP1 == $rows[$i+1]{0} ))
|
762 |
-
$line .= rtrim( substr( $rows[++$i], 1 ), self::$CRLF );
|
763 |
-
$output[] = $line;
|
764 |
-
}
|
765 |
-
return $output;
|
766 |
-
}
|
767 |
-
/**
|
768 |
-
* Return string with removed ical line folding
|
769 |
-
*
|
770 |
-
* Remove any line-endings that may include spaces or tabs
|
771 |
-
* and convert all line endings (iCal default '\r\n'),
|
772 |
-
* takes care of '\r\n', '\r' and '\n' and mixed '\r\n'+'\r', '\r\n'+'\n'
|
773 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
774 |
-
* @since 2.22.23 - 2017-03-01
|
775 |
-
* @param string $text
|
776 |
-
* @return string
|
777 |
-
* @static
|
778 |
-
*/
|
779 |
-
public static function convEolChar( & $text ) {
|
780 |
-
static $BASEDELIM = null;
|
781 |
-
static $BASEDELIMs = null;
|
782 |
-
static $EMPTYROW = null;
|
783 |
-
static $FMT = '%1$s%2$75s%1$s';
|
784 |
-
static $SP0 = '';
|
785 |
-
static $CRLFs = ["\r\n", "\n\r", "\n", "\r"];
|
786 |
-
static $CRLFexts = ["\r\n ", "\n\r\t"];
|
787 |
-
/* fix dummy line separator etc */
|
788 |
-
if( empty( $BASEDELIM )) {
|
789 |
-
$BASEDELIM = self::getRandChars( 16 );
|
790 |
-
$BASEDELIMs = $BASEDELIM . $BASEDELIM;
|
791 |
-
$EMPTYROW = sprintf( $FMT, $BASEDELIM, $SP0 );
|
792 |
-
}
|
793 |
-
/* fix eol chars */
|
794 |
-
$text = str_replace( $CRLFs, $BASEDELIM, $text );
|
795 |
-
/* fix empty lines */
|
796 |
-
$text = str_replace( $BASEDELIMs, $EMPTYROW, $text );
|
797 |
-
/* fix line folding */
|
798 |
-
$text = str_replace( $BASEDELIM, util::$CRLF, $text );
|
799 |
-
$text = str_replace( $CRLFexts, null, $text );
|
800 |
-
/* split in component/property lines */
|
801 |
-
return explode( util::$CRLF, $text );
|
802 |
-
}
|
803 |
-
/**
|
804 |
-
* Return wrapped string with (byte oriented) line breaks at pos 75
|
805 |
-
*
|
806 |
-
* Lines of text SHOULD NOT be longer than 75 octets, excluding the line
|
807 |
-
* break. Long content lines SHOULD be split into a multiple line
|
808 |
-
* representations using a line "folding" technique. That is, a long
|
809 |
-
* line can be split between any two characters by inserting a CRLF
|
810 |
-
* immediately followed by a single linear white space character (i.e.,
|
811 |
-
* SPACE, US-ASCII decimal 32 or HTAB, US-ASCII decimal 9). Any sequence
|
812 |
-
* of CRLF followed immediately by a single linear white space character
|
813 |
-
* is ignored (i.e., removed) when processing the content type.
|
814 |
-
*
|
815 |
-
* Edited 2007-08-26 by Anders Litzell, anders@litzell.se to fix bug where
|
816 |
-
* the reserved expression "\n" in the arg $string could be broken up by the
|
817 |
-
* folding of lines, causing ambiguity in the return string.
|
818 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
819 |
-
* @since 2.22.23 - 2017-03-01
|
820 |
-
* @param string $string
|
821 |
-
* @return string
|
822 |
-
* @access private
|
823 |
-
* @static
|
824 |
-
* @link http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
825 |
-
*/
|
826 |
-
private static function size75( $string ) {
|
827 |
-
static $DBS = '\\';
|
828 |
-
static $LCN = 'n';
|
829 |
-
static $UCN = 'N';
|
830 |
-
static $SPBSLCN = ' \n';
|
831 |
-
static $SP1 = ' ';
|
832 |
-
$tmp = $string;
|
833 |
-
$string = null;
|
834 |
-
$cCnt = $x = 0;
|
835 |
-
while( true ) {
|
836 |
-
if( ! isset( $tmp[$x] )) {
|
837 |
-
$string .= util::$CRLF; // loop breakes here
|
838 |
-
break;
|
839 |
-
}
|
840 |
-
elseif(( 74 <= $cCnt ) &&
|
841 |
-
( $DBS == $tmp[$x] ) &&
|
842 |
-
(( $LCN == $tmp[$x+1] ) || ( $UCN == $tmp[$x+1] ))) {
|
843 |
-
$string .= util::$CRLF . $SPBSLCN; // don't break lines inside '\n'
|
844 |
-
$x += 2;
|
845 |
-
if( ! isset( $tmp[$x] )) {
|
846 |
-
$string .= util::$CRLF;
|
847 |
-
break;
|
848 |
-
}
|
849 |
-
$cCnt = 3;
|
850 |
-
}
|
851 |
-
elseif( 75 <= $cCnt ) {
|
852 |
-
$string .= util::$CRLF . $SP1;
|
853 |
-
$cCnt = 1;
|
854 |
-
}
|
855 |
-
$byte = ord( $tmp[$x] );
|
856 |
-
$string .= $tmp[$x];
|
857 |
-
switch( true ) {
|
858 |
-
case(( $byte >= 0x20 ) && ( $byte <= 0x7F )) :
|
859 |
-
$cCnt += 1; // characters U-00000000 - U-0000007F (same as ASCII)
|
860 |
-
break; // add a one byte character
|
861 |
-
case(( $byte & 0xE0) == 0xC0 ) : // characters U-00000080 - U-000007FF, mask 110XXXXX
|
862 |
-
if( isset( $tmp[$x+1] )) {
|
863 |
-
$cCnt += 1;
|
864 |
-
$string .= $tmp[$x+1];
|
865 |
-
$x += 1; // add a two bytes character
|
866 |
-
}
|
867 |
-
break;
|
868 |
-
case(( $byte & 0xF0 ) == 0xE0 ) : // characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
869 |
-
if( isset( $tmp[$x+2] )) {
|
870 |
-
$cCnt += 1;
|
871 |
-
$string .= $tmp[$x+1] . $tmp[$x+2];
|
872 |
-
$x += 2; // add a three bytes character
|
873 |
-
}
|
874 |
-
break;
|
875 |
-
case(( $byte & 0xF8 ) == 0xF0 ) : // characters U-00010000 - U-001FFFFF, mask 11110XXX
|
876 |
-
if( isset( $tmp[$x+3] )) {
|
877 |
-
$cCnt += 1;
|
878 |
-
$string .= $tmp[$x+1] . $tmp[$x+2] . $tmp[$x+3];
|
879 |
-
$x += 3; // add a four bytes character
|
880 |
-
}
|
881 |
-
break;
|
882 |
-
case(( $byte & 0xFC ) == 0xF8 ) : // characters U-00200000 - U-03FFFFFF, mask 111110XX
|
883 |
-
if( isset( $tmp[$x+4] )) {
|
884 |
-
$cCnt += 1;
|
885 |
-
$string .= $tmp[$x+1] . $tmp[$x+2] . $tmp[$x+3] . $tmp[$x+4];
|
886 |
-
$x += 4; // add a five bytes character
|
887 |
-
}
|
888 |
-
break;
|
889 |
-
case(( $byte & 0xFE ) == 0xFC ) : // characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
890 |
-
if( isset( $tmp[$x+5] )) {
|
891 |
-
$cCnt += 1;
|
892 |
-
$string .= $tmp[$x+1] . $tmp[$x+2] . $tmp[$x+3] . $tmp[$x+4] . $tmp[$x+5];
|
893 |
-
$x += 5; // add a six bytes character
|
894 |
-
}
|
895 |
-
break;
|
896 |
-
default: // add any other byte without counting up $cCnt
|
897 |
-
break;
|
898 |
-
} // end switch( true )
|
899 |
-
$x += 1; // next 'byte' to test
|
900 |
-
} // end while( true )
|
901 |
-
return $string;
|
902 |
-
}
|
903 |
-
/**
|
904 |
-
* Separate (string) to iCal property value and attributes
|
905 |
-
*
|
906 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
907 |
-
* @since 2.23.13 - 2017-05-02
|
908 |
-
* @param string $line property content
|
909 |
-
* @param array $propAttr property parameters
|
910 |
-
* @static
|
911 |
-
* @TODO same as in util::calAddressCheck() ??
|
912 |
-
*/
|
913 |
-
public static function splitContent( & $line, & $propAttr=null ) {
|
914 |
-
static $CSS = '://';
|
915 |
-
static $MSTZ = ['utc-', 'utc+', 'gmt-', 'gmt+'];
|
916 |
-
static $PROTO3 = ['fax:', 'cid:', 'sms:', 'tel:', 'urn:'];
|
917 |
-
static $PROTO4 = ['crid:', 'news:', 'pres:'];
|
918 |
-
static $PROTO6 = ['mailto:'];
|
919 |
-
static $EQ = '=';
|
920 |
-
$attr = [];
|
921 |
-
$attrix = -1;
|
922 |
-
$clen = strlen( $line );
|
923 |
-
$WithinQuotes = false;
|
924 |
-
$len = strlen( $line );
|
925 |
-
$cix = 0;
|
926 |
-
while( $cix < $len ) {
|
927 |
-
if( ! $WithinQuotes && ( self::$COLON == $line[$cix] ) &&
|
928 |
-
( substr( $line,$cix, 3 ) != $CSS ) &&
|
929 |
-
( ! in_array( strtolower( substr( $line,$cix - 6, 4 )), $MSTZ )) &&
|
930 |
-
( ! in_array( strtolower( substr( $line,$cix - 3, 4 )), $PROTO3 )) &&
|
931 |
-
( ! in_array( strtolower( substr( $line,$cix - 4, 5 )), $PROTO4 )) &&
|
932 |
-
( ! in_array( strtolower( substr( $line,$cix - 6, 7 )), $PROTO6 ))) {
|
933 |
-
$attrEnd = true;
|
934 |
-
if(( $cix < ( $clen - 4 )) &&
|
935 |
-
ctype_digit( substr( $line, $cix+1, 4 ))) { // an URI with a (4pos) portnr??
|
936 |
-
for( $c2ix = $cix; 3 < $c2ix; $c2ix-- ) {
|
937 |
-
if( $CSS == substr( $line, $c2ix - 2, 3 )) {
|
938 |
-
$attrEnd = false;
|
939 |
-
break; // an URI with a portnr!!
|
940 |
-
}
|
941 |
-
}
|
942 |
-
}
|
943 |
-
if( $attrEnd) {
|
944 |
-
$line = substr( $line, ( $cix + 1 ));
|
945 |
-
break;
|
946 |
-
}
|
947 |
-
$cix++;
|
948 |
-
} // end if( ! $WithinQuotes...
|
949 |
-
if( self::$QQ == $line[$cix] ) // '"'
|
950 |
-
$WithinQuotes = ! $WithinQuotes;
|
951 |
-
if( self::$SEMIC == $line[$cix] ) // ';'
|
952 |
-
$attr[++$attrix] = null;
|
953 |
-
else {
|
954 |
-
if( 0 > $attrix )
|
955 |
-
$attrix = 0;
|
956 |
-
$attr[$attrix] .= $line[$cix];
|
957 |
-
}
|
958 |
-
$cix++;
|
959 |
-
} // end while...
|
960 |
-
/* make attributes in array format */
|
961 |
-
$propAttr = [];
|
962 |
-
foreach( $attr as $attribute ) {
|
963 |
-
$attrsplit = explode( $EQ, $attribute, 2 );
|
964 |
-
if( 1 < count( $attrsplit ))
|
965 |
-
$propAttr[$attrsplit[0]] = $attrsplit[1];
|
966 |
-
}
|
967 |
-
}
|
968 |
-
/**
|
969 |
-
* Special characters management output
|
970 |
-
*
|
971 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
972 |
-
* @since 2.23.8 - 2017-04-17
|
973 |
-
* @param string $string
|
974 |
-
* @return string
|
975 |
-
* @static
|
976 |
-
*/
|
977 |
-
public static function strrep( $string ) {
|
978 |
-
static $BSLCN = '\n';
|
979 |
-
static $SPECCHAR = ['n', 'N', 'r', ',', ';'];
|
980 |
-
static $DBS = "\\";
|
981 |
-
static $SQ = "'";
|
982 |
-
static $BSCOMMA = '\,';
|
983 |
-
static $BSSEMIC = '\;';
|
984 |
-
static $BSLCR = "\r";
|
985 |
-
static $QBSLCN = "\n";
|
986 |
-
static $BSUCN = '\N';
|
987 |
-
$string = (string) $string;
|
988 |
-
$strLen = strlen( $string );
|
989 |
-
$pos = 0;
|
990 |
-
while( $pos < $strLen ) {
|
991 |
-
if( false === ( $pos = strpos( $string, $DBS, $pos )))
|
992 |
-
break;
|
993 |
-
if( ! in_array( substr( $string, $pos, 1 ), $SPECCHAR )) {
|
994 |
-
$string = substr( $string, 0, $pos ) . $DBS . substr( $string, ( $pos + 1 ));
|
995 |
-
$pos += 1;
|
996 |
-
}
|
997 |
-
$pos += 1;
|
998 |
-
}
|
999 |
-
if( false !== strpos( $string, self::$QQ ))
|
1000 |
-
$string = str_replace( self::$QQ, $SQ, $string);
|
1001 |
-
if( false !== strpos( $string, self::$COMMA ))
|
1002 |
-
$string = str_replace( self::$COMMA, $BSCOMMA, $string);
|
1003 |
-
if( false !== strpos( $string, self::$SEMIC ))
|
1004 |
-
$string = str_replace( self::$SEMIC, $BSSEMIC, $string);
|
1005 |
-
if( false !== strpos( $string, self::$CRLF ))
|
1006 |
-
$string = str_replace( self::$CRLF, $BSLCN, $string);
|
1007 |
-
elseif( false !== strpos( $string, $BSLCR ))
|
1008 |
-
$string = str_replace( $BSLCR, $BSLCN, $string);
|
1009 |
-
elseif( false !== strpos( $string, $QBSLCN ))
|
1010 |
-
$string = str_replace( $QBSLCN, $BSLCN, $string);
|
1011 |
-
if( false !== strpos( $string, $BSUCN ))
|
1012 |
-
$string = str_replace( $BSUCN, $BSLCN, $string);
|
1013 |
-
$string = str_replace( self::$CRLF, $BSLCN, $string);
|
1014 |
-
return $string;
|
1015 |
-
}
|
1016 |
-
/**
|
1017 |
-
* Special characters management input
|
1018 |
-
*
|
1019 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1020 |
-
* @since 2.22.2 - 2015-06-25
|
1021 |
-
* @param string $string
|
1022 |
-
* @return string
|
1023 |
-
* @static
|
1024 |
-
*/
|
1025 |
-
public static function strunrep( $string ) {
|
1026 |
-
static $BS4 = '\\\\';
|
1027 |
-
static $BS2 = '\\';
|
1028 |
-
static $BSCOMMA = '\,';
|
1029 |
-
static $BSSEMIC = '\;';
|
1030 |
-
$string = str_replace( $BS4, $BS2, $string);
|
1031 |
-
$string = str_replace( $BSCOMMA, self::$COMMA, $string);
|
1032 |
-
$string = str_replace( $BSSEMIC, self::$SEMIC, $string);
|
1033 |
-
return $string;
|
1034 |
-
}
|
1035 |
-
/**
|
1036 |
-
* Return string with trimmed trailing \n
|
1037 |
-
*
|
1038 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1039 |
-
* @since 2.22.23 - 2017-02-17
|
1040 |
-
* @param string $value
|
1041 |
-
* @return string
|
1042 |
-
* @static
|
1043 |
-
*/
|
1044 |
-
public static function trimTrailNL( $value ) {
|
1045 |
-
static $NL = '\n';
|
1046 |
-
if( $NL == strtolower( substr( $value, -2 )))
|
1047 |
-
$value = substr( $value, 0, ( strlen( $value ) -2 ));
|
1048 |
-
return $value;
|
1049 |
-
}
|
1050 |
-
/**
|
1051 |
-
* Return internal date (format) with parameters based on input date
|
1052 |
-
*
|
1053 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1054 |
-
* @since 2.21.11 - 2015-03-21
|
1055 |
-
* @param mixed $year
|
1056 |
-
* @param mixed $month
|
1057 |
-
* @param int $day
|
1058 |
-
* @param int $hour
|
1059 |
-
* @param int $min
|
1060 |
-
* @param int $sec
|
1061 |
-
* @param string $tz
|
1062 |
-
* @param array $params
|
1063 |
-
* @param string $caller
|
1064 |
-
* @param string $objName
|
1065 |
-
* @param string $tzid
|
1066 |
-
* @return array
|
1067 |
-
* @static
|
1068 |
-
*/
|
1069 |
-
public static function setDate( $year,
|
1070 |
-
$month=null,
|
1071 |
-
$day=null,
|
1072 |
-
$hour=null,
|
1073 |
-
$min=null,
|
1074 |
-
$sec=null,
|
1075 |
-
$tz=null,
|
1076 |
-
$params=null,
|
1077 |
-
$caller=null,
|
1078 |
-
$objName=null,
|
1079 |
-
$tzid=null ) {
|
1080 |
-
$input = $parno = null;
|
1081 |
-
$localtime = (( self::$DTSTART == $caller ) &&
|
1082 |
-
in_array( $objName, self::$TZCOMPS )) ? true : false;
|
1083 |
-
self::strDate2arr( $year );
|
1084 |
-
if( self::isArrayDate( $year )) {
|
1085 |
-
$input[self::$LCvalue] = self::chkDateArr( $year );
|
1086 |
-
if( 100 > $input[self::$LCvalue][self::$LCYEAR] )
|
1087 |
-
$input[self::$LCvalue][self::$LCYEAR] += 2000;
|
1088 |
-
if( $localtime )
|
1089 |
-
unset( $month[self::$VALUE], $month[self::$TZID] );
|
1090 |
-
elseif( ! isset( $month[self::$TZID] ) && isset( $tzid ))
|
1091 |
-
$month[self::$TZID] = $tzid;
|
1092 |
-
if( isset( $input[self::$LCvalue][self::$LCtz] ) &&
|
1093 |
-
self::isOffset( $input[self::$LCvalue][self::$LCtz] ))
|
1094 |
-
unset( $month[self::$TZID] );
|
1095 |
-
elseif( ! isset( $input[self::$LCvalue][self::$LCtz] ) &&
|
1096 |
-
isset( $month[self::$TZID] ) &&
|
1097 |
-
self::isOffset( $month[self::$TZID] )) {
|
1098 |
-
$input[self::$LCvalue][self::$LCtz] = $month[self::$TZID];
|
1099 |
-
unset( $month[self::$TZID] );
|
1100 |
-
}
|
1101 |
-
$input[self::$LCparams] = self::setParams( $month,
|
1102 |
-
self::$DEFAULTVALUEDATETIME );
|
1103 |
-
$hitval = ( isset( $input[self::$LCvalue][self::$LCtz] )) ? 7 : 6;
|
1104 |
-
$parno = self::existRem( $input[self::$LCparams],
|
1105 |
-
self::$VALUE,
|
1106 |
-
self::$DATE_TIME,
|
1107 |
-
$hitval );
|
1108 |
-
$parno = self::existRem( $input[self::$LCparams],
|
1109 |
-
self::$VALUE,
|
1110 |
-
self::$DATE,
|
1111 |
-
3,
|
1112 |
-
count( $input[self::$LCvalue] ),
|
1113 |
-
$parno );
|
1114 |
-
if( 6 > $parno )
|
1115 |
-
unset( $input[self::$LCvalue][self::$LCtz],
|
1116 |
-
$input[self::$LCparams][self::$TZID],
|
1117 |
-
$tzid );
|
1118 |
-
if(( 6 <= $parno ) &&
|
1119 |
-
isset( $input[self::$LCvalue][self::$LCtz] ) &&
|
1120 |
-
( self::$Z != $input[self::$LCvalue][self::$LCtz] ) &&
|
1121 |
-
self::isOffset( $input[self::$LCvalue][self::$LCtz] )) {
|
1122 |
-
$input[self::$LCvalue] = self::strDate2ArrayDate( sprintf( self::$YMDHISE,
|
1123 |
-
(int) $input[self::$LCvalue][self::$LCYEAR],
|
1124 |
-
(int) $input[self::$LCvalue][self::$LCMONTH],
|
1125 |
-
(int) $input[self::$LCvalue][self::$LCDAY],
|
1126 |
-
(int) $input[self::$LCvalue][self::$LCHOUR],
|
1127 |
-
(int) $input[self::$LCvalue][self::$LCMIN],
|
1128 |
-
(int) $input[self::$LCvalue][self::$LCSEC],
|
1129 |
-
$input[self::$LCvalue][self::$LCtz] ),
|
1130 |
-
$parno );
|
1131 |
-
unset( $input[self::$LCvalue][self::$UNPARSEDTEXT],
|
1132 |
-
$input[self::$LCparams][self::$TZID] );
|
1133 |
-
}
|
1134 |
-
if( isset( $input[self::$LCvalue][self::$LCtz] ) &&
|
1135 |
-
! self::isOffset( $input[self::$LCvalue][self::$LCtz] )) {
|
1136 |
-
$input[self::$LCparams][self::$TZID] = $input[self::$LCvalue][self::$LCtz];
|
1137 |
-
unset( $input[self::$LCvalue][self::$LCtz] );
|
1138 |
-
}
|
1139 |
-
} // end if( self::isArrayDate( $year ))
|
1140 |
-
elseif( self::isArrayTimestampDate( $year )) {
|
1141 |
-
if( $localtime )
|
1142 |
-
unset( $month[self::$LCvalue], $month[self::$TZID] );
|
1143 |
-
$input[self::$LCparams] = self::setParams( $month,
|
1144 |
-
self::$DEFAULTVALUEDATETIME );
|
1145 |
-
$parno = self::existRem( $input[self::$LCparams],
|
1146 |
-
self::$VALUE,
|
1147 |
-
self::$DATE,
|
1148 |
-
3 );
|
1149 |
-
$hitval = 7;
|
1150 |
-
$parno = self::existRem( $input[self::$LCparams],
|
1151 |
-
self::$VALUE,
|
1152 |
-
self::$DATE_TIME,
|
1153 |
-
$hitval,
|
1154 |
-
$parno );
|
1155 |
-
if( isset( $year[self::$LCtz] ) && ! empty( $year[self::$LCtz] )) {
|
1156 |
-
if( !self::isOffset( $year[self::$LCtz] )) {
|
1157 |
-
$input[self::$LCparams][self::$TZID] = $year[self::$LCtz];
|
1158 |
-
unset( $year[self::$LCtz], $tzid );
|
1159 |
-
}
|
1160 |
-
else {
|
1161 |
-
if( isset( $input[self::$LCparams][self::$TZID] ) &&
|
1162 |
-
! empty( $input[self::$LCparams][self::$TZID] )) {
|
1163 |
-
if( !self::isOffset( $input[self::$LCparams][self::$TZID] ))
|
1164 |
-
unset( $tzid );
|
1165 |
-
else
|
1166 |
-
unset( $input[self::$LCparams][self::$TZID]);
|
1167 |
-
}
|
1168 |
-
elseif( isset( $tzid ) && ! self::isOffset( $tzid ))
|
1169 |
-
$input[self::$LCparams][self::$TZID] = $tzid;
|
1170 |
-
}
|
1171 |
-
}
|
1172 |
-
elseif( isset( $input[self::$LCparams][self::$TZID] ) &&
|
1173 |
-
! empty( $input[self::$LCparams][self::$TZID] )) {
|
1174 |
-
if( self::isOffset( $input[self::$LCparams][self::$TZID] )) {
|
1175 |
-
$year[self::$LCtz] = $input[self::$LCparams][self::$TZID];
|
1176 |
-
unset( $input[self::$LCparams][self::$TZID]);
|
1177 |
-
if( isset( $tzid ) &&
|
1178 |
-
! empty( $tzid ) &&
|
1179 |
-
! self::isOffset( $tzid ))
|
1180 |
-
$input[self::$LCparams][self::$TZID] = $tzid;
|
1181 |
-
}
|
1182 |
-
}
|
1183 |
-
elseif( isset( $tzid ) && ! empty( $tzid )) {
|
1184 |
-
if( self::isOffset( $tzid )) {
|
1185 |
-
$year[self::$LCtz] = $tzid;
|
1186 |
-
unset( $input[self::$LCparams][self::$TZID]);
|
1187 |
-
}
|
1188 |
-
else
|
1189 |
-
$input[self::$LCparams][self::$TZID] = $tzid;
|
1190 |
-
}
|
1191 |
-
$input[self::$LCvalue] = self::timestamp2date( $year, $parno );
|
1192 |
-
} // end elseif( self::isArrayTimestampDate( $year ))
|
1193 |
-
elseif( 8 <= strlen( trim((string) $year ))) { // string ex. "2006-08-03 10:12:18 [[[+/-]1234[56]] / timezone]"
|
1194 |
-
if( $localtime )
|
1195 |
-
unset( $month[self::$LCvalue], $month[self::$TZID] );
|
1196 |
-
elseif( ! isset( $month[self::$TZID] ) && ! empty( $tzid ))
|
1197 |
-
$month[self::$TZID] = $tzid;
|
1198 |
-
$input[self::$LCparams] = self::setParams( $month,
|
1199 |
-
self::$DEFAULTVALUEDATETIME );
|
1200 |
-
$parno = self::existRem( $input[self::$LCparams],
|
1201 |
-
self::$VALUE,
|
1202 |
-
self::$DATE_TIME,
|
1203 |
-
7,
|
1204 |
-
$parno );
|
1205 |
-
$parno = self::existRem( $input[self::$LCparams],
|
1206 |
-
self::$VALUE,
|
1207 |
-
self::$DATE,
|
1208 |
-
3,
|
1209 |
-
$parno,
|
1210 |
-
$parno );
|
1211 |
-
$input[self::$LCvalue] = self::strDate2ArrayDate( $year, $parno );
|
1212 |
-
if( 3 == $parno )
|
1213 |
-
unset( $input[self::$LCvalue][self::$LCtz],
|
1214 |
-
$input[self::$LCparams][self::$TZID] );
|
1215 |
-
unset( $input[self::$LCvalue][self::$UNPARSEDTEXT] );
|
1216 |
-
if( isset( $input[self::$LCvalue][self::$LCtz] )) {
|
1217 |
-
if( self::isOffset( $input[self::$LCvalue][self::$LCtz] )) {
|
1218 |
-
$input[self::$LCvalue] = self::strDate2ArrayDate( sprintf( self::$YMDHISE,
|
1219 |
-
(int) $input[self::$LCvalue][self::$LCYEAR],
|
1220 |
-
(int) $input[self::$LCvalue][self::$LCMONTH],
|
1221 |
-
(int) $input[self::$LCvalue][self::$LCDAY],
|
1222 |
-
(int) $input[self::$LCvalue][self::$LCHOUR],
|
1223 |
-
(int) $input[self::$LCvalue][self::$LCMIN],
|
1224 |
-
(int) $input[self::$LCvalue][self::$LCSEC],
|
1225 |
-
$input[self::$LCvalue][self::$LCtz] ),
|
1226 |
-
7 );
|
1227 |
-
unset( $input[self::$LCvalue][self::$UNPARSEDTEXT],
|
1228 |
-
$input[self::$LCparams][self::$TZID] );
|
1229 |
-
}
|
1230 |
-
else {
|
1231 |
-
$input[self::$LCparams][self::$TZID] = $input[self::$LCvalue][self::$LCtz];
|
1232 |
-
unset( $input[self::$LCvalue][self::$LCtz] );
|
1233 |
-
}
|
1234 |
-
}
|
1235 |
-
elseif( isset( $input[self::$LCparams][self::$TZID] ) &&
|
1236 |
-
self::isOffset( $input[self::$LCparams][self::$TZID] )) {
|
1237 |
-
$input[self::$LCvalue] = self::strDate2ArrayDate( sprintf( self::$YMDHISE,
|
1238 |
-
(int) $input[self::$LCvalue][self::$LCYEAR],
|
1239 |
-
(int) $input[self::$LCvalue][self::$LCMONTH],
|
1240 |
-
(int) $input[self::$LCvalue][self::$LCDAY],
|
1241 |
-
(int) $input[self::$LCvalue][self::$LCHOUR],
|
1242 |
-
(int) $input[self::$LCvalue][self::$LCMIN],
|
1243 |
-
(int) $input[self::$LCvalue][self::$LCSEC],
|
1244 |
-
$input[self::$LCparams][self::$TZID] ),
|
1245 |
-
7 );
|
1246 |
-
unset( $input[self::$LCvalue][self::$UNPARSEDTEXT],
|
1247 |
-
$input[self::$LCparams][self::$TZID] );
|
1248 |
-
}
|
1249 |
-
} // end elseif( 8 <= strlen( trim((string) $year )))
|
1250 |
-
else { // using all (?) args
|
1251 |
-
if( 100 > $year )
|
1252 |
-
$year += 2000;
|
1253 |
-
if( is_array( $params ))
|
1254 |
-
$input[self::$LCparams] = self::setParams( $params,
|
1255 |
-
self::$DEFAULTVALUEDATETIME );
|
1256 |
-
elseif( is_array( $tz )) {
|
1257 |
-
$input[self::$LCparams] = self::setParams( $tz,
|
1258 |
-
self::$DEFAULTVALUEDATETIME );
|
1259 |
-
$tz = false;
|
1260 |
-
}
|
1261 |
-
elseif( is_array( $hour )) {
|
1262 |
-
$input[self::$LCparams] = self::setParams( $hour,
|
1263 |
-
self::$DEFAULTVALUEDATETIME );
|
1264 |
-
$hour = $min = $sec = $tz = false;
|
1265 |
-
}
|
1266 |
-
if( $localtime )
|
1267 |
-
unset ( $input[self::$LCparams][self::$LCvalue],
|
1268 |
-
$input[self::$LCparams][self::$TZID] );
|
1269 |
-
elseif( ! isset( $tz ) &&
|
1270 |
-
! isset( $input[self::$LCparams][self::$TZID] ) &&
|
1271 |
-
! empty( $tzid ))
|
1272 |
-
$input[self::$LCparams][self::$TZID] = $tzid;
|
1273 |
-
elseif( isset( $tz ) && self::isOffset( $tz ))
|
1274 |
-
unset( $input[self::$LCparams][self::$TZID] );
|
1275 |
-
elseif( isset( $input[self::$LCparams][self::$TZID] ) &&
|
1276 |
-
self::isOffset( $input[self::$LCparams][self::$TZID] )) {
|
1277 |
-
$tz = $input[self::$LCparams][self::$TZID];
|
1278 |
-
unset( $input[self::$LCparams][self::$TZID] );
|
1279 |
-
}
|
1280 |
-
$parno = self::existRem( $input[self::$LCparams],
|
1281 |
-
self::$VALUE,
|
1282 |
-
self::$DATE,
|
1283 |
-
3 );
|
1284 |
-
$hitval = ( self::isOffset( $tz )) ? 7 : 6;
|
1285 |
-
$parno = self::existRem( $input[self::$LCparams],
|
1286 |
-
self::$VALUE,
|
1287 |
-
self::$DATE_TIME,
|
1288 |
-
$hitval,
|
1289 |
-
$parno,
|
1290 |
-
$parno );
|
1291 |
-
$input[self::$LCvalue] = [self::$LCYEAR => $year,
|
1292 |
-
self::$LCMONTH => $month,
|
1293 |
-
self::$LCDAY => $day];
|
1294 |
-
if( 3 != $parno ) {
|
1295 |
-
$input[self::$LCvalue][self::$LCHOUR] = ( $hour ) ? $hour : '0';
|
1296 |
-
$input[self::$LCvalue][self::$LCMIN] = ( $min ) ? $min : '0';
|
1297 |
-
$input[self::$LCvalue][self::$LCSEC] = ( $sec ) ? $sec : '0';
|
1298 |
-
if( ! empty( $tz ))
|
1299 |
-
$input[self::$LCvalue][self::$LCtz] = $tz;
|
1300 |
-
$strdate = self::date2strdate( $input[self::$LCvalue], $parno );
|
1301 |
-
if( ! empty( $tz ) && !self::isOffset( $tz ))
|
1302 |
-
$strdate .= ( self::$Z == $tz ) ? $tz : ' '.$tz;
|
1303 |
-
$input[self::$LCvalue] = self::strDate2ArrayDate( $strdate, $parno );
|
1304 |
-
unset( $input[self::$LCvalue][self::$UNPARSEDTEXT] );
|
1305 |
-
if( isset( $input[self::$LCvalue][self::$LCtz] )) {
|
1306 |
-
if( self::isOffset( $input[self::$LCvalue][self::$LCtz] )) {
|
1307 |
-
$input[self::$LCvalue] = self::strDate2ArrayDate( sprintf( self::$YMDHISE,
|
1308 |
-
(int) $input[self::$LCvalue][self::$LCYEAR],
|
1309 |
-
(int) $input[self::$LCvalue][self::$LCMONTH],
|
1310 |
-
(int) $input[self::$LCvalue][self::$LCDAY],
|
1311 |
-
(int) $input[self::$LCvalue][self::$LCHOUR],
|
1312 |
-
(int) $input[self::$LCvalue][self::$LCMIN],
|
1313 |
-
(int) $input[self::$LCvalue][self::$LCSEC],
|
1314 |
-
$input[self::$LCvalue][self::$LCtz] ),
|
1315 |
-
7 );
|
1316 |
-
unset( $input[self::$LCvalue][self::$UNPARSEDTEXT],
|
1317 |
-
$input[self::$LCparams][self::$TZID] );
|
1318 |
-
}
|
1319 |
-
else {
|
1320 |
-
$input[self::$LCparams][self::$TZID] = $input[self::$LCvalue][self::$LCtz];
|
1321 |
-
unset( $input[self::$LCvalue][self::$LCtz] );
|
1322 |
-
}
|
1323 |
-
}
|
1324 |
-
elseif( isset( $input[self::$LCparams][self::$TZID] ) &&
|
1325 |
-
self::isOffset( $input[self::$LCparams][self::$TZID] )) {
|
1326 |
-
$input[self::$LCvalue] = self::strDate2ArrayDate( sprintf( self::$YMDHISE,
|
1327 |
-
(int) $input[self::$LCvalue][self::$LCYEAR],
|
1328 |
-
(int) $input[self::$LCvalue][self::$LCMONTH],
|
1329 |
-
(int) $input[self::$LCvalue][self::$LCDAY],
|
1330 |
-
(int) $input[self::$LCvalue][self::$LCHOUR],
|
1331 |
-
(int) $input[self::$LCvalue][self::$LCMIN],
|
1332 |
-
(int) $input[self::$LCvalue][self::$LCSEC],
|
1333 |
-
$input[self::$LCparams][self::$TZID] ),
|
1334 |
-
7 );
|
1335 |
-
unset( $input[self::$LCvalue][self::$UNPARSEDTEXT],
|
1336 |
-
$input[self::$LCparams][self::$TZID] );
|
1337 |
-
}
|
1338 |
-
}
|
1339 |
-
} // end else (i.e. using all arguments)
|
1340 |
-
if(( 3 == $parno ) || self::isParamsValueSet( $input, self::$DATE )) {
|
1341 |
-
$input[self::$LCparams][self::$VALUE] = self::$DATE;
|
1342 |
-
unset( $input[self::$LCvalue][self::$LCHOUR],
|
1343 |
-
$input[self::$LCvalue][self::$LCMIN],
|
1344 |
-
$input[self::$LCvalue][self::$LCSEC],
|
1345 |
-
$input[self::$LCvalue][self::$LCtz],
|
1346 |
-
$input[self::$LCparams][self::$TZID] );
|
1347 |
-
}
|
1348 |
-
elseif( isset( $input[self::$LCparams][self::$TZID] )) {
|
1349 |
-
if(( 0 == strcasecmp( self::$UTC, $input[self::$LCparams][self::$TZID] )) ||
|
1350 |
-
( 0 == strcasecmp( self::$GMT, $input[self::$LCparams][self::$TZID] ))) {
|
1351 |
-
$input[self::$LCvalue][self::$LCtz] = self::$Z;
|
1352 |
-
unset( $input[self::$LCparams][self::$TZID] );
|
1353 |
-
}
|
1354 |
-
else
|
1355 |
-
unset( $input[self::$LCvalue][self::$LCtz] );
|
1356 |
-
}
|
1357 |
-
elseif( isset( $input[self::$LCvalue][self::$LCtz] )) {
|
1358 |
-
if(( 0 == strcasecmp( self::$UTC, $input[self::$LCvalue][self::$LCtz] )) ||
|
1359 |
-
( 0 == strcasecmp( self::$GMT, $input[self::$LCvalue][self::$LCtz] )))
|
1360 |
-
$input[self::$LCvalue][self::$LCtz] = self::$Z;
|
1361 |
-
if( self::$Z != $input[self::$LCvalue][self::$LCtz] ) {
|
1362 |
-
$input[self::$LCparams][self::$TZID] = $input[self::$LCvalue][self::$LCtz];
|
1363 |
-
unset( $input[self::$LCvalue][self::$LCtz] );
|
1364 |
-
}
|
1365 |
-
else
|
1366 |
-
unset( $input[self::$LCparams][self::$TZID] );
|
1367 |
-
}
|
1368 |
-
if( $localtime )
|
1369 |
-
unset( $input[self::$LCvalue][self::$LCtz], $input[self::$LCparams][self::$TZID] );
|
1370 |
-
return $input;
|
1371 |
-
}
|
1372 |
-
/**
|
1373 |
-
* Return input (UTC) date to internal date with parameters
|
1374 |
-
*
|
1375 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1376 |
-
* @since 2.22.23 - 2017-02-17
|
1377 |
-
* @param mixed $year
|
1378 |
-
* @param mixed $month
|
1379 |
-
* @param int $day
|
1380 |
-
* @param int $hour
|
1381 |
-
* @param int $min
|
1382 |
-
* @param int $sec
|
1383 |
-
* @param array $params
|
1384 |
-
* @return array
|
1385 |
-
* @static
|
1386 |
-
*/
|
1387 |
-
public static function setDate2( $year,
|
1388 |
-
$month=null,
|
1389 |
-
$day=null,
|
1390 |
-
$hour=null,
|
1391 |
-
$min=null,
|
1392 |
-
$sec=null,
|
1393 |
-
$params=null ) {
|
1394 |
-
$input = null;
|
1395 |
-
self::strDate2arr( $year );
|
1396 |
-
if( self::isArrayDate( $year )) {
|
1397 |
-
$input[self::$LCvalue] = self::chkDateArr( $year, 7 );
|
1398 |
-
if( isset( $input[self::$LCvalue][self::$LCYEAR] ) &&
|
1399 |
-
( 100 > $input[self::$LCvalue][self::$LCYEAR] ))
|
1400 |
-
$input[self::$LCvalue][self::$LCYEAR] += 2000;
|
1401 |
-
$input[self::$LCparams] = self::setParams( $month,
|
1402 |
-
self::$DEFAULTVALUEDATETIME );
|
1403 |
-
if( isset( $input[self::$LCvalue][self::$LCtz] ) &&
|
1404 |
-
self::isOffset( $input[self::$LCvalue][self::$LCtz] ))
|
1405 |
-
$tzid = $input[self::$LCvalue][self::$LCtz];
|
1406 |
-
elseif( isset( $input[self::$LCparams][self::$TZID] ) &&
|
1407 |
-
self::isOffset( $input[self::$LCparams][self::$TZID] ))
|
1408 |
-
$tzid = $input[self::$LCparams][self::$TZID];
|
1409 |
-
else
|
1410 |
-
$tzid = null;
|
1411 |
-
if( ! empty( $tzid ) && ( self::$Z != $tzid ) && self::isOffset( $tzid )) {
|
1412 |
-
$input[self::$LCvalue] = self::strDate2ArrayDate( sprintf( self::$YMDHISE,
|
1413 |
-
(int) $input[self::$LCvalue][self::$LCYEAR],
|
1414 |
-
(int) $input[self::$LCvalue][self::$LCMONTH],
|
1415 |
-
(int) $input[self::$LCvalue][self::$LCDAY],
|
1416 |
-
(int) $input[self::$LCvalue][self::$LCHOUR],
|
1417 |
-
(int) $input[self::$LCvalue][self::$LCMIN],
|
1418 |
-
(int) $input[self::$LCvalue][self::$LCSEC],
|
1419 |
-
$tzid ),
|
1420 |
-
7 );
|
1421 |
-
unset( $input[self::$LCvalue][self::$UNPARSEDTEXT] );
|
1422 |
-
}
|
1423 |
-
} // end if( self::isArrayDate( $year ))
|
1424 |
-
elseif( self::isArrayTimestampDate( $year )) {
|
1425 |
-
if( isset( $year[self::$LCtz] ) &&
|
1426 |
-
! self::isOffset( $year[self::$LCtz] ))
|
1427 |
-
$year[self::$LCtz] = self::$UTC;
|
1428 |
-
elseif( isset( $input[self::$LCparams][self::$TZID] ) &&
|
1429 |
-
self::isOffset( $input[self::$LCparams][self::$TZID] ))
|
1430 |
-
$year[self::$LCtz] = $input[self::$LCparams][self::$TZID];
|
1431 |
-
else
|
1432 |
-
$year[self::$LCtz] = self::$UTC;
|
1433 |
-
$input[self::$LCvalue] = self::timestamp2date( $year, 7 );
|
1434 |
-
$input[self::$LCparams] = self::setParams( $month,
|
1435 |
-
self::$DEFAULTVALUEDATETIME );
|
1436 |
-
} // end elseif( self::isArrayTimestampDate( $year ))
|
1437 |
-
elseif( 8 <= strlen( trim((string) $year ))) { // ex. 2006-08-03 10:12:18
|
1438 |
-
$input[self::$LCvalue] = self::strDate2ArrayDate( $year, 7 );
|
1439 |
-
unset( $input[self::$LCvalue][self::$UNPARSEDTEXT] );
|
1440 |
-
$input[self::$LCparams] = self::setParams( $month,
|
1441 |
-
self::$DEFAULTVALUEDATETIME );
|
1442 |
-
if(( ! isset( $input[self::$LCvalue][self::$LCtz] ) ||
|
1443 |
-
empty( $input[self::$LCvalue][self::$LCtz] )) &&
|
1444 |
-
isset( $input[self::$LCparams][self::$TZID] ) &&
|
1445 |
-
self::isOffset( $input[self::$LCparams][self::$TZID] )) {
|
1446 |
-
$input[self::$LCvalue] = self::strDate2ArrayDate( sprintf( self::$YMDHISE,
|
1447 |
-
(int) $input[self::$LCvalue][self::$LCYEAR],
|
1448 |
-
(int) $input[self::$LCvalue][self::$LCMONTH],
|
1449 |
-
(int) $input[self::$LCvalue][self::$LCDAY],
|
1450 |
-
(int) $input[self::$LCvalue][self::$LCHOUR],
|
1451 |
-
(int) $input[self::$LCvalue][self::$LCMIN],
|
1452 |
-
(int) $input[self::$LCvalue][self::$LCSEC],
|
1453 |
-
$input[self::$LCparams][self::$TZID] ),
|
1454 |
-
7 );
|
1455 |
-
unset( $input[self::$LCvalue][self::$UNPARSEDTEXT] );
|
1456 |
-
}
|
1457 |
-
} // end elseif( 8 <= strlen( trim((string) $year )))
|
1458 |
-
else {
|
1459 |
-
if( 100 > $year )
|
1460 |
-
$year += 2000;
|
1461 |
-
$input[self::$LCvalue] = [self::$LCYEAR => $year,
|
1462 |
-
self::$LCMONTH => $month,
|
1463 |
-
self::$LCDAY => $day,
|
1464 |
-
self::$LCHOUR => $hour,
|
1465 |
-
self::$LCMIN => $min,
|
1466 |
-
self::$LCSEC => $sec];
|
1467 |
-
if( isset( $tz ))
|
1468 |
-
$input[self::$LCvalue][self::$LCtz] = $tz;
|
1469 |
-
if(( isset( $tz ) && self::isOffset( $tz )) ||
|
1470 |
-
( isset( $input[self::$LCparams][self::$TZID] ) &&
|
1471 |
-
self::isOffset( $input[self::$LCparams][self::$TZID] ))) {
|
1472 |
-
if( ! isset( $tz ) &&
|
1473 |
-
isset( $input[self::$LCparams][self::$TZID] ) &&
|
1474 |
-
self::isOffset( $input[self::$LCparams][self::$TZID] ))
|
1475 |
-
$input[self::$LCvalue][self::$LCtz] = $input[self::$LCparams][self::$TZID];
|
1476 |
-
unset( $input[self::$LCparams][self::$TZID] );
|
1477 |
-
$strdate = self::date2strdate( $input[self::$LCvalue], 7 );
|
1478 |
-
$input[self::$LCvalue] = self::strDate2ArrayDate( $strdate, 7 );
|
1479 |
-
unset( $input[self::$LCvalue][self::$UNPARSEDTEXT] );
|
1480 |
-
}
|
1481 |
-
$input[self::$LCparams] = self::setParams( $params,
|
1482 |
-
self::$DEFAULTVALUEDATETIME );
|
1483 |
-
} // end else
|
1484 |
-
unset( $input[self::$LCparams][self::$VALUE], $input[self::$LCparams][self::$TZID] );
|
1485 |
-
if( ! isset( $input[self::$LCvalue][self::$LCHOUR] ))
|
1486 |
-
$input[self::$LCvalue][self::$LCHOUR] = 0;
|
1487 |
-
if( ! isset( $input[self::$LCvalue][self::$LCMIN] ))
|
1488 |
-
$input[self::$LCvalue][self::$LCMIN] = 0;
|
1489 |
-
if( ! isset( $input[self::$LCvalue][self::$LCSEC] ))
|
1490 |
-
$input[self::$LCvalue][self::$LCSEC] = 0;
|
1491 |
-
$input[self::$LCvalue][self::$LCtz] = self::$Z;
|
1492 |
-
return $input;
|
1493 |
-
}
|
1494 |
-
/**
|
1495 |
-
* Return array (in internal format) for an input date-time/date array (keyed or unkeyed)
|
1496 |
-
*
|
1497 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1498 |
-
* @since 2.22.23 - 2017-02-19
|
1499 |
-
* @param array $datetime
|
1500 |
-
* @param int $parno default null, 3: DATE(Ymd), 6: YmdHis, 7: YmdHis + offset/timezone
|
1501 |
-
* @return array
|
1502 |
-
* @static
|
1503 |
-
*/
|
1504 |
-
public static function chkDateArr( $datetime, $parno=null ) {
|
1505 |
-
static $PLUS4ZERO = '+0000';
|
1506 |
-
static $MINUS4ZERO = '-0000';
|
1507 |
-
static $PLUS6ZERO = '+000000';
|
1508 |
-
static $MINUS6ZERO = '-000000';
|
1509 |
-
$output = [];
|
1510 |
-
if(( is_null( $parno ) || ( 6 <= $parno )) &&
|
1511 |
-
isset( $datetime[3] ) &&
|
1512 |
-
! isset( $datetime[4] )) { // Y-m-d with tz
|
1513 |
-
$temp = $datetime[3];
|
1514 |
-
$datetime[3] = $datetime[4] = $datetime[5] = 0;
|
1515 |
-
$datetime[6] = $temp;
|
1516 |
-
}
|
1517 |
-
foreach( $datetime as $dateKey => $datePart ) {
|
1518 |
-
switch ( $dateKey ) {
|
1519 |
-
case '0':
|
1520 |
-
case self::$LCYEAR :
|
1521 |
-
$output[self::$LCYEAR] = $datePart;
|
1522 |
-
break;
|
1523 |
-
case '1':
|
1524 |
-
case self::$LCMONTH :
|
1525 |
-
$output[self::$LCMONTH] = $datePart;
|
1526 |
-
break;
|
1527 |
-
case '2':
|
1528 |
-
case self::$LCDAY :
|
1529 |
-
$output[self::$LCDAY] = $datePart;
|
1530 |
-
break;
|
1531 |
-
}
|
1532 |
-
if( 3 != $parno ) {
|
1533 |
-
switch ( $dateKey ) {
|
1534 |
-
case '0':
|
1535 |
-
case '1':
|
1536 |
-
case '2':
|
1537 |
-
break;
|
1538 |
-
case '3':
|
1539 |
-
case self::$LCHOUR:
|
1540 |
-
$output[self::$LCHOUR] = $datePart;
|
1541 |
-
break;
|
1542 |
-
case '4':
|
1543 |
-
case self::$LCMIN :
|
1544 |
-
$output[self::$LCMIN] = $datePart;
|
1545 |
-
break;
|
1546 |
-
case '5':
|
1547 |
-
case self::$LCSEC :
|
1548 |
-
$output[self::$LCSEC] = $datePart;
|
1549 |
-
break;
|
1550 |
-
case '6':
|
1551 |
-
case self::$LCtz :
|
1552 |
-
$output[self::$LCtz] = $datePart;
|
1553 |
-
break;
|
1554 |
-
}
|
1555 |
-
}
|
1556 |
-
}
|
1557 |
-
if( 3 != $parno ) {
|
1558 |
-
if( ! isset( $output[self::$LCHOUR] ))
|
1559 |
-
$output[self::$LCHOUR] = 0;
|
1560 |
-
if( ! isset( $output[self::$LCMIN] ))
|
1561 |
-
$output[self::$LCMIN] = 0;
|
1562 |
-
if( ! isset( $output[self::$LCSEC] ))
|
1563 |
-
$output[self::$LCSEC] = 0;
|
1564 |
-
if( isset( $output[self::$LCtz] ) &&
|
1565 |
-
(( $PLUS4ZERO == $output[self::$LCtz] ) ||
|
1566 |
-
( $MINUS4ZERO == $output[self::$LCtz] ) ||
|
1567 |
-
( $PLUS6ZERO == $output[self::$LCtz] ) ||
|
1568 |
-
( $MINUS6ZERO == $output[self::$LCtz] )))
|
1569 |
-
$output[self::$LCtz] = self::$Z;
|
1570 |
-
}
|
1571 |
-
return $output;
|
1572 |
-
}
|
1573 |
-
/**
|
1574 |
-
* Return iCal formatted string for (internal array) date/date-time
|
1575 |
-
*
|
1576 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1577 |
-
* @since 2.22.23 - 2017-02-24
|
1578 |
-
* @param array $datetime
|
1579 |
-
* @param int $parno default 6
|
1580 |
-
* @return string
|
1581 |
-
* @static
|
1582 |
-
*/
|
1583 |
-
public static function date2strdate( $datetime, $parno=null ) {
|
1584 |
-
static $SECONDS = ' seconds';
|
1585 |
-
static $YMDYHIS = 'Ymd\THis';
|
1586 |
-
if( ! isset( $datetime[self::$LCYEAR] ) &&
|
1587 |
-
! isset( $datetime[self::$LCMONTH] ) &&
|
1588 |
-
! isset( $datetime[self::$LCDAY] ) &&
|
1589 |
-
! isset( $datetime[self::$LCHOUR] ) &&
|
1590 |
-
! isset( $datetime[self::$LCMIN] ) &&
|
1591 |
-
! isset( $datetime[self::$LCSEC] ))
|
1592 |
-
return null;
|
1593 |
-
if( is_null( $parno ))
|
1594 |
-
$parno = 6;
|
1595 |
-
$output = null;
|
1596 |
-
foreach( $datetime as $dkey => & $dvalue ) {
|
1597 |
-
if( self::$LCtz != $dkey )
|
1598 |
-
$dvalue = (int) $dvalue;
|
1599 |
-
}
|
1600 |
-
$output = sprintf( self::$YMD, $datetime[self::$LCYEAR],
|
1601 |
-
$datetime[self::$LCMONTH],
|
1602 |
-
$datetime[self::$LCDAY] );
|
1603 |
-
if( 3 == $parno )
|
1604 |
-
return $output;
|
1605 |
-
if( ! isset( $datetime[self::$LCHOUR] ))
|
1606 |
-
$datetime[self::$LCHOUR] = 0;
|
1607 |
-
if( ! isset( $datetime[self::$LCMIN] ))
|
1608 |
-
$datetime[self::$LCMIN] = 0;
|
1609 |
-
if( ! isset( $datetime[self::$LCSEC] ))
|
1610 |
-
$datetime[self::$LCSEC] = 0;
|
1611 |
-
$output .= self::$T . sprintf( self::$HIS, $datetime[self::$LCHOUR],
|
1612 |
-
$datetime[self::$LCMIN],
|
1613 |
-
$datetime[self::$LCSEC] );
|
1614 |
-
if( isset( $datetime[self::$LCtz] )) {
|
1615 |
-
$datetime[self::$LCtz] = trim( $datetime[self::$LCtz] );
|
1616 |
-
if( ! empty( $datetime[self::$LCtz] )) {
|
1617 |
-
if( self::$Z == $datetime[self::$LCtz] )
|
1618 |
-
$parno = 7;
|
1619 |
-
elseif( self::isOffset( $datetime[self::$LCtz] )) {
|
1620 |
-
$parno = 7;
|
1621 |
-
$offset = self::tz2offset( $datetime[self::$LCtz] );
|
1622 |
-
try {
|
1623 |
-
$timezone = new \DateTimeZone( self::$UTC );
|
1624 |
-
$d = new \DateTime( $output, $timezone );
|
1625 |
-
if( 0 != $offset ) // adjust för offset
|
1626 |
-
$d->modify( $offset . $SECONDS );
|
1627 |
-
$output = $d->format( $YMDYHIS );
|
1628 |
-
}
|
1629 |
-
catch( \Exception $e ) {
|
1630 |
-
$output = date( $YMDYHIS, mktime( $datetime[self::$LCHOUR],
|
1631 |
-
$datetime[self::$LCMIN],
|
1632 |
-
( $datetime[self::$LCSEC] - $offset ),
|
1633 |
-
$datetime[self::$LCMONTH],
|
1634 |
-
$datetime[self::$LCDAY],
|
1635 |
-
$datetime[self::$LCYEAR] ));
|
1636 |
-
}
|
1637 |
-
}
|
1638 |
-
if( 7 == $parno )
|
1639 |
-
$output .= self::$Z;
|
1640 |
-
} // end if( ! empty( $datetime[self::$LCtz] ))
|
1641 |
-
}
|
1642 |
-
return $output;
|
1643 |
-
}
|
1644 |
-
/**
|
1645 |
-
* Return array (in internal format) for a (array) duration
|
1646 |
-
*
|
1647 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1648 |
-
* @since 2.19.4 - 2014-03-14
|
1649 |
-
* @param array $duration
|
1650 |
-
* @return array
|
1651 |
-
* @static
|
1652 |
-
*/
|
1653 |
-
public static function duration2arr( $duration ) {
|
1654 |
-
$seconds = 0;
|
1655 |
-
foreach( $duration as $durKey => $durValue ) {
|
1656 |
-
if( empty( $durValue )) continue;
|
1657 |
-
switch ( $durKey ) {
|
1658 |
-
case '0': case self::$LCWEEK:
|
1659 |
-
$seconds += (((int) $durValue ) * 60 * 60 * 24 * 7 );
|
1660 |
-
break;
|
1661 |
-
case '1': case self::$LCDAY:
|
1662 |
-
$seconds += (((int) $durValue ) * 60 * 60 * 24 );
|
1663 |
-
break;
|
1664 |
-
case '2': case self::$LCHOUR:
|
1665 |
-
$seconds += (((int) $durValue ) * 60 * 60 );
|
1666 |
-
break;
|
1667 |
-
case '3': case self::$LCMIN:
|
1668 |
-
$seconds += (((int) $durValue ) * 60 );
|
1669 |
-
break;
|
1670 |
-
case '4': case self::$LCSEC:
|
1671 |
-
$seconds += (int) $durValue;
|
1672 |
-
break;
|
1673 |
-
}
|
1674 |
-
}
|
1675 |
-
$output = [];
|
1676 |
-
$output[self::$LCWEEK] = (int) floor( $seconds / ( 60 * 60 * 24 * 7 ));
|
1677 |
-
if(( 0 < $output[self::$LCWEEK] ) &&
|
1678 |
-
( 0 == ( $seconds % ( 60 * 60 * 24 * 7 ))))
|
1679 |
-
return $output;
|
1680 |
-
unset( $output[self::$LCWEEK] );
|
1681 |
-
$output[self::$LCDAY] = (int) floor( $seconds / ( 60 * 60 * 24 ));
|
1682 |
-
$seconds = ( $seconds % ( 60 * 60 * 24 ));
|
1683 |
-
$output[self::$LCHOUR] = (int) floor( $seconds / ( 60 * 60 ));
|
1684 |
-
$seconds = ( $seconds % ( 60 * 60 ));
|
1685 |
-
$output[self::$LCMIN] = (int) floor( $seconds / 60 );
|
1686 |
-
$output[self::$LCSEC] = ( $seconds % 60 );
|
1687 |
-
if( empty( $output[self::$LCDAY] ))
|
1688 |
-
unset( $output[self::$LCDAY] );
|
1689 |
-
if(( 0 == $output[self::$LCHOUR] ) &&
|
1690 |
-
( 0 == $output[self::$LCMIN] ) &&
|
1691 |
-
( 0 == $output[self::$LCSEC] ))
|
1692 |
-
unset( $output[self::$LCHOUR],
|
1693 |
-
$output[self::$LCMIN],
|
1694 |
-
$output[self::$LCSEC] );
|
1695 |
-
return $output;
|
1696 |
-
}
|
1697 |
-
/**
|
1698 |
-
* Return datetime array (in internal format) for startdate + duration
|
1699 |
-
*
|
1700 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1701 |
-
* @since 2.21.11 - 2015-03-21
|
1702 |
-
* @param array $startdate
|
1703 |
-
* @param array $duration
|
1704 |
-
* @return array, date format
|
1705 |
-
* @static
|
1706 |
-
*/
|
1707 |
-
public static function duration2date( $startdate, $duration ) {
|
1708 |
-
$dateOnly = ( isset( $startdate[self::$LCHOUR] ) ||
|
1709 |
-
isset( $startdate[self::$LCMIN] ) ||
|
1710 |
-
isset( $startdate[self::$LCSEC] )) ? false : true;
|
1711 |
-
$startdate[self::$LCHOUR] = ( isset( $startdate[self::$LCHOUR] ))
|
1712 |
-
? $startdate[self::$LCHOUR] : 0;
|
1713 |
-
$startdate[self::$LCMIN] = ( isset( $startdate[self::$LCMIN] ))
|
1714 |
-
? $startdate[self::$LCMIN] : 0;
|
1715 |
-
$startdate[self::$LCSEC] = ( isset( $startdate[self::$LCSEC] ))
|
1716 |
-
? $startdate[self::$LCSEC] : 0;
|
1717 |
-
$dtend = 0;
|
1718 |
-
if( isset( $duration[self::$LCWEEK] ))
|
1719 |
-
$dtend += ( $duration[self::$LCWEEK] * 7 * 24 * 60 * 60 );
|
1720 |
-
if( isset( $duration[self::$LCDAY] ))
|
1721 |
-
$dtend += ( $duration[self::$LCDAY] * 24 * 60 * 60 );
|
1722 |
-
if( isset( $duration[self::$LCHOUR] ))
|
1723 |
-
$dtend += ( $duration[self::$LCHOUR] * 60 *60 );
|
1724 |
-
if( isset( $duration[self::$LCMIN] ))
|
1725 |
-
$dtend += ( $duration[self::$LCMIN] * 60 );
|
1726 |
-
if( isset( $duration[self::$LCSEC] ))
|
1727 |
-
$dtend += $duration[self::$LCSEC];
|
1728 |
-
$date = date( self::$YMDHIS3,
|
1729 |
-
mktime((int) $startdate[self::$LCHOUR],
|
1730 |
-
(int) $startdate[self::$LCMIN],
|
1731 |
-
(int) ( $startdate[self::$LCSEC] + $dtend ),
|
1732 |
-
(int) $startdate[self::$LCMONTH],
|
1733 |
-
(int) $startdate[self::$LCDAY],
|
1734 |
-
(int) $startdate[self::$LCYEAR] ));
|
1735 |
-
$d = explode( self::$MINUS, $date );
|
1736 |
-
$dtend2 = [self::$LCYEAR => $d[0],
|
1737 |
-
self::$LCMONTH => $d[1],
|
1738 |
-
self::$LCDAY => $d[2],
|
1739 |
-
self::$LCHOUR => $d[3],
|
1740 |
-
self::$LCMIN => $d[4],
|
1741 |
-
self::$LCSEC => $d[5]];
|
1742 |
-
if( isset( $startdate[self::$LCtz] ))
|
1743 |
-
$dtend2[self::$LCtz] = $startdate[self::$LCtz];
|
1744 |
-
if( $dateOnly &&
|
1745 |
-
(( 0 == $dtend2[self::$LCHOUR] ) &&
|
1746 |
-
( 0 == $dtend2[self::$LCMIN] ) &&
|
1747 |
-
( 0 == $dtend2[self::$LCSEC] )))
|
1748 |
-
unset( $dtend2[self::$LCHOUR],
|
1749 |
-
$dtend2[self::$LCMIN],
|
1750 |
-
$dtend2[self::$LCSEC] );
|
1751 |
-
return $dtend2;
|
1752 |
-
}
|
1753 |
-
/**
|
1754 |
-
* Return an iCal formatted string from (internal array) duration
|
1755 |
-
*
|
1756 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1757 |
-
* @since 2.15.8 - 2012-10-30
|
1758 |
-
* @param array $duration, array( week, day, hour, min, sec )
|
1759 |
-
* @return string
|
1760 |
-
* @static
|
1761 |
-
*/
|
1762 |
-
public static function duration2str( array $duration ) {
|
1763 |
-
static $P = 'P';
|
1764 |
-
static $W = 'W';
|
1765 |
-
static $D = 'D';
|
1766 |
-
static $H = 'H';
|
1767 |
-
static $OH = '0H';
|
1768 |
-
static $M = 'M';
|
1769 |
-
static $OM = '0M';
|
1770 |
-
static $S = 'S';
|
1771 |
-
static $OS = '0S';
|
1772 |
-
static $PT0H0M0S = 'PT0H0M0S';
|
1773 |
-
if( isset( $duration[self::$LCWEEK] ) ||
|
1774 |
-
isset( $duration[self::$LCDAY] ) ||
|
1775 |
-
isset( $duration[self::$LCHOUR] ) ||
|
1776 |
-
isset( $duration[self::$LCMIN] ) ||
|
1777 |
-
isset( $duration[self::$LCSEC] ))
|
1778 |
-
$ok = true;
|
1779 |
-
else
|
1780 |
-
return null;
|
1781 |
-
if( isset( $duration[self::$LCWEEK] ) &&
|
1782 |
-
( 0 < $duration[self::$LCWEEK] ))
|
1783 |
-
return $P . $duration[self::$LCWEEK] . $W;
|
1784 |
-
$output = $P;
|
1785 |
-
if( isset($duration[self::$LCDAY] ) &&
|
1786 |
-
( 0 < $duration[self::$LCDAY] ))
|
1787 |
-
$output .= $duration[self::$LCDAY] . $D;
|
1788 |
-
if(( isset( $duration[self::$LCHOUR]) &&
|
1789 |
-
( 0 < $duration[self::$LCHOUR] )) ||
|
1790 |
-
( isset( $duration[self::$LCMIN]) &&
|
1791 |
-
( 0 < $duration[self::$LCMIN] )) ||
|
1792 |
-
( isset( $duration[self::$LCSEC]) &&
|
1793 |
-
( 0 < $duration[self::$LCSEC] ))) {
|
1794 |
-
$output .= self::$T;
|
1795 |
-
$output .= ( isset( $duration[self::$LCHOUR]) &&
|
1796 |
-
( 0 < $duration[self::$LCHOUR] ))
|
1797 |
-
? $duration[self::$LCHOUR] . $H : $OH;
|
1798 |
-
$output .= ( isset( $duration[self::$LCMIN]) &&
|
1799 |
-
( 0 < $duration[self::$LCMIN] ))
|
1800 |
-
? $duration[self::$LCMIN] . $M : $OM;
|
1801 |
-
$output .= ( isset( $duration[self::$LCSEC]) &&
|
1802 |
-
( 0 < $duration[self::$LCSEC] ))
|
1803 |
-
? $duration[self::$LCSEC] . $S : $OS;
|
1804 |
-
}
|
1805 |
-
if( $P == $output )
|
1806 |
-
$output = $PT0H0M0S;
|
1807 |
-
return $output;
|
1808 |
-
}
|
1809 |
-
/**
|
1810 |
-
* Return array (in internal format) from string duration
|
1811 |
-
*
|
1812 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1813 |
-
* @since 2.23.8 - 2017-04-17
|
1814 |
-
* @param array $duration
|
1815 |
-
* @return array|bool false on error
|
1816 |
-
* @static
|
1817 |
-
*/
|
1818 |
-
public static function durationStr2arr( $duration ) {
|
1819 |
-
static $P = 'P';
|
1820 |
-
static $Tt = ['t', 'T'];
|
1821 |
-
static $W = 'W';
|
1822 |
-
static $D = 'D';
|
1823 |
-
static $H = 'H';
|
1824 |
-
static $M = 'M';
|
1825 |
-
static $S = 'S';
|
1826 |
-
$duration = (string) trim( $duration );
|
1827 |
-
while( 0 != strcasecmp( $P, $duration[0] )) {
|
1828 |
-
if( 0 < strlen( $duration ))
|
1829 |
-
$duration = substr( $duration, 1 );
|
1830 |
-
else
|
1831 |
-
return false; // no leading P !?!?
|
1832 |
-
}
|
1833 |
-
$duration = substr( $duration, 1 ); // skip P
|
1834 |
-
$duration = str_replace( $Tt, null, $duration );
|
1835 |
-
$output = [];
|
1836 |
-
$val = null;
|
1837 |
-
$durLen = strlen( $duration );
|
1838 |
-
for( $ix=0; $ix < $durLen; $ix++ ) {
|
1839 |
-
switch( strtoupper( $duration[$ix] )) {
|
1840 |
-
case $W :
|
1841 |
-
$output[self::$LCWEEK] = $val;
|
1842 |
-
$val = null;
|
1843 |
-
break;
|
1844 |
-
case $D :
|
1845 |
-
$output[self::$LCDAY] = $val;
|
1846 |
-
$val = null;
|
1847 |
-
break;
|
1848 |
-
case $H :
|
1849 |
-
$output[self::$LCHOUR] = $val;
|
1850 |
-
$val = null;
|
1851 |
-
break;
|
1852 |
-
case $M :
|
1853 |
-
$output[self::$LCMIN] = $val;
|
1854 |
-
$val = null;
|
1855 |
-
break;
|
1856 |
-
case $S :
|
1857 |
-
$output[self::$LCSEC] = $val;
|
1858 |
-
$val = null;
|
1859 |
-
break;
|
1860 |
-
default:
|
1861 |
-
if( ! ctype_digit( $duration[$ix] ))
|
1862 |
-
return false; // unknown duration control character !?!?
|
1863 |
-
else
|
1864 |
-
$val .= $duration[$ix];
|
1865 |
-
}
|
1866 |
-
}
|
1867 |
-
return self::duration2arr( $output );
|
1868 |
-
}
|
1869 |
-
/**
|
1870 |
-
* Return bool true if input contains a date/time (in array format)
|
1871 |
-
*
|
1872 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1873 |
-
* @since 2.16.24 - 2013-07-02
|
1874 |
-
* @param array $input
|
1875 |
-
* @return bool
|
1876 |
-
* @static
|
1877 |
-
*/
|
1878 |
-
public static function isArrayDate( $input ) {
|
1879 |
-
if( ! is_array( $input ) ||
|
1880 |
-
isset( $input[self::$LCWEEK] ) ||
|
1881 |
-
isset( $input[self::$LCTIMESTAMP] ) ||
|
1882 |
-
( 3 > count( $input )))
|
1883 |
-
return false;
|
1884 |
-
if( 7 == count( $input ))
|
1885 |
-
return true;
|
1886 |
-
if( isset( $input[self::$LCYEAR] ) &&
|
1887 |
-
isset( $input[self::$LCMONTH] ) &&
|
1888 |
-
isset( $input[self::$LCDAY] ))
|
1889 |
-
return checkdate( (int) $input[self::$LCMONTH],
|
1890 |
-
(int) $input[self::$LCDAY],
|
1891 |
-
(int) $input[self::$LCYEAR] );
|
1892 |
-
if( isset( $input[self::$LCDAY] ) ||
|
1893 |
-
isset( $input[self::$LCHOUR] ) ||
|
1894 |
-
isset( $input[self::$LCMIN] ) ||
|
1895 |
-
isset( $input[self::$LCSEC] ))
|
1896 |
-
return false;
|
1897 |
-
if(( 0 == $input[0] ) ||
|
1898 |
-
( 0 == $input[1] ) ||
|
1899 |
-
( 0 == $input[2] ))
|
1900 |
-
return false;
|
1901 |
-
if(( 1970 > $input[0] ) ||
|
1902 |
-
( 12 < $input[1] ) ||
|
1903 |
-
( 31 < $input[2] ))
|
1904 |
-
return false;
|
1905 |
-
if(( isset( $input[0] ) &&
|
1906 |
-
isset( $input[1] ) &&
|
1907 |
-
isset( $input[2] )) &&
|
1908 |
-
checkdate((int) $input[1],
|
1909 |
-
(int) $input[2],
|
1910 |
-
(int) $input[0] ))
|
1911 |
-
return true;
|
1912 |
-
$input = self::strDate2ArrayDate( $input[1] .
|
1913 |
-
self::$L .
|
1914 |
-
$input[2] .
|
1915 |
-
self::$L .
|
1916 |
-
$input[0], 3 ); // m - d - Y
|
1917 |
-
if( isset( $input[self::$LCYEAR] ) &&
|
1918 |
-
isset( $input[self::$LCMONTH] ) &&
|
1919 |
-
isset( $input[self::$LCDAY] ))
|
1920 |
-
return checkdate( (int) $input[self::$LCMONTH],
|
1921 |
-
(int) $input[self::$LCDAY],
|
1922 |
-
(int) $input[self::$LCYEAR] );
|
1923 |
-
return false;
|
1924 |
-
}
|
1925 |
-
/**
|
1926 |
-
* Return bool true if input array contains a (keyed) timestamp date
|
1927 |
-
*
|
1928 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1929 |
-
* @since 2.4.16 - 2008-10-18
|
1930 |
-
* @param array $input
|
1931 |
-
* @return bool
|
1932 |
-
* @static
|
1933 |
-
*/
|
1934 |
-
public static function isArrayTimestampDate( $input ) {
|
1935 |
-
return ( is_array( $input ) && isset( $input[self::$LCTIMESTAMP] ));
|
1936 |
-
}
|
1937 |
-
/**
|
1938 |
-
* Return bool true if input string contains (trailing) UTC/iCal offset
|
1939 |
-
*
|
1940 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1941 |
-
* @since 2.14.1 - 2012-09-21
|
1942 |
-
* @param string $input
|
1943 |
-
* @return bool
|
1944 |
-
* @static
|
1945 |
-
*/
|
1946 |
-
public static function isOffset( $input ) {
|
1947 |
-
static $PLUSMINUSARR = ['+', '-'];
|
1948 |
-
static $ZERO4 = '0000';
|
1949 |
-
static $NINE4 = '9999';
|
1950 |
-
static $ZERO6 = '000000';
|
1951 |
-
static $NINE6 = '999999';
|
1952 |
-
$input = trim( (string) $input );
|
1953 |
-
if( self::$Z == substr( $input, -1 ))
|
1954 |
-
return true;
|
1955 |
-
elseif(( 5 <= strlen( $input )) &&
|
1956 |
-
( in_array( substr( $input, -5, 1 ), $PLUSMINUSARR )) &&
|
1957 |
-
( $ZERO4 <= substr( $input, -4 )) && ( $NINE4 >= substr( $input, -4 )))
|
1958 |
-
return true;
|
1959 |
-
elseif(( 7 <= strlen( $input )) &&
|
1960 |
-
( in_array( substr( $input, -7, 1 ), $PLUSMINUSARR )) &&
|
1961 |
-
( $ZERO6 <= substr( $input, -6 )) && ( $NINE6 >= substr( $input, -6 )))
|
1962 |
-
return true;
|
1963 |
-
return false;
|
1964 |
-
}
|
1965 |
-
/**
|
1966 |
-
* Convert a date from string to (internal, keyed) array format, return true on success
|
1967 |
-
*
|
1968 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1969 |
-
* @since 2.11.8 - 2012-01-27
|
1970 |
-
* @param mixed $date
|
1971 |
-
* @return bool, true on success
|
1972 |
-
* @static
|
1973 |
-
*/
|
1974 |
-
public static function strDate2arr( & $date ) {
|
1975 |
-
static $ET = [' ', 't', 'T'];
|
1976 |
-
if( is_array( $date ))
|
1977 |
-
return false;
|
1978 |
-
if( 5 > strlen( (string) $date ))
|
1979 |
-
return false;
|
1980 |
-
$work = $date;
|
1981 |
-
if( 2 == substr_count( $work, self::$MINUS ))
|
1982 |
-
$work = str_replace( self::$MINUS, null, $work );
|
1983 |
-
if( 2 == substr_count( $work, self::$L ))
|
1984 |
-
$work = str_replace( self::$L, null, $work );
|
1985 |
-
if( ! ctype_digit( substr( $work, 0, 8 )))
|
1986 |
-
return false;
|
1987 |
-
$temp = [self::$LCYEAR => (int) substr( $work, 0, 4 ),
|
1988 |
-
self::$LCMONTH => (int) substr( $work, 4, 2 ),
|
1989 |
-
self::$LCDAY => (int) substr( $work, 6, 2 )];
|
1990 |
-
if( ! checkdate( $temp[self::$LCMONTH],
|
1991 |
-
$temp[self::$LCDAY],
|
1992 |
-
$temp[self::$LCYEAR] ))
|
1993 |
-
return false;
|
1994 |
-
if( 8 == strlen( $work )) {
|
1995 |
-
$date = $temp;
|
1996 |
-
return true;
|
1997 |
-
}
|
1998 |
-
if( in_array( $work[8], $ET ))
|
1999 |
-
$work = substr( $work, 9 );
|
2000 |
-
elseif( ctype_digit( $work[8] ))
|
2001 |
-
$work = substr( $work, 8 );
|
2002 |
-
else
|
2003 |
-
return false;
|
2004 |
-
if( 2 == substr_count( $work, self::$COLON ))
|
2005 |
-
$work = str_replace( self::$COLON, null, $work );
|
2006 |
-
if( ! ctype_digit( substr( $work, 0, 4 )))
|
2007 |
-
return false;
|
2008 |
-
$temp[self::$LCHOUR] = substr( $work, 0, 2 );
|
2009 |
-
$temp[self::$LCMIN] = substr( $work, 2, 2 );
|
2010 |
-
if((( 0 > $temp[self::$LCHOUR] ) || ( $temp[self::$LCHOUR] > 23 )) ||
|
2011 |
-
(( 0 > $temp[self::$LCMIN] ) || ( $temp[self::$LCMIN] > 59 )))
|
2012 |
-
return false;
|
2013 |
-
if( ctype_digit( substr( $work, 4, 2 ))) {
|
2014 |
-
$temp[self::$LCSEC] = substr( $work, 4, 2 );
|
2015 |
-
if(( 0 > $temp[self::$LCSEC] ) || ( $temp[self::$LCSEC] > 59 ))
|
2016 |
-
return false;
|
2017 |
-
$len = 6;
|
2018 |
-
}
|
2019 |
-
else {
|
2020 |
-
$temp[self::$LCSEC] = 0;
|
2021 |
-
$len = 4;
|
2022 |
-
}
|
2023 |
-
if( $len < strlen( $work))
|
2024 |
-
$temp[self::$LCtz] = trim( substr( $work, 6 ));
|
2025 |
-
$date = $temp;
|
2026 |
-
return true;
|
2027 |
-
}
|
2028 |
-
/**
|
2029 |
-
* Return string date-time/date as array (in internal format, keyed)
|
2030 |
-
*
|
2031 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
2032 |
-
* @since 2.22.23 - 2017-02-19
|
2033 |
-
* Modified to also return original string value by Yitzchok Lavi <icalcreator@onebigsystem.com>
|
2034 |
-
* @param string $datetime
|
2035 |
-
* @param int $parno default false
|
2036 |
-
* @param mixed $wtz default null
|
2037 |
-
* @return array
|
2038 |
-
* @static
|
2039 |
-
*/
|
2040 |
-
public static function strDate2ArrayDate( $datetime,
|
2041 |
-
$parno=null,
|
2042 |
-
$wtz=null ) {
|
2043 |
-
static $SECONDS = ' seconds';
|
2044 |
-
$unparseddatetime = $datetime;
|
2045 |
-
$datetime = (string) trim( $datetime );
|
2046 |
-
$tz = null;
|
2047 |
-
$offset = 0;
|
2048 |
-
$tzSts = false;
|
2049 |
-
$len = strlen( $datetime );
|
2050 |
-
if( self::$Z == substr( $datetime, -1 )) {
|
2051 |
-
$tz = self::$Z;
|
2052 |
-
$datetime = trim( substr( $datetime, 0, ( $len - 1 )));
|
2053 |
-
$tzSts = true;
|
2054 |
-
}
|
2055 |
-
if( self::isOffset( substr( $datetime, -5, 5 ))) { // [+/-]NNNN offset
|
2056 |
-
$tz = substr( $datetime, -5, 5 );
|
2057 |
-
$datetime = trim( substr( $datetime, 0, ($len - 5)));
|
2058 |
-
}
|
2059 |
-
elseif( self::isOffset( substr( $datetime, -7, 7 ))) { // [+/-]NNNNNN offset
|
2060 |
-
$tz = substr( $datetime, -7, 7 );
|
2061 |
-
$datetime = trim( substr( $datetime, 0, ($len - 7)));
|
2062 |
-
}
|
2063 |
-
elseif( empty( $wtz ) &&
|
2064 |
-
ctype_digit( substr( $datetime, 0, 4 )) &&
|
2065 |
-
ctype_digit( substr( $datetime, -2, 2 )) &&
|
2066 |
-
self::strDate2arr( $datetime )) {
|
2067 |
-
$output = $datetime;
|
2068 |
-
if( ! empty( $tz ))
|
2069 |
-
$output[self::$LCtz] = self::$Z;
|
2070 |
-
$output[self::$UNPARSEDTEXT] = $unparseddatetime;
|
2071 |
-
return $output;
|
2072 |
-
}
|
2073 |
-
else {
|
2074 |
-
$tx = 0; // find any TRAILING timezone or offset
|
2075 |
-
$len = strlen( $datetime );
|
2076 |
-
for( $cx = -1; $cx > ( 9 - $len ); $cx-- ) {
|
2077 |
-
$char = substr( $datetime, $cx, 1 );
|
2078 |
-
if(( self::$SP1 == $char ) || ctype_digit( $char ))
|
2079 |
-
break; // if exists, tz ends here.. . ?
|
2080 |
-
else
|
2081 |
-
$tx--; // tz length counter
|
2082 |
-
}
|
2083 |
-
if( 0 > $tx ) { // if any timezone or offset found
|
2084 |
-
$tz = substr( $datetime, $tx );
|
2085 |
-
$datetime = trim( substr( $datetime, 0, $len + $tx ));
|
2086 |
-
}
|
2087 |
-
if(( ctype_digit( substr( $datetime, 0, 8 )) &&
|
2088 |
-
( self::$T == $datetime[8] ) &&
|
2089 |
-
ctype_digit( substr( $datetime, -6, 6 ))) ||
|
2090 |
-
( ctype_digit( substr( $datetime, 0, 14 ))))
|
2091 |
-
$tzSts = true;
|
2092 |
-
}
|
2093 |
-
if( empty( $tz ) && ! empty( $wtz ))
|
2094 |
-
$tz = $wtz;
|
2095 |
-
if( 3 == $parno )
|
2096 |
-
$tz = null;
|
2097 |
-
if( ! empty( $tz )) { // tz set
|
2098 |
-
if(( self::$Z != $tz ) && ( self::isOffset( $tz ))) {
|
2099 |
-
$offset = (string) self::tz2offset( $tz ) * -1;
|
2100 |
-
$tz = self::$UTC;
|
2101 |
-
$tzSts = true;
|
2102 |
-
}
|
2103 |
-
elseif( ! empty( $wtz ))
|
2104 |
-
$tzSts = true;
|
2105 |
-
$tz = trim( $tz );
|
2106 |
-
if(( 0 == strcasecmp( self::$Z, $tz )) ||
|
2107 |
-
( 0 == strcasecmp( self::$GMT, $tz )))
|
2108 |
-
$tz = self::$UTC;
|
2109 |
-
if( 0 < substr_count( $datetime, self::$MINUS ))
|
2110 |
-
$datetime = str_replace( self::$MINUS, self::$L, $datetime );
|
2111 |
-
try {
|
2112 |
-
$timezone = new \DateTimeZone( $tz );
|
2113 |
-
$d = new \DateTime( $datetime, $timezone );
|
2114 |
-
if( 0 != $offset ) // adjust for offset
|
2115 |
-
$d->modify( $offset . $SECONDS );
|
2116 |
-
$datestring = $d->format( self::$YMDHIS3 );
|
2117 |
-
unset( $d );
|
2118 |
-
}
|
2119 |
-
catch( \Exception $e ) {
|
2120 |
-
$datestring = date( self::$YMDHIS3, strtotime( $datetime ));
|
2121 |
-
}
|
2122 |
-
} // end if( ! empty( $tz ))
|
2123 |
-
else
|
2124 |
-
$datestring = date( self::$YMDHIS3, strtotime( $datetime ));
|
2125 |
-
if( self::$UTC == $tz )
|
2126 |
-
$tz = self::$Z;
|
2127 |
-
$d = explode( self::$MINUS, $datestring );
|
2128 |
-
$output = [self::$LCYEAR => $d[0],
|
2129 |
-
self::$LCMONTH => $d[1],
|
2130 |
-
self::$LCDAY => $d[2]];
|
2131 |
-
if( ! empty( $parno ) || ( 3 != $parno )) { // parno is set to 6 or 7
|
2132 |
-
$output[self::$LCHOUR] = $d[3];
|
2133 |
-
$output[self::$LCMIN] = $d[4];
|
2134 |
-
$output[self::$LCSEC] = $d[5];
|
2135 |
-
if(( $tzSts || ( 7 == $parno )) && ! empty( $tz ))
|
2136 |
-
$output[self::$LCtz] = $tz;
|
2137 |
-
}
|
2138 |
-
// return original string in the array in case strtotime failed to make sense of it
|
2139 |
-
$output[self::$UNPARSEDTEXT] = $unparseddatetime;
|
2140 |
-
return $output;
|
2141 |
-
}
|
2142 |
-
/**
|
2143 |
-
* Return string/array timestamp(+ offset/timezone (default UTC)) as array (in internal format, keyed).
|
2144 |
-
*
|
2145 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
2146 |
-
* @since 2.21.11 - 2015-03-07
|
2147 |
-
* @param mixed $timestamp
|
2148 |
-
* @param int $parno
|
2149 |
-
* @param string $wtz
|
2150 |
-
* @return array
|
2151 |
-
* @static
|
2152 |
-
*/
|
2153 |
-
public static function timestamp2date( $timestamp, $parno=6, $wtz=null ) {
|
2154 |
-
static $FMTTIMESTAMP = '@%s';
|
2155 |
-
static $SPSEC = ' seconds';
|
2156 |
-
if( is_array( $timestamp )) {
|
2157 |
-
$tz = ( isset( $timestamp[self::$LCtz] ))
|
2158 |
-
? $timestamp[self::$LCtz] : $wtz;
|
2159 |
-
$timestamp = $timestamp[self::$LCTIMESTAMP];
|
2160 |
-
}
|
2161 |
-
$tz = ( isset( $tz )) ? $tz : $wtz;
|
2162 |
-
$offset = 0;
|
2163 |
-
if( empty( $tz ) ||
|
2164 |
-
( self::$Z == $tz ) ||
|
2165 |
-
( 0 == strcasecmp( self::$GMT, $tz )))
|
2166 |
-
$tz = self::$UTC;
|
2167 |
-
elseif( self::isOffset( $tz )) {
|
2168 |
-
$offset = self::tz2offset( $tz );
|
2169 |
-
}
|
2170 |
-
try {
|
2171 |
-
$timestamp = sprintf( $FMTTIMESTAMP, $timestamp );
|
2172 |
-
$d = new \DateTime( $timestamp ); // set UTC date
|
2173 |
-
if( 0 != $offset ) // adjust for offset
|
2174 |
-
$d->modify( $offset . $SPSEC );
|
2175 |
-
elseif( self::$UTC != $tz )
|
2176 |
-
$d->setTimezone( new \DateTimeZone( $tz )); // convert to local date
|
2177 |
-
$date = $d->format( self::$YMDHIS3 );
|
2178 |
-
}
|
2179 |
-
catch( \Exception $e ) {
|
2180 |
-
$date = date( self::$YMDHIS3, $timestamp );
|
2181 |
-
}
|
2182 |
-
$date = explode( self::$MINUS, $date );
|
2183 |
-
$output = [self::$LCYEAR => $date[0],
|
2184 |
-
self::$LCMONTH => $date[1],
|
2185 |
-
self::$LCDAY => $date[2]];
|
2186 |
-
if( 3 != $parno ) {
|
2187 |
-
$output[self::$LCHOUR] = $date[3];
|
2188 |
-
$output[self::$LCMIN] = $date[4];
|
2189 |
-
$output[self::$LCSEC] = $date[5];
|
2190 |
-
if(( self::$UTC == $tz ) || ( 0 == $offset ))
|
2191 |
-
$output[self::$LCtz] = self::$Z;
|
2192 |
-
}
|
2193 |
-
return $output;
|
2194 |
-
}
|
2195 |
-
/**
|
2196 |
-
* Return seconds based on an offset, [+/-]HHmm[ss], used when correcting UTC to localtime or v.v.
|
2197 |
-
*
|
2198 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
2199 |
-
* @since 2.23.8 - 2017-04-17
|
2200 |
-
* @param string $tz
|
2201 |
-
* @return integer
|
2202 |
-
* @static
|
2203 |
-
*/
|
2204 |
-
public static function tz2offset( $tz ) {
|
2205 |
-
static $ZERO4 = '0000';
|
2206 |
-
static $NINE4 = '9999';
|
2207 |
-
static $ZERO2 = '00';
|
2208 |
-
static $NINE2 = '99';
|
2209 |
-
$tz = trim( (string) $tz );
|
2210 |
-
$offset = 0;
|
2211 |
-
if((( 5 != strlen( $tz )) &&
|
2212 |
-
( 7 != strlen( $tz ))) ||
|
2213 |
-
(( self::$PLUS != $tz[0] &&
|
2214 |
-
( self::$MINUS != $tz[0] ))) ||
|
2215 |
-
(( $ZERO4 >= substr( $tz, 1, 4 )) &&
|
2216 |
-
( $NINE4 < substr( $tz, 1, 4 ))) ||
|
2217 |
-
(( 7 == strlen( $tz )) &&
|
2218 |
-
( $ZERO2 > substr( $tz, 5, 2 )) &&
|
2219 |
-
( $NINE2 < substr( $tz, 5, 2 ))))
|
2220 |
-
return $offset;
|
2221 |
-
$hours2sec = (int) substr( $tz, 1, 2 ) * 3600;
|
2222 |
-
$min2sec = (int) substr( $tz, 3, 2 ) * 60;
|
2223 |
-
$sec = ( 7 == strlen( $tz ))
|
2224 |
-
? (int) substr( $tz, -2 ) : $ZERO2;
|
2225 |
-
$offset = $hours2sec + $min2sec + $sec;
|
2226 |
-
$offset = ( self::$MINUS == $tz[0] )
|
2227 |
-
? $offset * -1 : $offset;
|
2228 |
-
return $offset;
|
2229 |
-
}
|
2230 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/util/utilAttendee.php
DELETED
@@ -1,254 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\util;
|
32 |
-
/**
|
33 |
-
* iCalcreator attendee support class
|
34 |
-
*
|
35 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
36 |
-
* @since 2.22.23 - 2017-02-02
|
37 |
-
*/
|
38 |
-
class utilAttendee {
|
39 |
-
/**
|
40 |
-
* Return string after a cal-address check, prefix mail address with MAILTO
|
41 |
-
*
|
42 |
-
* Acceps other prefix ftp://, http://, file://, gopher://, news:, nntp://, telnet://, wais://, prospero:// etc
|
43 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
44 |
-
* @since 2.22.23 - 2017-03-06
|
45 |
-
* @param string $value
|
46 |
-
* @param bool $trimQuotes
|
47 |
-
* @return string
|
48 |
-
* @static
|
49 |
-
* @TODO fix in util::splitContent() ??
|
50 |
-
*/
|
51 |
-
public static function calAddressCheck( $value, $trimQuotes=true ) {
|
52 |
-
static $MAILTOCOLON = 'MAILTO:';
|
53 |
-
$value = trim( $value );
|
54 |
-
if( $trimQuotes )
|
55 |
-
$value = trim( $value, util::$QQ );
|
56 |
-
switch( true ) {
|
57 |
-
case( empty( $value )) :
|
58 |
-
break;
|
59 |
-
case( 0 == strcasecmp( $MAILTOCOLON, substr( $value, 0, 7 ))) :
|
60 |
-
$value = $MAILTOCOLON . substr( $value, 7 ); // accept mailto:
|
61 |
-
break;
|
62 |
-
case( false !== ( $pos = strpos( substr( $value, 0, 9 ), util::$COLON ))) :
|
63 |
-
break; // accept (as is) from list above
|
64 |
-
case( filter_var( $value, FILTER_VALIDATE_EMAIL )) :
|
65 |
-
$value = $MAILTOCOLON . $value; // accept mail address
|
66 |
-
break;
|
67 |
-
default : // accept as is...
|
68 |
-
break;
|
69 |
-
}
|
70 |
-
return $value;
|
71 |
-
}
|
72 |
-
/**
|
73 |
-
* Return formatted output for calendar component property attendee
|
74 |
-
*
|
75 |
-
* @param array $attendeeData
|
76 |
-
* @param bool $allowEmpty
|
77 |
-
* @return string
|
78 |
-
* @static
|
79 |
-
*/
|
80 |
-
public static function formatAttendee( array $attendeeData, $allowEmpty ) {
|
81 |
-
static $FMTQVALUE = '"%s"';
|
82 |
-
static $FMTKEYVALUE = ';%s=%s';
|
83 |
-
static $FMTKEYEQ = ';%s=';
|
84 |
-
static $FMTDIREQ = ';%s=%s%s%s';
|
85 |
-
$output = null;
|
86 |
-
foreach( $attendeeData as $ax => $attendeePart ) {
|
87 |
-
if( empty( $attendeePart[util::$LCvalue] )) {
|
88 |
-
if( $allowEmpty )
|
89 |
-
$output .= util::createElement( util::$ATTENDEE );
|
90 |
-
continue;
|
91 |
-
}
|
92 |
-
$attributes = $content = null;
|
93 |
-
foreach( $attendeePart as $pLabel => $pValue ) {
|
94 |
-
if( util::$LCvalue == $pLabel ) {
|
95 |
-
$content .= $pValue;
|
96 |
-
continue;
|
97 |
-
}
|
98 |
-
if(( util::$LCparams != $pLabel ) ||
|
99 |
-
( ! is_array( $pValue )))
|
100 |
-
continue;
|
101 |
-
foreach( $pValue as $pLabel2 => $pValue2 ) { // fix (opt) quotes
|
102 |
-
if( is_array( $pValue2 ) ||
|
103 |
-
in_array( $pLabel2, util::$ATTENDEEPARKEYS ))
|
104 |
-
continue; // DELEGATED-FROM, DELEGATED-TO, MEMBER
|
105 |
-
if(( false !== strpos( $pValue2, util::$COLON )) ||
|
106 |
-
( false !== strpos( $pValue2, util::$SEMIC )) ||
|
107 |
-
( false !== strpos( $pValue2, util::$COMMA )))
|
108 |
-
$pValue[$pLabel2] = sprintf( $FMTQVALUE, $pValue2 );
|
109 |
-
}
|
110 |
-
/* set attenddee parameters in rfc2445 order */
|
111 |
-
if( isset( $pValue[util::$CUTYPE] ))
|
112 |
-
$attributes .= sprintf( $FMTKEYVALUE,
|
113 |
-
util::$CUTYPE,
|
114 |
-
$pValue[util::$CUTYPE] );
|
115 |
-
if( isset( $pValue[util::$MEMBER] ))
|
116 |
-
$attributes .= sprintf( $FMTKEYEQ,
|
117 |
-
util::$MEMBER ) .
|
118 |
-
self::getQuotedListItems( $pValue[util::$MEMBER] );
|
119 |
-
if( isset( $pValue[util::$ROLE] ))
|
120 |
-
$attributes .= sprintf( $FMTKEYVALUE,
|
121 |
-
util::$ROLE,
|
122 |
-
$pValue[util::$ROLE] );
|
123 |
-
if( isset( $pValue[util::$PARTSTAT] ))
|
124 |
-
$attributes .= sprintf( $FMTKEYVALUE,
|
125 |
-
util::$PARTSTAT,
|
126 |
-
$pValue[util::$PARTSTAT] );
|
127 |
-
if( isset( $pValue[util::$RSVP] ))
|
128 |
-
$attributes .= sprintf( $FMTKEYVALUE,
|
129 |
-
util::$RSVP,
|
130 |
-
$pValue[util::$RSVP] );
|
131 |
-
if( isset( $pValue[util::$DELEGATED_TO] ))
|
132 |
-
$attributes .= sprintf( $FMTKEYEQ,
|
133 |
-
util::$DELEGATED_TO ) .
|
134 |
-
self::getQuotedListItems( $pValue[util::$DELEGATED_TO] );
|
135 |
-
if( isset( $pValue[util::$DELEGATED_FROM] ))
|
136 |
-
$attributes .= sprintf( $FMTKEYEQ,
|
137 |
-
util::$DELEGATED_FROM ) .
|
138 |
-
self::getQuotedListItems( $pValue[util::$DELEGATED_FROM] );
|
139 |
-
if( isset( $pValue[util::$SENT_BY] ))
|
140 |
-
$attributes .= sprintf( $FMTKEYVALUE,
|
141 |
-
util::$SENT_BY,
|
142 |
-
$pValue[util::$SENT_BY] );
|
143 |
-
if( isset( $pValue[util::$CN] ))
|
144 |
-
$attributes .= sprintf( $FMTKEYVALUE,
|
145 |
-
util::$CN,
|
146 |
-
$pValue[util::$CN] );
|
147 |
-
if( isset( $pValue[util::$DIR] )) {
|
148 |
-
$delim = ( false === strpos( $pValue[util::$DIR], util::$QQ )) ? util::$QQ : null;
|
149 |
-
$attributes .= sprintf( $FMTDIREQ, util::$DIR,
|
150 |
-
$delim,
|
151 |
-
$pValue[util::$DIR],
|
152 |
-
$delim );
|
153 |
-
}
|
154 |
-
if( isset( $pValue[util::$LANGUAGE] ))
|
155 |
-
$attributes .= sprintf( $FMTKEYVALUE,
|
156 |
-
util::$LANGUAGE,
|
157 |
-
$pValue[util::$LANGUAGE] );
|
158 |
-
$xparams = [];
|
159 |
-
foreach( $pValue as $pLabel2 => $pValue2 ) {
|
160 |
-
if( ctype_digit( (string) $pLabel2 ))
|
161 |
-
$xparams[] = $pValue2;
|
162 |
-
elseif( ! in_array( $pLabel2, util::$ATTENDEEPARALLKEYS ))
|
163 |
-
$xparams[$pLabel2] = $pValue2;
|
164 |
-
}
|
165 |
-
if( empty( $xparams ))
|
166 |
-
continue;
|
167 |
-
ksort( $xparams, SORT_STRING );
|
168 |
-
foreach( $xparams as $pLabel2 => $pValue2 ) {
|
169 |
-
if( ctype_digit( (string) $pLabel2 ))
|
170 |
-
$attributes .= util::$SEMIC . $pValue2; // ??
|
171 |
-
else
|
172 |
-
$attributes .= sprintf( $FMTKEYVALUE, $pLabel2,
|
173 |
-
$pValue2 );
|
174 |
-
}
|
175 |
-
} // end foreach( $attendeePart )) as $pLabel => $pValue )
|
176 |
-
$output .= util::createElement( util::$ATTENDEE,
|
177 |
-
$attributes,
|
178 |
-
$content );
|
179 |
-
} // end foreach( $attendeeData as $ax => $attendeePart )
|
180 |
-
return $output;
|
181 |
-
}
|
182 |
-
/**
|
183 |
-
* Return string of comma-separated quoted array members
|
184 |
-
*
|
185 |
-
* @param array $list
|
186 |
-
* @return string
|
187 |
-
* @access private
|
188 |
-
* @static
|
189 |
-
*/
|
190 |
-
private static function getQuotedListItems( array $list ) {
|
191 |
-
static $FMTQVALUE = '"%s"';
|
192 |
-
static $FMTCOMMAQVALUE = ',"%s"';
|
193 |
-
$strList = null;
|
194 |
-
foreach( $list as $x => $v )
|
195 |
-
$strList .= ( 0 < $x )
|
196 |
-
? sprintf( $FMTCOMMAQVALUE, $v )
|
197 |
-
: sprintf( $FMTQVALUE, $v );
|
198 |
-
return $strList;
|
199 |
-
}
|
200 |
-
/**
|
201 |
-
* Return formatted output for calendar component property attendee
|
202 |
-
*
|
203 |
-
* @param array $params
|
204 |
-
* @param string $objName
|
205 |
-
* @param string $lang
|
206 |
-
* @return array
|
207 |
-
* @static
|
208 |
-
*/
|
209 |
-
public static function prepAttendeeParams( $params, $objName, $lang ) {
|
210 |
-
static $NONXPROPCOMPS = null;
|
211 |
-
if( is_null( $NONXPROPCOMPS ))
|
212 |
-
$NONXPROPCOMPS = [util::$LCVFREEBUSY, util::$LCVALARM];
|
213 |
-
$params2 = [];
|
214 |
-
if( is_array( $params )) {
|
215 |
-
$optArr = [];
|
216 |
-
$params = array_change_key_case( $params, CASE_UPPER );
|
217 |
-
foreach( $params as $pLabel => $optParamValue ) {
|
218 |
-
if( ! util::isXprefixed( $pLabel ) &&
|
219 |
-
in_array( $objName, $NONXPROPCOMPS ))
|
220 |
-
continue;
|
221 |
-
switch( $pLabel ) {
|
222 |
-
case util::$MEMBER:
|
223 |
-
case util::$DELEGATED_TO:
|
224 |
-
case util::$DELEGATED_FROM:
|
225 |
-
if( ! is_array( $optParamValue ))
|
226 |
-
$optParamValue = [$optParamValue];
|
227 |
-
foreach(( array_keys( $optParamValue )) as $px )
|
228 |
-
$optArr[$pLabel][] = self::calAddressCheck( $optParamValue[$px] );
|
229 |
-
break;
|
230 |
-
default:
|
231 |
-
if( util::$SENT_BY == $pLabel )
|
232 |
-
$optParamValue = self::calAddressCheck( $optParamValue );
|
233 |
-
else
|
234 |
-
$optParamValue = trim( $optParamValue, util::$QQ );
|
235 |
-
$params2[$pLabel] = $optParamValue;
|
236 |
-
break;
|
237 |
-
} // end switch( $pLabel.. .
|
238 |
-
} // end foreach( $params as $pLabel => $optParamValue )
|
239 |
-
foreach( $optArr as $pLabel => $pValue )
|
240 |
-
$params2[$pLabel] = $pValue;
|
241 |
-
} // end if( is_array($params ))
|
242 |
-
// remove defaults
|
243 |
-
util::existRem( $params2, util::$CUTYPE, util::$INDIVIDUAL );
|
244 |
-
util::existRem( $params2, util::$PARTSTAT, util::$NEEDS_ACTION );
|
245 |
-
util::existRem( $params2, util::$ROLE, util::$REQ_PARTICIPANT );
|
246 |
-
util::existRem( $params2, util::$RSVP, util::$false );
|
247 |
-
// check language setting
|
248 |
-
if( isset( $params2[util::$CN ] ) &&
|
249 |
-
! isset( $params2[util::$LANGUAGE ] ) &&
|
250 |
-
! empty( $lang ))
|
251 |
-
$params2[util::$LANGUAGE ] = $lang;
|
252 |
-
return $params2;
|
253 |
-
}
|
254 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/util/utilGeo.php
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\util;
|
32 |
-
/**
|
33 |
-
* iCalcreator geo support class
|
34 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
35 |
-
* @since 2.22.23 - 2017-02-02
|
36 |
-
*/
|
37 |
-
class utilGeo {
|
38 |
-
/**
|
39 |
-
* @var string GEO vars: output format for geo latitude and longitude (before rtrim) etc
|
40 |
-
* @access public
|
41 |
-
* @static
|
42 |
-
*/
|
43 |
-
public static $geoLatFmt = '%09.6f';
|
44 |
-
public static $geoLongFmt = '%8.6f';
|
45 |
-
public static $LATITUDE = 'latitude';
|
46 |
-
public static $LONGITUDE = 'longitude';
|
47 |
-
/**
|
48 |
-
* Return formatted geo output
|
49 |
-
*
|
50 |
-
* @param float $ll
|
51 |
-
* @param string $format
|
52 |
-
* @return string
|
53 |
-
* @access public
|
54 |
-
* @static
|
55 |
-
*/
|
56 |
-
public static function geo2str2( $ll, $format ) {
|
57 |
-
if( 0.0 < $ll )
|
58 |
-
$sign = util::$PLUS;
|
59 |
-
else
|
60 |
-
$sign = ( 0.0 > $ll ) ? util::$MINUS : null;
|
61 |
-
return rtrim( rtrim( $sign . sprintf( $format, abs( $ll )),
|
62 |
-
util::$ZERO ),
|
63 |
-
util::$DOT );
|
64 |
-
}
|
65 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/util/utilRecur.php
DELETED
@@ -1,873 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\util;
|
32 |
-
/**
|
33 |
-
* iCalcreator recur support class
|
34 |
-
*
|
35 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
36 |
-
* @since 2.23.18 - 2017-06-14
|
37 |
-
*/
|
38 |
-
class utilRecur {
|
39 |
-
/**
|
40 |
-
* Static values for recurrence FREQuence
|
41 |
-
* @access private
|
42 |
-
* @static
|
43 |
-
*/
|
44 |
-
private static $DAILY = 'DAILY';
|
45 |
-
private static $WEEKLY = 'WEEKLY';
|
46 |
-
private static $MONTHLY = 'MONTHLY';
|
47 |
-
private static $YEARLY = 'YEARLY';
|
48 |
-
//private static $SECONDLY = 'SECONDLY';
|
49 |
-
//private static $MINUTELY = 'MINUTELY';
|
50 |
-
//private static $HOURLY = 'HOURLY';
|
51 |
-
private static $DAYNAMES = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'];
|
52 |
-
private static $YEARCNT_UP = 'yearcnt_up';
|
53 |
-
private static $YEARCNT_DOWN = 'yearcnt_down';
|
54 |
-
private static $MONTHDAYNO_UP = 'monthdayno_up';
|
55 |
-
private static $MONTHDAYNO_DOWN = 'monthdayno_down';
|
56 |
-
private static $MONTHCNT_DOWN = 'monthcnt_down';
|
57 |
-
private static $YEARDAYNO_UP = 'yeardayno_up';
|
58 |
-
private static $YEARDAYNO_DOWN = 'yeardayno_down';
|
59 |
-
private static $WEEKNO_UP = 'weekno_up';
|
60 |
-
private static $WEEKNO_DOWN = 'weekno_down';
|
61 |
-
private static $W = 'W';
|
62 |
-
/**
|
63 |
-
* Sort recur dates
|
64 |
-
* @param array $byDayA
|
65 |
-
* @param array $byDayB
|
66 |
-
* @return int
|
67 |
-
* @access private
|
68 |
-
* @static
|
69 |
-
*/
|
70 |
-
private static function recurBydaySort( $byDayA, $byDayB ) {
|
71 |
-
static $days = ['SU' => 0,
|
72 |
-
'MO' => 1,
|
73 |
-
'TU' => 2,
|
74 |
-
'WE' => 3,
|
75 |
-
'TH' => 4,
|
76 |
-
'FR' => 5,
|
77 |
-
'SA' => 6];
|
78 |
-
return ( $days[substr( $byDayA, -2 )] < $days[substr( $byDayB, -2 )] ) ? -1 : 1;
|
79 |
-
}
|
80 |
-
/**
|
81 |
-
* Return formatted output for calendar component property data value type recur
|
82 |
-
*
|
83 |
-
* @param string $recurlabel
|
84 |
-
* @param array $recurData
|
85 |
-
* @param bool $allowEmpty
|
86 |
-
* @return string
|
87 |
-
* @static
|
88 |
-
*/
|
89 |
-
public static function formatRecur( $recurlabel, $recurData, $allowEmpty ) {
|
90 |
-
static $FMTFREQEQ = 'FREQ=%s';
|
91 |
-
static $FMTDEFAULTEQ = ';%s=%s';
|
92 |
-
static $FMTOTHEREQ = ';%s=';
|
93 |
-
static $RECURBYDAYSORTER = null;
|
94 |
-
static $SP0 = '';
|
95 |
-
if( is_null( $RECURBYDAYSORTER ))
|
96 |
-
$RECURBYDAYSORTER = [get_class(), 'recurBydaySort'];
|
97 |
-
if( empty( $recurData ))
|
98 |
-
return null;
|
99 |
-
$output = null;
|
100 |
-
foreach( $recurData as $rx => $theRule ) {
|
101 |
-
if( empty( $theRule[util::$LCvalue] )) {
|
102 |
-
if( $allowEmpty )
|
103 |
-
$output .= util::createElement( $recurlabel );
|
104 |
-
continue;
|
105 |
-
}
|
106 |
-
$attributes = ( isset( $theRule[util::$LCparams] ))
|
107 |
-
? util::createParams( $theRule[util::$LCparams] )
|
108 |
-
: null;
|
109 |
-
$content1 = $content2 = null;
|
110 |
-
foreach( $theRule[util::$LCvalue] as $ruleLabel => $ruleValue ) {
|
111 |
-
$ruleLabel = strtoupper( $ruleLabel );
|
112 |
-
switch( $ruleLabel ) {
|
113 |
-
case util::$FREQ :
|
114 |
-
$content1 .= sprintf( $FMTFREQEQ, $ruleValue );
|
115 |
-
break;
|
116 |
-
case util::$UNTIL :
|
117 |
-
$parno = ( isset( $ruleValue[util::$LCHOUR] )) ? 7 : 3;
|
118 |
-
$content2 .= sprintf( $FMTDEFAULTEQ, util::$UNTIL,
|
119 |
-
util::date2strdate( $ruleValue,
|
120 |
-
$parno ));
|
121 |
-
break;
|
122 |
-
case util::$COUNT :
|
123 |
-
case util::$INTERVAL :
|
124 |
-
case util::$WKST :
|
125 |
-
$content2 .= sprintf( $FMTDEFAULTEQ, $ruleLabel, $ruleValue );
|
126 |
-
break;
|
127 |
-
case util::$BYDAY :
|
128 |
-
$byday = [$SP0];
|
129 |
-
$bx = 0;
|
130 |
-
foreach( $ruleValue as $bix => $bydayPart ) {
|
131 |
-
if( ! empty( $byday[$bx] ) && // new day
|
132 |
-
! ctype_digit( substr( $byday[$bx], -1 )))
|
133 |
-
$byday[++$bx] = $SP0;
|
134 |
-
if( ! is_array( $bydayPart )) // day without order number
|
135 |
-
$byday[$bx] .= (string) $bydayPart;
|
136 |
-
else { // day with order number
|
137 |
-
foreach( $bydayPart as $bix2 => $bydayPart2 )
|
138 |
-
$byday[$bx] .= (string) $bydayPart2;
|
139 |
-
}
|
140 |
-
} // end foreach( $ruleValue as $bix => $bydayPart )
|
141 |
-
if( 1 < count( $byday ))
|
142 |
-
usort( $byday, $RECURBYDAYSORTER );
|
143 |
-
$content2 .= sprintf( $FMTDEFAULTEQ, util::$BYDAY,
|
144 |
-
implode( util::$COMMA,
|
145 |
-
$byday ));
|
146 |
-
break;
|
147 |
-
default : // BYSECOND/BYMINUTE/BYHOUR/BYMONTHDAY/BYYEARDAY/BYWEEKNO/BYMONTH/BYSETPOS...
|
148 |
-
if( is_array( $ruleValue )) {
|
149 |
-
$content2 .= sprintf( $FMTOTHEREQ, $ruleLabel );
|
150 |
-
$content2 .= implode( util::$COMMA, $ruleValue );
|
151 |
-
}
|
152 |
-
else
|
153 |
-
$content2 .= sprintf( $FMTDEFAULTEQ, $ruleLabel, $ruleValue );
|
154 |
-
break;
|
155 |
-
} // end switch( $ruleLabel )
|
156 |
-
} // end foreach( $theRule[util::$LCvalue] )) as $ruleLabel => $ruleValue )
|
157 |
-
$output .= util::createElement( $recurlabel,
|
158 |
-
$attributes,
|
159 |
-
$content1 . $content2 );
|
160 |
-
} // end foreach( $recurData as $rx => $theRule )
|
161 |
-
return $output;
|
162 |
-
}
|
163 |
-
/**
|
164 |
-
* Convert input format for EXRULE and RRULE to internal format
|
165 |
-
*
|
166 |
-
* @param array $rexrule
|
167 |
-
* @return array
|
168 |
-
* @static
|
169 |
-
*/
|
170 |
-
public static function setRexrule( $rexrule ) {
|
171 |
-
static $BYSECOND = 'BYSECOND';
|
172 |
-
static $BYMINUTE = 'BYMINUTE';
|
173 |
-
static $BYHOUR = 'BYHOUR';
|
174 |
-
$input = [];
|
175 |
-
if( empty( $rexrule ))
|
176 |
-
return $input;
|
177 |
-
$rexrule = array_change_key_case( $rexrule, CASE_UPPER );
|
178 |
-
foreach( $rexrule as $rexruleLabel => $rexruleValue ) {
|
179 |
-
if( util::$UNTIL != $rexruleLabel )
|
180 |
-
$input[$rexruleLabel] = $rexruleValue;
|
181 |
-
else {
|
182 |
-
util::strDate2arr( $rexruleValue );
|
183 |
-
if( util::isArrayTimestampDate( $rexruleValue )) // timestamp, always date-time UTC
|
184 |
-
$input[$rexruleLabel] = util::timestamp2date( $rexruleValue, 7, util::$UTC );
|
185 |
-
elseif( util::isArrayDate( $rexruleValue )) { // date or UTC date-time
|
186 |
-
$parno = ( isset( $rexruleValue[util::$LCHOUR] ) ||
|
187 |
-
isset( $rexruleValue[4] )) ? 7 : 3;
|
188 |
-
$d = util::chkDateArr( $rexruleValue, $parno );
|
189 |
-
if(( 3 < $parno ) &&
|
190 |
-
isset( $d[util::$LCtz] ) &&
|
191 |
-
( util::$Z != $d[util::$LCtz] ) &&
|
192 |
-
util::isOffset( $d[util::$LCtz] )) {
|
193 |
-
$input[$rexruleLabel] = util::strDate2ArrayDate( sprintf( util::$YMDHISE,
|
194 |
-
(int) $d[util::$LCYEAR],
|
195 |
-
(int) $d[util::$LCMONTH],
|
196 |
-
(int) $d[util::$LCDAY],
|
197 |
-
(int) $d[util::$LCHOUR],
|
198 |
-
(int) $d[util::$LCMIN],
|
199 |
-
(int) $d[util::$LCSEC],
|
200 |
-
$d[util::$LCtz] ),
|
201 |
-
7 );
|
202 |
-
unset( $input[$rexruleLabel][util::$UNPARSEDTEXT] );
|
203 |
-
}
|
204 |
-
else
|
205 |
-
$input[$rexruleLabel] = $d;
|
206 |
-
}
|
207 |
-
elseif( 8 <= strlen( trim( $rexruleValue ))) { // ex. textual date-time 2006-08-03 10:12:18 => UTC
|
208 |
-
$input[$rexruleLabel] = util::strDate2ArrayDate( $rexruleValue );
|
209 |
-
unset( $input[$rexruleLabel][util::$UNPARSEDTEXT] );
|
210 |
-
}
|
211 |
-
if(( 3 < count( $input[$rexruleLabel] )) &&
|
212 |
-
! isset( $input[$rexruleLabel][util::$LCtz] ))
|
213 |
-
$input[$rexruleLabel][util::$LCtz] = util::$Z;
|
214 |
-
}
|
215 |
-
} // end foreach( $rexrule as $rexruleLabel => $rexruleValue )
|
216 |
-
/* set recurrence rule specification in rfc2445 order */
|
217 |
-
$input2 = [];
|
218 |
-
if( isset( $input[util::$FREQ] ))
|
219 |
-
$input2[util::$FREQ] = $input[util::$FREQ];
|
220 |
-
if( isset( $input[util::$UNTIL] ))
|
221 |
-
$input2[util::$UNTIL] = $input[util::$UNTIL];
|
222 |
-
elseif( isset( $input[util::$COUNT] ))
|
223 |
-
$input2[util::$COUNT] = $input[util::$COUNT];
|
224 |
-
if( isset( $input[util::$INTERVAL] ))
|
225 |
-
$input2[util::$INTERVAL] = $input[util::$INTERVAL];
|
226 |
-
if( isset( $input[$BYSECOND] ))
|
227 |
-
$input2[$BYSECOND] = $input[$BYSECOND];
|
228 |
-
if( isset( $input[$BYMINUTE] ))
|
229 |
-
$input2[$BYMINUTE] = $input[$BYMINUTE];
|
230 |
-
if( isset( $input[$BYHOUR] ))
|
231 |
-
$input2[$BYHOUR] = $input[$BYHOUR];
|
232 |
-
if( isset( $input[util::$BYDAY] )) {
|
233 |
-
if( ! is_array( $input[util::$BYDAY] )) // ensure upper case.. .
|
234 |
-
$input2[util::$BYDAY] = strtoupper( $input[util::$BYDAY] );
|
235 |
-
else {
|
236 |
-
foreach( $input[util::$BYDAY] as $BYDAYx => $BYDAYv ) {
|
237 |
-
if( 0 == strcasecmp( util::$DAY, $BYDAYx ))
|
238 |
-
$input2[util::$BYDAY][util::$DAY] = strtoupper( $BYDAYv );
|
239 |
-
elseif( ! is_array( $BYDAYv ))
|
240 |
-
$input2[util::$BYDAY][$BYDAYx] = $BYDAYv;
|
241 |
-
else {
|
242 |
-
foreach( $BYDAYv as $BYDAYx2 => $BYDAYv2 ) {
|
243 |
-
if( 0 == strcasecmp( util::$DAY, $BYDAYx2 ))
|
244 |
-
$input2[util::$BYDAY][$BYDAYx][util::$DAY] = strtoupper( $BYDAYv2 );
|
245 |
-
else
|
246 |
-
$input2[util::$BYDAY][$BYDAYx][$BYDAYx2] = $BYDAYv2;
|
247 |
-
}
|
248 |
-
}
|
249 |
-
}
|
250 |
-
}
|
251 |
-
} // end if( isset( $input[util::$BYDAY] ))
|
252 |
-
if( isset( $input[util::$BYMONTHDAY] ))
|
253 |
-
$input2[util::$BYMONTHDAY] = $input[util::$BYMONTHDAY];
|
254 |
-
if( isset( $input[util::$BYYEARDAY] ))
|
255 |
-
$input2[util::$BYYEARDAY] = $input[util::$BYYEARDAY];
|
256 |
-
if( isset( $input[util::$BYWEEKNO] ))
|
257 |
-
$input2[util::$BYWEEKNO] = $input[util::$BYWEEKNO];
|
258 |
-
if( isset( $input[util::$BYMONTH] ))
|
259 |
-
$input2[util::$BYMONTH] = $input[util::$BYMONTH];
|
260 |
-
if( isset( $input[util::$BYSETPOS] ))
|
261 |
-
$input2[util::$BYSETPOS] = $input[util::$BYSETPOS];
|
262 |
-
if( isset( $input[util::$WKST] ))
|
263 |
-
$input2[util::$WKST] = $input[util::$WKST];
|
264 |
-
return $input2;
|
265 |
-
}
|
266 |
-
/**
|
267 |
-
* Update array $result with dates based on a recur pattern
|
268 |
-
*
|
269 |
-
* If missing, UNTIL is set 1 year from startdate (emergency break)
|
270 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
271 |
-
* @since 2.21.11 - 2015-03-10
|
272 |
-
* @param array $result array to update, array([Y-m-d] => bool)
|
273 |
-
* @param array $recur pattern for recurrency (only value part, params ignored)
|
274 |
-
* @param mixed $wdate component start date, string / array / (datetime) obj
|
275 |
-
* @param mixed $fcnStart start date, string / array / (datetime) obj
|
276 |
-
* @param mixed $fcnEnd end date, string / array / (datetime) obj
|
277 |
-
* @static
|
278 |
-
* @todo BYHOUR, BYMINUTE, BYSECOND, WEEKLY at year end/start OR not at all
|
279 |
-
*/
|
280 |
-
public static function recur2date( & $result,
|
281 |
-
$recur,
|
282 |
-
$wdate,
|
283 |
-
$fcnStart,
|
284 |
-
$fcnEnd=false ) {
|
285 |
-
static $YEAR2DAYARR = ['YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY'];
|
286 |
-
static $SU = 'SU';
|
287 |
-
self::reFormatDate( $wdate );
|
288 |
-
$wdateYMD = sprintf( util::$YMD, $wdate[util::$LCYEAR],
|
289 |
-
$wdate[util::$LCMONTH],
|
290 |
-
$wdate[util::$LCDAY] );
|
291 |
-
$wdateHis = sprintf( util::$HIS, $wdate[util::$LCHOUR],
|
292 |
-
$wdate[util::$LCMIN],
|
293 |
-
$wdate[util::$LCSEC] );
|
294 |
-
$untilHis = $wdateHis;
|
295 |
-
self::reFormatDate( $fcnStart );
|
296 |
-
$fcnStartYMD = sprintf( util::$YMD, $fcnStart[util::$LCYEAR],
|
297 |
-
$fcnStart[util::$LCMONTH],
|
298 |
-
$fcnStart[util::$LCDAY] );
|
299 |
-
if( ! empty( $fcnEnd ))
|
300 |
-
self::reFormatDate( $fcnEnd );
|
301 |
-
else {
|
302 |
-
$fcnEnd = $fcnStart;
|
303 |
-
$fcnEnd[util::$LCYEAR] += 1;
|
304 |
-
}
|
305 |
-
$fcnEndYMD = sprintf( util::$YMD, $fcnEnd[util::$LCYEAR],
|
306 |
-
$fcnEnd[util::$LCMONTH],
|
307 |
-
$fcnEnd[util::$LCDAY] );
|
308 |
-
// echo "<b>recur _in_ comp</b> start ".implode('-',$wdate)." period start ".implode('-',$fcnStart)." period end ".implode('-',$fcnEnd)."<br>\n";
|
309 |
-
// echo 'recur='.str_replace( [PHP_EOL, ' '], null, var_export( $recur, true ))."<br> \n"; // test ###
|
310 |
-
if( ! isset( $recur[util::$COUNT] ) &&
|
311 |
-
! isset( $recur[util::$UNTIL] ))
|
312 |
-
$recur[util::$UNTIL] = $fcnEnd; // create break
|
313 |
-
if( isset( $recur[util::$UNTIL] )) {
|
314 |
-
foreach( $recur[util::$UNTIL] as $k => $v ) {
|
315 |
-
if( ctype_digit( $v ))
|
316 |
-
$recur[util::$UNTIL][$k] = (int) $v;
|
317 |
-
}
|
318 |
-
unset( $recur[util::$UNTIL][util::$LCtz] );
|
319 |
-
if( $fcnEnd > $recur[util::$UNTIL] ) {
|
320 |
-
$fcnEnd = $recur[util::$UNTIL]; // emergency break
|
321 |
-
$fcnEndYMD = sprintf( util::$YMD, $fcnEnd[util::$LCYEAR],
|
322 |
-
$fcnEnd[util::$LCMONTH],
|
323 |
-
$fcnEnd[util::$LCDAY] );
|
324 |
-
}
|
325 |
-
if( isset( $recur[util::$UNTIL][util::$LCHOUR] ))
|
326 |
-
$untilHis = sprintf( util::$HIS, $recur[util::$UNTIL][util::$LCHOUR],
|
327 |
-
$recur[util::$UNTIL][util::$LCMIN],
|
328 |
-
$recur[util::$UNTIL][util::$LCSEC] );
|
329 |
-
else
|
330 |
-
$untilHis = sprintf( util::$HIS, 23, 59, 59 );
|
331 |
-
// echo 'recurUNTIL='.str_replace( [PHP_EOL, ' '], '', var_export( $recur['UNTIL'], true )).", untilHis={$untilHis}<br> \n"; // test ###
|
332 |
-
} // end if( isset( $recur[util::$UNTIL] ))
|
333 |
-
// echo 'fcnEnd:'.$fcnEndYMD.$untilHis."<br>\n"; // test ###
|
334 |
-
if( $wdateYMD > $fcnEndYMD ) {
|
335 |
-
// echo 'recur out of date, '.implode('-',$wdate).', end='.implode('-',$fcnEnd)."<br>\n"; // test ###
|
336 |
-
return []; // nothing to do.. .
|
337 |
-
}
|
338 |
-
if( ! isset( $recur[util::$FREQ] )) // "MUST be specified.. ."
|
339 |
-
$recur[util::$FREQ] = self::$DAILY; // ??
|
340 |
-
$wkst = ( isset( $recur[util::$WKST] ) &&
|
341 |
-
( $SU == $recur[util::$WKST] )) ? 24*60*60 : 0; // ??
|
342 |
-
if( ! isset( $recur[util::$INTERVAL] ))
|
343 |
-
$recur[util::$INTERVAL] = 1;
|
344 |
-
$recurCount = ( ! isset( $recur[util::$BYSETPOS] )) ? 1 : 0; // DTSTART counts as the first occurrence
|
345 |
-
/* find out how to step up dates and set index for interval count */
|
346 |
-
$step = [];
|
347 |
-
if( self::$YEARLY == $recur[util::$FREQ] )
|
348 |
-
$step[util::$LCYEAR] = 1;
|
349 |
-
elseif( self::$MONTHLY == $recur[util::$FREQ] )
|
350 |
-
$step[util::$LCMONTH] = 1;
|
351 |
-
elseif( self::$WEEKLY == $recur[util::$FREQ] )
|
352 |
-
$step[util::$LCDAY] = 7;
|
353 |
-
else
|
354 |
-
$step[util::$LCDAY] = 1;
|
355 |
-
if( isset( $step[util::$LCYEAR] ) && isset( $recur[util::$BYMONTH] ))
|
356 |
-
$step = [util::$LCMONTH => 1];
|
357 |
-
if( empty( $step ) && isset( $recur[util::$BYWEEKNO] )) // ??
|
358 |
-
$step = [util::$LCDAY => 7];
|
359 |
-
if( isset( $recur[util::$BYYEARDAY] ) ||
|
360 |
-
isset( $recur[util::$BYMONTHDAY] ) ||
|
361 |
-
isset( $recur[util::$BYDAY] ))
|
362 |
-
$step = [util::$LCDAY => 1];
|
363 |
-
$intervalarr = [];
|
364 |
-
if( 1 < $recur[util::$INTERVAL] ) {
|
365 |
-
$intervalix = self::recurIntervalIx( $recur[util::$FREQ],
|
366 |
-
$wdate,
|
367 |
-
$wkst );
|
368 |
-
$intervalarr = [$intervalix => 0];
|
369 |
-
}
|
370 |
-
if( isset( $recur[util::$BYSETPOS] )) { // save start date + weekno
|
371 |
-
$bysetposymd1 = $bysetposymd2 = $bysetposw1 = $bysetposw2 = [];
|
372 |
-
if( is_array( $recur[util::$BYSETPOS] )) {
|
373 |
-
foreach( $recur[util::$BYSETPOS] as $bix => $bval )
|
374 |
-
$recur[util::$BYSETPOS][$bix] = (int) $bval;
|
375 |
-
}
|
376 |
-
else
|
377 |
-
$recur[util::$BYSETPOS] = [(int) $recur[util::$BYSETPOS]];
|
378 |
-
if( self::$YEARLY == $recur[util::$FREQ] ) {
|
379 |
-
$wdate[util::$LCMONTH] = $wdate[util::$LCDAY] = 1; // start from beginning of year
|
380 |
-
$wdateYMD = sprintf( util::$YMD, $wdate[util::$LCYEAR],
|
381 |
-
$wdate[util::$LCMONTH],
|
382 |
-
$wdate[util::$LCDAY] );
|
383 |
-
self::stepdate( $fcnEnd, $fcnEndYMD, [util::$LCYEAR => 1] ); // make sure to count last year
|
384 |
-
}
|
385 |
-
elseif( self::$MONTHLY == $recur[util::$FREQ] ) {
|
386 |
-
$wdate[util::$LCDAY] = 1; // start from beginning of month
|
387 |
-
$wdateYMD = sprintf( util::$YMD, $wdate[util::$LCYEAR],
|
388 |
-
$wdate[util::$LCMONTH],
|
389 |
-
$wdate[util::$LCDAY] );
|
390 |
-
self::stepdate( $fcnEnd, $fcnEndYMD, [util::$LCMONTH => 1] ); // make sure to count last month
|
391 |
-
}
|
392 |
-
else
|
393 |
-
self::stepdate( $fcnEnd, $fcnEndYMD, $step); // make sure to count whole last period
|
394 |
-
// echo "BYSETPOS endDat =".implode('-',$fcnEnd).' step='.var_export($step,true)."<br>\n"; // test ######
|
395 |
-
$bysetposWold = (int) date( self::$W,
|
396 |
-
mktime( 0,
|
397 |
-
0,
|
398 |
-
$wkst,
|
399 |
-
$wdate[util::$LCMONTH],
|
400 |
-
$wdate[util::$LCDAY],
|
401 |
-
$wdate[util::$LCYEAR] ));
|
402 |
-
$bysetposYold = $wdate[util::$LCYEAR];
|
403 |
-
$bysetposMold = $wdate[util::$LCMONTH];
|
404 |
-
$bysetposDold = $wdate[util::$LCDAY];
|
405 |
-
} // end if( isset( $recur[util::$BYSETPOS] ))
|
406 |
-
else
|
407 |
-
self::stepdate( $wdate, $wdateYMD, $step);
|
408 |
-
$year_old = null;
|
409 |
-
/* MAIN LOOP */
|
410 |
-
while( true ) {
|
411 |
-
// $txt = ( isset( $recur[util::$COUNT] )) ? '. recurCount : ' . $recurCount . ', COUNT : ' . $recur[util::$COUNT] : null; // test ###
|
412 |
-
// echo "recur start while:<b>{$wdateYMD}</b>, end:{$fcnEndYMD}{$txt}<br>\n"; // test ###
|
413 |
-
if( $wdateYMD.$wdateHis > $fcnEndYMD.$untilHis )
|
414 |
-
break;
|
415 |
-
if( isset( $recur[util::$COUNT] ) &&
|
416 |
-
( $recurCount >= $recur[util::$COUNT] ))
|
417 |
-
break;
|
418 |
-
if( $year_old != $wdate[util::$LCYEAR] ) { // $year_old=null 1:st time
|
419 |
-
$year_old = $wdate[util::$LCYEAR];
|
420 |
-
$daycnts = self::initDayCnts( $wdate, $recur, $wkst );
|
421 |
-
}
|
422 |
-
|
423 |
-
/* check interval */
|
424 |
-
if( 1 < $recur[util::$INTERVAL] ) {
|
425 |
-
/* create interval index */
|
426 |
-
$intervalix = self::recurIntervalIx( $recur[util::$FREQ],
|
427 |
-
$wdate,
|
428 |
-
$wkst );
|
429 |
-
/* check interval */
|
430 |
-
$currentKey = array_keys( $intervalarr );
|
431 |
-
$currentKey = end( $currentKey ); // get last index
|
432 |
-
if( $currentKey != $intervalix )
|
433 |
-
$intervalarr = [$intervalix => ( $intervalarr[$currentKey] + 1 )];
|
434 |
-
if(( $recur[util::$INTERVAL] != $intervalarr[$intervalix] ) &&
|
435 |
-
( 0 != $intervalarr[$intervalix] )) {
|
436 |
-
/* step up date */
|
437 |
-
// echo "skip: ".implode('-',$wdate)." ix=$intervalix old=$currentKey interval=".$intervalarr[$intervalix]."<br>\n"; // test ###
|
438 |
-
self::stepdate( $wdate, $wdateYMD, $step);
|
439 |
-
continue;
|
440 |
-
}
|
441 |
-
else // continue within the selected interval
|
442 |
-
$intervalarr[$intervalix] = 0;
|
443 |
-
// echo "cont: ".implode('-',$wdate)." ix=$intervalix old=$currentKey interval=".$intervalarr[$intervalix]."<br>\n"; // test ###
|
444 |
-
} // endif( 1 < $recur['INTERVAL'] )
|
445 |
-
$updateOK = true;
|
446 |
-
if( $updateOK && isset( $recur[util::$BYMONTH] ))
|
447 |
-
$updateOK = self::recurBYcntcheck( $recur[util::$BYMONTH],
|
448 |
-
$wdate[util::$LCMONTH],
|
449 |
-
( $wdate[util::$LCMONTH] - 13 ));
|
450 |
-
if( $updateOK && isset( $recur[util::$BYWEEKNO] ))
|
451 |
-
$updateOK = self::recurBYcntcheck( $recur[util::$BYWEEKNO],
|
452 |
-
$daycnts[$wdate[util::$LCMONTH]][$wdate[util::$LCDAY]][self::$WEEKNO_UP],
|
453 |
-
$daycnts[$wdate[util::$LCMONTH]][$wdate[util::$LCDAY]][self::$WEEKNO_DOWN] );
|
454 |
-
if( $updateOK && isset( $recur[util::$BYYEARDAY] ))
|
455 |
-
$updateOK = self::recurBYcntcheck( $recur[util::$BYYEARDAY],
|
456 |
-
$daycnts[$wdate[util::$LCMONTH]][$wdate[util::$LCDAY]][self::$YEARCNT_UP],
|
457 |
-
$daycnts[$wdate[util::$LCMONTH]][$wdate[util::$LCDAY]][self::$YEARCNT_DOWN] );
|
458 |
-
if( $updateOK && isset( $recur[util::$BYMONTHDAY] ))
|
459 |
-
$updateOK = self::recurBYcntcheck( $recur[util::$BYMONTHDAY],
|
460 |
-
$wdate[util::$LCDAY],
|
461 |
-
$daycnts[$wdate[util::$LCMONTH]][$wdate[util::$LCDAY]][self::$MONTHCNT_DOWN] );
|
462 |
-
// echo "efter BYMONTHDAY: ".implode('-',$wdate).' status: '; echo ($updateOK) ? 'true' : 'false'; echo "<br>\n"; // test ######
|
463 |
-
if( $updateOK && isset( $recur[util::$BYDAY] )) {
|
464 |
-
$updateOK = false;
|
465 |
-
$m = $wdate[util::$LCMONTH];
|
466 |
-
$d = $wdate[util::$LCDAY];
|
467 |
-
if( isset( $recur[util::$BYDAY][util::$DAY] )) { // single day, opt with year/month day order no
|
468 |
-
$daynoexists = $daynosw = $daynamesw = false;
|
469 |
-
if( $recur[util::$BYDAY][util::$DAY] == $daycnts[$m][$d][util::$DAY] )
|
470 |
-
$daynamesw = true;
|
471 |
-
if( isset( $recur[util::$BYDAY][0] )) {
|
472 |
-
$daynoexists = true;
|
473 |
-
if(( isset( $recur[util::$FREQ] ) &&
|
474 |
-
( $recur[util::$FREQ] == self::$MONTHLY )) ||
|
475 |
-
isset( $recur[util::$BYMONTH] ))
|
476 |
-
$daynosw = self::recurBYcntcheck( $recur[util::$BYDAY][0],
|
477 |
-
$daycnts[$m][$d][self::$MONTHDAYNO_UP],
|
478 |
-
$daycnts[$m][$d][self::$MONTHDAYNO_DOWN] );
|
479 |
-
elseif( isset( $recur[util::$FREQ] ) &&
|
480 |
-
( $recur[util::$FREQ] == self::$YEARLY ))
|
481 |
-
$daynosw = self::recurBYcntcheck( $recur[util::$BYDAY][0],
|
482 |
-
$daycnts[$m][$d][self::$YEARDAYNO_UP],
|
483 |
-
$daycnts[$m][$d][self::$YEARDAYNO_DOWN] );
|
484 |
-
}
|
485 |
-
if(( $daynoexists && $daynosw && $daynamesw ) ||
|
486 |
-
( ! $daynoexists && ! $daynosw && $daynamesw )) {
|
487 |
-
$updateOK = true;
|
488 |
-
// echo "m=$m d=$d day=".$daycnts[$m][$d][util::$DAY]." yeardayno_up=".$daycnts[$m][$d][self::$YEARDAYNO_UP]." daynoexists:$daynoexists daynosw:$daynosw daynamesw:$daynamesw updateOK:$updateOK<br>\n"; // test ###
|
489 |
-
}
|
490 |
-
// echo "m=$m d=$d day=".$daycnts[$m][$d][util::$DAY]." yeardayno_up=".$daycnts[$m][$d][self::$YEARDAYNO_UP]." daynoexists:$daynoexists daynosw:$daynosw daynamesw:$daynamesw updateOK:$updateOK<br>\n"; // test ###
|
491 |
-
}
|
492 |
-
else {
|
493 |
-
foreach( $recur[util::$BYDAY] as $bydayvalue ) {
|
494 |
-
$daynoexists = $daynosw = $daynamesw = false;
|
495 |
-
if( isset( $bydayvalue[util::$DAY] ) &&
|
496 |
-
( $bydayvalue[util::$DAY] == $daycnts[$m][$d][util::$DAY] ))
|
497 |
-
$daynamesw = true;
|
498 |
-
if( isset( $bydayvalue[0] )) {
|
499 |
-
$daynoexists = true;
|
500 |
-
if(( isset( $recur[util::$FREQ] ) &&
|
501 |
-
( $recur[util::$FREQ] == self::$MONTHLY )) ||
|
502 |
-
isset( $recur[util::$BYMONTH] ))
|
503 |
-
$daynosw = self::recurBYcntcheck( $bydayvalue['0'],
|
504 |
-
$daycnts[$m][$d][self::$MONTHDAYNO_UP],
|
505 |
-
$daycnts[$m][$d][self::$MONTHDAYNO_DOWN] );
|
506 |
-
elseif( isset( $recur[util::$FREQ] ) &&
|
507 |
-
( $recur[util::$FREQ] == self::$YEARLY ))
|
508 |
-
$daynosw = self::recurBYcntcheck( $bydayvalue['0'],
|
509 |
-
$daycnts[$m][$d][self::$YEARDAYNO_UP],
|
510 |
-
$daycnts[$m][$d][self::$YEARDAYNO_DOWN] );
|
511 |
-
}
|
512 |
-
// echo "daynoexists:$daynoexists daynosw:$daynosw daynamesw:$daynamesw<br>\n"; // test ###
|
513 |
-
if(( $daynoexists && $daynosw && $daynamesw ) ||
|
514 |
-
( ! $daynoexists && ! $daynosw && $daynamesw )) {
|
515 |
-
$updateOK = true;
|
516 |
-
break;
|
517 |
-
}
|
518 |
-
}
|
519 |
-
}
|
520 |
-
}
|
521 |
-
// echo "efter BYDAY: ".implode('-',$wdate).' status: '; echo ($updateOK) ? 'true' : 'false'; echo "<br>\n"; // test ###
|
522 |
-
/* check BYSETPOS */
|
523 |
-
if( $updateOK ) {
|
524 |
-
if( isset( $recur[util::$BYSETPOS] ) &&
|
525 |
-
( in_array( $recur[util::$FREQ], $YEAR2DAYARR))) {
|
526 |
-
if( isset( $recur[self::$WEEKLY] )) {
|
527 |
-
if( $bysetposWold == $daycnts[$wdate[util::$LCMONTH]][$wdate[util::$LCDAY]][self::$WEEKNO_UP] )
|
528 |
-
$bysetposw1[] = $wdateYMD;
|
529 |
-
else
|
530 |
-
$bysetposw2[] = $wdateYMD;
|
531 |
-
}
|
532 |
-
else {
|
533 |
-
if(( isset( $recur[util::$FREQ] ) &&
|
534 |
-
( self::$YEARLY == $recur[util::$FREQ] ) &&
|
535 |
-
( $bysetposYold == $wdate[util::$LCYEAR] )) ||
|
536 |
-
( isset( $recur[util::$FREQ] ) &&
|
537 |
-
( self::$MONTHLY == $recur[util::$FREQ] ) &&
|
538 |
-
(( $bysetposYold == $wdate[util::$LCYEAR] ) &&
|
539 |
-
( $bysetposMold == $wdate[util::$LCMONTH] ))) ||
|
540 |
-
( isset( $recur[util::$FREQ] ) &&
|
541 |
-
( self::$DAILY == $recur[util::$FREQ] ) &&
|
542 |
-
(( $bysetposYold == $wdate[util::$LCYEAR] ) &&
|
543 |
-
( $bysetposMold == $wdate[util::$LCMONTH]) &&
|
544 |
-
( $bysetposDold == $wdate[util::$LCDAY] )))) {
|
545 |
-
// echo "bysetposymd1[]=".date('Y-m-d H:i:s',$wdatets)."<br>\n"; // test ###
|
546 |
-
$bysetposymd1[] = $wdateYMD;
|
547 |
-
}
|
548 |
-
else {
|
549 |
-
// echo "bysetposymd2[]=".date('Y-m-d H:i:s',$wdatets)."<br>\n"; // test ###
|
550 |
-
$bysetposymd2[] = $wdateYMD;
|
551 |
-
}
|
552 |
-
} // end else
|
553 |
-
}
|
554 |
-
else {
|
555 |
-
if( checkdate((int) $wdate[util::$LCMONTH],
|
556 |
-
(int) $wdate[util::$LCDAY],
|
557 |
-
(int) $wdate[util::$LCYEAR] )) {
|
558 |
-
/* update result array if BYSETPOS is not set */
|
559 |
-
$recurCount++;
|
560 |
-
if( $fcnStartYMD <= $wdateYMD ) { // only output within period
|
561 |
-
$result[$wdateYMD] = true;
|
562 |
-
// echo "recur $wdateYMD, recurCount:{$recurCount}<br>\n"; // test ###
|
563 |
-
}
|
564 |
-
}
|
565 |
-
// else echo "recur, no date $wdateYMD<br>\n"; // test ###
|
566 |
-
$updateOK = false;
|
567 |
-
}
|
568 |
-
}
|
569 |
-
/* step up date */
|
570 |
-
self::stepdate( $wdate, $wdateYMD, $step);
|
571 |
-
/* check if BYSETPOS is set for updating result array */
|
572 |
-
if( $updateOK && isset( $recur[util::$BYSETPOS] )) {
|
573 |
-
$bysetpos = false;
|
574 |
-
if( isset( $recur[util::$FREQ] ) &&
|
575 |
-
( self::$YEARLY == $recur[util::$FREQ] ) &&
|
576 |
-
( $bysetposYold != $wdate[util::$LCYEAR] )) {
|
577 |
-
$bysetpos = true;
|
578 |
-
$bysetposYold = $wdate[util::$LCYEAR];
|
579 |
-
}
|
580 |
-
elseif( isset( $recur[util::$FREQ] ) &&
|
581 |
-
( self::$MONTHLY == $recur[util::$FREQ] &&
|
582 |
-
(( $bysetposYold != $wdate[util::$LCYEAR] ) ||
|
583 |
-
( $bysetposMold != $wdate[util::$LCMONTH] )))) {
|
584 |
-
$bysetpos = true;
|
585 |
-
$bysetposYold = $wdate[util::$LCYEAR];
|
586 |
-
$bysetposMold = $wdate[util::$LCMONTH];
|
587 |
-
}
|
588 |
-
elseif( isset( $recur[util::$FREQ] ) &&
|
589 |
-
( self::$WEEKLY == $recur[util::$FREQ] )) {
|
590 |
-
$weekno = (int) date( self::$W,
|
591 |
-
mktime( 0,
|
592 |
-
0,
|
593 |
-
$wkst,
|
594 |
-
$wdate[util::$LCMONTH],
|
595 |
-
$wdate[util::$LCDAY],
|
596 |
-
$wdate[util::$LCYEAR] ));
|
597 |
-
if( $bysetposWold != $weekno ) {
|
598 |
-
$bysetposWold = $weekno;
|
599 |
-
$bysetpos = true;
|
600 |
-
}
|
601 |
-
}
|
602 |
-
elseif( isset( $recur[util::$FREQ] ) &&
|
603 |
-
( self::$DAILY == $recur[util::$FREQ] ) &&
|
604 |
-
(( $bysetposYold != $wdate[util::$LCYEAR] ) ||
|
605 |
-
( $bysetposMold != $wdate[util::$LCMONTH] ) ||
|
606 |
-
( $bysetposDold != $wdate[util::$LCDAY] ))) {
|
607 |
-
$bysetpos = true;
|
608 |
-
$bysetposYold = $wdate[util::$LCYEAR];
|
609 |
-
$bysetposMold = $wdate[util::$LCMONTH];
|
610 |
-
$bysetposDold = $wdate[util::$LCDAY];
|
611 |
-
}
|
612 |
-
if( $bysetpos ) {
|
613 |
-
if( isset( $recur[util::$BYWEEKNO] )) {
|
614 |
-
$bysetposarr1 = & $bysetposw1;
|
615 |
-
$bysetposarr2 = & $bysetposw2;
|
616 |
-
}
|
617 |
-
else {
|
618 |
-
$bysetposarr1 = & $bysetposymd1;
|
619 |
-
$bysetposarr2 = & $bysetposymd2;
|
620 |
-
}
|
621 |
-
|
622 |
-
foreach( $recur[util::$BYSETPOS] as $ix ) {
|
623 |
-
if( 0 > $ix ) // both positive and negative BYSETPOS allowed
|
624 |
-
$ix = ( count( $bysetposarr1 ) + $ix + 1);
|
625 |
-
$ix--;
|
626 |
-
if( isset( $bysetposarr1[$ix] )) {
|
627 |
-
if( $fcnStartYMD <= $bysetposarr1[$ix] ) { // only output within period
|
628 |
-
// $testweekno = (int) date( $W, mktime( 0, 0, $wkst, (int) substr( $bysetposarr1[$ix], 4, 2 ), (int) substr( $bysetposarr1[$ix], 6, 2 ), (int) substr( $bysetposarr1[$ix], 0, 3 ))); // test ###
|
629 |
-
// echo " testYMD (weekno)=$bysetposarr1[$ix] ($testweekno)"; // test ###
|
630 |
-
$result[$bysetposarr1[$ix]] = true;
|
631 |
-
}
|
632 |
-
$recurCount++;
|
633 |
-
}
|
634 |
-
if( isset( $recur[util::$COUNT] ) && ( $recurCount >= $recur[util::$COUNT] ))
|
635 |
-
break;
|
636 |
-
}
|
637 |
-
// echo "<br>\n"; // test ###
|
638 |
-
$bysetposarr1 = $bysetposarr2;
|
639 |
-
$bysetposarr2 = [];
|
640 |
-
} // end if( $bysetpos )
|
641 |
-
} // end if( $updateOK && isset( $recur['BYSETPOS'] ))
|
642 |
-
} // end while( true )
|
643 |
-
// echo 'output='.str_replace( [PHP_EOL, ' '], '', var_export( $result, true ))."<br> \n"; // test ###
|
644 |
-
}
|
645 |
-
/**
|
646 |
-
* Checking BYDAY (etc) hits, recur2date help function
|
647 |
-
*
|
648 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
649 |
-
* @since 2.6.12 - 2011-01-03
|
650 |
-
* @param array $BYvalue
|
651 |
-
* @param int $upValue
|
652 |
-
* @param int $downValue
|
653 |
-
* @return bool
|
654 |
-
* @access private
|
655 |
-
* @static
|
656 |
-
*/
|
657 |
-
private static function recurBYcntcheck( $BYvalue, $upValue, $downValue ) {
|
658 |
-
if( is_array( $BYvalue ) &&
|
659 |
-
( in_array( $upValue, $BYvalue ) || in_array( $downValue, $BYvalue )))
|
660 |
-
return true;
|
661 |
-
elseif(( $BYvalue == $upValue ) || ( $BYvalue == $downValue ))
|
662 |
-
return true;
|
663 |
-
else
|
664 |
-
return false;
|
665 |
-
}
|
666 |
-
/**
|
667 |
-
* (re-)Calculate internal index, recur2date help function
|
668 |
-
*
|
669 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
670 |
-
* @since 2.6.12 - 2011-01-03
|
671 |
-
* @param string $freq
|
672 |
-
* @param array $date
|
673 |
-
* @param int $wkst
|
674 |
-
* @return bool
|
675 |
-
* @access private
|
676 |
-
* @static
|
677 |
-
*/
|
678 |
-
private static function recurIntervalIx( $freq, $date, $wkst ) {
|
679 |
-
/* create interval index */
|
680 |
-
switch( $freq ) {
|
681 |
-
case self::$YEARLY :
|
682 |
-
$intervalix = $date[util::$LCYEAR];
|
683 |
-
break;
|
684 |
-
case self::$MONTHLY :
|
685 |
-
$intervalix = $date[util::$LCYEAR] . util::$MINUS . $date[util::$LCMONTH];
|
686 |
-
break;
|
687 |
-
case self::$WEEKLY :
|
688 |
-
$intervalix = (int) date( self::$W,
|
689 |
-
mktime( 0,
|
690 |
-
0,
|
691 |
-
$wkst,
|
692 |
-
(int) $date[util::$LCMONTH],
|
693 |
-
(int) $date[util::$LCDAY],
|
694 |
-
(int) $date[util::$LCYEAR] ));
|
695 |
-
break;
|
696 |
-
case self::$DAILY :
|
697 |
-
default:
|
698 |
-
$intervalix = $date[util::$LCYEAR] .
|
699 |
-
util::$MINUS .
|
700 |
-
$date[util::$LCMONTH] .
|
701 |
-
util::$MINUS .
|
702 |
-
$date[util::$LCDAY];
|
703 |
-
break;
|
704 |
-
}
|
705 |
-
return $intervalix;
|
706 |
-
}
|
707 |
-
/**
|
708 |
-
* Return updated date, array and timpstamp
|
709 |
-
*
|
710 |
-
* @param array $date date to step
|
711 |
-
* @param string $dateYMD date YMD
|
712 |
-
* @param array $step default array( util::$LCDAY => 1 )
|
713 |
-
* @return void
|
714 |
-
* @access private
|
715 |
-
* @static
|
716 |
-
*/
|
717 |
-
private static function stepdate( & $date, & $dateYMD, $step=null ) {
|
718 |
-
static $t = 't';
|
719 |
-
if( is_null( $step ))
|
720 |
-
$step = [util::$LCDAY => 1];
|
721 |
-
if( ! isset( $date[util::$LCHOUR] ))
|
722 |
-
$date[util::$LCHOUR] = 0;
|
723 |
-
if( ! isset( $date[util::$LCMIN] ))
|
724 |
-
$date[util::$LCMIN] = 0;
|
725 |
-
if( ! isset( $date[util::$LCSEC] ))
|
726 |
-
$date[util::$LCSEC] = 0;
|
727 |
-
if( isset( $step[util::$LCDAY] ))
|
728 |
-
$mcnt = date( $t,
|
729 |
-
mktime( (int) $date[util::$LCHOUR],
|
730 |
-
(int) $date[util::$LCMIN],
|
731 |
-
(int) $date[util::$LCSEC],
|
732 |
-
(int) $date[util::$LCMONTH],
|
733 |
-
(int) $date[util::$LCDAY],
|
734 |
-
(int) $date[util::$LCYEAR] ));
|
735 |
-
foreach( $step as $stepix => $stepvalue )
|
736 |
-
$date[$stepix] += $stepvalue;
|
737 |
-
if( isset( $step[util::$LCMONTH] )) {
|
738 |
-
if( 12 < $date[util::$LCMONTH] ) {
|
739 |
-
$date[util::$LCYEAR] += 1;
|
740 |
-
$date[util::$LCMONTH] -= 12;
|
741 |
-
}
|
742 |
-
}
|
743 |
-
elseif( isset( $step[util::$LCDAY] )) {
|
744 |
-
if( $mcnt < $date[util::$LCDAY] ) {
|
745 |
-
$date[util::$LCDAY] -= $mcnt;
|
746 |
-
$date[util::$LCMONTH] += 1;
|
747 |
-
if( 12 < $date[util::$LCMONTH] ) {
|
748 |
-
$date[util::$LCYEAR] += 1;
|
749 |
-
$date[util::$LCMONTH] -= 12;
|
750 |
-
}
|
751 |
-
}
|
752 |
-
}
|
753 |
-
$dateYMD = sprintf( util::$YMD, (int) $date[util::$LCYEAR],
|
754 |
-
(int) $date[util::$LCMONTH],
|
755 |
-
(int) $date[util::$LCDAY] );
|
756 |
-
}
|
757 |
-
/**
|
758 |
-
* Return initiated $daycnts
|
759 |
-
*
|
760 |
-
* @param array $wdate
|
761 |
-
* @param array $recur
|
762 |
-
* @param int $wkst
|
763 |
-
* @return array
|
764 |
-
* @access private
|
765 |
-
* @static
|
766 |
-
*/
|
767 |
-
private static function initDayCnts( array $wdate, array $recur, $wkst ) {
|
768 |
-
$daycnts = [];
|
769 |
-
$yeardaycnt = [];
|
770 |
-
$yeardays = 0;
|
771 |
-
foreach( self::$DAYNAMES as $dn )
|
772 |
-
$yeardaycnt[$dn] = 0;
|
773 |
-
for( $m = 1; $m <= 12; $m++ ) { // count up and update up-counters
|
774 |
-
$daycnts[$m] = [];
|
775 |
-
$weekdaycnt = [];
|
776 |
-
foreach( self::$DAYNAMES as $dn )
|
777 |
-
$weekdaycnt[$dn] = 0;
|
778 |
-
$mcnt = date( 't', mktime( 0, 0, 0, $m, 1, $wdate[util::$LCYEAR] ));
|
779 |
-
for( $d = 1; $d <= $mcnt; $d++ ) {
|
780 |
-
$daycnts[$m][$d] = [];
|
781 |
-
if( isset( $recur[util::$BYYEARDAY] )) {
|
782 |
-
$yeardays++;
|
783 |
-
$daycnts[$m][$d][self::$YEARCNT_UP] = $yeardays;
|
784 |
-
}
|
785 |
-
if( isset( $recur[util::$BYDAY] )) {
|
786 |
-
$day = date( 'w', mktime( 0, 0, 0, $m, $d, $wdate[util::$LCYEAR] ));
|
787 |
-
$day = self::$DAYNAMES[$day];
|
788 |
-
$daycnts[$m][$d][util::$DAY] = $day;
|
789 |
-
$weekdaycnt[$day]++;
|
790 |
-
$daycnts[$m][$d][self::$MONTHDAYNO_UP] = $weekdaycnt[$day];
|
791 |
-
$yeardaycnt[$day]++;
|
792 |
-
$daycnts[$m][$d][self::$YEARDAYNO_UP] = $yeardaycnt[$day];
|
793 |
-
}
|
794 |
-
if( isset( $recur[util::$BYWEEKNO] ) ||
|
795 |
-
( $recur[util::$FREQ] == self::$WEEKLY ))
|
796 |
-
$daycnts[$m][$d][self::$WEEKNO_UP] = (int) date( self::$W,
|
797 |
-
mktime( 0,
|
798 |
-
0,
|
799 |
-
$wkst,
|
800 |
-
$m,
|
801 |
-
$d,
|
802 |
-
$wdate[util::$LCYEAR] ));
|
803 |
-
} // end for( $d = 1; $d <= $mcnt; $d++ )
|
804 |
-
} // end for( $m = 1; $m <= 12; $m++ )
|
805 |
-
$daycnt = 0;
|
806 |
-
$yeardaycnt = [];
|
807 |
-
if( isset( $recur[util::$BYWEEKNO] ) ||
|
808 |
-
( $recur[util::$FREQ] == self::$WEEKLY )) {
|
809 |
-
$weekno = null;
|
810 |
-
for( $d=31; $d > 25; $d-- ) { // get last weekno for year
|
811 |
-
if( ! $weekno )
|
812 |
-
$weekno = $daycnts[12][$d][self::$WEEKNO_UP];
|
813 |
-
elseif( $weekno < $daycnts[12][$d][self::$WEEKNO_UP] ) {
|
814 |
-
$weekno = $daycnts[12][$d][self::$WEEKNO_UP];
|
815 |
-
break;
|
816 |
-
}
|
817 |
-
}
|
818 |
-
}
|
819 |
-
for( $m = 12; $m > 0; $m-- ) { // count down and update down-counters
|
820 |
-
$weekdaycnt = [];
|
821 |
-
foreach( self::$DAYNAMES as $dn )
|
822 |
-
$yeardaycnt[$dn] = $weekdaycnt[$dn] = 0;
|
823 |
-
$monthcnt = 0;
|
824 |
-
$mcnt = date( 't', mktime( 0, 0, 0, $m, 1, $wdate[util::$LCYEAR] ));
|
825 |
-
for( $d = $mcnt; $d > 0; $d-- ) {
|
826 |
-
if( isset( $recur[util::$BYYEARDAY] )) {
|
827 |
-
$daycnt -= 1;
|
828 |
-
$daycnts[$m][$d][self::$YEARCNT_DOWN] = $daycnt;
|
829 |
-
}
|
830 |
-
if( isset( $recur[util::$BYMONTHDAY] )) {
|
831 |
-
$monthcnt -= 1;
|
832 |
-
$daycnts[$m][$d][self::$MONTHCNT_DOWN] = $monthcnt;
|
833 |
-
}
|
834 |
-
if( isset( $recur[util::$BYDAY] )) {
|
835 |
-
$day = $daycnts[$m][$d][util::$DAY];
|
836 |
-
$weekdaycnt[$day] -= 1;
|
837 |
-
$daycnts[$m][$d][self::$MONTHDAYNO_DOWN] = $weekdaycnt[$day];
|
838 |
-
$yeardaycnt[$day] -= 1;
|
839 |
-
$daycnts[$m][$d][self::$YEARDAYNO_DOWN] = $yeardaycnt[$day];
|
840 |
-
}
|
841 |
-
if( isset( $recur[util::$BYWEEKNO] ) ||
|
842 |
-
( $recur[util::$FREQ] == self::$WEEKLY ))
|
843 |
-
$daycnts[$m][$d][self::$WEEKNO_DOWN] = ( $daycnts[$m][$d][self::$WEEKNO_UP] - $weekno - 1 );
|
844 |
-
}
|
845 |
-
} // end for( $m = 12; $m > 0; $m-- )
|
846 |
-
return $daycnts;
|
847 |
-
}
|
848 |
-
/**
|
849 |
-
* Return a reformatted input date
|
850 |
-
*
|
851 |
-
* @param mixed $aDate
|
852 |
-
* @access private
|
853 |
-
* @static
|
854 |
-
*/
|
855 |
-
private static function reFormatDate( & $aDate ) {
|
856 |
-
static $YMDHIS2 = 'Y-m-d H:i:s';
|
857 |
-
switch( true ) {
|
858 |
-
case ( is_string( $aDate )) :
|
859 |
-
util::strDate2arr( $aDate );
|
860 |
-
break;
|
861 |
-
case ( util::isDateTimeClass( $aDate )) :
|
862 |
-
$aDate = $aDate->format( $YMDHIS2 );
|
863 |
-
util::strDate2arr( $aDate );
|
864 |
-
break;
|
865 |
-
default :
|
866 |
-
break;
|
867 |
-
}
|
868 |
-
foreach( $aDate as $k => $v ) {
|
869 |
-
if( ctype_digit( $v ))
|
870 |
-
$aDate[$k] = (int) $v;
|
871 |
-
}
|
872 |
-
}
|
873 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/util/utilRedirect.php
DELETED
@@ -1,129 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\util;
|
32 |
-
use kigkonsult\iCalcreator\vcalendar;
|
33 |
-
/**
|
34 |
-
* iCalcreator redirect support class
|
35 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
36 |
-
* @since 2.23.6 - 2017-04-13
|
37 |
-
*/
|
38 |
-
class utilRedirect {
|
39 |
-
/**
|
40 |
-
* HTTP headers
|
41 |
-
*
|
42 |
-
* @var array $headers
|
43 |
-
* @access private
|
44 |
-
* @static
|
45 |
-
*/
|
46 |
-
private static $headers = ['Content-Encoding: gzip',
|
47 |
-
'Vary: *',
|
48 |
-
'Content-Length: %s',
|
49 |
-
'Content-Type: text/calendar; charset=utf-8',
|
50 |
-
'Content-Disposition: attachment; filename="%s"',
|
51 |
-
'Content-Disposition: inline; filename="%s"',
|
52 |
-
'Cache-Control: max-age=10'];
|
53 |
-
/**
|
54 |
-
* Return created, updated and/or parsed calendar, sending a HTTP redirect header.
|
55 |
-
*
|
56 |
-
* @param vcalendar $calendar
|
57 |
-
* @param bool $utf8Encode
|
58 |
-
* @param bool $gzip
|
59 |
-
* @param bool $cdType true : Content-Disposition: attachment... (default), false : ...inline...
|
60 |
-
* @return bool true on success, false on error
|
61 |
-
* @static
|
62 |
-
*/
|
63 |
-
public static function returnCalendar( vcalendar $calendar,
|
64 |
-
$utf8Encode=false,
|
65 |
-
$gzip=false,
|
66 |
-
$cdType=true ) {
|
67 |
-
static $ICR = 'iCr';
|
68 |
-
$filename = $calendar->getConfig( util::$FILENAME );
|
69 |
-
$output = $calendar->createCalendar();
|
70 |
-
if( $utf8Encode )
|
71 |
-
$output = utf8_encode( $output );
|
72 |
-
$fsize = null;
|
73 |
-
if( $gzip ) {
|
74 |
-
$output = gzencode( $output, 9 );
|
75 |
-
$fsize = strlen( $output );
|
76 |
-
header( self::$headers[0] );
|
77 |
-
header( self::$headers[1] );
|
78 |
-
}
|
79 |
-
else {
|
80 |
-
if( false !== ( $temp = tempnam( sys_get_temp_dir(), $ICR ))) {
|
81 |
-
if( false !== file_put_contents( $temp, $output ))
|
82 |
-
$fsize = @filesize( $temp );
|
83 |
-
unlink( $temp );
|
84 |
-
}
|
85 |
-
}
|
86 |
-
if( ! empty( $fsize ))
|
87 |
-
header( sprintf( self::$headers[2], $fsize ));
|
88 |
-
header( self::$headers[3] );
|
89 |
-
$cdType = ( $cdType ) ? 4 : 5;
|
90 |
-
header( sprintf( self::$headers[$cdType], $filename ));
|
91 |
-
header( self::$headers[6] );
|
92 |
-
echo $output;
|
93 |
-
return true;
|
94 |
-
}
|
95 |
-
/**
|
96 |
-
* If recent version of calendar file exists (default one hour), an HTTP redirect header is sent
|
97 |
-
*
|
98 |
-
* @param vcalendar $calendar
|
99 |
-
* @param int $timeout default 3600 sec
|
100 |
-
* @param bool $cdType true : Content-Disposition: attachment... (default), false : ...inline...
|
101 |
-
* @return bool true on success, false on error
|
102 |
-
* @static
|
103 |
-
*/
|
104 |
-
public static function useCachedCalendar( vcalendar $calendar,
|
105 |
-
$timeout=3600,
|
106 |
-
$cdType=true ) {
|
107 |
-
static $R = 'r';
|
108 |
-
if( false === ( $dirfile = $calendar->getConfig( util::$URL )))
|
109 |
-
$dirfile = $calendar->getConfig( util::$DIRFILE );
|
110 |
-
if( ! is_file( $dirfile ) || ! is_readable( $dirfile ))
|
111 |
-
return false;
|
112 |
-
if( time() - filemtime( $dirfile ) > $timeout )
|
113 |
-
return false;
|
114 |
-
clearstatcache();
|
115 |
-
$fsize = @filesize( $dirfile );
|
116 |
-
$filename = $calendar->getConfig( util::$FILENAME );
|
117 |
-
header( self::$headers[3] );
|
118 |
-
if( ! empty( $fsize ))
|
119 |
-
header( sprintf( self::$headers[2], $fsize ));
|
120 |
-
$cdType = ( $cdType ) ? 4 : 5;
|
121 |
-
header( sprintf( self::$headers[$cdType], $filename ));
|
122 |
-
header( self::$headers[6] );
|
123 |
-
if( false === ( $fp = @fopen( $dirfile, $R )))
|
124 |
-
return false;
|
125 |
-
fpassthru( $fp );
|
126 |
-
fclose( $fp );
|
127 |
-
return true;
|
128 |
-
}
|
129 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/util/utilRexdate.php
DELETED
@@ -1,536 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24.1
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator\util;
|
32 |
-
/**
|
33 |
-
* iCalcreator EXDATE/RDATE support class
|
34 |
-
*
|
35 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
36 |
-
* @since 2.24.1 - 2018-10-22
|
37 |
-
*/
|
38 |
-
class utilRexdate {
|
39 |
-
/**
|
40 |
-
* Check (EXDATE/RDATE) date(-time) and params arrays for an opt. timezone
|
41 |
-
*
|
42 |
-
* If it is a DATE-TIME or DATE, updates $parno and (opt) $params)
|
43 |
-
* @param array $theDate date to check
|
44 |
-
* @param int $parno no of date parts (i.e. year, month.. .)
|
45 |
-
* @param array $params property parameters
|
46 |
-
* @access private
|
47 |
-
* @static
|
48 |
-
*/
|
49 |
-
private static function chkDateCfg( $theDate, & $parno, & $params ) {
|
50 |
-
$paramsValueIsDATE = util::isParamsValueSet( [util::$LCparams => $params],
|
51 |
-
util::$DATE );
|
52 |
-
switch( true ) {
|
53 |
-
case ( isset( $params[util::$TZID] )) :
|
54 |
-
$parno = 6;
|
55 |
-
break;
|
56 |
-
case ( $paramsValueIsDATE ) :
|
57 |
-
$params[util::$VALUE] = util::$DATE;
|
58 |
-
$parno = 3;
|
59 |
-
break;
|
60 |
-
default:
|
61 |
-
if( util::isParamsValueSet( [util::$LCparams => $params],
|
62 |
-
util::$PERIOD )) {
|
63 |
-
$params[util::$VALUE] = util::$PERIOD;
|
64 |
-
$parno = 7;
|
65 |
-
}
|
66 |
-
switch( true ) {
|
67 |
-
case ( is_array( $theDate )) :
|
68 |
-
if( isset( $theDate[util::$LCTIMESTAMP] ))
|
69 |
-
$tzid = ( isset( $theDate[util::$LCtz] ))
|
70 |
-
? $theDate[util::$LCtz] : null;
|
71 |
-
else
|
72 |
-
$tzid = ( isset( $theDate[util::$LCtz] ))
|
73 |
-
? $theDate[util::$LCtz] : ( 7 == count( $theDate )) ? end( $theDate ) : null;
|
74 |
-
if( ! empty( $tzid )) {
|
75 |
-
$parno = 7;
|
76 |
-
if( ! util::isOffset( $tzid ))
|
77 |
-
$params[util::$TZID] = $tzid; // save only timezone
|
78 |
-
}
|
79 |
-
elseif( ! $parno &&
|
80 |
-
( 3 == count( $theDate )) &&
|
81 |
-
$paramsValueIsDATE )
|
82 |
-
$parno = 3;
|
83 |
-
else
|
84 |
-
$parno = 6;
|
85 |
-
break;
|
86 |
-
default : // i.e. string
|
87 |
-
$date = trim((string) $theDate );
|
88 |
-
if( util::$Z == substr( $date, -1 ))
|
89 |
-
$parno = 7; // UTC DATE-TIME
|
90 |
-
elseif((( 8 == strlen( $date ) && ctype_digit( $date )) ||
|
91 |
-
( 11 >= strlen( $date )))
|
92 |
-
&& $paramsValueIsDATE )
|
93 |
-
$parno = 3;
|
94 |
-
$date = util::strDate2ArrayDate( $date, $parno );
|
95 |
-
unset( $date[util::$UNPARSEDTEXT] );
|
96 |
-
if( ! empty( $date[util::$LCtz] )) {
|
97 |
-
$parno = 7;
|
98 |
-
if( ! util::isOffset( $date[util::$LCtz] ))
|
99 |
-
$params[util::$TZID] = $date[util::$LCtz]; // save only timezone
|
100 |
-
}
|
101 |
-
elseif( empty( $parno ))
|
102 |
-
$parno = 6;
|
103 |
-
} // end switch( true )
|
104 |
-
if( isset( $params[util::$TZID] ))
|
105 |
-
$parno = 6;
|
106 |
-
break;
|
107 |
-
} // end switch( true )
|
108 |
-
return true;
|
109 |
-
}
|
110 |
-
/**
|
111 |
-
* Return formatted output for calendar component property data value type recur
|
112 |
-
*
|
113 |
-
* @param array $exdateData
|
114 |
-
* @param bool $allowEmpty
|
115 |
-
* @return string
|
116 |
-
* @static
|
117 |
-
*/
|
118 |
-
public static function formatExdate( $exdateData, $allowEmpty ) {
|
119 |
-
static $SORTER1 = ['kigkonsult\iCalcreator\vcalendarSortHandler',
|
120 |
-
'sortExdate1'];
|
121 |
-
static $SORTER2 = ['kigkonsult\iCalcreator\vcalendarSortHandler',
|
122 |
-
'sortExdate2'];
|
123 |
-
$output = null;
|
124 |
-
$exdates = [];
|
125 |
-
foreach(( array_keys( $exdateData )) as $ex ) {
|
126 |
-
$theExdate = $exdateData[$ex];
|
127 |
-
if( empty( $theExdate[util::$LCvalue] )) {
|
128 |
-
if( $allowEmpty )
|
129 |
-
$output .= util::createElement( util::$EXDATE );
|
130 |
-
continue;
|
131 |
-
}
|
132 |
-
if( 1 < count( $theExdate[util::$LCvalue] ))
|
133 |
-
usort( $theExdate[util::$LCvalue], $SORTER1 );
|
134 |
-
$exdates[] = $theExdate;
|
135 |
-
}
|
136 |
-
if( 1 < count( $exdates ))
|
137 |
-
usort( $exdates, $SORTER2 );
|
138 |
-
foreach(( array_keys( $exdates )) as $ex ) {
|
139 |
-
$theExdate = $exdates[$ex];
|
140 |
-
$content = $attributes = null;
|
141 |
-
foreach(( array_keys( $theExdate[util::$LCvalue] )) as $eix ) {
|
142 |
-
$exdatePart = $theExdate[util::$LCvalue][$eix];
|
143 |
-
$parno = count( $exdatePart );
|
144 |
-
$formatted = util::date2strdate( $exdatePart, $parno );
|
145 |
-
if( isset( $theExdate[util::$LCparams][util::$TZID] ))
|
146 |
-
$formatted = str_replace( util::$Z, null, $formatted);
|
147 |
-
if( 0 < $eix ) {
|
148 |
-
if( isset( $theExdate[util::$LCvalue][0][util::$LCtz] )) {
|
149 |
-
if( ctype_digit( substr( $theExdate[util::$LCvalue][0][util::$LCtz], -4 )) ||
|
150 |
-
( util::$Z == $theExdate[util::$LCvalue][0][util::$LCtz] )) {
|
151 |
-
if( util::$Z != substr( $formatted, -1 ))
|
152 |
-
$formatted .= util::$Z;
|
153 |
-
}
|
154 |
-
else
|
155 |
-
$formatted = str_replace( util::$Z, null, $formatted );
|
156 |
-
}
|
157 |
-
else
|
158 |
-
$formatted = str_replace( util::$Z, null, $formatted );
|
159 |
-
} // end if( 0 < $eix )
|
160 |
-
$content .= ( 0 < $eix ) ? util::$COMMA . $formatted : $formatted;
|
161 |
-
} // end foreach(( array_keys( $theExdate[util::$LCvalue]...
|
162 |
-
$output .= util::createElement( util::$EXDATE,
|
163 |
-
util::createParams( $theExdate[util::$LCparams] ),
|
164 |
-
$content );
|
165 |
-
} // end foreach(( array_keys( $exdates...
|
166 |
-
return $output;
|
167 |
-
}
|
168 |
-
/**
|
169 |
-
* Return prepared calendar component property exdate input
|
170 |
-
*
|
171 |
-
* @param array $exdates
|
172 |
-
* @param array $params
|
173 |
-
* @return array
|
174 |
-
* @static
|
175 |
-
* @since 2.24.1 - 2018-10-22
|
176 |
-
*/
|
177 |
-
public static function prepInputExdate( $exdates, $params=null ) {
|
178 |
-
static $GMTUTCZARR = ['GMT', 'UTC', 'Z'];
|
179 |
-
$input = [
|
180 |
-
util::$LCparams => util::setParams( $params, util::$DEFAULTVALUEDATETIME ),
|
181 |
-
util::$LCvalue => []
|
182 |
-
];
|
183 |
-
$toZ = ( isset( $input[util::$LCparams][util::$TZID] ) &&
|
184 |
-
in_array( strtoupper( $input[util::$LCparams][util::$TZID] ),
|
185 |
-
$GMTUTCZARR ))
|
186 |
-
? true : false;
|
187 |
-
/* ev. check 1:st date and save ev. timezone **/
|
188 |
-
self::chkDateCfg( reset( $exdates ), $parno, $input[util::$LCparams] );
|
189 |
-
util::existRem( $input[util::$LCparams],
|
190 |
-
util::$VALUE,
|
191 |
-
util::$DATE_TIME ); // remove default parameter
|
192 |
-
foreach(( array_keys( $exdates )) as $eix ) {
|
193 |
-
$theExdate = $exdates[$eix];
|
194 |
-
util::strDate2arr( $theExdate );
|
195 |
-
if( util::isArrayTimestampDate( $theExdate )) {
|
196 |
-
if( isset( $theExdate[util::$LCtz] ) &&
|
197 |
-
! util::isOffset( $theExdate[util::$LCtz] )) {
|
198 |
-
if( isset( $input[util::$LCparams][util::$TZID] ))
|
199 |
-
$theExdate[util::$LCtz] = $input[util::$LCparams][util::$TZID];
|
200 |
-
else
|
201 |
-
$input[util::$LCparams][util::$TZID] = $theExdate[util::$LCtz];
|
202 |
-
}
|
203 |
-
$exdatea = util::timestamp2date( $theExdate, $parno );
|
204 |
-
}
|
205 |
-
elseif( is_array( $theExdate )) {
|
206 |
-
$d = util::chkDateArr( $theExdate, $parno );
|
207 |
-
if( isset( $d[util::$LCtz] ) &&
|
208 |
-
( util::$Z != $d[util::$LCtz] ) &&
|
209 |
-
util::isOffset( $d[util::$LCtz] )) {
|
210 |
-
$strdate = sprintf( util::$YMDHISE, (int) $d[util::$LCYEAR],
|
211 |
-
(int) $d[util::$LCMONTH],
|
212 |
-
(int) $d[util::$LCDAY],
|
213 |
-
(int) $d[util::$LCHOUR],
|
214 |
-
(int) $d[util::$LCMIN],
|
215 |
-
(int) $d[util::$LCSEC],
|
216 |
-
$d[util::$LCtz] );
|
217 |
-
$exdatea = util::strDate2ArrayDate( $strdate, 7 );
|
218 |
-
unset( $exdatea[util::$UNPARSEDTEXT] );
|
219 |
-
}
|
220 |
-
else
|
221 |
-
$exdatea = $d;
|
222 |
-
}
|
223 |
-
elseif( 8 <= strlen( trim( $theExdate ))) { // ex. 2006-08-03 10:12:18
|
224 |
-
$exdatea = util::strDate2ArrayDate( $theExdate, $parno );
|
225 |
-
unset( $exdatea[util::$UNPARSEDTEXT] );
|
226 |
-
}
|
227 |
-
if( 3 == $parno )
|
228 |
-
unset( $exdatea[util::$LCHOUR],
|
229 |
-
$exdatea[util::$LCMIN],
|
230 |
-
$exdatea[util::$LCSEC],
|
231 |
-
$exdatea[util::$LCtz] );
|
232 |
-
elseif( isset( $exdatea[util::$LCtz] ))
|
233 |
-
$exdatea[util::$LCtz] = (string) $exdatea[util::$LCtz];
|
234 |
-
if( isset( $input[util::$LCparams][util::$TZID] ) ||
|
235 |
-
( isset( $exdatea[util::$LCtz] ) &&
|
236 |
-
! util::isOffset( $exdatea[util::$LCtz] )) ||
|
237 |
-
( isset( $input[util::$LCvalue][0] ) &&
|
238 |
-
( ! isset( $input[util::$LCvalue][0][util::$LCtz] ))) ||
|
239 |
-
( isset( $input[util::$LCvalue][0][util::$LCtz] ) &&
|
240 |
-
! util::isOffset( $input[util::$LCvalue][0][util::$LCtz] )))
|
241 |
-
unset( $exdatea[util::$LCtz] );
|
242 |
-
if( $toZ ) // time zone Z
|
243 |
-
$exdatea[util::$LCtz] = util::$Z;
|
244 |
-
$input[util::$LCvalue][] = $exdatea;
|
245 |
-
} // end foreach(( array_keys( $exdates...
|
246 |
-
if( 0 >= count( $input[util::$LCvalue] ))
|
247 |
-
return false;
|
248 |
-
if( 3 == $parno ) {
|
249 |
-
$input[util::$LCparams][util::$VALUE] = util::$DATE;
|
250 |
-
unset( $input[util::$LCparams][util::$TZID] );
|
251 |
-
}
|
252 |
-
if( $toZ ) // time zone Z
|
253 |
-
unset( $input[util::$LCparams][util::$TZID] );
|
254 |
-
return $input;
|
255 |
-
}
|
256 |
-
/**
|
257 |
-
* Return formatted output for calendar component property rdate
|
258 |
-
*
|
259 |
-
* @param array $rdateData
|
260 |
-
* @param bool $allowEmpty
|
261 |
-
* @param string $objName
|
262 |
-
* @return string
|
263 |
-
* @static
|
264 |
-
*/
|
265 |
-
public static function formatRdate( $rdateData, $allowEmpty, $objName ) {
|
266 |
-
static $SORTER1 = ['kigkonsult\iCalcreator\vcalendarSortHandler',
|
267 |
-
'sortRdate1'];
|
268 |
-
static $SORTER2 = ['kigkonsult\iCalcreator\vcalendarSortHandler',
|
269 |
-
'sortRdate2'];
|
270 |
-
$utcTime = ( in_array( $objName, util::$TZCOMPS )) ? true : false;
|
271 |
-
$output = null;
|
272 |
-
$rdates = [];
|
273 |
-
foreach(( array_keys( $rdateData )) as $rpix ) {
|
274 |
-
$theRdate = $rdateData[$rpix];
|
275 |
-
if( empty( $theRdate[util::$LCvalue] )) {
|
276 |
-
if( $allowEmpty )
|
277 |
-
$output .= util::createElement( util::$RDATE );
|
278 |
-
continue;
|
279 |
-
}
|
280 |
-
if( $utcTime )
|
281 |
-
unset( $theRdate[util::$LCparams][util::$TZID] );
|
282 |
-
if( 1 < count( $theRdate[util::$LCvalue] ))
|
283 |
-
usort( $theRdate[util::$LCvalue], $SORTER1 );
|
284 |
-
$rdates[] = $theRdate;
|
285 |
-
}
|
286 |
-
if( 1 < count( $rdates ))
|
287 |
-
usort( $rdates, $SORTER2 );
|
288 |
-
foreach(( array_keys( $rdates )) as $rpix ) {
|
289 |
-
$theRdate = $rdates[$rpix];
|
290 |
-
$attributes = util::createParams( $theRdate[util::$LCparams] );
|
291 |
-
$cnt = count( $theRdate[util::$LCvalue] );
|
292 |
-
$content = null;
|
293 |
-
$rno = 1;
|
294 |
-
foreach(( array_keys( $theRdate[util::$LCvalue] )) as $rix ) {
|
295 |
-
$rdatePart = $theRdate[util::$LCvalue][$rix];
|
296 |
-
$contentPart = null;
|
297 |
-
if( is_array( $rdatePart ) &&
|
298 |
-
util::isParamsValueSet( $theRdate, util::$PERIOD )) { // PERIOD
|
299 |
-
if( $utcTime )
|
300 |
-
unset( $rdatePart[0][util::$LCtz] );
|
301 |
-
$formatted = util::date2strdate( $rdatePart[0] ); // PERIOD part 1
|
302 |
-
if( $utcTime || !empty( $theRdate[util::$LCparams][util::$TZID] ))
|
303 |
-
$formatted = str_replace( util::$Z, null, $formatted);
|
304 |
-
$contentPart .= $formatted;
|
305 |
-
$contentPart .= '/';
|
306 |
-
$cnt2 = count( $rdatePart[1]);
|
307 |
-
if( array_key_exists( util::$LCYEAR, $rdatePart[1] )) {
|
308 |
-
if( array_key_exists( util::$LCHOUR, $rdatePart[1] ))
|
309 |
-
$cnt2 = 7; // date-time
|
310 |
-
else
|
311 |
-
$cnt2 = 3; // date
|
312 |
-
}
|
313 |
-
elseif( array_key_exists( util::$LCWEEK, $rdatePart[1] )) // duration
|
314 |
-
$cnt2 = 5;
|
315 |
-
if(( 7 == $cnt2 ) && // period= -> date-time
|
316 |
-
isset( $rdatePart[1][util::$LCYEAR] ) &&
|
317 |
-
isset( $rdatePart[1][util::$LCMONTH] ) &&
|
318 |
-
isset( $rdatePart[1][util::$LCDAY] )) {
|
319 |
-
if( $utcTime )
|
320 |
-
unset( $rdatePart[1][util::$LCtz] );
|
321 |
-
$formatted = util::date2strdate( $rdatePart[1] ); // PERIOD part 2
|
322 |
-
if( $utcTime || !empty( $theRdate[util::$LCparams][util::$TZID] ))
|
323 |
-
$formatted = str_replace( util::$Z, null, $formatted );
|
324 |
-
$contentPart .= $formatted;
|
325 |
-
}
|
326 |
-
else { // period= -> dur-time
|
327 |
-
$contentPart .= util::duration2str( $rdatePart[1] );
|
328 |
-
}
|
329 |
-
} // PERIOD end
|
330 |
-
else { // SINGLE date start
|
331 |
-
if( $utcTime )
|
332 |
-
unset( $rdatePart[util::$LCtz] );
|
333 |
-
$parno = ( util::isParamsValueSet( $theRdate, util::$DATE )) ? 3 : null;
|
334 |
-
$formatted = util::date2strdate( $rdatePart, $parno );
|
335 |
-
if( $utcTime || !empty( $theRdate[util::$LCparams][util::$TZID] ))
|
336 |
-
$formatted = str_replace( util::$Z, null, $formatted);
|
337 |
-
$contentPart .= $formatted;
|
338 |
-
}
|
339 |
-
$content .= $contentPart;
|
340 |
-
if( $rno < $cnt )
|
341 |
-
$content .= util::$COMMA;
|
342 |
-
$rno++;
|
343 |
-
} // end foreach(( array_keys( $theRdate[util::$LCvalue]...
|
344 |
-
$output .= util::createElement( util::$RDATE,
|
345 |
-
$attributes,
|
346 |
-
$content );
|
347 |
-
} // foreach(( array_keys( $rdates...
|
348 |
-
return $output;
|
349 |
-
}
|
350 |
-
/**
|
351 |
-
* Return prepared calendar component property rdate input
|
352 |
-
*
|
353 |
-
* @param array $rdates
|
354 |
-
* @param array $params
|
355 |
-
* @param string $objName
|
356 |
-
* @return array
|
357 |
-
* @static
|
358 |
-
*/
|
359 |
-
public static function prepInputRdate( $rdates, $params, $objName ) {
|
360 |
-
static $PREFIXARR = ['P', '+', '-'];
|
361 |
-
static $GMTUTCZARR = ['GMT', 'UTC', 'Z'];
|
362 |
-
$input = [util::$LCparams => util::setParams( $params,
|
363 |
-
util::$DEFAULTVALUEDATETIME )];
|
364 |
-
if( in_array( $objName, util::$TZCOMPS )) {
|
365 |
-
unset( $input[util::$LCparams][util::$TZID] );
|
366 |
-
$input[util::$LCparams][util::$VALUE] = util::$DATE_TIME;
|
367 |
-
}
|
368 |
-
$toZ = ( isset( $params[util::$TZID] ) &&
|
369 |
-
in_array( strtoupper( $params[util::$TZID] ),
|
370 |
-
$GMTUTCZARR ))
|
371 |
-
? true : false;
|
372 |
-
/* check if PERIOD, if not set */
|
373 |
-
if(( ! isset( $input[util::$LCparams][util::$VALUE] ) ||
|
374 |
-
( ! util::isParamsValueSet( $input, util::$DATE ) &&
|
375 |
-
! util::isParamsValueSet( $input, util::$PERIOD ))) &&
|
376 |
-
isset( $rdates[0] ) && is_array( $rdates[0] ) && ( 2 == count( $rdates[0] )) &&
|
377 |
-
isset( $rdates[0][0] ) && isset( $rdates[0][1] ) && ! isset( $rdates[0][util::$LCTIMESTAMP] ) &&
|
378 |
-
(( is_array( $rdates[0][0] ) && ( isset( $rdates[0][0][util::$LCTIMESTAMP] ) ||
|
379 |
-
util::isArrayDate( $rdates[0][0] ))) ||
|
380 |
-
( is_string( $rdates[0][0] ) && ( 8 <= strlen( trim( $rdates[0][0] ))))) &&
|
381 |
-
( is_array( $rdates[0][1] ) || ( is_string( $rdates[0][1] ) && ( 3 <= strlen( trim( $rdates[0][1] ))))))
|
382 |
-
$input[util::$LCparams][util::$VALUE] = util::$PERIOD;
|
383 |
-
/* check 1:st date, upd. $parno (opt) and save opt. timezone **/
|
384 |
-
$date = reset( $rdates );
|
385 |
-
if( isset( $input[util::$LCparams][util::$VALUE] ) &&
|
386 |
-
( util::$PERIOD == $input[util::$LCparams][util::$VALUE] )) // PERIOD
|
387 |
-
$date = reset( $date );
|
388 |
-
self::chkDateCfg( $date, $parno, $input[util::$LCparams] );
|
389 |
-
util::existRem( $input[util::$LCparams],
|
390 |
-
util::$VALUE,
|
391 |
-
util::$DATE_TIME ); // remove default
|
392 |
-
foreach( $rdates as $rpix => $theRdate ) {
|
393 |
-
$inputa = null;
|
394 |
-
util::strDate2arr( $theRdate );
|
395 |
-
if( is_array( $theRdate )) {
|
396 |
-
if( isset( $input[util::$LCparams][util::$VALUE] ) &&
|
397 |
-
( util::$PERIOD == $input[util::$LCparams][util::$VALUE] )) { // PERIOD
|
398 |
-
foreach( $theRdate as $rix => $rPeriod ) {
|
399 |
-
util::strDate2arr( $theRdate );
|
400 |
-
if( is_array( $rPeriod )) {
|
401 |
-
if( util::isArrayTimestampDate( $rPeriod )) { // timestamp
|
402 |
-
if( isset( $rPeriod[util::$LCtz] ) &&
|
403 |
-
! util::isOffset( $rPeriod[util::$LCtz] )) {
|
404 |
-
if( isset( $input[util::$LCparams][util::$TZID] ))
|
405 |
-
$rPeriod[util::$LCtz] = $input[util::$LCparams][util::$TZID];
|
406 |
-
else
|
407 |
-
$input[util::$LCparams][util::$TZID] = $rPeriod[util::$LCtz];
|
408 |
-
}
|
409 |
-
$inputab = util::timestamp2date( $rPeriod, $parno );
|
410 |
-
} // end if( util::isArrayTimestampDate( $rPeriod ))
|
411 |
-
elseif( util::isArrayDate( $rPeriod )) {
|
412 |
-
$d = ( 3 < count ( $rPeriod ))
|
413 |
-
? util::chkDateArr( $rPeriod, $parno )
|
414 |
-
: util::chkDateArr( $rPeriod, 6 );
|
415 |
-
if( isset( $d[util::$LCtz] ) &&
|
416 |
-
( util::$Z != $d[util::$LCtz] ) &&
|
417 |
-
util::isOffset( $d[util::$LCtz] )) {
|
418 |
-
$inputab = util::strDate2ArrayDate( sprintf( util::$YMDHISE,
|
419 |
-
(int) $d[util::$LCYEAR],
|
420 |
-
(int) $d[util::$LCMONTH],
|
421 |
-
(int) $d[util::$LCDAY],
|
422 |
-
(int) $d[util::$LCHOUR],
|
423 |
-
(int) $d[util::$LCMIN],
|
424 |
-
(int) $d[util::$LCSEC],
|
425 |
-
$d[util::$LCtz] ),
|
426 |
-
7 );
|
427 |
-
unset( $inputab[util::$UNPARSEDTEXT] );
|
428 |
-
}
|
429 |
-
else
|
430 |
-
$inputab = $d;
|
431 |
-
} // end elseif( util::isArrayDate( $rPeriod ))
|
432 |
-
elseif(( 1 == count( $rPeriod )) &&
|
433 |
-
( 8 <= strlen( reset( $rPeriod )))) { // text-date
|
434 |
-
$inputab = util::strDate2ArrayDate( reset( $rPeriod ), $parno );
|
435 |
-
unset( $inputab[util::$UNPARSEDTEXT] );
|
436 |
-
}
|
437 |
-
else // array format duration
|
438 |
-
$inputab = util::duration2arr( $rPeriod );
|
439 |
-
} // end if( is_array( $rPeriod ))
|
440 |
-
elseif(( 3 <= strlen( trim( $rPeriod ))) && // string format duration
|
441 |
-
( in_array( $rPeriod[0], $PREFIXARR ))) {
|
442 |
-
if( 'P' != $rPeriod[0] )
|
443 |
-
$rPeriod = substr( $rPeriod, 1 );
|
444 |
-
$inputab = util::durationStr2arr( $rPeriod );
|
445 |
-
}
|
446 |
-
elseif( 8 <= strlen( trim( $rPeriod ))) { // text date ex. 2006-08-03 10:12:18
|
447 |
-
$inputab = util::strDate2ArrayDate( $rPeriod, $parno );
|
448 |
-
unset( $inputab[util::$UNPARSEDTEXT] );
|
449 |
-
}
|
450 |
-
if(( 0 == $rpix ) && ( 0 == $rix )) {
|
451 |
-
if( isset( $inputab[util::$LCtz] ) &&
|
452 |
-
in_array( strtoupper( $inputab[util::$LCtz] ),
|
453 |
-
$GMTUTCZARR )) {
|
454 |
-
$inputab[util::$LCtz] = util::$Z;
|
455 |
-
$toZ = true;
|
456 |
-
}
|
457 |
-
}
|
458 |
-
else {
|
459 |
-
if( isset( $inputa[0][util::$LCtz] ) &&
|
460 |
-
( util::$Z == $inputa[0][util::$LCtz] ) &&
|
461 |
-
isset( $inputab[util::$LCYEAR] ))
|
462 |
-
$inputab[util::$LCtz] = util::$Z;
|
463 |
-
else
|
464 |
-
unset( $inputab[util::$LCtz] );
|
465 |
-
}
|
466 |
-
if( $toZ && isset( $inputab[util::$LCYEAR] ) )
|
467 |
-
$inputab[util::$LCtz] = util::$Z;
|
468 |
-
$inputa[] = $inputab;
|
469 |
-
} // end foreach( $theRdate as $rix => $rPeriod )
|
470 |
-
} // PERIOD end
|
471 |
-
elseif ( util::isArrayTimestampDate( $theRdate )) { // timestamp
|
472 |
-
if( isset( $theRdate[util::$LCtz] ) &&
|
473 |
-
! util::isOffset( $theRdate[util::$LCtz] )) {
|
474 |
-
if( isset( $input[util::$LCparams][util::$TZID] ))
|
475 |
-
$theRdate[util::$LCtz] = $input[util::$LCparams][util::$TZID];
|
476 |
-
else
|
477 |
-
$input[util::$LCparams][util::$TZID] = $theRdate[util::$LCtz];
|
478 |
-
}
|
479 |
-
$inputa = util::timestamp2date( $theRdate, $parno );
|
480 |
-
}
|
481 |
-
else { // date[-time]
|
482 |
-
$inputa = util::chkDateArr( $theRdate, $parno );
|
483 |
-
if( isset( $inputa[util::$LCtz] ) &&
|
484 |
-
( util::$Z != $inputa[util::$LCtz] ) &&
|
485 |
-
util::isOffset( $inputa[util::$LCtz] )) {
|
486 |
-
$inputa = util::strDate2ArrayDate( sprintf( util::$YMDHISE,
|
487 |
-
(int) $inputa[util::$LCYEAR],
|
488 |
-
(int) $inputa[util::$LCMONTH],
|
489 |
-
(int) $inputa[util::$LCDAY],
|
490 |
-
(int) $inputa[util::$LCHOUR],
|
491 |
-
(int) $inputa[util::$LCMIN],
|
492 |
-
(int) $inputa[util::$LCSEC],
|
493 |
-
$inputa[util::$LCtz] ),
|
494 |
-
7 );
|
495 |
-
unset( $inputa[util::$UNPARSEDTEXT] );
|
496 |
-
}
|
497 |
-
}
|
498 |
-
} // end if( is_array( $theRdate ))
|
499 |
-
elseif( 8 <= strlen( trim( $theRdate ))) { // text date ex. 2006-08-03 10:12:18
|
500 |
-
$inputa = util::strDate2ArrayDate( $theRdate, $parno );
|
501 |
-
unset( $inputa[util::$UNPARSEDTEXT] );
|
502 |
-
if( $toZ )
|
503 |
-
$inputa[util::$LCtz] = util::$Z;
|
504 |
-
}
|
505 |
-
if( ! isset( $input[util::$LCparams][util::$VALUE] ) ||
|
506 |
-
( util::$PERIOD != $input[util::$LCparams][util::$VALUE] )) { // no PERIOD
|
507 |
-
if(( 0 == $rpix ) && !$toZ )
|
508 |
-
$toZ = ( isset( $inputa[util::$LCtz] ) &&
|
509 |
-
in_array( strtoupper( $inputa[util::$LCtz] ), $GMTUTCZARR ))
|
510 |
-
? true : false;
|
511 |
-
if( $toZ )
|
512 |
-
$inputa[util::$LCtz] = util::$Z;
|
513 |
-
if( 3 == $parno )
|
514 |
-
unset( $inputa[util::$LCHOUR],
|
515 |
-
$inputa[util::$LCMIN],
|
516 |
-
$inputa[util::$LCSEC],
|
517 |
-
$inputa[util::$LCtz] );
|
518 |
-
elseif( isset( $inputa[util::$LCtz] ))
|
519 |
-
$inputa[util::$LCtz] = (string) $inputa[util::$LCtz];
|
520 |
-
if( isset( $input[util::$LCparams][util::$TZID] ) ||
|
521 |
-
( isset( $input[util::$LCvalue][0] ) &&
|
522 |
-
( ! isset( $input[util::$LCvalue][0][util::$LCtz] ))))
|
523 |
-
if( !$toZ )
|
524 |
-
unset( $inputa[util::$LCtz] );
|
525 |
-
}
|
526 |
-
$input[util::$LCvalue][] = $inputa;
|
527 |
-
}
|
528 |
-
if( 3 == $parno ) {
|
529 |
-
$input[util::$LCparams][util::$VALUE] = util::$DATE;
|
530 |
-
unset( $input[util::$LCparams][util::$TZID] );
|
531 |
-
}
|
532 |
-
if( $toZ )
|
533 |
-
unset( $input[util::$LCparams][util::$TZID] );
|
534 |
-
return $input;
|
535 |
-
}
|
536 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/util/utilSelect.php
DELETED
@@ -1,786 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2018 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24.2
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
|
32 |
-
namespace kigkonsult\iCalcreator\util;
|
33 |
-
|
34 |
-
use kigkonsult\iCalcreator\vcalendar;
|
35 |
-
use kigkonsult\iCalcreator\calendarComponent;
|
36 |
-
use kigkonsult\iCalcreator\vcalendarSortHandler;
|
37 |
-
use kigkonsult\iCalcreator\iCaldateTime;
|
38 |
-
use DateInterval;
|
39 |
-
/**
|
40 |
-
* iCalcreator geo support class
|
41 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
42 |
-
* @since 2.24.2 - 2018-10-30
|
43 |
-
*/
|
44 |
-
class utilSelect {
|
45 |
-
/**
|
46 |
-
* Return selected components from calendar on date or selectOption basis
|
47 |
-
*
|
48 |
-
* DTSTART MUST be set for every component.
|
49 |
-
* No check of date.
|
50 |
-
* @param object $calendar
|
51 |
-
* @param mixed $startY (int) start Year, default current Year
|
52 |
-
* ALT. (obj) start date (datetime)
|
53 |
-
* ALT. array selecOptions ( *[ <propName> => <uniqueValue> ] )
|
54 |
-
* @param mixed $startM (int) start Month, default current Month
|
55 |
-
* ALT. (obj) end date (datetime)
|
56 |
-
* @param int $startD start Day, default current Day
|
57 |
-
* @param int $endY end Year, default $startY
|
58 |
-
* @param int $endM end Month, default $startM
|
59 |
-
* @param int $endD end Day, default $startD
|
60 |
-
* @param mixed $cType calendar component type(-s), default false=all else string/array type(-s)
|
61 |
-
* @param bool $flat false (default) => output : array[Year][Month][Day][]
|
62 |
-
* true => output : array[] (ignores split)
|
63 |
-
* @param bool $any true (default) - select component(-s) that occurs within period
|
64 |
-
* false - only component(-s) that starts within period
|
65 |
-
* @param bool $split true (default) - one component copy every DAY it occurs during the
|
66 |
-
* period (implies flat=false)
|
67 |
-
* false - one occurance of component only in output array
|
68 |
-
* @return mixed array on success, bool false on error
|
69 |
-
* @static
|
70 |
-
* @since 2.24.2 - 2018-10-29
|
71 |
-
*/
|
72 |
-
public static function selectComponents(
|
73 |
-
vcalendar $calendar,
|
74 |
-
$startY = null,
|
75 |
-
$startM = null,
|
76 |
-
$startD = null,
|
77 |
-
$endY = null,
|
78 |
-
$endM = null,
|
79 |
-
$endD = null,
|
80 |
-
$cType = null,
|
81 |
-
$flat = null,
|
82 |
-
$any = null,
|
83 |
-
$split = null
|
84 |
-
) {
|
85 |
-
static $Y = 'Y';
|
86 |
-
static $M = 'm';
|
87 |
-
static $D = 'd';
|
88 |
-
static $STRTOLOWER = 'strtolower';
|
89 |
-
static $P1D = 'P1D';
|
90 |
-
static $DTENDEXIST = 'dtendExist';
|
91 |
-
static $DUEEXIST = 'dueExist';
|
92 |
-
static $DURATIONEXIST = 'durationExist';
|
93 |
-
static $ENDALLDAYEVENT = 'endAllDayEvent';
|
94 |
-
static $MINUS1DAY = '-1 day';
|
95 |
-
static $RANGE = 'RANGE';
|
96 |
-
static $THISANDFUTURE = 'THISANDFUTURE';
|
97 |
-
static $YMDHIS2 = 'Y-m-d H:i:s';
|
98 |
-
static $PRA = '%a';
|
99 |
-
static $YMD2 = 'Y-m-d';
|
100 |
-
static $DAYOFDAYS = 'day %d of %d';
|
101 |
-
static $SORTER = ['kigkonsult\iCalcreator\vcalendarSortHandler', 'cmpfcn'];
|
102 |
-
/* check if empty calendar */
|
103 |
-
if( 1 > $calendar->countComponents())
|
104 |
-
return false;
|
105 |
-
if( is_array( $startY ))
|
106 |
-
return self::selectComponents2( $calendar, $startY );
|
107 |
-
/* check default dates */
|
108 |
-
if( util::isDateTimeClass( $startY ) &&
|
109 |
-
util::isDateTimeClass( $startM )) {
|
110 |
-
$endY = $startM->format( $Y );
|
111 |
-
$endM = $startM->format( $M );
|
112 |
-
$endD = $startM->format( $D );
|
113 |
-
$startD = $startY->format( $D );
|
114 |
-
$startM = $startY->format( $M );
|
115 |
-
$startY = $startY->format( $Y );
|
116 |
-
}
|
117 |
-
else {
|
118 |
-
if( empty( $startY )) $startY = date( $Y );
|
119 |
-
if( empty( $startM )) $startM = date( $M );
|
120 |
-
if( empty( $startD )) $startD = date( $D );
|
121 |
-
if( empty( $endY )) $endY = $startY;
|
122 |
-
if( empty( $endM )) $endM = $startM;
|
123 |
-
if( empty( $endD )) $endD = $startD;
|
124 |
-
}
|
125 |
-
/* check component types */
|
126 |
-
if( empty( $cType ))
|
127 |
-
$cType = util::$VCOMPS;
|
128 |
-
else {
|
129 |
-
if( ! is_array( $cType ))
|
130 |
-
$cType = [$cType];
|
131 |
-
$cType = array_map( $STRTOLOWER, $cType );
|
132 |
-
foreach( $cType as $cix => $theType ) {
|
133 |
-
if( ! in_array( $theType, util::$VCOMPS ))
|
134 |
-
$cType[$cix] = util::$LCVEVENT;
|
135 |
-
}
|
136 |
-
$cType = array_unique( $cType );
|
137 |
-
}
|
138 |
-
$flat = ( is_null( $flat )) ? false : (bool) $flat; // defaults
|
139 |
-
$any = ( is_null( $any )) ? true : (bool) $any;
|
140 |
-
$split = ( is_null( $split )) ? true : (bool) $split;
|
141 |
-
if(( false === $flat ) && ( false === $any )) // invalid combination
|
142 |
-
$split = false;
|
143 |
-
if(( true === $flat ) && ( true === $split )) // invalid combination
|
144 |
-
$split = false;
|
145 |
-
/* iterate components */
|
146 |
-
$result = [];
|
147 |
-
$calendar->sort( util::$UID );
|
148 |
-
$compUIDcmp = null;
|
149 |
-
$exdatelist = $recurrIdList = [];
|
150 |
-
$INTERVAL_P1D = new DateInterval( $P1D );
|
151 |
-
$cix = -1;
|
152 |
-
while( $component = $calendar->getComponent()) {
|
153 |
-
$cix += 1;
|
154 |
-
if( empty( $component ))
|
155 |
-
continue;
|
156 |
-
/* skip unvalid type components */
|
157 |
-
if( ! in_array( $component->objName, $cType ))
|
158 |
-
continue;
|
159 |
-
unset( $compStart, $compEnd );
|
160 |
-
/* select start from dtstart or due if dtstart is missing */
|
161 |
-
$prop = $component->getProperty( util::$DTSTART, false, true );
|
162 |
-
if( empty( $prop ) &&
|
163 |
-
( $component->objName == util::$LCVTODO ) &&
|
164 |
-
( false === ( $prop = $component->getProperty( util::$DUE, false, true ))))
|
165 |
-
continue;
|
166 |
-
if( empty( $prop ))
|
167 |
-
continue;
|
168 |
-
/* get UID */
|
169 |
-
$compUID = $component->getProperty( util::$UID );
|
170 |
-
if( $compUIDcmp != $compUID ) {
|
171 |
-
$compUIDcmp = $compUID;
|
172 |
-
$exdatelist = $recurrIdList = [];
|
173 |
-
}
|
174 |
-
$compStart = iCaldateTime::factory( $prop[util::$LCvalue], $prop[util::$LCparams], $prop[util::$LCvalue] );
|
175 |
-
$dtstartTz = $compStart->getTimezoneName();
|
176 |
-
if( util::isParamsValueSet( $prop, util::$DATE ))
|
177 |
-
$compStartHis = null;
|
178 |
-
else {
|
179 |
-
$his = $compStart->getTime();
|
180 |
-
$compStartHis = sprintf( util::$HIS, (int) $his[0], (int) $his[1], (int) $his[2] );
|
181 |
-
}
|
182 |
-
/* get end date from dtend/due/duration properties */
|
183 |
-
if( false !== ( $prop = $component->getProperty( util::$DTEND, false, true ))) {
|
184 |
-
$compEnd = iCaldateTime::factory( $prop[util::$LCvalue], $prop[util::$LCparams], $prop[util::$LCvalue], $dtstartTz );
|
185 |
-
$compEnd->SCbools[$DTENDEXIST] = true;
|
186 |
-
}
|
187 |
-
if( empty( $prop ) &&
|
188 |
-
( $component->objName == util::$LCVTODO ) &&
|
189 |
-
( false !== ( $prop = $component->getProperty( util::$DUE, false, true )))) {
|
190 |
-
$compEnd = iCaldateTime::factory( $prop[util::$LCvalue], $prop[util::$LCparams], $prop[util::$LCvalue], $dtstartTz );
|
191 |
-
$compEnd->SCbools[$DUEEXIST] = true;
|
192 |
-
}
|
193 |
-
if( empty( $prop ) && // duration in dtend (array) format
|
194 |
-
( false !== ( $prop = $component->getProperty( util::$DURATION, false, true, true )))) {
|
195 |
-
$compEnd = iCaldateTime::factory( $prop[util::$LCvalue], $prop[util::$LCparams], $prop[util::$LCvalue], $dtstartTz );
|
196 |
-
$compEnd->SCbools[$DURATIONEXIST] = true;
|
197 |
-
}
|
198 |
-
if( ! empty( $prop ) && ! isset( $prop[util::$LCvalue][util::$LCHOUR] )) {
|
199 |
-
/* a DTEND without time part denotes an end of an event that actually ends the day before,
|
200 |
-
for an all-day event DTSTART=20071201 DTEND=20071202, taking place 20071201!!! */
|
201 |
-
$compEnd->SCbools[$ENDALLDAYEVENT] = true;
|
202 |
-
$compEnd->modify( $MINUS1DAY );
|
203 |
-
$compEnd->setTime( 23, 59, 59 );
|
204 |
-
}
|
205 |
-
unset( $prop );
|
206 |
-
if( empty( $compEnd )) {
|
207 |
-
$compDuration = null; // DateInterval, no duration
|
208 |
-
$compEnd = clone $compStart;
|
209 |
-
$compEnd->setTime( 23, 59, 59 ); // 23:59:59 the same day as start
|
210 |
-
}
|
211 |
-
else {
|
212 |
-
if( $compEnd->format( $YMD2 ) < $compStart->format( $YMD2 )) { // MUST be after start date!!
|
213 |
-
$compEnd = clone $compStart;
|
214 |
-
$compEnd->setTime( 23, 59, 59 ); // 23:59:59 the same day as start or ???
|
215 |
-
}
|
216 |
-
$compDuration = $compStart->diff( $compEnd ); // DateInterval - todo error-check
|
217 |
-
}
|
218 |
-
/* check recurrence-id (note, a missing sequence (expected here) is the same as sequence=0
|
219 |
-
so don't test for sequence), to alter when hit in dtstart/recurlist */
|
220 |
-
$recurrid = null;
|
221 |
-
if( false !== ( $prop = $component->getProperty( util::$RECURRENCE_ID, false, true ))) {
|
222 |
-
$recurrid = iCaldateTime::factory( $prop[util::$LCvalue], $prop[util::$LCparams], $prop[util::$LCvalue], $dtstartTz );
|
223 |
-
$rangeSet = ( isset( $prop[util::$LCparams][$RANGE] ) &&
|
224 |
-
( $THISANDFUTURE == $prop[util::$LCparams][$RANGE] ))
|
225 |
-
? true : false;
|
226 |
-
$recurrIdList[$recurrid->key] = [
|
227 |
-
clone $compStart,
|
228 |
-
clone $compEnd,
|
229 |
-
$compDuration, // DateInterval
|
230 |
-
$rangeSet,
|
231 |
-
clone $component
|
232 |
-
]; // change recur this day to new YmdHis/duration/range
|
233 |
-
unset( $prop );
|
234 |
-
continue; // ignore any other props in the recurrence_id component
|
235 |
-
} // end recurrence-id/sequence test
|
236 |
-
ksort( $recurrIdList, SORT_STRING );
|
237 |
-
$fcnStart = clone $compStart;
|
238 |
-
$fcnStart->setDate((int) $startY, (int) $startM, (int) $startD );
|
239 |
-
$fcnStart->setTime( 0, 0, 0 );
|
240 |
-
$fcnEnd = clone $compEnd;
|
241 |
-
$fcnEnd->setDate((int) $endY, (int) $endM, (int) $endD );
|
242 |
-
$fcnEnd->setTime( 23, 59, 59 );
|
243 |
-
/* make a list of optional exclude dates for component occurence
|
244 |
-
from exrule and exdate */
|
245 |
-
$workStart = clone $compStart;
|
246 |
-
$duration = ( ! empty( $compDuration )) ? $compDuration : $INTERVAL_P1D; // DateInterval
|
247 |
-
$workStart->sub( $duration );
|
248 |
-
$workEnd = clone $fcnEnd;
|
249 |
-
$workEnd->add( $duration );
|
250 |
-
self::getAllEXRULEdates( $component, $exdatelist,
|
251 |
-
$dtstartTz, $compStart, $workStart, $workEnd,
|
252 |
-
$compStartHis );
|
253 |
-
self::getAllEXDATEdates( $component, $exdatelist, $dtstartTz );
|
254 |
-
/* select only components within.. . */
|
255 |
-
$xRecurrence = 1;
|
256 |
-
if(( ! $any && self::inScope( $compStart, $fcnStart,
|
257 |
-
$compStart, $fcnEnd, $compStart->dateFormat )) || // (dt)start within the period
|
258 |
-
( $any && self::inScope( $fcnEnd, $compStart,
|
259 |
-
$fcnStart, $compEnd, $compStart->dateFormat ))) { // occurs within the period
|
260 |
-
/* add the selected component (WITHIN valid dates) to output array */
|
261 |
-
if( $flat ) { // any=true/false, ignores split
|
262 |
-
if( empty( $recurrid ))
|
263 |
-
$result[$compUID] = clone $component; // copy original to output (but not anyone with recurrence-id)
|
264 |
-
}
|
265 |
-
elseif( $split ) { // split the original component
|
266 |
-
if( $compStart->format( $YMDHIS2 ) < $fcnStart->format( $YMDHIS2 ))
|
267 |
-
$rstart = clone $fcnStart;
|
268 |
-
else
|
269 |
-
$rstart = clone $compStart;
|
270 |
-
if( $compEnd->format( $YMDHIS2 ) > $fcnEnd->format( $YMDHIS2 ))
|
271 |
-
$rend = clone $fcnEnd;
|
272 |
-
else
|
273 |
-
$rend = clone $compEnd;
|
274 |
-
if( ! isset( $exdatelist[$rstart->key] )) { // not excluded in exrule/exdate
|
275 |
-
if( isset( $recurrIdList[$rstart->key] )) { // change start day to new YmdHis/duration
|
276 |
-
$k = $rstart->key;
|
277 |
-
$rstart = clone $recurrIdList[$k][0];
|
278 |
-
$startHis = $rstart->getTime();
|
279 |
-
$rend = clone $rstart;
|
280 |
-
if( ! empty( $recurrIdList[$k][2] )) { // DateInterval
|
281 |
-
$rend->add( $recurrIdList[$k][2] );
|
282 |
-
}
|
283 |
-
elseif( ! empty( $compDuration )) { // DateInterval
|
284 |
-
$rend->add( $compDuration );
|
285 |
-
}
|
286 |
-
$endHis = $rend->getTime();
|
287 |
-
$component2 = ( isset( $recurrIdList[$k][4] )) ? clone $recurrIdList[$k][4] : clone $component;
|
288 |
-
}
|
289 |
-
else {
|
290 |
-
$startHis = $compStart->getTime();
|
291 |
-
$endHis = $compEnd->getTime();
|
292 |
-
$component2 = clone $component;
|
293 |
-
}
|
294 |
-
$cnt = 0; // exclude any recurrence START date, found in exdatelist or recurrIdList but accept the reccurence-id comp itself
|
295 |
-
$occurenceDays = 1 + (int) $rstart->diff( $rend )->format( $PRA ); // count the days (incl start day)
|
296 |
-
while( $rstart->format( $YMD2 ) <= $rend->format( $YMD2 )) {
|
297 |
-
$cnt += 1;
|
298 |
-
if( 1 < $occurenceDays )
|
299 |
-
$component2->setProperty(
|
300 |
-
util::$X_OCCURENCE,
|
301 |
-
sprintf( $DAYOFDAYS, $cnt, $occurenceDays )
|
302 |
-
);
|
303 |
-
if( 1 < $cnt )
|
304 |
-
$rstart->setTime( 0, 0, 0 );
|
305 |
-
else {
|
306 |
-
$rstart->setTime( $startHis[0], $startHis[1], $startHis[2] );
|
307 |
-
$exdatelist[$rstart->key] = $compDuration; // make sure to exclude start day from the recurrence pattern // DateInterval
|
308 |
-
}
|
309 |
-
$component2->setProperty( util::$X_CURRENT_DTSTART,
|
310 |
-
$rstart->format( $compStart->dateFormat ));
|
311 |
-
$xY = (int) $rstart->format( $Y );
|
312 |
-
$xM = (int) $rstart->format( $M );
|
313 |
-
$xD = (int) $rstart->format( $D );
|
314 |
-
if( false !== $compDuration ) { // DateInterval
|
315 |
-
$propName = ( isset( $compEnd->SCbools[$DUEEXIST] ))
|
316 |
-
? util::$X_CURRENT_DUE : util::$X_CURRENT_DTEND;
|
317 |
-
if( $cnt < $occurenceDays )
|
318 |
-
$rstart->setTime( 23, 59, 59 );
|
319 |
-
elseif(( $rstart->format( $YMD2 ) < $rend->format( $YMD2 )) &&
|
320 |
-
( '00' == $endHis[0] ) &&
|
321 |
-
( '00' == $endHis[1] ) &&
|
322 |
-
( '00' == $endHis[2] )) // end exactly at midnight
|
323 |
-
$rstart->setTime( 24, 0, 0 );
|
324 |
-
else
|
325 |
-
$rstart->setTime( $endHis[0], $endHis[1], $endHis[2] );
|
326 |
-
$component2->setProperty( $propName,
|
327 |
-
$rstart->format( $compEnd->dateFormat ));
|
328 |
-
}
|
329 |
-
$result[$xY][$xM][$xD][$compUID] = clone $component2; // copy to output
|
330 |
-
$rstart->add( $INTERVAL_P1D );
|
331 |
-
} // end while(( $rstart->format( 'Ymd' ) < $rend->format( 'Ymd' ))
|
332 |
-
unset( $cnt, $occurenceDays );
|
333 |
-
} // end if( ! isset( $exdatelist[$rstart->key] ))
|
334 |
-
unset( $rstart, $rend );
|
335 |
-
} // end elseif( $split ) - else use component date
|
336 |
-
else { // !$flat && !$split, i.e. no flat array and DTSTART within period
|
337 |
-
if( isset( $recurrIdList[$compStart->key] )) {
|
338 |
-
$tstart = clone $recurrIdList[$compStart->key][0];
|
339 |
-
$component2 = ( isset( $recurrIdList[$k][4] )) ? $recurrIdList[$k][4] : clone $component;
|
340 |
-
}
|
341 |
-
else {
|
342 |
-
$tstart = clone $compStart;
|
343 |
-
$component2 = clone $component;
|
344 |
-
}
|
345 |
-
if( ! $any || ! isset( $exdatelist[$tstart->key] )) { // exclude any recurrence date, found in exdatelist
|
346 |
-
$xY = (int) $tstart->format( $Y );
|
347 |
-
$xM = (int) $tstart->format( $M );
|
348 |
-
$xD = (int) $tstart->format( $D );
|
349 |
-
$result[$xY][$xM][$xD][$compUID] = clone $component2; // copy to output
|
350 |
-
}
|
351 |
-
unset( $tstart );
|
352 |
-
}
|
353 |
-
} // end (dt)start within the period OR occurs within the period
|
354 |
-
/* *************************************************************
|
355 |
-
if 'any' components, check components with reccurrence rules, removing all excluding dates
|
356 |
-
*********************************************************** */
|
357 |
-
if( true === $any ) {
|
358 |
-
$recurlist = [];
|
359 |
-
/* make a list of optional repeating dates for component occurence, rrule, rdate */
|
360 |
-
self::getAllRRULEdates( $component, $recurlist,
|
361 |
-
$dtstartTz, $compStart, $workStart, $workEnd,
|
362 |
-
$compStartHis, $exdatelist, $compDuration );
|
363 |
-
$workStart = clone $fcnStart;
|
364 |
-
$workStart->sub(( ! empty( $compDuration )) ? $compDuration : $INTERVAL_P1D );
|
365 |
-
self::getAllRDATEdates( $component, $recurlist,
|
366 |
-
$dtstartTz, $workStart, $fcnEnd, $compStart->dateFormat,
|
367 |
-
$exdatelist, $compStartHis, $compDuration );
|
368 |
-
unset( $workStart, $rend );
|
369 |
-
foreach( $recurrIdList as $rKey => $rVal ) { // check for recurrence-id, i.e. alter recur Ymd[His] and duration
|
370 |
-
if( 3 < $rKey ) {
|
371 |
-
continue;
|
372 |
-
}
|
373 |
-
if( isset( $recurlist[$rKey] )) {
|
374 |
-
unset( $recurlist[$rKey] );
|
375 |
-
$recurlist[$rVal[0]->key] = ( ! empty( $rVal[2] )) ? $rVal[2] : $compDuration; // DateInterval
|
376 |
-
}
|
377 |
-
}
|
378 |
-
ksort( $recurlist, SORT_STRING );
|
379 |
-
/* output all remaining components in recurlist */
|
380 |
-
if( 0 < count( $recurlist )) {
|
381 |
-
$component2 = clone $component;
|
382 |
-
$compUID = $component2->getProperty( util::$UID );
|
383 |
-
$workStart = clone $fcnStart;
|
384 |
-
$workStart->sub(( ! empty( $compDuration )) ? $compDuration : $INTERVAL_P1D ); // DateInterval
|
385 |
-
$YmdOld = null;
|
386 |
-
foreach( $recurlist as $recurkey => $durationInterval ) {
|
387 |
-
if( $YmdOld == substr( $recurkey, 0, 8 )) // skip overlapping recur the same day, i.e. RDATE before RRULE
|
388 |
-
continue;
|
389 |
-
$YmdOld = substr( $recurkey, 0, 8 );
|
390 |
-
$rstart = clone $compStart;
|
391 |
-
$rstart->setDate((int) substr( $recurkey, 0, 4 ),
|
392 |
-
(int) substr( $recurkey, 4, 2 ),
|
393 |
-
(int) substr( $recurkey, 6, 2 ));
|
394 |
-
$rstart->setTime((int) substr( $recurkey, 8, 2 ),
|
395 |
-
(int) substr( $recurkey, 10, 2 ),
|
396 |
-
(int) substr( $recurkey, 12, 2 ));
|
397 |
-
/* add recurring components within valid dates to output array, only start date set */
|
398 |
-
if( $flat ) {
|
399 |
-
if( ! isset( $result[$compUID] )) // only one comp
|
400 |
-
$result[$compUID] = clone $component2; // copy to output
|
401 |
-
}
|
402 |
-
/* add recurring components within valid dates to output array, split for each day */
|
403 |
-
elseif( $split ) {
|
404 |
-
/* check and alter current component to recurr-comp if YMD match */
|
405 |
-
$recurrFound = false;
|
406 |
-
foreach( $recurrIdList as $k => $v ) {
|
407 |
-
if( substr( $k, 0, 8 ) == substr( $recurkey, 0, 8 )) {
|
408 |
-
$rstart = clone $recurrIdList[$k][0];
|
409 |
-
$durationInterval2 = ( ! empty( $recurrIdList[$k][2] )) ? $recurrIdList[$k][2] : null; // DateInterval
|
410 |
-
$component3 = clone $recurrIdList[$k][4];
|
411 |
-
$recurrFound = true;
|
412 |
-
break;
|
413 |
-
}
|
414 |
-
}
|
415 |
-
if( ! $recurrFound ) {
|
416 |
-
$component3 = clone $component2;
|
417 |
-
$durationInterval2 = ( ! empty( $durationInterval )) ? $durationInterval : null;
|
418 |
-
}
|
419 |
-
$rend = clone $rstart;
|
420 |
-
if( ! empty( $durationInterval2 )) {
|
421 |
-
$rend->add( $durationInterval2 );
|
422 |
-
}
|
423 |
-
if( $rend->format( $YMD2 ) > $fcnEnd->format( $YMD2 )) {
|
424 |
-
$rend = clone $fcnEnd;
|
425 |
-
}
|
426 |
-
$endHis = $rend->getTime();
|
427 |
-
$xRecurrence += 1;
|
428 |
-
$cnt = 0;
|
429 |
-
$occurenceDays = 1 + (int) $rstart->diff( $rend )->format( $PRA ); // count the days (incl start day)
|
430 |
-
while( $rstart->format( $YMD2 ) <= $rend->format( $YMD2 )) { // iterate.. .
|
431 |
-
$cnt += 1;
|
432 |
-
if( $rstart->format( $YMD2 ) < $fcnStart->format( $YMD2 )) { // date before dtstart
|
433 |
-
$rstart->add( $INTERVAL_P1D ); // cycle rstart to dtstart
|
434 |
-
$rstart->setTime( 0, 0, 0 );
|
435 |
-
continue;
|
436 |
-
}
|
437 |
-
elseif( 2 == $cnt )
|
438 |
-
$rstart->setTime( 0, 0, 0 );
|
439 |
-
$xY = (int) $rstart->format( $Y );
|
440 |
-
$xM = (int) $rstart->format( $M );
|
441 |
-
$xD = (int) $rstart->format( $D );
|
442 |
-
$component3->setProperty( util::$X_RECURRENCE, $xRecurrence );
|
443 |
-
if( 1 < $occurenceDays )
|
444 |
-
$component3->setProperty( util::$X_OCCURENCE, sprintf( $DAYOFDAYS, $cnt, $occurenceDays ));
|
445 |
-
else
|
446 |
-
$component3->deleteProperty( util::$X_OCCURENCE );
|
447 |
-
$component3->setProperty( util::$X_CURRENT_DTSTART, $rstart->format( $compStart->dateFormat ));
|
448 |
-
$propName = ( isset( $compEnd->SCbools[$DUEEXIST] )) ? util::$X_CURRENT_DUE : util::$X_CURRENT_DTEND;
|
449 |
-
if( ! empty( $durationInterval2 )) {
|
450 |
-
if( $cnt < $occurenceDays )
|
451 |
-
$rstart->setTime( 23, 59, 59 );
|
452 |
-
elseif(( $rstart->format( $YMD2 ) < $rend->format( $YMD2 )) &&
|
453 |
-
( '00' == $endHis[0] ) && ( '00' == $endHis[1] ) && ( '00' == $endHis[2] )) // end exactly at midnight
|
454 |
-
$rstart->setTime( 24, 0, 0 );
|
455 |
-
else
|
456 |
-
$rstart->setTime( $endHis[0], $endHis[1], $endHis[2] );
|
457 |
-
$component3->setProperty( $propName, $rstart->format( $compEnd->dateFormat ));
|
458 |
-
}
|
459 |
-
else
|
460 |
-
$component3->deleteProperty( $propName );
|
461 |
-
$result[$xY][$xM][$xD][$compUID] = clone $component3; // copy to output
|
462 |
-
$rstart->add( $INTERVAL_P1D );
|
463 |
-
} // end while( $rstart->format( 'Ymd' ) <= $rend->format( 'Ymd' ))
|
464 |
-
unset( $rstart, $rend );
|
465 |
-
} // end elseif( $split )
|
466 |
-
elseif( $rstart->format( $YMD2 ) >= $fcnStart->format( $YMD2 )) {
|
467 |
-
$xRecurrence += 1; // date within period, flat=false && split=false => one comp every recur startdate
|
468 |
-
$component2->setProperty( util::$X_RECURRENCE, $xRecurrence );
|
469 |
-
$component2->setProperty( util::$X_CURRENT_DTSTART, $rstart->format( $compStart->dateFormat ));
|
470 |
-
$propName = ( isset( $compEnd->SCbools[$DUEEXIST] ))
|
471 |
-
? util::$X_CURRENT_DUE : util::$X_CURRENT_DTEND;
|
472 |
-
if( ! empty( $durationInterval )) {
|
473 |
-
$rstart->add( $durationInterval );
|
474 |
-
$component2->setProperty( $propName, $rstart->format( $compEnd->dateFormat ));
|
475 |
-
}
|
476 |
-
else
|
477 |
-
$component2->deleteProperty( $propName );
|
478 |
-
$xY = (int) $rstart->format( $Y );
|
479 |
-
$xM = (int) $rstart->format( $M );
|
480 |
-
$xD = (int) $rstart->format( $D );
|
481 |
-
$result[$xY][$xM][$xD][$compUID] = clone $component2; // copy to output
|
482 |
-
} // end elseif( $rstart >= $fcnStart )
|
483 |
-
unset( $rstart );
|
484 |
-
} // end foreach( $recurlist as $recurkey => $durationInterval )
|
485 |
-
unset( $component2, $component3, $xRecurrence, $compUID, $workStart, $rstart );
|
486 |
-
} // end if( 0 < count( $recurlist ))
|
487 |
-
} // end if( true === $any )
|
488 |
-
unset( $component );
|
489 |
-
} // end while( $component = $calendar->getComponent())
|
490 |
-
if( 0 >= count( $result ))
|
491 |
-
return false;
|
492 |
-
elseif( ! $flat ) {
|
493 |
-
foreach( $result as $y => $yList ) {
|
494 |
-
foreach( $yList as $m => $mList ) {
|
495 |
-
foreach( $mList as $d => $dList ) {
|
496 |
-
if( empty( $dList ))
|
497 |
-
unset( $result[$y][$m][$d] );
|
498 |
-
else {
|
499 |
-
$result[$y][$m][$d] = array_values( $dList ); // skip tricky UID-index
|
500 |
-
if( 1 < count( $result[$y][$m][$d] )) {
|
501 |
-
foreach( $result[$y][$m][$d] as $cix => $d2List ) // sort
|
502 |
-
vcalendarSortHandler::setSortArgs( $result[$y][$m][$d][$cix] );
|
503 |
-
usort( $result[$y][$m][$d], $SORTER );
|
504 |
-
}
|
505 |
-
}
|
506 |
-
} // end foreach( $mList as $d => $dList )
|
507 |
-
if( empty( $result[$y][$m] ))
|
508 |
-
unset( $result[$y][$m] );
|
509 |
-
else
|
510 |
-
ksort( $result[$y][$m] );
|
511 |
-
} // end foreach( $yList as $m => $mList )
|
512 |
-
if( empty( $result[$y] ))
|
513 |
-
unset( $result[$y] );
|
514 |
-
else
|
515 |
-
ksort( $result[$y] );
|
516 |
-
} // end foreach( $result as $y => $yList )
|
517 |
-
if( empty( $result ))
|
518 |
-
unset( $result );
|
519 |
-
else
|
520 |
-
ksort( $result );
|
521 |
-
} // end elseif( !$flat )
|
522 |
-
if( ! is_null( $result ) && 0 >= count( $result ))
|
523 |
-
return false;
|
524 |
-
return $result;
|
525 |
-
}
|
526 |
-
/**
|
527 |
-
* Return bool true if dates are in scope
|
528 |
-
*
|
529 |
-
* @param iCaldateTime $start
|
530 |
-
* @param iCaldateTime $scopeStart
|
531 |
-
* @param iCaldateTime $end
|
532 |
-
* @param iCaldateTime $scopeEnd
|
533 |
-
* @param string $format
|
534 |
-
* @return bool
|
535 |
-
* @access private
|
536 |
-
* @static
|
537 |
-
*/
|
538 |
-
private static function inScope(
|
539 |
-
iCaldateTime $start,
|
540 |
-
iCaldateTime $scopeStart,
|
541 |
-
iCaldateTime $end,
|
542 |
-
iCaldateTime $scopeEnd,
|
543 |
-
$format
|
544 |
-
) {
|
545 |
-
return (( $start->format( $format ) >= $scopeStart->format( $format )) &&
|
546 |
-
( $end->format( $format ) <= $scopeEnd->format( $format )));
|
547 |
-
}
|
548 |
-
/**
|
549 |
-
* Get all EXRULE dates (multiple values allowed)
|
550 |
-
*
|
551 |
-
* @param calendarComponent $component
|
552 |
-
* @param array $exdatelist
|
553 |
-
* @param string $dtstartTz
|
554 |
-
* @param iCaldateTime $compStart
|
555 |
-
* @param iCaldateTime $workStart
|
556 |
-
* @param iCaldateTime $workEnd
|
557 |
-
* @param string $compStartHis
|
558 |
-
*/
|
559 |
-
private static function getAllEXRULEdates(
|
560 |
-
calendarComponent $component,
|
561 |
-
array & $exdatelist,
|
562 |
-
$dtstartTz,
|
563 |
-
iCaldateTime $compStart,
|
564 |
-
iCaldateTime $workStart,
|
565 |
-
iCaldateTime $workEnd,
|
566 |
-
$compStartHis
|
567 |
-
) {
|
568 |
-
while( false !== ( $prop = $component->getProperty( util::$EXRULE ))) {
|
569 |
-
$exdatelist2 = [];
|
570 |
-
if( isset( $prop[util::$UNTIL][util::$LCHOUR] )) { // convert UNTIL date to DTSTART timezone
|
571 |
-
$until = iCaldateTime::factory( $prop[util::$UNTIL], [util::$TZID => util::$UTC], null, $dtstartTz );
|
572 |
-
$until = $until->format();
|
573 |
-
util::strDate2arr( $until );
|
574 |
-
$prop[util::$UNTIL] = $until;
|
575 |
-
}
|
576 |
-
utilRecur::recur2date( $exdatelist2, $prop, $compStart, $workStart, $workEnd );
|
577 |
-
foreach( $exdatelist2 as $k => $v ) { // point out exact every excluded ocurrence (incl. opt. His)
|
578 |
-
$exdatelist[$k.$compStartHis] = $v;
|
579 |
-
}
|
580 |
-
unset( $until, $exdatelist2 );
|
581 |
-
}
|
582 |
-
return true;
|
583 |
-
}
|
584 |
-
/**
|
585 |
-
* Get all EXDATE dates (multiple values allowed)
|
586 |
-
*
|
587 |
-
* @param calendarComponent $component
|
588 |
-
* @param array $exdatelist
|
589 |
-
* @param string $dtstartTz
|
590 |
-
*/
|
591 |
-
private static function getAllEXDATEdates(
|
592 |
-
calendarComponent $component,
|
593 |
-
array & $exdatelist,
|
594 |
-
$dtstartTz
|
595 |
-
) {
|
596 |
-
while( false !== ( $prop = $component->getProperty( util::$EXDATE, false, true ))) {
|
597 |
-
foreach( $prop[util::$LCvalue] as $exdate ) {
|
598 |
-
$exdate = iCaldateTime::factory( $exdate, $prop[util::$LCparams], $exdate, $dtstartTz );
|
599 |
-
$exdatelist[$exdate->key] = true;
|
600 |
-
} // end - foreach( $exdate as $exdate )
|
601 |
-
}
|
602 |
-
return true;
|
603 |
-
}
|
604 |
-
/**
|
605 |
-
* Update $recurlist all RRULE dates (multiple values allowed)
|
606 |
-
*
|
607 |
-
* @param calendarComponent $component
|
608 |
-
* @param array $recurlist
|
609 |
-
* @param string $dtstartTz
|
610 |
-
* @param iCaldateTime $compStart
|
611 |
-
* @param iCaldateTime $workStart
|
612 |
-
* @param iCaldateTime $workEnd
|
613 |
-
* @param string $compStartHis
|
614 |
-
* @param array $exdatelist
|
615 |
-
* @param DateInterval $compDuration
|
616 |
-
*/
|
617 |
-
private static function getAllRRULEdates(
|
618 |
-
calendarComponent $component,
|
619 |
-
array & $recurlist,
|
620 |
-
$dtstartTz,
|
621 |
-
iCaldateTime $compStart,
|
622 |
-
iCaldateTime $workStart,
|
623 |
-
iCaldateTime $workEnd,
|
624 |
-
$compStartHis,
|
625 |
-
array $exdatelist,
|
626 |
-
DateInterval $compDuration = null
|
627 |
-
) {
|
628 |
-
while( false !== ( $prop = $component->getProperty( util::$RRULE ))) {
|
629 |
-
$recurlist2 = [];
|
630 |
-
if( isset( $prop[util::$UNTIL][util::$LCHOUR] )) { // convert RRULE['UNTIL'] to the same timezone as DTSTART !!
|
631 |
-
$until = iCaldateTime::factory( $prop[util::$UNTIL], [util::$TZID => util::$UTC], null, $dtstartTz );
|
632 |
-
$until = $until->format();
|
633 |
-
util::strDate2arr( $until );
|
634 |
-
$prop[util::$UNTIL] = $until;
|
635 |
-
}
|
636 |
-
utilRecur::recur2date( $recurlist2, $prop, $compStart, $workStart, $workEnd );
|
637 |
-
foreach( $recurlist2 as $recurkey => $recurvalue ) { // recurkey=Ymd
|
638 |
-
$recurkey .= $compStartHis; // add opt His
|
639 |
-
if( ! isset( $exdatelist[$recurkey] ))
|
640 |
-
$recurlist[$recurkey] = $compDuration; // DateInterval or false
|
641 |
-
}
|
642 |
-
unset( $prop, $until, $recurlist2 );
|
643 |
-
}
|
644 |
-
return true;
|
645 |
-
}
|
646 |
-
/**
|
647 |
-
* Update $recurlist with RDATE dates (multiple values allowed)
|
648 |
-
*
|
649 |
-
* @param calendarComponent $component
|
650 |
-
* @param array $recurlist
|
651 |
-
* @param string $dtstartTz
|
652 |
-
* @param iCaldateTime $workStart
|
653 |
-
* @param iCaldateTime $fcnEnd
|
654 |
-
* @param string $format
|
655 |
-
* @param array $exdatelist
|
656 |
-
* @param string $compStartHis
|
657 |
-
* @param DateInterval $compDuration
|
658 |
-
*/
|
659 |
-
private static function getAllRDATEdates(
|
660 |
-
calendarComponent $component,
|
661 |
-
array & $recurlist,
|
662 |
-
$dtstartTz,
|
663 |
-
iCaldateTime $workStart,
|
664 |
-
iCaldateTime $fcnEnd,
|
665 |
-
$format,
|
666 |
-
array $exdatelist,
|
667 |
-
$compStartHis,
|
668 |
-
DateInterval $compDuration = null
|
669 |
-
) {
|
670 |
-
while( false !== ( $prop = $component->getProperty( util::$RDATE, false, true ))) {
|
671 |
-
$rdateFmt = ( isset( $prop[util::$LCparams][util::$VALUE] ))
|
672 |
-
? $prop[util::$LCparams][util::$VALUE]
|
673 |
-
: util::$DATE_TIME;
|
674 |
-
$params = $prop[util::$LCparams];
|
675 |
-
$prop = $prop[util::$LCvalue];
|
676 |
-
foreach( $prop as $rix => $theRdate ) {
|
677 |
-
if( util::$PERIOD == $rdateFmt ) { // all days within PERIOD
|
678 |
-
$rdate = iCaldateTime::factory( $theRdate[0], $params, $theRdate[0], $dtstartTz );
|
679 |
-
if( ! self::inScope( $rdate, $workStart, $rdate, $fcnEnd, $format ) ||
|
680 |
-
isset( $exdatelist[$rdate->key] ))
|
681 |
-
continue;
|
682 |
-
if( isset( $theRdate[1][util::$LCYEAR] )) { // date-date period end
|
683 |
-
$recurlist[$rdate->key] = $rdate->diff(
|
684 |
-
iCaldateTime::factory( $theRdate[1], $params, $theRdate[1], $dtstartTz )
|
685 |
-
);
|
686 |
-
}
|
687 |
-
else { // period duration
|
688 |
-
$recurlist[$rdate->key] = new DateInterval( util::duration2str( $theRdate[1] ));
|
689 |
-
}
|
690 |
-
} // end if( util::$PERIOD == $rdateFmt )
|
691 |
-
elseif( util::$DATE == $rdateFmt ) { // single recurrence, DATE
|
692 |
-
$rdate = iCaldateTime::factory( $theRdate,
|
693 |
-
array_merge( $params, [util::$TZID => $dtstartTz] ),
|
694 |
-
null,
|
695 |
-
$dtstartTz );
|
696 |
-
if( self::inScope( $rdate, $workStart, $rdate, $fcnEnd, $format ) &&
|
697 |
-
! isset( $exdatelist[$rdate->key] )) // set start date for recurrence + DateInterval/false (+opt His)
|
698 |
-
$recurlist[$rdate->key.$compStartHis] = $compDuration;
|
699 |
-
} // end DATE
|
700 |
-
else { // start DATETIME
|
701 |
-
$rdate = iCaldateTime::factory( $theRdate,
|
702 |
-
$params,
|
703 |
-
$theRdate,
|
704 |
-
$dtstartTz );
|
705 |
-
if( self::inScope( $rdate, $workStart, $rdate, $fcnEnd, $format ) &&
|
706 |
-
! isset( $exdatelist[$rdate->key] ))
|
707 |
-
$recurlist[$rdate->key] = $compDuration; // set start datetime for recurrence DateInterval/false
|
708 |
-
} // end DATETIME
|
709 |
-
} // end foreach( $prop as $rix => $theRdate )
|
710 |
-
} // end while( false !== ( $prop = $component->getProperty( util::$RDATE, false, true )))
|
711 |
-
return true;
|
712 |
-
}
|
713 |
-
/**
|
714 |
-
* Return array with selected components values from calendar based on specific property value(-s)
|
715 |
-
*
|
716 |
-
* @param vcalendar $calendar
|
717 |
-
* @param array $selectOptions (string) key => (mixed) value, (key=propertyName)
|
718 |
-
* @return array
|
719 |
-
* @access private
|
720 |
-
* @static
|
721 |
-
*/
|
722 |
-
private static function selectComponents2(
|
723 |
-
vcalendar $calendar,
|
724 |
-
array $selectOptions
|
725 |
-
) {
|
726 |
-
$output = [];
|
727 |
-
$selectOptions = array_change_key_case( $selectOptions, CASE_UPPER );
|
728 |
-
while( $component3 = $calendar->getComponent()) {
|
729 |
-
if( empty( $component3 ))
|
730 |
-
continue;
|
731 |
-
if( ! in_array( $component3->objName, util::$VCOMPS ))
|
732 |
-
continue;
|
733 |
-
$uid = $component3->getProperty( util::$UID );
|
734 |
-
foreach( $selectOptions as $propName => $pValue ) {
|
735 |
-
if( ! in_array( $propName, util::$OTHERPROPS ))
|
736 |
-
continue;
|
737 |
-
if( ! is_array( $pValue ))
|
738 |
-
$pValue = [$pValue];
|
739 |
-
if(( util::$UID == $propName ) && in_array( $uid, $pValue )) {
|
740 |
-
$output[$uid][] = $component3;
|
741 |
-
continue;
|
742 |
-
}
|
743 |
-
elseif( in_array( $propName, util::$MPROPS1 )) {
|
744 |
-
$propValues = [];
|
745 |
-
$component3->getProperties( $propName, $propValues );
|
746 |
-
$propValues = array_keys( $propValues );
|
747 |
-
foreach( $pValue as $theValue ) {
|
748 |
-
if( in_array( $theValue, $propValues )) { // && ! isset( $output[$uid] )) {
|
749 |
-
$output[$uid][] = $component3;
|
750 |
-
break;
|
751 |
-
}
|
752 |
-
}
|
753 |
-
continue;
|
754 |
-
} // end elseif( // multiple occurrence?
|
755 |
-
elseif( false === ( $d = $component3->getProperty( $propName ))) // single occurrence
|
756 |
-
continue;
|
757 |
-
if( is_array( $d )) {
|
758 |
-
foreach( $d as $part ) {
|
759 |
-
if( in_array( $part, $pValue ) && ! isset( $output[$uid] ))
|
760 |
-
$output[$uid][] = $component3;
|
761 |
-
}
|
762 |
-
}
|
763 |
-
elseif(( util::$SUMMARY == $propName ) && ! isset( $output[$uid] )) {
|
764 |
-
foreach( $pValue as $pval ) {
|
765 |
-
if( false !== stripos( $d, $pval )) {
|
766 |
-
$output[$uid][] = $component3;
|
767 |
-
break;
|
768 |
-
}
|
769 |
-
}
|
770 |
-
}
|
771 |
-
elseif( in_array( $d, $pValue ) && ! isset( $output[$uid] ))
|
772 |
-
$output[$uid][] = $component3;
|
773 |
-
} // end foreach( $selectOptions as $propName => $pValue )
|
774 |
-
} // end while( $component3 = $calendar->getComponent()) {
|
775 |
-
if( ! empty( $output )) {
|
776 |
-
ksort( $output ); // uid order
|
777 |
-
$output2 = [];
|
778 |
-
foreach( $output as $uid => $uList ) {
|
779 |
-
foreach( $uList as $cx => $uValue )
|
780 |
-
$output2[] = $uValue;
|
781 |
-
}
|
782 |
-
$output = $output2;
|
783 |
-
}
|
784 |
-
return $output;
|
785 |
-
}
|
786 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/valarm.php
DELETED
@@ -1,145 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* iCalcreator VALARM component class
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
class valarm extends calendarComponent {
|
40 |
-
use traits\ACTIONtrait,
|
41 |
-
traits\ATTACHtrait,
|
42 |
-
traits\ATTENDEEtrait,
|
43 |
-
traits\DESCRIPTIONtrait,
|
44 |
-
traits\DURATIONtrait,
|
45 |
-
traits\REPEATtrait,
|
46 |
-
traits\SUMMARYtrait,
|
47 |
-
traits\TRIGGERtrait;
|
48 |
-
/**
|
49 |
-
* Constructor for calendar component VALARM object
|
50 |
-
*
|
51 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
52 |
-
* @since 2.22.20 - 2017-02-01
|
53 |
-
* @param array $config
|
54 |
-
*/
|
55 |
-
public function __construct( $config = []) {
|
56 |
-
static $A = 'a';
|
57 |
-
parent::__construct();
|
58 |
-
$this->setConfig( util::initConfig( $config ));
|
59 |
-
$this->cno = $A . parent::getObjectNo();
|
60 |
-
}
|
61 |
-
/**
|
62 |
-
* Destructor
|
63 |
-
*
|
64 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
65 |
-
* @since 2.22.23 - 2017-03-18
|
66 |
-
*/
|
67 |
-
public function __destruct() {
|
68 |
-
unset( $this->xprop,
|
69 |
-
$this->components,
|
70 |
-
$this->unparsed,
|
71 |
-
$this->config,
|
72 |
-
$this->propix,
|
73 |
-
$this->propdelix );
|
74 |
-
unset( $this->objName,
|
75 |
-
$this->cno );
|
76 |
-
unset( $this->action,
|
77 |
-
$this->attach,
|
78 |
-
$this->attendee,
|
79 |
-
$this->description,
|
80 |
-
$this->duration,
|
81 |
-
$this->repeat,
|
82 |
-
$this->summary,
|
83 |
-
$this->trigger );
|
84 |
-
}
|
85 |
-
/**
|
86 |
-
* Return formatted output for calendar component VALARM object instance
|
87 |
-
*
|
88 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
89 |
-
* @since 2.5.1 - 2008-10-22
|
90 |
-
* @return string
|
91 |
-
*/
|
92 |
-
public function createComponent() {
|
93 |
-
$objectname = strtoupper( $this->objName );
|
94 |
-
$component = sprintf( util::$FMTBEGIN, $objectname );
|
95 |
-
$component .= $this->createAction();
|
96 |
-
$component .= $this->createAttach();
|
97 |
-
$component .= $this->createAttendee();
|
98 |
-
$component .= $this->createDescription();
|
99 |
-
$component .= $this->createDuration();
|
100 |
-
$component .= $this->createRepeat();
|
101 |
-
$component .= $this->createSummary();
|
102 |
-
$component .= $this->createTrigger();
|
103 |
-
$component .= $this->createXprop();
|
104 |
-
return $component . sprintf( util::$FMTEND, $objectname );
|
105 |
-
}
|
106 |
-
/**
|
107 |
-
* Return valarm component property value/params,
|
108 |
-
*
|
109 |
-
* If arg $inclParam, return array with keys VALUE/PARAMS.
|
110 |
-
* @param string $propName
|
111 |
-
* @param int $propix specific property in case of multiply occurences
|
112 |
-
* @param bool $inclParam
|
113 |
-
* @param bool $specform
|
114 |
-
* @return mixed
|
115 |
-
*/
|
116 |
-
public function getProperty( $propName=false,
|
117 |
-
$propix=false,
|
118 |
-
$inclParam=false,
|
119 |
-
$specform=false ) {
|
120 |
-
switch( strtoupper( $propName )) {
|
121 |
-
case util::$ACTION:
|
122 |
-
if( isset( $this->action[util::$LCvalue] ))
|
123 |
-
return ( $inclParam ) ? $this->action
|
124 |
-
: $this->action[util::$LCvalue];
|
125 |
-
break;
|
126 |
-
case util::$REPEAT:
|
127 |
-
if( isset( $this->repeat[util::$LCvalue] ))
|
128 |
-
return ( $inclParam ) ? $this->repeat
|
129 |
-
: $this->repeat[util::$LCvalue];
|
130 |
-
break;
|
131 |
-
case util::$TRIGGER:
|
132 |
-
if( isset( $this->trigger[util::$LCvalue] ))
|
133 |
-
return ( $inclParam ) ? $this->trigger
|
134 |
-
: $this->trigger[util::$LCvalue];
|
135 |
-
break;
|
136 |
-
default:
|
137 |
-
return parent::getProperty( $propName,
|
138 |
-
$propix,
|
139 |
-
$inclParam,
|
140 |
-
$specform );
|
141 |
-
break;
|
142 |
-
}
|
143 |
-
return false;
|
144 |
-
}
|
145 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/vcalendar.php
DELETED
@@ -1,1060 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2018 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24.2
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
use kigkonsult\iCalcreator\util\utilGeo;
|
34 |
-
use kigkonsult\iCalcreator\util\utilSelect;
|
35 |
-
use kigkonsult\iCalcreator\util\utilRedirect;
|
36 |
-
/**
|
37 |
-
* vcalendar class
|
38 |
-
*
|
39 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
40 |
-
* @since 2.22.20 - 2017-01-29
|
41 |
-
*/
|
42 |
-
class vcalendar extends iCalBase {
|
43 |
-
use traits\CALSCALEtrait,
|
44 |
-
traits\METHODtrait,
|
45 |
-
traits\PRODIDtrait,
|
46 |
-
traits\VERSIONtrait;
|
47 |
-
/**
|
48 |
-
* @var property output formats, used by CALSCALE, METHOD, PRODID and VERSION
|
49 |
-
* @access private
|
50 |
-
* @static
|
51 |
-
*/
|
52 |
-
private static $FMTICAL = "%s:%s\r\n";
|
53 |
-
/**
|
54 |
-
* Constructor for calendar object
|
55 |
-
*
|
56 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
57 |
-
* @since 2.22.23 - 2017-03-16
|
58 |
-
* @param array $config
|
59 |
-
*/
|
60 |
-
public function __construct( $config = []) {
|
61 |
-
$this->setConfig( util::$UNIQUE_ID, ( isset( $_SERVER[util::$SERVER_NAME] ))
|
62 |
-
? gethostbyname( $_SERVER[util::$SERVER_NAME] )
|
63 |
-
: util::$LOCALHOST );
|
64 |
-
$this->setConfig( util::initConfig( $config ));
|
65 |
-
}
|
66 |
-
/**
|
67 |
-
* Destructor
|
68 |
-
*
|
69 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
70 |
-
* @since 2.22.23 - 2017-03-18
|
71 |
-
*/
|
72 |
-
public function __destruct() {
|
73 |
-
if( ! empty( $this->components ))
|
74 |
-
foreach( $this->components as $cix => $comp )
|
75 |
-
$this->components[$cix]->__destruct();
|
76 |
-
unset( $this->xprop,
|
77 |
-
$this->components,
|
78 |
-
$this->unparsed,
|
79 |
-
$this->config,
|
80 |
-
$this->propix,
|
81 |
-
$this->compix,
|
82 |
-
$this->propdelix );
|
83 |
-
unset( $this->calscale,
|
84 |
-
$this->method,
|
85 |
-
$this->prodid,
|
86 |
-
$this->version );
|
87 |
-
}
|
88 |
-
/**
|
89 |
-
* Return iCalcreator version
|
90 |
-
*
|
91 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
92 |
-
* @since 2.18.5 - 2013-08-29
|
93 |
-
* @return string
|
94 |
-
*/
|
95 |
-
public static function iCalcreatorVersion() {
|
96 |
-
return trim( substr( ICALCREATOR_VERSION, strpos( ICALCREATOR_VERSION, util::$SP1 )));
|
97 |
-
}
|
98 |
-
/**
|
99 |
-
* Return vcalendar config value or * calendar components, false on not found
|
100 |
-
*
|
101 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
102 |
-
* @since 2.22.23 - 2017-02-28
|
103 |
-
* @param mixed $config
|
104 |
-
* @return mixed
|
105 |
-
*/
|
106 |
-
public function getConfig( $config=null ) {
|
107 |
-
static $VCALENDAR = 'vcalendar';
|
108 |
-
static $YMDHIS = 'YmdHis';
|
109 |
-
static $DOTICS = '.ics';
|
110 |
-
static $DOTXML = '.xml';
|
111 |
-
if( is_null( $config )) {
|
112 |
-
$return = [];
|
113 |
-
$return[util::$ALLOWEMPTY] = $this->getConfig( util::$ALLOWEMPTY );
|
114 |
-
$return[util::$DELIMITER] = $this->getConfig( util::$DELIMITER );
|
115 |
-
$return[util::$DIRECTORY] = $this->getConfig( util::$DIRECTORY );
|
116 |
-
$return[util::$FILENAME] = $this->getConfig( util::$FILENAME );
|
117 |
-
$return[util::$DIRFILE] = $this->getConfig( util::$DIRFILE );
|
118 |
-
$return[util::$FILESIZE] = $this->getConfig( util::$FILESIZE );
|
119 |
-
if( false !== ( $cfg = $this->getConfig( util::$URL )))
|
120 |
-
$return[util::$URL] = $cfg;
|
121 |
-
if( false !== ( $cfg = $this->getConfig( util::$LANGUAGE )))
|
122 |
-
$return[util::$LANGUAGE] = $cfg;
|
123 |
-
if( false !== ( $cfg = $this->getConfig( util::$TZID )))
|
124 |
-
$return[util::$TZID] = $cfg;
|
125 |
-
$return[util::$UNIQUE_ID] = $this->getConfig( util::$UNIQUE_ID );
|
126 |
-
return $return;
|
127 |
-
}
|
128 |
-
switch( strtoupper( $config )) {
|
129 |
-
case util::$DELIMITER :
|
130 |
-
if( isset( $this->config[util::$DELIMITER] ))
|
131 |
-
return $this->config[util::$DELIMITER];
|
132 |
-
break;
|
133 |
-
case util::$DIRECTORY :
|
134 |
-
if( ! isset( $this->config[util::$DIRECTORY] ))
|
135 |
-
$this->config[util::$DIRECTORY] = util::$DOT;
|
136 |
-
return $this->config[util::$DIRECTORY];
|
137 |
-
break;
|
138 |
-
case util::$DIRFILE :
|
139 |
-
return $this->getConfig( util::$DIRECTORY ) .
|
140 |
-
$this->getConfig( util::$DELIMITER ) .
|
141 |
-
$this->getConfig( util::$FILENAME );
|
142 |
-
break;
|
143 |
-
case util::$FILEINFO :
|
144 |
-
return [$this->getConfig( util::$DIRECTORY ),
|
145 |
-
$this->getConfig( util::$FILENAME ),
|
146 |
-
$this->getConfig( util::$FILESIZE )];
|
147 |
-
break;
|
148 |
-
case util::$FILENAME :
|
149 |
-
if( ! isset( $this->config[util::$FILENAME] ))
|
150 |
-
$this->config[util::$FILENAME] =
|
151 |
-
date( $YMDHIS, intval( microtime( true ))) . $DOTICS;
|
152 |
-
return $this->config[util::$FILENAME];
|
153 |
-
break;
|
154 |
-
case util::$FILESIZE :
|
155 |
-
$size = 0;
|
156 |
-
if( empty( $this->config[util::$URL] )) {
|
157 |
-
$dirfile = $this->getConfig( util::$DIRFILE );
|
158 |
-
if( ! is_file( $dirfile ) || ( false === ( $size = filesize( $dirfile ))))
|
159 |
-
$size = 0;
|
160 |
-
clearstatcache();
|
161 |
-
}
|
162 |
-
return $size;
|
163 |
-
break;
|
164 |
-
case util::$UNIQUE_ID:
|
165 |
-
if( isset( $this->config[util::$UNIQUE_ID] ))
|
166 |
-
return $this->config[util::$UNIQUE_ID];
|
167 |
-
break;
|
168 |
-
case util::$URL :
|
169 |
-
if( ! empty( $this->config[util::$URL] ))
|
170 |
-
return $this->config[util::$URL];
|
171 |
-
break;
|
172 |
-
default :
|
173 |
-
return parent::getConfig( $config );
|
174 |
-
}
|
175 |
-
return false;
|
176 |
-
}
|
177 |
-
/**
|
178 |
-
* General vcalendar set config
|
179 |
-
*
|
180 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
181 |
-
* @since 2.22.23 - 2017-02-02
|
182 |
-
* @param mixed $config
|
183 |
-
* @param string $value
|
184 |
-
* @param string $arg3 (dummy)
|
185 |
-
* @return bool
|
186 |
-
*/
|
187 |
-
public function setConfig( $config, $value=null, $arg3=null ) {
|
188 |
-
static $PROTOCOLS = ['HTTP://', 'WEBCAL://', 'webcal://'];
|
189 |
-
static $PROTOHTTP = 'http://';
|
190 |
-
static $LCPROTOHTTPS = 'https://';
|
191 |
-
static $UCPROTOHTTPS = 'HTTPS://';
|
192 |
-
static $DOTICS = '.ics';
|
193 |
-
if( is_array( $config )) {
|
194 |
-
$config = array_change_key_case( $config, CASE_UPPER );
|
195 |
-
if( isset( $config[util::$DELIMITER] )) {
|
196 |
-
if( false === $this->setConfig( util::$DELIMITER,
|
197 |
-
$config[util::$DELIMITER] ))
|
198 |
-
return false;
|
199 |
-
unset( $config[util::$DELIMITER] );
|
200 |
-
}
|
201 |
-
if( isset( $config[util::$DIRECTORY] )) {
|
202 |
-
if( false === $this->setConfig( util::$DIRECTORY,
|
203 |
-
$config[util::$DIRECTORY] ))
|
204 |
-
return false;
|
205 |
-
unset( $config[util::$DIRECTORY] );
|
206 |
-
}
|
207 |
-
foreach( $config as $cKey => $cValue ) {
|
208 |
-
if( false === $this->setConfig( $cKey, $cValue ))
|
209 |
-
return false;
|
210 |
-
}
|
211 |
-
return true;
|
212 |
-
}
|
213 |
-
$res = false;
|
214 |
-
switch( strtoupper( $config )) {
|
215 |
-
case util::$DELIMITER :
|
216 |
-
$this->config[util::$DELIMITER] = $value;
|
217 |
-
return true;
|
218 |
-
break;
|
219 |
-
case util::$DIRECTORY :
|
220 |
-
if( false === ( $value = realpath( rtrim( trim( $value ), $this->config[util::$DELIMITER] ))))
|
221 |
-
return false;
|
222 |
-
else {
|
223 |
-
/* local directory */
|
224 |
-
$this->config[util::$DIRECTORY] = $value;
|
225 |
-
$this->config[util::$URL] = null;
|
226 |
-
return true;
|
227 |
-
}
|
228 |
-
break;
|
229 |
-
case util::$FILENAME :
|
230 |
-
$value = trim( $value );
|
231 |
-
$dirfile = $this->config[util::$DIRECTORY] .
|
232 |
-
$this->config[util::$DELIMITER] . $value;
|
233 |
-
if( file_exists( $dirfile )) {
|
234 |
-
/* local file exists */
|
235 |
-
if( is_readable( $dirfile ) || is_writable( $dirfile )) {
|
236 |
-
clearstatcache();
|
237 |
-
$this->config[util::$FILENAME] = $value;
|
238 |
-
return true;
|
239 |
-
}
|
240 |
-
else
|
241 |
-
return false;
|
242 |
-
}
|
243 |
-
elseif( is_readable( $this->config[util::$DIRECTORY] ) ||
|
244 |
-
is_writable( $this->config[util::$DIRECTORY] )) {
|
245 |
-
/* read- or writable directory */
|
246 |
-
clearstatcache();
|
247 |
-
$this->config[util::$FILENAME] = $value;
|
248 |
-
return true;
|
249 |
-
}
|
250 |
-
else
|
251 |
-
return false;
|
252 |
-
break;
|
253 |
-
case util::$LANGUAGE : // set language for calendar component as defined in [RFC 1766]
|
254 |
-
$value = trim( $value );
|
255 |
-
$this->config[util::$LANGUAGE] = $value;
|
256 |
-
$this->makeProdid();
|
257 |
-
$subcfg = [util::$LANGUAGE => $value];
|
258 |
-
$res = true;
|
259 |
-
break;
|
260 |
-
case util::$UNIQUE_ID :
|
261 |
-
$value = trim( $value );
|
262 |
-
$this->config[util::$UNIQUE_ID] = $value;
|
263 |
-
$this->makeProdid();
|
264 |
-
$subcfg = [util::$UNIQUE_ID => $value];
|
265 |
-
$res = true;
|
266 |
-
break;
|
267 |
-
case util::$URL :
|
268 |
-
/* remote file - URL */
|
269 |
-
$value = str_replace( $PROTOCOLS, $PROTOHTTP, trim( $value ));
|
270 |
-
$value = str_replace( $UCPROTOHTTPS, $LCPROTOHTTPS, trim( $value ));
|
271 |
-
if(( $PROTOHTTP != substr( $value, 0, 7 )) &&
|
272 |
-
( $LCPROTOHTTPS != substr( $value, 0, 8 )))
|
273 |
-
return false;
|
274 |
-
$this->config[util::$DIRECTORY] = util::$DOT;
|
275 |
-
$this->config[util::$URL] = $value;
|
276 |
-
if( $DOTICS != strtolower( substr( $value, -4 )))
|
277 |
-
unset( $this->config[util::$FILENAME] );
|
278 |
-
else
|
279 |
-
$this->config[util::$FILENAME] = basename( $value );
|
280 |
-
return true;
|
281 |
-
break;
|
282 |
-
default: // any unvalid config key.. .
|
283 |
-
$res = parent::setConfig( $config, $value );
|
284 |
-
}
|
285 |
-
if( ! $res )
|
286 |
-
return false;
|
287 |
-
if( isset( $subcfg ) && ! empty( $this->components )) {
|
288 |
-
foreach( $subcfg as $cfgkey => $cfgValue ) {
|
289 |
-
foreach( $this->components as $cix => $component ) {
|
290 |
-
$res = $this->components[$cix]->setConfig( $cfgkey, $cfgValue, true );
|
291 |
-
if( ! $res )
|
292 |
-
break 2;
|
293 |
-
}
|
294 |
-
}
|
295 |
-
}
|
296 |
-
return $res;
|
297 |
-
}
|
298 |
-
/**
|
299 |
-
* Delete calendar property value
|
300 |
-
*
|
301 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
302 |
-
* @since 2.8.8 - 2011-03-15
|
303 |
-
* @param mixed $propName bool false => X-property
|
304 |
-
* @param int $propix specific property in case of multiply occurences
|
305 |
-
* @return bool true on successfull delete
|
306 |
-
*/
|
307 |
-
public function deleteProperty( $propName=false, $propix=false ) {
|
308 |
-
$propName = ( $propName ) ? strtoupper( $propName ) : util::$X_PROP;
|
309 |
-
if( ! $propix )
|
310 |
-
$propix = ( isset( $this->propdelix[$propName] ) &&
|
311 |
-
( util::$X_PROP != $propName ))
|
312 |
-
? $this->propdelix[$propName] + 2
|
313 |
-
: 1;
|
314 |
-
$this->propdelix[$propName] = --$propix;
|
315 |
-
switch( $propName ) {
|
316 |
-
case util::$CALSCALE:
|
317 |
-
$this->calscale = null;
|
318 |
-
break;
|
319 |
-
case util::$METHOD:
|
320 |
-
$this->method = null;
|
321 |
-
break;
|
322 |
-
default:
|
323 |
-
return parent::deleteXproperty( $propName,
|
324 |
-
$this->xprop,
|
325 |
-
$propix,
|
326 |
-
$this->propdelix );
|
327 |
-
break;
|
328 |
-
}
|
329 |
-
return true;
|
330 |
-
}
|
331 |
-
/**
|
332 |
-
* Return calendar property value/params
|
333 |
-
*
|
334 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
335 |
-
* @since 2.21.09 - 2015-03-29
|
336 |
-
* @param string $propName
|
337 |
-
* @param int $propix specific property in case of multiply occurences
|
338 |
-
* @param bool $inclParam
|
339 |
-
* @return mixed
|
340 |
-
*/
|
341 |
-
public function getProperty( $propName=false,
|
342 |
-
$propix=false,
|
343 |
-
$inclParam=false ) {
|
344 |
-
static $RECURRENCE_ID_UID = 'RECURRENCE-ID-UID';
|
345 |
-
static $R_UID = 'R-UID';
|
346 |
-
$propName = ( $propName ) ? strtoupper( $propName ) : util::$X_PROP;
|
347 |
-
if( util::$X_PROP == $propName ) {
|
348 |
-
if( empty( $propix ))
|
349 |
-
$propix = ( isset( $this->propix[$propName] ))
|
350 |
-
? $this->propix[$propName] + 2
|
351 |
-
: 1;
|
352 |
-
$this->propix[$propName] = --$propix;
|
353 |
-
}
|
354 |
-
switch( $propName ) {
|
355 |
-
case util::$ATTENDEE:
|
356 |
-
case util::$CATEGORIES:
|
357 |
-
case util::$CONTACT:
|
358 |
-
case util::$DTSTART:
|
359 |
-
case util::$GEOLOCATION:
|
360 |
-
case util::$LOCATION:
|
361 |
-
case util::$ORGANIZER:
|
362 |
-
case util::$PRIORITY:
|
363 |
-
case util::$RESOURCES:
|
364 |
-
case util::$STATUS:
|
365 |
-
case util::$SUMMARY:
|
366 |
-
case $RECURRENCE_ID_UID:
|
367 |
-
case util::$RELATED_TO:
|
368 |
-
case $R_UID:
|
369 |
-
case util::$UID:
|
370 |
-
case util::$URL:
|
371 |
-
$output = [];
|
372 |
-
foreach( $this->components as $cix => $component) {
|
373 |
-
if( ! in_array( $component->objName, util::$VCOMPS ))
|
374 |
-
continue;
|
375 |
-
if( in_array( $propName, util::$MPROPS1 )) {
|
376 |
-
$component->getProperties( $propName, $output );
|
377 |
-
continue;
|
378 |
-
}
|
379 |
-
elseif(( 3 < strlen( $propName )) &&
|
380 |
-
( util::$UID == substr( $propName, -3 ))) {
|
381 |
-
if( false !== ( $content = $component->getProperty( util::$RECURRENCE_ID )))
|
382 |
-
$content = $component->getProperty( util::$UID );
|
383 |
-
}
|
384 |
-
elseif( util::$GEOLOCATION == $propName ) {
|
385 |
-
if( false === ( $geo = $component->getProperty( util::$GEO )))
|
386 |
-
continue;
|
387 |
-
$loc = $component->getProperty( util::$LOCATION );
|
388 |
-
$content = ( empty( $loc ))
|
389 |
-
? null
|
390 |
-
: $loc . util::$SP1;
|
391 |
-
$content .= utilGeo::geo2str2( $geo[utilGeo::$LATITUDE],
|
392 |
-
utilGeo::$geoLatFmt ) .
|
393 |
-
utilGeo::geo2str2( $geo[utilGeo::$LONGITUDE],
|
394 |
-
utilGeo::$geoLongFmt ) . utiL::$L;
|
395 |
-
}
|
396 |
-
elseif( false === ( $content = $component->getProperty( $propName )))
|
397 |
-
continue;
|
398 |
-
if(( false === $content ) || empty( $content ))
|
399 |
-
continue;
|
400 |
-
elseif( is_array( $content )) {
|
401 |
-
if( isset( $content[util::$LCYEAR] )) {
|
402 |
-
$key = sprintf( util::$YMD, (int) $content[util::$LCYEAR],
|
403 |
-
(int) $content[util::$LCMONTH],
|
404 |
-
(int) $content[util::$LCDAY] );
|
405 |
-
if( ! isset( $output[$key] ))
|
406 |
-
$output[$key] = 1;
|
407 |
-
else
|
408 |
-
$output[$key] += 1;
|
409 |
-
}
|
410 |
-
else {
|
411 |
-
foreach( $content as $partKey => $partValue ) {
|
412 |
-
if( ! isset( $output[$partKey] ))
|
413 |
-
$output[$partKey] = $partValue;
|
414 |
-
else
|
415 |
-
$output[$partKey] += $partValue;
|
416 |
-
}
|
417 |
-
}
|
418 |
-
} // end elseif( is_array( $content )) {
|
419 |
-
elseif( ! isset( $output[$content] ))
|
420 |
-
$output[$content] = 1;
|
421 |
-
else
|
422 |
-
$output[$content] += 1;
|
423 |
-
} // end foreach( $this->components as $cix => $component)
|
424 |
-
if( ! empty( $output ))
|
425 |
-
ksort( $output );
|
426 |
-
return $output;
|
427 |
-
break;
|
428 |
-
case util::$CALSCALE:
|
429 |
-
return ( ! empty( $this->calscale )) ? $this->calscale : false;
|
430 |
-
break;
|
431 |
-
case util::$METHOD:
|
432 |
-
return ( ! empty( $this->method )) ? $this->method : false;
|
433 |
-
break;
|
434 |
-
case util::$PRODID:
|
435 |
-
if( empty( $this->prodid ))
|
436 |
-
$this->makeProdid();
|
437 |
-
return $this->prodid;
|
438 |
-
break;
|
439 |
-
case util::$VERSION:
|
440 |
-
return ( ! empty( $this->version )) ? $this->version : false;
|
441 |
-
break;
|
442 |
-
default:
|
443 |
-
if( $propName != util::$X_PROP ) {
|
444 |
-
if( ! isset( $this->xprop[$propName] ))
|
445 |
-
return false;
|
446 |
-
return ( $inclParam ) ? [$propName,
|
447 |
-
$this->xprop[$propName]]
|
448 |
-
: [$propName,
|
449 |
-
$this->xprop[$propName][util::$LCvalue]];
|
450 |
-
}
|
451 |
-
else {
|
452 |
-
if( empty( $this->xprop ))
|
453 |
-
return false;
|
454 |
-
$xpropno = 0;
|
455 |
-
foreach( $this->xprop as $xpropKey => $xpropValue ) {
|
456 |
-
if( $propix == $xpropno )
|
457 |
-
return ( $inclParam ) ? [$xpropKey,
|
458 |
-
$xpropValue]
|
459 |
-
: [$xpropKey,
|
460 |
-
$xpropValue[util::$LCvalue]];
|
461 |
-
else
|
462 |
-
$xpropno++;
|
463 |
-
}
|
464 |
-
unset( $this->propix[$propName] );
|
465 |
-
return false; // not found ??
|
466 |
-
}
|
467 |
-
}
|
468 |
-
return false;
|
469 |
-
}
|
470 |
-
/**
|
471 |
-
* General vcalendar set property method
|
472 |
-
*
|
473 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
474 |
-
* @since 2.22.23 - 2017-04-09
|
475 |
-
* @param mixed $args variable number of function arguments,
|
476 |
-
* first argument is ALWAYS component name,
|
477 |
-
* second ALWAYS component value!
|
478 |
-
* @return bool
|
479 |
-
*/
|
480 |
-
public function setProperty () {
|
481 |
-
$numargs = func_num_args();
|
482 |
-
if( 1 > $numargs )
|
483 |
-
return false;
|
484 |
-
$arglist = func_get_args();
|
485 |
-
switch( strtoupper( $arglist[0] )) {
|
486 |
-
case util::$CALSCALE:
|
487 |
-
return $this->setCalscale( $arglist[1] );
|
488 |
-
case util::$METHOD:
|
489 |
-
return $this->setMethod( $arglist[1] );
|
490 |
-
case util::$VERSION:
|
491 |
-
return $this->setVersion( $arglist[1] );
|
492 |
-
default:
|
493 |
-
if( ! isset( $arglist[1] ))
|
494 |
-
$arglist[1] = null;
|
495 |
-
if( ! isset( $arglist[2] ))
|
496 |
-
$arglist[2] = null;
|
497 |
-
return $this->setXprop( $arglist[0], $arglist[1], $arglist[2] );
|
498 |
-
}
|
499 |
-
return false;
|
500 |
-
}
|
501 |
-
/**
|
502 |
-
* Add calendar component to vcalendar
|
503 |
-
*
|
504 |
-
* alias to setComponent
|
505 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
506 |
-
* @since 1.x.x - 2007-04-24
|
507 |
-
* @param object $component calendar component
|
508 |
-
*/
|
509 |
-
public function addComponent( $component ) {
|
510 |
-
$this->setComponent( $component );
|
511 |
-
return true;
|
512 |
-
}
|
513 |
-
/**
|
514 |
-
* Return clone of calendar component
|
515 |
-
*
|
516 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
517 |
-
* @since 2.23.14 - 2017-05-02
|
518 |
-
* @param mixed $arg1 ordno/component type/ component uid
|
519 |
-
* @param mixed $arg2 ordno if arg1 = component type
|
520 |
-
* @return calendarComponent on success, bool false on error
|
521 |
-
*/
|
522 |
-
public function getComponent( $arg1=null, $arg2=null ) {
|
523 |
-
static $INDEX = 'INDEX';
|
524 |
-
$index = $argType = null;
|
525 |
-
switch( true ) {
|
526 |
-
case ( is_null( $arg1 )) : // first or next in component chain
|
527 |
-
$argType = $INDEX;
|
528 |
-
if( isset( $this->compix[$INDEX] ))
|
529 |
-
$this->compix[$INDEX] = $this->compix[$INDEX] + 1;
|
530 |
-
else
|
531 |
-
$this->compix = [$INDEX => 1];
|
532 |
-
$index = $this->compix[$INDEX];
|
533 |
-
break;
|
534 |
-
case ( is_array( $arg1 )) : // [ *[propertyName => propertyValue] ]
|
535 |
-
$arg2 = implode( util::$MINUS, array_keys( $arg1 ));
|
536 |
-
if( isset( $this->compix[$arg2] ))
|
537 |
-
$this->compix[$arg2] = $this->compix[$arg2] + 1;
|
538 |
-
else
|
539 |
-
$this->compix = [$arg2 => 1];
|
540 |
-
$index = $this->compix[$arg2];
|
541 |
-
break;
|
542 |
-
case ( ctype_digit( (string) $arg1 )) : // specific component in chain
|
543 |
-
$argType = $INDEX;
|
544 |
-
$index = (int) $arg1;
|
545 |
-
$this->compix = [];
|
546 |
-
break;
|
547 |
-
case ( in_array( strtolower( $arg1 ), util::$MCOMPS ) &&
|
548 |
-
( 0 != strcasecmp( $arg1, util::$LCVALARM ))) : // object class name
|
549 |
-
unset( $this->compix[$INDEX] );
|
550 |
-
$argType = strtolower( $arg1 );
|
551 |
-
if( is_null( $arg2 )) {
|
552 |
-
if( isset( $this->compix[$argType] ))
|
553 |
-
$this->compix[$argType] = $this->compix[$argType] + 1;
|
554 |
-
else
|
555 |
-
$this->compix = [$argType => 1];
|
556 |
-
$index = $this->compix[$argType];
|
557 |
-
}
|
558 |
-
elseif( isset( $arg2 ) && ctype_digit( (string) $arg2 ))
|
559 |
-
$index = (int) $arg2;
|
560 |
-
break;
|
561 |
-
case ( is_string( $arg1 )) : // assume UID as 1st argument
|
562 |
-
if( is_null( $arg2 )) {
|
563 |
-
if( isset( $this->compix[$arg1] ))
|
564 |
-
$this->compix[$arg1] = $this->compix[$arg1] + 1;
|
565 |
-
else
|
566 |
-
$this->compix = [$arg1 => 1];
|
567 |
-
$index = $this->compix[$arg1];
|
568 |
-
}
|
569 |
-
elseif( isset( $arg2 ) && ctype_digit( (string) $arg2 ))
|
570 |
-
$index = (int) $arg2;
|
571 |
-
break;
|
572 |
-
} // end switch( true )
|
573 |
-
if( isset( $index ))
|
574 |
-
$index -= 1;
|
575 |
-
$ckeys = array_keys( $this->components );
|
576 |
-
if( ! empty( $index ) && ( $index > end( $ckeys )))
|
577 |
-
return false;
|
578 |
-
$cix1gC = 0;
|
579 |
-
foreach( $ckeys as $cix ) {
|
580 |
-
if( empty( $this->components[$cix] ))
|
581 |
-
continue;
|
582 |
-
if(( $INDEX == $argType ) && ( $index == $cix ))
|
583 |
-
return clone $this->components[$cix];
|
584 |
-
elseif( 0 == strcmp( $argType, $this->components[$cix]->objName )) {
|
585 |
-
if( $index == $cix1gC )
|
586 |
-
return clone $this->components[$cix];
|
587 |
-
$cix1gC++;
|
588 |
-
}
|
589 |
-
elseif( is_array( $arg1 )) { // [ *[propertyName => propertyValue] ]
|
590 |
-
$hit = [];
|
591 |
-
$arg1 = array_change_key_case( $arg1, CASE_UPPER );
|
592 |
-
foreach( $arg1 as $pName => $pValue ) {
|
593 |
-
if( ! in_array( $pName, util::$DATEPROPS ) &&
|
594 |
-
! in_array( $pName, util::$OTHERPROPS ))
|
595 |
-
continue;
|
596 |
-
if( in_array( $pName, util::$MPROPS1 )) { // multiple occurrence
|
597 |
-
$propValues = [];
|
598 |
-
$this->components[$cix]->getProperties( $pName, $propValues );
|
599 |
-
$propValues = array_keys( $propValues );
|
600 |
-
$hit[] = ( in_array( $pValue, $propValues ));
|
601 |
-
continue;
|
602 |
-
} // end if(.. .// multiple occurrence
|
603 |
-
if( false === ( $value = $this->components[$cix]->getProperty( $pName ))) { // single occurrence
|
604 |
-
$hit[] = false; // missing property
|
605 |
-
continue;
|
606 |
-
}
|
607 |
-
if( util::$SUMMARY == $pName ) { // exists within (any case)
|
608 |
-
$hit[] = ( false !== stripos( $value, $pValue )) ? true : false;
|
609 |
-
continue;
|
610 |
-
}
|
611 |
-
if( in_array( $pName, util::$DATEPROPS )) {
|
612 |
-
$valueDate = sprintf( util::$YMD, (int) $value[util::$LCYEAR],
|
613 |
-
(int) $value[util::$LCMONTH],
|
614 |
-
(int) $value[util::$LCDAY] );
|
615 |
-
if( 8 < strlen( $pValue )) {
|
616 |
-
if( isset( $value[util::$LCHOUR] )) {
|
617 |
-
if( util::$T == substr( $pValue, 8, 1 ))
|
618 |
-
$pValue = str_replace( util::$T, null, $pValue );
|
619 |
-
$valueDate .= sprintf( util::$HIS, (int) $value[util::$LCHOUR],
|
620 |
-
(int) $value[util::$LCMIN],
|
621 |
-
(int) $value[util::$LCSEC] );
|
622 |
-
}
|
623 |
-
else
|
624 |
-
$pValue = substr( $pValue, 0, 8 );
|
625 |
-
}
|
626 |
-
$hit[] = ( $pValue == $valueDate ) ? true : false;
|
627 |
-
continue;
|
628 |
-
}
|
629 |
-
elseif( !is_array( $value ))
|
630 |
-
$value = [$value];
|
631 |
-
foreach( $value as $part ) {
|
632 |
-
$part = ( false !== strpos( $part, util::$COMMA ))
|
633 |
-
? explode( util::$COMMA, $part ) : [$part];
|
634 |
-
foreach( $part as $subPart ) {
|
635 |
-
if( $pValue == $subPart ) {
|
636 |
-
$hit[] = true;
|
637 |
-
continue 3;
|
638 |
-
}
|
639 |
-
}
|
640 |
-
} // end foreach( $value as $part )
|
641 |
-
$hit[] = false; // no hit in property
|
642 |
-
} // end foreach( $arg1 as $pName => $pValue )
|
643 |
-
if( in_array( true, $hit )) {
|
644 |
-
if( $index == $cix1gC )
|
645 |
-
return clone $this->components[$cix];
|
646 |
-
$cix1gC++;
|
647 |
-
}
|
648 |
-
} // end elseif( is_array( $arg1 )) { // [ *[propertyName => propertyValue] ]
|
649 |
-
elseif( ! $argType &&
|
650 |
-
( $arg1 == $this->components[$cix]->getProperty( util::$UID ))) {
|
651 |
-
if( $index == $cix1gC )
|
652 |
-
return clone $this->components[$cix];
|
653 |
-
$cix1gC++;
|
654 |
-
}
|
655 |
-
} // end foreach( $ckeys as $cix )
|
656 |
-
/* not found.. . */
|
657 |
-
$this->compix = [];
|
658 |
-
return false;
|
659 |
-
}
|
660 |
-
/**
|
661 |
-
* Return vevent object instance, vcalendar::newComponent() wrapper
|
662 |
-
*
|
663 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
664 |
-
* @since 2.23.20 - 2017-06-26
|
665 |
-
* @return object
|
666 |
-
*/
|
667 |
-
public function newVevent() {
|
668 |
-
return $this->newComponent( util::$LCVEVENT );
|
669 |
-
}
|
670 |
-
/**
|
671 |
-
* Return vtodo object instance, vcalendar::newComponent() wrapper
|
672 |
-
*
|
673 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
674 |
-
* @since 2.23.20 - 2017-06-26
|
675 |
-
* @return object
|
676 |
-
*/
|
677 |
-
public function newVtodo() {
|
678 |
-
return $this->newComponent( util::$LCVTODO );
|
679 |
-
}
|
680 |
-
/**
|
681 |
-
* Return vjournal object instance, vcalendar::newComponent() wrapper
|
682 |
-
*
|
683 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
684 |
-
* @since 2.23.20 - 2017-06-26
|
685 |
-
* @return object
|
686 |
-
*/
|
687 |
-
public function newVjournal() {
|
688 |
-
return $this->newComponent( util::$LCVJOURNAL );
|
689 |
-
}
|
690 |
-
/**
|
691 |
-
* Return vfreebusy object instance, vcalendar::newComponent() wrapper
|
692 |
-
*
|
693 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
694 |
-
* @since 2.23.20 - 2017-06-26
|
695 |
-
* @return object
|
696 |
-
*/
|
697 |
-
public function newVfreebusy() {
|
698 |
-
return $this->newComponent( util::$LCVFREEBUSY );
|
699 |
-
}
|
700 |
-
/**
|
701 |
-
* Return vtimezone object instance, vcalendar::newComponent() wrapper
|
702 |
-
*
|
703 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
704 |
-
* @since 2.23.20 - 2017-06-26
|
705 |
-
* @return object
|
706 |
-
*/
|
707 |
-
public function newVtimezone() {
|
708 |
-
return $this->newComponent( util::$LCVTIMEZONE );
|
709 |
-
}
|
710 |
-
/**
|
711 |
-
* Replace calendar component in vcalendar
|
712 |
-
*
|
713 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
714 |
-
* @since 2.21.11 - 2015-03-21
|
715 |
-
* @param object $component calendar component
|
716 |
-
* @return bool
|
717 |
-
*/
|
718 |
-
public function replaceComponent( $component ) {
|
719 |
-
if( in_array( $component->objName, util::$VCOMPS ))
|
720 |
-
return $this->setComponent( $component,
|
721 |
-
$component->getProperty( util::$UID ));
|
722 |
-
if(( util::$LCVTIMEZONE != $component->objName ) ||
|
723 |
-
( false === ( $tzid = $component->getProperty( util::$TZID ))))
|
724 |
-
return false;
|
725 |
-
foreach( $this->components as $cix => $comp ) {
|
726 |
-
if( util::$LCVTIMEZONE != $component->objName )
|
727 |
-
continue;
|
728 |
-
if( $tzid == $comp->getProperty( util::$TZID )) {
|
729 |
-
$component->compix = [];
|
730 |
-
$this->components[$cix] = $component;
|
731 |
-
return true;
|
732 |
-
}
|
733 |
-
}
|
734 |
-
return false;
|
735 |
-
}
|
736 |
-
/**
|
737 |
-
* Return selected components from calendar on date or selectOption basis
|
738 |
-
*
|
739 |
-
* DTSTART MUST be set for every component.
|
740 |
-
* No date check.
|
741 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
742 |
-
* @since 2.23.3 - 2017-03-19
|
743 |
-
* @param mixed $startY (int) start Year, default current Year
|
744 |
-
* ALT. (obj) start date (datetime)
|
745 |
-
* ALT. array selecOptions ( *[ <propName> => <uniqueValue> ] )
|
746 |
-
* @param mixed $startM (int) start Month, default current Month
|
747 |
-
* ALT. (obj) end date (datetime)
|
748 |
-
* @param int $startD start Day, default current Day
|
749 |
-
* @param int $endY end Year, default $startY
|
750 |
-
* @param int $endM end Month, default $startM
|
751 |
-
* @param int $endD end Day, default $startD
|
752 |
-
* @param mixed $cType calendar component type(-s), default false=all else string/array type(-s)
|
753 |
-
* @param bool $flat false (default) => output : array[Year][Month][Day][]
|
754 |
-
* true => output : array[] (ignores split)
|
755 |
-
* @param bool $any true (default) - select component(-s) that occurs within period
|
756 |
-
* false - only component(-s) that starts within period
|
757 |
-
* @param bool $split true (default) - one component copy every DAY it occurs during the
|
758 |
-
* period (implies flat=false)
|
759 |
-
* false - one occurance of component only in output array
|
760 |
-
* @return mixed array on success, bool false on error
|
761 |
-
*/
|
762 |
-
public function selectComponents( $startY=null, $startM=null, $startD=null,
|
763 |
-
$endY=null, $endM=null, $endD=null,
|
764 |
-
$cType=null, $flat=null, $any=null, $split=null ) {
|
765 |
-
return utilSelect::selectComponents( $this,
|
766 |
-
$startY, $startM, $startD,
|
767 |
-
$endY, $endM, $endD,
|
768 |
-
$cType, $flat, $any, $split );
|
769 |
-
}
|
770 |
-
/**
|
771 |
-
* Sort iCal compoments
|
772 |
-
*
|
773 |
-
* Ascending sort on properties (if exist) x-current-dtstart, dtstart,
|
774 |
-
* x-current-dtend, dtend, x-current-due, due, duration, created, dtstamp, uid if called without arguments,
|
775 |
-
* otherwise sorting on specific (argument) property values
|
776 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
777 |
-
* @since 2.22.23 - 2017-02-20
|
778 |
-
* @param string $sortArg
|
779 |
-
*/
|
780 |
-
public function sort( $sortArg=null ) {
|
781 |
-
static $SORTER = ['kigkonsult\iCalcreator\vcalendarSortHandler', 'cmpfcn'];
|
782 |
-
if( 2 > $this->countComponents())
|
783 |
-
return;
|
784 |
-
if( ! is_null( $sortArg )) {
|
785 |
-
$sortArg = strtoupper( $sortArg );
|
786 |
-
if( ! in_array( $sortArg, util::$OTHERPROPS ) &&
|
787 |
-
( util::$DTSTAMP != $sortArg ))
|
788 |
-
$sortArg = null;
|
789 |
-
}
|
790 |
-
foreach( $this->components as $cix => $component )
|
791 |
-
vcalendarSortHandler::setSortArgs( $this->components[$cix], $sortArg );
|
792 |
-
usort( $this->components, $SORTER );
|
793 |
-
}
|
794 |
-
/**
|
795 |
-
* Parse iCal text/file into vcalendar, components, properties and parameters
|
796 |
-
*
|
797 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
798 |
-
* @since 2.23.18 - 2017-06-14
|
799 |
-
* @param mixed $unparsedtext strict rfc2445 formatted, single property string or array of property strings
|
800 |
-
* @param resource $context PHP resource context
|
801 |
-
* @return bool true on success, false on parse error
|
802 |
-
*/
|
803 |
-
public function parse( $unparsedtext=false, $context=null ) {
|
804 |
-
static $NLCHARS = '\n';
|
805 |
-
static $BEGIN_VCALENDAR = 'BEGIN:VCALENDAR';
|
806 |
-
static $END_VCALENDAR = 'END:VCALENDAR';
|
807 |
-
static $ENDSHORTS = ['END:VE', 'END:VF', 'END:VJ', 'END:VT'];
|
808 |
-
static $BEGIN_VEVENT = 'BEGIN:VEVENT';
|
809 |
-
static $BEGIN_VFREEBUSY = 'BEGIN:VFREEBUSY';
|
810 |
-
static $BEGIN_VJOURNAL = 'BEGIN:VJOURNAL';
|
811 |
-
static $BEGIN_VTODO = 'BEGIN:VTODO';
|
812 |
-
static $BEGIN_VTIMEZONE = 'BEGIN:VTIMEZONE';
|
813 |
-
static $DBLS = "\\";
|
814 |
-
static $TRIMCHARS = "\x00..\x1F";
|
815 |
-
static $CALPROPNAMES = null;
|
816 |
-
static $VERSIONPRODID = null;
|
817 |
-
if( is_null( $CALPROPNAMES ))
|
818 |
-
$CALPROPNAMES = [util::$CALSCALE,
|
819 |
-
util::$METHOD,
|
820 |
-
util::$PRODID,
|
821 |
-
util::$VERSION];
|
822 |
-
if( is_null( $VERSIONPRODID ))
|
823 |
-
$VERSIONPRODID = [util::$VERSION,
|
824 |
-
util::$PRODID];
|
825 |
-
$arrParse = false;
|
826 |
-
if( empty( $unparsedtext )) {
|
827 |
-
/* directory+filename is set previously
|
828 |
-
via setConfig url or directory+filename */
|
829 |
-
if( false === ( $file = $this->getConfig( util::$URL ))) {
|
830 |
-
if( false === ( $file = $this->getConfig( util::$DIRFILE )))
|
831 |
-
return false; /* err 1 */
|
832 |
-
if( ! is_file( $file ))
|
833 |
-
return false; /* err 2 */
|
834 |
-
if( ! is_readable( $file ))
|
835 |
-
return false; /* err 3 */
|
836 |
-
}
|
837 |
-
if( ! empty( $context ) && filter_var( $file, FILTER_VALIDATE_URL )) {
|
838 |
-
If( false === ( $rows = file_get_contents( $file, false, $context )))
|
839 |
-
return false; /* err 6 */
|
840 |
-
}
|
841 |
-
elseif( false === ( $rows = file_get_contents( $file )))
|
842 |
-
return false; /* err 5 */
|
843 |
-
} // end if( empty( $unparsedtext ))
|
844 |
-
elseif( is_array( $unparsedtext )) {
|
845 |
-
$rows = implode( $NLCHARS . util::$CRLF, $unparsedtext );
|
846 |
-
$arrParse = true;
|
847 |
-
}
|
848 |
-
else
|
849 |
-
$rows = $unparsedtext;
|
850 |
-
/* fix line folding */
|
851 |
-
$rows = util::convEolChar( $rows, util::$CRLF );
|
852 |
-
if( $arrParse ) {
|
853 |
-
foreach( $rows as $lix => $row )
|
854 |
-
$rows[$lix] = util::trimTrailNL( $row );
|
855 |
-
}
|
856 |
-
/* skip leading (empty/invalid) lines
|
857 |
-
(and remove leading BOM chars etc) */
|
858 |
-
foreach( $rows as $lix => $row ) {
|
859 |
-
if( false !== stripos( $row, $BEGIN_VCALENDAR )) {
|
860 |
-
$rows[$lix] = $BEGIN_VCALENDAR;
|
861 |
-
break;
|
862 |
-
}
|
863 |
-
unset( $rows[$lix] );
|
864 |
-
}
|
865 |
-
if( 3 > count( $rows )) /* err 10 */
|
866 |
-
return false;
|
867 |
-
/* skip trailing empty lines and ensure an end row */
|
868 |
-
$lix = array_keys( $rows );
|
869 |
-
$lix = end( $lix );
|
870 |
-
while( 3 < $lix ) {
|
871 |
-
$tst = trim( $rows[$lix] );
|
872 |
-
if(( $NLCHARS == $tst ) || empty( $tst )) {
|
873 |
-
unset( $rows[$lix] );
|
874 |
-
$lix--;
|
875 |
-
continue;
|
876 |
-
}
|
877 |
-
if( false === stripos( $rows[$lix], $END_VCALENDAR ))
|
878 |
-
$rows[] = $END_VCALENDAR;
|
879 |
-
else
|
880 |
-
$rows[$lix] = $END_VCALENDAR;
|
881 |
-
break;
|
882 |
-
}
|
883 |
-
$comp = $this;
|
884 |
-
$calSync = $compSync = 0;
|
885 |
-
/* identify components and update unparsed data for components */
|
886 |
-
$compClosed = true; // used in case of missing END-comp-row
|
887 |
-
$config = $this->getConfig();
|
888 |
-
foreach( $rows as $lix => $row ) {
|
889 |
-
switch( true ) {
|
890 |
-
case ( 0 == strcasecmp( $BEGIN_VCALENDAR, substr( $row, 0, 15 ))) :
|
891 |
-
$calSync++;
|
892 |
-
break;
|
893 |
-
case ( 0 == strcasecmp( $END_VCALENDAR, substr( $row, 0, 13 ))) :
|
894 |
-
if( 0 < $compSync )
|
895 |
-
$this->components[] = $comp;
|
896 |
-
$compSync--;
|
897 |
-
$calSync--;
|
898 |
-
if( 0 != $calSync )
|
899 |
-
return false; /* err 20 */
|
900 |
-
break 2;
|
901 |
-
case ( in_array( strtoupper( substr( $row, 0, 6 )), $ENDSHORTS )) :
|
902 |
-
$this->components[] = $comp;
|
903 |
-
$compSync--;
|
904 |
-
$compClosed = true;
|
905 |
-
break;
|
906 |
-
case ( 0 == strcasecmp( $BEGIN_VEVENT, substr( $row, 0, 12 ))) :
|
907 |
-
if( ! $compClosed ) {
|
908 |
-
$this->components[] = $comp;
|
909 |
-
$compSync--;
|
910 |
-
}
|
911 |
-
$comp = new vevent( $config );
|
912 |
-
$compSync++;
|
913 |
-
$compClosed = false;
|
914 |
-
break;
|
915 |
-
case ( 0 == strcasecmp( $BEGIN_VFREEBUSY, substr( $row, 0, 15 ))) :
|
916 |
-
if( ! $compClosed ) {
|
917 |
-
$this->components[] = $comp;
|
918 |
-
$compSync--;
|
919 |
-
}
|
920 |
-
$comp = new vfreebusy( $config );
|
921 |
-
$compSync++;
|
922 |
-
$compClosed = false;
|
923 |
-
break;
|
924 |
-
case ( 0 == strcasecmp( $BEGIN_VJOURNAL, substr( $row, 0, 14 ))) :
|
925 |
-
if( ! $compClosed ) {
|
926 |
-
$this->components[] = $comp;
|
927 |
-
$compSync--;
|
928 |
-
}
|
929 |
-
$comp = new vjournal( $config );
|
930 |
-
$compSync++;
|
931 |
-
$compClosed = false;
|
932 |
-
break;
|
933 |
-
case ( 0 == strcasecmp( $BEGIN_VTODO, substr( $row, 0, 11 ))) :
|
934 |
-
if( ! $compClosed ) {
|
935 |
-
$this->components[] = $comp;
|
936 |
-
$compSync--;
|
937 |
-
}
|
938 |
-
$comp = new vtodo( $config );
|
939 |
-
$compSync++;
|
940 |
-
$compClosed = false;
|
941 |
-
break;
|
942 |
-
case ( 0 == strcasecmp( $BEGIN_VTIMEZONE, substr( $row, 0, 15 ))) :
|
943 |
-
if( ! $compClosed ) {
|
944 |
-
$this->components[] = $comp;
|
945 |
-
$compSync--;
|
946 |
-
}
|
947 |
-
$comp = new vtimezone( $config );
|
948 |
-
$compSync++;
|
949 |
-
$compClosed = false;
|
950 |
-
break;
|
951 |
-
default : /* update component with unparsed data */
|
952 |
-
$comp->unparsed[] = $row;
|
953 |
-
break;
|
954 |
-
} // switch( true )
|
955 |
-
} // end foreach( $rows as $lix => $row )
|
956 |
-
/* parse data for calendar (this) object */
|
957 |
-
if( isset( $this->unparsed ) &&
|
958 |
-
is_array( $this->unparsed ) &&
|
959 |
-
( count( $this->unparsed ) > 0 )) {
|
960 |
-
/* concatenate property values spread over several rows */
|
961 |
-
foreach( util::concatRows( $this->unparsed ) as $lx => $row ) {
|
962 |
-
/* split property name and opt.params and value */
|
963 |
-
list( $propName, $row ) = util::getPropName( $row );
|
964 |
-
if( ! util::isXprefixed( $propName ) &&
|
965 |
-
! in_array( strtoupper( $propName ), $CALPROPNAMES ) && // skip non standard property names
|
966 |
-
in_array( strtoupper( $propName ), $VERSIONPRODID )) // ignore version/prodid properties
|
967 |
-
continue;
|
968 |
-
/* separate attributes from value */
|
969 |
-
util::splitContent( $row, $propAttr );
|
970 |
-
/* update Property */
|
971 |
-
$this->setProperty( $propName,
|
972 |
-
util::strunrep( rtrim( $row, $TRIMCHARS )),
|
973 |
-
$propAttr );
|
974 |
-
} // end foreach( $propRows as $lx => $row )
|
975 |
-
} // end if( is_array( $this->unparsed.. .
|
976 |
-
unset( $this->unparsed );
|
977 |
-
/* parse Components */
|
978 |
-
if( $this->countComponents() > 0 ) {
|
979 |
-
foreach( $this->components as $ckey => $component ) {
|
980 |
-
if( ! empty( $this->components[$ckey] ) &&
|
981 |
-
! empty( $this->components[$ckey]->unparsed )) {
|
982 |
-
$this->components[$ckey]->parse();
|
983 |
-
}
|
984 |
-
}
|
985 |
-
}
|
986 |
-
else
|
987 |
-
return false; /* err 91 or something.. . */
|
988 |
-
return true;
|
989 |
-
}
|
990 |
-
/**
|
991 |
-
* Return formatted output for calendar object instance
|
992 |
-
*
|
993 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
994 |
-
* @since 2.21.07 - 2015-03-31
|
995 |
-
* @return string
|
996 |
-
*/
|
997 |
-
public function createCalendar() {
|
998 |
-
static $BEGIN_VCALENDAR = "BEGIN:VCALENDAR\r\n";
|
999 |
-
static $END_VCALENDAR = "END:VCALENDAR\r\n";
|
1000 |
-
$calendar = $BEGIN_VCALENDAR;
|
1001 |
-
$calendar .= $this->createVersion();
|
1002 |
-
$calendar .= $this->createProdid();
|
1003 |
-
$calendar .= $this->createCalscale();
|
1004 |
-
$calendar .= $this->createMethod();
|
1005 |
-
$calendar .= $this->createXprop();
|
1006 |
-
$config = $this->getConfig();
|
1007 |
-
foreach( $this->components as $cix => $component ) {
|
1008 |
-
if( ! empty( $component )) {
|
1009 |
-
$this->components[$cix]->setConfig( $config, false, true );
|
1010 |
-
$calendar .= $this->components[$cix]->createComponent();
|
1011 |
-
}
|
1012 |
-
}
|
1013 |
-
return $calendar . $END_VCALENDAR;
|
1014 |
-
}
|
1015 |
-
/**
|
1016 |
-
* Save calendar content in a file
|
1017 |
-
*
|
1018 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1019 |
-
* @since 2.21.5 - 2015-03-29
|
1020 |
-
* @return bool true on success, false on error
|
1021 |
-
*/
|
1022 |
-
public function saveCalendar() {
|
1023 |
-
$output = $this->createCalendar();
|
1024 |
-
if( false === ( $dirfile = $this->getConfig( util::$URL )))
|
1025 |
-
$dirfile = $this->getConfig( util::$DIRFILE );
|
1026 |
-
return ( false === file_put_contents( $dirfile, $output, LOCK_EX )) ? false : true;
|
1027 |
-
}
|
1028 |
-
/**
|
1029 |
-
* Return created, updated and/or parsed calendar,
|
1030 |
-
* sending a HTTP redirect header.
|
1031 |
-
*
|
1032 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1033 |
-
* @since 2.23.6 - 2017-04-13
|
1034 |
-
* @param bool $utf8Encode
|
1035 |
-
* @param bool $gzip
|
1036 |
-
* @param bool $cdType true : Content-Disposition: attachment... (default), false : ...inline...
|
1037 |
-
* @return bool true on success, false on error
|
1038 |
-
*/
|
1039 |
-
public function returnCalendar( $utf8Encode=false, $gzip=false, $cdType=true ) {
|
1040 |
-
return utilRedirect::returnCalendar( $this,
|
1041 |
-
$utf8Encode,
|
1042 |
-
$gzip,
|
1043 |
-
$cdType );
|
1044 |
-
}
|
1045 |
-
/**
|
1046 |
-
* If recent version of calendar file exists (default one hour), an HTTP redirect header is sent
|
1047 |
-
* else false is returned.
|
1048 |
-
*
|
1049 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
1050 |
-
* @since 2.23.6 - 2017-04-13
|
1051 |
-
* @param int $timeout default 3600 sec
|
1052 |
-
* @param bool $cdType true : Content-Disposition: attachment... (default), false : ...inline...
|
1053 |
-
* @return bool true on success, false on error
|
1054 |
-
*/
|
1055 |
-
public function useCachedCalendar( $timeout=3600, $cdType=true ) {
|
1056 |
-
return utilRedirect::useCachedCalendar( $this,
|
1057 |
-
$timeout,
|
1058 |
-
$cdType );
|
1059 |
-
}
|
1060 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/vcalendarSortHandler.php
DELETED
@@ -1,299 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* iCalcreator vcalendarSortHandler class
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.23.9 - 2017-04-22
|
38 |
-
*/
|
39 |
-
class vcalendarSortHandler {
|
40 |
-
/**
|
41 |
-
* vcalendar sort callback function
|
42 |
-
*
|
43 |
-
* @since 2.23.9 - 2017-04-20
|
44 |
-
* @param calendarComponent $a
|
45 |
-
* @param calendarComponent $b
|
46 |
-
* @return int
|
47 |
-
* @static
|
48 |
-
*/
|
49 |
-
public static function cmpfcn( calendarComponent $a, calendarComponent $b ) {
|
50 |
-
if( empty( $a )) return -1;
|
51 |
-
if( empty( $b )) return 1;
|
52 |
-
if( util::$LCVTIMEZONE == $a->objName ) {
|
53 |
-
if( util::$LCVTIMEZONE != $b->objName ) return -1;
|
54 |
-
elseif( $a->srtk[0] <= $b->srtk[0] ) return -1;
|
55 |
-
else return 1;
|
56 |
-
}
|
57 |
-
elseif( util::$LCVTIMEZONE == $b->objName ) return 1;
|
58 |
-
for( $k = 0; $k < 4 ; $k++ ) {
|
59 |
-
if( empty( $a->srtk[$k] )) return -1;
|
60 |
-
elseif( empty( $b->srtk[$k] )) return 1;
|
61 |
-
$sortStat = strcmp( $a->srtk[$k], $b->srtk[$k] );
|
62 |
-
if( 0 == $sortStat )
|
63 |
-
continue;
|
64 |
-
return ( 0 < $sortStat ) ? 1 : -1;
|
65 |
-
}
|
66 |
-
return 0;
|
67 |
-
}
|
68 |
-
/**
|
69 |
-
* Set sort arguments/parameters in component
|
70 |
-
*
|
71 |
-
* @since 2.23.19 - 2017-04-22
|
72 |
-
* @param calendarComponent $c valendar component
|
73 |
-
* @param string $sortArg
|
74 |
-
* @static
|
75 |
-
*/
|
76 |
-
public static function setSortArgs( calendarComponent $c, $sortArg=null ) {
|
77 |
-
static $INITARR = ['0', '0', '0', '0'];
|
78 |
-
$c->srtk = $INITARR;
|
79 |
-
if( util::$LCVTIMEZONE == $c->objName ) {
|
80 |
-
if( false === ( $c->srtk[0] = $c->getProperty( util::$TZID )))
|
81 |
-
$c->srtk[0] = 0;
|
82 |
-
return;
|
83 |
-
}
|
84 |
-
elseif( ! is_null( $sortArg )) {
|
85 |
-
if( in_array( $sortArg, util::$MPROPS1 )) { // all string
|
86 |
-
$propValues = [];
|
87 |
-
$c->getProperties( $sortArg, $propValues );
|
88 |
-
if( ! empty( $propValues )) {
|
89 |
-
$c->srtk[0] = key( array_slice( $propValues, 0, 1, TRUE ));
|
90 |
-
if( util::$RELATED_TO == $sortArg )
|
91 |
-
$c->srtk[0] .= $c->getProperty( util::$UID );
|
92 |
-
}
|
93 |
-
elseif( util::$RELATED_TO == $sortArg )
|
94 |
-
$c->srtk[0] = $c->getProperty( util::$UID );
|
95 |
-
} // end if( in_array( $sortArg, util::$MPROPS1 ))
|
96 |
-
elseif( false !== ( $d = $c->getProperty( $sortArg ))) {
|
97 |
-
$c->srtk[0] = ( util::isArrayDate( $d )) ? self::arrDate2str( $d ) : $d;
|
98 |
-
if( util::$UID == $sortArg ) {
|
99 |
-
if( false !== ( $d = $c->getProperty( util::$RECURRENCE_ID ))) {
|
100 |
-
$c->srtk[1] = self::arrDate2str( $d );
|
101 |
-
if( false === ( $c->srtk[2] = $c->getProperty( util::$SEQUENCE )))
|
102 |
-
$c->srtk[2] = PHP_INT_MAX;
|
103 |
-
}
|
104 |
-
else
|
105 |
-
$c->srtk[1] = $c->srtk[2] = PHP_INT_MAX;
|
106 |
-
} // end if( util::$UID == $sortArg )
|
107 |
-
} // end elseif( false !== ( $d = $c->getProperty( $sortArg )))
|
108 |
-
return;
|
109 |
-
} // end elseif( $sortArg )
|
110 |
-
switch( true ) { // sortkey 0 : dtstart
|
111 |
-
case ( false !== ( $d = $c->getProperty( util::$X_CURRENT_DTSTART ))) :
|
112 |
-
$c->srtk[0] = self::arrDate2str( util::strDate2ArrayDate( $d[1] ));
|
113 |
-
break;
|
114 |
-
case ( false !== ( $d = $c->getProperty( util::$DTSTART ))) :
|
115 |
-
$c->srtk[0] = self::arrDate2str( $d );
|
116 |
-
break;
|
117 |
-
}
|
118 |
-
switch( true ) { // sortkey 1 : dtend/due(/duration)
|
119 |
-
case ( false !== ( $d = $c->getProperty( util::$X_CURRENT_DTEND ))) :
|
120 |
-
$c->srtk[1] = self::arrDate2str( util::strDate2ArrayDate( $d[1] ));
|
121 |
-
break;
|
122 |
-
case ( false !== ( $d = $c->getProperty( util::$DTEND ))) :
|
123 |
-
$c->srtk[1] = self::arrDate2str( $d );
|
124 |
-
break;
|
125 |
-
case ( false !== ( $d = $c->getProperty( util::$X_CURRENT_DUE ))) :
|
126 |
-
$c->srtk[1] = self::arrDate2str( util::strDate2ArrayDate( $d[1] ));
|
127 |
-
break;
|
128 |
-
case ( false !== ( $d = $c->getProperty( util::$DUE ))) :
|
129 |
-
$c->srtk[1] = self::arrDate2str( $d );
|
130 |
-
break;
|
131 |
-
case ( false !== ( $d = $c->getProperty( util::$DURATION, false, false, true ))) :
|
132 |
-
$c->srtk[1] = self::arrDate2str( $d );
|
133 |
-
break;
|
134 |
-
}
|
135 |
-
switch( true ) { // sortkey 2 : created/dtstamp
|
136 |
-
case ( false !== ( $d = $c->getProperty( util::$CREATED ))) :
|
137 |
-
$c->srtk[2] = self::arrDate2str( $d );
|
138 |
-
break;
|
139 |
-
case ( false !== ( $d = $c->getProperty( util::$DTSTAMP ))) :
|
140 |
-
$c->srtk[2] = self::arrDate2str( $d );
|
141 |
-
break;
|
142 |
-
}
|
143 |
-
// sortkey 3 : uid
|
144 |
-
if( false === ( $c->srtk[3] = $c->getProperty( util::$UID )))
|
145 |
-
$c->srtk[3] = 0;
|
146 |
-
}
|
147 |
-
/**
|
148 |
-
* Return formatted string from (array) date/datetime
|
149 |
-
*
|
150 |
-
* @param array $aDate
|
151 |
-
* @return string
|
152 |
-
* @access private
|
153 |
-
* @static
|
154 |
-
*/
|
155 |
-
private static function arrDate2str( array $aDate ) {
|
156 |
-
$str = sprintf( util::$YMD,
|
157 |
-
$aDate[util::$LCYEAR],
|
158 |
-
$aDate[util::$LCMONTH],
|
159 |
-
$aDate[util::$LCDAY] );
|
160 |
-
if( isset( $aDate[util::$LCHOUR] ))
|
161 |
-
$str .= sprintf( util::$HIS,
|
162 |
-
$aDate[util::$LCHOUR],
|
163 |
-
$aDate[util::$LCMIN],
|
164 |
-
$aDate[util::$LCSEC] );
|
165 |
-
if( isset( $aDate[util::$LCtz] ) && ! empty( $aDate[util::$LCtz] ))
|
166 |
-
$str .= $aDate[util::$LCtz];
|
167 |
-
return $str;
|
168 |
-
}
|
169 |
-
/**
|
170 |
-
* Sort callback function for exdate
|
171 |
-
*
|
172 |
-
* @param array $a
|
173 |
-
* @param array $b
|
174 |
-
* @return int
|
175 |
-
* @static
|
176 |
-
*/
|
177 |
-
public static function sortExdate1( array $a, array $b ) {
|
178 |
-
$as = sprintf( util::$YMD, (int) $a[util::$LCYEAR],
|
179 |
-
(int) $a[util::$LCMONTH],
|
180 |
-
(int) $a[util::$LCDAY] );
|
181 |
-
$as .= ( isset( $a[util::$LCHOUR] )) ? sprintf( util::$HIS, (int) $a[util::$LCHOUR],
|
182 |
-
(int) $a[util::$LCMIN],
|
183 |
-
(int) $a[util::$LCSEC] )
|
184 |
-
: null;
|
185 |
-
$bs = sprintf( util::$YMD, (int) $b[util::$LCYEAR],
|
186 |
-
(int) $b[util::$LCMONTH],
|
187 |
-
(int) $b[util::$LCDAY] );
|
188 |
-
$bs .= ( isset( $b[util::$LCHOUR] )) ? sprintf( util::$HIS, (int) $b[util::$LCHOUR],
|
189 |
-
(int) $b[util::$LCMIN],
|
190 |
-
(int) $b[util::$LCSEC] )
|
191 |
-
: null;
|
192 |
-
return strcmp( $as, $bs );
|
193 |
-
}
|
194 |
-
/**
|
195 |
-
* Sort callback function for exdate
|
196 |
-
*
|
197 |
-
* @param array $a
|
198 |
-
* @param array $b
|
199 |
-
* @return int
|
200 |
-
* @static
|
201 |
-
*/
|
202 |
-
public static function sortExdate2( array $a, array $b ) {
|
203 |
-
$val = reset( $a[util::$LCvalue] );
|
204 |
-
$as = sprintf( util::$YMD, (int) $val[util::$LCYEAR],
|
205 |
-
(int) $val[util::$LCMONTH],
|
206 |
-
(int) $val[util::$LCDAY] );
|
207 |
-
$as .= ( isset( $val[util::$LCHOUR] )) ? sprintf( util::$HIS, (int) $val[util::$LCHOUR],
|
208 |
-
(int) $val[util::$LCMIN],
|
209 |
-
(int) $val[util::$LCSEC] )
|
210 |
-
: null;
|
211 |
-
$val = reset( $b[util::$LCvalue] );
|
212 |
-
$bs = sprintf( util::$YMD, (int) $val[util::$LCYEAR],
|
213 |
-
(int) $val[util::$LCMONTH],
|
214 |
-
(int) $val[util::$LCDAY] );
|
215 |
-
$bs .= ( isset( $val[util::$LCHOUR] )) ? sprintf( util::$HIS, (int) $val[util::$LCHOUR],
|
216 |
-
(int) $val[util::$LCMIN],
|
217 |
-
(int) $val[util::$LCSEC] )
|
218 |
-
: null;
|
219 |
-
return strcmp( $as, $bs );
|
220 |
-
}
|
221 |
-
/**
|
222 |
-
* Sort callback function for freebusy and rdate, sort single property (inside values)
|
223 |
-
*
|
224 |
-
* @param array $a
|
225 |
-
* @param array $b
|
226 |
-
* @return int
|
227 |
-
* @static
|
228 |
-
*/
|
229 |
-
public static function sortRdate1( array $a, array $b ) {
|
230 |
-
$as = null;
|
231 |
-
if( isset( $a[util::$LCYEAR] ))
|
232 |
-
$as = self::formatdatePart( $a );
|
233 |
-
elseif( isset( $a[0][util::$LCYEAR] )) {
|
234 |
-
$as = self::formatdatePart( $a[0] );
|
235 |
-
$as .= self::formatdatePart( $a[1] );
|
236 |
-
}
|
237 |
-
else
|
238 |
-
return 1;
|
239 |
-
$bs = null;
|
240 |
-
if( isset( $b[util::$LCYEAR] ))
|
241 |
-
$bs = self::formatdatePart( $b );
|
242 |
-
elseif( isset( $b[0][util::$LCYEAR] )) {
|
243 |
-
$bs = self::formatdatePart( $b[0] );
|
244 |
-
$bs .= self::formatdatePart( $b[1] );
|
245 |
-
}
|
246 |
-
else
|
247 |
-
return -1;
|
248 |
-
return strcmp( $as, $bs );
|
249 |
-
}
|
250 |
-
/**
|
251 |
-
* Sort callback function for rdate, sort multiple RDATEs in order (after 1st datetime/date/period)
|
252 |
-
*
|
253 |
-
* @param array $a
|
254 |
-
* @param array $b
|
255 |
-
* @return int
|
256 |
-
* @static
|
257 |
-
*/
|
258 |
-
public static function sortRdate2( array $a, array $b ) {
|
259 |
-
$as = null;
|
260 |
-
if( isset( $a[util::$LCvalue][0][util::$LCYEAR] ))
|
261 |
-
$as = self::formatdatePart( $a[util::$LCvalue][0] );
|
262 |
-
elseif( isset( $a[util::$LCvalue][0][0][util::$LCYEAR] )) {
|
263 |
-
$as = self::formatdatePart( $a[util::$LCvalue][0][0] );
|
264 |
-
$as .= self::formatdatePart( $a[util::$LCvalue][0][1] );
|
265 |
-
}
|
266 |
-
else
|
267 |
-
return 1;
|
268 |
-
$bs = null;
|
269 |
-
if( isset( $b[util::$LCvalue][0][util::$LCYEAR] ))
|
270 |
-
$bs = self::formatdatePart( $b[util::$LCvalue][0] );
|
271 |
-
elseif( isset( $a[util::$LCvalue][0][0][util::$LCYEAR] )) {
|
272 |
-
$bs = self::formatdatePart( $b[util::$LCvalue][0][0] );
|
273 |
-
$bs .= self::formatdatePart( $b[util::$LCvalue][0][1] );
|
274 |
-
}
|
275 |
-
else
|
276 |
-
return -1;
|
277 |
-
return strcmp( $as, $bs );
|
278 |
-
}
|
279 |
-
/**
|
280 |
-
* Format date
|
281 |
-
*
|
282 |
-
* @param array $part
|
283 |
-
* @return string
|
284 |
-
*/
|
285 |
-
private static function formatdatePart( array $part ) {
|
286 |
-
if( isset( $part[util::$LCYEAR] )) {
|
287 |
-
$str = sprintf( util::$YMD, (int) $part[util::$LCYEAR],
|
288 |
-
(int) $part[util::$LCMONTH],
|
289 |
-
(int) $part[util::$LCDAY] );
|
290 |
-
$str .= ( isset( $part[util::$LCHOUR] )) ? sprintf( util::$HIS, (int) $part[util::$LCHOUR],
|
291 |
-
(int) $part[util::$LCMIN],
|
292 |
-
(int) $part[util::$LCSEC] )
|
293 |
-
: null;
|
294 |
-
}
|
295 |
-
else
|
296 |
-
$str = util::duration2str( $part );
|
297 |
-
return $str;
|
298 |
-
}
|
299 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/vevent.php
DELETED
@@ -1,190 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* iCalcreator VEVENT component class
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
class vevent extends calendarComponent {
|
40 |
-
use traits\ATTACHtrait,
|
41 |
-
traits\ATTENDEEtrait,
|
42 |
-
traits\CATEGORIEStrait,
|
43 |
-
traits\CLASStrait,
|
44 |
-
traits\COMMENTtrait,
|
45 |
-
traits\CONTACTtrait,
|
46 |
-
traits\CREATEDtrait,
|
47 |
-
traits\DESCRIPTIONtrait,
|
48 |
-
traits\DTENDtrait,
|
49 |
-
traits\DTSTAMPtrait,
|
50 |
-
traits\DTSTARTtrait,
|
51 |
-
traits\DURATIONtrait,
|
52 |
-
traits\EXDATEtrait,
|
53 |
-
traits\EXRULEtrait,
|
54 |
-
traits\GEOtrait,
|
55 |
-
traits\LAST_MODIFIEDtrait,
|
56 |
-
traits\LOCATIONtrait,
|
57 |
-
traits\ORGANIZERtrait,
|
58 |
-
traits\PRIORITYtrait,
|
59 |
-
traits\RDATEtrait,
|
60 |
-
traits\RECURRENCE_IDtrait,
|
61 |
-
traits\RELATED_TOtrait,
|
62 |
-
traits\REQUEST_STATUStrait,
|
63 |
-
traits\RESOURCEStrait,
|
64 |
-
traits\RRULEtrait,
|
65 |
-
traits\SEQUENCEtrait,
|
66 |
-
traits\STATUStrait,
|
67 |
-
traits\SUMMARYtrait,
|
68 |
-
traits\TRANSPtrait,
|
69 |
-
traits\UIDtrait,
|
70 |
-
traits\URLtrait;
|
71 |
-
/**
|
72 |
-
* Constructor for calendar component VEVENT object
|
73 |
-
*
|
74 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
75 |
-
* @since 2.22.20 - 2017-02-01
|
76 |
-
* @param array $config
|
77 |
-
*/
|
78 |
-
public function __construct( $config = []) {
|
79 |
-
static $E = 'e';
|
80 |
-
parent::__construct();
|
81 |
-
$this->setConfig( util::initConfig( $config ));
|
82 |
-
$this->cno = $E . parent::getObjectNo();
|
83 |
-
}
|
84 |
-
/**
|
85 |
-
* Destructor
|
86 |
-
*
|
87 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
88 |
-
* @since 2.22.23 - 2017-03-18
|
89 |
-
*/
|
90 |
-
public function __destruct() {
|
91 |
-
if( ! empty( $this->components ))
|
92 |
-
foreach( $this->components as $cix => $component )
|
93 |
-
$this->components[$cix]->__destruct();
|
94 |
-
unset( $this->xprop,
|
95 |
-
$this->components,
|
96 |
-
$this->unparsed,
|
97 |
-
$this->config,
|
98 |
-
$this->compix,
|
99 |
-
$this->propix,
|
100 |
-
$this->propdelix );
|
101 |
-
unset( $this->objName,
|
102 |
-
$this->cno );
|
103 |
-
unset( $this->attach,
|
104 |
-
$this->attendee,
|
105 |
-
$this->categories,
|
106 |
-
$this->class,
|
107 |
-
$this->comment,
|
108 |
-
$this->contact,
|
109 |
-
$this->created,
|
110 |
-
$this->description,
|
111 |
-
$this->dtend,
|
112 |
-
$this->dtstamp,
|
113 |
-
$this->dtstart,
|
114 |
-
$this->duration,
|
115 |
-
$this->exdate,
|
116 |
-
$this->exrule,
|
117 |
-
$this->geo,
|
118 |
-
$this->lastmodified,
|
119 |
-
$this->location,
|
120 |
-
$this->organizer,
|
121 |
-
$this->priority,
|
122 |
-
$this->rdate,
|
123 |
-
$this->recurrenceid,
|
124 |
-
$this->relatedto,
|
125 |
-
$this->requeststatus,
|
126 |
-
$this->resources,
|
127 |
-
$this->rrule,
|
128 |
-
$this->sequence,
|
129 |
-
$this->status,
|
130 |
-
$this->summary,
|
131 |
-
$this->transp,
|
132 |
-
$this->uid,
|
133 |
-
$this->url );
|
134 |
-
}
|
135 |
-
/**
|
136 |
-
* Return formatted output for calendar component VEVENT object instance
|
137 |
-
*
|
138 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
139 |
-
* @since 2.10.16 - 2011-10-28
|
140 |
-
* @return string
|
141 |
-
*/
|
142 |
-
public function createComponent() {
|
143 |
-
$objectname = strtoupper( $this->objName );
|
144 |
-
$component = sprintf( util::$FMTBEGIN, $objectname );
|
145 |
-
$component .= $this->createUid();
|
146 |
-
$component .= $this->createDtstamp();
|
147 |
-
$component .= $this->createAttach();
|
148 |
-
$component .= $this->createAttendee();
|
149 |
-
$component .= $this->createCategories();
|
150 |
-
$component .= $this->createComment();
|
151 |
-
$component .= $this->createContact();
|
152 |
-
$component .= $this->createClass();
|
153 |
-
$component .= $this->createCreated();
|
154 |
-
$component .= $this->createDescription();
|
155 |
-
$component .= $this->createDtstart();
|
156 |
-
$component .= $this->createDtend();
|
157 |
-
$component .= $this->createDuration();
|
158 |
-
$component .= $this->createExdate();
|
159 |
-
$component .= $this->createExrule();
|
160 |
-
$component .= $this->createGeo();
|
161 |
-
$component .= $this->createLastModified();
|
162 |
-
$component .= $this->createLocation();
|
163 |
-
$component .= $this->createOrganizer();
|
164 |
-
$component .= $this->createPriority();
|
165 |
-
$component .= $this->createRdate();
|
166 |
-
$component .= $this->createRrule();
|
167 |
-
$component .= $this->createRelatedTo();
|
168 |
-
$component .= $this->createRequestStatus();
|
169 |
-
$component .= $this->createRecurrenceid();
|
170 |
-
$component .= $this->createResources();
|
171 |
-
$component .= $this->createSequence();
|
172 |
-
$component .= $this->createStatus();
|
173 |
-
$component .= $this->createSummary();
|
174 |
-
$component .= $this->createTransp();
|
175 |
-
$component .= $this->createUrl();
|
176 |
-
$component .= $this->createXprop();
|
177 |
-
$component .= $this->createSubComponent();
|
178 |
-
return $component . sprintf( util::$FMTEND, $objectname );
|
179 |
-
}
|
180 |
-
/**
|
181 |
-
* Return valarm object instance, calendarComponent::newComponent() wrapper
|
182 |
-
*
|
183 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
184 |
-
* @since 2.23.20 - 2017-06-26
|
185 |
-
* @return object
|
186 |
-
*/
|
187 |
-
public function newValarm() {
|
188 |
-
return $this->newComponent( util::$LCVALARM );
|
189 |
-
}
|
190 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/vfreebusy.php
DELETED
@@ -1,119 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* iCalcreator VFREEBUSY component class
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-02
|
38 |
-
*/
|
39 |
-
class vfreebusy extends calendarComponent {
|
40 |
-
use traits\ATTENDEEtrait,
|
41 |
-
traits\COMMENTtrait,
|
42 |
-
traits\CONTACTtrait,
|
43 |
-
traits\DTENDtrait,
|
44 |
-
traits\DTSTAMPtrait,
|
45 |
-
traits\DTSTARTtrait,
|
46 |
-
traits\DURATIONtrait,
|
47 |
-
traits\FREEBUSYtrait,
|
48 |
-
traits\ORGANIZERtrait,
|
49 |
-
traits\REQUEST_STATUStrait,
|
50 |
-
traits\UIDtrait,
|
51 |
-
traits\URLtrait;
|
52 |
-
/**
|
53 |
-
* Constructor for calendar component VFREEBUSY object
|
54 |
-
*
|
55 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
56 |
-
* @since 2.22.20 - 2017-02-01
|
57 |
-
* @param array $config
|
58 |
-
*/
|
59 |
-
public function __construct( $config = []) {
|
60 |
-
static $F = 'f';
|
61 |
-
parent::__construct();
|
62 |
-
$this->setConfig( util::initConfig( $config ));
|
63 |
-
$this->cno = $F . parent::getObjectNo();
|
64 |
-
}
|
65 |
-
/**
|
66 |
-
* Destructor
|
67 |
-
*
|
68 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
69 |
-
* @since 2.22.23 - 2017-03-18
|
70 |
-
*/
|
71 |
-
public function __destruct() {
|
72 |
-
unset( $this->xprop,
|
73 |
-
$this->components,
|
74 |
-
$this->unparsed,
|
75 |
-
$this->config,
|
76 |
-
$this->propix,
|
77 |
-
$this->compix,
|
78 |
-
$this->propdelix );
|
79 |
-
unset( $this->objName,
|
80 |
-
$this->cno );
|
81 |
-
unset( $this->attendee,
|
82 |
-
$this->comment,
|
83 |
-
$this->contact,
|
84 |
-
$this->dtend,
|
85 |
-
$this->dtstamp,
|
86 |
-
$this->dtstart,
|
87 |
-
$this->duration,
|
88 |
-
$this->freebusy,
|
89 |
-
$this->organizer,
|
90 |
-
$this->requeststatus,
|
91 |
-
$this->uid,
|
92 |
-
$this->url );
|
93 |
-
}
|
94 |
-
/**
|
95 |
-
* Return formatted output for calendar component VFREEBUSY object instance
|
96 |
-
*
|
97 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
98 |
-
* @since 2.3.1 - 2007-11-19
|
99 |
-
* @return string
|
100 |
-
*/
|
101 |
-
public function createComponent() {
|
102 |
-
$objectname = strtoupper( $this->objName );
|
103 |
-
$component = sprintf( util::$FMTBEGIN, $objectname );
|
104 |
-
$component .= $this->createUid();
|
105 |
-
$component .= $this->createDtstamp();
|
106 |
-
$component .= $this->createAttendee();
|
107 |
-
$component .= $this->createComment();
|
108 |
-
$component .= $this->createContact();
|
109 |
-
$component .= $this->createDtstart();
|
110 |
-
$component .= $this->createDtend();
|
111 |
-
$component .= $this->createDuration();
|
112 |
-
$component .= $this->createFreebusy();
|
113 |
-
$component .= $this->createOrganizer();
|
114 |
-
$component .= $this->createRequestStatus();
|
115 |
-
$component .= $this->createUrl();
|
116 |
-
$component .= $this->createXprop();
|
117 |
-
return $component . sprintf( util::$FMTEND, $objectname );
|
118 |
-
}
|
119 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/vjournal.php
DELETED
@@ -1,155 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* iCalcreator VJOURNAL component class
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-01
|
38 |
-
*/
|
39 |
-
class vjournal extends calendarComponent {
|
40 |
-
use traits\ATTACHtrait,
|
41 |
-
traits\ATTENDEEtrait,
|
42 |
-
traits\CATEGORIEStrait,
|
43 |
-
traits\CLASStrait,
|
44 |
-
traits\COMMENTtrait,
|
45 |
-
traits\CONTACTtrait,
|
46 |
-
traits\CREATEDtrait,
|
47 |
-
traits\DESCRIPTIONtrait,
|
48 |
-
traits\DTSTAMPtrait,
|
49 |
-
traits\DTSTARTtrait,
|
50 |
-
traits\EXDATEtrait,
|
51 |
-
traits\EXRULEtrait,
|
52 |
-
traits\LAST_MODIFIEDtrait,
|
53 |
-
traits\ORGANIZERtrait,
|
54 |
-
traits\RDATEtrait,
|
55 |
-
traits\RECURRENCE_IDtrait,
|
56 |
-
traits\RELATED_TOtrait,
|
57 |
-
traits\REQUEST_STATUStrait,
|
58 |
-
traits\RRULEtrait,
|
59 |
-
traits\SEQUENCEtrait,
|
60 |
-
traits\STATUStrait,
|
61 |
-
traits\SUMMARYtrait,
|
62 |
-
traits\UIDtrait,
|
63 |
-
traits\URLtrait;
|
64 |
-
/**
|
65 |
-
* Constructor for calendar component VJOURNAL object
|
66 |
-
*
|
67 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
68 |
-
* @since 2.22.20 - 2017-02-01
|
69 |
-
* @param array $config
|
70 |
-
*/
|
71 |
-
public function __construct( $config = []) {
|
72 |
-
static $J = 'j';
|
73 |
-
parent::__construct();
|
74 |
-
$this->setConfig( util::initConfig( $config ));
|
75 |
-
$this->cno = $J . parent::getObjectNo();
|
76 |
-
}
|
77 |
-
/**
|
78 |
-
* Destructor
|
79 |
-
*
|
80 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
81 |
-
* @since 2.22.23 - 2017-03-18
|
82 |
-
*/
|
83 |
-
public function __destruct() {
|
84 |
-
unset( $this->xprop,
|
85 |
-
$this->components,
|
86 |
-
$this->unparsed,
|
87 |
-
$this->config,
|
88 |
-
$this->compix,
|
89 |
-
$this->propix,
|
90 |
-
$this->propdelix );
|
91 |
-
unset( $this->objName,
|
92 |
-
$this->cno );
|
93 |
-
unset( $this->attach,
|
94 |
-
$this->attendee,
|
95 |
-
$this->categories,
|
96 |
-
$this->class,
|
97 |
-
$this->comment,
|
98 |
-
$this->contact,
|
99 |
-
$this->created,
|
100 |
-
$this->description,
|
101 |
-
$this->dtstamp,
|
102 |
-
$this->dtstart,
|
103 |
-
$this->exdate,
|
104 |
-
$this->exrule,
|
105 |
-
$this->lastmodified,
|
106 |
-
$this->organizer,
|
107 |
-
$this->rdate,
|
108 |
-
$this->recurrenceid,
|
109 |
-
$this->relatedto,
|
110 |
-
$this->requeststatus,
|
111 |
-
$this->rrule,
|
112 |
-
$this->sequence,
|
113 |
-
$this->status,
|
114 |
-
$this->summary,
|
115 |
-
$this->uid,
|
116 |
-
$this->url );
|
117 |
-
}
|
118 |
-
/**
|
119 |
-
* Return formatted output for calendar component VJOURNAL object instance
|
120 |
-
*
|
121 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
122 |
-
* @since 2.5.1 - 2008-10-12
|
123 |
-
* @return string
|
124 |
-
*/
|
125 |
-
public function createComponent() {
|
126 |
-
$objectname = strtoupper( $this->objName );
|
127 |
-
$component = sprintf( util::$FMTBEGIN, $objectname );
|
128 |
-
$component .= $this->createUid();
|
129 |
-
$component .= $this->createDtstamp();
|
130 |
-
$component .= $this->createAttach();
|
131 |
-
$component .= $this->createAttendee();
|
132 |
-
$component .= $this->createCategories();
|
133 |
-
$component .= $this->createClass();
|
134 |
-
$component .= $this->createComment();
|
135 |
-
$component .= $this->createContact();
|
136 |
-
$component .= $this->createCreated();
|
137 |
-
$component .= $this->createDescription();
|
138 |
-
$component .= $this->createDtstart();
|
139 |
-
$component .= $this->createExdate();
|
140 |
-
$component .= $this->createExrule();
|
141 |
-
$component .= $this->createLastModified();
|
142 |
-
$component .= $this->createOrganizer();
|
143 |
-
$component .= $this->createRdate();
|
144 |
-
$component .= $this->createRequestStatus();
|
145 |
-
$component .= $this->createRecurrenceid();
|
146 |
-
$component .= $this->createRelatedTo();
|
147 |
-
$component .= $this->createRrule();
|
148 |
-
$component .= $this->createSequence();
|
149 |
-
$component .= $this->createStatus();
|
150 |
-
$component .= $this->createSummary();
|
151 |
-
$component .= $this->createUrl();
|
152 |
-
$component .= $this->createXprop();
|
153 |
-
return $component . sprintf( util::$FMTEND, $objectname );
|
154 |
-
}
|
155 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/vtimezone.php
DELETED
@@ -1,195 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* iCalcreator VTIMEZONE component class
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-01
|
38 |
-
*/
|
39 |
-
class vtimezone extends calendarComponent {
|
40 |
-
use traits\COMMENTtrait,
|
41 |
-
traits\DTSTARTtrait,
|
42 |
-
traits\LAST_MODIFIEDtrait,
|
43 |
-
traits\RDATEtrait,
|
44 |
-
traits\RRULEtrait,
|
45 |
-
traits\TZIDtrait,
|
46 |
-
traits\TZNAMEtrait,
|
47 |
-
traits\TZOFFSETFROMtrait,
|
48 |
-
traits\TZOFFSETTOtrait,
|
49 |
-
traits\TZURLtrait;
|
50 |
-
/**
|
51 |
-
* @var string $timezonetype vtimezone type value
|
52 |
-
* @access protected
|
53 |
-
*/
|
54 |
-
protected $timezonetype;
|
55 |
-
/**
|
56 |
-
* Constructor for calendar component VTIMEZONE object
|
57 |
-
*
|
58 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
59 |
-
* @since 2.22.23 - 2017-02-01
|
60 |
-
* @param mixed $timezonetype default false ( STANDARD / DAYLIGHT )
|
61 |
-
* @param array $config
|
62 |
-
*/
|
63 |
-
public function __construct( $timezonetype=null, $config = []) {
|
64 |
-
static $TZ = 'tz';
|
65 |
-
if( is_array( $timezonetype )) {
|
66 |
-
$config = $timezonetype;
|
67 |
-
$timezonetype = null;
|
68 |
-
}
|
69 |
-
$this->timezonetype = ( empty( $timezonetype ))
|
70 |
-
? util::$LCVTIMEZONE : strtolower( $timezonetype );
|
71 |
-
parent::__construct();
|
72 |
-
$this->setConfig( util::initConfig( $config ));
|
73 |
-
$prf = ( empty( $timezonetype )) ? $TZ : substr( $timezonetype, 0, 1 );
|
74 |
-
$this->cno = $prf . parent::getObjectNo();
|
75 |
-
}
|
76 |
-
/**
|
77 |
-
* Destructor
|
78 |
-
*
|
79 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
80 |
-
* @since 2.22.23 - 2017-03-17
|
81 |
-
*/
|
82 |
-
public function __destruct() {
|
83 |
-
if( ! empty( $this->components ))
|
84 |
-
foreach( $this->components as $cix => $component )
|
85 |
-
$this->components[$cix]->__destruct();
|
86 |
-
unset( $this->xprop,
|
87 |
-
$this->components,
|
88 |
-
$this->unparsed,
|
89 |
-
$this->config,
|
90 |
-
$this->propix,
|
91 |
-
$this->compix,
|
92 |
-
$this->propdelix );
|
93 |
-
unset( $this->objName,
|
94 |
-
$this->cno );
|
95 |
-
unset( $this->comment,
|
96 |
-
$this->dtstart,
|
97 |
-
$this->lastmodified,
|
98 |
-
$this->rdate,
|
99 |
-
$this->rrule,
|
100 |
-
$this->tzid,
|
101 |
-
$this->tzname,
|
102 |
-
$this->tzoffsetfrom,
|
103 |
-
$this->tzoffsetto,
|
104 |
-
$this->tzurl,
|
105 |
-
$this->timezonetype );
|
106 |
-
}
|
107 |
-
/**
|
108 |
-
* Return formatted output for calendar component VTIMEZONE object instance
|
109 |
-
*
|
110 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
111 |
-
* @since 2.5.1 - 2008-10-25
|
112 |
-
* @return string
|
113 |
-
*/
|
114 |
-
public function createComponent() {
|
115 |
-
$objectname = strtoupper(( isset( $this->timezonetype )) ? $this->timezonetype : $this->objName );
|
116 |
-
$component = sprintf( util::$FMTBEGIN, $objectname );
|
117 |
-
$component .= $this->createTzid();
|
118 |
-
$component .= $this->createLastModified();
|
119 |
-
$component .= $this->createTzurl();
|
120 |
-
$component .= $this->createDtstart();
|
121 |
-
$component .= $this->createTzoffsetfrom();
|
122 |
-
$component .= $this->createTzoffsetto();
|
123 |
-
$component .= $this->createComment();
|
124 |
-
$component .= $this->createRdate();
|
125 |
-
$component .= $this->createRrule();
|
126 |
-
$component .= $this->createTzname();
|
127 |
-
$component .= $this->createXprop();
|
128 |
-
$component .= $this->createSubComponent();
|
129 |
-
return $component . sprintf( util::$FMTEND, $objectname );
|
130 |
-
}
|
131 |
-
/**
|
132 |
-
* Return vtimezone component property value/params
|
133 |
-
*
|
134 |
-
* If arg $inclParam, return array with keys VALUE/PARAMS
|
135 |
-
* @param string $propName
|
136 |
-
* @param int $propix specific property in case of multiply occurences
|
137 |
-
* @param bool $inclParam
|
138 |
-
* @param bool $specform
|
139 |
-
* @return mixed
|
140 |
-
*/
|
141 |
-
public function getProperty( $propName=null,
|
142 |
-
$propix=null,
|
143 |
-
$inclParam=false,
|
144 |
-
$specform=false ) {
|
145 |
-
switch( strtoupper( $propName )) {
|
146 |
-
case util::$TZID:
|
147 |
-
if( isset( $this->tzid[util::$LCvalue] ))
|
148 |
-
return ( $inclParam ) ? $this->tzid
|
149 |
-
: $this->tzid[util::$LCvalue];
|
150 |
-
break;
|
151 |
-
case util::$TZOFFSETFROM:
|
152 |
-
if( isset( $this->tzoffsetfrom[util::$LCvalue] ))
|
153 |
-
return ( $inclParam ) ? $this->tzoffsetfrom
|
154 |
-
: $this->tzoffsetfrom[util::$LCvalue];
|
155 |
-
break;
|
156 |
-
case util::$TZOFFSETTO:
|
157 |
-
if( isset( $this->tzoffsetto[util::$LCvalue] ))
|
158 |
-
return ( $inclParam ) ? $this->tzoffsetto
|
159 |
-
: $this->tzoffsetto[util::$LCvalue];
|
160 |
-
break;
|
161 |
-
case util::$TZURL:
|
162 |
-
if( isset( $this->tzurl[util::$LCvalue] ))
|
163 |
-
return ( $inclParam ) ? $this->tzurl
|
164 |
-
: $this->tzurl[util::$LCvalue];
|
165 |
-
break;
|
166 |
-
default:
|
167 |
-
return parent::getProperty( $propName,
|
168 |
-
$propix,
|
169 |
-
$inclParam,
|
170 |
-
$specform );
|
171 |
-
break;
|
172 |
-
}
|
173 |
-
return false;
|
174 |
-
}
|
175 |
-
/**
|
176 |
-
* Return timezone standard object instance, vtimezone::newComponent() wrapper
|
177 |
-
*
|
178 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
179 |
-
* @since 2.23.20 - 2017-06-26
|
180 |
-
* @return object
|
181 |
-
*/
|
182 |
-
public function newStandard() {
|
183 |
-
return $this->newComponent( util::$LCSTANDARD );
|
184 |
-
}
|
185 |
-
/**
|
186 |
-
* Return timezone daylight object instance, vtimezone::newComponent() wrapper
|
187 |
-
*
|
188 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
189 |
-
* @since 2.23.20 - 2017-06-26
|
190 |
-
* @return object
|
191 |
-
*/
|
192 |
-
public function newDaylight() {
|
193 |
-
return $this->newComponent( util::$LCDAYLIGHT );
|
194 |
-
}
|
195 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.24.2/src/vtodo.php
DELETED
@@ -1,193 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* iCalcreator, a PHP rfc2445/rfc5545 solution.
|
4 |
-
*
|
5 |
-
* This file is a part of iCalcreator.
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
-
* Package iCalcreator
|
10 |
-
* Version 2.24
|
11 |
-
* License Subject matter of licence is the software iCalcreator.
|
12 |
-
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID as implemented and
|
14 |
-
* invoked in iCalcreator shall be included in all copies or
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
* iCalcreator can be used either under the terms of
|
17 |
-
* a proprietary license, available at <https://kigkonsult.se/>
|
18 |
-
* or the GNU Affero General Public License, version 3:
|
19 |
-
* iCalcreator is free software: you can redistribute it and/or
|
20 |
-
* modify it under the terms of the GNU Affero General Public License
|
21 |
-
* as published by the Free Software Foundation, either version 3 of
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
-
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
* GNU Affero General Public License for more details.
|
27 |
-
* You should have received a copy of the GNU Affero General Public
|
28 |
-
* License along with this program.
|
29 |
-
* If not, see <http://www.gnu.org/licenses/>.
|
30 |
-
*/
|
31 |
-
namespace kigkonsult\iCalcreator;
|
32 |
-
use kigkonsult\iCalcreator\util\util;
|
33 |
-
/**
|
34 |
-
* iCalcreator VTODO component class
|
35 |
-
*
|
36 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.22.23 - 2017-02-01
|
38 |
-
*/
|
39 |
-
class vtodo extends calendarComponent {
|
40 |
-
use traits\ATTACHtrait,
|
41 |
-
traits\ATTENDEEtrait,
|
42 |
-
traits\CATEGORIEStrait,
|
43 |
-
traits\CLASStrait,
|
44 |
-
traits\COMMENTtrait,
|
45 |
-
traits\COMPLETEDtrait,
|
46 |
-
traits\CONTACTtrait,
|
47 |
-
traits\CREATEDtrait,
|
48 |
-
traits\DESCRIPTIONtrait,
|
49 |
-
traits\DTSTAMPtrait,
|
50 |
-
traits\DTSTARTtrait,
|
51 |
-
traits\DUEtrait,
|
52 |
-
traits\DURATIONtrait,
|
53 |
-
traits\EXDATEtrait,
|
54 |
-
traits\EXRULEtrait,
|
55 |
-
traits\GEOtrait,
|
56 |
-
traits\LAST_MODIFIEDtrait,
|
57 |
-
traits\LOCATIONtrait,
|
58 |
-
traits\ORGANIZERtrait,
|
59 |
-
traits\PERCENT_COMPLETEtrait,
|
60 |
-
traits\PRIORITYtrait,
|
61 |
-
traits\RDATEtrait,
|
62 |
-
traits\RECURRENCE_IDtrait,
|
63 |
-
traits\RELATED_TOtrait,
|
64 |
-
traits\REQUEST_STATUStrait,
|
65 |
-
traits\RESOURCEStrait,
|
66 |
-
traits\RRULEtrait,
|
67 |
-
traits\SEQUENCEtrait,
|
68 |
-
traits\STATUStrait,
|
69 |
-
traits\SUMMARYtrait,
|
70 |
-
traits\UIDtrait,
|
71 |
-
traits\URLtrait;
|
72 |
-
/**
|
73 |
-
* Constructor for calendar component VTODO object
|
74 |
-
*
|
75 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
76 |
-
* @since 2.22.23 - 2017-02-01
|
77 |
-
* @param array $config
|
78 |
-
*/
|
79 |
-
public function __construct( $config = []) {
|
80 |
-
static $T = 't';
|
81 |
-
parent::__construct();
|
82 |
-
$this->setConfig( util::initConfig( $config ));
|
83 |
-
$this->cno = $T . parent::getObjectNo();
|
84 |
-
}
|
85 |
-
/**
|
86 |
-
* Destructor
|
87 |
-
*
|
88 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
89 |
-
* @since 2.22.23 - 2017-03-17
|
90 |
-
*/
|
91 |
-
public function __destruct() {
|
92 |
-
if( ! empty( $this->components ))
|
93 |
-
foreach( $this->components as $cix => $component )
|
94 |
-
$this->components[$cix]->__destruct();
|
95 |
-
unset( $this->xprop,
|
96 |
-
$this->components,
|
97 |
-
$this->unparsed,
|
98 |
-
$this->config,
|
99 |
-
$this->propix,
|
100 |
-
$this->compix,
|
101 |
-
$this->propdelix );
|
102 |
-
unset( $this->objName,
|
103 |
-
$this->cno );
|
104 |
-
unset( $this->attach,
|
105 |
-
$this->attendee,
|
106 |
-
$this->categories,
|
107 |
-
$this->class,
|
108 |
-
$this->comment,
|
109 |
-
$this->completed,
|
110 |
-
$this->contact,
|
111 |
-
$this->created,
|
112 |
-
$this->description,
|
113 |
-
$this->dtstamp,
|
114 |
-
$this->dtstart,
|
115 |
-
$this->due,
|
116 |
-
$this->duration,
|
117 |
-
$this->exdate,
|
118 |
-
$this->exrule,
|
119 |
-
$this->geo,
|
120 |
-
$this->lastmodified,
|
121 |
-
$this->location,
|
122 |
-
$this->organizer,
|
123 |
-
$this->percentcomplete,
|
124 |
-
$this->priority,
|
125 |
-
$this->rdate,
|
126 |
-
$this->recurrenceid,
|
127 |
-
$this->relatedto,
|
128 |
-
$this->requeststatus,
|
129 |
-
$this->resources,
|
130 |
-
$this->rrule,
|
131 |
-
$this->sequence,
|
132 |
-
$this->status,
|
133 |
-
$this->summary,
|
134 |
-
$this->uid,
|
135 |
-
$this->url );
|
136 |
-
}
|
137 |
-
/**
|
138 |
-
* Return formatted output for calendar component VTODO object instance
|
139 |
-
*
|
140 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
141 |
-
* @since 2.5.1 - 2008-11-07
|
142 |
-
* @return string
|
143 |
-
*/
|
144 |
-
public function createComponent() {
|
145 |
-
$objectname = strtoupper( $this->objName );
|
146 |
-
$component = sprintf( util::$FMTBEGIN, $objectname );
|
147 |
-
$component .= $this->createUid();
|
148 |
-
$component .= $this->createDtstamp();
|
149 |
-
$component .= $this->createAttach();
|
150 |
-
$component .= $this->createAttendee();
|
151 |
-
$component .= $this->createCategories();
|
152 |
-
$component .= $this->createClass();
|
153 |
-
$component .= $this->createComment();
|
154 |
-
$component .= $this->createCompleted();
|
155 |
-
$component .= $this->createContact();
|
156 |
-
$component .= $this->createCreated();
|
157 |
-
$component .= $this->createDescription();
|
158 |
-
$component .= $this->createDtstart();
|
159 |
-
$component .= $this->createDue();
|
160 |
-
$component .= $this->createDuration();
|
161 |
-
$component .= $this->createExdate();
|
162 |
-
$component .= $this->createExrule();
|
163 |
-
$component .= $this->createGeo();
|
164 |
-
$component .= $this->createLastModified();
|
165 |
-
$component .= $this->createLocation();
|
166 |
-
$component .= $this->createOrganizer();
|
167 |
-
$component .= $this->createPercentComplete();
|
168 |
-
$component .= $this->createPriority();
|
169 |
-
$component .= $this->createRdate();
|
170 |
-
$component .= $this->createRelatedTo();
|
171 |
-
$component .= $this->createRequestStatus();
|
172 |
-
$component .= $this->createRecurrenceid();
|
173 |
-
$component .= $this->createResources();
|
174 |
-
$component .= $this->createRrule();
|
175 |
-
$component .= $this->createSequence();
|
176 |
-
$component .= $this->createStatus();
|
177 |
-
$component .= $this->createSummary();
|
178 |
-
$component .= $this->createUrl();
|
179 |
-
$component .= $this->createXprop();
|
180 |
-
$component .= $this->createSubComponent();
|
181 |
-
return $component . sprintf( util::$FMTEND, $objectname );
|
182 |
-
}
|
183 |
-
/**
|
184 |
-
* Return valarm object instance, calendarComponent::newComponent() wrapper
|
185 |
-
*
|
186 |
-
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
187 |
-
* @since 2.23.20 - 2017-06-26
|
188 |
-
* @return object
|
189 |
-
*/
|
190 |
-
public function newValarm() {
|
191 |
-
return $this->newComponent( util::$LCVALARM );
|
192 |
-
}
|
193 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/iCal/iCalcreator-2.26.9/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# iCalcreator
|
2 |
+
|
3 |
+
is the PHP class package managing
|
4 |
+
|
5 |
+
> iCal (rfc2445/rfc5445) calendar information
|
6 |
+
|
7 |
+
operating on calendar and
|
8 |
+
calendar events, reports, todos and journaling data.
|
9 |
+
|
10 |
+
~~~~~~~~
|
11 |
+
|
12 |
+
iCalcreator supports systems like
|
13 |
+
|
14 |
+
* calendars
|
15 |
+
* CMS
|
16 |
+
* project management systems
|
17 |
+
* other applications...
|
18 |
+
|
19 |
+
~~~~~~~~
|
20 |
+
|
21 |
+
__Builds__
|
22 |
+
|
23 |
+
Please review the releaseNotes for a brief overview,
|
24 |
+
docs/summary and docs/using for details.
|
25 |
+
|
26 |
+
Stable 2.26.9 *(master)*.
|
27 |
+
|
28 |
+
Release 2.28 candidate (tag 2.27.17)
|
29 |
+
|
30 |
+
Unsupported (tags):
|
31 |
+
- 2.26
|
32 |
+
- 2.24.2
|
33 |
+
- 2.24
|
34 |
+
- 2.22.5
|
lib/iCal/{iCalcreator-2.24.2 → iCalcreator-2.26.9}/autoload.php
RENAMED
@@ -1,32 +1,31 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* iCalcreator,
|
4 |
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* Copyright (c) 2007-2018 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
-
* Link http://kigkonsult.se/iCalcreator/index.php
|
9 |
* Package iCalcreator
|
10 |
-
* Version 2.
|
11 |
* License Subject matter of licence is the software iCalcreator.
|
12 |
* The above copyright, link, package and version notices,
|
13 |
-
* this licence notice and the [rfc5545] PRODID
|
14 |
-
* invoked in iCalcreator shall be included in
|
15 |
-
* substantial portions of the iCalcreator.
|
16 |
-
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
-
* the License, or (at your option) any later version.
|
23 |
* iCalcreator is distributed in the hope that it will be useful,
|
24 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
26 |
-
* GNU
|
27 |
-
*
|
28 |
-
*
|
29 |
-
* If not, see <
|
|
|
|
|
30 |
*/
|
31 |
/**
|
32 |
* autoload.php
|
@@ -34,21 +33,21 @@
|
|
34 |
* iCalcreator package autoloader
|
35 |
*
|
36 |
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
37 |
-
* @since 2.
|
38 |
*/
|
39 |
/**
|
40 |
* Do NOT alter or remove the constant!!
|
41 |
*/
|
42 |
-
define( 'ICALCREATOR_VERSION', 'iCalcreator 2.
|
43 |
/**
|
44 |
-
* load iCalcreator src and support classes and
|
45 |
*/
|
46 |
spl_autoload_register(
|
47 |
function( $class ) {
|
48 |
static $SRC = 'src';
|
49 |
static $BS = '\\';
|
50 |
static $PHP = '.php';
|
51 |
-
static $PREFIX = '
|
52 |
static $BASEDIR = null;
|
53 |
if( is_null( $BASEDIR ))
|
54 |
$BASEDIR = __DIR__ . DIRECTORY_SEPARATOR . $SRC . DIRECTORY_SEPARATOR;
|
1 |
<?php
|
2 |
/**
|
3 |
+
* iCalcreator, the PHP class package managing iCal (rfc2445/rfc5445) calendar information.
|
4 |
*
|
5 |
+
* copyright (c) 2007-2019 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
6 |
+
* Link https://kigkonsult.se
|
|
|
|
|
7 |
* Package iCalcreator
|
8 |
+
* Version 2.26.9
|
9 |
* License Subject matter of licence is the software iCalcreator.
|
10 |
* The above copyright, link, package and version notices,
|
11 |
+
* this licence notice and the invariant [rfc5545] PRODID result use
|
12 |
+
* as implemented and invoked in iCalcreator shall be included in
|
13 |
+
* all copies or substantial portions of the iCalcreator.
|
14 |
+
*
|
15 |
+
* iCalcreator is free software: you can redistribute it and/or modify
|
16 |
+
* it under the terms of the GNU Lesser General Public License as published
|
17 |
+
* by the Free Software Foundation, either version 3 of the License,
|
18 |
+
* or (at your option) any later version.
|
19 |
+
*
|
|
|
20 |
* iCalcreator is distributed in the hope that it will be useful,
|
21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
+
* GNU Lesser General Public License for more details.
|
24 |
+
*
|
25 |
+
* You should have received a copy of the GNU Lesser General Public License
|
26 |
+
* along with iCalcreator. If not, see <https://www.gnu.org/licenses/>.
|
27 |
+
*
|
28 |
+
* This file is a part of iCalcreator.
|
29 |
*/
|
30 |
/**
|
31 |
* autoload.php
|
33 |
* iCalcreator package autoloader
|
34 |
*
|
35 |
* @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
|
36 |
+
* @since 2.26.8 - 2019-04-09
|
37 |
*/
|
38 |
/**
|
39 |
* Do NOT alter or remove the constant!!
|
40 |
*/
|
41 |
+
define( 'ICALCREATOR_VERSION', 'iCalcreator 2.26.9' );
|
42 |
/**
|
43 |
+
* load iCalcreator src and support classes and Traits
|
44 |
*/
|
45 |
spl_autoload_register(
|
46 |
function( $class ) {
|
47 |
static $SRC = 'src';
|
48 |
static $BS = '\\';
|
49 |
static $PHP = '.php';
|
50 |
+
static $PREFIX = 'Kigkonsult\\Icalcreator\\';
|
51 |
static $BASEDIR = null;
|
52 |
if( is_null( $BASEDIR ))
|
53 |
$BASEDIR = __DIR__ . DIRECTORY_SEPARATOR . $SRC . DIRECTORY_SEPARATOR;
|
lib/iCal/{iCalcreator-2.24.2 → iCalcreator-2.26.9}/composer.json
RENAMED
@@ -17,11 +17,11 @@
|
|
17 |
"standard",
|
18 |
"daylight",
|
19 |
"file" ],
|
20 |
-
"time" : "
|
21 |
-
"license": "
|
22 |
"homepage": "http://kigkonsult.se",
|
23 |
"support": {
|
24 |
-
"issues": "
|
25 |
},
|
26 |
"authors": [
|
27 |
{
|
@@ -31,9 +31,10 @@
|
|
31 |
],
|
32 |
"autoload": {
|
33 |
"files": ["autoload.php"],
|
34 |
-
"psr-4": { "
|
35 |
},
|
36 |
"require": {
|
37 |
-
"php": ">=5.
|
|
|
38 |
}
|
39 |
}
|
17 |
"standard",
|
18 |
"daylight",
|
19 |
"file" ],
|
20 |
+
"time" : "2019-03-14",
|
21 |
+
"license": ["LGPL-3.0-or-later"],
|
22 |
"homepage": "http://kigkonsult.se",
|
23 |
"support": {
|
24 |
+
"issues": "https://github.com/iCalcreator/iCalcreator/issues"
|
25 |
},
|
26 |
"authors": [
|
27 |
{
|
31 |
],
|
32 |
"autoload": {
|
33 |
"files": ["autoload.php"],
|
34 |
+
"psr-4": { "Kigkonsult\\Icalcreator\\": ["src/", "src/Util/", "src/Traits/"] }
|
35 |
},
|
36 |
"require": {
|
37 |
+
"php": ">=5.6",
|
38 |
+
"ext-simplexml": "*"
|
39 |
}
|
40 |
}
|
lib/iCal/iCalcreator-2.26.9/docs/lgpl.txt
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 29 June 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
|
9 |
+
This version of the GNU Lesser General Public License incorporates
|
10 |
+
the terms and conditions of version 3 of the GNU General Public
|
11 |
+
License, supplemented by the additional permissions listed below.
|
12 |
+
|
13 |
+
0. Additional Definitions.
|
14 |
+
|
15 |
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16 |
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17 |
+
General Public License.
|
18 |
+
|
19 |
+
"The Library" refers to a covered work governed by this License,
|
20 |
+
other than an Application or a Combined Work as defined below.
|
21 |
+
|
22 |
+
An "Application" is any work that makes use of an interface provided
|
23 |
+
by the Library, but which is not otherwise based on the Library.
|
24 |
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25 |
+
of using an interface provided by the Library.
|
26 |
+
|
27 |
+
A "Combined Work" is a work produced by combining or linking an
|
28 |
+
Application with the Library. The particular version of the Library
|
29 |
+
with which the Combined Work was made is also called the "Linked
|
30 |
+
Version".
|
31 |
+
|
32 |
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33 |
+
Corresponding Source for the Combined Work, excluding any source code
|
34 |
+
for portions of the Combined Work that, considered in isolation, are
|
35 |
+
based on the Application, and not on the Linked Version.
|
36 |
+
|
37 |
+
The "Corresponding Application Code" for a Combined Work means the
|
38 |
+
object code and/or source code for the Application, including any data
|
39 |
+
and utility programs needed for reproducing the Combined Work from the
|
40 |
+
Application, but excluding the System Libraries of the Combined Work.
|
41 |
+
|
42 |
+
1. Exception to Section 3 of the GNU GPL.
|
43 |
+
|
44 |
+
You may convey a covered work under sections 3 and 4 of this License
|
45 |
+
without being bound by section 3 of the GNU GPL.
|
46 |
+
|
47 |
+
2. Conveying Modified Versions.
|
48 |
+
|
49 |
+
If you modify a copy of the Library, and, in your modifications, a
|
50 |
+
facility refers to a function or data to be supplied by an Application
|
51 |
+
that uses the facility (other than as an argument passed when the
|
52 |
+
facility is invoked), then you may convey a copy of the modified
|
53 |
+
version:
|
54 |
+
|
55 |
+
a) under this License, provided that you make a good faith effort to
|
56 |
+
ensure that, in the event an Application does not supply the
|
57 |
+
function or data, the facility still operates, and performs
|
58 |
+
whatever part of its purpose remains meaningful, or
|
59 |
+
|
60 |
+
b) under the GNU GPL, with none of the additional permissions of
|
61 |
+
this License applicable to that copy.
|
62 |
+
|
63 |
+
3. Object Code Incorporating Material from Library Header Files.
|
64 |
+
|
65 |
+
The object code form of an Application may incorporate material from
|
66 |
+
a header file that is part of the Library. You may convey such object
|
67 |
+
code under terms of your choice, provided that, if the incorporated
|
68 |
+
material is not limited to numerical parameters, data structure
|
69 |
+
layouts and accessors, or small macros, inline functions and templates
|
70 |
+
(ten or fewer lines in length), you do both of the following:
|
71 |
+
|
72 |
+
a) Give prominent notice with each copy of the object code that the
|
73 |
+
Library is used in it and that the Library and its use are
|
74 |
+
covered by this License.
|
75 |
+
|
76 |
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77 |
+
document.
|
78 |
+
|
79 |
+
4. Combined Works.
|
80 |
+
|
81 |
+
You may convey a Combined Work under terms of your choice that,
|
82 |
+
taken together, effectively do not restrict modification of the
|
83 |
+
portions of the Library contained in the Combined Work and reverse
|
84 |
+
engineering for debugging such modifications, if you also do each of
|
85 |
+
the following:
|
86 |
+
|
87 |
+
a) Give prominent notice with each copy of the Combined Work that
|
88 |
+
the Library is used in it and that the Library and its use are
|
89 |
+
covered by this License.
|
90 |
+
|
91 |
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92 |
+
document.
|
93 |
+
|
94 |
+
c) For a Combined Work that displays copyright notices during
|
95 |
+
execution, include the copyright notice for the Library among
|
96 |
+
these notices, as well as a reference directing the user to the
|
97 |
+
copies of the GNU GPL and this license document.
|
98 |
+
|
99 |
+
d) Do one of the following:
|
100 |
+
|
101 |
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102 |
+
License, and the Corresponding Application Code in a form
|
103 |
+
suitable for, and under terms that permit, the user to
|
104 |
+
recombine or relink the Application with a modified version of
|
105 |
+
the Linked Version to produce a modified Combined Work, in the
|
106 |
+
manner specified by section 6 of the GNU GPL for conveying
|
107 |
+
Corresponding Source.
|
108 |
+
|
109 |
+
1) Use a suitable shared library mechanism for linking with the
|
110 |
+
Library. A suitable mechanism is one that (a) uses at run time
|
111 |
+
a copy of the Library already present on the user's computer
|
112 |
+
system, and (b) will operate properly with a modified version
|
113 |
+
of the Library that is interface-compatible with the Linked
|
114 |
+
Version.
|
115 |
+
|
116 |
+
e) Provide Installation Information, but only if you would otherwise
|
117 |
+
be required to provide such information under section 6 of the
|
118 |
+
GNU GPL, and only to the extent that such information is
|
119 |
+
necessary to install and execute a modified version of the
|
120 |
+
Combined Work produced by recombining or relinking the
|
121 |
+
Application with a modified version of the Linked Version. (If
|
122 |
+
you use option 4d0, the Installation Information must accompany
|
123 |
+
the Minimal Corresponding Source and Corresponding Application
|
124 |
+
Code. If you use option 4d1, you must provide the Installation
|
125 |
+
Information in the manner specified by section 6 of the GNU GPL
|
126 |
+
for conveying Corresponding Source.)
|
127 |
+
|
128 |
+
5. Combined Libraries.
|
129 |
+
|
130 |
+
You may place library facilities that are a work based on the
|
131 |
+
Library side by side in a single library together with other library
|
132 |
+
facilities that are not Applications and are not covered by this
|
133 |
+
License, and convey such a combined library under terms of your
|
134 |
+
choice, if you do both of the following:
|
135 |
+
|
136 |
+
a) Accompany the combined library with a copy of the same work based
|
137 |
+
on the Library, uncombined with any other library facilities,
|
138 |
+
conveyed under the terms of this License.
|
139 |
+
|
140 |
+
b) Give prominent notice with the combined library that part of it
|
141 |
+
is a work based on the Library, and explaining where to find the
|
142 |
+
accompanying uncombined form of the same work.
|
143 |
+
|
144 |
+
6. Revised Versions of the GNU Lesser General Public License.
|
145 |
+
|
146 |
+
The Free Software Foundation may publish revised and/or new versions
|
147 |
+
of the GNU Lesser General Public License from time to time. Such new
|
148 |
+
versions will be similar in spirit to the present version, but may
|
149 |
+
differ in detail to address new problems or concerns.
|
150 |
+
|
151 |
+
Each version is given a distinguishing version number. If the
|
152 |
+
Library as you received it specifies that a certain numbered version
|
153 |
+
of the GNU Lesser General Public License "or any later version"
|
154 |
+
applies to it, you have the option of following the terms and
|
155 |
+
conditions either of that published version or of any later version
|
156 |
+
published by the Free Software Foundation. If the Library as you
|
157 |
+
received it does not specify a version number of the GNU Lesser
|
158 |
+
General Public License, you may choose any version of the GNU Lesser
|
159 |
+
General Public License ever published by the Free Software Foundation.
|
160 |
+
|
161 |
+
If the Library as you received it specifies that a proxy can decide
|
162 |
+
whether future versions of the GNU Lesser General Public License shall
|
163 |
+
apply, that proxy's public statement of acceptance of any version is
|
164 |
+
permanent authorization for you to choose that version for the
|
165 |
+
Library.
|
lib/iCal/iCalcreator-2.26.9/docs/summary.html
ADDED
@@ -0,0 +1,682 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
|
2 |
+
<!--
|
3 |
+
iCalcreator, the PHP class package managing iCal (rfc2445/rfc5445) calendar information.
|
4 |
+
|
5 |
+
This file is a part of iCalcreator.
|
6 |
+
|
7 |
+
copyright (c) 2007-2019 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
+
Link https://kigkonsult.se
|
9 |
+
Package iCalcreator
|
10 |
+
Version 2.26.8
|
11 |
+
License Subject matter of licence is the software iCalcreator.
|
12 |
+
The above copyright, link, package and version notices,
|
13 |
+
this licence notice and the invariant [rfc5545] PRODID result use
|
14 |
+
as implemented and invoked in iCalcreator shall be included in
|
15 |
+
all copies or substantial portions of the iCalcreator.
|
16 |
+
|
17 |
+
iCalcreator is free software: you can redistribute it and/or modify
|
18 |
+
it under the terms of the GNU Lesser General Public License as published
|
19 |
+
by the Free Software Foundation, either version 3 of the License,
|
20 |
+
or (at your option) any later version.
|
21 |
+
|
22 |
+
iCalcreator is distributed in the hope that it will be useful,
|
23 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
25 |
+
GNU Lesser General Public License for more details.
|
26 |
+
|
27 |
+
You should have received a copy of the GNU Lesser General Public License
|
28 |
+
along with iCalcreator. If not, see <https://www.gnu.org/licenses/>.
|
29 |
+
-->
|
30 |
+
<html>
|
31 |
+
<head>
|
32 |
+
<title>iCalcreator 2.26.8 manual</title>
|
33 |
+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
34 |
+
<meta name="author" content="Kjell-Inge Gustafsson, kigkonsult, All rights reserved">
|
35 |
+
<meta name="copyright" content="2007-2019 Kjell-Inge Gustafsson, kigkonsult">
|
36 |
+
<meta name="keywords" content="ical, calendar, calender, xcal, xml, icalender, rfc2445, rfc5545, vcalender, php, create">
|
37 |
+
<meta name="description" content="using iCalcreator v2.26.8">
|
38 |
+
<style type="text/css">
|
39 |
+
* {
|
40 |
+
FONT-FAMILY : "Bitstream Vera Sans", Helvetica, "Lucida Grande","Lucida Sans Unicode", Lucida, Arial, Geneva, sans-serif;
|
41 |
+
BACKGROUND-COLOR: white;
|
42 |
+
COLOR : black;
|
43 |
+
FONT-SIZE : small;
|
44 |
+
}
|
45 |
+
body {
|
46 |
+
MARGIN-LEFT : 10px;
|
47 |
+
WIDTH : 750px;
|
48 |
+
}
|
49 |
+
h1 {
|
50 |
+
BACKGROUND-COLOR: silver;
|
51 |
+
BORDER : thin solid black;
|
52 |
+
FONT-SIZE : x-large;
|
53 |
+
FONT-WEIGHT : bold;
|
54 |
+
DISPLAY : block;
|
55 |
+
}
|
56 |
+
h2 {
|
57 |
+
FONT-SIZE : large;
|
58 |
+
}
|
59 |
+
h3 {
|
60 |
+
FONT-SIZE : medium;
|
61 |
+
}
|
62 |
+
h4 {
|
63 |
+
FONT-SIZE : small;
|
64 |
+
FONT-WEIGHT : bold;
|
65 |
+
}
|
66 |
+
h5 {
|
67 |
+
FONT-SIZE : small;
|
68 |
+
FONT-WEIGHT : normal;
|
69 |
+
TEXT-DECORATION : underline;
|
70 |
+
}
|
71 |
+
table {
|
72 |
+
border-collapse : collapse;
|
73 |
+
width : 100%;
|
74 |
+
}
|
75 |
+
p.comment {
|
76 |
+
FONT-FAMILY : monospace;
|
77 |
+
FONT-SIZE : 9pt;
|
78 |
+
FONT-WEIGHT : 500;
|
79 |
+
WHITE-SPACE : pre-wrap; /* css-3 */
|
80 |
+
WHITE-SPACE : -moz-pre-wrap; /* Mozilla, since 1999 */
|
81 |
+
WHITE-SPACE : -pre-wrap; /* Opera 4-6 */
|
82 |
+
WHITE-SPACE : -o-pre-wrap; /* Opera 7 */
|
83 |
+
WORD-WRAP : break-word; /* Internet Explorer 5.5+ */
|
84 |
+
}
|
85 |
+
span.comment {
|
86 |
+
BACKGROUND-COLOR: inherit;
|
87 |
+
FONT-FAMILY : Areal;
|
88 |
+
FONT-SIZE : 8pt;
|
89 |
+
LETTER-SPACING : 0.2em;
|
90 |
+
}
|
91 |
+
p.example {
|
92 |
+
BACKGROUND-COLOR: #DCDCDC;
|
93 |
+
font-family : monospace;
|
94 |
+
FONT-SIZE : 9pt;
|
95 |
+
LETTER-SPACING : 0.1em;
|
96 |
+
LINE-HEIGHT : 1.5em;
|
97 |
+
WHITE-SPACE : pre-wrap; /* css-3 */
|
98 |
+
WHITE-SPACE : -moz-pre-wrap; /* Mozilla, since 1999 */
|
99 |
+
WHITE-SPACE : -pre-wrap; /* Opera 4-6 */
|
100 |
+
WHITE-SPACE : -o-pre-wrap; /* Opera 7 */
|
101 |
+
WORD-WRAP : break-word; /* Internet Explorer 5.5+ */
|
102 |
+
}
|
103 |
+
p.format, span.format {
|
104 |
+
BORDER : gray dotted thin;
|
105 |
+
FONT-FAMILY : Helvetica;
|
106 |
+
FONT-SIZE : 9pt;
|
107 |
+
LETTER-SPACING : 0.2em;
|
108 |
+
LINE-HEIGHT : 2em;
|
109 |
+
WHITE-SPACE : pre-wrap; /* css-3 */
|
110 |
+
WHITE-SPACE : -moz-pre-wrap; /* Mozilla, since 1999 */
|
111 |
+
WHITE-SPACE : -pre-wrap; /* Opera 4-6 */
|
112 |
+
WHITE-SPACE : -o-pre-wrap; /* Opera 7 */
|
113 |
+
WORD-WRAP : break-word; /* Internet Explorer 5.5+ */
|
114 |
+
}
|
115 |
+
.header {
|
116 |
+
BACKGROUND-COLOR: silver;
|
117 |
+
BORDER : thin solid black;
|
118 |
+
FONT-SIZE : xx-large;
|
119 |
+
}
|
120 |
+
p.quotes {
|
121 |
+
BACKGROUND-COLOR: #F5F5F5;
|
122 |
+
FONT-FAMILY : Arial;
|
123 |
+
FONT-STYLE : italic;
|
124 |
+
LETTER-SPACING : 0.1em;
|
125 |
+
}
|
126 |
+
sup {
|
127 |
+
BACKGROUND-COLOR: transparent;
|
128 |
+
FONT-SIZE : x-small;
|
129 |
+
FONT-WEIGHT : bold;
|
130 |
+
VERTICAL-ALIGN : super;
|
131 |
+
}
|
132 |
+
.top {
|
133 |
+
VERTICAL-ALIGN : top;
|
134 |
+
}
|
135 |
+
</style>
|
136 |
+
</head>
|
137 |
+
<body>
|
138 |
+
<a name="top"></a>
|
139 |
+
<p class="header">iCalcreator v2.26.8</p>
|
140 |
+
<p>
|
141 |
+
iCalcreator v2.26.8<br>
|
142 |
+
Copyright © 2007-2019 Kjell-Inge Gustafsson, kigkonsult, All rights reserved.<br>
|
143 |
+
<a href="http://kigkonsult.se/iCalcreator/index.php" title="kigkonsult.se/iCalcreator" target="_blank">kigkonsult.se iCalcreator</a><br>
|
144 |
+
Contact : iCal_at_kigkonsult_dot_se
|
145 |
+
</p>
|
146 |
+
|
147 |
+
<h2>Preface</h2>
|
148 |
+
<p>
|
149 |
+
This document describes usage of iCalcreator, the <em>PHP</em> software implementation of standards
|
150 |
+
<a href="https://tools.ietf.org/html/rfc5545" title="Download RFC5545 in text format" target="_blank">rfc5545</a>/
|
151 |
+
<a href="https://tools.ietf.org/html/rfc5546" title="Download RFC5546 in text format" target="_blank">rfc5546</a>
|
152 |
+
(rfc2445/rfc2446) to manage iCal formatted files.
|
153 |
+
</p>
|
154 |
+
<p>
|
155 |
+
This document is provided by kigkonsult for informational purposes
|
156 |
+
and is provided on an "as is" basis without any warranties expressed or implied.
|
157 |
+
</p>
|
158 |
+
<p>
|
159 |
+
Information in this document is subject to change without notice and does
|
160 |
+
not represent a commitment on the part of kigkonsult.
|
161 |
+
The software described in this document is provided under a <a href="#Copyright_and_Licence">license agreement</a>.
|
162 |
+
The software may be used only in accordance with the terms of that <a href="#Copyright_and_Licence">license agreement</a>.
|
163 |
+
It is against the law to copy or use the software except as specifically allowed in the <a href="#Copyright_and_Licence">license agreement</a>.
|
164 |
+
</p>
|
165 |
+
<p>
|
166 |
+
It is the users responsibility to ensure the suitability of the software before using it.
|
167 |
+
In no circumstances will kigkonsult be responsible for
|
168 |
+
the use of the software's outcomes or results or any loss
|
169 |
+
or damage of data or programs as a result of using the software.
|
170 |
+
</p>
|
171 |
+
<p>
|
172 |
+
The use of the software implies acceptance of these terms and the <a href="#Copyright_and_Licence">license</a>.
|
173 |
+
</p>
|
174 |
+
<p>
|
175 |
+
This document makes previous versions obsolete.
|
176 |
+
</p>
|
177 |
+
|
178 |
+
<h4>The software</h4>
|
179 |
+
<p>
|
180 |
+
iCalcreator is a <em>PHP</em> class package managing iCal files, supporting (non-)calendar
|
181 |
+
systems and applications to process and communicate calendar information like
|
182 |
+
events, agendas, tasks, reports, totos and journaling information.
|
183 |
+
</p>
|
184 |
+
<p>
|
185 |
+
For iCalcreator 2.26.8 version (and later), <em>PHP</em> version 5.6+ is required.
|
186 |
+
</p>
|
187 |
+
|
188 |
+
<h4>iCal</h4>
|
189 |
+
<p>
|
190 |
+
A short iCal description is found at
|
191 |
+
<a href="http://en.wikipedia.org/wiki/ICalendar#Core_object" title="iCalendar From Wikipedia, the free encyclopedia" target="_blank">Wikipedia</a>.
|
192 |
+
If You are not familiar with iCal, read this first!
|
193 |
+
</p>
|
194 |
+
<p>
|
195 |
+
The <strong>iCalendar</strong> format, <strong>iCal</strong>, are described in
|
196 |
+
</p>
|
197 |
+
<dl>
|
198 |
+
<dt><a href="https://tools.ietf.org/html/rfc5545" title="Download RFC5545 in text format" target="_blank">rfc5545</a>
|
199 |
+
<dd>"Internet Calendaring and Scheduling Core Object Specification (<strong>iCalendar</strong>)"
|
200 |
+
<dt><a href="https://tools.ietf.org/html/rfc5546" title="Download RFC5546 in text format" target="_blank">rfc5546</a>
|
201 |
+
<dd>"iCalendar Transport-Independent Interoperability Protocol (iTIP)"<br>Scheduling Events, BusyTime, To-dos and Journal Entries
|
202 |
+
<p class="quotes">. ..allows for the capture and exchange of information normally stored
|
203 |
+
within a calendaring and scheduling application.</p>
|
204 |
+
and
|
205 |
+
<p class="quotes">. ..is an exchange format between applications or systems.</p>
|
206 |
+
</dl>
|
207 |
+
<p>
|
208 |
+
<a href="https://tools.ietf.org/html/rfc5545" title="Download RFC5545 in text format" target="_blank">rfc5545</a> and
|
209 |
+
<a href="https://tools.ietf.org/html/rfc5546" title="Download RFC5546 in text format" target="_blank">rfc5546</a>
|
210 |
+
obsoletes, respectively,
|
211 |
+
<a href="https://tools.ietf.org/html/rfc2445" title="Download RFC2445 in text format" target="_blank">rfc2445</a> and
|
212 |
+
<a href="https://tools.ietf.org/html/rfc2446" title="Download RFC2446 in text format" target="_blank">rfc2446</a>.
|
213 |
+
</p>
|
214 |
+
<p>
|
215 |
+
Any references to rfc2445, below, corresponds to rfc5545.
|
216 |
+
</p>
|
217 |
+
|
218 |
+
<h4>xCal</h4>
|
219 |
+
<p>
|
220 |
+
iCalcreator also supports xCal (iCal xml),
|
221 |
+
<a href="https://tools.ietf.org/html/rfc6321" title="Download RFC6321 in text format" target="_blank">rfc6321</a>,
|
222 |
+
The XML Format for <strong>iCalendar</strong>.
|
223 |
+
</p>
|
224 |
+
<p>
|
225 |
+
A short xCal description is found at <a href="http://en.wikipedia.org/wiki/XCal" title="xCal on Wikipedia, the free encyclopedia" target="_blank">Wikipedia</a>.
|
226 |
+
</p>
|
227 |
+
|
228 |
+
<h4>Support</h4>
|
229 |
+
<p>
|
230 |
+
For previous iCalcreator releases support upon (paid) request only.
|
231 |
+
</p>
|
232 |
+
<p>
|
233 |
+
Use the issues <a href="https://github.com/iCalcreator/iCalcreator/issues" title="kigkonsult.se issues" target="_blank">page</a>
|
234 |
+
for queries, improvement/development issues or professional support and development.
|
235 |
+
Please note that paid support or consulting service has the highest priority.
|
236 |
+
</p>
|
237 |
+
<p>
|
238 |
+
kigkonsult offer professional services for software support, design and new/re-development, customizations and adaptations
|
239 |
+
of <em>PHP</em>/<em>MySQL</em> solutions with focus on software lifecycle management, including long term utility, reliability and maintainability.
|
240 |
+
</p>
|
241 |
+
|
242 |
+
<h4>Donate</h4>
|
243 |
+
<p>
|
244 |
+
You can show your appreciation for our free software,
|
245 |
+
and can support future development by making a donation to the kigkonsult GPL/LGPL projects.
|
246 |
+
</p>
|
247 |
+
<p>
|
248 |
+
Make a donation of any size by clicking <a href="http://kigkonsult.se/contact/index.php#Donate" title="Donate" target="_blank">here</a>.
|
249 |
+
Thanks in advance!
|
250 |
+
</p>
|
251 |
+
|
252 |
+
<h4>Contact</h4>
|
253 |
+
<p>
|
254 |
+
Use the <a href="https://github.com/iCalcreator/iCalcreator/issues" title="kigkonsult.se issues" target="_blank"> github issues</a>
|
255 |
+
for queries, improvement/development issues or professional support and development.
|
256 |
+
Please note that paid support or consulting service has the highest priority.
|
257 |
+
</p>
|
258 |
+
|
259 |
+
<h4>Downloads and usage examples</h4>
|
260 |
+
<p>
|
261 |
+
At <a href="https://github.com/iCalcreator/iCalcreator" title="kigkonsult iCalcreator" target="_blank">kigkonsult.se</a> you can download a more
|
262 |
+
complete manual and review and explore iCalcreator usage.
|
263 |
+
</p>
|
264 |
+
|
265 |
+
<h4>Install</h4>
|
266 |
+
<dl>
|
267 |
+
<dt>Composer (https://getcomposer.org/)
|
268 |
+
<dd>
|
269 |
+
<dd>composer require kigkonsult/icalcreator
|
270 |
+
<dd>
|
271 |
+
<dt>Or
|
272 |
+
<dd> include the (download) iCalcreator folder to your include-path
|
273 |
+
<dd>Add
|
274 |
+
<dd><span class="format">require_once "[path/]iCalcreator-2.26.8/autoload.php";</span>
|
275 |
+
<dd>to your <em>PHP</em>-script.
|
276 |
+
<dd>The iCalcreator invoker has changed since previous version!
|
277 |
+
</dl>
|
278 |
+
|
279 |
+
<p>
|
280 |
+
iCalcreator 2.26.8 is using namespace "Kigkonsult\Icalcreator".
|
281 |
+
</p>
|
282 |
+
|
283 |
+
|
284 |
+
<h4>Notes</h4>
|
285 |
+
<p>
|
286 |
+
When creating a new Vcalendar(/component) instance, review config settings.
|
287 |
+
</p>
|
288 |
+
<p>
|
289 |
+
You will find a complete iCalcreator function list (ex. getProperty, deleteProperty) in
|
290 |
+
<a href="https://github.com/iCalcreator/iCalcreator/docs" title="iCalcreator complete manual" target="_blank">iCalcreator manual</a>.
|
291 |
+
</p>
|
292 |
+
<p>
|
293 |
+
Note, to ease up usage, you will find convenient holders for component names,
|
294 |
+
properties, config keys etc in top of the "util" class file (src/util/util.php).
|
295 |
+
</p>
|
296 |
+
|
297 |
+
<h2>CREATE</h2>
|
298 |
+
|
299 |
+
<p class="example"><?php
|
300 |
+
|
301 |
+
namespace Kigkonsult\Icalcreator;
|
302 |
+
|
303 |
+
use Kigkonsult\Icalcreator\Util\Util;
|
304 |
+
|
305 |
+
// <span class="comment">define time zone</span>
|
306 |
+
$tz = "Europe/Stockholm";
|
307 |
+
// <span class="comment">set Your unique id, </span>
|
308 |
+
// <span class="comment">required if any component UID is missing</span>
|
309 |
+
$config = [
|
310 |
+
Util::$UNIQUE_ID => "kigkonsult.se",
|
311 |
+
// <span class="comment">opt. set "calendar" timezone</span>
|
312 |
+
Util::$TZID => $tz
|
313 |
+
];
|
314 |
+
// <span class="comment">create a new Vcalendar instance</span>
|
315 |
+
$calendar= new Vcalendar( $config );
|
316 |
+
|
317 |
+
// <span class="comment">required of some calendar software</span>
|
318 |
+
$calendar->setProperty( Util::$METHOD, "PUBLISH" );
|
319 |
+
$calendar->setProperty( Util::$X_WR_CALNAME, "Calendar Sample");
|
320 |
+
$calendar->setProperty( Util::$X_WR_CALDESC, "Calendar Description" );
|
321 |
+
$calendar->setProperty( Util::$X_WR_TIMEZONE, $tz );
|
322 |
+
|
323 |
+
// <span class="comment">create an calendar event component</span>
|
324 |
+
$vevent = $calendar->newVevent();
|
325 |
+
// <span class="comment">set event start</span>
|
326 |
+
$vevent->setProperty(
|
327 |
+
Util::$DTSTART,
|
328 |
+
new DateTime( '2017-04-01 19:00:00')
|
329 |
+
);
|
330 |
+
// <span class="comment">set event end</span>
|
331 |
+
$vevent->setProperty(
|
332 |
+
Util::$DTEND,
|
333 |
+
new DateTime( '2017-04-01 22:30:00')
|
334 |
+
);
|
335 |
+
$vevent->setProperty( Util::$LOCATION, "Central Placa" );
|
336 |
+
$vevent->setProperty( Util::$SUMMARY, "PHP summit" );
|
337 |
+
$vevent->setProperty( Util::$DESCRIPTION, "This is a description" );
|
338 |
+
$vevent->setProperty( Util::$COMMENT, "This is a comment" );
|
339 |
+
$vevent->setProperty( Util::$ATTENDEE, "attendee1@icaldomain.net" );
|
340 |
+
|
341 |
+
// <span class="comment">create an event alarm</span>
|
342 |
+
$valarm = $vevent->newValarm();
|
343 |
+
$valarm->setProperty( Util::$ACTION, "DISPLAY" );
|
344 |
+
// <span class="comment">reuse the event description</span>
|
345 |
+
$valarm->setProperty( Util::$DESCRIPTION, $vevent->getProperty( Util::$DESCRIPTION ));
|
346 |
+
// <span class="comment">create alarm trigger (in UTC datetime)</span>
|
347 |
+
$valarm->setProperty(
|
348 |
+
Util::$TRIGGER,
|
349 |
+
new DateTime( '2017-04-01 08:00:00 UTC')
|
350 |
+
);
|
351 |
+
|
352 |
+
// <span class="comment">create another calendar event component</span>
|
353 |
+
$vevent = $calendar->newVevent();
|
354 |
+
// <span class="comment">alt. date format, here for an all-day event</span>
|
355 |
+
$vevent->setProperty(
|
356 |
+
Util::$DTSTART,
|
357 |
+
"20170401",
|
358 |
+
[ "VALUE" => "DATE" ]
|
359 |
+
);
|
360 |
+
$vevent->setProperty( Util::$ORGANIZER, "cio@icaldomain.com" );
|
361 |
+
$vevent->setProperty( Util::$SUMMARY, "ALL-DAY event" );
|
362 |
+
$vevent->setProperty( Util::$DESCRIPTION, "This is a description for an all-day event" );
|
363 |
+
$vevent->setProperty( Util::$RESOURCES, "Full attension" );
|
364 |
+
// <span class="comment">weekly, four occasions</span>
|
365 |
+
$vevent->setProperty(
|
366 |
+
Util::$RRULE,
|
367 |
+
[
|
368 |
+
"FREQ" => "WEEKLY",
|
369 |
+
"count" => 4
|
370 |
+
]
|
371 |
+
);
|
372 |
+
// <span class="comment">supporting parse of strict rfc5545 formatted text</span>
|
373 |
+
$vevent->parse( "LOCATION:1CP Conference Room 4350" );
|
374 |
+
|
375 |
+
// <span class="comment">all calendar components are described in <a href="https://tools.ietf.org/html/rfc5545" title="RFC5545" target="_blank">rfc5545</a></span>
|
376 |
+
// <span class="comment">a complete iCalcreator function list (ex. setProperty) in the iCalcreator using manual</span>
|
377 |
+
|
378 |
+
// <span class="comment">create timezone component(-s)</span>
|
379 |
+
// <span class="comment">based on all start dates in events (i.e. all dtstarts)</span>
|
380 |
+
// <span class="comment">X-LIC-LOCATION required of some calendar software</span>
|
381 |
+
$xprops = [ Util::$X_LIC_LOCATION => $tz ];
|
382 |
+
Kigkonsult\Icalcreator\TimezoneHandler::createTimezone( $v, $tz, $xprops );
|
383 |
+
|
384 |
+
</p>
|
385 |
+
|
386 |
+
<h2>PARSE</h2>
|
387 |
+
<h4>iCal, rfc5545 / rfc2445 </h4>
|
388 |
+
<p>How to parse an iCal (external/file) resource</p>
|
389 |
+
<p class="example">
|
390 |
+
|
391 |
+
// <span class="comment">set Your unique id, </span>
|
392 |
+
// <span class="comment">required if any component UID is missing</span>
|
393 |
+
$vcalendar = new Vcalendar(
|
394 |
+
[ Util::$UNIQUE_ID => "kigkonsult.se", ]
|
395 |
+
);
|
396 |
+
|
397 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
398 |
+
|
399 |
+
$vcalendar->parse( $iCalContent );
|
400 |
+
|
401 |
+
<h4>xCal, rfc6321 (XML)</h4>
|
402 |
+
<p>
|
403 |
+
How to convert (file) XML resource to an Vcalendar instance.
|
404 |
+
</p>
|
405 |
+
<p class="example">
|
406 |
+
|
407 |
+
// <span class="comment">set Your unique id, </span>
|
408 |
+
// <span class="comment">required if any component UID is missing</span>
|
409 |
+
$config = [ Util::$UNIQUE_ID => "kigkonsult.se" ];
|
410 |
+
|
411 |
+
// <span class="comment">use a local xCal file</span>
|
412 |
+
$filename = "xmlfile.xml";
|
413 |
+
// <span class="comment"> or a remote xCal resource</span>
|
414 |
+
/* $filename = 'http://kigkonsult.se/xcal.php?a=1&b=2&c=3'; */
|
415 |
+
if( ! ( $calendar = Kigkonsult\Icalcreator\IcalXML::XMLfile2iCal( $filename, $config ))) {
|
416 |
+
exit( "Error when parsing $filename" );
|
417 |
+
}
|
418 |
+
// <span class="comment">continue process (edit, parse, select) $calendar</span>
|
419 |
+
|
420 |
+
</p>
|
421 |
+
|
422 |
+
|
423 |
+
<h2>EDIT</h2>
|
424 |
+
<p class="example">
|
425 |
+
|
426 |
+
// <span class="comment">create a new Vcalendar instance</span>
|
427 |
+
$config = [ Util::$UNIQUE_ID => "kigkonsult.se" ];
|
428 |
+
$calendar = new Vcalendar( $config );
|
429 |
+
|
430 |
+
// <span class="comment">parse a calendar file</span>
|
431 |
+
$config = [
|
432 |
+
Util::$DIRECTORY => "calendars",
|
433 |
+
Util::$FILENAME => "file.ics"
|
434 |
+
];
|
435 |
+
$calendar->setConfig( $config );
|
436 |
+
$calendar->parse();
|
437 |
+
// <span class="comment">required of some calendar software</span>
|
438 |
+
|
439 |
+
$calendar->setProperty( Util::$METHOD, "PUBLISH" );
|
440 |
+
$calendar->setProperty( Util::$X_WR_CALNAME, "Calendar Sample");
|
441 |
+
$calendar->setProperty( Util::$X_WR_CALDESC, "Calendar Description" );
|
442 |
+
$calendar->setProperty( Util::$X_WR_TIMEZONE, "Europe/Stockholm" );
|
443 |
+
|
444 |
+
// <span class="comment">read events, one by one</span>
|
445 |
+
while( $vevent = $calendar->getComponent(
|
446 |
+
Vcalendar::VEVENT )) {
|
447 |
+
|
448 |
+
// <span class="comment">get uid (unique id/key for component), required, one occurrence </span>
|
449 |
+
$uid = $vevent->getProperty( Util::$UID );
|
450 |
+
|
451 |
+
// <span class="comment">get dtstart required, one occurrence</span>
|
452 |
+
$dtstart = $vevent->getProperty( Util::$DTSTART );
|
453 |
+
|
454 |
+
// <span class="comment">opt. description</span>
|
455 |
+
if( $description = $vevent->getProperty( Util::$DESCRIPTION, 1 )) {
|
456 |
+
|
457 |
+
// <span class="comment">edit the description</span>
|
458 |
+
|
459 |
+
// <span class="comment">update/replace the description</span>
|
460 |
+
$vevent->setProperty(
|
461 |
+
Util::$DESCRIPTION,
|
462 |
+
$description,
|
463 |
+
false,
|
464 |
+
1
|
465 |
+
);
|
466 |
+
}
|
467 |
+
|
468 |
+
// <span class="comment">get optional comments</span>
|
469 |
+
while( $comment = $vevent->getProperty( Util::$COMMENT )) {
|
470 |
+
.. .
|
471 |
+
}
|
472 |
+
|
473 |
+
// <span class="comment">remove all ATTENDEE properties .. .</span>
|
474 |
+
while( $vevent->deleteProperty( Util::$ATTENDEE )) {
|
475 |
+
continue;
|
476 |
+
}
|
477 |
+
|
478 |
+
// <span class="comment">update/replace event in calendar</span>
|
479 |
+
// <span class="comment"> with UID as key</span>
|
480 |
+
$calendar->setComponent ( $vevent, $uid );
|
481 |
+
} // end while
|
482 |
+
|
483 |
+
</p>
|
484 |
+
<br>
|
485 |
+
<br>
|
486 |
+
|
487 |
+
<h2>SELECT</h2>
|
488 |
+
<p>
|
489 |
+
(setup)
|
490 |
+
</p>
|
491 |
+
<p class="example">
|
492 |
+
|
493 |
+
// <span class="comment">create a new Vcalendar instance</span>
|
494 |
+
$calendar = new Vcalendar(
|
495 |
+
[ Util::$UNIQUE_ID => "kigkonsult.se", ]
|
496 |
+
);
|
497 |
+
|
498 |
+
$iCalContent = file_get_contents( "http://www.aDomain.net/file.ics" );
|
499 |
+
|
500 |
+
$calendar->parse( $iCalContent );
|
501 |
+
|
502 |
+
// <span class="comment">required of some calendar software</span>
|
503 |
+
$calendar->setProperty( Util::$METHOD, "PUBLISH" );
|
504 |
+
$calendar->setProperty( Util::$X_WR_CALNAME, "Calendar Sample");
|
505 |
+
$calendar->setProperty( Util::$X_WR_CALDESC, "Calendar Description" );
|
506 |
+
$calendar->setProperty( Util::$X_WR_TIMEZONE, "Europe/Stockholm");
|
507 |
+
|
508 |
+
</p>
|
509 |
+
<h4>Ex. calendar date based select</h4>
|
510 |
+
<p class="example">
|
511 |
+
|
512 |
+
// <span class="comment">select components occurring today</span>
|
513 |
+
// <span class="comment">(including components with recurrence pattern)</span>
|
514 |
+
$eventArray = $calendar->selectComponents();
|
515 |
+
foreach( $eventArray as $year => $yearArray) {
|
516 |
+
foreach( $yearArray as $month => $monthArray ) {
|
517 |
+
foreach( $monthArray as $day => $dailyEventsArray ) {
|
518 |
+
foreach( $dailyEventsArray as $vevent ) {
|
519 |
+
|
520 |
+
// <span class="comment">if event is a member of a recurrence set</span>
|
521 |
+
// <span class="comment">returns [ </span>
|
522 |
+
// <span class="comment"> "x-current-dtstart",</span>
|
523 |
+
// <span class="comment"> (string) date( "Y-m-d [H:i:s][timezone/UTC offset]")</span>
|
524 |
+
// <span class="comment">]</span>
|
525 |
+
$currddate = $event->getProperty( Util::$X_CURRENT_DTSTART );
|
526 |
+
|
527 |
+
// <span class="comment">orig. dtstart</span>
|
528 |
+
$dtstart = $vevent->getProperty( Util::$DTSTART );
|
529 |
+
$summary = $vevent->getProperty( Util::$SUMMARY );
|
530 |
+
$description = $vevent->getProperty( Util::$DESCRIPTION );
|
531 |
+
.. .
|
532 |
+
.. .
|
533 |
+
} // end foreach
|
534 |
+
} // end foreach
|
535 |
+
} // end foreach
|
536 |
+
} // end foreach
|
537 |
+
|
538 |
+
</p>
|
539 |
+
<h4>Ex. calendar select specific property values</h4>
|
540 |
+
<p class="example">
|
541 |
+
|
542 |
+
// <span class="comment">fetch specific property from calendar perspective</span>
|
543 |
+
// <span class="comment">(unique) values and occurrences : </span>
|
544 |
+
// <span class="comment">ATTENDEE, CATEGORIES, CONTACT,</span>
|
545 |
+
// <span class="comment">DTSTART, LOCATION, ORGANIZER,</span>
|
546 |
+
// <span class="comment">PRIORITY, RESOURCES, STATUS,</span>
|
547 |
+
// <span class="comment">SUMMARY, UID, URL,</span>
|
548 |
+
// <span class="comment">GEOLOCATION<sup>*</sup></span>
|
549 |
+
$valueOccur = $calendar->getProperty( Util::$RESOURCES );
|
550 |
+
foreach( $valueOccur as $uniqueValue => $occurCnt ) {
|
551 |
+
|
552 |
+
echo "The RESOURCES value <b>$uniqueValue</b> occurs <b>$occurCnt</b> times<br />";
|
553 |
+
|
554 |
+
}
|
555 |
+
|
556 |
+
</p>
|
557 |
+
<p>
|
558 |
+
<sup>*</sup>) Using the non-standard directive "GEOLOCATION", iCalcreator returns output supporting
|
559 |
+
ISO6709 "Standard representation of geographic point location by coordinates",
|
560 |
+
by combining the "LOCATION" and "GEO" property values (only if "GEO" is set).
|
561 |
+
</p>
|
562 |
+
<h4>Ex. select calendar components based on specific property value</h4>
|
563 |
+
<p class="example">
|
564 |
+
|
565 |
+
// <span class="comment">selects components</span>
|
566 |
+
// <span class="comment">based on specific property value(-s)</span>
|
567 |
+
// <span class="comment">ATTENDEE, CATEGORIES, CONTACT,</span>
|
568 |
+
// <span class="comment">LOCATION, ORGANIZER,</span>
|
569 |
+
// <span class="comment">PRIORITY, RESOURCES, STATUS,</span>
|
570 |
+
// <span class="comment">SUMMARY, URL, UID</span>
|
571 |
+
$selectSpec = [ Util::$CATEGORIES => "course1" ];
|
572 |
+
$specComps = $calendar->selectComponents( $selectSpec );
|
573 |
+
foreach( $specComps as $comp ) {
|
574 |
+
.. .
|
575 |
+
}
|
576 |
+
|
577 |
+
</p>
|
578 |
+
<br>
|
579 |
+
<br>
|
580 |
+
|
581 |
+
<h2>OUTPUT</h2>
|
582 |
+
<p>(setup)</p>
|
583 |
+
<p class="example">
|
584 |
+
|
585 |
+
// <span class="comment">create a new Vcalendar instance</span>
|
586 |
+
$calendar = new Vcalendar(
|
587 |
+
[ Util::$UNIQUE_ID => "kigkonsult.se", ]
|
588 |
+
);
|
589 |
+
|
590 |
+
// <span class="comment">required of some calendar software</span>
|
591 |
+
$calendar->setProperty( Util::$METHOD, "PUBLISH" );
|
592 |
+
$calendar->setProperty( Util::$X_WR_CALNAME, "Calendar Sample");
|
593 |
+
$calendar->setProperty( Util::$X_WR_CALDESC, "Calendar Description" );
|
594 |
+
$calendar->setProperty( Util::$X_WR_TIMEZONE, "Europe/Stockholm");
|
595 |
+
|
596 |
+
// <span class="comment">continue process (edit, parse, select) $calendar</span>
|
597 |
+
|
598 |
+
</p>
|
599 |
+
<h5>opt 1</h5>
|
600 |
+
<p>
|
601 |
+
Redirect calendar file to browser.
|
602 |
+
</p>
|
603 |
+
<p class="example">
|
604 |
+
|
605 |
+
$calendar->returnCalendar();
|
606 |
+
exit;
|
607 |
+
|
608 |
+
</p>
|
609 |
+
|
610 |
+
<h5>opt 2</h5>
|
611 |
+
<p>
|
612 |
+
Save calendar to file.
|
613 |
+
</p>
|
614 |
+
<p class="example">
|
615 |
+
|
616 |
+
// <span class="comment">set output directory and file name</span>
|
617 |
+
$config = [
|
618 |
+
Util::$DIRECTORY => "depot",
|
619 |
+
Util::$FILENAME => "calendar.ics"
|
620 |
+
];
|
621 |
+
$calendar->setConfig( $config );
|
622 |
+
$calendar->saveCalendar();
|
623 |
+
|
624 |
+
</p>
|
625 |
+
|
626 |
+
<h5>opt 3, xCal</h5>
|
627 |
+
<p>
|
628 |
+
Create well-formed XML, rfc6321 (as string).
|
629 |
+
</p>
|
630 |
+
<p class="example">
|
631 |
+
|
632 |
+
$xmlstr = Kigkonsult\Icalcreator\IcalXML::iCal2XML( $calendar);
|
633 |
+
|
634 |
+
</p>
|
635 |
+
|
636 |
+
<h5>opt 4, json</h5>
|
637 |
+
<p>
|
638 |
+
Create a json string.
|
639 |
+
</p>
|
640 |
+
<p class="example">
|
641 |
+
$xmlstr = Kigkonsult\Icalcreator\IcalXML::iCal2XML( $calendar);
|
642 |
+
$json = json_encode( simplexml_load_string( $xmlstr ));
|
643 |
+
|
644 |
+
</p>
|
645 |
+
|
646 |
+
|
647 |
+
<br>
|
648 |
+
<br>
|
649 |
+
|
650 |
+
|
651 |
+
<a name="Copyright_and_Licence"></a>
|
652 |
+
<h2>COPYRIGHT AND LICENSE</h2>
|
653 |
+
|
654 |
+
<table>
|
655 |
+
<tr><td>Copyright<td>(c) 2007-2019 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
656 |
+
<tr><td>Link <td>http://kigkonsult.se/iCalcreator/index.php
|
657 |
+
<tr><td>Package <td>iCalcreator
|
658 |
+
<tr><td>Version <td>2.26.8
|
659 |
+
<tr><td class="top">License <td>
|
660 |
+
Subject matter of licence is the software iCalcreator.<br>
|
661 |
+
The above copyright, link, package and version notices,<br>
|
662 |
+
this licence notice and the invariant [rfc5545] PRODID result use<br>
|
663 |
+
as implemented and invoked in iCalcreator shall be included in<br>
|
664 |
+
all copies or substantial portions of the iCalcreator.<br>
|
665 |
+
<br>
|
666 |
+
iCalcreator is free software: you can redistribute it and/or modify<br>
|
667 |
+
it under the terms of the GNU Lesser General Public License as published<br>
|
668 |
+
by the Free Software Foundation, either version 3 of the License,<br>
|
669 |
+
or (at your option) any later version.<br>
|
670 |
+
<br>
|
671 |
+
iCalcreator is distributed in the hope that it will be useful,<br>
|
672 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
|
673 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
|
674 |
+
GNU Lesser General Public License for more details.<br>
|
675 |
+
<br>
|
676 |
+
You should have received a copy of the GNU Lesser General Public License<br>
|
677 |
+
along with iCalcreator. If not, see <https://www.gnu.org/licenses/>.
|
678 |
+
</table>
|
679 |
+
|
680 |
+
<br>
|
681 |
+
</body>
|
682 |
+
</html>
|
lib/iCal/{iCalcreator-2.24.2 → iCalcreator-2.26.9}/docs/using.html
RENAMED
@@ -1,41 +1,40 @@
|
|
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
|
2 |
<!--
|
3 |
-
iCalcreator,
|
4 |
-
|
5 |
-
This file is a part of iCalcreator.
|
6 |
-
|
7 |
-
|
8 |
-
Link
|
9 |
-
Package iCalcreator
|
10 |
-
Version 2.
|
11 |
-
License Subject matter of licence is the software iCalcreator.
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
If not, see <http://www.gnu.org/licenses/>.
|
30 |
-->
|
31 |
<html>
|
32 |
<head>
|
33 |
-
<title>iCalcreator 2.
|
34 |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
35 |
<meta name="author" content="Kjell-Inge Gustafsson, kigkonsult, All rights reserved">
|
36 |
-
<meta name="copyright" content="2007-
|
37 |
-
<meta name="keywords" content="ical, calendar,
|
38 |
-
<meta name="description" content="using iCalcreator v2.
|
39 |
<style type="text/css">
|
40 |
* {
|
41 |
FONT-FAMILY : "Bitstream Vera Sans", Helvetica, "Lucida Grande","Lucida Sans Unicode", Lucida, Arial, Geneva, sans-serif;
|
@@ -166,18 +165,20 @@ sup {
|
|
166 |
</head>
|
167 |
<body>
|
168 |
<a name="top"></a>
|
169 |
-
<p class="header">iCalcreator v2.
|
170 |
<p>
|
171 |
-
iCalcreator v2.
|
172 |
-
Copyright © 2007-
|
173 |
<a href="http://kigkonsult.se/iCalcreator/index.php" title="kigkonsult.se/iCalcreator" target="_blank">kigkonsult.se iCalcreator</a><br>
|
174 |
-
|
175 |
</p>
|
176 |
|
177 |
<h2>Preface</h2>
|
178 |
<p>
|
179 |
-
This document describes usage of iCalcreator,
|
180 |
-
<a href="
|
|
|
|
|
181 |
</p>
|
182 |
<p>
|
183 |
This document is provided by kigkonsult for informational purposes
|
@@ -202,12 +203,12 @@ The use of the software implies acceptance of these terms and the <a href="#Copy
|
|
202 |
<p>
|
203 |
This document makes previous versions obsolete.
|
204 |
</p>
|
205 |
-
<a href="#INDEX">[index]</a
|
206 |
|
207 |
<a name="INTRO"></a><h1>1 INTRO</h1>
|
208 |
<p>
|
209 |
-
iCalcreator is a <em>PHP</em> class package managing iCal files, supporting (non-)
|
210 |
-
systems and applications to process and communicate
|
211 |
events, agendas, tasks, reports, totos and journaling information.
|
212 |
</p>
|
213 |
<p>
|
@@ -216,7 +217,7 @@ The iCal standards are <a href="#Standards">rfc5545/rfc5546 (rfc2445/rfc2446)</a
|
|
216 |
iCalcreator features create, parse, edit and select <strong>calendar</strong> and <strong>calendar</strong> components.
|
217 |
</p>
|
218 |
<p>
|
219 |
-
For iCalcreator 2.
|
220 |
</p>
|
221 |
<br>
|
222 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a>
|
@@ -232,20 +233,20 @@ A short iCal description is found at <a href="http://en.wikipedia.org/wiki/ICale
|
|
232 |
The <strong>iCalendar</strong> format, <strong>iCal</strong>, are described in
|
233 |
</p>
|
234 |
<dl>
|
235 |
-
<dt><a href="
|
236 |
<dd>"Internet Calendaring and Scheduling Core Object Specification (<strong>iCalendar</strong>)"
|
237 |
-
<dt><a href="
|
238 |
<dd>"iCalendar Transport-Independent Interoperability Protocol (iTIP)"<br>Scheduling Events, BusyTime, To-dos and Journal Entries
|
239 |
<p class="quotes">. ..allows for the capture and exchange of information normally stored
|
240 |
within a calendaring and scheduling application.</p>
|
241 |
and
|
242 |
<p class="quotes">. ..is an exchange format between applications or systems.</p>
|
243 |
</dl>
|
244 |
-
<p><a href="
|
245 |
-
<a href="
|
246 |
obsoletes, respectively,
|
247 |
-
<a href="
|
248 |
-
<a href="
|
249 |
</p>
|
250 |
<p>
|
251 |
Any references to rfc2445, below, corresponds to rfc5545.
|
@@ -254,7 +255,7 @@ Any references to rfc2445, below, corresponds to rfc5545.
|
|
254 |
<h4>xCal</h4>
|
255 |
<p>
|
256 |
iCalcreator also supports xCal (iCal xml),
|
257 |
-
<a href="
|
258 |
The XML Format for <strong>iCalendar</strong>.
|
259 |
</p>
|
260 |
<p>
|
@@ -300,19 +301,14 @@ This style is used for <em>PHP</em> coding examples.
|
|
300 |
|
301 |
<a name="Support"></a><h2>1.4 Support</h2>
|
302 |
<p>
|
303 |
-
|
304 |
</p>
|
305 |
<p>
|
306 |
-
|
307 |
-
<a href="http://kigkonsult.se/contact/index.php" title="kigkonsult.se/contact" target="_blank">kigkonsult.se/contact</a>
|
308 |
-
or
|
309 |
-
<a href="https://github.com/iCalcreator/iCalcreator/issues" title="github" target="_blank"> github.com/iCalcreator</a>
|
310 |
-
for improvement/development issues or professional support and development.
|
311 |
-
Please note that paid support or consulting service has the highest priority.
|
312 |
</p>
|
313 |
<p>
|
314 |
-
kigkonsult offer professional services for software support, design and new/re-development
|
315 |
-
of <em>PHP</em>/<em>MySQL</em> solutions with focus on software lifecycle management, including long term utility, reliability and maintainability.
|
316 |
</p>
|
317 |
|
318 |
<br>
|
@@ -337,21 +333,21 @@ Thanks in advance!
|
|
337 |
<dl>
|
338 |
<dt>Composer (https://getcomposer.org/)
|
339 |
<dd>
|
340 |
-
<dd>composer require kigkonsult/
|
341 |
<dd>
|
342 |
<dt>Or
|
343 |
<dd> include the (download) iCalcreator folder to your include-path
|
344 |
<dd>Add
|
345 |
-
<dd><span class="format">require_once "[path/]iCalcreator-2.
|
346 |
<dd>to your <em>PHP</em>-script.
|
347 |
<dd>The iCalcreator invoker has changed since previous version!
|
348 |
</dl>
|
349 |
<p>
|
350 |
-
iCalcreator is
|
351 |
</p>
|
352 |
<p>
|
353 |
You may need to set the default timezone.
|
354 |
-
When creating a new
|
355 |
</p>
|
356 |
<p>
|
357 |
There are free iCal icons (use as buttons on a web page?) to download
|
@@ -362,7 +358,36 @@ There are free iCal icons (use as buttons on a web page?) to download
|
|
362 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a>
|
363 |
|
364 |
|
365 |
-
<a name="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
<p>Some properties (ex. as described in
|
367 |
<a href="http://en.wikipedia.org/wiki/ICalendar#Calendar_extensions" title="http://en.wikipedia.org/wiki/ICalendar#Calendar_extensions" target="_blank">wikipedia:iCal</a>)
|
368 |
may be required when importing iCal files into some calendaring software (MS etc). Also <a href="#X-PROPERTY">X-properties</a> may appear in exports. Below are examples</p>
|
@@ -379,28 +404,51 @@ may be required when importing iCal files into some calendaring software (MS etc
|
|
379 |
<dt>on component level in a <a href="#VTIMEZONE">vtimezone</a> component
|
380 |
<dd><a href="#X-PROPERTY">X-LIC-LOCATION</a> x-property
|
381 |
</dl>
|
|
|
382 |
<sup>*</sup>
|
383 |
Created automatically in iCalcreator, if not set.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
<p class="label">Example</p>
|
385 |
<p>
|
386 |
-
A strong recommendation is also to set config <a href="#Unique_id">unique_id</a> when creating a new
|
387 |
-
to ensure accurate setting of all components <a href="#UID">UID</a> property,
|
388 |
Also setting of config timezone ("TZID" and "X-WR-TIMEZONE" below) is to recommend.
|
389 |
</p>
|
390 |
<p class="example">
|
391 |
-
$config =
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
$vcalendar->setProperty(
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
$vcalendar->setProperty(
|
401 |
-
|
402 |
-
|
403 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
|
405 |
</p>
|
406 |
|
@@ -418,7 +466,8 @@ $vcalendar->setProperty( "X-WR-TIMEZONE",
|
|
418 |
<a href="#Support">1.4 Support</a><br>
|
419 |
<a href="#Donate">1.5 Donate</a><br>
|
420 |
<a href="#INSTALL">1.6 Install</a><br>
|
421 |
-
<a
|
|
|
422 |
<a href="#INDEX">1.9 INDEX</a><br>
|
423 |
<br>
|
424 |
<a href="#Calendar_Component_list">2 Calendar Component list</a><br>
|
@@ -434,19 +483,19 @@ $vcalendar->setProperty( "X-WR-TIMEZONE",
|
|
434 |
<br>
|
435 |
<a href="#Function_list">3 Function list</a><br>
|
436 |
<br>
|
437 |
-
<a href="#iCalcreator_object_methods">3.1
|
438 |
<br>
|
439 |
<a href="#Calendar_object_constructors">3.1.1 Constructors</a><br>
|
440 |
-
<a href="#vcalendar_constr">3.1.1.1
|
441 |
-
<a href="#vevent_constr">3.1.1.2
|
442 |
-
<a href="#vtodo_constr">3.1.1.3
|
443 |
-
<a href="#vjournal_constr">3.1.1.4
|
444 |
-
<a href="#vfreebusy_constr">3.1.1.5
|
445 |
-
<a href="#valarm_constr">3.1.1.6
|
446 |
-
<a href="#vtimezone_constr">3.1.1.7
|
447 |
-
<a href="#standard_daylight_constr">3.1.1.8
|
448 |
-
<br>
|
449 |
-
<a href="#iCalcreator_object_property_methods">3.1.2
|
450 |
<a href="#deleteProperty">3.1.2.1 deleteProperty</a><br>
|
451 |
<a href="#getProperty">3.1.2.2 getProperty</a><br>
|
452 |
<a href="#setProperty">3.1.2.3 setProperty</a><br>
|
@@ -455,7 +504,7 @@ $vcalendar->setProperty( "X-WR-TIMEZONE",
|
|
455 |
<a href="#VERSION">3.1.2.6 VERSION</a><br>
|
456 |
<a href="#X-PROPERTY">3.1.2.7 X-PROPERTY</a><br>
|
457 |
<br>
|
458 |
-
<a href="#iCalcreator_component_object_methods">3.1.3
|
459 |
<a href="#deleteComponent">3.1.3.1 deleteComponent</a><br>
|
460 |
<a href="#getComponent">3.1.3.2 getComponent</a><br>
|
461 |
<a href="#newComponent">3.1.3.3 newComponent</a><br>
|
@@ -463,7 +512,7 @@ $vcalendar->setProperty( "X-WR-TIMEZONE",
|
|
463 |
<a href="#selectComponents">3.1.3.5 selectComponents</a><br>
|
464 |
<a href="#setComponent">3.1.3.6 setComponent</a><br>
|
465 |
<br>
|
466 |
-
<a href="#iCalcreator_calendar_methods">3.1.4
|
467 |
<a href="#parse_merge">3.1.4.1 parse and merge</a><br>
|
468 |
<a href="#createCalendar">3.1.4.2 createCalendar</a><br>
|
469 |
<a href="#returnCalendar">3.1.4.3 returnCalendar</a><br>
|
@@ -472,7 +521,7 @@ $vcalendar->setProperty( "X-WR-TIMEZONE",
|
|
472 |
<a href="#useCachedCalendar">3.1.4.6 useCachedCalendar</a><br>
|
473 |
<a href="#iCalcreatorVersion">3.1.4.7 iCalcreatorVersion</a><br>
|
474 |
<br>
|
475 |
-
<a href="#iCalcreator_configuration_methods">3.1.5
|
476 |
<a href="#configKeys">3.1.5.1 configuration keys</a><br>
|
477 |
<a href="#getConfig">3.1.5.2 getConfig</a><br>
|
478 |
<a href="#initConfig">3.1.5.3 calendar/component initialization</a><br>
|
@@ -491,7 +540,7 @@ $vcalendar->setProperty( "X-WR-TIMEZONE",
|
|
491 |
<a href="#Unique_id">3.1.5.16 Unique_id</a><br>
|
492 |
<a href="#configURL">3.1.5.17 URL</a><br>
|
493 |
<br>
|
494 |
-
<a href="#Calendar_component_object_property_function_list">3.2
|
495 |
<a href="#deleteProperty_PROP">3.2.1 deleteProperty</a><br>
|
496 |
<a href="#getProperty_PROP">3.2.2 getProperty</a><br>
|
497 |
<a href="#parse">3.2.3 parse</a><br>
|
@@ -604,7 +653,7 @@ $vcalendar->setProperty( "X-WR-TIMEZONE",
|
|
604 |
<br>
|
605 |
<a href="#TimezoneXMLjsonvCard">4 Timezone, XML, json and vCard support</a><br>
|
606 |
<a href="#timezoneHandler">4.1 iCalcreator and timezoneHandler class</a><br>
|
607 |
-
<a href="#createTimezone">4.1.1 createTimezone</
|
608 |
<a href="#ms2phpTZ">4.1.2 ms2phpTZ</a><br>
|
609 |
<a href="#transformDateTime">4.1.3 transformDateTime</a><br>
|
610 |
<a href="#TZhelpers">4.2 Timezone helper functions</a><br>
|
@@ -624,12 +673,12 @@ $vcalendar->setProperty( "X-WR-TIMEZONE",
|
|
624 |
|
625 |
<a name="Calendar_Component_list"></a><h1>2 Calendar Component list</h1>
|
626 |
<p>
|
627 |
-
To ease up usage, You will find convenient holders for
|
628 |
-
properties
|
629 |
used in code snippets.
|
630 |
</p>
|
631 |
<p>
|
632 |
-
Quote from <a href="
|
633 |
- Internet Calendaring and Scheduling Core Object Specification (<strong>iCalendar</strong>)!
|
634 |
</p>
|
635 |
<a name="VCALENDAR"></a><h2>2.1 VCALENDAR</h2>
|
@@ -1290,19 +1339,23 @@ A comprehensive table showing relation between <strong>calendar</strong> compone
|
|
1290 |
<p>
|
1291 |
If not set, the <a href="#DTSTAMP">DTSTAMP</a> and <a href="#UID">UID</a> properties
|
1292 |
are automatically created by iCalcreator<br>
|
1293 |
-
for <a href="#VEVENT">vevent</a
|
1294 |
-
|
1295 |
-
|
|
|
|
|
|
|
|
|
1296 |
</p>
|
1297 |
<br>
|
1298 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_Component_list">[up]</a>
|
1299 |
|
1300 |
<a name="Function_list"></a><h1>3 Function list</h1>
|
1301 |
|
1302 |
-
<a name="iCalcreator_object_methods"></a><h2>3.1
|
1303 |
|
1304 |
<a name="Calendar_object_constructors"></a><h3>3.1.1 Constructors</h3>
|
1305 |
-
<a name="vcalendar_constr"></a><h4>3.1.1.1
|
1306 |
<p>Create a new <a href="#VCALENDAR">VCALENDAR</a> object.</p>
|
1307 |
<p class="label">Format</p>
|
1308 |
<p class="format">vcalendar::vcalendar( [ config ] )</p>
|
@@ -1311,8 +1364,8 @@ config = array, review <a href="#iCalcreator_configuration_methods">configuratio
|
|
1311 |
</p>
|
1312 |
<p class="label">Basic example</p>
|
1313 |
<p class="example">
|
1314 |
-
$config =
|
1315 |
-
$vcalendar = new
|
1316 |
|
1317 |
</p>
|
1318 |
<p>
|
@@ -1322,18 +1375,17 @@ if not set manually, and based on the configuration <a href="#Unique_id">unique_
|
|
1322 |
<p class="label">Extended example</p>
|
1323 |
<p class="example">
|
1324 |
$tz = "Europe/Stockholm"
|
1325 |
-
$config =
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
|
|
1330 |
|
1331 |
// <span class="comment">insert components or parse an iCal file (and edit components)</span>
|
1332 |
|
1333 |
-
$xprops =
|
1334 |
-
kigkonsult\iCalcreator\
|
1335 |
-
$tz,
|
1336 |
-
$xprops );
|
1337 |
|
1338 |
</p>
|
1339 |
<p>
|
@@ -1344,7 +1396,7 @@ if not set manually, a TZID <b>auto completion</b>.
|
|
1344 |
<p>
|
1345 |
Some <strong>calendar</strong> software may also require calendar property <a href="#Additional_Descriptors">X-WR-TIMEZONE</a>
|
1346 |
and vtimezone component with property <a href="#Additional_Descriptors">X-LIC-LOCATION</a>,
|
1347 |
-
review <a href="#createTimezone">createTimezone</a>, a method in the
|
1348 |
</p>
|
1349 |
<p>
|
1350 |
Do <b>NOT</b> set <a href="#Directory">directory</a>/<a href="#Filename">filename</a> in vcalendar constructor,
|
@@ -1354,24 +1406,26 @@ due to inability to detect error (bool false) config return.
|
|
1354 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Function_list">[up]</a>
|
1355 |
|
1356 |
|
1357 |
-
<a name="vevent_constr"></a><h4>3.1.1.2
|
1358 |
<p class="label">Format 1</p>
|
1359 |
<p>
|
1360 |
-
Create a new <a href="#VEVENT">VEVENT</a> object using an
|
1361 |
returning a reference to the new component.
|
1362 |
</p>
|
1363 |
<p>
|
1364 |
-
To ease up usage,
|
1365 |
</p>
|
1366 |
|
1367 |
<p class="format">vcalendar::newComponent( "vevent" )</p>
|
1368 |
<p class="label">Example</p>
|
1369 |
<p class="example">
|
1370 |
-
$config =
|
1371 |
-
|
1372 |
-
|
|
|
|
|
1373 |
|
1374 |
-
$vevent = $vcalendar->newComponent(
|
1375 |
$vevent->setProperty( .. .
|
1376 |
</p>
|
1377 |
<p>
|
@@ -1380,9 +1434,11 @@ You can also use a convenient vcalendar::newComponent() method wrapper, like:
|
|
1380 |
<p class="format">vcalendar::newVevent()</p>
|
1381 |
<p class="label">Example</p>
|
1382 |
<p class="example">
|
1383 |
-
$config =
|
1384 |
-
|
1385 |
-
|
|
|
|
|
1386 |
|
1387 |
$vevent = $vcalendar->newVevent();
|
1388 |
$vevent->setProperty( .. .
|
@@ -1396,12 +1452,14 @@ config = array, review <a href="#iCalcreator_configuration_methods">configuratio
|
|
1396 |
</p>
|
1397 |
<p class="label">Example</p>
|
1398 |
<p class="example">
|
1399 |
-
$config =
|
1400 |
-
|
1401 |
-
|
|
|
|
|
1402 |
|
1403 |
$config = $vcalendar->getConfig();
|
1404 |
-
$vevent = new
|
1405 |
$vevent->setProperty( .. .
|
1406 |
|
1407 |
$vcalendar->setComponent( $vevent );
|
@@ -1411,23 +1469,25 @@ $vcalendar->setComponent( $vevent );
|
|
1411 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Function_list">[up]</a>
|
1412 |
|
1413 |
|
1414 |
-
<a name="vtodo_constr"></a><h4>3.1.1.3
|
1415 |
<p class="label">Format 1</p>
|
1416 |
<p>
|
1417 |
-
Create a new <a href="#VTODO">VTODO</a> object using an
|
1418 |
returning a reference to the new component.
|
1419 |
</p>
|
1420 |
<p>
|
1421 |
-
To ease up usage,
|
1422 |
</p>
|
1423 |
<p class="format">vcalendar::newComponent( "vtodo" )</p>
|
1424 |
<p class="label">Example</p>
|
1425 |
<p class="example">
|
1426 |
-
$config =
|
1427 |
-
|
1428 |
-
|
|
|
|
|
1429 |
|
1430 |
-
$vtodo = $vcalendar->newComponent(
|
1431 |
$vtodo->setProperty( .. .
|
1432 |
|
1433 |
</p>
|
@@ -1437,9 +1497,11 @@ You can also use a convenient vcalendar::newComponent() method wrapper, like:
|
|
1437 |
<p class="format">vcalendar::newVtodo()</p>
|
1438 |
<p class="label">Example</p>
|
1439 |
<p class="example">
|
1440 |
-
$config =
|
1441 |
-
|
1442 |
-
|
|
|
|
|
1443 |
|
1444 |
$vtodo = $vcalendar->newVtodo();
|
1445 |
$vtodo->setProperty( .. .
|
@@ -1454,11 +1516,13 @@ config = array, review <a href="#iCalcreator_configuration_methods">configuratio
|
|
1454 |
</p>
|
1455 |
<p class="label">Example</p>
|
1456 |
<p class="example">
|
1457 |
-
$config =
|
1458 |
-
|
1459 |
-
|
|
|
|
|
1460 |
|
1461 |
-
$vtodo = new
|
1462 |
$vtodo->setProperty( .. .
|
1463 |
|
1464 |
$vcalendar->setComponent( $vtodo );
|
@@ -1468,23 +1532,25 @@ $vcalendar->setComponent( $vtodo );
|
|
1468 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Function_list">[up]</a>
|
1469 |
|
1470 |
|
1471 |
-
<a name="vjournal_constr"></a><h4>3.1.1.4
|
1472 |
<p class="label">Format 1</p>
|
1473 |
<p>
|
1474 |
-
Create a new <a href="#
|
1475 |
returning a reference to the new component.
|
1476 |
</p>
|
1477 |
<p>
|
1478 |
-
To ease up usage,
|
1479 |
</p>
|
1480 |
<p class="format">vcalendar::newComponent( "vjournal" )</p>
|
1481 |
<p class="label">Example</p>
|
1482 |
<p class="example">
|
1483 |
-
$config =
|
1484 |
-
|
1485 |
-
|
|
|
|
|
1486 |
|
1487 |
-
$vjournal = $vcalendar->newComponent(
|
1488 |
$vjournal->setProperty( .. .
|
1489 |
|
1490 |
</p>
|
@@ -1494,9 +1560,11 @@ You can also use a convenient vcalendar::newComponent() method wrapper, like:
|
|
1494 |
<p class="format">vcalendar::newVjournal()</p>
|
1495 |
<p class="label">Example</p>
|
1496 |
<p class="example">
|
1497 |
-
$config =
|
1498 |
-
|
1499 |
-
|
|
|
|
|
1500 |
|
1501 |
$vjournal = $vcalendar->newVjournal();
|
1502 |
$vjournal->setProperty( .. .
|
@@ -1511,11 +1579,13 @@ config = array, review <a href="#iCalcreator_configuration_methods">configuratio
|
|
1511 |
</p>
|
1512 |
<p class="label">Example</p>
|
1513 |
<p class="example">
|
1514 |
-
$config =
|
1515 |
-
|
1516 |
-
|
|
|
|
|
1517 |
|
1518 |
-
$vjournal = new
|
1519 |
$vjournal->setProperty( .. .
|
1520 |
|
1521 |
$vcalendar->setComponent( $vjournal );
|
@@ -1525,23 +1595,25 @@ $vcalendar->setComponent( $vjournal );
|
|
1525 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Function_list">[up]</a>
|
1526 |
|
1527 |
|
1528 |
-
<a name="vfreebusy_constr"></a><h4>3.1.1.5
|
1529 |
<p class="label">Format 1</p>
|
1530 |
<p>
|
1531 |
-
Create a new <a href="#VFREEBUSY">VFREEBUSY</a> object using an
|
1532 |
returning a reference to the new component.
|
1533 |
</p>
|
1534 |
<p>
|
1535 |
-
To ease up usage,
|
1536 |
</p>
|
1537 |
<p class="format">vcalendar::newComponent( "vfreebusy" )</p>
|
1538 |
<p class="label">Example</p>
|
1539 |
<p class="example">
|
1540 |
-
$config =
|
1541 |
-
|
1542 |
-
|
|
|
|
|
1543 |
|
1544 |
-
$vfreebusy = $vcalendar->newComponent(
|
1545 |
$vfreebusy->setProperty( .. .
|
1546 |
|
1547 |
</p>
|
@@ -1551,9 +1623,11 @@ You can also use a convenient vcalendar::newComponent() method wrapper, like:
|
|
1551 |
<p class="format">vcalendar::newVfreebusy()</p>
|
1552 |
<p class="label">Example</p>
|
1553 |
<p class="example">
|
1554 |
-
$config =
|
1555 |
-
|
1556 |
-
|
|
|
|
|
1557 |
|
1558 |
$vfreebusy = $vcalendar->newVfreebusy();
|
1559 |
$vfreebusy->setProperty( .. .
|
@@ -1568,11 +1642,13 @@ config = array, review <a href="#iCalcreator_configuration_methods">configuratio
|
|
1568 |
</p>
|
1569 |
<p class="label">Example</p>
|
1570 |
<p class="example">
|
1571 |
-
$config =
|
1572 |
-
|
1573 |
-
|
|
|
|
|
1574 |
|
1575 |
-
$vfreebusy = new
|
1576 |
$vfreebusy->setProperty( .. .
|
1577 |
|
1578 |
$vcalendar->setComponent( $vfreebusy );
|
@@ -1582,28 +1658,30 @@ $vcalendar->setComponent( $vfreebusy );
|
|
1582 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Function_list">[up]</a>
|
1583 |
|
1584 |
|
1585 |
-
<a name="valarm_constr"></a><h4>3.1.1.6
|
1586 |
<p class="label">Format 1</p>
|
1587 |
<p>
|
1588 |
-
Create a new <a href="#VALARM">VALARM</a> object using an
|
1589 |
returning a reference to the new (sub-)component.
|
1590 |
The <a href="#VALARM">VALARM</a> calendar component MUST only appear (one or more, mutually independent)
|
1591 |
within either a <a href="#VEVENT">VEVENT</a> or <a href="#VTODO">VTODO</a> calendar component.
|
1592 |
</p>
|
1593 |
<p>
|
1594 |
-
To ease up usage,
|
1595 |
</p>
|
1596 |
<p class="format">calendarComponent::newComponent( "valarm" )</p>
|
1597 |
<p class="label">Example</p>
|
1598 |
<p class="example">
|
1599 |
-
$config =
|
1600 |
-
|
1601 |
-
|
|
|
|
|
1602 |
|
1603 |
-
$vevent = $vcalendar->newComponent(
|
1604 |
$vevent->setProperty( .. .
|
1605 |
|
1606 |
-
$valarm = $vevent->newComponent(
|
1607 |
$valarm->setProperty( .. .
|
1608 |
|
1609 |
</p>
|
@@ -1613,9 +1691,11 @@ You can also use a convenient calendarComponent::newComponent() method wrapper,
|
|
1613 |
<p class="format">calendarComponent::newValarm()</p>
|
1614 |
<p class="label">Example</p>
|
1615 |
<p class="example">
|
1616 |
-
$config =
|
1617 |
-
|
1618 |
-
|
|
|
|
|
1619 |
|
1620 |
$vevent = $vcalendar->newVevent();
|
1621 |
$vevent->setProperty( .. .
|
@@ -1633,14 +1713,16 @@ config = array, review <a href="#iCalcreator_configuration_methods">configuratio
|
|
1633 |
</p>
|
1634 |
<p class="label">Example</p>
|
1635 |
<p class="example">
|
1636 |
-
$config =
|
1637 |
-
|
1638 |
-
|
|
|
|
|
1639 |
|
1640 |
-
$vevent = new
|
1641 |
$vevent->setProperty( .. .
|
1642 |
|
1643 |
-
$valarm = new
|
1644 |
$valarm->setProperty( .. .
|
1645 |
|
1646 |
$vevent->setComponent( $valarm );
|
@@ -1652,27 +1734,29 @@ $vcalendar->setComponent( $vevent );
|
|
1652 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Function_list">[up]</a>
|
1653 |
|
1654 |
|
1655 |
-
<a name="vtimezone_constr"></a><h4>3.1.1.7
|
1656 |
<p>
|
1657 |
The vtimezone component describe, at a minimum, the base offset from <b>UTC</b> for the time zone.
|
1658 |
For dates with UTC DATE-TIME, read <a href="#DATE_WITH_UTC_TIME">this</a>!
|
1659 |
</p>
|
1660 |
<p>
|
1661 |
-
To ease up usage,
|
1662 |
</p>
|
1663 |
<p class="label">Format 1</p>
|
1664 |
<p>
|
1665 |
-
Create a new <a href="#VTIMEZONE">VTIMEZONE</a> object using an
|
1666 |
returning a reference to the new component.
|
1667 |
</p>
|
1668 |
<p class="format">vcalendar::newComponent( "vtimezone" )</p>
|
1669 |
<p class="label">Example</p>
|
1670 |
<p class="example">
|
1671 |
-
$config =
|
1672 |
-
|
1673 |
-
|
|
|
|
|
1674 |
|
1675 |
-
$vtimezone = $vcalendar->newComponent(
|
1676 |
$vtimezone->setProperty( .. .
|
1677 |
|
1678 |
</p>
|
@@ -1682,9 +1766,11 @@ You can also use a convenient vcalendar::newComponent() method wrapper, like:
|
|
1682 |
<p class="format">vcalendar::newVtimezone()</p>
|
1683 |
<p class="label">Example</p>
|
1684 |
<p class="example">
|
1685 |
-
$config =
|
1686 |
-
|
1687 |
-
|
|
|
|
|
1688 |
|
1689 |
$vtimezone = $vcalendar->newVtimezone();
|
1690 |
$vtimezone->setProperty( .. .
|
@@ -1699,11 +1785,13 @@ config = array, review <a href="#iCalcreator_configuration_methods">configuratio
|
|
1699 |
</p>
|
1700 |
<p class="label">Example</p>
|
1701 |
<p class="example">
|
1702 |
-
$config =
|
1703 |
-
|
1704 |
-
|
|
|
|
|
1705 |
|
1706 |
-
$vtimezone = new
|
1707 |
$vtimezone->setProperty( .. .
|
1708 |
|
1709 |
$vcalendar->setComponent( $vtimezone );
|
@@ -1712,39 +1800,41 @@ $vcalendar->setComponent( $vtimezone );
|
|
1712 |
<br>
|
1713 |
<h5>Creation of timezone components</h5>
|
1714 |
<p>
|
1715 |
-
It is possible to create timezone components, using a method in
|
1716 |
and utilizing the <em>PHP</em> DateTimeZone class.
|
1717 |
</p>
|
1718 |
<br>
|
1719 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Function_list">[up]</a>
|
1720 |
|
1721 |
-
<a name="standard_daylight_constr"></a><h4>3.1.1.8
|
1722 |
<p class="label">Format 1</p>
|
1723 |
<p>
|
1724 |
Create a new <a href="#VTIMEZONE">VTIMEZONE</a> <b>standard</b> / <b>daylight</b> objects
|
1725 |
-
using an
|
1726 |
returning a reference to the new (sub-)component.
|
1727 |
</p>
|
1728 |
<p>
|
1729 |
-
To ease up usage,
|
1730 |
-
|
1731 |
-
|
1732 |
as used in code snippets are available.
|
1733 |
</p>
|
1734 |
<p class="format">vtimezone::newComponent( "standard" )</p>
|
1735 |
<p class="label">Example</p>
|
1736 |
<p class="example">
|
1737 |
-
$config =
|
1738 |
-
|
1739 |
-
|
|
|
|
|
1740 |
|
1741 |
-
$vtimezone = $vcalendar->newComponent(
|
1742 |
$vtimezone->setProperty( .. .
|
1743 |
|
1744 |
-
$standard = $vtimezone->newComponent(
|
1745 |
$standard->setProperty( .. .
|
1746 |
|
1747 |
-
$daylight = $vtimezone->newComponent(
|
1748 |
$daylight->setProperty( .. .
|
1749 |
|
1750 |
</p>
|
@@ -1755,9 +1845,11 @@ You can also use convenient vcalendar::newComponent() method wrappers, like:
|
|
1755 |
<p class="format">vtimezone::newDaylight()</p>
|
1756 |
<p class="label">Example</p>
|
1757 |
<p class="example">
|
1758 |
-
$config =
|
1759 |
-
|
1760 |
-
|
|
|
|
|
1761 |
|
1762 |
$vtimezone = $vcalendar->newVtimezone();
|
1763 |
$vtimezone->setProperty( .. .
|
@@ -1778,23 +1870,27 @@ config = array, review <a href="#iCalcreator_configuration_methods">configuratio
|
|
1778 |
</p>
|
1779 |
<p class="label">Example</p>
|
1780 |
<p class="example">
|
1781 |
-
$config =
|
1782 |
-
|
1783 |
-
|
|
|
|
|
1784 |
|
1785 |
-
$vtimezone = new
|
1786 |
$vtimezone->setProperty( .. .
|
1787 |
|
1788 |
-
$standard = new
|
1789 |
-
|
1790 |
-
|
|
|
1791 |
$standard->setProperty( .. .
|
1792 |
|
1793 |
$vtimezone->setComponent( $standard );
|
1794 |
|
1795 |
-
$daylight = new
|
1796 |
-
|
1797 |
-
|
|
|
1798 |
$daylight->setProperty( .. .
|
1799 |
|
1800 |
$vtimezone->setComponent( $daylight );
|
@@ -1806,10 +1902,10 @@ $vcalendar->setComponent( $vtimezone );
|
|
1806 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Function_list">[up]</a>
|
1807 |
|
1808 |
|
1809 |
-
<a name="iCalcreator_object_property_methods"></a><h3>3.1.2
|
1810 |
|
1811 |
<a name="deleteProperty"></a><h4>3.1.2.1 deleteProperty</h4>
|
1812 |
-
<p>Generic
|
1813 |
<p>Bool false is returned if no property exists or when end-of-properties at consecutive method calls.</p>
|
1814 |
<p class="label">Format</p>
|
1815 |
<p class="format">vcalendar::deleteProperty( [ PropName [, order=1 ] )</p>
|
@@ -1820,13 +1916,14 @@ order = (int) if missing 1st/next occurrence,
|
|
1820 |
</p>
|
1821 |
<p class="label">Example</p>
|
1822 |
<p class="example">
|
1823 |
-
$
|
1824 |
-
|
1825 |
-
|
1826 |
-
$
|
1827 |
-
|
1828 |
-
|
1829 |
-
|
|
|
1830 |
</p>
|
1831 |
<br>
|
1832 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_object_property_methods">[up]</a>
|
@@ -1842,32 +1939,35 @@ if( ! $vcalendar->deleteProperty( kigkonsult\iCalcreator\util\util::$METHOD )
|
|
1842 |
order = (int) if missing 1st/next occurrence,
|
1843 |
used with multiply (property) occurrences
|
1844 |
complete = (bool) false (default) : output only property value
|
1845 |
-
true : output =
|
1846 |
</p>
|
1847 |
<p class="label">Example 1</p>
|
1848 |
<p class="example">
|
1849 |
-
$
|
1850 |
-
|
1851 |
-
|
1852 |
-
$
|
1853 |
-
$
|
|
|
1854 |
|
1855 |
</p>
|
1856 |
<p class="label">Example 2</p>
|
1857 |
<p class="example">
|
1858 |
-
$
|
1859 |
-
|
1860 |
-
|
1861 |
-
$
|
|
|
1862 |
while( $xprop = $vcalendar->getProperty( )) { // <span class="comment">get x-properties</span>
|
1863 |
-
|
|
|
1864 |
</p>
|
1865 |
<a name="getProperty2"></a>
|
1866 |
<a name="geoLocation"></a>
|
1867 |
<p class="label">Format 2</p>
|
1868 |
<p>
|
1869 |
Ability to fetch specific <i>component</i> property (unique) value(-s) and number of occurrence(-s).
|
1870 |
-
The search includes <b>ALL</b> components within the
|
1871 |
</p>
|
1872 |
<p>
|
1873 |
Outputs an array( *[ (string) unique-property-value => (int) number_of_occurrence ] ) or an empty array if no hits.
|
@@ -1924,17 +2024,17 @@ To get component property values, use <a href="#getProperty_PROP">getProperty</a
|
|
1924 |
<p class="format">vcalendar::getProperty( PropName )</p>
|
1925 |
<p class="comment">propName = (string) case independent, property name</p>
|
1926 |
<p class="label">Example 1</p>
|
1927 |
-
<p>Fetch all attendees in the
|
1928 |
<p class="example">
|
1929 |
-
$attendees = $vcalendar->getProperty(
|
1930 |
-
foreach( $attendees as $attendee
|
1931 |
.. .
|
1932 |
</p>
|
1933 |
<p class="label">Example 2</p>
|
1934 |
-
<p>Fetch all DTSTARTs in the
|
1935 |
<p class="example">
|
1936 |
-
$startDates = $vcalendar->getProperty(
|
1937 |
-
foreach( $startDates as $startDate
|
1938 |
.. .
|
1939 |
</p>
|
1940 |
<br>
|
@@ -1942,7 +2042,7 @@ foreach( $startDates as $startDate => $occurrCount ) {
|
|
1942 |
|
1943 |
|
1944 |
<a name="setProperty"></a><h4>3.1.2.3 setProperty</h4>
|
1945 |
-
<p>Generic the
|
1946 |
<p>A successful update returns true.</p>
|
1947 |
<p class="label">Format</p>
|
1948 |
<p class="format">vcalendar::setProperty( PropName, Proparg_1 *[, Proparg_n] )</p>
|
@@ -1955,13 +2055,13 @@ Proparg = (mixed) property argument
|
|
1955 |
</p>
|
1956 |
<p class="label">Example</p>
|
1957 |
<p class="example">
|
1958 |
-
$config =
|
1959 |
-
|
1960 |
-
|
1961 |
-
|
|
|
1962 |
$vcalendar->setConfig( $config );
|
1963 |
-
$vcalendar->setProperty(
|
1964 |
-
"GREGORIAN" );
|
1965 |
|
1966 |
</p>
|
1967 |
<br>
|
@@ -1976,7 +2076,7 @@ This property defines the <strong>calendar</strong> scale used for the <strong>c
|
|
1976 |
The default value is "GREGORIAN", implied when missing.
|
1977 |
</p>
|
1978 |
<p>
|
1979 |
-
To ease up usage,
|
1980 |
</p>
|
1981 |
<h5>Create CALSCALE</h5>
|
1982 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -1993,7 +2093,7 @@ $str = $vcalendar->createCalscale();
|
|
1993 |
<p class="format">vcalendar::deleteProperty( "calscale" )</p>
|
1994 |
<p class="label">Example</p>
|
1995 |
<p class="example">
|
1996 |
-
$vcalendar->deleteProperty(
|
1997 |
|
1998 |
</p>
|
1999 |
<h5>Get Calscale</h5>
|
@@ -2002,26 +2102,27 @@ $vcalendar->deleteProperty( kigkonsult\iCalcreator\util\util::$CALSCALE );
|
|
2002 |
<p class="format">vcalendar::getProperty( "calscale" )</p>
|
2003 |
<p class="label">Example</p>
|
2004 |
<p class="example">
|
2005 |
-
$
|
2006 |
-
|
2007 |
-
|
2008 |
-
$
|
2009 |
-
$vcalendar->parse();
|
2010 |
-
$calscale = $vcalendar->getProperty(
|
2011 |
|
2012 |
</p>
|
2013 |
<h5>Set CALSCALE</h5>
|
2014 |
-
<p>
|
2015 |
<p class="label">Format</p>
|
2016 |
<p class="format">vcalendar::setProperty( "calscale", value )</p>
|
2017 |
<p class="comment">value = (string) calscale value</p>
|
2018 |
<p class="label">Example</p>
|
2019 |
<p class="example">
|
2020 |
-
$config =
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
|
|
2025 |
|
2026 |
</p>
|
2027 |
<br>
|
@@ -2039,7 +2140,7 @@ into some calendaring software (MS etc.), as well as <a href="#X-PROPERTY">x-pro
|
|
2039 |
and the (automatically created) <a href="#DTSTAMP">DTSTAMP</a> and <a href="#UID">UID</a> properties.
|
2040 |
</p>
|
2041 |
<p>
|
2042 |
-
To ease up usage,
|
2043 |
</p>
|
2044 |
<h5>Create METHOD</h5>
|
2045 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -2056,7 +2157,7 @@ $str = $vcalendar->createMethod();
|
|
2056 |
<p class="format">vcalendar::deleteProperty( "METHOD" )</p>
|
2057 |
<p class="label">Example</p>
|
2058 |
<p class="example">
|
2059 |
-
$vcalendar->deleteProperty(
|
2060 |
|
2061 |
</p>
|
2062 |
<h5>Get METHOD</h5>
|
@@ -2065,24 +2166,25 @@ $vcalendar->deleteProperty( kigkonsult\iCalcreator\util\util::$METHOD );
|
|
2065 |
<p class="format">vcalendar::getProperty( "method" );</p>
|
2066 |
<p class="label">Example</p>
|
2067 |
<p class="example">
|
2068 |
-
$config =
|
2069 |
-
$vcalendar = new
|
2070 |
$vcalendar->parse();
|
2071 |
-
$method = $vcalendar->getProperty(
|
2072 |
|
2073 |
</p>
|
2074 |
<h5>Set METHOD</h5>
|
2075 |
-
<p>
|
2076 |
<p class="label">Format</p>
|
2077 |
<p class="format">vcalendar::setProperty( "method", value )</p>
|
2078 |
<p class="comment">value = (string) method value</p>
|
2079 |
<p class="label">Example</p>
|
2080 |
<p class="example">
|
2081 |
-
$config =
|
2082 |
-
|
2083 |
-
|
2084 |
-
|
2085 |
-
|
|
|
2086 |
|
2087 |
</p>
|
2088 |
<br>
|
@@ -2095,7 +2197,7 @@ This property specifies the identifier corresponding to the version number of th
|
|
2095 |
This property is always placed first in the <strong>calendar</strong> file.
|
2096 |
</p>
|
2097 |
<p>
|
2098 |
-
To ease up usage,
|
2099 |
</p>
|
2100 |
<h5>Create Version</h5>
|
2101 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -2112,27 +2214,28 @@ $str = $vcalendar->createVersion();
|
|
2112 |
<p class="format">vcalendar::getProperty( "version" )</p>
|
2113 |
<p class="label">Example</p>
|
2114 |
<p class="example">
|
2115 |
-
$
|
2116 |
-
|
2117 |
-
|
2118 |
-
$
|
2119 |
-
$vcalendar->parse();
|
2120 |
-
$version = $vcalendar->getProperty(
|
2121 |
|
2122 |
</p>
|
2123 |
<h5>Set Version</h5>
|
2124 |
-
<p>
|
2125 |
Only version 2.0 valid, version is <b>AUTO</b> generated at <strong>calendar</strong> creation.</p>
|
2126 |
<p class="label">Format</p>
|
2127 |
<p class="format">vcalendar::setProperty( "version", version )</p>
|
2128 |
<p class="comment">version = (string) iCal version</p>
|
2129 |
<p class="label">Example</p>
|
2130 |
<p class="example">
|
2131 |
-
$config =
|
2132 |
-
|
2133 |
-
|
2134 |
-
|
2135 |
-
|
|
|
2136 |
|
2137 |
</p>
|
2138 |
<br>
|
@@ -2172,7 +2275,7 @@ $vcalendar->deleteProperty( "X-PROPERTY" );
|
|
2172 |
<p>Delete all x-properties.</p>
|
2173 |
<p class="example">
|
2174 |
while( $vcalendar->deleteProperty())
|
2175 |
-
|
2176 |
|
2177 |
</p>
|
2178 |
<h5>Get X-PROPERTY</h5>
|
@@ -2187,17 +2290,17 @@ while( $vcalendar->deleteProperty())
|
|
2187 |
, array( "value" => propertyData<sup>2</sup> )
|
2188 |
, "params" => params<sup>3</sup>))
|
2189 |
<p class="comment">propertyName<sup>1</sup>, propertyData<sup>2</sup> and params<sup>3</sup> specs below.</p>
|
2190 |
-
|
2191 |
<p class="label">Example 1</p>
|
2192 |
<p>
|
2193 |
Read all x-prop values in a loop. Output in detail below.
|
2194 |
</p>
|
2195 |
<p class="example">
|
2196 |
-
$
|
2197 |
-
|
2198 |
-
|
2199 |
-
$
|
2200 |
-
$vcalendar->parse();
|
2201 |
while( $xprop = $vcalendar->getProperty( )) {
|
2202 |
// <span class="comment">$xprop = array( propertyName<sup>1</sup>,
|
2203 |
propertyData<sup>2</sup> )</span>
|
@@ -2208,11 +2311,11 @@ while( $xprop = $vcalendar->getProperty( )) {
|
|
2208 |
If exists, read the X-WR-TIMEZONE x-prop
|
2209 |
</p>
|
2210 |
<p class="example">
|
2211 |
-
$
|
2212 |
-
|
2213 |
-
|
2214 |
-
$
|
2215 |
-
$vcalendar->parse();
|
2216 |
if( $xprop = $vcalendar->getProperty( "X-WR-TIMEZONE" )) {
|
2217 |
// <span class="comment">$xprop = array( "X-WR-TIMEZONE",
|
2218 |
propertyData<sup>2</sup> )</span>
|
@@ -2223,11 +2326,11 @@ if( $xprop = $vcalendar->getProperty( "X-WR-TIMEZONE" )) {
|
|
2223 |
Read all x-prop values/parameters in a loop.
|
2224 |
</p>
|
2225 |
<p class="example">
|
2226 |
-
$
|
2227 |
-
|
2228 |
-
|
2229 |
-
$
|
2230 |
-
$vcalendar->parse();
|
2231 |
while( $xprop = $vcalendar->getProperty( false, false, true )) {
|
2232 |
/* <span class="comment">$xprop = array( propertyName<sup>1</sup>,
|
2233 |
array( "value" => propertyData<sup>2</sup>,
|
@@ -2249,26 +2352,25 @@ lang<sup>*</sup> = as defined in [RFC5546]
|
|
2249 |
</p>
|
2250 |
<p class="label">Example</p>
|
2251 |
<p class="example">
|
2252 |
-
$config =
|
2253 |
-
|
2254 |
-
|
|
|
|
|
2255 |
// <span class="comment">set some X-properties</span>
|
2256 |
-
$vcalendar->setProperty( "x-wr-calname",
|
2257 |
-
|
2258 |
-
$vcalendar->setProperty( "X-WR-
|
2259 |
-
"Calendar Description" );
|
2260 |
-
$vcalendar->setProperty( "X-WR-TIMEZONE",
|
2261 |
-
"Europe/Stockholm" );
|
2262 |
|
2263 |
</p>
|
2264 |
<br>
|
2265 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_object_property_methods">[up]</a>
|
2266 |
|
2267 |
-
<a name="iCalcreator_component_object_methods"></a><h3>3.1.3
|
2268 |
|
2269 |
<a name="deleteComponent"></a><h4>3.1.3.1 deleteComponent</h4>
|
2270 |
<p>
|
2271 |
-
Remove component from the
|
2272 |
</p>
|
2273 |
<p>
|
2274 |
Bool false is returned if no component exists or at end-of-components invoking the method consecutive.
|
@@ -2287,38 +2389,38 @@ componentSuborderNumber = (int) order number</p>
|
|
2287 |
<p class="format">vcalendar::deleteComponent( <a href="#UID">UID</a> )</p>
|
2288 |
<p class="label">Example 1</p>
|
2289 |
<p class="example">
|
2290 |
-
$
|
2291 |
-
|
2292 |
-
|
2293 |
-
$
|
2294 |
-
$vcalendar->parse();
|
2295 |
$vcalendar->deleteComponent( 1 );
|
2296 |
-
$vcalendar->deleteComponent(
|
2297 |
$vcalendar->deleteComponent( "20070803T194810CEST-0123U3PXiX@kigkonsult.se");
|
2298 |
|
2299 |
</p>
|
2300 |
<p class="label">Example 2</p>
|
2301 |
<p>Deleting all components, using format 2 without order number.</p>
|
2302 |
<p class="example">
|
2303 |
-
$
|
2304 |
-
|
2305 |
-
|
2306 |
-
$
|
2307 |
-
$vcalendar->parse();
|
2308 |
-
|
2309 |
-
while( $vcalendar->deleteComponent( kigkonsult\iCalcreator\util\util::$LCVEVENT))
|
2310 |
-
continue;
|
2311 |
-
|
2312 |
-
$vtodo = $vcalendar->getComponent( kigkonsult\iCalcreator\util\util::$LCVTODO );
|
2313 |
-
while( $vtodo->deleteComponent( kigkonsult\iCalcreator\util\util::$LCVALARM))
|
2314 |
-
continue;
|
2315 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2316 |
</p>
|
2317 |
<br>
|
2318 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_component_object_methods">[up]</a>
|
2319 |
|
2320 |
<a name="getComponent"></a><h4>3.1.3.2 getComponent</h4>
|
2321 |
-
<p>Get (next) component from the
|
2322 |
<p>
|
2323 |
Bool false is returned if no component exists or at end-of-components invoking the method consecutive.
|
2324 |
</p>
|
@@ -2327,12 +2429,12 @@ Bool false is returned if no component exists or at end-of-components invoking t
|
|
2327 |
<p class="format">vcalendar::getComponent()</p>
|
2328 |
<p class="label">Example</p>
|
2329 |
<p class="example">
|
2330 |
-
$
|
2331 |
-
|
2332 |
-
|
2333 |
-
$
|
2334 |
-
$vcalendar->parse();
|
2335 |
-
while( $comp = $vcalendar->getComponent()) {
|
2336 |
.. .
|
2337 |
}
|
2338 |
|
@@ -2343,11 +2445,11 @@ while( $comp = $vcalendar->getComponent()) {§
|
|
2343 |
<p class="comment">orderNumber = (int) order number</p>
|
2344 |
<p class="label">Example</p>
|
2345 |
<p class="example">
|
2346 |
-
$
|
2347 |
-
|
2348 |
-
|
2349 |
-
$
|
2350 |
-
$vcalendar->parse();
|
2351 |
if( $comp = $vcalendar->getComponent( 1 )) {
|
2352 |
.. .
|
2353 |
}
|
@@ -2364,12 +2466,12 @@ get specific component with component type and suborder number (1st=1, 2nd=2).
|
|
2364 |
componentSuborderNumber = (int) order number</p>
|
2365 |
<p class="label">Example</p>
|
2366 |
<p class="example">
|
2367 |
-
$
|
2368 |
-
|
2369 |
-
|
2370 |
-
$
|
2371 |
-
$vcalendar->parse();
|
2372 |
-
if( $comp = $vcalendar->getComponent(
|
2373 |
.. .
|
2374 |
}
|
2375 |
|
@@ -2384,11 +2486,11 @@ May be used when trying to find (base) component and corresponding <a href="#REC
|
|
2384 |
<p class="format">vcalendar::getComponent( <a href="#UID">UID</a> )</p>
|
2385 |
<p class="label">Example</p>
|
2386 |
<p class="example">
|
2387 |
-
$
|
2388 |
-
|
2389 |
-
|
2390 |
-
$
|
2391 |
-
$vcalendar->parse();
|
2392 |
$uid = "20070803T194810CEST-0123U3PXiX@kigkonsult.se";
|
2393 |
if( $comp = $vcalendar->getComponent( $uid )) {
|
2394 |
.. .
|
@@ -2443,7 +2545,7 @@ For the other, non-date, properties an exact (strict case) match is required.
|
|
2443 |
To select components based on property values, use <a href="#selectComponents2">selectComponents</a> (Format 2).
|
2444 |
</p>
|
2445 |
<p>
|
2446 |
-
To retrieve specific
|
2447 |
use <a href="#getProperty2">getProperty</a> (Format 2).
|
2448 |
</p>
|
2449 |
<p class="format">vcalendar::getComponent( search )</p>
|
@@ -2455,14 +2557,13 @@ propertyData = (string) unique property value (strict case),
|
|
2455 |
datetime format "YYYYMMDDTHHMMSS"</p>
|
2456 |
<p class="label">Example</p>
|
2457 |
<p class="example">
|
2458 |
-
$
|
2459 |
-
|
2460 |
-
|
2461 |
-
$
|
2462 |
-
$vcalendar->parse();
|
2463 |
-
while( $comp = $vcalendar->getComponent(
|
2464 |
-
|
2465 |
-
|
2466 |
}
|
2467 |
|
2468 |
</p>
|
@@ -2472,15 +2573,15 @@ while( $comp = $vcalendar->getComponent( array( kigkonsult\iCalcreator\util\
|
|
2472 |
<a name="newComponent"></a><h4>3.1.3.3 newComponent</h4>
|
2473 |
<P>
|
2474 |
Create component (<a href="#VEVENT">VEVENT</a> / <a href="#VTODO">VTODO</a> / <a href="#VJOURNAL">VJOURNAL</a> / <a href="#VFREEBUSY">VFREEBUSY</a> / <a href="#VTIMEZONE">VTIMEZONE</a>)
|
2475 |
-
using a
|
2476 |
</p>
|
2477 |
<p>
|
2478 |
-
To ease up usage,
|
2479 |
-
|
2480 |
-
|
2481 |
-
|
2482 |
-
|
2483 |
-
|
2484 |
as used in code snippets is available.
|
2485 |
</p>
|
2486 |
<p class="label">Format</p>
|
@@ -2488,11 +2589,13 @@ as used in code snippets is available.
|
|
2488 |
<p class="comment">componentType = (string) component type</p>
|
2489 |
<p class="label">Example</p>
|
2490 |
<p class="example">
|
2491 |
-
$config =
|
2492 |
-
|
2493 |
-
|
|
|
|
|
2494 |
|
2495 |
-
$vevent = $vcalendar->newComponent(
|
2496 |
|
2497 |
</p>
|
2498 |
|
@@ -2517,7 +2620,7 @@ A successfull replace returns bool true otherwise bool false.
|
|
2517 |
</p>
|
2518 |
<p class="label">Format</p>
|
2519 |
<p class="format">vcalendar::replaceComponent( component )</p>
|
2520 |
-
<p class="comment">component = (object) component
|
2521 |
<p class="label">Example</p>
|
2522 |
<p class="example">
|
2523 |
$vcalendar->replaceComponent( $component );
|
@@ -2531,10 +2634,11 @@ $vcalendar->replaceComponent( $component );
|
|
2531 |
<p class="label">Format 1</p>
|
2532 |
<p>
|
2533 |
Selects <a href="#VEVENT">EVENT</a> / <a href="#VTODO">VTODO</a> / <a href="#VJOURNAL">VJOURNAL</a> /
|
2534 |
-
<a href="#VFREEBUSY">VFREEBUSY</a> components from the
|
2535 |
(notice <a href="#date_restriction">date restriction</a>), based on the initial <a href="#DTSTART">DTSTART</a>
|
2536 |
property along with the <a href="#RRULE">RRULE</a>, <a href="#RDATE">RDATE</a>, <a href="#EXDATE">EXDATE</a>
|
2537 |
-
and <a href="#EXRULE">EXRULE</a> properties in the component
|
|
|
2538 |
</p>
|
2539 |
<p>Requirement:</p>
|
2540 |
<ul>
|
@@ -2553,22 +2657,26 @@ the <a href="#RECURRENCE-ID">RECURRENCE-ID</a> parameter "RANGE" (&quo
|
|
2553 |
<li>no X-CURRENT-DTEND if no DTEND (DUE) is set (below)</li>
|
2554 |
</ul>
|
2555 |
<p>
|
2556 |
-
Returns an array with components (events) or bool false is returned if no
|
|
|
|
|
|
|
2557 |
<p>
|
2558 |
-
|
|
|
2559 |
<ul>
|
2560 |
<li>"X-CURRENT-DTSTART", TEXT content, <i>"Y-m-d [H:i:s [timezone]]"</i> showing the current start date.</li>
|
2561 |
<li>"X-CURRENT-DTEND" alt. "X-CURRENT-DUE" (opt), TEXT content, <i>"Y-m-d [H:i:s [timezone]]"</i> showing the current end date.</li>
|
2562 |
-
<li>"X-RECURRENCE", the RRULE/RDATE recurrence pattarn number (
|
2563 |
<li>"X-OCCURENCE", contains, where applicable, single multi-day recurrence event day number (formatted as 'day X of Y')</li>
|
2564 |
</ul>
|
2565 |
<p>
|
2566 |
-
To ease up usage,
|
2567 |
-
|
2568 |
-
|
2569 |
-
|
2570 |
-
|
2571 |
-
|
2572 |
are available.
|
2573 |
</p>
|
2574 |
<p class="format">vcalendar::selectComponents([ startYear, startMonth, startDay
|
@@ -2576,9 +2684,9 @@ are available.
|
|
2576 |
[, cType [, flat [, any [, split]]]]]])
|
2577 |
</p>
|
2578 |
<p class="comment">startYear : (int) start year (4*digit), default current year
|
2579 |
-
(object) start date
|
2580 |
startMonth : (int) start month (1-2*digit), default current month
|
2581 |
-
(object) end date
|
2582 |
startDay : (int) start day (1-2*digit), default current day
|
2583 |
endYear : (int) end year (4*digit), default startYear
|
2584 |
endMonth : (int) end month (1-2*digit), default startMonth
|
@@ -2609,33 +2717,31 @@ If flat is set to false, output array is sorted in 'Y-m-d h-i-s' asc. order.
|
|
2609 |
</p>
|
2610 |
<p class="label">Example</p>
|
2611 |
<p class="example">
|
2612 |
-
$
|
2613 |
-
|
2614 |
-
|
2615 |
-
$
|
2616 |
-
$vcalendar->
|
2617 |
-
$vcalendar->
|
2618 |
-
$events_arr = $vcalendar->selectComponents( 2007, 11, 1, 2007, 11, 30,
|
2619 |
-
kigkonsult\iCalcreator\util\util::$LCVEVENT );
|
2620 |
// <span class="comment">select all events occurring 1-30 nov. 2007</span>
|
2621 |
foreach( $events_arr as $year => $year_arr ) {
|
2622 |
-
|
2623 |
-
|
2624 |
-
|
2625 |
-
|
2626 |
<span class="comment">// if member of a recurrence set, returns
|
2627 |
// array(" x-current-dtstart",
|
2628 |
// <(string) date("Y-m-d [H:i:s][timezone/UTC offset]")>)</span>
|
2629 |
-
|
2630 |
-
|
2631 |
-
|
2632 |
-
|
2633 |
|
2634 |
</p>
|
2635 |
<a name="selectComponents2"></a>
|
2636 |
<p class="label">format 2</p>
|
2637 |
<p>
|
2638 |
-
Using this format, the
|
2639 |
</p>
|
2640 |
<dl>
|
2641 |
<dt>Supported Descriptive Component Properties
|
@@ -2666,7 +2772,7 @@ For the property <a href="#SUMMARY">SUMMARY</a>, if a search value (any case) ex
|
|
2666 |
For the other properties an exact (strict case) match is required. Multiple search properties may coexist.
|
2667 |
</p>
|
2668 |
<p>
|
2669 |
-
To retrieve specific
|
2670 |
use <a href="#getProperty2">getProperty</a> (Format 2).
|
2671 |
</p>
|
2672 |
<p>
|
@@ -2680,23 +2786,22 @@ propertyValue : (string) value / (array) ( *[ (string) value] )
|
|
2680 |
</p>
|
2681 |
<p class="label">Example</p>
|
2682 |
<p class="example">
|
2683 |
-
$
|
2684 |
-
|
2685 |
-
|
2686 |
-
$
|
2687 |
-
$vcalendar->
|
2688 |
-
$
|
2689 |
-
$searchArray = array( kigkonsult\iCalcreator\util\util::$PRIORITY => array( 1, 2, 3, 4 ));
|
2690 |
$highPrioArr = $vcalendar->selectComponents( $searchArray );
|
2691 |
// <span class="comment">select all components with PRIORITY set to high (1-4)</span>
|
2692 |
if( ! empty( $highPrioArr )) {
|
2693 |
-
|
2694 |
-
|
2695 |
-
|
2696 |
-
|
2697 |
-
|
2698 |
-
|
2699 |
-
|
2700 |
}
|
2701 |
exit;
|
2702 |
</p>
|
@@ -2705,8 +2810,8 @@ exit;
|
|
2705 |
|
2706 |
<a name="setComponent"></a><h4>3.1.3.6 setComponent</h4>
|
2707 |
<p>
|
2708 |
-
Replace or update component in the
|
2709 |
-
Also add a <strong>calendar</strong> component to the
|
2710 |
when <strong>calendar</strong> component is created with the procedural (<b>non</b>-factory) method,
|
2711 |
see example <a href="#vevent_constr">VEVENT</a>, format 2.
|
2712 |
</p>
|
@@ -2715,7 +2820,7 @@ see example <a href="#vevent_constr">VEVENT</a>, format 2.
|
|
2715 |
<p>Insert last in component chain.</p>
|
2716 |
<p class="format">vcalendar::setComponent( component )
|
2717 |
addComponent( component ) // <span class="comment">alias</span></p>
|
2718 |
-
<p class="comment">component = (object)
|
2719 |
<p class="comment">addComponent, may be removed in future versions.</p>
|
2720 |
<p class="label">format 2</p>
|
2721 |
<p>
|
@@ -2723,7 +2828,7 @@ Insert/replace component with order number (1st=1, 2nd=2).
|
|
2723 |
If replace and orderNumber is not found, component is inserted last in chain.
|
2724 |
</p>
|
2725 |
<p class="format">vcalendar::setComponent( component, orderNumber )</p>
|
2726 |
-
<p class="comment">component = (object)
|
2727 |
int = (int) order numder</p>
|
2728 |
<p class="label">format 3</p>
|
2729 |
<p>
|
@@ -2731,7 +2836,7 @@ Replace component with component type and 1st alt. component order number.
|
|
2731 |
If orderNumber is not found, component is inserted last in chain.
|
2732 |
</p>
|
2733 |
<p class="format">vcalendar::setComponent( component, componentType [, componentSuborderNo])</p>
|
2734 |
-
<p class="comment">component = (object)
|
2735 |
componentType = (string) component type
|
2736 |
componentSuborderNo = (int) component Suborder Number</p>
|
2737 |
<p class="label">format 4</p>
|
@@ -2741,51 +2846,63 @@ N.B <a href="#UID">UID</a> is NOT set for <a href="#VALARM">ALARM</a> / <a href=
|
|
2741 |
If <a href="#UID">UID</a> is not found, component is inserted last in chain.
|
2742 |
</p>
|
2743 |
<p class="format">vcalendar::setComponent( component, <a href="#UID">UID</a> )</p>
|
2744 |
-
<p class="comment">component = (object)
|
2745 |
<p class="label">Example</p>
|
2746 |
<p class="example">
|
2747 |
-
$
|
2748 |
-
|
2749 |
-
|
2750 |
-
$
|
2751 |
-
$vcalendar->parse();
|
2752 |
$vevent = vcalendar->getComponent( 1 ); // <span class="comment">fetch first EVENT</span>
|
2753 |
-
$vevent->setProperty(
|
2754 |
-
|
2755 |
-
|
|
|
2756 |
$vcalendar->setComponent( $vevent, 1 ); // <span class="comment">replace first component</span>
|
2757 |
|
2758 |
</p>
|
2759 |
<br>
|
2760 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_component_object_methods">[up]</a>
|
2761 |
|
2762 |
-
<a name="iCalcreator_calendar_methods"></a><h3>3.1.4
|
2763 |
|
2764 |
<a name="parse_merge"></a><h4>3.1.4.1 parse and merge</h4>
|
2765 |
<p>
|
2766 |
-
Parse iCal file(-s) or string/array <strong>calendar</strong> content into a single
|
2767 |
including multiple vcalendars (within a single ICS file) parse, e.g. Oracle Calendar exports.
|
2768 |
</p>
|
2769 |
<p>
|
2770 |
-
As
|
2771 |
-
|
2772 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2773 |
</p>
|
2774 |
<p>
|
2775 |
If missing, component property <a href="#UID">UID</a> is created when parsing.
|
2776 |
-
|
2777 |
</p>
|
2778 |
<p>
|
2779 |
Notice <a href="#date_restriction">date restriction</a>!
|
2780 |
</p>
|
2781 |
<p>
|
2782 |
If major parse error occurs (like file access error,
|
2783 |
-
invalid <strong>calendar</strong> file or <strong>calendar</strong> file without components), bool is returned.
|
2784 |
</p>
|
2785 |
<p>
|
2786 |
Minor errors like non-standard line-endings, initial and trailing empty lines
|
2787 |
-
|
2788 |
-
|
2789 |
</p>
|
2790 |
<p>
|
2791 |
Non-standard iCal properties (except the <a href="#X-PROPERTY_PROP">X-properties</a>) are ignored.
|
@@ -2796,66 +2913,86 @@ Non-standard iCal properties (except the <a href="#X-PROPERTY_PROP">X-properties
|
|
2796 |
ex. result from - file_get_contents( "filename")
|
2797 |
(array) calendarContent
|
2798 |
ex. result from - file( "filename", FILE_IGNORE_NEW_LINES )</p>
|
|
|
2799 |
<p class="label">parse example 1</p>
|
2800 |
<p class="example">
|
2801 |
-
$
|
2802 |
-
|
2803 |
-
|
2804 |
-
$
|
2805 |
-
$vcalendar->parse();
|
2806 |
|
2807 |
</p>
|
|
|
2808 |
<p class="label">parse example 2</p>
|
2809 |
<p class="example">
|
2810 |
-
$
|
2811 |
-
|
2812 |
-
|
2813 |
-
$
|
|
|
2814 |
|
2815 |
</p>
|
|
|
2816 |
<p class="label">parse example 3</p>
|
2817 |
<p class="example">
|
2818 |
-
$
|
2819 |
-
|
2820 |
-
|
2821 |
-
|
2822 |
-
$str =
|
2823 |
-
"BEGIN:VCALENDAR",
|
2824 |
-
"PRODID:-//kigkonsult.se//NONSGML kigkonsult.se iCalcreator 2.
|
2825 |
-
"VERSION:2.0",
|
2826 |
-
"BEGIN:VEVENT",
|
2827 |
-
"DTSTART:20101224T190000Z",
|
2828 |
-
"DTEND:20101224T200000Z",
|
2829 |
-
"DTSTAMP:20101020T103827Z",
|
2830 |
-
"UID:20101020T113827-1234GkdhFR@test.org",
|
2831 |
-
"DESCRIPTION:example",
|
2832 |
-
"END:VEVENT",
|
2833 |
-
"END:VCALENDAR"
|
|
|
2834 |
$vcalendar->parse( $str );
|
2835 |
|
2836 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2837 |
<p class="label">merge example</p>
|
2838 |
<p class="example">
|
2839 |
-
$
|
2840 |
-
|
2841 |
-
|
2842 |
|
2843 |
-
$
|
2844 |
-
$vcalendar->parse();
|
2845 |
|
2846 |
-
$
|
2847 |
-
$vcalendar->parse();
|
2848 |
|
2849 |
-
|
2850 |
-
|
2851 |
-
$vcalendar->
|
|
|
|
|
2852 |
|
2853 |
</p>
|
2854 |
<br>
|
2855 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_calendar_methods">[up]</a>
|
2856 |
|
2857 |
<a name="createCalendar"></a><h4>3.1.4.2 createCalendar</h4>
|
2858 |
-
Generate and return <strong>calendar</strong
|
2859 |
<p class="label">Format</p>
|
2860 |
<p class="format">vcalendar::createCalendar()</p>
|
2861 |
<p class="label">Example</p>
|
@@ -2869,7 +3006,7 @@ echo $str;
|
|
2869 |
|
2870 |
<a name="returnCalendar"></a><h4>3.1.4.3 returnCalendar</h4>
|
2871 |
<p>
|
2872 |
-
Redirect the
|
2873 |
Filename, addressed to browser, is automatically generated if missing or not set
|
2874 |
and the filename will look like it is set using<br>
|
2875 |
</p>
|
@@ -2877,6 +3014,9 @@ and the filename will look like it is set using<br>
|
|
2877 |
<p>
|
2878 |
The method do not stop PHP script (exit), returns (bool) true on success!
|
2879 |
</p>
|
|
|
|
|
|
|
2880 |
<p class="label">Format</p>
|
2881 |
<p class="format">vcalendar::returnCalendar( [ utf8Encode [, gzip [, cdType ]]] )</p>
|
2882 |
<p class="comment">utf8Encode = (bool) true: utf8 encoded output,
|
@@ -2888,39 +3028,48 @@ cdType = (bool) true: (default) Content-Disposition: attachment
|
|
2888 |
false: Content-Disposition: inline</p>
|
2889 |
<p class="label">Example 1</p>
|
2890 |
<p class="example">
|
2891 |
-
$config =
|
2892 |
-
|
2893 |
-
|
2894 |
-
|
2895 |
-
$
|
2896 |
-
|
2897 |
-
|
2898 |
-
|
2899 |
-
|
2900 |
-
|
2901 |
-
|
2902 |
-
|
2903 |
-
|
2904 |
-
|
2905 |
-
|
2906 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2907 |
|
2908 |
$vcalendar->returnCalendar();
|
2909 |
exit;
|
2910 |
</p>
|
2911 |
<p class="label">Example 2</p>
|
2912 |
<p class="example">
|
2913 |
-
$
|
2914 |
-
|
2915 |
-
|
2916 |
-
|
2917 |
-
$vcalendar->parse();
|
2918 |
$utf8Encode = true;
|
2919 |
if( isset( $_SERVER["HTTP_ACCEPT_ENCODING"] ) &&
|
2920 |
-
( false !== strpos( strtolower( $_SERVER["HTTP_ACCEPT_ENCODING"] ), "gzip" )))
|
2921 |
-
|
2922 |
-
|
2923 |
-
|
|
|
|
|
2924 |
$vcalendar->returnCalendar( $utf8Encode, $gzip );
|
2925 |
exit;
|
2926 |
</p>
|
@@ -2929,23 +3078,28 @@ exit;
|
|
2929 |
|
2930 |
<a name="saveCalendar"></a><h4>3.1.4.4 saveCalendar</h4>
|
2931 |
<p>
|
2932 |
-
Save the
|
2933 |
using preset <a href="#Directory">directory</a> and <a href="#Filename">filename</a>.
|
2934 |
Filename is automatically generated if missing or not set
|
2935 |
and the filename will look like it is set using<br>
|
2936 |
</p>
|
2937 |
<p class="example">$filename = date( "YmdHis" ).".ics"</p>
|
2938 |
-
|
2939 |
<p>Return bool true on success, on error false.</p>
|
|
|
|
|
|
|
2940 |
<p class="label">Format</p>
|
2941 |
<p class="format">vcalendar::saveCalendar()</p>
|
2942 |
<p class="label">Example</p>
|
2943 |
<p class="example">
|
2944 |
-
$vcalendar->setConfig(
|
2945 |
-
|
|
|
|
|
2946 |
if( false === $vcalendar->saveCalendar()) {
|
2947 |
-
|
2948 |
-
|
2949 |
</p>
|
2950 |
<br>
|
2951 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_calendar_methods">[up]</a>
|
@@ -2955,7 +3109,7 @@ if( false === $vcalendar->saveCalendar()) {
|
|
2955 |
<p>
|
2956 |
Sort created/parsed <strong>calendar</strong> components on the following (prioritized) keys:<br>
|
2957 |
1 - X-CURRENT-DTSTART - X-CURRENT-DTEND/X-CURRENT-DUE<br>
|
2958 |
-
(if created in
|
2959 |
1 - <a href="#DTSTART">DTSTART</a> - <a href="#DTEND">DTEND</a> alt. <a href="#DURATION">DURATION</a> (<a href="#VEVENT">VEVENT</a> and <a href="#VFREEBUSY">VFREEBUSY</a> components)<br>
|
2960 |
1 - <a href="#DTSTART">DTSTART</a> - <a href="#DUE">DUE</a> alt. <a href="#DURATION">DURATION</a> (<a href="#VTODO">VTODO</a> components)<br>
|
2961 |
1 - <a href="#DTSTART">DTSTART</a> (<a href="#VJOURNAL">VJOURNAL</a> components)<br>
|
@@ -2964,7 +3118,7 @@ Sort created/parsed <strong>calendar</strong> components on the following (prior
|
|
2964 |
A date value, like "DTSTART;VALUE=DATE:20120717", are sorted before a datetime value.<br>
|
2965 |
<a href="#VTIMEZONE">VTIMEZONE</a> component(-s) is always placed first (ordered by <a href="#TZID">TZID</a>). The
|
2966 |
<a href="#VTIMEZONE">STANDARD</a> / <a href="#VTIMEZONE">DAYLIGHT</a> sub-components are sorted (on asc. key <a href="#DTSTART">DTSTART</a>) when calling
|
2967 |
-
<a href="#createCalendar">createCalendar</a> (or <a href="#
|
2968 |
<br>
|
2969 |
<a href="#VALARM">ALARM</a> sub-components, if exists, are not sorted.
|
2970 |
|
@@ -2972,11 +3126,11 @@ A date value, like "DTSTART;VALUE=DATE:20120717", are sorted before a
|
|
2972 |
<p class="format">vcalendar::sort()</p>
|
2973 |
<p class="label">Example</p>
|
2974 |
<p class="example">
|
2975 |
-
$
|
2976 |
-
|
2977 |
-
|
2978 |
-
|
2979 |
-
$vcalendar->parse();
|
2980 |
$vcalendar->sort();
|
2981 |
$vcalendar->returnCalendar();
|
2982 |
exit;
|
@@ -3007,6 +3161,9 @@ If a recent version of (non-empty and saved) <strong>calendar</strong> file exis
|
|
3007 |
<p>
|
3008 |
NOTE, the method no longer stops PHP script (exit), returns bool true on success, false on error!
|
3009 |
</p>
|
|
|
|
|
|
|
3010 |
<p class="label">Format</p>
|
3011 |
<p class="format">vcalendar::useCachedCalendar( [ timeout [, cdType ]] )</p>
|
3012 |
<p class="comment">timeout = (int) default 3600 sec
|
@@ -3014,8 +3171,8 @@ cdType = (bool) true: (default) Content-Disposition: attachment
|
|
3014 |
false: Content-Disposition: inline</p>
|
3015 |
<p class="label">Example</p>
|
3016 |
<p class="example">
|
3017 |
-
$vcalendar->setConfig(
|
3018 |
-
$vcalendar->setConfig(
|
3019 |
$vcalendar->useCachedCalendar();
|
3020 |
|
3021 |
</p>
|
@@ -3025,7 +3182,7 @@ $vcalendar->useCachedCalendar();
|
|
3025 |
|
3026 |
<a name="iCalcreatorVersion"></a><h4>3.1.4.7 iCalcreatorVersion</h4>
|
3027 |
<p>
|
3028 |
-
This static class method returns the iCalcreator class version number
|
3029 |
</p>
|
3030 |
<p>
|
3031 |
There is also a <em>PHP</em> constant "ICALCREATOR_VERSION" (all versions).
|
@@ -3038,7 +3195,7 @@ There is also a <em>PHP</em> constant "ICALCREATOR_VERSION" (all versi
|
|
3038 |
|
3039 |
|
3040 |
|
3041 |
-
<a name="iCalcreator_configuration_methods"></a><h3>3.1.5
|
3042 |
|
3043 |
<a name="configKeys"></a><h4>3.1.5.1 configuration keys</h4>
|
3044 |
<p>
|
@@ -3065,31 +3222,31 @@ as well as some (most) property parameter keys.
|
|
3065 |
<td class="bl bb ref">getConfig only</td>
|
3066 |
</tr>
|
3067 |
<tr>
|
3068 |
-
<td class="bl bb"><a class="ref" href="#Delimiter">Delimiter</a></td>
|
3069 |
<td class="bl bb center">*</td>
|
3070 |
<td class="bl bb"> </td>
|
3071 |
<td class="bl bb ref"> </td>
|
3072 |
</tr>
|
3073 |
<tr>
|
3074 |
-
<td class="bl bb"><a class="ref" href="#Directory">Directory</a></td>
|
3075 |
<td class="bl bb center">*</td>
|
3076 |
<td class="bl bb"> </td>
|
3077 |
<td class="bl bb ref"> </td>
|
3078 |
</tr>
|
3079 |
<tr>
|
3080 |
-
<td class="bl bb"><a class="ref" href="#Filename">Filename</a></td>
|
3081 |
<td class="bl bb center">*</td>
|
3082 |
<td class="bl bb"> </td>
|
3083 |
<td class="bl bb ref"> </td>
|
3084 |
</tr>
|
3085 |
<tr>
|
3086 |
-
<td class="bl bb"><a class="ref" href="#Dirfile">Dirfile</a></td>
|
3087 |
<td class="bl bb center">*</td>
|
3088 |
<td class="bl bb"> </td>
|
3089 |
<td class="bl bb ref">getConfig only</td>
|
3090 |
</tr>
|
3091 |
<tr>
|
3092 |
-
<td class="bl bb"><a class="ref" href="#Filesize">Filesize</a></td>
|
3093 |
<td class="bl bb center">*</td>
|
3094 |
<td class="bl bb"> </td>
|
3095 |
<td class="bl bb ref">getConfig only</td>
|
@@ -3119,12 +3276,16 @@ as well as some (most) property parameter keys.
|
|
3119 |
<td class="bl bb ref"> </td>
|
3120 |
</tr>
|
3121 |
<tr>
|
3122 |
-
<td class="bl bb"><a class="ref" href="#configURL">URL</a></td>
|
3123 |
<td class="bl bb center">*</td>
|
3124 |
<td class="bl bb"> </td>
|
3125 |
<td class="bl bb ref"> </td>
|
3126 |
</tr>
|
3127 |
</table>
|
|
|
|
|
|
|
|
|
3128 |
<br>
|
3129 |
<br>
|
3130 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_configuration_methods">[up]</a>
|
@@ -3134,11 +3295,8 @@ as well as some (most) property parameter keys.
|
|
3134 |
<p class="comment">key = (string) config key</p>
|
3135 |
<p class="label">Example 1</p>
|
3136 |
<p class="example">
|
3137 |
-
$
|
3138 |
|
3139 |
-
</p>
|
3140 |
-
In this example, notice <a href="#Filename">Filename</a>
|
3141 |
-
<br>
|
3142 |
<p class="label">Example 2</p>
|
3143 |
<p class="example">
|
3144 |
$config = $vcalendar->getConfig();
|
@@ -3151,15 +3309,15 @@ $config = $vcalendar->getConfig();
|
|
3151 |
|
3152 |
<a name="initConfig"></a><h4>3.1.5.3 calendar/component initialization</h4>
|
3153 |
<p class="label">Format</p>
|
3154 |
-
<p>Create a new
|
3155 |
<p class="format">vcalendar::vcalendar( [ config ] )</p>
|
3156 |
<p class="comment">config = (array) ( *[, key => value] )
|
3157 |
key = (string) config key
|
3158 |
value = (mixed) config value</p>
|
3159 |
<p class="label">Example 1</p>
|
3160 |
<p class="example">
|
3161 |
-
$config =
|
3162 |
-
$vcalendar = new
|
3163 |
|
3164 |
</p>
|
3165 |
<p>
|
@@ -3173,14 +3331,14 @@ key = (string) config key
|
|
3173 |
value = (mixed) config value</p>
|
3174 |
<p class="label">Example 2</p>
|
3175 |
<p class="example">
|
3176 |
-
$config =
|
3177 |
-
$vevent = new
|
3178 |
|
3179 |
</p>
|
3180 |
<p class="label">Example 3</p>
|
3181 |
<p class="example">
|
3182 |
$config = $vcalendar->getConfig();
|
3183 |
-
$vevent = new
|
3184 |
|
3185 |
</p>
|
3186 |
<p>Only component relevant configuration are set. If using the <a href="#newComponent">newComponent</a> method, configuration is set automatically.</p>
|
@@ -3197,34 +3355,34 @@ key = (string) config key
|
|
3197 |
value = (mixed) config value</p>
|
3198 |
<p class="label">Example 1</p>
|
3199 |
<p class="example">
|
3200 |
-
$config =
|
3201 |
-
|
3202 |
-
|
3203 |
-
$vcalendar = new
|
3204 |
$vcalendar->setConfig( $config );
|
3205 |
|
3206 |
</p>
|
3207 |
-
<p class="label">Example 2</p>
|
3208 |
-
<p class="example">
|
3209 |
-
$config = array( kigkonsult\iCalcreator\util\util::$UNIQUE_ID => "kigkonsult.se" );
|
3210 |
-
$vevent = new kigkonsult\iCalcreator\vevent();
|
3211 |
-
$vevent->setConfig( $config );
|
3212 |
|
3213 |
-
</p>
|
3214 |
<p class="label">Format 2</p>
|
3215 |
<p class="format">vcalendar::setConfig( key, value )</p>
|
3216 |
<p class="comment">key = (string) config key
|
3217 |
value = (mixed) config value</p>
|
3218 |
<p class="label">Example 1</p>
|
3219 |
<p class="example">
|
3220 |
-
$vcalendar = new
|
3221 |
-
$vcalendar->setConfig(
|
|
|
|
|
|
|
3222 |
|
3223 |
</p>
|
3224 |
<p class="label">Example 2</p>
|
3225 |
<p class="example">
|
3226 |
-
$vevent = new
|
3227 |
-
$vevent->setConfig(
|
|
|
|
|
|
|
3228 |
|
3229 |
</p>
|
3230 |
<br>
|
@@ -3232,7 +3390,7 @@ $vevent->setConfig( kigkonsult\iCalcreator\util\util::$UNIQUE_ID, "kigko
|
|
3232 |
|
3233 |
<a name="allowEmpty"></a><h4>3.1.5.5 Allow empty components</h4>
|
3234 |
<p>
|
3235 |
-
Allow or reject empty <strong>calendar</strong> properties. Used in <a href="#createCalendar">createCalendar</a>, <a href="#
|
3236 |
create<Property> methods, creating [RFC5545] formats.
|
3237 |
</p>
|
3238 |
<p>
|
@@ -3243,10 +3401,10 @@ Default true (allow).
|
|
3243 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_configuration_methods">[up]</a>
|
3244 |
|
3245 |
<a name="Compsinfo"></a><h4>3.1.5.6 Component information</h4>
|
3246 |
-
<p>Only to use with
|
3247 |
<p>
|
3248 |
-
Get information about the
|
3249 |
-
about all components (in array format) within the
|
3250 |
</p>
|
3251 |
<p class="comment">Output = array ( *compinfo )
|
3252 |
compinfo = array ( "ordno" => int ordno,
|
@@ -3262,26 +3420,25 @@ compinfo = array ( "ordno" => int ordno,
|
|
3262 |
// <span class="comment">if subcomponents exists, an array for each subcomponent</span></p>
|
3263 |
<p class="label">Example</p>
|
3264 |
<p class="example">
|
3265 |
-
$
|
3266 |
-
|
3267 |
-
|
3268 |
-
$
|
3269 |
-
$vcalendar->
|
3270 |
-
$vcalendar->
|
3271 |
-
$compsinfo = $vcalendar->getConfig( kigkonsult\iCalcreator\util\util::$COMPSINFO );
|
3272 |
foreach( $compsinfo as compinfo) {
|
3273 |
-
|
3274 |
-
|
3275 |
-
|
3276 |
-
|
3277 |
-
|
3278 |
-
|
3279 |
-
|
3280 |
-
|
3281 |
-
|
3282 |
-
|
3283 |
-
|
3284 |
-
}
|
3285 |
|
3286 |
</p>
|
3287 |
<br>
|
@@ -3292,6 +3449,11 @@ foreach( $compsinfo as compinfo) {
|
|
3292 |
<p>
|
3293 |
Default <em>PHP</em> constant DIRECTORY_SEPARATOR. If used, <b>must</b> be set BEFORE filename!
|
3294 |
</p>
|
|
|
|
|
|
|
|
|
|
|
3295 |
<br>
|
3296 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_configuration_methods">[up]</a>
|
3297 |
|
@@ -3308,13 +3470,18 @@ If set using an config array and together with <a name="Filename"><u>Filename</u
|
|
3308 |
When setting directory, the <em>PHP</em> realpath function is applied to speed up parse/saveCalendar methods.
|
3309 |
When setting Directory, any previously set <a href="#configURL">URL</a> is removed.
|
3310 |
</p>
|
|
|
|
|
|
|
|
|
|
|
3311 |
<p class="label">Example</p>
|
3312 |
<p class="example">
|
3313 |
$dir = 'test';
|
3314 |
-
$config =
|
3315 |
-
if( false === $vcalendar->setConfig( $config ))
|
3316 |
-
|
3317 |
-
|
3318 |
</p>
|
3319 |
<p>
|
3320 |
For temporary calendar files, you may set directory/<a href="#Filename">filename</a> using <em>PHP</em> functions sys_get_temp_dir() and tempnam().
|
@@ -3328,19 +3495,29 @@ due to inability to detect error (bool false) config return.
|
|
3328 |
|
3329 |
<a name="Dirfile"></a><h4>3.1.5.9 Dirfile</h4>
|
3330 |
<p>
|
3331 |
-
Only available in
|
|
|
|
|
|
|
|
|
|
|
3332 |
</p>
|
3333 |
<br>
|
3334 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_configuration_methods">[up]</a>
|
3335 |
|
3336 |
<a name="Fileinfo"></a><h4>3.1.5.10 Fileinfo</h4>
|
3337 |
<p>
|
3338 |
-
Only available in
|
3339 |
<a href="#Filename">filename</a> and <a href="#Filesize">filesize</a>.
|
3340 |
</p>
|
|
|
|
|
|
|
|
|
|
|
3341 |
<p class="label">Example</p>
|
3342 |
<p class="example">
|
3343 |
-
$fileinfo = $vcalendar->getConfig(
|
3344 |
|
3345 |
</p>
|
3346 |
<p class="comment">output = array( <directory>, <filename>, <filesize> )</p>
|
@@ -3352,29 +3529,35 @@ $fileinfo = $vcalendar->getConfig( kigkonsult\iCalcreator\util\util::$FILEINF
|
|
3352 |
<p class="example">$filename = date( "YmdHis" ).".ics";</p>
|
3353 |
|
3354 |
<p>
|
3355 |
-
If not set, filename is created when requested, ex. in
|
3356 |
</p>
|
3357 |
<p>
|
3358 |
Local filename <b>must</b> be set AFTER setting directory (and opt. delimiter)!
|
3359 |
Filename (and opt. directory) <b>must</b> be readable/writeable otherwise bool false is returned.
|
3360 |
</p>
|
|
|
|
|
|
|
|
|
|
|
3361 |
<p class="label">Example</p>
|
3362 |
<p class="example">
|
3363 |
$dir = 'test';
|
3364 |
-
$config =
|
3365 |
-
if( false === $vcalendar->setConfig( $config ))
|
3366 |
-
|
|
|
3367 |
$file = 'temp.ics';
|
3368 |
-
$config =
|
3369 |
-
if( false === $vcalendar->setConfig( $config ))
|
3370 |
-
|
3371 |
-
|
3372 |
</p>
|
3373 |
<p>
|
3374 |
-
For temporary calendar files, you may set <a href="#Directory">directory</a
|
3375 |
</p>
|
3376 |
<p>
|
3377 |
-
Do <b>NOT</b> set <a href="#Directory">directory</a
|
3378 |
due to inability to detect error (bool false) config return.
|
3379 |
</p>
|
3380 |
<br>
|
@@ -3382,19 +3565,24 @@ due to inability to detect error (bool false) config return.
|
|
3382 |
|
3383 |
<a name="Filesize"></a><h4>3.1.5.12 Filesize</h4>
|
3384 |
<p>
|
3385 |
-
Only when getting configuration (using
|
3386 |
Returns the size of the file in bytes, to be invoked<br>
|
3387 |
- after "saveCalendar()"<br>
|
3388 |
or<br>
|
3389 |
- after a "setConfig( "directory" / "filename" )" and before/after "parse()".<br>
|
3390 |
Getting the filesize for a remote file (URL) will always return zero.
|
3391 |
</p>
|
|
|
|
|
|
|
|
|
|
|
3392 |
<br>
|
3393 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_configuration_methods">[up]</a>
|
3394 |
|
3395 |
<a name="Language"></a><h4>3.1.5.13 Language</h4>
|
3396 |
<p>
|
3397 |
-
Language for the
|
3398 |
</p>
|
3399 |
<p>
|
3400 |
Default empty.
|
@@ -3428,7 +3616,7 @@ Default empty.
|
|
3428 |
<p>
|
3429 |
Note, some <strong>calendar</strong> software may also require calendar property <a href="#Additional_Descriptors">X-WR-TIMEZONE</a>
|
3430 |
and vtimezone component property <a href="#Additional_Descriptors">X-LIC-LOCATION</a>
|
3431 |
-
(to be set manually, examine also the <a href="#createTimezone">createTimezone</a> a
|
3432 |
</p>
|
3433 |
<br>
|
3434 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_configuration_methods">[up]</a>
|
@@ -3451,10 +3639,10 @@ Used when setting other (domain) name than server name.
|
|
3451 |
The <strong>calendar</strong> property PRODID is always recreated when setting unique_id.
|
3452 |
</p>
|
3453 |
<p>
|
3454 |
-
If missing, the component property <a href="#UID">UID</a> is created at first use of
|
3455 |
</p>
|
3456 |
<p>
|
3457 |
-
A strong recommendation is <b>always</b> to set unique_id, creating a new
|
3458 |
to ensure accurate creation of all components <a href="#UID">UID</a> property, also before <a href="#parse">parse</a>, in case of missing <a href="#UID">UID</a>.
|
3459 |
</p>
|
3460 |
<br>
|
@@ -3477,32 +3665,38 @@ The URL remote file <u>file</u> part can be retrieved by the vcalendar method<br
|
|
3477 |
getConfig( "filename" ).
|
3478 |
When using a resource, filename is unset (note <a href="#Filename">filename</a>, above).
|
3479 |
</p>
|
|
|
|
|
|
|
|
|
|
|
3480 |
<p class="label">Example</p>
|
3481 |
<p>Parse of remote file, then local save in "depot" folder, using original filename</p>
|
3482 |
<p class="example">
|
3483 |
-
$
|
3484 |
-
|
3485 |
-
|
3486 |
-
|
|
|
|
|
3487 |
$vcalendar->parse();
|
3488 |
$vcalendar->sort();
|
3489 |
|
3490 |
-
|
3491 |
-
$vcalendar->setConfig( kigkonsult\iCalcreator\util\util::$DIRECTORY, "depot" );
|
3492 |
$vcalendar->saveCalendar();
|
3493 |
|
3494 |
</p>
|
3495 |
<br>
|
3496 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_configuration_methods">[up]</a>
|
3497 |
|
3498 |
-
<a name="Calendar_component_object_property_function_list"></a><h2>3.2
|
3499 |
<p>
|
3500 |
All iCalcreator component object property methods for get/set data.<br>
|
3501 |
For property format in detail, see
|
3502 |
-
<a href="
|
3503 |
</p>
|
3504 |
<a name="DATE_WITH_UTC_TIME"></a>
|
3505 |
-
<span class="label">Notice:</span> for properties and VALUE=DATE-TIME
|
3506 |
<p class="quotes">RFC2445:
|
3507 |
The date with UTC time, or absolute time,
|
3508 |
is identified by a LATIN CAPITAL LETTER Z suffix character (US-ASCII decimal 90),
|
@@ -3511,7 +3705,7 @@ For example, the following represents January 19, 1998, at 0700 UTC:
|
|
3511 |
</p>
|
3512 |
<p class="quotes">DTSTART:19980119T070000Z</p>
|
3513 |
<p class="quotes">The <a href="#TZID">TZID</a> property parameter MUST <b>NOT</b> be applied to DATE-TIME properties
|
3514 |
-
whose time values are specified in UTC.
|
3515 |
</p>
|
3516 |
<p>
|
3517 |
<a name="date_restriction"></a>
|
@@ -3521,7 +3715,7 @@ before 1970 or after GMT may force a <em>PHP</em> date function to generate an e
|
|
3521 |
Timezones need to be PHP complient!
|
3522 |
</p>
|
3523 |
<a name="deleteProperty_PROP"></a><h3>3.2.1 deleteProperty</h3>
|
3524 |
-
Generic
|
3525 |
Bool false is returned if no property exists or when end-of-properties at consecutive function calls.
|
3526 |
<p class="label">Format</p>
|
3527 |
<p class="format">calendarComponent::deleteProperty( [ PropName [, order ] )</p>
|
@@ -3532,16 +3726,15 @@ order = (int) if missing 1st/next occurrence,
|
|
3532 |
<p class="label">Example</p>
|
3533 |
<p>Remove all COMMENT properties in first event component.</p>
|
3534 |
<p class="example">
|
3535 |
-
$
|
3536 |
-
|
3537 |
-
|
3538 |
-
$
|
3539 |
-
$vcalendar->
|
3540 |
-
$vcalendar->
|
3541 |
-
$event
|
3542 |
-
|
3543 |
-
|
3544 |
-
|
3545 |
</p>
|
3546 |
<br>
|
3547 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_component_object_property_function_list">[up]</a>
|
@@ -3567,25 +3760,24 @@ complete - (bool) false (default): output only property value
|
|
3567 |
,"params"=> <parameter array>)</p>
|
3568 |
<p class="label">Example</p>
|
3569 |
<p class="example">
|
3570 |
-
$
|
3571 |
-
|
3572 |
-
|
3573 |
-
$
|
3574 |
-
$vcalendar->
|
3575 |
-
$vcalendar->
|
3576 |
-
|
3577 |
-
$dtstart = $vevent->getProperty( kigkonsult\iCalcreator\util\util::$DTSTART );
|
3578 |
// <span class="comment">one occurrence</span>
|
3579 |
-
|
3580 |
-
|
3581 |
-
|
3582 |
-
|
3583 |
}
|
3584 |
|
3585 |
</p>
|
3586 |
<p>
|
3587 |
-
To get
|
3588 |
-
|
3589 |
<br>
|
3590 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_component_object_property_function_list">[up]</a>
|
3591 |
|
@@ -3618,15 +3810,16 @@ Except the <a href="#X-PROPERTY_PROP">X-properties</a>, non-standard properties
|
|
3618 |
property name <b>must</b> start string / rows(-s)</p>
|
3619 |
<p class="label">example</p>
|
3620 |
<p class="example">
|
3621 |
-
$e = $vcalendar->newComponent(
|
3622 |
$e->parse( "DTSTAMP:19970324T1200Z" );
|
3623 |
$e->parse( "SEQUENCE:0" );
|
3624 |
$e->parse( "ORGANIZER:MAILTO:jdoe@host1.com" );
|
3625 |
-
$e->parse(
|
3626 |
-
"ATTENDEE;RSVP=TRUE:MAILTO:jsmith@host1.com",
|
3627 |
-
"ATTENDEE;RSVP=TRUE:MAILTO:jsmith@host2.com",
|
3628 |
-
"ATTENDEE;RSVP=TRUE:MAILTO:jsmith@host3.com",
|
3629 |
-
"ATTENDEE;RSVP=TRUE:MAILTO:jsmith@host4.com"
|
|
|
3630 |
$e->parse( "DTSTART:19970324T123000Z" );
|
3631 |
$e->parse( "DTEND:19970324T210000Z" );
|
3632 |
$e->parse( "CATEGORIES:MEETING,PROJECT" );
|
@@ -3648,14 +3841,16 @@ $e->parse( "DESCRIPTION:Project xyz Review Meeting Minutes\\n "
|
|
3648 |
. "- Next weeks meeting is cancelled. No meeting until 3/23." );
|
3649 |
$e->parse( "LOCATION:LDB Lobby" );
|
3650 |
$e->parse( "ATTACH;FMTTYPE=application/postscript:ftp://xyz.com/pub/conf/bkgrnd.ps" );
|
3651 |
-
$e->parse(
|
3652 |
-
|
3653 |
-
|
3654 |
-
|
3655 |
-
|
3656 |
-
|
3657 |
-
|
3658 |
-
|
|
|
|
|
3659 |
$e->parse( "X-xomment:non-standard property will be displayed, comma escaped");
|
3660 |
|
3661 |
</p>
|
@@ -3683,18 +3878,23 @@ Proparg_n = (mixed) property content
|
|
3683 |
</p>
|
3684 |
<p class="label">Example</p>
|
3685 |
<p class="example">
|
3686 |
-
$vevent = $vcalendar->newComponent(
|
3687 |
-
$vevent->setProperty(
|
3688 |
-
|
3689 |
-
|
3690 |
-
|
3691 |
-
|
3692 |
-
|
3693 |
-
|
3694 |
-
|
3695 |
-
|
3696 |
-
|
3697 |
-
|
|
|
|
|
|
|
|
|
|
|
3698 |
|
3699 |
</p>
|
3700 |
<br>
|
@@ -3708,7 +3908,7 @@ This property defines the action to be invoked when an <a href="#VALARM">VALARM<
|
|
3708 |
This property is REQUIRED and MUST NOT occur more than once. ("PROCEDURE" is deprecated in [RFC5545].)
|
3709 |
</p>
|
3710 |
<p>
|
3711 |
-
To ease up usage,
|
3712 |
</p>
|
3713 |
<h5>Create ACTION</h5>
|
3714 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -3725,7 +3925,7 @@ $str = $component->createAction();
|
|
3725 |
<p class="format">calendarComponent::deleteProperty( "Action" )</p>
|
3726 |
<p class="label">Example</p>
|
3727 |
<p class="example">
|
3728 |
-
$valarm->deleteProperty(
|
3729 |
|
3730 |
</p>
|
3731 |
<h5>Get ACTION</h5>
|
@@ -3739,11 +3939,11 @@ $valarm->deleteProperty( kigkonsult\iCalcreator\util\util::$ACTION );
|
|
3739 |
, "params" => xparams<sup>2</sup> )</p>
|
3740 |
<p class="label">Example</p>
|
3741 |
<p class="example">
|
3742 |
-
$action = $valarm->getProperty(
|
3743 |
|
3744 |
</p>
|
3745 |
<h5>Set ACTION</h5>
|
3746 |
-
<p>
|
3747 |
<p class="label">Format</p>
|
3748 |
<p class="format">calendarComponent::setProperty( "Action", actionValue [, xparams ] )</p>
|
3749 |
<p class="comment">actionValue<sup>1</sup> = (string) one of "AUDIO" / "DISPLAY" / "EMAIL" / "PROCEDURE"
|
@@ -3751,8 +3951,7 @@ xparams<sup>2</sup> = (array) ( *[ (string) key => (string) value ] ) //
|
|
3751 |
</p>
|
3752 |
<p class="label">Example</p>
|
3753 |
<p class="example">
|
3754 |
-
$valarm->setProperty(
|
3755 |
-
"DISPLAY" );
|
3756 |
|
3757 |
</p>
|
3758 |
<br>
|
@@ -3776,7 +3975,7 @@ please use only characters within the ASCII character set in parameter name and
|
|
3776 |
to ensure proper line folding when using <a href="#createCalendar">createCalendar</a> and/or <a href="#returnCalendar">returnCalendar</a>.
|
3777 |
</p>
|
3778 |
<p>
|
3779 |
-
To ease up usage,
|
3780 |
</p>
|
3781 |
<h5>Create ATTACH</h5>
|
3782 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -3793,21 +3992,21 @@ $str = $component->createAttach();
|
|
3793 |
<p class="format">calendarComponent::deleteProperty( "ATTACH" )</p>
|
3794 |
<p class="label">Example 1</p>
|
3795 |
<p class="example">
|
3796 |
-
$valarm->deleteProperty(
|
3797 |
|
3798 |
</p>
|
3799 |
<p class="label">Example 2</p>
|
3800 |
Delete ATTACH property no 2.
|
3801 |
<p class="example">
|
3802 |
-
$valarm->deleteProperty(
|
3803 |
|
3804 |
</p>
|
3805 |
<p class="label">Example 3</p>
|
3806 |
Deleting all ATTACH properties.
|
3807 |
<p class="example">
|
3808 |
-
while( $valarm->deleteProperty(
|
3809 |
-
|
3810 |
-
|
3811 |
</p>
|
3812 |
<h5>Get ATTACH</h5>
|
3813 |
<p>If set, returns property value(-s), otherwise bool false.</p>
|
@@ -3825,11 +4024,11 @@ while( $valarm->deleteProperty( kigkonsult\iCalcreator\util\util::$ATTACH ))
|
|
3825 |
<p class="comment">Get propOrderNo ATTACH</p>
|
3826 |
<p class="label">Example</p>
|
3827 |
<p class="example">
|
3828 |
-
$attach = $valarm->getProperty(
|
3829 |
|
3830 |
</p>
|
3831 |
<h5>Set ATTACH</h5>
|
3832 |
-
<p>
|
3833 |
<p class="label">Format</p>
|
3834 |
<p class="format">calendarComponent::setProperty( "attach", attachValue<sup>1</sup> [, params [, propOrderNo ]] )</p>
|
3835 |
<p class="comment">attachValue<sup>1</sup> = (string) URI / inline binary encoded content
|
@@ -3843,9 +4042,11 @@ propOrderNo = (int) order number // <span class="comment">1=1st, 2=
|
|
3843 |
</p>
|
3844 |
<p class="label">Example</p>
|
3845 |
<p class="example">
|
3846 |
-
$vevent->setProperty(
|
3847 |
-
|
3848 |
-
|
|
|
|
|
3849 |
|
3850 |
</p>
|
3851 |
<br>
|
@@ -3861,7 +4062,7 @@ in a VALARM ("ACTION" "email"), OPTIONAL and MAY occur more
|
|
3861 |
<p>You can <a href="#sort2">SORT</a> <strong>calendar</strong> (components) on (asc) ATTENDEE values.</p>
|
3862 |
<p>You can export <strong>calendar</strong> ATTENDEE values as <a href="#iCal2vCards">vCards</a>.
|
3863 |
<p>
|
3864 |
-
To ease up usage,
|
3865 |
</p>
|
3866 |
<h5>Create ATTENDEE</h5>
|
3867 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -3879,21 +4080,21 @@ $str = $component->createAttendee();
|
|
3879 |
<p class="label">Example 1</p>
|
3880 |
<p>Delete (single/first) ATTENDEE property</p>
|
3881 |
<p class="example">
|
3882 |
-
$valarm->deleteProperty(
|
3883 |
|
3884 |
</p>
|
3885 |
<p class="label">Example 2</p>
|
3886 |
<p>Delete ATTENDEE property no 2.</p>
|
3887 |
<p class="example">
|
3888 |
-
$valarm->deleteProperty(
|
3889 |
|
3890 |
</p>
|
3891 |
<p class="label">Example 3</p>
|
3892 |
Deleting all ATTENDEE properties.
|
3893 |
<p class="example">
|
3894 |
-
while( $valarm->deleteProperty(
|
3895 |
-
|
3896 |
-
|
3897 |
</p>
|
3898 |
<h5>Get ATTENDEE</h5>
|
3899 |
<p>If set, returns property value(-s), otherwise bool false.</p>
|
@@ -3911,12 +4112,12 @@ while( $valarm->deleteProperty( kigkonsult\iCalcreator\util\util::$ATTENDEE )
|
|
3911 |
<p class="comment">output = attendeeValue<sup>1</sup></p>
|
3912 |
<p class="label">Example</p>
|
3913 |
<p class="example">
|
3914 |
-
$attendee = $valarm->getProperty(
|
3915 |
|
3916 |
</p>
|
3917 |
<h5>Set ATTENDEE</h5>
|
3918 |
<p>
|
3919 |
-
|
3920 |
Property value must be prefixed by protocol (ftp://, http://,mailto:, file:// ref. rfc 1738 ),
|
3921 |
if missing, "mailto:" is set (indicating an internet mail address).
|
3922 |
Also MEMBER and DIR parameters must be prefixed by protocol. DELEGATED-TO, DELEGATED-FROM, SENT-BY parameters
|
@@ -4024,33 +4225,41 @@ xparams = (string) key => (string) value // <span class="comment">key
|
|
4024 |
propOrderNo = (int) order number // <span class="comment">1=1st, 2=2nd etc</span>
|
4025 |
lang<sup>*</sup> = as defined in [RFC5546]</p>
|
4026 |
<p>
|
4027 |
-
See rules in detail in <a href="
|
4028 |
</p>
|
4029 |
<p class="label">Example</p>
|
4030 |
<p class="example">
|
4031 |
-
$vevent->setProperty(
|
4032 |
-
|
4033 |
-
|
4034 |
-
|
4035 |
-
|
4036 |
-
|
4037 |
-
|
4038 |
-
|
4039 |
-
|
4040 |
-
|
4041 |
-
|
4042 |
-
|
4043 |
-
|
4044 |
-
|
4045 |
-
|
4046 |
-
|
4047 |
-
|
4048 |
-
|
4049 |
-
|
4050 |
-
|
4051 |
-
|
4052 |
-
|
4053 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4054 |
</p>
|
4055 |
<br>
|
4056 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_component_object_property_function_list">[up]</a>
|
@@ -4064,7 +4273,7 @@ The value type for CATEGORIES is TEXT.
|
|
4064 |
</p>
|
4065 |
<p>You can <a href="#sort2">SORT</a> <strong>calendar</strong> (components) on (asc) CATEGORIES values.</p>
|
4066 |
<p>
|
4067 |
-
To ease up usage,
|
4068 |
</p>
|
4069 |
|
4070 |
<h5>Create CATEGORIES</h5>
|
@@ -4083,21 +4292,21 @@ $str = $component->createCategories();
|
|
4083 |
<p class="label">Example 1</p>
|
4084 |
<p>Delete (single/first) CATEGORIES property</p>
|
4085 |
<p class="example">
|
4086 |
-
$vevent->deleteProperty(
|
4087 |
|
4088 |
</p>
|
4089 |
<p class="label">Example 2</p>
|
4090 |
<p>Delete CATEGORIES property no 2.</p>
|
4091 |
<p class="example">
|
4092 |
-
$vevent->deleteProperty(
|
4093 |
|
4094 |
</p>
|
4095 |
<p class="label">Example 3</p>
|
4096 |
<p>Deleting all CATEGORIES properties.</p>
|
4097 |
<p class="example">
|
4098 |
-
while( $vevent->deleteProperty(
|
4099 |
-
|
4100 |
-
|
4101 |
</p>
|
4102 |
<h5>Get CATEGORIES</h5>
|
4103 |
<p>If set, returns property value(-s), otherwise bool false.</p>
|
@@ -4115,11 +4324,11 @@ while( $vevent->deleteProperty( kigkonsult\iCalcreator\util\util::$CATEGORIES
|
|
4115 |
<p class="comment">Get propOrderNo CATEGORIES</p>
|
4116 |
<p class="label">Example</p>
|
4117 |
<p class="example">
|
4118 |
-
$categories = $valarm->getProperty(
|
4119 |
|
4120 |
</p>
|
4121 |
<h5>Set CATEGORIES</h5>
|
4122 |
-
<p>
|
4123 |
<p>
|
4124 |
In spite of the fact that CATEGORIES may contain a (comma separated) list of values,
|
4125 |
a strong recommendation is to split a CATEGORIES "list" into multiple single CATEGORIES entries.
|
@@ -4137,8 +4346,7 @@ propOrderNo = (int) order number // <span class="comment">1=1st,
|
|
4137 |
lang<sup>*</sup> = as defined in [RFC5546]</p>
|
4138 |
<p class="label">Example</p>
|
4139 |
<p class="example">
|
4140 |
-
$vevent->setProperty(
|
4141 |
-
"project_x" );
|
4142 |
|
4143 |
</p>
|
4144 |
<br>
|
@@ -4151,7 +4359,7 @@ This property defines the access classification for a <strong>calendar</strong>
|
|
4151 |
and MUST NOT occur more than once in <a href="#VEVENT">VEVENT</a>, <a href="#VTODO">VTODO</a> and <a href="#VJOURNAL">VJOURNAL</a> components.
|
4152 |
</p>
|
4153 |
<p>
|
4154 |
-
To ease up usage,
|
4155 |
</p>
|
4156 |
<h5>Create CLASS</h5>
|
4157 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -4168,7 +4376,7 @@ $str = $component->createClass();
|
|
4168 |
<p class="format">calendarComponent::deleteProperty( "CLASS" )</p>
|
4169 |
<p class="label">Example</p>
|
4170 |
<p class="example">
|
4171 |
-
$vjournal->deleteProperty(
|
4172 |
|
4173 |
</p>
|
4174 |
<h5>Get CLASS</h5>
|
@@ -4182,11 +4390,11 @@ $vjournal->deleteProperty( kigkonsult\iCalcreator\util\util::$CLASS );
|
|
4182 |
, "params" => xparams<sup>2</sup> )</p>
|
4183 |
<p class="label">Example</p>
|
4184 |
<p class="example">
|
4185 |
-
$class = $valarm->getProperty(
|
4186 |
|
4187 |
</p>
|
4188 |
<h5>Set CLASS</h5>
|
4189 |
-
<p>
|
4190 |
<p class="label">Format</p>
|
4191 |
<p class="format">calendarComponent::setProperty( "class", classvalue [, xparams ] )</p>
|
4192 |
<p class="comment">classvalue<sup>1</sup> = "PUBLIC"
|
@@ -4198,8 +4406,7 @@ xparams<sup>2</sup> = (array) ( *[ (string) key => (string) value ] ) // <
|
|
4198 |
</p>
|
4199 |
<p class="label">Example</p>
|
4200 |
<p class="example">
|
4201 |
-
$vevent->setProperty(
|
4202 |
-
"CONFIDENTIAL" );
|
4203 |
|
4204 |
</p>
|
4205 |
<br>
|
@@ -4212,7 +4419,7 @@ and is OPTIONAL and MAY occur more than once in <a href="#VEVENT">VEVENT</a>, <a
|
|
4212 |
</p>
|
4213 |
<p>The value type for COMMENT is TEXT.</p>
|
4214 |
<p>
|
4215 |
-
To ease up usage,
|
4216 |
</p>
|
4217 |
<h5>Create COMMENT</h5>
|
4218 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -4230,21 +4437,21 @@ $str = $component->createComment();
|
|
4230 |
<p class="label">Example 1</p>
|
4231 |
<p>Delete (single/first) COMMENT property</p>
|
4232 |
<p class="example">
|
4233 |
-
$vevent->deleteProperty(
|
4234 |
|
4235 |
</p>
|
4236 |
<p class="label">Example 2</p>
|
4237 |
<p>Delete COMMENT property no 2.</p>
|
4238 |
<p class="example">
|
4239 |
-
$vevent->deleteProperty(
|
4240 |
|
4241 |
</p>
|
4242 |
<p class="label">Example 3</p>
|
4243 |
<p>Deleting all COMMENT properties.</p>
|
4244 |
<p class="example">
|
4245 |
-
while( $vevent->deleteProperty(
|
4246 |
-
|
4247 |
-
|
4248 |
</p>
|
4249 |
<h5>Get COMMENT</h5>
|
4250 |
<p>If set, returns property value, otherwise bool false.</p>
|
@@ -4262,11 +4469,11 @@ while( $vevent->deleteProperty( kigkonsult\iCalcreator\util\util::$COMMENT ))
|
|
4262 |
<p class="comment">Get propOrderNo COMMENT</p>
|
4263 |
<p class="label">Example</p>
|
4264 |
<p class="example">
|
4265 |
-
$comment = $vevent->getProperty(
|
4266 |
|
4267 |
</p>
|
4268 |
<h5>Set COMMENT</h5>
|
4269 |
-
<p>
|
4270 |
<p class="label">Format</p>
|
4271 |
<p class="format">calendarComponent::setProperty( "comment", commentValue [, params [, propOrderNo ]] )</p>
|
4272 |
<p class="comment">commentValue<sup>1</sup> = (string) Value type Text
|
@@ -4279,8 +4486,7 @@ propOrderNo = (int) order number // <span class="comment">1=1st, 2
|
|
4279 |
lang<sup>*</sup> = as defined in [RFC5546]</p>
|
4280 |
<p class="label">Example</p>
|
4281 |
<p class="example">
|
4282 |
-
$vevent->setProperty(
|
4283 |
-
"this is a comment" );
|
4284 |
|
4285 |
</p>
|
4286 |
<br>
|
@@ -4291,10 +4497,10 @@ $vevent->setProperty( kigkonsult\iCalcreator\util\util::$COMMENT,
|
|
4291 |
<p>
|
4292 |
This property defines the date and time that a <a href="#VTODO">VTODO</a> was actually completed and is OPTIONAL and MUST NOT occur more than once.
|
4293 |
</p>
|
4294 |
-
<p>The value type for COMPLETED is <a href="#DATE_WITH_UTC_TIME">UTC</a> DATE-TIME.</p>
|
4295 |
<p>For methods and formatting, explore the <a href="#CREATED">CREATED</a> property.</p>
|
4296 |
<p>
|
4297 |
-
To ease up usage,
|
4298 |
</p>
|
4299 |
<br>
|
4300 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_component_object_property_function_list">[up]</a>
|
@@ -4311,7 +4517,7 @@ The property is used to represent textual contact information or alternately a r
|
|
4311 |
<p>You can <a href="#sort2">SORT</a> <strong>calendar</strong> (components) on (asc) CONTACT values.</p>
|
4312 |
<p>You can export <strong>calendar</strong> CONTACT values as <a href="#iCal2vCards">vCards</a>.
|
4313 |
<p>
|
4314 |
-
To ease up usage,
|
4315 |
</p>
|
4316 |
<h5>Create CONTACT</h5>
|
4317 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -4329,21 +4535,21 @@ $str = $component->createContact();
|
|
4329 |
<p class="label">Example 1</p>
|
4330 |
<p>Delete (single/first) CONTACT property<p>
|
4331 |
<p class="example">
|
4332 |
-
$vevent->deleteProperty(
|
4333 |
|
4334 |
</p>
|
4335 |
<p class="label">Example 2</p>
|
4336 |
<p>Delete CONTACT property no 2.</p>
|
4337 |
<p class="example">
|
4338 |
-
$vevent->deleteProperty(
|
4339 |
|
4340 |
</p>
|
4341 |
<p class="label">Example 3</p>
|
4342 |
<p>Deleting all CONTACT properties.</p>
|
4343 |
<p class="example">
|
4344 |
-
while( $vevent->deleteProperty(
|
4345 |
-
|
4346 |
-
|
4347 |
</p>
|
4348 |
<h5>Get CONTACT</h5>
|
4349 |
<p>If set, returns property value, otherwise bool false.</p>
|
@@ -4361,11 +4567,11 @@ while( $vevent->deleteProperty( kigkonsult\iCalcreator\util\util::$CONTACT ))
|
|
4361 |
<p class="comment">Get propOrderNo CONTACT</p>
|
4362 |
<p class="label">Example</p>
|
4363 |
<p class="example">
|
4364 |
-
$contact = $vevent->getProperty(
|
4365 |
|
4366 |
</p>
|
4367 |
<h5>Set CONTACT</h5>
|
4368 |
-
<p>
|
4369 |
<p class="label">Format</p>
|
4370 |
<p class="format">calendarComponent::setProperty( "contact", contactValue [, params [, propOrderNo ]] )</p>
|
4371 |
<p class="comment">contactValue<sup>1</sup> = (string) Value type TEXT
|
@@ -4378,8 +4584,7 @@ propOrderNo = (int) order number // <span class="comment">1=1st, 2
|
|
4378 |
lang<sup>*</sup> = as defined in [RFC5546]</p>
|
4379 |
<p class="label">Example</p>
|
4380 |
<p class="example">
|
4381 |
-
$c->setProperty(
|
4382 |
-
"tel 012-34 56 789" )
|
4383 |
|
4384 |
</p>
|
4385 |
<br>
|
@@ -4394,9 +4599,9 @@ Note: This is analogous to the creation date and time for a file in the file sys
|
|
4394 |
The property is OPTIONAL and MUST NOT occur more than once in <a href="#VEVENT">VEVENT</a>,
|
4395 |
<a href="#VTODO">VTODO</a> and <a href="#VJOURNAL">VJOURNAL</a> components.
|
4396 |
</p>
|
4397 |
-
<p>The value type for CREATED is <a href="#DATE_WITH_UTC_TIME">UTC</a> DATE-TIME.</p>
|
4398 |
<p>
|
4399 |
-
To ease up usage,
|
4400 |
</p>
|
4401 |
<h5>Create CREATED</h5>
|
4402 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -4413,7 +4618,7 @@ $str = $component->createCreated();
|
|
4413 |
<p class="format">calendarComponent::deleteProperty( "CREATED" )</p>
|
4414 |
<p class="label">Example</p>
|
4415 |
<p class="example">
|
4416 |
-
$vevent->deleteProperty(
|
4417 |
|
4418 |
</p>
|
4419 |
<h5>Get CREATED</h5>
|
@@ -4427,19 +4632,24 @@ $vevent->deleteProperty( kigkonsult\iCalcreator\util\util::$CREATED );
|
|
4427 |
, "params" => xparams<sup>2</sup> )</p>
|
4428 |
<p class="label">Example</p>
|
4429 |
<p class="example">
|
4430 |
-
$created = $vevent->getProperty(
|
4431 |
|
4432 |
</p>
|
4433 |
<h5>Set CREATED</h5>
|
4434 |
<p>
|
4435 |
-
|
4436 |
-
if "offset" parameter is used, converted to a <a href="#DATE_WITH_UTC_TIME">UTC</a> DATE-TIME.
|
4437 |
-
Notice,
|
4438 |
</p>
|
4439 |
<p>The current UTC date-time is set if invoked without parameters.</p>
|
4440 |
<p class="label">Format</p>
|
4441 |
<p class="format">calendarComponent::setProperty( "created", [ createdDate [, xparams ]] )</p>
|
4442 |
-
<p class="comment">
|
|
|
|
|
|
|
|
|
|
|
4443 |
, "month" => (int) month
|
4444 |
, "day" => (int) day
|
4445 |
[, "hour" => (int) hour
|
@@ -4459,10 +4669,13 @@ createdDate = (array) ( (int) year
|
|
4459 |
, (int) min
|
4460 |
, (int) sec
|
4461 |
[, offset ]] )
|
4462 |
-
|
4463 |
-
createdDate = (
|
4464 |
-
|
4465 |
-
|
|
|
|
|
|
|
4466 |
<br>date/datetime string<sup>*</sup> recommended formats
|
4467 |
"20110625", "2011-06-25", "2011/06/26"
|
4468 |
"20110625051015", "20110625 051015"
|
@@ -4474,26 +4687,21 @@ xparams<sup>2</sup> = array( *[ (string) key => (string) value ] ) // <sp
|
|
4474 |
<span class="comment">(notice <a href="#date_restriction">date restriction</a>)</span></p>
|
4475 |
<p class="label">Example 1</p>
|
4476 |
<p class="example">
|
4477 |
-
$config =
|
4478 |
-
$vcalendar = new
|
4479 |
-
$vtodo = $vcalendar->newComponent(
|
4480 |
|
4481 |
-
$vtodo->setProperty(
|
4482 |
-
|
|
|
|
|
|
|
4483 |
|
4484 |
</p>
|
4485 |
<p class="label">Example 2</p>
|
4486 |
<p class="example">
|
4487 |
-
$
|
4488 |
-
|
4489 |
-
// <span class="comment">local date + UTC offset will result in a <a class="ref" href="#DATE_WITH_UTC_TIME">UTC</a> DATE-TIME</span>
|
4490 |
-
$vtodo->setProperty( kigkonsult\iCalcreator\util\util::$CREATED,
|
4491 |
-
$date );
|
4492 |
-
|
4493 |
-
</p>
|
4494 |
-
<p class="label">Example 3</p>
|
4495 |
-
<p class="example">
|
4496 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$CREATED ); // <span class="comment">current UTC date-time is set if invoked without parameters</span>
|
4497 |
|
4498 |
</p>
|
4499 |
<br>
|
@@ -4510,7 +4718,7 @@ times within a <a href="#VJOURNAL">VJOURNAL</a> <strong>calendar</strong> compon
|
|
4510 |
</p>
|
4511 |
<p>The value type for DESCRIPTION is TEXT.</p>
|
4512 |
<p>
|
4513 |
-
To ease up usage,
|
4514 |
</p>
|
4515 |
<h5>Create DESCRIPTION</h5>
|
4516 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -4528,21 +4736,21 @@ $str = $component->createDescription();
|
|
4528 |
<p class="label">Example 1</p>
|
4529 |
<p>Delete (single/first) DESCRIPTION property.</p>
|
4530 |
<p class="example">
|
4531 |
-
$vevent->deleteProperty(
|
4532 |
|
4533 |
</p>
|
4534 |
<p class="label">Example 2</p>
|
4535 |
<p>Delete DESCRIPTION property no 2.</p>
|
4536 |
<p class="example">
|
4537 |
-
$vjournal->deleteProperty(
|
4538 |
|
4539 |
</p>
|
4540 |
<p class="label">Example 3</p>
|
4541 |
<p>Deleting all DESCRIPTION properties.</p>
|
4542 |
<p class="example">
|
4543 |
-
while( $vjournal->deleteProperty(
|
4544 |
-
|
4545 |
-
|
4546 |
</p>
|
4547 |
<h5>Get DESCRIPTION</h5>
|
4548 |
<p>If set, returns property value(-s), otherwise bool false.</p>
|
@@ -4555,11 +4763,11 @@ while( $vjournal->deleteProperty( kigkonsult\iCalcreator\util\util::$DESCRIPT
|
|
4555 |
, "params" => params<sup>2</sup> )</p>
|
4556 |
<p class="label">Example</p>
|
4557 |
<p class="example">
|
4558 |
-
$description = $vevent->getProperty(
|
4559 |
|
4560 |
</p>
|
4561 |
<h5>Set DESCRIPTION</h5>
|
4562 |
-
<p>
|
4563 |
<br>
|
4564 |
Parameters will be ordered as prescribed in [RFC5545].
|
4565 |
<p class="label">Format</p>
|
@@ -4574,8 +4782,7 @@ propOrderNo = (int) order number // <span class="comment">1=1s
|
|
4574 |
lang<sup>*</sup> = as defined in [RFC5546]</p>
|
4575 |
<p class="label">Example</p>
|
4576 |
<p class="example">
|
4577 |
-
$vevent->setProperty(
|
4578 |
-
"This is a description" );
|
4579 |
|
4580 |
</p>
|
4581 |
<br>
|
@@ -4592,7 +4799,7 @@ if DURATION NOT occurs.
|
|
4592 |
The default value type for DTEND is DATE-TIME, can be set to a DATE value type.
|
4593 |
</p>
|
4594 |
<p>
|
4595 |
-
To ease up usage,
|
4596 |
</p>
|
4597 |
<p class="quotes">
|
4598 |
The value type of the "DTEND" or "DUE" properties MUST match the value type of "DTSTART" property as defined in [RFC5545])
|
@@ -4618,7 +4825,7 @@ $str = $component->createDtend();
|
|
4618 |
<p class="format">calendarComponent::deleteProperty( "DTEND" )</p>
|
4619 |
<p class="label">Example</p>
|
4620 |
<p class="example">
|
4621 |
-
$vevent->deleteProperty(
|
4622 |
|
4623 |
</p>
|
4624 |
<h5>Get DTEND</h5>
|
@@ -4632,23 +4839,34 @@ $vevent->deleteProperty( kigkonsult\iCalcreator\util\util::$DTEND );
|
|
4632 |
, "params" => params<sup>2</sup> )</p>
|
4633 |
<p class="label">Example</p>
|
4634 |
<p class="example">
|
4635 |
-
$dtend = $vevent->getProperty(
|
4636 |
|
4637 |
</p>
|
4638 |
<h5>Set DTEND</h5>
|
4639 |
<p>
|
4640 |
-
|
4641 |
(in params<sup>2</sup>) otherwise DATE-TIME (default) value type is set.
|
4642 |
</p>
|
4643 |
<p>
|
4644 |
If no timezone parameter (tz or tzidparam below) is set (i.e.local time) and config <a href="#dTZID">TZID</a> is set,
|
4645 |
date-time values will be set WITH timezone from config.
|
4646 |
-
|
|
|
|
|
|
|
|
|
|
|
4647 |
</p>
|
|
|
4648 |
<p>Parameters will be ordered as prescribed in [RFC5545].</p>
|
4649 |
<p class="label">Format</p>
|
4650 |
<p class="format">calendarComponent::setProperty( "dtend", dtendDate [, params<sup>2</sup> ] )
|
4651 |
-
<p class="comment">
|
|
|
|
|
|
|
|
|
|
|
4652 |
, "month" => (int) month
|
4653 |
, "day" => (int) day
|
4654 |
[, "hour" => (int) hour
|
@@ -4670,20 +4888,20 @@ dtendDate = array( (int) year
|
|
4670 |
, (int) sec
|
4671 |
[, tz ]] )
|
4672 |
dtendDate = (array) ( "timestamp" => (int) timestamp [,"tz" => tz])
|
4673 |
-
|
4674 |
-
|
4675 |
-
|
4676 |
-
|
4677 |
-
// <span class="comment">the time MUST be specified in the <a href="#DATE_WITH_UTC_TIME">UTC</a> DATE-TIME</span>
|
4678 |
tz = (string) <timezone identifier> / offset
|
4679 |
-
|
4680 |
offset = (int) (+/-)HHmm[ss] // <span class="comment">(arr/str) local date + UTC offset</span>
|
4681 |
-
// <span class="comment">will result in a <a href="#DATE_WITH_UTC_TIME">UTC</a>
|
|
|
4682 |
params<sup>2</sup> = (array) ([ tzidparam/datetimeparam/dateparam ] *[,xparams])
|
4683 |
-
tzidparam =
|
4684 |
-
|
4685 |
-
|
4686 |
-
|
4687 |
datetimeparam = "VALUE" => "DATE-TIME" // <span class="comment">default, output as date-time</span>
|
4688 |
dateparam = "VALUE" => "DATE" // <span class="comment">output as DATE, ex. all-day event</span>
|
4689 |
xparams = (string) key => (string) value // <span class="comment">key prefix "X-"</span>
|
@@ -4695,36 +4913,33 @@ xparams = (string) key => (string) value // <span class="comment">key p
|
|
4695 |
"2011/06/25 05:10:15", "2011/06/25T05:10:15", "2011/06/25t05:10:15"
|
4696 |
trailing characters (digits), if exists, will be interpreted as offset/timezone
|
4697 |
other string formats, acceptable by <em>PHP</em> strtotime function, may (would) work
|
4698 |
-
<span class="comment">(notice <a href="#date_restriction">date restriction</a>)</span
|
|
|
4699 |
<p class="label">Example 1</p>
|
4700 |
<p class="example">
|
4701 |
-
$vevent->setProperty(
|
4702 |
-
|
|
|
|
|
|
|
4703 |
|
4704 |
</p>
|
4705 |
<p class="label">Example 2</p>
|
4706 |
<p class="example">
|
4707 |
-
$
|
4708 |
-
|
4709 |
-
|
4710 |
-
|
|
|
|
|
4711 |
|
4712 |
</p>
|
4713 |
<p class="label">Example 3</p>
|
4714 |
<p class="example">
|
4715 |
-
$vevent->setProperty(
|
4716 |
-
|
4717 |
-
|
4718 |
-
|
4719 |
-
|
4720 |
-
</p>
|
4721 |
-
<p class="label">Example 4</p>
|
4722 |
-
<p class="example">
|
4723 |
-
$calendar->setConfig( kigkonsult\iCalcreator\util\util::$TZID, 'Europe/Stockholm' );
|
4724 |
-
|
4725 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$DTEND,
|
4726 |
-
2006, 8, 11, 7, 30, 0 );
|
4727 |
-
<span class="comment">// output: DTEND;TZID=Europe/Stockholm:20060811T073000</span>
|
4728 |
|
4729 |
</p>
|
4730 |
<br>
|
@@ -4733,7 +4948,7 @@ $vevent->setProperty( kigkonsult\iCalcreator\util\util::$DTEND,
|
|
4733 |
|
4734 |
<a name="DTSTAMP"></a><h3>3.2.16 DTSTAMP</h3>
|
4735 |
<p>
|
4736 |
-
The property indicates the date/time the instance
|
4737 |
MUST NOT occur more than once in <a href="#VEVENT">VEVENT</a>, <a href="#VTODO">VTODO</a>, <a href="#VJOURNAL">VJOURNAL</a>
|
4738 |
and <a href="#VFREEBUSY">VFREEBUSY</a> components. However, DTSTAMP is <b>AUTOMATICALL§Y GENERATED</b> in iCalcreator when creating a component.
|
4739 |
</p>
|
@@ -4742,11 +4957,11 @@ DTSTAMP may be required when importing iCal files into some <strong>calendar</st
|
|
4742 |
as well as (<strong>calendar</strong>) <a href="#X-PROPERTY">x-properties</a> "X-WR-CALNAME", "X-WR-CALDESC" and<br>"X-WR-TIMEZONE",
|
4743 |
<a href="#METHOD">METHOD</a> property (value PUBLISH etc.) and the (also auto created) <a href="#UID">UID</a> property.
|
4744 |
</p>
|
4745 |
-
<p>The value type for DTSTAMP is <a href="#DATE_WITH_UTC_TIME">UTC</a> DATE-TIME.</p>
|
4746 |
<p>For methods and formatting, explore the <a href="#CREATED">CREATED</a> property.</p>
|
4747 |
<p>You can <a href="#sort2">SORT</a> <strong>calendar</strong> (components) on (asc) DTSTAMP values.</p>
|
4748 |
<p>
|
4749 |
-
To ease up usage,
|
4750 |
</p>
|
4751 |
<br>
|
4752 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_component_object_property_function_list">[up]</a>
|
@@ -4767,7 +4982,7 @@ DTEND;VALUE=DATE:20071202. // <span class="comment">opt., in effect midnight of
|
|
4767 |
</p>
|
4768 |
<p>For methods and formatting, explore the <a href="#DTEND">DTEND</a> property.</p>
|
4769 |
<p>
|
4770 |
-
To ease up usage,
|
4771 |
</p>
|
4772 |
<br>
|
4773 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_component_object_property_function_list">[up]</a>
|
@@ -4786,7 +5001,7 @@ The value type of the "DTEND" or "DUE" properties MUST match the value type of "
|
|
4786 |
</p>
|
4787 |
<p>For methods and formatting, explore the <a href="#DTEND">DTEND</a> property.</p>
|
4788 |
<p>
|
4789 |
-
To ease up usage,
|
4790 |
</p>
|
4791 |
<br>
|
4792 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_component_object_property_function_list">[up]</a>
|
@@ -4806,10 +5021,7 @@ To ease up usage, kigkonsult\iCalcreator\util\util::$DUE is available.
|
|
4806 |
<dd>it is OPTIONAL and MUST NOT occur more than once and MUST occur in pair with TRIGGER. If one occurs, so MUST the other.
|
4807 |
</dl>
|
4808 |
<p>
|
4809 |
-
|
4810 |
-
</p>
|
4811 |
-
<p>
|
4812 |
-
To ease up usage, kigkonsult\iCalcreator\util\util::$DURATION as used in code snippets is available.
|
4813 |
</p>
|
4814 |
<h5>Create DURATION</h5>
|
4815 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -4826,7 +5038,7 @@ $str = $component->createDuration();
|
|
4826 |
<p class="format">calendarComponent::deleteProperty( "DURATION" )</p>
|
4827 |
<p class="label">Example</p>
|
4828 |
<p class="example">
|
4829 |
-
$valarm->deleteProperty(
|
4830 |
|
4831 |
</p>
|
4832 |
<h5>Get DURATION</h5>
|
@@ -4840,7 +5052,7 @@ $valarm->deleteProperty( kigkonsult\iCalcreator\util\util::$DURATION );
|
|
4840 |
, "params" => xparams<sup>2</sup> )</p>
|
4841 |
<p class="label">Example</p>
|
4842 |
<p class="example">
|
4843 |
-
$duration = $vtodo->getProperty(
|
4844 |
|
4845 |
</p>
|
4846 |
<p class="label">option</p>
|
@@ -4850,10 +5062,21 @@ If a 4th argument is used and set to true, returned output is in a DATE-TIME
|
|
4850 |
<a href="#DTSTART">DTSTART</a> value with the added DURATION value (incl. opt. timezone).
|
4851 |
</p>
|
4852 |
<h5>Set DURATION</h5>
|
4853 |
-
<p>
|
4854 |
<p class="label">Format</p>
|
4855 |
<p class="format">calendarComponent::setProperty( "duration", duration [, xparams ] )</p>
|
4856 |
-
<p class="comment">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4857 |
duration<sup>1</sup> = (array) ( "week" => (int) week )
|
4858 |
duration<sup>1</sup> = array ( "day" => (int) day )
|
4859 |
[, "hour" => (int) hour
|
@@ -4870,28 +5093,25 @@ duration = (int) week/false
|
|
4870 |
[, (int) hour
|
4871 |
, (int) min
|
4872 |
, (int) sec ]]
|
4873 |
-
|
4874 |
-
dur-date = dur-day [dur-time]
|
4875 |
-
dur-time = "T" (dur-hour / dur-minute / dur-second)
|
4876 |
-
dur-week = 1*DIGIT "W"
|
4877 |
-
dur-hour = 1*DIGIT "H" [dur-minute]
|
4878 |
-
dur-minute = 1*DIGIT "M" [dur-second]
|
4879 |
-
dur-second = 1*DIGIT "S"
|
4880 |
-
dur-day = 1*DIGIT "D"
|
4881 |
xparams<sup>2</sup> = (array) ( *[ (string) key => (string) value ] ) // <span class="comment">key prefix "X-"</span>
|
4882 |
</p>
|
4883 |
<p class="label">Example 1</p>
|
4884 |
<p>One day duration.</p>
|
4885 |
<p class="example">
|
4886 |
-
$vtodo->setProperty
|
4887 |
-
|
|
|
|
|
4888 |
|
4889 |
</p>
|
4890 |
<p class="label">Example 2</p>
|
4891 |
<p>Four hours duration.</p>
|
4892 |
<p class="example">
|
4893 |
-
$vtodo->setProperty(
|
4894 |
-
|
|
|
|
|
4895 |
|
4896 |
</p>
|
4897 |
<br>
|
@@ -4905,7 +5125,7 @@ and MAY occur more than once in <a href="#VEVENT">VEVENT</a>, <a href="#VTODO">V
|
|
4905 |
</p>
|
4906 |
<p>The default value type for EXDATE is DATE-TIME, can be set to a DATE value type.</p>
|
4907 |
<p>
|
4908 |
-
To ease up usage,
|
4909 |
</p>
|
4910 |
<h5>Create EXDATE</h5>
|
4911 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -4922,47 +5142,44 @@ $str = $component->createExdate();
|
|
4922 |
<p class="format">calendarComponent::deleteProperty( "EXDATE" )</p>
|
4923 |
<p class="label">Example 1</p>
|
4924 |
<p class="example">
|
4925 |
-
$vtodo->deleteProperty(
|
4926 |
|
4927 |
</p>
|
4928 |
<p class="label">Example 2</p>
|
4929 |
<P>Delete EXDATE property no 2.</p>
|
4930 |
<p class="example">
|
4931 |
-
$vjournal->deleteProperty(
|
4932 |
|
4933 |
</p>
|
4934 |
<p class="label">Example 3</p>
|
4935 |
<p>Deleting all EXDATE properties.</p>
|
4936 |
<p class="example">
|
4937 |
-
while( $vjournal->deleteProperty(
|
4938 |
-
|
4939 |
-
|
|
|
4940 |
</p>
|
4941 |
<h5>Get EXDATE</h5>
|
4942 |
<p>If set, returns property value, otherwise bool false.</p>
|
4943 |
<p class="label">Format 1</p>
|
4944 |
<p class="format">calendarComponent::getProperty( "EXDATE" )<p>
|
4945 |
-
<p class="comment">output = exdates<sup>1</sup
|
4946 |
<p class="label">Format 2</p>
|
4947 |
<p class="format">calendarComponent::getProperty( "exdate", propOrderNo/false, true )</p>
|
4948 |
<p class="comment">propOrderNo = (int) specific property value</p>
|
4949 |
-
<p class="comment">output = array( "value" => exdates<sup>1</sup>
|
4950 |
, "params" => xparams<sup>2</sup> )</p>
|
4951 |
-
<p class="label">Format 3</p>
|
4952 |
-
<p class="format">calendarComponent::getProperty( "EXDATE", propOrderNo )</p>
|
4953 |
-
<p class="comment">propOrderNo = (int) specific property value</p>
|
4954 |
-
<p class="comment">Get propOrderNo EXDATE</p>
|
4955 |
<p class="label">Example</p>
|
4956 |
<p class="example">
|
4957 |
-
$exdate = $vtodo->getProperty(
|
4958 |
|
4959 |
</p>
|
4960 |
<h5>Set EXDATE</h5>
|
4961 |
-
<p>
|
4962 |
<p>The value type for EXDATE should match the <a href="#DTSTART">DTSTART</a> value type.</p>
|
4963 |
<p>
|
4964 |
If DATE value type is set in params ("VALUE" = "DATE"), all timezone or offset in dates are ignored.<br>
|
4965 |
-
If no "VALUE" value type is set
|
4966 |
</p>
|
4967 |
<p>
|
4968 |
If "TZID" is set in params,
|
@@ -4972,17 +5189,25 @@ If no "TZID" is set in params and timezone in 1st date, all remaining
|
|
4972 |
If none of the above rules are applicable, DATE-TIME and local date is set default.
|
4973 |
</p>
|
4974 |
<p>
|
4975 |
-
|
|
|
4976 |
</p>
|
4977 |
<p>EXDATEs are automatically sorted in ascending order (Y-m-d[-H-i-s]).</p>
|
4978 |
<p>
|
4979 |
In spite of the fact that EXDATE may contain a (comma separated) list of values,
|
4980 |
-
a strong recommendation is to split
|
|
|
4981 |
</p>
|
4982 |
<p>Parameters will be ordered as prescribed in [RFC5545].</p>
|
4983 |
<p class="label">Format</p>
|
4984 |
<p class="format">calendarComponent::setProperty( "exdate", exdates [, params [, propOrderNo ]] )</p>
|
4985 |
<p class="comment">exdates<sup>1</sup> = (array) ( date *[, date ] )
|
|
|
|
|
|
|
|
|
|
|
|
|
4986 |
date = array( (int) year
|
4987 |
, (int) month
|
4988 |
, (int) day
|
@@ -4998,17 +5223,21 @@ date<sup>1</sup> = (array) ( "year" => (int) year
|
|
4998 |
, "sec" => (int) sec
|
4999 |
[, "tz" => tz ]] )
|
5000 |
date = (array) ( "timestamp" => (int) timestamp [, "tz" => tz])
|
5001 |
-
|
5002 |
-
|
5003 |
tz = (string) <timezone identifier> / offset
|
5004 |
-
|
5005 |
-
offset = (int) (+/-)HHmm[ss] // <span class="comment">(arr/str) local date + UTC offset will result in a <a href="#DATE_WITH_UTC_TIME">UTC</a> DATE-TIME</span>
|
5006 |
params<sup>2</sup> = (array) ([(datetimeparam/dateparam) / tzidparam] *[,xparams])
|
5007 |
-
|
5008 |
-
|
5009 |
-
|
5010 |
-
|
5011 |
-
|
|
|
|
|
|
|
|
|
5012 |
<br>date/datetime string<sup>*</sup> recommended formats
|
5013 |
"20110625", "2011-06-25", "2011/06/26"
|
5014 |
"20110625051015", "20110625 051015"
|
@@ -5020,17 +5249,11 @@ propOrderNo = (int) order number // <span class="comment">1=1st, 2
|
|
5020 |
<span class="commsnt">(notice <a href="#date_restriction">date restriction</a>)</span></p>
|
5021 |
<p class="label">Example 1</p>
|
5022 |
<p class="example">
|
5023 |
-
$vevent->setProperty(
|
5024 |
-
|
5025 |
-
|
5026 |
-
|
5027 |
-
|
5028 |
-
<p class="label">Example 2</p>
|
5029 |
-
<p class="example">
|
5030 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$EXDATE,
|
5031 |
-
array( array("year" =>,2006,"month" => 8,"day"=> 11)),
|
5032 |
-
array( "VALUE" => "DATE" ));
|
5033 |
-
<span class="comment">// exclude 2006-08-11 from recurrence pattern;</span>
|
5034 |
|
5035 |
</p>
|
5036 |
<br>
|
@@ -5044,7 +5267,7 @@ and MAY occur more than once in <a href="#VEVENT">VEVENT</a>, <a href="#VTODO">V
|
|
5044 |
</p>
|
5045 |
<p>EXRULE is deprecated in [RFC5545]!</p>
|
5046 |
<p>
|
5047 |
-
To ease up usage,
|
5048 |
</p>
|
5049 |
<h5>Create EXRULE</h5>
|
5050 |
<p>If set, returns [RFC2445] formatted string, otherwise bool false.</p>
|
@@ -5061,21 +5284,21 @@ $str = $component->createExrule();
|
|
5061 |
<p class="format">calendarComponent::deleteProperty( "EXRULE" )</p>
|
5062 |
<p class="label">Example 1</p>
|
5063 |
<p class="example">
|
5064 |
-
$vtodo->deleteProperty(
|
5065 |
|
5066 |
</p>
|
5067 |
<p class="label">Example 2</p>
|
5068 |
<p>Delete EXRULE property no 2.</p>
|
5069 |
<p class="example">
|
5070 |
-
$vjournal->deleteProperty(
|
5071 |
|
5072 |
</p>
|
5073 |
<p class="label">Example 3</p>
|
5074 |
<p>Deleting all EXRULE properties.</p>
|
5075 |
<p class="example">
|
5076 |
-
while( $vjournal->deleteProperty(
|
5077 |
-
|
5078 |
-
|
5079 |
</p>
|
5080 |
<h5>Get EXRULE</h5>
|
5081 |
<p>If set, returns property value, otherwise bool false.</p>
|
@@ -5093,18 +5316,19 @@ while( $vjournal->deleteProperty( kigkonsult\iCalcreator\util\util::$EXRULE )
|
|
5093 |
<p class="comment">Get propOrderNo EXRULE</p>
|
5094 |
<p class="label">Example</p>
|
5095 |
<p class="example">
|
5096 |
-
$exrule = $vtodo->getProperty(
|
5097 |
|
5098 |
</p>
|
5099 |
<h5>Set EXRULE</h5>
|
5100 |
<p>
|
5101 |
-
|
5102 |
-
|
|
|
5103 |
</p>
|
5104 |
<p>Parameters, will be ordered as prescribed in [RFC5545].</p>
|
5105 |
<p class="label">Format</p>
|
5106 |
<p class="format">calendarComponent::setProperty( "exrule", recur [, xparams [, propOrderNo ]] )</p>
|
5107 |
-
See rules in detail in <a href="
|
5108 |
<p class="comment">recur<sup>1</sup> = (array) ( "FREQ" => freq
|
5109 |
// <span class="comment">either UNTIL or COUNT may appear in a "recur",
|
5110 |
but UNTIL and COUNT MUST NOT occur in the same "recur"</span>
|
@@ -5131,15 +5355,21 @@ freq = "SECONDLY" /
|
|
5131 |
"WEEKLY" /
|
5132 |
"MONTHLY" /
|
5133 |
"YEARLY"
|
5134 |
-
enddate = date // <span class="comment">a DATE value or a <a href="#DATE_WITH_UTC_TIME">UTC</a> DATE-TIME value</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
5135 |
date = (array) ( "year" => (int) year
|
5136 |
, "month" => (int) month
|
5137 |
, "day" => (int) day
|
5138 |
[, "hour" => (int) hour
|
5139 |
, "min" => (int) min
|
5140 |
, "sec" => (int) sec ])
|
5141 |
-
date = (array) ( "timestamp" => (int) timestamp ) // <span class="comment">results in a <a href="#DATE_WITH_UTC_TIME">UTC</a> DATE-TIME</span>
|
5142 |
-
|
5143 |
byseclist = seconds
|
5144 |
byseclist = (array) (seconds *(, seconds ))
|
5145 |
seconds = 1DIGIT / 2DIGIT ;0 to 59
|
@@ -5188,43 +5418,51 @@ propOrderNo = (int) order number // <span class="co
|
|
5188 |
<span class="comment">(notice <a href="#date_restriction">date restriction</a>)</span></p>
|
5189 |
<p class="label">Example</p>
|
5190 |
<p class="example">
|
5191 |
-
$vevent->setProperty(
|
5192 |
-
|
5193 |
-
|
5194 |
-
|
5195 |
-
|
5196 |
-
|
5197 |
-
|
5198 |
-
|
5199 |
-
|
5200 |
-
|
5201 |
-
|
5202 |
-
|
5203 |
-
|
5204 |
-
|
5205 |
-
|
5206 |
-
|
5207 |
-
|
5208 |
-
|
5209 |
-
|
5210 |
-
|
5211 |
-
|
5212 |
-
|
5213 |
-
|
5214 |
-
|
5215 |
-
|
5216 |
-
|
5217 |
-
|
5218 |
-
|
5219 |
-
|
5220 |
-
|
5221 |
-
|
5222 |
-
|
5223 |
-
|
5224 |
-
|
5225 |
-
|
5226 |
-
|
5227 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5228 |
// <span class="comment">(*) single value/array of values</span>
|
5229 |
// <span class="comment">(**) single value array /array of arrays</span>
|
5230 |
|
@@ -5238,9 +5476,9 @@ $vtodo->setProperty( >kigkonsult\iCalcreator\util\util::$EXRULE,
|
|
5238 |
The property defines one or more free or busy time intervals in a <a href="#VFREEBUSY">VFREEBUSY</a>
|
5239 |
<strong>calendar</strong> component.
|
5240 |
<p>
|
5241 |
-
<p>The value type for FREEBUSY is PERIOD. A PERIOD is
|
5242 |
<p>
|
5243 |
-
To ease up usage,
|
5244 |
</p>
|
5245 |
<h5>Create FREEBUSY</h5>
|
5246 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -5258,43 +5496,46 @@ $str = $component->createfreebusy();
|
|
5258 |
<p class="label">Example 1</p>
|
5259 |
<p>Delete (single/first) FREEBUSY property</p>
|
5260 |
<p class="example">
|
5261 |
-
$vfreebusy->deleteProperty(
|
5262 |
|
5263 |
</p>
|
5264 |
<p class="label">Example 2</p>
|
5265 |
<p>Delete FREEBUSY property no 2.</p>
|
5266 |
<p class="example">
|
5267 |
-
$vfreebusy->deleteProperty(
|
5268 |
|
5269 |
</p>
|
5270 |
<p class="label">Example 3</p>
|
5271 |
<p>Deleting all FREEBUSY properties.</p>
|
5272 |
<p class="example">
|
5273 |
-
while( $vfreebusy->deleteProperty(
|
5274 |
-
|
5275 |
-
|
5276 |
</p>
|
5277 |
<h5>Get FREEBUSY</h5>
|
5278 |
<p>If set, returns property value, otherwise bool false.</p>
|
5279 |
<p class="label">Format 1</p>
|
5280 |
<p class="format">calendarComponent::getProperty( "FREEBUSY" )</p>
|
5281 |
-
<p class="comment">
|
|
|
|
|
|
|
5282 |
<p class="label">Format 3</p>
|
5283 |
<p class="format">calendarComponent::getProperty( "FREEBUSY", propOrderNo/false , true )</p>
|
5284 |
<p class="comment">propOrderNo = (int) specific property value</p>
|
5285 |
-
<p class="comment">
|
5286 |
-
|
5287 |
-
<
|
5288 |
-
|
5289 |
-
|
5290 |
-
<p class="comment">Get propOrderNo FREEBUSY</p>
|
5291 |
<p class="label">Example</p>
|
5292 |
<p class="example">
|
5293 |
-
$freebusy = $vfreebusy->getProperty(
|
5294 |
|
5295 |
</p>
|
5296 |
<h5>Set FREEBUSY</h5>
|
5297 |
-
|
|
|
5298 |
<p class="label">Format</p>
|
5299 |
<p class="format">calendarComponent::setProperty( "freebusy",freebusytype,fbperiods [,xparams [,propOrderNo ]] )</p>
|
5300 |
<p class="comment">freebusytype<sup>1</sup> = one of "FREE"
|
@@ -5305,21 +5546,40 @@ Insert property value. A FREEBUSY input date is always a <a href="#DATE_WITH_UTC
|
|
5305 |
fbperiods = (array) ( periods<sup>2</sup> )
|
5306 |
periods<sup>2</sup> = (array) ( startdate, enddate/duration ) /
|
5307 |
(array) ( *[, (array) ( startdate, enddate/duration )] )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5308 |
startdate/enddate = (array) ( (int) year
|
5309 |
, (int) month
|
5310 |
, (int) day
|
5311 |
, (int) hour
|
5312 |
, (int) min
|
5313 |
, (int) sec )
|
5314 |
-
startdate/enddate = (array) ( "year" => (int) year
|
5315 |
, "month" => (int) month
|
5316 |
, "day" => (int) day
|
5317 |
, "hour" => (int) hour
|
5318 |
, "min" => (int) min
|
5319 |
-
, "sec" => (int) sec ) // <span class="comment">output format</span>
|
5320 |
-
startdate/enddate = (array) ( "timestamp" => (int) timestamp ) // <span class="comment">results in a <a href="#DATE_WITH_UTC_TIME">UTC</a> DATE-TIME</span>
|
5321 |
-
|
5322 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5323 |
duration = (array) ( (int) week / false
|
5324 |
[, (int) day / false
|
5325 |
, (int) hour
|
@@ -5331,59 +5591,45 @@ duration = (array) ( "week" => (int) week / false
|
|
5331 |
, "min" => (int) min
|
5332 |
, "sec" => (int) sec ]] ); // <span class="comment">output format</span>
|
5333 |
duration = (array) ( "sec" => (int) sec )
|
5334 |
-
|
5335 |
-
= (["+"]/"-") "P" (dur-date/dur-time/dur-week)
|
5336 |
-
dur-date = dur-day [dur-time]
|
5337 |
-
dur-time = "T" (dur-hour / dur-minute / dur-second)
|
5338 |
-
dur-week = 1*DIGIT "W"
|
5339 |
-
dur-hour = 1*DIGIT "H" [dur-minute]
|
5340 |
-
dur-minute = 1*DIGIT "M" [dur-second]
|
5341 |
-
dur-second = 1*DIGIT "S"
|
5342 |
-
dur-day = 1*DIGIT "D"
|
5343 |
xparams<sup>3 </sup> = (array) ( *[ (string) key => (string) value ] ) // <span class="comment">key prefix "X-"</span>
|
5344 |
propOrderNo = (int) order number // <span class="comment">1=1st, 2=2nd etc</span>
|
5345 |
<br>date/datetime string<sup>*</sup> recommended formats
|
5346 |
-
"20110625051015", "20110625 051015"
|
5347 |
-
"20110625T051015", "20110625t051015"
|
5348 |
-
"2011-06-25 05:10:15", "2011-06-25T05:10:15", "2011-06-25t05:10:15"
|
5349 |
-
"2011/06/25 05:10:15", "2011/06/25T05:10:15", "2011/06/25t05:10:15"
|
5350 |
other string formats, acceptable by <em>PHP</em> strtotime function, may (would) work
|
5351 |
<span class="comment">(notice <a href="#date_restriction">date restriction</a>)</span></p>
|
5352 |
<p class="label">Example</p>
|
5353 |
-
See rules in detail in <a href="
|
5354 |
-
<p class="example">
|
5355 |
-
$fdate1 =
|
5356 |
-
|
5357 |
-
$
|
5358 |
-
|
5359 |
-
|
5360 |
-
|
5361 |
-
|
5362 |
-
|
5363 |
-
|
5364 |
-
|
5365 |
-
|
5366 |
-
$
|
5367 |
-
|
5368 |
-
|
5369 |
-
|
5370 |
-
|
5371 |
-
|
5372 |
-
|
5373 |
-
|
5374 |
-
|
5375 |
-
$
|
5376 |
-
$
|
5377 |
-
|
5378 |
-
|
5379 |
-
|
5380 |
-
|
5381 |
-
$freebusy->setProperty(kigkonsult\iCalcreator\util\util::$FREEBUSY,
|
5382 |
-
"Busy",
|
5383 |
-
array( array( array( $fdate1, $fdate2 ),
|
5384 |
-
array( $fdate3, $fdur8 ),
|
5385 |
-
array( $fdate4, $fdur7 ),
|
5386 |
-
array( $fdate1, $fdate3 )));
|
5387 |
|
5388 |
</p>
|
5389 |
<br>
|
@@ -5411,7 +5657,7 @@ be separated from the whole number of degrees by a decimal point.</p>
|
|
5411 |
(only if <a href="#GEO">GEO</a> is set).
|
5412 |
</p>
|
5413 |
<p>
|
5414 |
-
To ease up usage,
|
5415 |
</p>
|
5416 |
<h5>Create GEO</h5>
|
5417 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -5428,7 +5674,7 @@ $str = $component->createGeo();
|
|
5428 |
<p class="format">calendarComponent::deleteProperty( "GEO" )</p>
|
5429 |
<p class="label">Example</p>
|
5430 |
<p class="example">
|
5431 |
-
$vevent->deleteProperty(
|
5432 |
|
5433 |
</p>
|
5434 |
<h5>Get GEO</h5>
|
@@ -5444,11 +5690,11 @@ $vevent->deleteProperty( kigkonsult\iCalcreator\util\util::$GEO );
|
|
5444 |
, "params" => xparams<sup>1</sup> )</p>
|
5445 |
<p class="label">Example</p>
|
5446 |
<p class="example">
|
5447 |
-
$geo = $vevent->getProperty(
|
5448 |
|
5449 |
</p>
|
5450 |
<h5>Set GEO</h5>
|
5451 |
-
<p>
|
5452 |
<p class="label">Format</p>
|
5453 |
<p class="format">calendarComponent::setProperty( "geo", latitude, longitude [, xparams ] )</p>
|
5454 |
<p class="comment">latitude = (float) latitude
|
@@ -5457,9 +5703,7 @@ xparams<sup>1</sup> = (array) ( *[ (string) key => (string) value ] ) // <spa
|
|
5457 |
</p>
|
5458 |
<p class="label">Example</p>
|
5459 |
<p class="example">
|
5460 |
-
$vevent->setProperty(
|
5461 |
-
11.23456,
|
5462 |
-
-23.45678 );
|
5463 |
|
5464 |
</p>
|
5465 |
<br>
|
@@ -5473,10 +5717,10 @@ component was last revised in the <strong>calendar</strong> store.
|
|
5473 |
The property is OPTIONAL and MUST NOT occur more than once in <a href="#VEVENT">VEVENT</a>,
|
5474 |
<a href="#VTODO">VTODO</a>, <a href="#VJOURNAL">VJOURNAL</a> and <a href="#VTIMEZONE">VTIMEZONE</a> components.
|
5475 |
</p>
|
5476 |
-
<p>The value type for LAST-MODIFIED is <a href="#DATE_WITH_UTC_TIME">UTC</a> DATE-TIME.</p>
|
5477 |
<p>For methods and formatting, explore the <a href="#CREATED">CREATED</a> property.</p>
|
5478 |
<p>
|
5479 |
-
To ease up usage,
|
5480 |
</p>
|
5481 |
<br>
|
5482 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_component_object_property_function_list">[up]</a>
|
@@ -5497,7 +5741,7 @@ by combining the <a href="#LOCATION">LOCATION</a> and <a href="#GEO">GEO</a> pro
|
|
5497 |
(only if <a href="#GEO">GEO</a> is set).
|
5498 |
</p>
|
5499 |
<p>
|
5500 |
-
To ease up usage,
|
5501 |
</p>
|
5502 |
<h5>Create LOCATION</h5>
|
5503 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -5514,7 +5758,7 @@ $str = $component->createLocation();
|
|
5514 |
<p class="format">calendarComponent::deleteProperty( "LOCATION" )</p>
|
5515 |
<p class="label">Example</p>
|
5516 |
<p class="example">
|
5517 |
-
$vevent->deleteProperty(
|
5518 |
|
5519 |
</p>
|
5520 |
<h5>Get LOCATION</h5>
|
@@ -5528,11 +5772,11 @@ $vevent->deleteProperty( kigkonsult\iCalcreator\util\util::$LOCATION );
|
|
5528 |
, "params" => param<sup>2</sup> )</p>
|
5529 |
<p class="label">Example</p>
|
5530 |
<p class="example">
|
5531 |
-
$location = $vevent->getProperty(
|
5532 |
|
5533 |
</p>
|
5534 |
<h5>Set LOCATION</h5>
|
5535 |
-
<p>
|
5536 |
<p>Parameters will be ordered as prescribed in [RFC5545].</p>
|
5537 |
<p class="label">Format</p>
|
5538 |
<p class="format">calendarComponent::setProperty( "location", location [, param] )</p>
|
@@ -5545,8 +5789,7 @@ xparams = (string) key => (string) value // <span class="comment">key prefi
|
|
5545 |
lang<sup>*</sup> = as defined in [RFC5546]</p>
|
5546 |
<p class="label">Example</p>
|
5547 |
<p class="example">
|
5548 |
-
$vevent->setProperty(
|
5549 |
-
"Buckingham Palace" );
|
5550 |
|
5551 |
</p>
|
5552 |
<br>
|
@@ -5563,7 +5806,7 @@ and MUST NOT occur more than once in <a href="#VEVENT">VEVENT</a>, <a href="#VTO
|
|
5563 |
<p>You can <a href="#sort2">SORT</a> <strong>calendar</strong> (components) on (asc) ORGANIZER values.</p>
|
5564 |
<p>You can export <strong>calendar</strong> ORGANIZER values as <a href="#iCal2vCards">vCards</a>.
|
5565 |
<p>
|
5566 |
-
To ease up usage,
|
5567 |
</p>
|
5568 |
<h5>Create ORGANIZER</h5>
|
5569 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -5580,7 +5823,7 @@ $str = $component->createOrganizer();
|
|
5580 |
<p class="format">calendarComponent::deleteProperty( "ORGANIZER" )</p>
|
5581 |
<p class="label">Example</p>
|
5582 |
<p class="example">
|
5583 |
-
$vevent->deleteProperty(
|
5584 |
|
5585 |
</p>
|
5586 |
<h5>Get ORGANIZER</h5>
|
@@ -5594,11 +5837,11 @@ $vevent->deleteProperty( kigkonsult\iCalcreator\util\util::$ORGANIZER );
|
|
5594 |
, "params" => params<sup>2</sup> )</p>
|
5595 |
<p class="label">Example</p>
|
5596 |
<p class="example">
|
5597 |
-
$organizer = $vevent->getProperty(
|
5598 |
|
5599 |
</p>
|
5600 |
<h5>Set ORGANIZER</h5>
|
5601 |
-
<p>
|
5602 |
Property value must be prefixed by protocol (ftp://, http://,mailto:, file:// ref. rfc 1738), "mailto:" prefixed if missing.
|
5603 |
Also DIR parameter must be prefixed by protocol.
|
5604 |
SENT-BY parameter must use protocol "mailto:", prefixed if missing.
|
@@ -5622,13 +5865,17 @@ lang<sup>*</sup> = as defined in [RFC5546]</p>
|
|
5622 |
<p class="label">Example</p>
|
5623 |
<p class="example">
|
5624 |
$dir = "ldap://domain.com:6666/o=3DDC%20Comp,c=3DUS??(cn=3DJohn%20Doe)";
|
5625 |
-
$vevent->setProperty(
|
5626 |
-
|
5627 |
-
|
5628 |
-
|
5629 |
-
|
5630 |
-
|
5631 |
-
|
|
|
|
|
|
|
|
|
5632 |
|
5633 |
</p>
|
5634 |
<br>
|
@@ -5648,7 +5895,7 @@ A value of "100" indicates that the <a href="#VTODO">VTODO</a> has been complete
|
|
5648 |
Integer values in between indicate the percent partially complete.
|
5649 |
</p>
|
5650 |
<p>
|
5651 |
-
To ease up usage,
|
5652 |
</p>
|
5653 |
<h5>Create PERCENT-COMPLETE</h5>
|
5654 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -5665,7 +5912,7 @@ $str = $component->createPercentComplete();
|
|
5665 |
<p class="format">calendarComponent::deleteProperty( "PERCENT-COMPLETE" )</p>
|
5666 |
<p class="label">Example</p>
|
5667 |
<p class="example">
|
5668 |
-
$vtodo->deleteProperty(
|
5669 |
|
5670 |
</p>
|
5671 |
<h5>Get PERCENT-COMPLETE</h5>
|
@@ -5679,11 +5926,11 @@ $vtodo->deleteProperty( kigkonsult\iCalcreator\util\util::$PERCENT_COMPLETE )
|
|
5679 |
, "params" => xparams<sup>2</sup> )</p>
|
5680 |
<p class="label">Example</p>
|
5681 |
<p class="example">
|
5682 |
-
$percent = $vtodo->getProperty(
|
5683 |
|
5684 |
</p>
|
5685 |
<h5>Set PERCENT-COMPLETE</h5>
|
5686 |
-
<p>
|
5687 |
<p class="label">Format</p>
|
5688 |
<p class="format">calendarComponent::setProperty( "Percent-Complete", percent [, xparams ] )</p>
|
5689 |
<p class="comment">percent<sup>1</sup> = (int) Value type INTEGER
|
@@ -5691,7 +5938,7 @@ xparams<sup>2</sup> = (array) ( *[ (string) key => (string) value ] ) // <spa
|
|
5691 |
</p>
|
5692 |
<p class="label">Example</p>
|
5693 |
<p class="example">
|
5694 |
-
$vtodo->setProperty(
|
5695 |
|
5696 |
</p>
|
5697 |
<br>
|
@@ -5713,7 +5960,7 @@ A value of nine (US-ASCII decimal 58) is the lowest priority.
|
|
5713 |
</p>
|
5714 |
<p>You can <a href="#sort2">SORT</a> <strong>calendar</strong> (components) on (asc) PRIORITY values.</p>
|
5715 |
<p>
|
5716 |
-
To ease up usage,
|
5717 |
</p>
|
5718 |
<h5>Create PRIORITY</h5>
|
5719 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -5730,7 +5977,7 @@ $str = $component->createPriority();
|
|
5730 |
<p class="format">calendarComponent::deleteProperty( "PRIORITY" )</p>
|
5731 |
<p class="label">Example</p>
|
5732 |
<p class="example">
|
5733 |
-
$vevent->deleteProperty(
|
5734 |
|
5735 |
</p>
|
5736 |
<h5>Get PRIORITY</h5>
|
@@ -5744,11 +5991,11 @@ $vevent->deleteProperty( kigkonsult\iCalcreator\util\util::$PRIORITY );
|
|
5744 |
, "params" => xparams<sup>2</sup> )</p>
|
5745 |
<p class="label">Example</p>
|
5746 |
<p class="example">
|
5747 |
-
$priority = $vevent->getProperty(
|
5748 |
|
5749 |
</p>
|
5750 |
<h5>Set PRIORITY</h5>
|
5751 |
-
<p>
|
5752 |
<p class="label">Format</p>
|
5753 |
<p class="format">calendarComponent::setProperty( "priority", priority [, xparams ] )</p>
|
5754 |
<p class="comment">priority<sup>1</sup> = (int) Value type INTEGER
|
@@ -5756,7 +6003,7 @@ xparams<sup>2</sup> = (array) ( *[ (string) key => (string) value ] ) // <sp
|
|
5756 |
</p>
|
5757 |
<p class="label">Example</p>
|
5758 |
<p class="example">
|
5759 |
-
$vevent->setProperty(
|
5760 |
|
5761 |
</p>
|
5762 |
<br>
|
@@ -5771,10 +6018,11 @@ more than once in <a href="#VEVENT">VEVENT</a>, <a href="#VTODO">VTODO</a>, <a h
|
|
5771 |
</p>
|
5772 |
<p>
|
5773 |
The default value type for RDATE is DATE-TIME, can be set to DATE or PERIOD (params<sup>2</sup>).
|
5774 |
-
In <a href="#VTIMEZONE">STANDARD</a> and <a href="#VTIMEZONE">DAYLIGHT</a> components,
|
|
|
5775 |
</p>
|
5776 |
<p>
|
5777 |
-
To ease up usage,
|
5778 |
</p>
|
5779 |
<h5>Create RDATE</h5>
|
5780 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
@@ -5792,7 +6040,7 @@ $str = $component->createRdate();
|
|
5792 |
<p class="label">Example 1</p>
|
5793 |
<p>Delete (single/first) RDATE property.</p>
|
5794 |
<p class="example">
|
5795 |
-
$vtodo->deleteProperty(
|
5796 |
|
5797 |
</p>
|
5798 |
<p class="label">Example 2</p>
|
@@ -5802,9 +6050,9 @@ $vjournal->deleteProperty( "RDATE", 2 );</p>
|
|
5802 |
<p class="label">Example 3</p>
|
5803 |
<p>Delete all RDATE properties.</p>
|
5804 |
<p class="example">
|
5805 |
-
while( $vjournal->deleteProperty(
|
5806 |
-
|
5807 |
-
|
5808 |
</p>
|
5809 |
<h5>Get RDATE</h5>
|
5810 |
<p>If set, returns property value, otherwise bool false.</p>
|
@@ -5822,15 +6070,15 @@ while( $vjournal->deleteProperty( kigkonsult\iCalcreator\util\util::$RDATE ))
|
|
5822 |
<p class="comment">Get propOrderNo RDATE</p>
|
5823 |
<p class="label">Example</p>
|
5824 |
<p class="example">
|
5825 |
-
$rdates = $vevent->getProperty(
|
5826 |
|
5827 |
</p>
|
5828 |
<h5>Set RDATE</h5>
|
5829 |
-
<p>
|
5830 |
<p>The value type for RDATE should match the <a href="#DTSTART">DTSTART</a> value type.</p>
|
5831 |
<p>
|
5832 |
If DATE value type is set in params ("VALUE" = "DATE"), all timezone or offset in dates are ignored.<br>
|
5833 |
-
If no "VALUE" value type is set
|
5834 |
</p>
|
5835 |
<p>
|
5836 |
If "TZID" is set in params,
|
@@ -5840,12 +6088,14 @@ If no "TZID" is set in params and timezone in 1st date, all remaining
|
|
5840 |
If none of the above rules are applicable, DATE-TIME and local date is set default.
|
5841 |
</p>
|
5842 |
<p>
|
5843 |
-
|
|
|
5844 |
</p>
|
5845 |
<p>RDATEs are automatically sorted in ascending order (Y-m-d[-H-i-s]).</p>
|
5846 |
<p>
|
5847 |
-
|
5848 |
a strong recommendation is to split a RDATE "list" into multiple single RDATE entries.
|
|
|
5849 |
</p>
|
5850 |
<p>Parameters will be ordered as prescribed in [RFC5545].</p>
|
5851 |
<p class="label">Format</p>
|
@@ -5854,13 +6104,12 @@ a strong recommendation is to split a RDATE "list" into multiple singl
|
|
5854 |
date2 = date / (array) ( startdate, enddate/duration )
|
5855 |
startdate = date
|
5856 |
enddate = date
|
5857 |
-
|
5858 |
-
|
5859 |
-
|
5860 |
-
|
5861 |
-
|
5862 |
-
|
5863 |
-
, tz ] )
|
5864 |
date = (array) ( "year" => (int) year
|
5865 |
, "month" => (int) month
|
5866 |
, "day" => (int) day
|
@@ -5868,13 +6117,34 @@ date = (array) ( "year" => (int) year
|
|
5868 |
, "min" => (int) min
|
5869 |
, "sec" => (int) sec
|
5870 |
[, "tz" => tz ]] )
|
5871 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5872 |
date = (array) ( "timestamp" => (int) timestamp [, "tz" => tz ] )
|
5873 |
-
|
5874 |
-
|
5875 |
tz = <timezone identifier> / offset
|
5876 |
-
|
5877 |
-
offset = (int) (+/-)HHmm[ss] // <span class="comment">(arr/str) local date + UTC offset
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5878 |
duration = (array) ( (int) week/false
|
5879 |
[, (int) day/false
|
5880 |
, (int) hour
|
@@ -5887,15 +6157,19 @@ duration = (array) ([ "week" => (int) week / false ,] /
|
|
5887 |
, "sec" => (int) sec ]] );
|
5888 |
// <span class="comment">output format, only used keys</span>
|
5889 |
duration = (array) ( "sec" => (int) sec );
|
5890 |
-
|
5891 |
params<sup>2</sup> = ([tzidparam ( / datetimeparam / dateparam / periodparam )] *[, xparams ] )
|
5892 |
-
tzidparam =
|
5893 |
-
|
5894 |
-
|
5895 |
-
|
5896 |
-
|
5897 |
-
|
5898 |
-
|
|
|
|
|
|
|
|
|
5899 |
xparams = (string) key => (string) value // <span class="comment">key prefix "X-"</span>
|
5900 |
propOrderNo = (int) order number // <span class="comment">1=1st, 2=2nd etc</span>
|
5901 |
<br>date/datetime string<sup>*</sup> recommended formats
|
@@ -5908,62 +6182,80 @@ propOrderNo = (int) order number // <span class="comment">1=1st, 2
|
|
5908 |
other string formats, acceptable by <em>PHP</em> strtotime function, may (would) work
|
5909 |
<span class="comment">(notice <a href="#date_restriction">date restriction</a>)</span></p>
|
5910 |
<p class="label">Example</p>
|
5911 |
-
See rules in detail in <a href="
|
5912 |
-
<p class="example">
|
5913 |
-
|
5914 |
-
|
5915 |
-
$
|
5916 |
-
"month" => 1,
|
5917 |
-
"day" => 1,
|
5918 |
-
"hour" => 1,
|
5919 |
-
"min" => 1,
|
5920 |
-
"sec" => 1,
|
5921 |
-
"tz" => "GMT" );
|
5922 |
-
$rdate2 = array( 2002, 2, 2, 2, 2, 2, "GMT" );
|
5923 |
-
$rdate3 = "3 March 2003 03.03.03";
|
5924 |
-
$rdate4 = array( 2004, 4, 4, 4, 4, 4, "GMT" );
|
5925 |
-
$rdate5 = array( 2005, 10, 5, 5, 5, 5 );
|
5926 |
-
$rdate8 = array( "year" => 2007, "month" => 7, "day" => 7 );
|
5927 |
-
$rdur6 = array( "week" => 0,
|
5928 |
-
"day" => 0,
|
5929 |
-
"hour" => 5,
|
5930 |
-
"min" => 5,
|
5931 |
-
"sec" => 5 );
|
5932 |
-
$rdur7 = array( 0, 0, 6 );
|
5933 |
-
<span class="comment">// duration for 6 hours</span>
|
5934 |
-
$rdur8 = array( "week" => 8 );
|
5935 |
-
<span class="comment">// duration for 8 weeks</span>
|
5936 |
-
|
5937 |
-
$vevent = $vcalendar->newComponent( kigkonsult\iCalcreator\util\util::$LCVEVENT );
|
5938 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$RDATE,
|
5939 |
-
array( $rdate1 ));
|
5940 |
-
<span class="comment">// one recurrence date, date in 7-params format (DATE-TIME)</span>
|
5941 |
-
|
5942 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$RDATE,
|
5943 |
-
array( $rdate1, $rdate2 ));
|
5944 |
-
<span class="comment">// two dates, date 7-params format (DATE-TIME)</span>
|
5945 |
-
|
5946 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$RDATE,
|
5947 |
-
array( array( $rdate1, $rdate2 ),
|
5948 |
-
array( $rdate3, $rdate4 )),
|
5949 |
-
array( "VALUE" => "PERIOD" ));
|
5950 |
-
<span class="comment">// Both fromdate and enddate must have 7 params (DATE-TIME) !!!</span>
|
5951 |
-
|
5952 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$RDATE,
|
5953 |
-
array( array( $rdate2, $rdur6 )),
|
5954 |
-
array( "VALUE" => "PERIOD" ));
|
5955 |
-
<span class="comment">// one duration (fromdate-duration)</span>
|
5956 |
-
|
5957 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$RDATE,
|
5958 |
-
array( array( $rdate1, $date2 ),
|
5959 |
-
array( $rdate3, $rdur7 )),
|
5960 |
-
array( "VALUE" => "PERIOD" ));
|
5961 |
-
<span class="comment">// period, pairs of fromdate+enddate and fromdate-duration</span>
|
5962 |
-
|
5963 |
-
$vevent->setProperty( kigkonsult\iCalcreator\util\util::$RDATE,
|
5964 |
-
array( $rdate5, $date8 )),
|
5965 |
-
array( "VALUE" => "DATE" ));
|
5966 |
-
<span class="comment">// dates in DATE format</span>
|
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
|
2 |
<!--
|
3 |
+
iCalcreator, the PHP class package managing iCal (rfc2445/rfc5445) calendar information.
|
4 |
+
|
5 |
+
This file is a part of iCalcreator.
|
6 |
+
|
7 |
+
copyright (c) 2007-2019 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
8 |
+
Link https://kigkonsult.se
|
9 |
+
Package iCalcreator
|
10 |
+
Version 2.26.8
|
11 |
+
License Subject matter of licence is the software iCalcreator.
|
12 |
+
The above copyright, link, package and version notices,
|
13 |
+
this licence notice and the invariant [rfc5545] PRODID result use
|
14 |
+
as implemented and invoked in iCalcreator shall be included in
|
15 |
+
all copies or substantial portions of the iCalcreator.
|
16 |
+
|
17 |
+
iCalcreator is free software: you can redistribute it and/or modify
|
18 |
+
it under the terms of the GNU Lesser General Public License as published
|
19 |
+
by the Free Software Foundation, either version 3 of the License,
|
20 |
+
or (at your option) any later version.
|
21 |
+
|
22 |
+
iCalcreator is distributed in the hope that it will be useful,
|
23 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
25 |
+
GNU Lesser General Public License for more details.
|
26 |
+
|
27 |
+
You should have received a copy of the GNU Lesser General Public License
|
28 |
+
along with iCalcreator. If not, see <https://www.gnu.org/licenses/>.
|
|
|
29 |
-->
|
30 |
<html>
|
31 |
<head>
|
32 |
+
<title>iCalcreator 2.26.8 manual</title>
|
33 |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
34 |
<meta name="author" content="Kjell-Inge Gustafsson, kigkonsult, All rights reserved">
|
35 |
+
<meta name="copyright" content="2007-2019 Kjell-Inge Gustafsson, kigkonsult">
|
36 |
+
<meta name="keywords" content="ical, calendar, calendar, xcal, xml, icalendar, rfc2445, rfc5545, vcalendar, php, create">
|
37 |
+
<meta name="description" content="using iCalcreator v2.26.8">
|
38 |
<style type="text/css">
|
39 |
* {
|
40 |
FONT-FAMILY : "Bitstream Vera Sans", Helvetica, "Lucida Grande","Lucida Sans Unicode", Lucida, Arial, Geneva, sans-serif;
|
165 |
</head>
|
166 |
<body>
|
167 |
<a name="top"></a>
|
168 |
+
<p class="header">iCalcreator v2.26.8</p>
|
169 |
<p>
|
170 |
+
iCalcreator v2.26.8<br>
|
171 |
+
Copyright © 2007-2019 Kjell-Inge Gustafsson, kigkonsult, All rights reserved.<br>
|
172 |
<a href="http://kigkonsult.se/iCalcreator/index.php" title="kigkonsult.se/iCalcreator" target="_blank">kigkonsult.se iCalcreator</a><br>
|
173 |
+
Contact : iCal_at_kigkonsult_dot_se
|
174 |
</p>
|
175 |
|
176 |
<h2>Preface</h2>
|
177 |
<p>
|
178 |
+
This document describes usage of iCalcreator, the <em>PHP</em> software implementation of standards
|
179 |
+
<a href="https://tools.ietf.org/html/rfc5545" title="Download RFC5545 in text format" target="_blank">rfc5545</a>/
|
180 |
+
<a href="https://tools.ietf.org/html/rfc5546" title="Download RFC5546 in text format" target="_blank">rfc5546</a>
|
181 |
+
(rfc2445/rfc2446) to manage iCal formatted files.
|
182 |
</p>
|
183 |
<p>
|
184 |
This document is provided by kigkonsult for informational purposes
|
203 |
<p>
|
204 |
This document makes previous versions obsolete.
|
205 |
</p>
|
206 |
+
<a href="#INDEX">[index]</a>
|
207 |
|
208 |
<a name="INTRO"></a><h1>1 INTRO</h1>
|
209 |
<p>
|
210 |
+
iCalcreator is a <em>PHP</em> class package managing iCal files, supporting (non-)calendar
|
211 |
+
systems and applications to process and communicate calendar information like
|
212 |
events, agendas, tasks, reports, totos and journaling information.
|
213 |
</p>
|
214 |
<p>
|
217 |
iCalcreator features create, parse, edit and select <strong>calendar</strong> and <strong>calendar</strong> components.
|
218 |
</p>
|
219 |
<p>
|
220 |
+
For iCalcreator 2.26.8 version (and later), <em>PHP</em> version >= 5.6 is required.
|
221 |
</p>
|
222 |
<br>
|
223 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a>
|
233 |
The <strong>iCalendar</strong> format, <strong>iCal</strong>, are described in
|
234 |
</p>
|
235 |
<dl>
|
236 |
+
<dt><a href="https://tools.ietf.org/html/rfc5545" title="Download RFC5545 in text format" target="_blank">rfc5545</a>
|
237 |
<dd>"Internet Calendaring and Scheduling Core Object Specification (<strong>iCalendar</strong>)"
|
238 |
+
<dt><a href="https://tools.ietf.org/html/rfc5546" title="Download RFC5546 in text format" target="_blank">rfc5546</a>
|
239 |
<dd>"iCalendar Transport-Independent Interoperability Protocol (iTIP)"<br>Scheduling Events, BusyTime, To-dos and Journal Entries
|
240 |
<p class="quotes">. ..allows for the capture and exchange of information normally stored
|
241 |
within a calendaring and scheduling application.</p>
|
242 |
and
|
243 |
<p class="quotes">. ..is an exchange format between applications or systems.</p>
|
244 |
</dl>
|
245 |
+
<p><a href="https://tools.ietf.org/html/rfc5545" title="Download RFC5545 in text format" target="_blank">rfc5545</a> and
|
246 |
+
<a href="https://tools.ietf.org/html/rfc5546" title="Download RFC5546 in text format" target="_blank">rfc5546</a>
|
247 |
obsoletes, respectively,
|
248 |
+
<a href="https://tools.ietf.org/html/rfc2445" title="Download RFC2445 in text format" target="_blank">rfc2445</a> and
|
249 |
+
<a href="https://tools.ietf.org/html/rfc2446" title="Download RFC2446 in text format" target="_blank">rfc2446</a>.
|
250 |
</p>
|
251 |
<p>
|
252 |
Any references to rfc2445, below, corresponds to rfc5545.
|
255 |
<h4>xCal</h4>
|
256 |
<p>
|
257 |
iCalcreator also supports xCal (iCal xml),
|
258 |
+
<a href="https://tools.ietf.org/html/rfc6321" title="Download RFC6321 in text format" target="_blank">rfc6321</a>,
|
259 |
The XML Format for <strong>iCalendar</strong>.
|
260 |
</p>
|
261 |
<p>
|
301 |
|
302 |
<a name="Support"></a><h2>1.4 Support</h2>
|
303 |
<p>
|
304 |
+
For support report, use <a href="https://github.com/iCalcreator/iCalcreator/issues" title="kigkonsult.se issues" target="_blank"> github issues</a>.
|
305 |
</p>
|
306 |
<p>
|
307 |
+
For non emergency issues, support upon (paid) request only.
|
|
|
|
|
|
|
|
|
|
|
308 |
</p>
|
309 |
<p>
|
310 |
+
kigkonsult offer professional services for software support, design and new/re-development and unit tests
|
311 |
+
of <em>PHP</em>/<em>MySQL</em> solutions with focus on software lifecycle management, including long term utility, reliability and maintainability.
|
312 |
</p>
|
313 |
|
314 |
<br>
|
333 |
<dl>
|
334 |
<dt>Composer (https://getcomposer.org/)
|
335 |
<dd>
|
336 |
+
<dd>composer require kigkonsult/icalcreator
|
337 |
<dd>
|
338 |
<dt>Or
|
339 |
<dd> include the (download) iCalcreator folder to your include-path
|
340 |
<dd>Add
|
341 |
+
<dd><span class="format">require_once "[path/]iCalcreator-2.26.8/autoload.php";</span>
|
342 |
<dd>to your <em>PHP</em>-script.
|
343 |
<dd>The iCalcreator invoker has changed since previous version!
|
344 |
</dl>
|
345 |
<p>
|
346 |
+
iCalcreator 2.26.8 is using namespace "Kigkonsult\Icalcreator".
|
347 |
</p>
|
348 |
<p>
|
349 |
You may need to set the default timezone.
|
350 |
+
When creating a new Vcalendar/component instance, review <a href="#iCalcreator_configuration_methods">config</a> settings.
|
351 |
</p>
|
352 |
<p>
|
353 |
There are free iCal icons (use as buttons on a web page?) to download
|
358 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a>
|
359 |
|
360 |
|
361 |
+
<a name="Release_plan"></a><h2>1.7 Release plan</h2>
|
362 |
+
<p>
|
363 |
+
A brief release plan, changable...<br>
|
364 |
+
Bugs are fixed as soon as possible upon priority or severity.
|
365 |
+
<dl>
|
366 |
+
<dt>v2.28</dt>
|
367 |
+
<dd>Exception error management</dd>
|
368 |
+
<dd> </dd>
|
369 |
+
<dd>Method chaining, appropriate methods like set-methods etc where relevant</dd>
|
370 |
+
<dd> </dd>
|
371 |
+
<dt>v2.30</dt>
|
372 |
+
<dd>Removal of all set-methods date(time)/interval array arguments<br>
|
373 |
+
as well as (most) get-methods return date(time)/interval array formats</dd>
|
374 |
+
<dd> </dd>
|
375 |
+
<dd>Alter<br>
|
376 |
+
- Vcalendar::parse()<br>
|
377 |
+
only string allowed, removing internal iCal file/url parse method</dd>
|
378 |
+
<dd> </dd>
|
379 |
+
<dd>Replacing methods<br>
|
380 |
+
- Vcalendar::saveCalendar()<br>
|
381 |
+
- Vcalendar::returnCalendar()<br>
|
382 |
+
- Vcalendar::useCachedCalendar()<br>
|
383 |
+
by new external iCal file/url acquire/dispose handler(s)
|
384 |
+
</dd>
|
385 |
+
</dl>
|
386 |
+
<br>
|
387 |
+
<a href="#INDEX">[index]</a> <a href="#top">[top]</a>
|
388 |
+
|
389 |
+
|
390 |
+
<a name="Additional_Descriptors"></a><h2>1.8 Additional Descriptors</h2>
|
391 |
<p>Some properties (ex. as described in
|
392 |
<a href="http://en.wikipedia.org/wiki/ICalendar#Calendar_extensions" title="http://en.wikipedia.org/wiki/ICalendar#Calendar_extensions" target="_blank">wikipedia:iCal</a>)
|
393 |
may be required when importing iCal files into some calendaring software (MS etc). Also <a href="#X-PROPERTY">X-properties</a> may appear in exports. Below are examples</p>
|
404 |
<dt>on component level in a <a href="#VTIMEZONE">vtimezone</a> component
|
405 |
<dd><a href="#X-PROPERTY">X-LIC-LOCATION</a> x-property
|
406 |
</dl>
|
407 |
+
<p>
|
408 |
<sup>*</sup>
|
409 |
Created automatically in iCalcreator, if not set.
|
410 |
+
<p>
|
411 |
+
To ease up usage,<br>
|
412 |
+
Kigkonsult\Icalcreator\Util\Util::$X_WR_CALNAME ('X-WR-CALNAME'),<br>
|
413 |
+
Kigkonsult\Icalcreator\Util\Util::$X_WR_CALDESC (X-WR-CALDESC'),<br>
|
414 |
+
Kigkonsult\Icalcreator\Util\Util::$X_WR_RELCALID (X-WR-RELCALID'),<br>
|
415 |
+
Kigkonsult\Icalcreator\Util\Util::$X_WR_TIMEZONE (X-WR-TIMEZONE'),<br>
|
416 |
+
Kigkonsult\Icalcreator\Util\Util::$X_LIC_LOCATION (X-LIC-LOCATION')<br>
|
417 |
+
as used in code snippets (below) are available.
|
418 |
+
</p>
|
419 |
+
|
420 |
<p class="label">Example</p>
|
421 |
<p>
|
422 |
+
A strong recommendation is also to set config <a href="#Unique_id">unique_id</a> when creating a new Vcalendar/component instance,
|
423 |
+
to ensure accurate setting of all components <a href="#UID">UID</a> property, also before <a href="#parse_merge">parse</a>.
|
424 |
Also setting of config timezone ("TZID" and "X-WR-TIMEZONE" below) is to recommend.
|
425 |
</p>
|
426 |
<p class="example">
|
427 |
+
$config = [
|
428 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
429 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
430 |
+
];
|
431 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
432 |
+
$vcalendar->setProperty(
|
433 |
+
Kigkonsult\Icalcreator\Util\Util::$METHOD,
|
434 |
+
"PUBLISH"
|
435 |
+
);
|
436 |
+
$vcalendar->setProperty(
|
437 |
+
Kigkonsult\Icalcreator\Util\Util::$X_WR_CALNAME,
|
438 |
+
"Calendar Sample"
|
439 |
+
);
|
440 |
+
$vcalendar->setProperty(
|
441 |
+
Kigkonsult\Icalcreator\Util\Util::$X_WR_CALDESC,
|
442 |
+
"Calendar Description"
|
443 |
+
);
|
444 |
+
$vcalendar->setProperty(
|
445 |
+
Kigkonsult\Icalcreator\Util\Util::$X_WR_RELCALID,
|
446 |
+
"3E26604A-50F4-4449-8B3E-E4F4932D05B5"
|
447 |
+
);
|
448 |
+
$vcalendar->setProperty(
|
449 |
+
Kigkonsult\Icalcreator\Util\Util::$X_WR_TIMEZONE,
|
450 |
+
"Europe/Stockholm"
|
451 |
+
);
|
452 |
|
453 |
</p>
|
454 |
|
466 |
<a href="#Support">1.4 Support</a><br>
|
467 |
<a href="#Donate">1.5 Donate</a><br>
|
468 |
<a href="#INSTALL">1.6 Install</a><br>
|
469 |
+
<a name="#Release_plan">1.7 Release plan</a><br>
|
470 |
+
<a href="#Additional_Descriptors">1.8 Additional_Descriptors</a><br>
|
471 |
<a href="#INDEX">1.9 INDEX</a><br>
|
472 |
<br>
|
473 |
<a href="#Calendar_Component_list">2 Calendar Component list</a><br>
|
483 |
<br>
|
484 |
<a href="#Function_list">3 Function list</a><br>
|
485 |
<br>
|
486 |
+
<a href="#iCalcreator_object_methods">3.1 Vcalendar methods</a><br>
|
487 |
<br>
|
488 |
<a href="#Calendar_object_constructors">3.1.1 Constructors</a><br>
|
489 |
+
<a href="#vcalendar_constr">3.1.1.1 Vcalendar</a><br>
|
490 |
+
<a href="#vevent_constr">3.1.1.2 Vevent</a><br>
|
491 |
+
<a href="#vtodo_constr">3.1.1.3 Vtodo</a><br>
|
492 |
+
<a href="#vjournal_constr">3.1.1.4 Vjournal</a><br>
|
493 |
+
<a href="#vfreebusy_constr">3.1.1.5 Vfreebusy</a><br>
|
494 |
+
<a href="#valarm_constr">3.1.1.6 Valarm</a><br>
|
495 |
+
<a href="#vtimezone_constr">3.1.1.7 Vtimezone</a><br>
|
496 |
+
<a href="#standard_daylight_constr">3.1.1.8 Standard / Daylight</a><br>
|
497 |
+
<br>
|
498 |
+
<a href="#iCalcreator_object_property_methods">3.1.2 Vcalendar property methods</a><br>
|
499 |
<a href="#deleteProperty">3.1.2.1 deleteProperty</a><br>
|
500 |
<a href="#getProperty">3.1.2.2 getProperty</a><br>
|
501 |
<a href="#setProperty">3.1.2.3 setProperty</a><br>
|
504 |
<a href="#VERSION">3.1.2.6 VERSION</a><br>
|
505 |
<a href="#X-PROPERTY">3.1.2.7 X-PROPERTY</a><br>
|
506 |
<br>
|
507 |
+
<a href="#iCalcreator_component_object_methods">3.1.3 Vcalendar component object methods</a><br>
|
508 |
<a href="#deleteComponent">3.1.3.1 deleteComponent</a><br>
|
509 |
<a href="#getComponent">3.1.3.2 getComponent</a><br>
|
510 |
<a href="#newComponent">3.1.3.3 newComponent</a><br>
|
512 |
<a href="#selectComponents">3.1.3.5 selectComponents</a><br>
|
513 |
<a href="#setComponent">3.1.3.6 setComponent</a><br>
|
514 |
<br>
|
515 |
+
<a href="#iCalcreator_calendar_methods">3.1.4 Vcalendar calendar methods</a><br>
|
516 |
<a href="#parse_merge">3.1.4.1 parse and merge</a><br>
|
517 |
<a href="#createCalendar">3.1.4.2 createCalendar</a><br>
|
518 |
<a href="#returnCalendar">3.1.4.3 returnCalendar</a><br>
|
521 |
<a href="#useCachedCalendar">3.1.4.6 useCachedCalendar</a><br>
|
522 |
<a href="#iCalcreatorVersion">3.1.4.7 iCalcreatorVersion</a><br>
|
523 |
<br>
|
524 |
+
<a href="#iCalcreator_configuration_methods">3.1.5 Vcalendar configuration</a><br>
|
525 |
<a href="#configKeys">3.1.5.1 configuration keys</a><br>
|
526 |
<a href="#getConfig">3.1.5.2 getConfig</a><br>
|
527 |
<a href="#initConfig">3.1.5.3 calendar/component initialization</a><br>
|
540 |
<a href="#Unique_id">3.1.5.16 Unique_id</a><br>
|
541 |
<a href="#configURL">3.1.5.17 URL</a><br>
|
542 |
<br>
|
543 |
+
<a href="#Calendar_component_object_property_function_list">3.2 Component property methods</a><br>
|
544 |
<a href="#deleteProperty_PROP">3.2.1 deleteProperty</a><br>
|
545 |
<a href="#getProperty_PROP">3.2.2 getProperty</a><br>
|
546 |
<a href="#parse">3.2.3 parse</a><br>
|
653 |
<br>
|
654 |
<a href="#TimezoneXMLjsonvCard">4 Timezone, XML, json and vCard support</a><br>
|
655 |
<a href="#timezoneHandler">4.1 iCalcreator and timezoneHandler class</a><br>
|
656 |
+
<a href="#createTimezone">4.1.1 createTimezone</a><br>
|
657 |
<a href="#ms2phpTZ">4.1.2 ms2phpTZ</a><br>
|
658 |
<a href="#transformDateTime">4.1.3 transformDateTime</a><br>
|
659 |
<a href="#TZhelpers">4.2 Timezone helper functions</a><br>
|
673 |
|
674 |
<a name="Calendar_Component_list"></a><h1>2 Calendar Component list</h1>
|
675 |
<p>
|
676 |
+
To ease up usage, You will find convenient holders for
|
677 |
+
properties and config keys etc in top of the "util" class file (src/util/util.php),
|
678 |
used in code snippets.
|
679 |
</p>
|
680 |
<p>
|
681 |
+
Quote from <a href="https://tools.ietf.org/html/rfc2445" title="RFC2445" target="_blank">RFC2445</a>
|
682 |
- Internet Calendaring and Scheduling Core Object Specification (<strong>iCalendar</strong>)!
|
683 |
</p>
|
684 |
<a name="VCALENDAR"></a><h2>2.1 VCALENDAR</h2>
|
1339 |
<p>
|
1340 |
If not set, the <a href="#DTSTAMP">DTSTAMP</a> and <a href="#UID">UID</a> properties
|
1341 |
are automatically created by iCalcreator<br>
|
1342 |
+
for <a href="#VEVENT">vevent</a>,
|
1343 |
+
<a href="#VTODO">vtodo</a>,
|
1344 |
+
<a href="#VJOURNAL">vjournal</a> and
|
1345 |
+
<a href="#VFREEBUSY">vfreebusy</a> components<br>
|
1346 |
+
when using Vcalendar methods <a href="#saveCalendar">saveCalendar</a> (or <a href="#returnCalendar">returnCalendar</a>)<br>
|
1347 |
+
or when fetching <a href="#DTSTAMP">DTSTAMP</a>/<a href="#UID">UID</a>
|
1348 |
+
property value with the component method <a href="#getProperty_PROP">getProperty</a>.
|
1349 |
</p>
|
1350 |
<br>
|
1351 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_Component_list">[up]</a>
|
1352 |
|
1353 |
<a name="Function_list"></a><h1>3 Function list</h1>
|
1354 |
|
1355 |
+
<a name="iCalcreator_object_methods"></a><h2>3.1 Vcalendar methods</h2>
|
1356 |
|
1357 |
<a name="Calendar_object_constructors"></a><h3>3.1.1 Constructors</h3>
|
1358 |
+
<a name="vcalendar_constr"></a><h4>3.1.1.1 Vcalendar</h4>
|
1359 |
<p>Create a new <a href="#VCALENDAR">VCALENDAR</a> object.</p>
|
1360 |
<p class="label">Format</p>
|
1361 |
<p class="format">vcalendar::vcalendar( [ config ] )</p>
|
1364 |
</p>
|
1365 |
<p class="label">Basic example</p>
|
1366 |
<p class="example">
|
1367 |
+
$config = [ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se" ];
|
1368 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1369 |
|
1370 |
</p>
|
1371 |
<p>
|
1375 |
<p class="label">Extended example</p>
|
1376 |
<p class="example">
|
1377 |
$tz = "Europe/Stockholm"
|
1378 |
+
$config = [
|
1379 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se"
|
1380 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => $tz
|
1381 |
+
];
|
1382 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1383 |
+
$vcalendar->setProperty( "X-WR-TIMEZONE", $tz );
|
1384 |
|
1385 |
// <span class="comment">insert components or parse an iCal file (and edit components)</span>
|
1386 |
|
1387 |
+
$xprops = [ Kigkonsult\Icalcreator\Util\Util::$X_LIC_LOCATION => $tz ];
|
1388 |
+
kigkonsult\iCalcreator\TimezoneHandler::createTimezone( $vcalendar, $tz, $xprops );
|
|
|
|
|
1389 |
|
1390 |
</p>
|
1391 |
<p>
|
1396 |
<p>
|
1397 |
Some <strong>calendar</strong> software may also require calendar property <a href="#Additional_Descriptors">X-WR-TIMEZONE</a>
|
1398 |
and vtimezone component with property <a href="#Additional_Descriptors">X-LIC-LOCATION</a>,
|
1399 |
+
review <a href="#createTimezone">createTimezone</a>, a method in the TimezoneHandler class.
|
1400 |
</p>
|
1401 |
<p>
|
1402 |
Do <b>NOT</b> set <a href="#Directory">directory</a>/<a href="#Filename">filename</a> in vcalendar constructor,
|
1406 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Function_list">[up]</a>
|
1407 |
|
1408 |
|
1409 |
+
<a name="vevent_constr"></a><h4>3.1.1.2 Vevent</h4>
|
1410 |
<p class="label">Format 1</p>
|
1411 |
<p>
|
1412 |
+
Create a new <a href="#VEVENT">VEVENT</a> object using an Vcalendar component factory-method,
|
1413 |
returning a reference to the new component.
|
1414 |
</p>
|
1415 |
<p>
|
1416 |
+
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::VEVENT as used in code snippets is available.
|
1417 |
</p>
|
1418 |
|
1419 |
<p class="format">vcalendar::newComponent( "vevent" )</p>
|
1420 |
<p class="label">Example</p>
|
1421 |
<p class="example">
|
1422 |
+
$config = [
|
1423 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1424 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1425 |
+
];
|
1426 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1427 |
|
1428 |
+
$vevent = $vcalendar->newComponent( Kigkonsult\Icalcreator\Vcalendar::VEVENT );
|
1429 |
$vevent->setProperty( .. .
|
1430 |
</p>
|
1431 |
<p>
|
1434 |
<p class="format">vcalendar::newVevent()</p>
|
1435 |
<p class="label">Example</p>
|
1436 |
<p class="example">
|
1437 |
+
$config = [
|
1438 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1439 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1440 |
+
];
|
1441 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1442 |
|
1443 |
$vevent = $vcalendar->newVevent();
|
1444 |
$vevent->setProperty( .. .
|
1452 |
</p>
|
1453 |
<p class="label">Example</p>
|
1454 |
<p class="example">
|
1455 |
+
$config = [
|
1456 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1457 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1458 |
+
];
|
1459 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1460 |
|
1461 |
$config = $vcalendar->getConfig();
|
1462 |
+
$vevent = new Kigkonsult\Icalcreator\Vevent( $config );
|
1463 |
$vevent->setProperty( .. .
|
1464 |
|
1465 |
$vcalendar->setComponent( $vevent );
|
1469 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Function_list">[up]</a>
|
1470 |
|
1471 |
|
1472 |
+
<a name="vtodo_constr"></a><h4>3.1.1.3 Vtodo</h4>
|
1473 |
<p class="label">Format 1</p>
|
1474 |
<p>
|
1475 |
+
Create a new <a href="#VTODO">VTODO</a> object using an Vcalendar component factory-method,
|
1476 |
returning a reference to the new component.
|
1477 |
</p>
|
1478 |
<p>
|
1479 |
+
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::VTODO as used in code snippets is available.
|
1480 |
</p>
|
1481 |
<p class="format">vcalendar::newComponent( "vtodo" )</p>
|
1482 |
<p class="label">Example</p>
|
1483 |
<p class="example">
|
1484 |
+
$config = [
|
1485 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1486 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1487 |
+
];
|
1488 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1489 |
|
1490 |
+
$vtodo = $vcalendar->newComponent( Kigkonsult\Icalcreator\Vcalendar::VTODO );
|
1491 |
$vtodo->setProperty( .. .
|
1492 |
|
1493 |
</p>
|
1497 |
<p class="format">vcalendar::newVtodo()</p>
|
1498 |
<p class="label">Example</p>
|
1499 |
<p class="example">
|
1500 |
+
$config = [
|
1501 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1502 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1503 |
+
];
|
1504 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1505 |
|
1506 |
$vtodo = $vcalendar->newVtodo();
|
1507 |
$vtodo->setProperty( .. .
|
1516 |
</p>
|
1517 |
<p class="label">Example</p>
|
1518 |
<p class="example">
|
1519 |
+
$config = [
|
1520 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1521 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1522 |
+
];
|
1523 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1524 |
|
1525 |
+
$vtodo = new Kigkonsult\Icalcreator\Vtodo( $vcalendar->getConfig());
|
1526 |
$vtodo->setProperty( .. .
|
1527 |
|
1528 |
$vcalendar->setComponent( $vtodo );
|
1532 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Function_list">[up]</a>
|
1533 |
|
1534 |
|
1535 |
+
<a name="vjournal_constr"></a><h4>3.1.1.4 Vjournal</h4>
|
1536 |
<p class="label">Format 1</p>
|
1537 |
<p>
|
1538 |
+
Create a new <a href="#VJOURNAL">VJOURNAL</a> object using an Vcalendar factory-method,
|
1539 |
returning a reference to the new component.
|
1540 |
</p>
|
1541 |
<p>
|
1542 |
+
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::VJOURNAL as used in code snippets is available.
|
1543 |
</p>
|
1544 |
<p class="format">vcalendar::newComponent( "vjournal" )</p>
|
1545 |
<p class="label">Example</p>
|
1546 |
<p class="example">
|
1547 |
+
$config = [
|
1548 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1549 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1550 |
+
];
|
1551 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1552 |
|
1553 |
+
$vjournal = $vcalendar->newComponent( Kigkonsult\Icalcreator\Vcalendar::VJOURNAL );
|
1554 |
$vjournal->setProperty( .. .
|
1555 |
|
1556 |
</p>
|
1560 |
<p class="format">vcalendar::newVjournal()</p>
|
1561 |
<p class="label">Example</p>
|
1562 |
<p class="example">
|
1563 |
+
$config = [
|
1564 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1565 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1566 |
+
];
|
1567 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1568 |
|
1569 |
$vjournal = $vcalendar->newVjournal();
|
1570 |
$vjournal->setProperty( .. .
|
1579 |
</p>
|
1580 |
<p class="label">Example</p>
|
1581 |
<p class="example">
|
1582 |
+
$config = [
|
1583 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1584 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1585 |
+
];
|
1586 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1587 |
|
1588 |
+
$vjournal = new Kigkonsult\Icalcreator\Vjournal( $vcalendar->getConfig());
|
1589 |
$vjournal->setProperty( .. .
|
1590 |
|
1591 |
$vcalendar->setComponent( $vjournal );
|
1595 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Function_list">[up]</a>
|
1596 |
|
1597 |
|
1598 |
+
<a name="vfreebusy_constr"></a><h4>3.1.1.5 Vfreebusy</h4>
|
1599 |
<p class="label">Format 1</p>
|
1600 |
<p>
|
1601 |
+
Create a new <a href="#VFREEBUSY">VFREEBUSY</a> object using an Vcalendar factory-method,
|
1602 |
returning a reference to the new component.
|
1603 |
</p>
|
1604 |
<p>
|
1605 |
+
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::VFREEBUSY as used in code snippets is available.
|
1606 |
</p>
|
1607 |
<p class="format">vcalendar::newComponent( "vfreebusy" )</p>
|
1608 |
<p class="label">Example</p>
|
1609 |
<p class="example">
|
1610 |
+
$config = [
|
1611 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1612 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1613 |
+
];
|
1614 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1615 |
|
1616 |
+
$vfreebusy = $vcalendar->newComponent( Kigkonsult\Icalcreator\Vcalendar::VFREEBUSY );
|
1617 |
$vfreebusy->setProperty( .. .
|
1618 |
|
1619 |
</p>
|
1623 |
<p class="format">vcalendar::newVfreebusy()</p>
|
1624 |
<p class="label">Example</p>
|
1625 |
<p class="example">
|
1626 |
+
$config = [
|
1627 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1628 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1629 |
+
];
|
1630 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1631 |
|
1632 |
$vfreebusy = $vcalendar->newVfreebusy();
|
1633 |
$vfreebusy->setProperty( .. .
|
1642 |
</p>
|
1643 |
<p class="label">Example</p>
|
1644 |
<p class="example">
|
1645 |
+
$config = [
|
1646 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1647 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1648 |
+
];
|
1649 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1650 |
|
1651 |
+
$vfreebusy = new Kigkonsult\Icalcreator\Vfreebusy( $vcalendar->getConfig());
|
1652 |
$vfreebusy->setProperty( .. .
|
1653 |
|
1654 |
$vcalendar->setComponent( $vfreebusy );
|
1658 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Function_list">[up]</a>
|
1659 |
|
1660 |
|
1661 |
+
<a name="valarm_constr"></a><h4>3.1.1.6 Valarm</h4>
|
1662 |
<p class="label">Format 1</p>
|
1663 |
<p>
|
1664 |
+
Create a new <a href="#VALARM">VALARM</a> object using an Vcalendar component factory-method,
|
1665 |
returning a reference to the new (sub-)component.
|
1666 |
The <a href="#VALARM">VALARM</a> calendar component MUST only appear (one or more, mutually independent)
|
1667 |
within either a <a href="#VEVENT">VEVENT</a> or <a href="#VTODO">VTODO</a> calendar component.
|
1668 |
</p>
|
1669 |
<p>
|
1670 |
+
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::VALARM as used in code snippets is available.
|
1671 |
</p>
|
1672 |
<p class="format">calendarComponent::newComponent( "valarm" )</p>
|
1673 |
<p class="label">Example</p>
|
1674 |
<p class="example">
|
1675 |
+
$config = [
|
1676 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1677 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1678 |
+
];
|
1679 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1680 |
|
1681 |
+
$vevent = $vcalendar->newComponent( Kigkonsult\Icalcreator\Vcalendar::VEVENT );
|
1682 |
$vevent->setProperty( .. .
|
1683 |
|
1684 |
+
$valarm = $vevent->newComponent( Kigkonsult\Icalcreator\Vcalendar::VALARM );
|
1685 |
$valarm->setProperty( .. .
|
1686 |
|
1687 |
</p>
|
1691 |
<p class="format">calendarComponent::newValarm()</p>
|
1692 |
<p class="label">Example</p>
|
1693 |
<p class="example">
|
1694 |
+
$config = [
|
1695 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1696 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1697 |
+
];
|
1698 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1699 |
|
1700 |
$vevent = $vcalendar->newVevent();
|
1701 |
$vevent->setProperty( .. .
|
1713 |
</p>
|
1714 |
<p class="label">Example</p>
|
1715 |
<p class="example">
|
1716 |
+
$config = [
|
1717 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1718 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1719 |
+
];
|
1720 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1721 |
|
1722 |
+
$vevent = new Kigkonsult\Icalcreator\Vevent();
|
1723 |
$vevent->setProperty( .. .
|
1724 |
|
1725 |
+
$valarm = new Kigkonsult\Icalcreator\Valarm( $vevent->getConfig());
|
1726 |
$valarm->setProperty( .. .
|
1727 |
|
1728 |
$vevent->setComponent( $valarm );
|
1734 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Function_list">[up]</a>
|
1735 |
|
1736 |
|
1737 |
+
<a name="vtimezone_constr"></a><h4>3.1.1.7 Vtimezone</h4>
|
1738 |
<p>
|
1739 |
The vtimezone component describe, at a minimum, the base offset from <b>UTC</b> for the time zone.
|
1740 |
For dates with UTC DATE-TIME, read <a href="#DATE_WITH_UTC_TIME">this</a>!
|
1741 |
</p>
|
1742 |
<p>
|
1743 |
+
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::VTIMEZONE as used in code snippets is available.
|
1744 |
</p>
|
1745 |
<p class="label">Format 1</p>
|
1746 |
<p>
|
1747 |
+
Create a new <a href="#VTIMEZONE">VTIMEZONE</a> object using an Vcalendar component factory-method,
|
1748 |
returning a reference to the new component.
|
1749 |
</p>
|
1750 |
<p class="format">vcalendar::newComponent( "vtimezone" )</p>
|
1751 |
<p class="label">Example</p>
|
1752 |
<p class="example">
|
1753 |
+
$config = [
|
1754 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1755 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1756 |
+
];
|
1757 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1758 |
|
1759 |
+
$vtimezone = $vcalendar->newComponent( Kigkonsult\Icalcreator\Vcalendar::VTIMEZONE );
|
1760 |
$vtimezone->setProperty( .. .
|
1761 |
|
1762 |
</p>
|
1766 |
<p class="format">vcalendar::newVtimezone()</p>
|
1767 |
<p class="label">Example</p>
|
1768 |
<p class="example">
|
1769 |
+
$config = [
|
1770 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1771 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1772 |
+
];
|
1773 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1774 |
|
1775 |
$vtimezone = $vcalendar->newVtimezone();
|
1776 |
$vtimezone->setProperty( .. .
|
1785 |
</p>
|
1786 |
<p class="label">Example</p>
|
1787 |
<p class="example">
|
1788 |
+
$config = [
|
1789 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1790 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1791 |
+
];
|
1792 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1793 |
|
1794 |
+
$vtimezone = new Kigkonsult\Icalcreator\Vtimezone( $vcalendar->getConfig());
|
1795 |
$vtimezone->setProperty( .. .
|
1796 |
|
1797 |
$vcalendar->setComponent( $vtimezone );
|
1800 |
<br>
|
1801 |
<h5>Creation of timezone components</h5>
|
1802 |
<p>
|
1803 |
+
It is possible to create timezone components, using a method in TimezoneHandler class, <a href="#createTimezone">createTimezone</a>
|
1804 |
and utilizing the <em>PHP</em> DateTimeZone class.
|
1805 |
</p>
|
1806 |
<br>
|
1807 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Function_list">[up]</a>
|
1808 |
|
1809 |
+
<a name="standard_daylight_constr"></a><h4>3.1.1.8 Standard / Daylight</h4>
|
1810 |
<p class="label">Format 1</p>
|
1811 |
<p>
|
1812 |
Create a new <a href="#VTIMEZONE">VTIMEZONE</a> <b>standard</b> / <b>daylight</b> objects
|
1813 |
+
using an Vcalendar component factory-method,
|
1814 |
returning a reference to the new (sub-)component.
|
1815 |
</p>
|
1816 |
<p>
|
1817 |
+
To ease up usage, constants
|
1818 |
+
Kigkonsult\Icalcreator\Vcalendar::STANDARD and
|
1819 |
+
Kigkonsult\Icalcreator\Vcalendar::DAYLIGHT
|
1820 |
as used in code snippets are available.
|
1821 |
</p>
|
1822 |
<p class="format">vtimezone::newComponent( "standard" )</p>
|
1823 |
<p class="label">Example</p>
|
1824 |
<p class="example">
|
1825 |
+
$config = [
|
1826 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1827 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1828 |
+
];
|
1829 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1830 |
|
1831 |
+
$vtimezone = $vcalendar->newComponent( Kigkonsult\Icalcreator\Vcalendar::VTIMEZONE );
|
1832 |
$vtimezone->setProperty( .. .
|
1833 |
|
1834 |
+
$standard = $vtimezone->newComponent( Kigkonsult\Icalcreator\Vcalendar::STANDARD );
|
1835 |
$standard->setProperty( .. .
|
1836 |
|
1837 |
+
$daylight = $vtimezone->newComponent( Kigkonsult\Icalcreator\Vcalendar::DAYLIGHT );
|
1838 |
$daylight->setProperty( .. .
|
1839 |
|
1840 |
</p>
|
1845 |
<p class="format">vtimezone::newDaylight()</p>
|
1846 |
<p class="label">Example</p>
|
1847 |
<p class="example">
|
1848 |
+
$config = [
|
1849 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1850 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1851 |
+
];
|
1852 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1853 |
|
1854 |
$vtimezone = $vcalendar->newVtimezone();
|
1855 |
$vtimezone->setProperty( .. .
|
1870 |
</p>
|
1871 |
<p class="label">Example</p>
|
1872 |
<p class="example">
|
1873 |
+
$config = [
|
1874 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
1875 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
1876 |
+
];
|
1877 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
1878 |
|
1879 |
+
$vtimezone = new Kigkonsult\Icalcreator\Vtimezone( $vcalendar->getConfig());
|
1880 |
$vtimezone->setProperty( .. .
|
1881 |
|
1882 |
+
$standard = new Kigkonsult\Icalcreator\Vtimezone(
|
1883 |
+
Kigkonsult\Icalcreator\Vcalendar::STANDARD,
|
1884 |
+
$vtimezone->getConfig()
|
1885 |
+
);
|
1886 |
$standard->setProperty( .. .
|
1887 |
|
1888 |
$vtimezone->setComponent( $standard );
|
1889 |
|
1890 |
+
$daylight = new Kigkonsult\Icalcreator\Vtimezone(
|
1891 |
+
Kigkonsult\Icalcreator\Vcalendar::DAYLIGHT,
|
1892 |
+
$vtimezone->getConfig()
|
1893 |
+
);
|
1894 |
$daylight->setProperty( .. .
|
1895 |
|
1896 |
$vtimezone->setComponent( $daylight );
|
1902 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Function_list">[up]</a>
|
1903 |
|
1904 |
|
1905 |
+
<a name="iCalcreator_object_property_methods"></a><h3>3.1.2 Vcalendar property methods</h3>
|
1906 |
|
1907 |
<a name="deleteProperty"></a><h4>3.1.2.1 deleteProperty</h4>
|
1908 |
+
<p>Generic Vcalendar deleteProperty method, simplifying removal of <strong>calendar</strong> properties.</p>
|
1909 |
<p>Bool false is returned if no property exists or when end-of-properties at consecutive method calls.</p>
|
1910 |
<p class="label">Format</p>
|
1911 |
<p class="format">vcalendar::deleteProperty( [ PropName [, order=1 ] )</p>
|
1916 |
</p>
|
1917 |
<p class="label">Example</p>
|
1918 |
<p class="example">
|
1919 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
1920 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
1921 |
+
);
|
1922 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
1923 |
+
$vcalendar->parse( $iCalContent );
|
1924 |
+
if( ! $vcalendar->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$METHOD )) {
|
1925 |
+
echo "METHOD property not found";
|
1926 |
+
}
|
1927 |
</p>
|
1928 |
<br>
|
1929 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_object_property_methods">[up]</a>
|
1939 |
order = (int) if missing 1st/next occurrence,
|
1940 |
used with multiply (property) occurrences
|
1941 |
complete = (bool) false (default) : output only property value
|
1942 |
+
true : output = [ "value"=> <value> ,"params" => <parameter array>]
|
1943 |
</p>
|
1944 |
<p class="label">Example 1</p>
|
1945 |
<p class="example">
|
1946 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
1947 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
1948 |
+
);
|
1949 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
1950 |
+
$vcalendar->parse( $iCalContent );
|
1951 |
+
$calscale = $vcalendar->getProperty( Kigkonsult\Icalcreator\Util\Util::$CALSCALE );
|
1952 |
|
1953 |
</p>
|
1954 |
<p class="label">Example 2</p>
|
1955 |
<p class="example">
|
1956 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
1957 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
1958 |
+
);
|
1959 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
1960 |
+
$vcalendar->parse( $iCalContent );
|
1961 |
while( $xprop = $vcalendar->getProperty( )) { // <span class="comment">get x-properties</span>
|
1962 |
+
.. .
|
1963 |
+
}
|
1964 |
</p>
|
1965 |
<a name="getProperty2"></a>
|
1966 |
<a name="geoLocation"></a>
|
1967 |
<p class="label">Format 2</p>
|
1968 |
<p>
|
1969 |
Ability to fetch specific <i>component</i> property (unique) value(-s) and number of occurrence(-s).
|
1970 |
+
The search includes <b>ALL</b> components within the Vcalendar instance.
|
1971 |
</p>
|
1972 |
<p>
|
1973 |
Outputs an array( *[ (string) unique-property-value => (int) number_of_occurrence ] ) or an empty array if no hits.
|
2024 |
<p class="format">vcalendar::getProperty( PropName )</p>
|
2025 |
<p class="comment">propName = (string) case independent, property name</p>
|
2026 |
<p class="label">Example 1</p>
|
2027 |
+
<p>Fetch all attendees in the Vcalendar instance.</p>
|
2028 |
<p class="example">
|
2029 |
+
$attendees = $vcalendar->getProperty( Kigkonsult\Icalcreator\Util\Util::$ATTENDEE );
|
2030 |
+
foreach( $attendees as $attendee => $occurrCount ) {
|
2031 |
.. .
|
2032 |
</p>
|
2033 |
<p class="label">Example 2</p>
|
2034 |
+
<p>Fetch all DTSTARTs in the Vcalendar instance.</p>
|
2035 |
<p class="example">
|
2036 |
+
$startDates = $vcalendar->getProperty( Kigkonsult\Icalcreator\Util\Util::$DTSTART );
|
2037 |
+
foreach( $startDates as $startDate => $occurrCount ) {
|
2038 |
.. .
|
2039 |
</p>
|
2040 |
<br>
|
2042 |
|
2043 |
|
2044 |
<a name="setProperty"></a><h4>3.1.2.3 setProperty</h4>
|
2045 |
+
<p>Generic the Vcalendar setProperty method,simplifying insert of <strong>calendar</strong> properties.</p>
|
2046 |
<p>A successful update returns true.</p>
|
2047 |
<p class="label">Format</p>
|
2048 |
<p class="format">vcalendar::setProperty( PropName, Proparg_1 *[, Proparg_n] )</p>
|
2055 |
</p>
|
2056 |
<p class="label">Example</p>
|
2057 |
<p class="example">
|
2058 |
+
$config = [
|
2059 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
2060 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
2061 |
+
];
|
2062 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(); // <span class="comment">initiate new CALENDAR</span>
|
2063 |
$vcalendar->setConfig( $config );
|
2064 |
+
$vcalendar->setProperty( Kigkonsult\Icalcreator\Util\Util::$CALSCALE, "GREGORIAN" );
|
|
|
2065 |
|
2066 |
</p>
|
2067 |
<br>
|
2076 |
The default value is "GREGORIAN", implied when missing.
|
2077 |
</p>
|
2078 |
<p>
|
2079 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$CALSCALE as used in code snippets is available.
|
2080 |
</p>
|
2081 |
<h5>Create CALSCALE</h5>
|
2082 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
2093 |
<p class="format">vcalendar::deleteProperty( "calscale" )</p>
|
2094 |
<p class="label">Example</p>
|
2095 |
<p class="example">
|
2096 |
+
$vcalendar->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$CALSCALE );
|
2097 |
|
2098 |
</p>
|
2099 |
<h5>Get Calscale</h5>
|
2102 |
<p class="format">vcalendar::getProperty( "calscale" )</p>
|
2103 |
<p class="label">Example</p>
|
2104 |
<p class="example">
|
2105 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2106 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2107 |
+
);
|
2108 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
2109 |
+
$vcalendar->parse( $iCalContent );
|
2110 |
+
$calscale = $vcalendar->getProperty( Kigkonsult\Icalcreator\Util\Util::$CALSCALE );
|
2111 |
|
2112 |
</p>
|
2113 |
<h5>Set CALSCALE</h5>
|
2114 |
+
<p>Set property value.</p>
|
2115 |
<p class="label">Format</p>
|
2116 |
<p class="format">vcalendar::setProperty( "calscale", value )</p>
|
2117 |
<p class="comment">value = (string) calscale value</p>
|
2118 |
<p class="label">Example</p>
|
2119 |
<p class="example">
|
2120 |
+
$config = [
|
2121 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
2122 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
2123 |
+
];
|
2124 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config ); // <span class="comment">initiate new CALENDAR</span>
|
2125 |
+
$vcalendar->setProperty( Kigkonsult\Icalcreator\Util\Util::$CALSCALE, "GREGORIAN" );
|
2126 |
|
2127 |
</p>
|
2128 |
<br>
|
2140 |
and the (automatically created) <a href="#DTSTAMP">DTSTAMP</a> and <a href="#UID">UID</a> properties.
|
2141 |
</p>
|
2142 |
<p>
|
2143 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$METHOD as used in code snippets is available.
|
2144 |
</p>
|
2145 |
<h5>Create METHOD</h5>
|
2146 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
2157 |
<p class="format">vcalendar::deleteProperty( "METHOD" )</p>
|
2158 |
<p class="label">Example</p>
|
2159 |
<p class="example">
|
2160 |
+
$vcalendar->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$METHOD );
|
2161 |
|
2162 |
</p>
|
2163 |
<h5>Get METHOD</h5>
|
2166 |
<p class="format">vcalendar::getProperty( "method" );</p>
|
2167 |
<p class="label">Example</p>
|
2168 |
<p class="example">
|
2169 |
+
$config = [ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se" ];
|
2170 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
2171 |
$vcalendar->parse();
|
2172 |
+
$method = $vcalendar->getProperty( Kigkonsult\Icalcreator\Util\Util::$METHOD );
|
2173 |
|
2174 |
</p>
|
2175 |
<h5>Set METHOD</h5>
|
2176 |
+
<p>Set property value.</p>
|
2177 |
<p class="label">Format</p>
|
2178 |
<p class="format">vcalendar::setProperty( "method", value )</p>
|
2179 |
<p class="comment">value = (string) method value</p>
|
2180 |
<p class="label">Example</p>
|
2181 |
<p class="example">
|
2182 |
+
$config = [
|
2183 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
2184 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
2185 |
+
];
|
2186 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config ); // <span class="comment">initiate new CALENDAR</span>
|
2187 |
+
$vcalendar->setProperty( Kigkonsult\Icalcreator\Util\Util::$METHOD, "PUBLISH" );
|
2188 |
|
2189 |
</p>
|
2190 |
<br>
|
2197 |
This property is always placed first in the <strong>calendar</strong> file.
|
2198 |
</p>
|
2199 |
<p>
|
2200 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$VERSION as used in code snippets is available.
|
2201 |
</p>
|
2202 |
<h5>Create Version</h5>
|
2203 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
2214 |
<p class="format">vcalendar::getProperty( "version" )</p>
|
2215 |
<p class="label">Example</p>
|
2216 |
<p class="example">
|
2217 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2218 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2219 |
+
);
|
2220 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
2221 |
+
$vcalendar->parse( $iCalContent );
|
2222 |
+
$version = $vcalendar->getProperty( Kigkonsult\Icalcreator\Util\Util::$VERSION )
|
2223 |
|
2224 |
</p>
|
2225 |
<h5>Set Version</h5>
|
2226 |
+
<p>Set property value.
|
2227 |
Only version 2.0 valid, version is <b>AUTO</b> generated at <strong>calendar</strong> creation.</p>
|
2228 |
<p class="label">Format</p>
|
2229 |
<p class="format">vcalendar::setProperty( "version", version )</p>
|
2230 |
<p class="comment">version = (string) iCal version</p>
|
2231 |
<p class="label">Example</p>
|
2232 |
<p class="example">
|
2233 |
+
$config = [
|
2234 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
2235 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
2236 |
+
];
|
2237 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config ); // <span class="comment">initiate new CALENDAR</span>
|
2238 |
+
$vcalendar->setProperty( Kigkonsult\Icalcreator\Util\Util::$VERSION, "2.0" );
|
2239 |
|
2240 |
</p>
|
2241 |
<br>
|
2275 |
<p>Delete all x-properties.</p>
|
2276 |
<p class="example">
|
2277 |
while( $vcalendar->deleteProperty())
|
2278 |
+
continue;
|
2279 |
|
2280 |
</p>
|
2281 |
<h5>Get X-PROPERTY</h5>
|
2290 |
, array( "value" => propertyData<sup>2</sup> )
|
2291 |
, "params" => params<sup>3</sup>))
|
2292 |
<p class="comment">propertyName<sup>1</sup>, propertyData<sup>2</sup> and params<sup>3</sup> specs below.</p>
|
2293 |
+
|
2294 |
<p class="label">Example 1</p>
|
2295 |
<p>
|
2296 |
Read all x-prop values in a loop. Output in detail below.
|
2297 |
</p>
|
2298 |
<p class="example">
|
2299 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2300 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2301 |
+
);
|
2302 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
2303 |
+
$vcalendar->parse( $iCalContent );
|
2304 |
while( $xprop = $vcalendar->getProperty( )) {
|
2305 |
// <span class="comment">$xprop = array( propertyName<sup>1</sup>,
|
2306 |
propertyData<sup>2</sup> )</span>
|
2311 |
If exists, read the X-WR-TIMEZONE x-prop
|
2312 |
</p>
|
2313 |
<p class="example">
|
2314 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2315 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2316 |
+
);
|
2317 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
2318 |
+
$vcalendar->parse( $iCalContent );
|
2319 |
if( $xprop = $vcalendar->getProperty( "X-WR-TIMEZONE" )) {
|
2320 |
// <span class="comment">$xprop = array( "X-WR-TIMEZONE",
|
2321 |
propertyData<sup>2</sup> )</span>
|
2326 |
Read all x-prop values/parameters in a loop.
|
2327 |
</p>
|
2328 |
<p class="example">
|
2329 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2330 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2331 |
+
);
|
2332 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
2333 |
+
$vcalendar->parse( $iCalContent );
|
2334 |
while( $xprop = $vcalendar->getProperty( false, false, true )) {
|
2335 |
/* <span class="comment">$xprop = array( propertyName<sup>1</sup>,
|
2336 |
array( "value" => propertyData<sup>2</sup>,
|
2352 |
</p>
|
2353 |
<p class="label">Example</p>
|
2354 |
<p class="example">
|
2355 |
+
$config = [
|
2356 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
2357 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
2358 |
+
];
|
2359 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config ); // initiate new CALENDAR
|
2360 |
// <span class="comment">set some X-properties</span>
|
2361 |
+
$vcalendar->setProperty( "x-wr-calname", "Calendar Sample" )
|
2362 |
+
$vcalendar->setProperty( "X-WR-CALDESC", "Calendar Description" );
|
2363 |
+
$vcalendar->setProperty( "X-WR-TIMEZONE", "Europe/Stockholm" );
|
|
|
|
|
|
|
2364 |
|
2365 |
</p>
|
2366 |
<br>
|
2367 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_object_property_methods">[up]</a>
|
2368 |
|
2369 |
+
<a name="iCalcreator_component_object_methods"></a><h3>3.1.3 Vcalendar component object methods</h3>
|
2370 |
|
2371 |
<a name="deleteComponent"></a><h4>3.1.3.1 deleteComponent</h4>
|
2372 |
<p>
|
2373 |
+
Remove component from the Vcalendar instance.
|
2374 |
</p>
|
2375 |
<p>
|
2376 |
Bool false is returned if no component exists or at end-of-components invoking the method consecutive.
|
2389 |
<p class="format">vcalendar::deleteComponent( <a href="#UID">UID</a> )</p>
|
2390 |
<p class="label">Example 1</p>
|
2391 |
<p class="example">
|
2392 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2393 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2394 |
+
);
|
2395 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
2396 |
+
$vcalendar->parse( $iCalContent );
|
2397 |
$vcalendar->deleteComponent( 1 );
|
2398 |
+
$vcalendar->deleteComponent( Kigkonsult\Icalcreator\Vcalendar::VTODO, 2 );
|
2399 |
$vcalendar->deleteComponent( "20070803T194810CEST-0123U3PXiX@kigkonsult.se");
|
2400 |
|
2401 |
</p>
|
2402 |
<p class="label">Example 2</p>
|
2403 |
<p>Deleting all components, using format 2 without order number.</p>
|
2404 |
<p class="example">
|
2405 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2406 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2407 |
+
);
|
2408 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
2409 |
+
$vcalendar->parse( $iCalContent );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2410 |
|
2411 |
+
while( $vcalendar->deleteComponent( Kigkonsult\Icalcreator\Vcalendar::VEVENT)) {
|
2412 |
+
continue;
|
2413 |
+
}
|
2414 |
+
$vtodo = $vcalendar->getComponent( Kigkonsult\Icalcreator\Vcalendar::VTODO );
|
2415 |
+
while( $vtodo->deleteComponent( Kigkonsult\Icalcreator\Vcalendar::VALARM)) {
|
2416 |
+
continue;
|
2417 |
+
}
|
2418 |
</p>
|
2419 |
<br>
|
2420 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_component_object_methods">[up]</a>
|
2421 |
|
2422 |
<a name="getComponent"></a><h4>3.1.3.2 getComponent</h4>
|
2423 |
+
<p>Get (next) component from the Vcalendar instance.</p>
|
2424 |
<p>
|
2425 |
Bool false is returned if no component exists or at end-of-components invoking the method consecutive.
|
2426 |
</p>
|
2429 |
<p class="format">vcalendar::getComponent()</p>
|
2430 |
<p class="label">Example</p>
|
2431 |
<p class="example">
|
2432 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2433 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2434 |
+
);
|
2435 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
2436 |
+
$vcalendar->parse( $iCalContent );
|
2437 |
+
while( $comp = $vcalendar->getComponent()) {
|
2438 |
.. .
|
2439 |
}
|
2440 |
|
2445 |
<p class="comment">orderNumber = (int) order number</p>
|
2446 |
<p class="label">Example</p>
|
2447 |
<p class="example">
|
2448 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2449 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2450 |
+
);
|
2451 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
2452 |
+
$vcalendar->parse( $iCalContent );
|
2453 |
if( $comp = $vcalendar->getComponent( 1 )) {
|
2454 |
.. .
|
2455 |
}
|
2466 |
componentSuborderNumber = (int) order number</p>
|
2467 |
<p class="label">Example</p>
|
2468 |
<p class="example">
|
2469 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2470 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2471 |
+
);
|
2472 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
2473 |
+
$vcalendar->parse( $iCalContent );
|
2474 |
+
if( $comp = $vcalendar->getComponent( Kigkonsult\Icalcreator\Vcalendar::VTODO, 2 )) {
|
2475 |
.. .
|
2476 |
}
|
2477 |
|
2486 |
<p class="format">vcalendar::getComponent( <a href="#UID">UID</a> )</p>
|
2487 |
<p class="label">Example</p>
|
2488 |
<p class="example">
|
2489 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2490 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2491 |
+
);
|
2492 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
2493 |
+
$vcalendar->parse( $iCalContent );
|
2494 |
$uid = "20070803T194810CEST-0123U3PXiX@kigkonsult.se";
|
2495 |
if( $comp = $vcalendar->getComponent( $uid )) {
|
2496 |
.. .
|
2545 |
To select components based on property values, use <a href="#selectComponents2">selectComponents</a> (Format 2).
|
2546 |
</p>
|
2547 |
<p>
|
2548 |
+
To retrieve specific Vcalendar instance property values, searching <b>ALL</b> components,
|
2549 |
use <a href="#getProperty2">getProperty</a> (Format 2).
|
2550 |
</p>
|
2551 |
<p class="format">vcalendar::getComponent( search )</p>
|
2557 |
datetime format "YYYYMMDDTHHMMSS"</p>
|
2558 |
<p class="label">Example</p>
|
2559 |
<p class="example">
|
2560 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2561 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2562 |
+
);
|
2563 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
2564 |
+
$vcalendar->parse( $iCalContent );
|
2565 |
+
while( $comp = $vcalendar->getComponent( [ Kigkonsult\Icalcreator\Util\Util::$RESOURCES => "PC" ]) {
|
2566 |
+
.. .
|
|
|
2567 |
}
|
2568 |
|
2569 |
</p>
|
2573 |
<a name="newComponent"></a><h4>3.1.3.3 newComponent</h4>
|
2574 |
<P>
|
2575 |
Create component (<a href="#VEVENT">VEVENT</a> / <a href="#VTODO">VTODO</a> / <a href="#VJOURNAL">VJOURNAL</a> / <a href="#VFREEBUSY">VFREEBUSY</a> / <a href="#VTIMEZONE">VTIMEZONE</a>)
|
2576 |
+
using a Vcalendar factory-method, returning a reference to the new component.
|
2577 |
</p>
|
2578 |
<p>
|
2579 |
+
To ease up usage, constants
|
2580 |
+
Kigkonsult\Icalcreator\Vcalendar::VEVENT,
|
2581 |
+
Kigkonsult\Icalcreator\Vcalendar::VTODO,,
|
2582 |
+
Kigkonsult\Icalcreator\Vcalendar::VJOURNAL,
|
2583 |
+
Kigkonsult\Icalcreator\Vcalendar::VFREEBUSY and
|
2584 |
+
Kigkonsult\Icalcreator\Vcalendar::VTIMEZONE
|
2585 |
as used in code snippets is available.
|
2586 |
</p>
|
2587 |
<p class="label">Format</p>
|
2589 |
<p class="comment">componentType = (string) component type</p>
|
2590 |
<p class="label">Example</p>
|
2591 |
<p class="example">
|
2592 |
+
$config = [
|
2593 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
2594 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
2595 |
+
];
|
2596 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
2597 |
|
2598 |
+
$vevent = $vcalendar->newComponent( Kigkonsult\Icalcreator\Vcalendar::VEVENT );
|
2599 |
|
2600 |
</p>
|
2601 |
|
2620 |
</p>
|
2621 |
<p class="label">Format</p>
|
2622 |
<p class="format">vcalendar::replaceComponent( component )</p>
|
2623 |
+
<p class="comment">component = (object) component instance</p>
|
2624 |
<p class="label">Example</p>
|
2625 |
<p class="example">
|
2626 |
$vcalendar->replaceComponent( $component );
|
2634 |
<p class="label">Format 1</p>
|
2635 |
<p>
|
2636 |
Selects <a href="#VEVENT">EVENT</a> / <a href="#VTODO">VTODO</a> / <a href="#VJOURNAL">VJOURNAL</a> /
|
2637 |
+
<a href="#VFREEBUSY">VFREEBUSY</a> components from the Vcalendar instance on based on <b>dates</b>
|
2638 |
(notice <a href="#date_restriction">date restriction</a>), based on the initial <a href="#DTSTART">DTSTART</a>
|
2639 |
property along with the <a href="#RRULE">RRULE</a>, <a href="#RDATE">RDATE</a>, <a href="#EXDATE">EXDATE</a>
|
2640 |
+
and <a href="#EXRULE">EXRULE</a> properties in the component and <a href="#UID">UID</a>-matched component(s)
|
2641 |
+
with <a href="#RECURRENCE-ID">RECURRENCE-ID</a>.
|
2642 |
</p>
|
2643 |
<p>Requirement:</p>
|
2644 |
<ul>
|
2657 |
<li>no X-CURRENT-DTEND if no DTEND (DUE) is set (below)</li>
|
2658 |
</ul>
|
2659 |
<p>
|
2660 |
+
Returns an array with components (events) or bool false is returned if no found component(s) exists.
|
2661 |
+
Replacing (<a href="#RECURRENCE-ID">RECURRENCE-ID</a>) components has (if missing) updated <a href="#COMMENT">COMMENT</a>,
|
2662 |
+
<a href="#DESCRIPTION">DESCRIPTION</a> and <a href="#COMMENT">COMMENT</a>s properties.
|
2663 |
+
</p>
|
2664 |
<p>
|
2665 |
+
Added X-properties in recurrent instances of a <strong>calendar</strong> component:
|
2666 |
+
</p>
|
2667 |
<ul>
|
2668 |
<li>"X-CURRENT-DTSTART", TEXT content, <i>"Y-m-d [H:i:s [timezone]]"</i> showing the current start date.</li>
|
2669 |
<li>"X-CURRENT-DTEND" alt. "X-CURRENT-DUE" (opt), TEXT content, <i>"Y-m-d [H:i:s [timezone]]"</i> showing the current end date.</li>
|
2670 |
+
<li>"X-RECURRENCE", the RRULE/RDATE recurrence pattarn number (not in the recurrence start), also after an RECURRENCE-ID change</li>
|
2671 |
<li>"X-OCCURENCE", contains, where applicable, single multi-day recurrence event day number (formatted as 'day X of Y')</li>
|
2672 |
</ul>
|
2673 |
<p>
|
2674 |
+
To ease up usage, constants
|
2675 |
+
Kigkonsult\Icalcreator\Util\UtilSelect::X_CURRENT_DTSTART,
|
2676 |
+
Kigkonsult\Icalcreator\Util\UtilSelect::X_CURRENT_DTEND,
|
2677 |
+
Kigkonsult\Icalcreator\Util\UtilSelect::X_CURRENT_DUE,
|
2678 |
+
Kigkonsult\Icalcreator\Util\UtilSelect::X_RECURRENCE,
|
2679 |
+
Kigkonsult\Icalcreator\Util\UtilSelect::X_OCCURENCE
|
2680 |
are available.
|
2681 |
</p>
|
2682 |
<p class="format">vcalendar::selectComponents([ startYear, startMonth, startDay
|
2684 |
[, cType [, flat [, any [, split]]]]]])
|
2685 |
</p>
|
2686 |
<p class="comment">startYear : (int) start year (4*digit), default current year
|
2687 |
+
(object) DateTime, start date<sup>*</sup>
|
2688 |
startMonth : (int) start month (1-2*digit), default current month
|
2689 |
+
(object) DateTime, end date<sup>*</sup>
|
2690 |
startDay : (int) start day (1-2*digit), default current day
|
2691 |
endYear : (int) end year (4*digit), default startYear
|
2692 |
endMonth : (int) end month (1-2*digit), default startMonth
|
2717 |
</p>
|
2718 |
<p class="label">Example</p>
|
2719 |
<p class="example">
|
2720 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2721 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2722 |
+
);
|
2723 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
2724 |
+
$vcalendar->parse( $iCalContent );
|
2725 |
+
$events_arr = $vcalendar->selectComponents( 2007, 11, 1, 2007, 11, 30, Kigkonsult\Icalcreator\Vcalendar::VEVENT );
|
|
|
|
|
2726 |
// <span class="comment">select all events occurring 1-30 nov. 2007</span>
|
2727 |
foreach( $events_arr as $year => $year_arr ) {
|
2728 |
+
foreach( $year_arr as $month => $month_arr ) {
|
2729 |
+
foreach( $month_arr as $day => $day_arr ) {
|
2730 |
+
foreach( $day_arr as $event ) {
|
2731 |
+
$currddate = $event->getProperty( Kigkonsult\Icalcreator\Util\Util::$X_CURRENT_DTSTART );
|
2732 |
<span class="comment">// if member of a recurrence set, returns
|
2733 |
// array(" x-current-dtstart",
|
2734 |
// <(string) date("Y-m-d [H:i:s][timezone/UTC offset]")>)</span>
|
2735 |
+
$startDate = $event->getProperty( Kigkonsult\Icalcreator\Util\Util::$DTSTART );
|
2736 |
+
$summary = $event->getProperty( Kigkonsult\Icalcreator\Util\Util::$SUMMARY );
|
2737 |
+
$description = $event->getProperty( Kigkonsult\Icalcreator\Util\Util::$DESCRIPTION );
|
2738 |
+
.. .
|
2739 |
|
2740 |
</p>
|
2741 |
<a name="selectComponents2"></a>
|
2742 |
<p class="label">format 2</p>
|
2743 |
<p>
|
2744 |
+
Using this format, the Vcalendar method selects components based on specific property value(-s).
|
2745 |
</p>
|
2746 |
<dl>
|
2747 |
<dt>Supported Descriptive Component Properties
|
2772 |
For the other properties an exact (strict case) match is required. Multiple search properties may coexist.
|
2773 |
</p>
|
2774 |
<p>
|
2775 |
+
To retrieve specific Vcalendar instance property values, searching <b>ALL</b> components,
|
2776 |
use <a href="#getProperty2">getProperty</a> (Format 2).
|
2777 |
</p>
|
2778 |
<p>
|
2786 |
</p>
|
2787 |
<p class="label">Example</p>
|
2788 |
<p class="example">
|
2789 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2790 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2791 |
+
);
|
2792 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
2793 |
+
$vcalendar->parse( $iCalContent );
|
2794 |
+
$searchArray = [ Kigkonsult\Icalcreator\Util\Util::$PRIORITY => [ 1, 2, 3, 4 ]];
|
|
|
2795 |
$highPrioArr = $vcalendar->selectComponents( $searchArray );
|
2796 |
// <span class="comment">select all components with PRIORITY set to high (1-4)</span>
|
2797 |
if( ! empty( $highPrioArr )) {
|
2798 |
+
$config = [ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se" ];
|
2799 |
+
$highPrioCal = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
2800 |
+
$highPrioCal->setProperty( "X-WR-CALDESC", "High priority events" );
|
2801 |
+
foreach( $highPrioArr as $highPrioComponent ) {
|
2802 |
+
$highPrioCal->setComponent( $highPrioComponent );
|
2803 |
+
}
|
2804 |
+
$highPrioCal->returnCalendar();
|
2805 |
}
|
2806 |
exit;
|
2807 |
</p>
|
2810 |
|
2811 |
<a name="setComponent"></a><h4>3.1.3.6 setComponent</h4>
|
2812 |
<p>
|
2813 |
+
Replace or update component in the Vcalendar instance.
|
2814 |
+
Also add a <strong>calendar</strong> component to the Vcalendar instance
|
2815 |
when <strong>calendar</strong> component is created with the procedural (<b>non</b>-factory) method,
|
2816 |
see example <a href="#vevent_constr">VEVENT</a>, format 2.
|
2817 |
</p>
|
2820 |
<p>Insert last in component chain.</p>
|
2821 |
<p class="format">vcalendar::setComponent( component )
|
2822 |
addComponent( component ) // <span class="comment">alias</span></p>
|
2823 |
+
<p class="comment">component = (object) Vcalendar component instance</p>
|
2824 |
<p class="comment">addComponent, may be removed in future versions.</p>
|
2825 |
<p class="label">format 2</p>
|
2826 |
<p>
|
2828 |
If replace and orderNumber is not found, component is inserted last in chain.
|
2829 |
</p>
|
2830 |
<p class="format">vcalendar::setComponent( component, orderNumber )</p>
|
2831 |
+
<p class="comment">component = (object) Vcalendar component instance
|
2832 |
int = (int) order numder</p>
|
2833 |
<p class="label">format 3</p>
|
2834 |
<p>
|
2836 |
If orderNumber is not found, component is inserted last in chain.
|
2837 |
</p>
|
2838 |
<p class="format">vcalendar::setComponent( component, componentType [, componentSuborderNo])</p>
|
2839 |
+
<p class="comment">component = (object) Vcalendar component instance
|
2840 |
componentType = (string) component type
|
2841 |
componentSuborderNo = (int) component Suborder Number</p>
|
2842 |
<p class="label">format 4</p>
|
2846 |
If <a href="#UID">UID</a> is not found, component is inserted last in chain.
|
2847 |
</p>
|
2848 |
<p class="format">vcalendar::setComponent( component, <a href="#UID">UID</a> )</p>
|
2849 |
+
<p class="comment">component = (object) Vcalendar component instance</p>
|
2850 |
<p class="label">Example</p>
|
2851 |
<p class="example">
|
2852 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2853 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2854 |
+
);
|
2855 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
2856 |
+
$vcalendar->parse( $iCalContent );
|
2857 |
$vevent = vcalendar->getComponent( 1 ); // <span class="comment">fetch first EVENT</span>
|
2858 |
+
$vevent->setProperty(
|
2859 |
+
Kigkonsult\Icalcreator\Util\Util::$DTSTART,
|
2860 |
+
new DateTime( "2006-12-24 19:30:00" )
|
2861 |
+
); // <span class="comment">update <a class="ref" href="#DTSTART">DTSTART</a> property</span>
|
2862 |
$vcalendar->setComponent( $vevent, 1 ); // <span class="comment">replace first component</span>
|
2863 |
|
2864 |
</p>
|
2865 |
<br>
|
2866 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_component_object_methods">[up]</a>
|
2867 |
|
2868 |
+
<a name="iCalcreator_calendar_methods"></a><h3>3.1.4 Vcalendar calendar methods</h3>
|
2869 |
|
2870 |
<a name="parse_merge"></a><h4>3.1.4.1 parse and merge</h4>
|
2871 |
<p>
|
2872 |
+
Parse iCal file(-s) or string/array <strong>calendar</strong> content into a single Vcalendar instance (components, properties and parameters),
|
2873 |
including multiple vcalendars (within a single ICS file) parse, e.g. Oracle Calendar exports.
|
2874 |
</p>
|
2875 |
<p>
|
2876 |
+
As for now, you can use (local) filename as argument and,
|
2877 |
+
as long as php.ini directive "allow_url_fopen" is enabled, also remote resources using URLs; protocol "http" ("webcal").
|
2878 |
+
A remote file, URL, <b>must</b> be prefixed by "http://" ("webcal://") and suffixed by a valid filename!
|
2879 |
+
</p>
|
2880 |
+
<p>
|
2881 |
+
Note, the config
|
2882 |
+
<a href="#Directory">Directory</a>,
|
2883 |
+
<a href="#Delimiter">Delimiter</a>,
|
2884 |
+
<a href="#Filename">Filename</a>,
|
2885 |
+
<a href="#Dirfile">Dirfile</a>
|
2886 |
+
and <a href="#configURL">URL</a> keys are objects for removal in future versions.
|
2887 |
+
Indicates all file (external resources) read/write methods will be placed outside iCalcreator.
|
2888 |
+
A strong recommendation now is placing iCal file/url content acquire functionality outside iCalcreator,
|
2889 |
+
this will also offer better acquire control.
|
2890 |
</p>
|
2891 |
<p>
|
2892 |
If missing, component property <a href="#UID">UID</a> is created when parsing.
|
2893 |
+
For that reason <a href="#Unique_id">UNIQUE_ID</a> might need to be set before parsing, Se examples below.
|
2894 |
</p>
|
2895 |
<p>
|
2896 |
Notice <a href="#date_restriction">date restriction</a>!
|
2897 |
</p>
|
2898 |
<p>
|
2899 |
If major parse error occurs (like file access error,
|
2900 |
+
invalid <strong>calendar</strong> file or <strong>calendar</strong> file without components), bool false is returned.
|
2901 |
</p>
|
2902 |
<p>
|
2903 |
Minor errors like non-standard line-endings, initial and trailing empty lines
|
2904 |
+
as well as files without proper end line(-s) (i.e. missing component end and/or "END:CALENDAR" iCal directives)
|
2905 |
+
are managed.
|
2906 |
</p>
|
2907 |
<p>
|
2908 |
Non-standard iCal properties (except the <a href="#X-PROPERTY_PROP">X-properties</a>) are ignored.
|
2913 |
ex. result from - file_get_contents( "filename")
|
2914 |
(array) calendarContent
|
2915 |
ex. result from - file( "filename", FILE_IGNORE_NEW_LINES )</p>
|
2916 |
+
|
2917 |
<p class="label">parse example 1</p>
|
2918 |
<p class="example">
|
2919 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2920 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2921 |
+
);
|
2922 |
+
$iCalContent = file_get_contents( "file.ics" );
|
2923 |
+
$vcalendar->parse( $iCalContent );
|
2924 |
|
2925 |
</p>
|
2926 |
+
|
2927 |
<p class="label">parse example 2</p>
|
2928 |
<p class="example">
|
2929 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2930 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2931 |
+
);
|
2932 |
+
$iCalContent = file_get_contents( "http://www.ical.net/calendars/calendar.ics" );
|
2933 |
+
$vcalendar->parse( $iCalContent );
|
2934 |
|
2935 |
</p>
|
2936 |
+
|
2937 |
<p class="label">parse example 3</p>
|
2938 |
<p class="example">
|
2939 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2940 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2941 |
+
);
|
2942 |
+
|
2943 |
+
$str = [
|
2944 |
+
"BEGIN:VCALENDAR",
|
2945 |
+
"PRODID:-//kigkonsult.se//NONSGML kigkonsult.se iCalcreator 2.26.8//",
|
2946 |
+
"VERSION:2.0",
|
2947 |
+
"BEGIN:VEVENT",
|
2948 |
+
"DTSTART:20101224T190000Z",
|
2949 |
+
"DTEND:20101224T200000Z",
|
2950 |
+
"DTSTAMP:20101020T103827Z",
|
2951 |
+
"UID:20101020T113827-1234GkdhFR@test.org",
|
2952 |
+
"DESCRIPTION:example",
|
2953 |
+
"END:VEVENT",
|
2954 |
+
"END:VCALENDAR"
|
2955 |
+
];
|
2956 |
$vcalendar->parse( $str );
|
2957 |
|
2958 |
</p>
|
2959 |
+
|
2960 |
+
<p class="label">parse example 4</p>
|
2961 |
+
<p>
|
2962 |
+
Subject for removal in future versions.
|
2963 |
+
</p>
|
2964 |
+
<p class="example">
|
2965 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2966 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2967 |
+
);
|
2968 |
+
$vcalendar->parse( "file.ics" );
|
2969 |
+
|
2970 |
+
</p>
|
2971 |
+
|
2972 |
<p class="label">merge example</p>
|
2973 |
<p class="example">
|
2974 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
2975 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
2976 |
+
);
|
2977 |
|
2978 |
+
$iCalContent = file_get_contents( "file1.ics" );
|
2979 |
+
$vcalendar->parse( $iCalContent );
|
2980 |
|
2981 |
+
$iCalContent = file_get_contents( "file2.ics" );
|
2982 |
+
$vcalendar->parse( $iCalContent );
|
2983 |
|
2984 |
+
file_put_contents(
|
2985 |
+
"icalmerge.ics",
|
2986 |
+
$vcalendar->createCalendar(),
|
2987 |
+
LOCK_EX
|
2988 |
+
);
|
2989 |
|
2990 |
</p>
|
2991 |
<br>
|
2992 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_calendar_methods">[up]</a>
|
2993 |
|
2994 |
<a name="createCalendar"></a><h4>3.1.4.2 createCalendar</h4>
|
2995 |
+
Generate and return (string) <strong>calendar</strong>.
|
2996 |
<p class="label">Format</p>
|
2997 |
<p class="format">vcalendar::createCalendar()</p>
|
2998 |
<p class="label">Example</p>
|
3006 |
|
3007 |
<a name="returnCalendar"></a><h4>3.1.4.3 returnCalendar</h4>
|
3008 |
<p>
|
3009 |
+
Redirect the Vcalendar instance content to user browser.
|
3010 |
Filename, addressed to browser, is automatically generated if missing or not set
|
3011 |
and the filename will look like it is set using<br>
|
3012 |
</p>
|
3014 |
<p>
|
3015 |
The method do not stop PHP script (exit), returns (bool) true on success!
|
3016 |
</p>
|
3017 |
+
<p>
|
3018 |
+
Note, the returnCalendar method is subject for change in future versions.
|
3019 |
+
</p>
|
3020 |
<p class="label">Format</p>
|
3021 |
<p class="format">vcalendar::returnCalendar( [ utf8Encode [, gzip [, cdType ]]] )</p>
|
3022 |
<p class="comment">utf8Encode = (bool) true: utf8 encoded output,
|
3028 |
false: Content-Disposition: inline</p>
|
3029 |
<p class="label">Example 1</p>
|
3030 |
<p class="example">
|
3031 |
+
$config = [
|
3032 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
3033 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID => "Europe/Stockholm"
|
3034 |
+
];
|
3035 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
3036 |
+
|
3037 |
+
$vevent = $vcalendar->newComponent( Kigkonsult\Icalcreator\Vcalendar::VEVENT );
|
3038 |
+
$vevent->setProperty(
|
3039 |
+
Kigkonsult\Icalcreator\Util\Util::$DTSTART,
|
3040 |
+
new DateTime( "2007-04-01 19:00:00" )
|
3041 |
+
);
|
3042 |
+
$vevent->setProperty(
|
3043 |
+
Kigkonsult\Icalcreator\Util\Util::$DURATION,
|
3044 |
+
new DateInterval( "PT1H" )
|
3045 |
+
);
|
3046 |
+
$vevent->setProperty(
|
3047 |
+
Kigkonsult\Icalcreator\Util\Util::$LOCATION,
|
3048 |
+
"Central Plaza"
|
3049 |
+
);
|
3050 |
+
$vevent->setProperty(
|
3051 |
+
Kigkonsult\Icalcreator\Util\Util::$SUMMARY,
|
3052 |
+
"PHP summit"
|
3053 |
+
);
|
3054 |
|
3055 |
$vcalendar->returnCalendar();
|
3056 |
exit;
|
3057 |
</p>
|
3058 |
<p class="label">Example 2</p>
|
3059 |
<p class="example">
|
3060 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
3061 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
3062 |
+
);
|
3063 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
3064 |
+
$vcalendar->parse( $iCalContent );
|
3065 |
$utf8Encode = true;
|
3066 |
if( isset( $_SERVER["HTTP_ACCEPT_ENCODING"] ) &&
|
3067 |
+
( false !== strpos( strtolower( $_SERVER["HTTP_ACCEPT_ENCODING"] ), "gzip" ))) {
|
3068 |
+
$gzip = true;
|
3069 |
+
}
|
3070 |
+
else {
|
3071 |
+
$gzip = false;
|
3072 |
+
}
|
3073 |
$vcalendar->returnCalendar( $utf8Encode, $gzip );
|
3074 |
exit;
|
3075 |
</p>
|
3078 |
|
3079 |
<a name="saveCalendar"></a><h4>3.1.4.4 saveCalendar</h4>
|
3080 |
<p>
|
3081 |
+
Save the Vcalendar instance in a file,
|
3082 |
using preset <a href="#Directory">directory</a> and <a href="#Filename">filename</a>.
|
3083 |
Filename is automatically generated if missing or not set
|
3084 |
and the filename will look like it is set using<br>
|
3085 |
</p>
|
3086 |
<p class="example">$filename = date( "YmdHis" ).".ics"</p>
|
3087 |
+
|
3088 |
<p>Return bool true on success, on error false.</p>
|
3089 |
+
<p>
|
3090 |
+
Note, the saveCalendar method is subject for change in future versions.
|
3091 |
+
</p>
|
3092 |
<p class="label">Format</p>
|
3093 |
<p class="format">vcalendar::saveCalendar()</p>
|
3094 |
<p class="label">Example</p>
|
3095 |
<p class="example">
|
3096 |
+
$vcalendar->setConfig( [
|
3097 |
+
Kigkonsult\Icalcreator\Util\Util::$DIRECTORY => "depot",
|
3098 |
+
Kigkonsult\Icalcreator\Util\Util::$FILENAME => "calendar.ics"
|
3099 |
+
]);
|
3100 |
if( false === $vcalendar->saveCalendar()) {
|
3101 |
+
echo "error when saving"
|
3102 |
+
}
|
3103 |
</p>
|
3104 |
<br>
|
3105 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_calendar_methods">[up]</a>
|
3109 |
<p>
|
3110 |
Sort created/parsed <strong>calendar</strong> components on the following (prioritized) keys:<br>
|
3111 |
1 - X-CURRENT-DTSTART - X-CURRENT-DTEND/X-CURRENT-DUE<br>
|
3112 |
+
(if created in Vcalendar method <a href="#selectComponents">selectComponents</a>)<br>
|
3113 |
1 - <a href="#DTSTART">DTSTART</a> - <a href="#DTEND">DTEND</a> alt. <a href="#DURATION">DURATION</a> (<a href="#VEVENT">VEVENT</a> and <a href="#VFREEBUSY">VFREEBUSY</a> components)<br>
|
3114 |
1 - <a href="#DTSTART">DTSTART</a> - <a href="#DUE">DUE</a> alt. <a href="#DURATION">DURATION</a> (<a href="#VTODO">VTODO</a> components)<br>
|
3115 |
1 - <a href="#DTSTART">DTSTART</a> (<a href="#VJOURNAL">VJOURNAL</a> components)<br>
|
3118 |
A date value, like "DTSTART;VALUE=DATE:20120717", are sorted before a datetime value.<br>
|
3119 |
<a href="#VTIMEZONE">VTIMEZONE</a> component(-s) is always placed first (ordered by <a href="#TZID">TZID</a>). The
|
3120 |
<a href="#VTIMEZONE">STANDARD</a> / <a href="#VTIMEZONE">DAYLIGHT</a> sub-components are sorted (on asc. key <a href="#DTSTART">DTSTART</a>) when calling
|
3121 |
+
<a href="#createCalendar">createCalendar</a> (or <a href="#returnCalendar">returnCalendar</a>).
|
3122 |
<br>
|
3123 |
<a href="#VALARM">ALARM</a> sub-components, if exists, are not sorted.
|
3124 |
|
3126 |
<p class="format">vcalendar::sort()</p>
|
3127 |
<p class="label">Example</p>
|
3128 |
<p class="example">
|
3129 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
3130 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
3131 |
+
);
|
3132 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
3133 |
+
$vcalendar->parse( $iCalContent );
|
3134 |
$vcalendar->sort();
|
3135 |
$vcalendar->returnCalendar();
|
3136 |
exit;
|
3161 |
<p>
|
3162 |
NOTE, the method no longer stops PHP script (exit), returns bool true on success, false on error!
|
3163 |
</p>
|
3164 |
+
<p>
|
3165 |
+
Note, the useCachedCalendar method is subject for change in future versions.
|
3166 |
+
</p>
|
3167 |
<p class="label">Format</p>
|
3168 |
<p class="format">vcalendar::useCachedCalendar( [ timeout [, cdType ]] )</p>
|
3169 |
<p class="comment">timeout = (int) default 3600 sec
|
3171 |
false: Content-Disposition: inline</p>
|
3172 |
<p class="label">Example</p>
|
3173 |
<p class="example">
|
3174 |
+
$vcalendar->setConfig( Kigkonsult\Icalcreator\Util\Util::$DIRECTORY, "depot" );
|
3175 |
+
$vcalendar->setConfig( Kigkonsult\Icalcreator\Util\Util::$FILENAME, "calendar.ics" );
|
3176 |
$vcalendar->useCachedCalendar();
|
3177 |
|
3178 |
</p>
|
3182 |
|
3183 |
<a name="iCalcreatorVersion"></a><h4>3.1.4.7 iCalcreatorVersion</h4>
|
3184 |
<p>
|
3185 |
+
This static class method returns the iCalcreator class version number.
|
3186 |
</p>
|
3187 |
<p>
|
3188 |
There is also a <em>PHP</em> constant "ICALCREATOR_VERSION" (all versions).
|
3195 |
|
3196 |
|
3197 |
|
3198 |
+
<a name="iCalcreator_configuration_methods"></a><h3>3.1.5 Vcalendar configuration</h3>
|
3199 |
|
3200 |
<a name="configKeys"></a><h4>3.1.5.1 configuration keys</h4>
|
3201 |
<p>
|
3222 |
<td class="bl bb ref">getConfig only</td>
|
3223 |
</tr>
|
3224 |
<tr>
|
3225 |
+
<td class="bl bb"><a class="ref" href="#Delimiter">Delimiter</a><sup>1</sup></td>
|
3226 |
<td class="bl bb center">*</td>
|
3227 |
<td class="bl bb"> </td>
|
3228 |
<td class="bl bb ref"> </td>
|
3229 |
</tr>
|
3230 |
<tr>
|
3231 |
+
<td class="bl bb"><a class="ref" href="#Directory">Directory</a><sup>1</sup></td>
|
3232 |
<td class="bl bb center">*</td>
|
3233 |
<td class="bl bb"> </td>
|
3234 |
<td class="bl bb ref"> </td>
|
3235 |
</tr>
|
3236 |
<tr>
|
3237 |
+
<td class="bl bb"><a class="ref" href="#Filename">Filename</a><sup>1</sup></td>
|
3238 |
<td class="bl bb center">*</td>
|
3239 |
<td class="bl bb"> </td>
|
3240 |
<td class="bl bb ref"> </td>
|
3241 |
</tr>
|
3242 |
<tr>
|
3243 |
+
<td class="bl bb"><a class="ref" href="#Dirfile">Dirfile</a><sup>1</sup></td>
|
3244 |
<td class="bl bb center">*</td>
|
3245 |
<td class="bl bb"> </td>
|
3246 |
<td class="bl bb ref">getConfig only</td>
|
3247 |
</tr>
|
3248 |
<tr>
|
3249 |
+
<td class="bl bb"><a class="ref" href="#Filesize">Filesize</a><sup>1</sup></td>
|
3250 |
<td class="bl bb center">*</td>
|
3251 |
<td class="bl bb"> </td>
|
3252 |
<td class="bl bb ref">getConfig only</td>
|
3276 |
<td class="bl bb ref"> </td>
|
3277 |
</tr>
|
3278 |
<tr>
|
3279 |
+
<td class="bl bb"><a class="ref" href="#configURL">URL</a><sup>1</sup></td>
|
3280 |
<td class="bl bb center">*</td>
|
3281 |
<td class="bl bb"> </td>
|
3282 |
<td class="bl bb ref"> </td>
|
3283 |
</tr>
|
3284 |
</table>
|
3285 |
+
<p>
|
3286 |
+
<sup>1</sup> objects for removal in future versions.
|
3287 |
+
</p>
|
3288 |
+
|
3289 |
<br>
|
3290 |
<br>
|
3291 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_configuration_methods">[up]</a>
|
3295 |
<p class="comment">key = (string) config key</p>
|
3296 |
<p class="label">Example 1</p>
|
3297 |
<p class="example">
|
3298 |
+
$uniqueId = $vcalendar->getConfig( Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID );
|
3299 |
|
|
|
|
|
|
|
3300 |
<p class="label">Example 2</p>
|
3301 |
<p class="example">
|
3302 |
$config = $vcalendar->getConfig();
|
3309 |
|
3310 |
<a name="initConfig"></a><h4>3.1.5.3 calendar/component initialization</h4>
|
3311 |
<p class="label">Format</p>
|
3312 |
+
<p>Create a new Vcalendar instance.</p>
|
3313 |
<p class="format">vcalendar::vcalendar( [ config ] )</p>
|
3314 |
<p class="comment">config = (array) ( *[, key => value] )
|
3315 |
key = (string) config key
|
3316 |
value = (mixed) config value</p>
|
3317 |
<p class="label">Example 1</p>
|
3318 |
<p class="example">
|
3319 |
+
$config = [ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se" ];
|
3320 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
3321 |
|
3322 |
</p>
|
3323 |
<p>
|
3331 |
value = (mixed) config value</p>
|
3332 |
<p class="label">Example 2</p>
|
3333 |
<p class="example">
|
3334 |
+
$config = [ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se" ];
|
3335 |
+
$vevent = new Kigkonsult\Icalcreator\Vevent( $config );
|
3336 |
|
3337 |
</p>
|
3338 |
<p class="label">Example 3</p>
|
3339 |
<p class="example">
|
3340 |
$config = $vcalendar->getConfig();
|
3341 |
+
$vevent = new Kigkonsult\Icalcreator\Vevent( $config );
|
3342 |
|
3343 |
</p>
|
3344 |
<p>Only component relevant configuration are set. If using the <a href="#newComponent">newComponent</a> method, configuration is set automatically.</p>
|
3355 |
value = (mixed) config value</p>
|
3356 |
<p class="label">Example 1</p>
|
3357 |
<p class="example">
|
3358 |
+
$config = [
|
3359 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
3360 |
+
];
|
3361 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar();
|
3362 |
$vcalendar->setConfig( $config );
|
3363 |
|
3364 |
</p>
|
|
|
|
|
|
|
|
|
|
|
3365 |
|
|
|
3366 |
<p class="label">Format 2</p>
|
3367 |
<p class="format">vcalendar::setConfig( key, value )</p>
|
3368 |
<p class="comment">key = (string) config key
|
3369 |
value = (mixed) config value</p>
|
3370 |
<p class="label">Example 1</p>
|
3371 |
<p class="example">
|
3372 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar();
|
3373 |
+
$vcalendar->setConfig(
|
3374 |
+
Kigkonsult\Icalcreator\Util\Util::$TZID,
|
3375 |
+
"UTC"
|
3376 |
+
);
|
3377 |
|
3378 |
</p>
|
3379 |
<p class="label">Example 2</p>
|
3380 |
<p class="example">
|
3381 |
+
$vevent = new Kigkonsult\Icalcreator\Vevent();
|
3382 |
+
$vevent->setConfig(
|
3383 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID,
|
3384 |
+
"kigkonsult.se"
|
3385 |
+
);
|
3386 |
|
3387 |
</p>
|
3388 |
<br>
|
3390 |
|
3391 |
<a name="allowEmpty"></a><h4>3.1.5.5 Allow empty components</h4>
|
3392 |
<p>
|
3393 |
+
Allow or reject empty <strong>calendar</strong> properties. Used in <a href="#createCalendar">createCalendar</a>, <a href="#returnCalendar">returnCalendar</a> or
|
3394 |
create<Property> methods, creating [RFC5545] formats.
|
3395 |
</p>
|
3396 |
<p>
|
3401 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_configuration_methods">[up]</a>
|
3402 |
|
3403 |
<a name="Compsinfo"></a><h4>3.1.5.6 Component information</h4>
|
3404 |
+
<p>Only to use with Vcalendar method getConfig.</p>
|
3405 |
<p>
|
3406 |
+
Get information about the Vcalendar instance components. Returns array with basic information
|
3407 |
+
about all components (in array format) within the Vcalendar instance.
|
3408 |
</p>
|
3409 |
<p class="comment">Output = array ( *compinfo )
|
3410 |
compinfo = array ( "ordno" => int ordno,
|
3420 |
// <span class="comment">if subcomponents exists, an array for each subcomponent</span></p>
|
3421 |
<p class="label">Example</p>
|
3422 |
<p class="example">
|
3423 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
3424 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
3425 |
+
);
|
3426 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
3427 |
+
$vcalendar->parse( $iCalContent );
|
3428 |
+
$compsinfo = $vcalendar->getConfig( Kigkonsult\Icalcreator\Util\Util::$COMPSINFO );
|
|
|
3429 |
foreach( $compsinfo as compinfo) {
|
3430 |
+
echo " order number : " . $compinfo["ordno"]."<br/>";
|
3431 |
+
echo " type : " . $compinfo["type"]."<br/>";
|
3432 |
+
echo " UID : " . $compinfo["uid"]."<br/>";
|
3433 |
+
foreach( $compinfo["props"] as $propertyName => $propertyCount ) {
|
3434 |
+
echo " $propertyName = $propertyCount";
|
3435 |
+
if( is_array( $compinfo["sub"] )) {
|
3436 |
+
foreach( $compinfo["sub"] as $subcompinfo ) {
|
3437 |
+
echo " order number : " . $subcompinfo["ordno"]."<br/>";
|
3438 |
+
/* .. dito if subcomponents exists */
|
3439 |
+
}
|
3440 |
+
} // end foreach
|
3441 |
+
} // end foreach
|
3442 |
|
3443 |
</p>
|
3444 |
<br>
|
3449 |
<p>
|
3450 |
Default <em>PHP</em> constant DIRECTORY_SEPARATOR. If used, <b>must</b> be set BEFORE filename!
|
3451 |
</p>
|
3452 |
+
<p>
|
3453 |
+
Note, the delimiter config key is subject for removal in future versions.
|
3454 |
+
A strong recommendation is placing iCal file content acquire/dispose functionality outside iCalcreator,
|
3455 |
+
this will also offer better acquire/dispose control.
|
3456 |
+
</p>
|
3457 |
<br>
|
3458 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_configuration_methods">[up]</a>
|
3459 |
|
3470 |
When setting directory, the <em>PHP</em> realpath function is applied to speed up parse/saveCalendar methods.
|
3471 |
When setting Directory, any previously set <a href="#configURL">URL</a> is removed.
|
3472 |
</p>
|
3473 |
+
<p>
|
3474 |
+
Note, the directory config key is subject for removal in future versions.
|
3475 |
+
A strong recommendation is placing iCal file content acquire/dispose functionality outside iCalcreator,
|
3476 |
+
this will also offer better acquire/dispose control.
|
3477 |
+
</p>
|
3478 |
<p class="label">Example</p>
|
3479 |
<p class="example">
|
3480 |
$dir = 'test';
|
3481 |
+
$config = [ Kigkonsult\Icalcreator\Util\Util::$DIRECTORY => $dir ];
|
3482 |
+
if( false === $vcalendar->setConfig( $config )) {
|
3483 |
+
die( "Invalid directory $dir" );
|
3484 |
+
}
|
3485 |
</p>
|
3486 |
<p>
|
3487 |
For temporary calendar files, you may set directory/<a href="#Filename">filename</a> using <em>PHP</em> functions sys_get_temp_dir() and tempnam().
|
3495 |
|
3496 |
<a name="Dirfile"></a><h4>3.1.5.9 Dirfile</h4>
|
3497 |
<p>
|
3498 |
+
Only available in Vcalendar method getConfig, returning (string) <a href="#Directory">directory</a>, <a href="#Delimiter">delimiter</a> and <a href="#Filename">filename</a>.
|
3499 |
+
</p>
|
3500 |
+
<p>
|
3501 |
+
Note, the dirfile config key is subject for removal in future versions.
|
3502 |
+
A strong recommendation is placing iCal file content acquire/dispose functionality outside iCalcreator,
|
3503 |
+
this will also offer better acquire/dispose control.
|
3504 |
</p>
|
3505 |
<br>
|
3506 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_configuration_methods">[up]</a>
|
3507 |
|
3508 |
<a name="Fileinfo"></a><h4>3.1.5.10 Fileinfo</h4>
|
3509 |
<p>
|
3510 |
+
Only available in Vcalendar method getConfig, giving information in array format about <a href="#Directory">directory</a>,
|
3511 |
<a href="#Filename">filename</a> and <a href="#Filesize">filesize</a>.
|
3512 |
</p>
|
3513 |
+
<p>
|
3514 |
+
Note, the fileinfo config key is subject for removal in future versions.
|
3515 |
+
A strong recommendation is placing iCal file content acquire/dispose functionality outside iCalcreator,
|
3516 |
+
this will also offer better acquire/dispose control.
|
3517 |
+
</p>
|
3518 |
<p class="label">Example</p>
|
3519 |
<p class="example">
|
3520 |
+
$fileinfo = $vcalendar->getConfig( Kigkonsult\Icalcreator\Util\Util::$FILEINFO );
|
3521 |
|
3522 |
</p>
|
3523 |
<p class="comment">output = array( <directory>, <filename>, <filesize> )</p>
|
3529 |
<p class="example">$filename = date( "YmdHis" ).".ics";</p>
|
3530 |
|
3531 |
<p>
|
3532 |
+
If not set, filename is created when requested, ex. in Vcalendar methods <a href="#saveCalendar">saveCalendar</a> or getConfig(Kigkonsult\Icalcreator\Util\Util::$FILENAME).
|
3533 |
</p>
|
3534 |
<p>
|
3535 |
Local filename <b>must</b> be set AFTER setting directory (and opt. delimiter)!
|
3536 |
Filename (and opt. directory) <b>must</b> be readable/writeable otherwise bool false is returned.
|
3537 |
</p>
|
3538 |
+
<p>
|
3539 |
+
Note, the filename config key is subject for removal in future versions.
|
3540 |
+
A strong recommendation is placing iCal file content acquire/dispose functionality outside iCalcreator,
|
3541 |
+
this will also offer better acquire/dispose control.
|
3542 |
+
</p>
|
3543 |
<p class="label">Example</p>
|
3544 |
<p class="example">
|
3545 |
$dir = 'test';
|
3546 |
+
$config = [ Kigkonsult\Icalcreator\Util\Util::$DIRECTORY => $dir ];
|
3547 |
+
if( false === $vcalendar->setConfig( $config )) {
|
3548 |
+
die( "Error when config directory $dir" );
|
3549 |
+
}
|
3550 |
$file = 'temp.ics';
|
3551 |
+
$config = [ Kigkonsult\Icalcreator\Util\Util::$FILENAME => $file ];
|
3552 |
+
if( false === $vcalendar->setConfig( $config )) {
|
3553 |
+
die( "Error when config filename $file" );
|
3554 |
+
}
|
3555 |
</p>
|
3556 |
<p>
|
3557 |
+
For temporary calendar files, you may set <a href="#Directory">directory</a>/<a href="#Filename">filename</a> using <em>PHP</em> functions sys_get_temp_dir() and tempnam().
|
3558 |
</p>
|
3559 |
<p>
|
3560 |
+
Do <b>NOT</b> set <a href="#Directory">directory</a>/<a href="#Filename">filename</a> in <a href="#vcalendar_constr">vcalendar</a> constructor,
|
3561 |
due to inability to detect error (bool false) config return.
|
3562 |
</p>
|
3563 |
<br>
|
3565 |
|
3566 |
<a name="Filesize"></a><h4>3.1.5.12 Filesize</h4>
|
3567 |
<p>
|
3568 |
+
Only when getting configuration (using Vcalendar method getConfig).<br>
|
3569 |
Returns the size of the file in bytes, to be invoked<br>
|
3570 |
- after "saveCalendar()"<br>
|
3571 |
or<br>
|
3572 |
- after a "setConfig( "directory" / "filename" )" and before/after "parse()".<br>
|
3573 |
Getting the filesize for a remote file (URL) will always return zero.
|
3574 |
</p>
|
3575 |
+
<p>
|
3576 |
+
Note, the filesize config key is subject for removal in future versions.
|
3577 |
+
A strong recommendation is placing iCal file content acquire/dispose functionality outside iCalcreator,
|
3578 |
+
this will also offer better acquire/dispose control.
|
3579 |
+
</p>
|
3580 |
<br>
|
3581 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_configuration_methods">[up]</a>
|
3582 |
|
3583 |
<a name="Language"></a><h4>3.1.5.13 Language</h4>
|
3584 |
<p>
|
3585 |
+
Language for the Vcalendar instance and component TEXT value properties as defined in [RFC5546].
|
3586 |
</p>
|
3587 |
<p>
|
3588 |
Default empty.
|
3616 |
<p>
|
3617 |
Note, some <strong>calendar</strong> software may also require calendar property <a href="#Additional_Descriptors">X-WR-TIMEZONE</a>
|
3618 |
and vtimezone component property <a href="#Additional_Descriptors">X-LIC-LOCATION</a>
|
3619 |
+
(to be set manually, examine also the <a href="#createTimezone">createTimezone</a> a TimezoneHandler class method ).
|
3620 |
</p>
|
3621 |
<br>
|
3622 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_configuration_methods">[up]</a>
|
3639 |
The <strong>calendar</strong> property PRODID is always recreated when setting unique_id.
|
3640 |
</p>
|
3641 |
<p>
|
3642 |
+
If missing, the component property <a href="#UID">UID</a> is created at first use of Vcalendar methods <a href="#createCalendar">createCalendar</a>, <a href="#returnCalendar">returnCalendar</a> or <a href="#saveCalendar">saveCalendar</a>
|
3643 |
</p>
|
3644 |
<p>
|
3645 |
+
A strong recommendation is <b>always</b> to set unique_id, creating a new Vcalendar or component instance,
|
3646 |
to ensure accurate creation of all components <a href="#UID">UID</a> property, also before <a href="#parse">parse</a>, in case of missing <a href="#UID">UID</a>.
|
3647 |
</p>
|
3648 |
<br>
|
3665 |
getConfig( "filename" ).
|
3666 |
When using a resource, filename is unset (note <a href="#Filename">filename</a>, above).
|
3667 |
</p>
|
3668 |
+
<p>
|
3669 |
+
Note, the URL config key as well as (internal) URL-parse and (file) save methods are subjects for removal in future versions.
|
3670 |
+
A strong recommendation is placing iCal url content acquire functionality outside iCalcreator,
|
3671 |
+
this will also offer better acquire control.
|
3672 |
+
</p>
|
3673 |
<p class="label">Example</p>
|
3674 |
<p>Parse of remote file, then local save in "depot" folder, using original filename</p>
|
3675 |
<p class="example">
|
3676 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
3677 |
+
[
|
3678 |
+
Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se",
|
3679 |
+
Kigkonsult\Icalcreator\Util\Util::$URL => "http://www.iCal.net/depot/calendar.ics",
|
3680 |
+
]
|
3681 |
+
);
|
3682 |
$vcalendar->parse();
|
3683 |
$vcalendar->sort();
|
3684 |
|
3685 |
+
$vcalendar->setConfig( Kigkonsult\Icalcreator\Util\Util::$DIRECTORY, "depot" );
|
|
|
3686 |
$vcalendar->saveCalendar();
|
3687 |
|
3688 |
</p>
|
3689 |
<br>
|
3690 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#iCalcreator_configuration_methods">[up]</a>
|
3691 |
|
3692 |
+
<a name="Calendar_component_object_property_function_list"></a><h2>3.2 Component property methods</h2>
|
3693 |
<p>
|
3694 |
All iCalcreator component object property methods for get/set data.<br>
|
3695 |
For property format in detail, see
|
3696 |
+
<a href="https://tools.ietf.org/html/rfc2445" title="RFC2445" target="_blank">RFC2445</a> - Internet Calendaring and Scheduling Core Object Specification (iCalendar).
|
3697 |
</p>
|
3698 |
<a name="DATE_WITH_UTC_TIME"></a>
|
3699 |
+
<span class="label">Notice:</span> for properties and VALUE=DATE-TIME in <b>UTC</b> timezone.
|
3700 |
<p class="quotes">RFC2445:
|
3701 |
The date with UTC time, or absolute time,
|
3702 |
is identified by a LATIN CAPITAL LETTER Z suffix character (US-ASCII decimal 90),
|
3705 |
</p>
|
3706 |
<p class="quotes">DTSTART:19980119T070000Z</p>
|
3707 |
<p class="quotes">The <a href="#TZID">TZID</a> property parameter MUST <b>NOT</b> be applied to DATE-TIME properties
|
3708 |
+
whose time values are specified in UTC timezone.
|
3709 |
</p>
|
3710 |
<p>
|
3711 |
<a name="date_restriction"></a>
|
3715 |
Timezones need to be PHP complient!
|
3716 |
</p>
|
3717 |
<a name="deleteProperty_PROP"></a><h3>3.2.1 deleteProperty</h3>
|
3718 |
+
Generic Vcalendar instance delete property method,simplifying removal of <strong>calendar</strong> properties.<br>
|
3719 |
Bool false is returned if no property exists or when end-of-properties at consecutive function calls.
|
3720 |
<p class="label">Format</p>
|
3721 |
<p class="format">calendarComponent::deleteProperty( [ PropName [, order ] )</p>
|
3726 |
<p class="label">Example</p>
|
3727 |
<p>Remove all COMMENT properties in first event component.</p>
|
3728 |
<p class="example">
|
3729 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
3730 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
3731 |
+
);
|
3732 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
3733 |
+
$vcalendar->parse( $iCalContent );
|
3734 |
+
$event = $vcalendar->getComponent( Kigkonsult\Icalcreator\Vcalendar::VEVENT );
|
3735 |
+
while( $event->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$COMMENT )) {
|
3736 |
+
continue;
|
3737 |
+
}
|
|
|
3738 |
</p>
|
3739 |
<br>
|
3740 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_component_object_property_function_list">[up]</a>
|
3760 |
,"params"=> <parameter array>)</p>
|
3761 |
<p class="label">Example</p>
|
3762 |
<p class="example">
|
3763 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar(
|
3764 |
+
[ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se", ]
|
3765 |
+
);
|
3766 |
+
$iCalContent = file_get_contents( "calendar.ics" );
|
3767 |
+
$vcalendar->parse( $iCalContent );
|
3768 |
+
while( $vevent = $vcalendar->getComponent( Kigkonsult\Icalcreator\Vcalendar::VEVENT )) {
|
3769 |
+
$dtstart = $vevent->getProperty( Kigkonsult\Icalcreator\Util\Util::$DTSTART );
|
|
|
3770 |
// <span class="comment">one occurrence</span>
|
3771 |
+
$description = $vevent->getProperty( Kigkonsult\Icalcreator\Util\Util::$DESCRIPTION ); // <span class="comment">one occurrence</span>
|
3772 |
+
while( $comment = $vevent->getProperty( Kigkonsult\Icalcreator\Util\Util::$COMMENT )) { // <span class="comment">MAY occur more than once</span>
|
3773 |
+
.. .
|
3774 |
+
}
|
3775 |
}
|
3776 |
|
3777 |
</p>
|
3778 |
<p>
|
3779 |
+
To get Vcalendar instance property values, use <a href="#getProperty">getProperty</a>.
|
3780 |
+
</p>
|
3781 |
<br>
|
3782 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_component_object_property_function_list">[up]</a>
|
3783 |
|
3810 |
property name <b>must</b> start string / rows(-s)</p>
|
3811 |
<p class="label">example</p>
|
3812 |
<p class="example">
|
3813 |
+
$e = $vcalendar->newComponent( Kigkonsult\Icalcreator\Vcalendar::VEVENT );
|
3814 |
$e->parse( "DTSTAMP:19970324T1200Z" );
|
3815 |
$e->parse( "SEQUENCE:0" );
|
3816 |
$e->parse( "ORGANIZER:MAILTO:jdoe@host1.com" );
|
3817 |
+
$e->parse( [
|
3818 |
+
"ATTENDEE;RSVP=TRUE:MAILTO:jsmith@host1.com",
|
3819 |
+
"ATTENDEE;RSVP=TRUE:MAILTO:jsmith@host2.com",
|
3820 |
+
"ATTENDEE;RSVP=TRUE:MAILTO:jsmith@host3.com",
|
3821 |
+
"ATTENDEE;RSVP=TRUE:MAILTO:jsmith@host4.com"
|
3822 |
+
]);
|
3823 |
$e->parse( "DTSTART:19970324T123000Z" );
|
3824 |
$e->parse( "DTEND:19970324T210000Z" );
|
3825 |
$e->parse( "CATEGORIES:MEETING,PROJECT" );
|
3841 |
. "- Next weeks meeting is cancelled. No meeting until 3/23." );
|
3842 |
$e->parse( "LOCATION:LDB Lobby" );
|
3843 |
$e->parse( "ATTACH;FMTTYPE=application/postscript:ftp://xyz.com/pub/conf/bkgrnd.ps" );
|
3844 |
+
$e->parse( [
|
3845 |
+
"BEGIN:VALARM",
|
3846 |
+
"ACTION:AUDIO",
|
3847 |
+
"TRIGGER;VALUE=DATE-TIME:19970224T070000Z",
|
3848 |
+
"ATTACH;FMTTYPE=audio/basic:http://host.com/pub/audio-files/ssbanner.aud",
|
3849 |
+
"REPEAT:4",
|
3850 |
+
"DURATION:PT1H",
|
3851 |
+
"X-alarm:non-standard ALARM property",
|
3852 |
+
"END:VALARM"
|
3853 |
+
]);
|
3854 |
$e->parse( "X-xomment:non-standard property will be displayed, comma escaped");
|
3855 |
|
3856 |
</p>
|
3878 |
</p>
|
3879 |
<p class="label">Example</p>
|
3880 |
<p class="example">
|
3881 |
+
$vevent = $vcalendar->newComponent( Kigkonsult\Icalcreator\Vcalendar::VEVENT );
|
3882 |
+
$vevent->setProperty(
|
3883 |
+
Kigkonsult\Icalcreator\Util\Util::$DTSTART,
|
3884 |
+
new DateTime( "2007-04-01 19:00:00" )
|
3885 |
+
);
|
3886 |
+
$vevent->setProperty(
|
3887 |
+
Kigkonsult\Icalcreator\Util\Util::$DURATION,
|
3888 |
+
new DateInterval( "PT3H" )
|
3889 |
+
);
|
3890 |
+
$vevent->setProperty(
|
3891 |
+
Kigkonsult\Icalcreator\Util\Util::$LOCATION,
|
3892 |
+
quot;Central Plaza"
|
3893 |
+
);
|
3894 |
+
$vevent->setProperty(
|
3895 |
+
Kigkonsult\Icalcreator\Util\Util::$SUMMARY,
|
3896 |
+
"PHP summit"
|
3897 |
+
);
|
3898 |
|
3899 |
</p>
|
3900 |
<br>
|
3908 |
This property is REQUIRED and MUST NOT occur more than once. ("PROCEDURE" is deprecated in [RFC5545].)
|
3909 |
</p>
|
3910 |
<p>
|
3911 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$ACTION as used in code snippets is available.
|
3912 |
</p>
|
3913 |
<h5>Create ACTION</h5>
|
3914 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
3925 |
<p class="format">calendarComponent::deleteProperty( "Action" )</p>
|
3926 |
<p class="label">Example</p>
|
3927 |
<p class="example">
|
3928 |
+
$valarm->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$ACTION );
|
3929 |
|
3930 |
</p>
|
3931 |
<h5>Get ACTION</h5>
|
3939 |
, "params" => xparams<sup>2</sup> )</p>
|
3940 |
<p class="label">Example</p>
|
3941 |
<p class="example">
|
3942 |
+
$action = $valarm->getProperty( Kigkonsult\Icalcreator\Util\Util::$ACTION );
|
3943 |
|
3944 |
</p>
|
3945 |
<h5>Set ACTION</h5>
|
3946 |
+
<p>Set property value.</p>
|
3947 |
<p class="label">Format</p>
|
3948 |
<p class="format">calendarComponent::setProperty( "Action", actionValue [, xparams ] )</p>
|
3949 |
<p class="comment">actionValue<sup>1</sup> = (string) one of "AUDIO" / "DISPLAY" / "EMAIL" / "PROCEDURE"
|
3951 |
</p>
|
3952 |
<p class="label">Example</p>
|
3953 |
<p class="example">
|
3954 |
+
$valarm->setProperty( Kigkonsult\Icalcreator\Util\Util::$ACTION, "DISPLAY" );
|
|
|
3955 |
|
3956 |
</p>
|
3957 |
<br>
|
3975 |
to ensure proper line folding when using <a href="#createCalendar">createCalendar</a> and/or <a href="#returnCalendar">returnCalendar</a>.
|
3976 |
</p>
|
3977 |
<p>
|
3978 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$ATTACH as used in code snippets is available.
|
3979 |
</p>
|
3980 |
<h5>Create ATTACH</h5>
|
3981 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
3992 |
<p class="format">calendarComponent::deleteProperty( "ATTACH" )</p>
|
3993 |
<p class="label">Example 1</p>
|
3994 |
<p class="example">
|
3995 |
+
$valarm->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$ATTACH );
|
3996 |
|
3997 |
</p>
|
3998 |
<p class="label">Example 2</p>
|
3999 |
Delete ATTACH property no 2.
|
4000 |
<p class="example">
|
4001 |
+
$valarm->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$ATTACH, 2 );
|
4002 |
|
4003 |
</p>
|
4004 |
<p class="label">Example 3</p>
|
4005 |
Deleting all ATTACH properties.
|
4006 |
<p class="example">
|
4007 |
+
while( $valarm->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$ATTACH )) {
|
4008 |
+
continue;
|
4009 |
+
}
|
4010 |
</p>
|
4011 |
<h5>Get ATTACH</h5>
|
4012 |
<p>If set, returns property value(-s), otherwise bool false.</p>
|
4024 |
<p class="comment">Get propOrderNo ATTACH</p>
|
4025 |
<p class="label">Example</p>
|
4026 |
<p class="example">
|
4027 |
+
$attach = $valarm->getProperty( Kigkonsult\Icalcreator\Util\Util::$ATTACH );
|
4028 |
|
4029 |
</p>
|
4030 |
<h5>Set ATTACH</h5>
|
4031 |
+
<p>Set property value. Parameters will be ordered as prescribed in [RFC5545].</p>
|
4032 |
<p class="label">Format</p>
|
4033 |
<p class="format">calendarComponent::setProperty( "attach", attachValue<sup>1</sup> [, params [, propOrderNo ]] )</p>
|
4034 |
<p class="comment">attachValue<sup>1</sup> = (string) URI / inline binary encoded content
|
4042 |
</p>
|
4043 |
<p class="label">Example</p>
|
4044 |
<p class="example">
|
4045 |
+
$vevent->setProperty(
|
4046 |
+
Kigkonsult\Icalcreator\Util\Util::$ATTACH,
|
4047 |
+
"ftp://domain.com/pub/docs/agenda.doc",
|
4048 |
+
[ "FMTTYPE" => "application/binary" ]
|
4049 |
+
);
|
4050 |
|
4051 |
</p>
|
4052 |
<br>
|
4062 |
<p>You can <a href="#sort2">SORT</a> <strong>calendar</strong> (components) on (asc) ATTENDEE values.</p>
|
4063 |
<p>You can export <strong>calendar</strong> ATTENDEE values as <a href="#iCal2vCards">vCards</a>.
|
4064 |
<p>
|
4065 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$ATTENDEE as used in code snippets is available.
|
4066 |
</p>
|
4067 |
<h5>Create ATTENDEE</h5>
|
4068 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
4080 |
<p class="label">Example 1</p>
|
4081 |
<p>Delete (single/first) ATTENDEE property</p>
|
4082 |
<p class="example">
|
4083 |
+
$valarm->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$ATTENDEE );
|
4084 |
|
4085 |
</p>
|
4086 |
<p class="label">Example 2</p>
|
4087 |
<p>Delete ATTENDEE property no 2.</p>
|
4088 |
<p class="example">
|
4089 |
+
$valarm->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$ATTENDEE, 2 );
|
4090 |
|
4091 |
</p>
|
4092 |
<p class="label">Example 3</p>
|
4093 |
Deleting all ATTENDEE properties.
|
4094 |
<p class="example">
|
4095 |
+
while( $valarm->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$ATTENDEE )) {
|
4096 |
+
continue;
|
4097 |
+
}
|
4098 |
</p>
|
4099 |
<h5>Get ATTENDEE</h5>
|
4100 |
<p>If set, returns property value(-s), otherwise bool false.</p>
|
4112 |
<p class="comment">output = attendeeValue<sup>1</sup></p>
|
4113 |
<p class="label">Example</p>
|
4114 |
<p class="example">
|
4115 |
+
$attendee = $valarm->getProperty( Kigkonsult\Icalcreator\Util\Util::$ATTENDEE );
|
4116 |
|
4117 |
</p>
|
4118 |
<h5>Set ATTENDEE</h5>
|
4119 |
<p>
|
4120 |
+
Set property value. If exist, default parameter values are removed after input (params<sup>2</sup>).
|
4121 |
Property value must be prefixed by protocol (ftp://, http://,mailto:, file:// ref. rfc 1738 ),
|
4122 |
if missing, "mailto:" is set (indicating an internet mail address).
|
4123 |
Also MEMBER and DIR parameters must be prefixed by protocol. DELEGATED-TO, DELEGATED-FROM, SENT-BY parameters
|
4225 |
propOrderNo = (int) order number // <span class="comment">1=1st, 2=2nd etc</span>
|
4226 |
lang<sup>*</sup> = as defined in [RFC5546]</p>
|
4227 |
<p>
|
4228 |
+
See rules in detail in <a href="https://tools.ietf.org/html/rfc2445" title="RFC2445" target="_blank">RFC2445</a> - Internet Calendaring and Scheduling Core Object Specification (iCalendar).
|
4229 |
</p>
|
4230 |
<p class="label">Example</p>
|
4231 |
<p class="example">
|
4232 |
+
$vevent->setProperty( Kigkonsult\Icalcreator\Util\Util::$ATTENDEE, "attendee1@ical.net" );
|
4233 |
+
$vevent->setProperty(
|
4234 |
+
Kigkonsult\Icalcreator\Util\Util::$ATTENDEE,
|
4235 |
+
"attendee2@ical.net",
|
4236 |
+
[
|
4237 |
+
"cutype" => "INDIVIDUAL",
|
4238 |
+
"member" => [
|
4239 |
+
"member1@ical.net",
|
4240 |
+
"member2@ical.net",
|
4241 |
+
"member3@ical.net"
|
4242 |
+
],
|
4243 |
+
"role" => "CHAIR",
|
4244 |
+
"PARTSTAT" => "ACCEPTED",
|
4245 |
+
"RSVP" => "TRUE",
|
4246 |
+
"DELEgated-to" => [
|
4247 |
+
"part1@ical.net",
|
4248 |
+
"part2@ical.net",
|
4249 |
+
"part3@ical.net"
|
4250 |
+
],
|
4251 |
+
"delegateD-FROM" => [
|
4252 |
+
"cio@ical.net",
|
4253 |
+
"vice.cio@ical.net"
|
4254 |
+
],
|
4255 |
+
"SENT-BY" => "secretary@ical.net",
|
4256 |
+
"LANGUAGE" => "us-EN",
|
4257 |
+
"CN" => "John Doe",
|
4258 |
+
"DIR" => "http://www.ical.net/info.doc",
|
4259 |
+
"x-agenda" => "status reports", <span class="comment">// xparam</span>
|
4260 |
+
"x-length" => "15 min" <span class="comment">// xparam</span>
|
4261 |
+
]
|
4262 |
+
);
|
4263 |
</p>
|
4264 |
<br>
|
4265 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_component_object_property_function_list">[up]</a>
|
4273 |
</p>
|
4274 |
<p>You can <a href="#sort2">SORT</a> <strong>calendar</strong> (components) on (asc) CATEGORIES values.</p>
|
4275 |
<p>
|
4276 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$CATEGORIES as used in code snippets is available.
|
4277 |
</p>
|
4278 |
|
4279 |
<h5>Create CATEGORIES</h5>
|
4292 |
<p class="label">Example 1</p>
|
4293 |
<p>Delete (single/first) CATEGORIES property</p>
|
4294 |
<p class="example">
|
4295 |
+
$vevent->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$CATEGORIES );
|
4296 |
|
4297 |
</p>
|
4298 |
<p class="label">Example 2</p>
|
4299 |
<p>Delete CATEGORIES property no 2.</p>
|
4300 |
<p class="example">
|
4301 |
+
$vevent->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$CATEGORIES, 2 );
|
4302 |
|
4303 |
</p>
|
4304 |
<p class="label">Example 3</p>
|
4305 |
<p>Deleting all CATEGORIES properties.</p>
|
4306 |
<p class="example">
|
4307 |
+
while( $vevent->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$CATEGORIES )) {
|
4308 |
+
continue;
|
4309 |
+
}
|
4310 |
</p>
|
4311 |
<h5>Get CATEGORIES</h5>
|
4312 |
<p>If set, returns property value(-s), otherwise bool false.</p>
|
4324 |
<p class="comment">Get propOrderNo CATEGORIES</p>
|
4325 |
<p class="label">Example</p>
|
4326 |
<p class="example">
|
4327 |
+
$categories = $valarm->getProperty( Kigkonsult\Icalcreator\Util\Util::$CATEGORIES );
|
4328 |
|
4329 |
</p>
|
4330 |
<h5>Set CATEGORIES</h5>
|
4331 |
+
<p>Set property value.</p>
|
4332 |
<p>
|
4333 |
In spite of the fact that CATEGORIES may contain a (comma separated) list of values,
|
4334 |
a strong recommendation is to split a CATEGORIES "list" into multiple single CATEGORIES entries.
|
4346 |
lang<sup>*</sup> = as defined in [RFC5546]</p>
|
4347 |
<p class="label">Example</p>
|
4348 |
<p class="example">
|
4349 |
+
$vevent->setProperty( Kigkonsult\Icalcreator\Util\Util::$CATEGORIES, "project_x" );
|
|
|
4350 |
|
4351 |
</p>
|
4352 |
<br>
|
4359 |
and MUST NOT occur more than once in <a href="#VEVENT">VEVENT</a>, <a href="#VTODO">VTODO</a> and <a href="#VJOURNAL">VJOURNAL</a> components.
|
4360 |
</p>
|
4361 |
<p>
|
4362 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$CLASS as used in code snippets is available.
|
4363 |
</p>
|
4364 |
<h5>Create CLASS</h5>
|
4365 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
4376 |
<p class="format">calendarComponent::deleteProperty( "CLASS" )</p>
|
4377 |
<p class="label">Example</p>
|
4378 |
<p class="example">
|
4379 |
+
$vjournal->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$CLASS );
|
4380 |
|
4381 |
</p>
|
4382 |
<h5>Get CLASS</h5>
|
4390 |
, "params" => xparams<sup>2</sup> )</p>
|
4391 |
<p class="label">Example</p>
|
4392 |
<p class="example">
|
4393 |
+
$class = $valarm->getProperty( Kigkonsult\Icalcreator\Util\Util::$CLASS );
|
4394 |
|
4395 |
</p>
|
4396 |
<h5>Set CLASS</h5>
|
4397 |
+
<p>Set property value.</p>
|
4398 |
<p class="label">Format</p>
|
4399 |
<p class="format">calendarComponent::setProperty( "class", classvalue [, xparams ] )</p>
|
4400 |
<p class="comment">classvalue<sup>1</sup> = "PUBLIC"
|
4406 |
</p>
|
4407 |
<p class="label">Example</p>
|
4408 |
<p class="example">
|
4409 |
+
$vevent->setProperty( Kigkonsult\Icalcreator\Util\Util::$CLASS, "CONFIDENTIAL" );
|
|
|
4410 |
|
4411 |
</p>
|
4412 |
<br>
|
4419 |
</p>
|
4420 |
<p>The value type for COMMENT is TEXT.</p>
|
4421 |
<p>
|
4422 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$COMMENT as used in code snippets is available.
|
4423 |
</p>
|
4424 |
<h5>Create COMMENT</h5>
|
4425 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
4437 |
<p class="label">Example 1</p>
|
4438 |
<p>Delete (single/first) COMMENT property</p>
|
4439 |
<p class="example">
|
4440 |
+
$vevent->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$COMMENT );
|
4441 |
|
4442 |
</p>
|
4443 |
<p class="label">Example 2</p>
|
4444 |
<p>Delete COMMENT property no 2.</p>
|
4445 |
<p class="example">
|
4446 |
+
$vevent->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$COMMENT, 2 );
|
4447 |
|
4448 |
</p>
|
4449 |
<p class="label">Example 3</p>
|
4450 |
<p>Deleting all COMMENT properties.</p>
|
4451 |
<p class="example">
|
4452 |
+
while( $vevent->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$COMMENT )) {
|
4453 |
+
continue;
|
4454 |
+
}
|
4455 |
</p>
|
4456 |
<h5>Get COMMENT</h5>
|
4457 |
<p>If set, returns property value, otherwise bool false.</p>
|
4469 |
<p class="comment">Get propOrderNo COMMENT</p>
|
4470 |
<p class="label">Example</p>
|
4471 |
<p class="example">
|
4472 |
+
$comment = $vevent->getProperty( Kigkonsult\Icalcreator\Util\Util::$COMMENT );
|
4473 |
|
4474 |
</p>
|
4475 |
<h5>Set COMMENT</h5>
|
4476 |
+
<p>Set property value. Parameters will be ordered as prescribed in [RFC5545].</p>
|
4477 |
<p class="label">Format</p>
|
4478 |
<p class="format">calendarComponent::setProperty( "comment", commentValue [, params [, propOrderNo ]] )</p>
|
4479 |
<p class="comment">commentValue<sup>1</sup> = (string) Value type Text
|
4486 |
lang<sup>*</sup> = as defined in [RFC5546]</p>
|
4487 |
<p class="label">Example</p>
|
4488 |
<p class="example">
|
4489 |
+
$vevent->setProperty( Kigkonsult\Icalcreator\Util\Util::$COMMENT, "this is a comment" );
|
|
|
4490 |
|
4491 |
</p>
|
4492 |
<br>
|
4497 |
<p>
|
4498 |
This property defines the date and time that a <a href="#VTODO">VTODO</a> was actually completed and is OPTIONAL and MUST NOT occur more than once.
|
4499 |
</p>
|
4500 |
+
<p>The value type for COMPLETED is <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME.</p>
|
4501 |
<p>For methods and formatting, explore the <a href="#CREATED">CREATED</a> property.</p>
|
4502 |
<p>
|
4503 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$CREATED as used in code snippets is available.
|
4504 |
</p>
|
4505 |
<br>
|
4506 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_component_object_property_function_list">[up]</a>
|
4517 |
<p>You can <a href="#sort2">SORT</a> <strong>calendar</strong> (components) on (asc) CONTACT values.</p>
|
4518 |
<p>You can export <strong>calendar</strong> CONTACT values as <a href="#iCal2vCards">vCards</a>.
|
4519 |
<p>
|
4520 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$CONTACT as used in code snippets is available.
|
4521 |
</p>
|
4522 |
<h5>Create CONTACT</h5>
|
4523 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
4535 |
<p class="label">Example 1</p>
|
4536 |
<p>Delete (single/first) CONTACT property<p>
|
4537 |
<p class="example">
|
4538 |
+
$vevent->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$CONTACT );
|
4539 |
|
4540 |
</p>
|
4541 |
<p class="label">Example 2</p>
|
4542 |
<p>Delete CONTACT property no 2.</p>
|
4543 |
<p class="example">
|
4544 |
+
$vevent->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$CONTACT, 2 );
|
4545 |
|
4546 |
</p>
|
4547 |
<p class="label">Example 3</p>
|
4548 |
<p>Deleting all CONTACT properties.</p>
|
4549 |
<p class="example">
|
4550 |
+
while( $vevent->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$CONTACT )) {
|
4551 |
+
continue;
|
4552 |
+
}
|
4553 |
</p>
|
4554 |
<h5>Get CONTACT</h5>
|
4555 |
<p>If set, returns property value, otherwise bool false.</p>
|
4567 |
<p class="comment">Get propOrderNo CONTACT</p>
|
4568 |
<p class="label">Example</p>
|
4569 |
<p class="example">
|
4570 |
+
$contact = $vevent->getProperty( Kigkonsult\Icalcreator\Util\Util::$CONTACT );
|
4571 |
|
4572 |
</p>
|
4573 |
<h5>Set CONTACT</h5>
|
4574 |
+
<p>Set property value. Parameters will be ordered as prescribed in [RFC5545].</p>
|
4575 |
<p class="label">Format</p>
|
4576 |
<p class="format">calendarComponent::setProperty( "contact", contactValue [, params [, propOrderNo ]] )</p>
|
4577 |
<p class="comment">contactValue<sup>1</sup> = (string) Value type TEXT
|
4584 |
lang<sup>*</sup> = as defined in [RFC5546]</p>
|
4585 |
<p class="label">Example</p>
|
4586 |
<p class="example">
|
4587 |
+
$c->setProperty( Kigkonsult\Icalcreator\Util\Util::$CONTACT, "tel 012-34 56 789" )
|
|
|
4588 |
|
4589 |
</p>
|
4590 |
<br>
|
4599 |
The property is OPTIONAL and MUST NOT occur more than once in <a href="#VEVENT">VEVENT</a>,
|
4600 |
<a href="#VTODO">VTODO</a> and <a href="#VJOURNAL">VJOURNAL</a> components.
|
4601 |
</p>
|
4602 |
+
<p>The value type for CREATED is <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME.</p>
|
4603 |
<p>
|
4604 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$CREATED as used in code snippets is available.
|
4605 |
</p>
|
4606 |
<h5>Create CREATED</h5>
|
4607 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
4618 |
<p class="format">calendarComponent::deleteProperty( "CREATED" )</p>
|
4619 |
<p class="label">Example</p>
|
4620 |
<p class="example">
|
4621 |
+
$vevent->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$CREATED );
|
4622 |
|
4623 |
</p>
|
4624 |
<h5>Get CREATED</h5>
|
4632 |
, "params" => xparams<sup>2</sup> )</p>
|
4633 |
<p class="label">Example</p>
|
4634 |
<p class="example">
|
4635 |
+
$created = $vevent->getProperty( Kigkonsult\Icalcreator\Util\Util::$CREATED );
|
4636 |
|
4637 |
</p>
|
4638 |
<h5>Set CREATED</h5>
|
4639 |
<p>
|
4640 |
+
Set property value. Input date is always a <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME or,
|
4641 |
+
if "offset" parameter is used, converted to a <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME.
|
4642 |
+
Notice, you can use the <a href="#transformDateTime">TimezoneHandler::transformDateTime()</a> method to change a local datetime to UTC datetime.
|
4643 |
</p>
|
4644 |
<p>The current UTC date-time is set if invoked without parameters.</p>
|
4645 |
<p class="label">Format</p>
|
4646 |
<p class="format">calendarComponent::setProperty( "created", [ createdDate [, xparams ]] )</p>
|
4647 |
+
<p class="comment"> // Recommended formats
|
4648 |
+
createdDate = (object) DateTime class instance, will be set to UTC if not UTC timezone
|
4649 |
+
createdDate = (string) date/datetime string<sup>*</sup>
|
4650 |
+
|
4651 |
+
// Supported but are objects for removal in future versions
|
4652 |
+
createdDate<sup>1</sup> = (array) ( "year" => (int) year
|
4653 |
, "month" => (int) month
|
4654 |
, "day" => (int) day
|
4655 |
[, "hour" => (int) hour
|
4669 |
, (int) min
|
4670 |
, (int) sec
|
4671 |
[, offset ]] )
|
4672 |
+
// <span class="comment">results in a <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME</span>
|
4673 |
+
createdDate = (array) ( "timestamp" => (int) timestamp )
|
4674 |
+
|
4675 |
+
// <span class="comment">(arr/str) local date + UTC offset will result in a <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME</span>
|
4676 |
+
offset = (int) (+/-)HHmm[ss]
|
4677 |
+
// <span class="comment">key prefix "X-"</span>
|
4678 |
+
xparams<sup>2</sup> = array( *[ (string) key => (string) value ] )
|
4679 |
<br>date/datetime string<sup>*</sup> recommended formats
|
4680 |
"20110625", "2011-06-25", "2011/06/26"
|
4681 |
"20110625051015", "20110625 051015"
|
4687 |
<span class="comment">(notice <a href="#date_restriction">date restriction</a>)</span></p>
|
4688 |
<p class="label">Example 1</p>
|
4689 |
<p class="example">
|
4690 |
+
$config = [ Kigkonsult\Icalcreator\Util\Util::$UNIQUE_ID => "kigkonsult.se" ];
|
4691 |
+
$vcalendar = new Kigkonsult\Icalcreator\Vcalendar( $config );
|
4692 |
+
$vtodo = $vcalendar->newComponent( Kigkonsult\Icalcreator\Vcalendar::VTODO );
|
4693 |
|
4694 |
+
$vtodo->setProperty(
|
4695 |
+
Kigkonsult\Icalcreator\Util\Util::$CREATED,
|
4696 |
+
new DateTime( '2006-08-11 14:30:35 UTC')
|
4697 |
+
);
|
4698 |
+
// <span class="comment">11 august 2006 14.30.35 UTC</span>
|
4699 |
|
4700 |
</p>
|
4701 |
<p class="label">Example 2</p>
|
4702 |
<p class="example">
|
4703 |
+
$vevent->setProperty( Kigkonsult\Icalcreator\Util\Util::$CREATED );
|
4704 |
+
// <span class="comment">current UTC date-time is set if invoked without parameters</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4705 |
|
4706 |
</p>
|
4707 |
<br>
|
4718 |
</p>
|
4719 |
<p>The value type for DESCRIPTION is TEXT.</p>
|
4720 |
<p>
|
4721 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$DESCRIPTION as used in code snippets is available.
|
4722 |
</p>
|
4723 |
<h5>Create DESCRIPTION</h5>
|
4724 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
4736 |
<p class="label">Example 1</p>
|
4737 |
<p>Delete (single/first) DESCRIPTION property.</p>
|
4738 |
<p class="example">
|
4739 |
+
$vevent->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$DESCRIPTION );
|
4740 |
|
4741 |
</p>
|
4742 |
<p class="label">Example 2</p>
|
4743 |
<p>Delete DESCRIPTION property no 2.</p>
|
4744 |
<p class="example">
|
4745 |
+
$vjournal->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$DESCRIPTION, 2 );
|
4746 |
|
4747 |
</p>
|
4748 |
<p class="label">Example 3</p>
|
4749 |
<p>Deleting all DESCRIPTION properties.</p>
|
4750 |
<p class="example">
|
4751 |
+
while( $vjournal->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$DESCRIPTION )) {
|
4752 |
+
continue;
|
4753 |
+
}
|
4754 |
</p>
|
4755 |
<h5>Get DESCRIPTION</h5>
|
4756 |
<p>If set, returns property value(-s), otherwise bool false.</p>
|
4763 |
, "params" => params<sup>2</sup> )</p>
|
4764 |
<p class="label">Example</p>
|
4765 |
<p class="example">
|
4766 |
+
$description = $vevent->getProperty( Kigkonsult\Icalcreator\Util\Util::$DESCRIPTION );
|
4767 |
|
4768 |
</p>
|
4769 |
<h5>Set DESCRIPTION</h5>
|
4770 |
+
<p>Set property value.</p>
|
4771 |
<br>
|
4772 |
Parameters will be ordered as prescribed in [RFC5545].
|
4773 |
<p class="label">Format</p>
|
4782 |
lang<sup>*</sup> = as defined in [RFC5546]</p>
|
4783 |
<p class="label">Example</p>
|
4784 |
<p class="example">
|
4785 |
+
$vevent->setProperty( Kigkonsult\Icalcreator\Util\Util::$DESCRIPTION, "This is a description" );
|
|
|
4786 |
|
4787 |
</p>
|
4788 |
<br>
|
4799 |
The default value type for DTEND is DATE-TIME, can be set to a DATE value type.
|
4800 |
</p>
|
4801 |
<p>
|
4802 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$DTEND as used in code snippets is available.
|
4803 |
</p>
|
4804 |
<p class="quotes">
|
4805 |
The value type of the "DTEND" or "DUE" properties MUST match the value type of "DTSTART" property as defined in [RFC5545])
|
4825 |
<p class="format">calendarComponent::deleteProperty( "DTEND" )</p>
|
4826 |
<p class="label">Example</p>
|
4827 |
<p class="example">
|
4828 |
+
$vevent->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$DTEND );
|
4829 |
|
4830 |
</p>
|
4831 |
<h5>Get DTEND</h5>
|
4839 |
, "params" => params<sup>2</sup> )</p>
|
4840 |
<p class="label">Example</p>
|
4841 |
<p class="example">
|
4842 |
+
$dtend = $vevent->getProperty( Kigkonsult\Icalcreator\Util\Util::$DTEND );
|
4843 |
|
4844 |
</p>
|
4845 |
<h5>Set DTEND</h5>
|
4846 |
<p>
|
4847 |
+
Set property value. If DATE value type is expected, "VALUE" = "DATE" <b>must</b> be set
|
4848 |
(in params<sup>2</sup>) otherwise DATE-TIME (default) value type is set.
|
4849 |
</p>
|
4850 |
<p>
|
4851 |
If no timezone parameter (tz or tzidparam below) is set (i.e.local time) and config <a href="#dTZID">TZID</a> is set,
|
4852 |
date-time values will be set WITH timezone from config.
|
4853 |
+
Note, if not using DateTime, use function <a href="#transformDateTime">transformDateTime</a>
|
4854 |
+
to change a (local) date value to UTC time zone.
|
4855 |
+
</p>
|
4856 |
+
<p>
|
4857 |
+
Within the "VFREEBUSY" <strong>calendar</strong> component,
|
4858 |
+
the time MUST be specified in the <a href="#DATE_WITH_UTC_TIME">UTC</a> datetime zone.
|
4859 |
</p>
|
4860 |
+
|
4861 |
<p>Parameters will be ordered as prescribed in [RFC5545].</p>
|
4862 |
<p class="label">Format</p>
|
4863 |
<p class="format">calendarComponent::setProperty( "dtend", dtendDate [, params<sup>2</sup> ] )
|
4864 |
+
<p class="comment"> // Recommended formats
|
4865 |
+
dtendDate = (object) DateTime class instance
|
4866 |
+
dtendDate = (string) date/datetime string<sup>*</sup>
|
4867 |
+
|
4868 |
+
// Supported but are objects for removal in future versions
|
4869 |
+
dtendDate<sup>1</sup> = (array) ( "year" => (int) year
|
4870 |
, "month" => (int) month
|
4871 |
, "day" => (int) day
|
4872 |
[, "hour" => (int) hour
|
4888 |
, (int) sec
|
4889 |
[, tz ]] )
|
4890 |
dtendDate = (array) ( "timestamp" => (int) timestamp [,"tz" => tz])
|
4891 |
+
// <span class="comment">timestamp without tz will result in a <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone</span>
|
4892 |
+
// <span class="comment">timestamp with tz=offset will result in a local DATE-TIME</span>
|
4893 |
+
|
4894 |
+
|
|
|
4895 |
tz = (string) <timezone identifier> / offset
|
4896 |
+
// <span class="comment">timezone will be used as tzidparam (below), if tzidparam not set</span>
|
4897 |
offset = (int) (+/-)HHmm[ss] // <span class="comment">(arr/str) local date + UTC offset</span>
|
4898 |
+
// <span class="comment">will result in a <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone</span>
|
4899 |
+
|
4900 |
params<sup>2</sup> = (array) ([ tzidparam/datetimeparam/dateparam ] *[,xparams])
|
4901 |
+
tzidparam = Kigkonsult\Icalcreator\Util\Util::$TZID => (string) <timezone identifier>
|
4902 |
+
// <span class="comment">output as local date-time with timezone identifier</span>
|
4903 |
+
// <span class="comment">if tzidparam="GMT"/"UTC" then</span>
|
4904 |
+
// <span class="comment">output date-time is suffixed by 'Z'</span>
|
4905 |
datetimeparam = "VALUE" => "DATE-TIME" // <span class="comment">default, output as date-time</span>
|
4906 |
dateparam = "VALUE" => "DATE" // <span class="comment">output as DATE, ex. all-day event</span>
|
4907 |
xparams = (string) key => (string) value // <span class="comment">key prefix "X-"</span>
|
4913 |
"2011/06/25 05:10:15", "2011/06/25T05:10:15", "2011/06/25t05:10:15"
|
4914 |
trailing characters (digits), if exists, will be interpreted as offset/timezone
|
4915 |
other string formats, acceptable by <em>PHP</em> strtotime function, may (would) work
|
4916 |
+
<span class="comment">(notice <a href="#date_restriction">date restriction</a>)</span>
|
4917 |
+
</p>
|
4918 |
<p class="label">Example 1</p>
|
4919 |
<p class="example">
|
4920 |
+
$vevent->setProperty(
|
4921 |
+
Kigkonsult\Icalcreator\Util\Util::$DTEND,
|
4922 |
+
new DateTime( '2006-08-11 16:30:00' )
|
4923 |
+
);
|
4924 |
+
<span class="comment">// 11 august 2006 16.30.00 local date</span>
|
4925 |
|
4926 |
</p>
|
4927 |
<p class="label">Example 2</p>
|
4928 |
<p class="example">
|
4929 |
+
$vevent->setProperty(
|
4930 |
+
Kigkonsult\Icalcreator\Util\Util::$DTEND,
|
4931 |
+
'20060811',
|
4932 |
+
[ Kigkonsult\Icalcreator\Util\Util::$VALUE => Kigkonsult\Icalcreator\Util\Util::$DATE ]
|
4933 |
+
);
|
4934 |
+
<span class="comment">// end of an all-day event</span>
|
4935 |
|
4936 |
</p>
|
4937 |
<p class="label">Example 3</p>
|
4938 |
<p class="example">
|
4939 |
+
$vevent->setProperty(
|
4940 |
+
Kigkonsult\Icalcreator\Util\Util::$DTEND,
|
4941 |
+
new DateTime( '2006-08-11 09:30:00', new DateTImeZone( 'Europe/Stockholm' ));
|
4942 |
+
<span class="comment">// output: DTEND;TZID=Europe/Stockholm:20060811T093000</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4943 |
|
4944 |
</p>
|
4945 |
<br>
|
4948 |
|
4949 |
<a name="DTSTAMP"></a><h3>3.2.16 DTSTAMP</h3>
|
4950 |
<p>
|
4951 |
+
The property indicates the date/time the Vcalendar instance was created and is OPTIONAL and
|
4952 |
MUST NOT occur more than once in <a href="#VEVENT">VEVENT</a>, <a href="#VTODO">VTODO</a>, <a href="#VJOURNAL">VJOURNAL</a>
|
4953 |
and <a href="#VFREEBUSY">VFREEBUSY</a> components. However, DTSTAMP is <b>AUTOMATICALL§Y GENERATED</b> in iCalcreator when creating a component.
|
4954 |
</p>
|
4957 |
as well as (<strong>calendar</strong>) <a href="#X-PROPERTY">x-properties</a> "X-WR-CALNAME", "X-WR-CALDESC" and<br>"X-WR-TIMEZONE",
|
4958 |
<a href="#METHOD">METHOD</a> property (value PUBLISH etc.) and the (also auto created) <a href="#UID">UID</a> property.
|
4959 |
</p>
|
4960 |
+
<p>The value type for DTSTAMP is <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME.</p>
|
4961 |
<p>For methods and formatting, explore the <a href="#CREATED">CREATED</a> property.</p>
|
4962 |
<p>You can <a href="#sort2">SORT</a> <strong>calendar</strong> (components) on (asc) DTSTAMP values.</p>
|
4963 |
<p>
|
4964 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$DTSTAMP is available.
|
4965 |
</p>
|
4966 |
<br>
|
4967 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_component_object_property_function_list">[up]</a>
|
4982 |
</p>
|
4983 |
<p>For methods and formatting, explore the <a href="#DTEND">DTEND</a> property.</p>
|
4984 |
<p>
|
4985 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$DTSTART is available.
|
4986 |
</p>
|
4987 |
<br>
|
4988 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_component_object_property_function_list">[up]</a>
|
5001 |
</p>
|
5002 |
<p>For methods and formatting, explore the <a href="#DTEND">DTEND</a> property.</p>
|
5003 |
<p>
|
5004 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$DUE is available.
|
5005 |
</p>
|
5006 |
<br>
|
5007 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_component_object_property_function_list">[up]</a>
|
5021 |
<dd>it is OPTIONAL and MUST NOT occur more than once and MUST occur in pair with TRIGGER. If one occurs, so MUST the other.
|
5022 |
</dl>
|
5023 |
<p>
|
5024 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$DURATION as used in code snippets is available.
|
|
|
|
|
|
|
5025 |
</p>
|
5026 |
<h5>Create DURATION</h5>
|
5027 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
5038 |
<p class="format">calendarComponent::deleteProperty( "DURATION" )</p>
|
5039 |
<p class="label">Example</p>
|
5040 |
<p class="example">
|
5041 |
+
$valarm->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$DURATION );
|
5042 |
|
5043 |
</p>
|
5044 |
<h5>Get DURATION</h5>
|
5052 |
, "params" => xparams<sup>2</sup> )</p>
|
5053 |
<p class="label">Example</p>
|
5054 |
<p class="example">
|
5055 |
+
$duration = $vtodo->getProperty( Kigkonsult\Icalcreator\Util\Util::$DURATION );
|
5056 |
|
5057 |
</p>
|
5058 |
<p class="label">option</p>
|
5062 |
<a href="#DTSTART">DTSTART</a> value with the added DURATION value (incl. opt. timezone).
|
5063 |
</p>
|
5064 |
<h5>Set DURATION</h5>
|
5065 |
+
<p>Set property value.</p>
|
5066 |
<p class="label">Format</p>
|
5067 |
<p class="format">calendarComponent::setProperty( "duration", duration [, xparams ] )</p>
|
5068 |
+
<p class="comment"> // Recommended formats
|
5069 |
+
duration = (object) DateInterval class instance
|
5070 |
+
duration = (string) dur-value = ["+"] "P" (dur-date/dur-time/dur-week) like "P15DT5H0M20S"
|
5071 |
+
dur-date = dur-day [dur-time]
|
5072 |
+
dur-time = "T" (dur-hour / dur-minute / dur-second)
|
5073 |
+
dur-week = 1*DIGIT "W"
|
5074 |
+
dur-hour = 1*DIGIT "H" [dur-minute]
|
5075 |
+
dur-minute = 1*DIGIT "M" [dur-second]
|
5076 |
+
dur-second = 1*DIGIT "S"
|
5077 |
+
dur-day = 1*DIGIT "D"
|
5078 |
+
|
5079 |
+
// Supported but are objects for removal in future versions
|
5080 |
duration<sup>1</sup> = (array) ( "week" => (int) week )
|
5081 |
duration<sup>1</sup> = array ( "day" => (int) day )
|
5082 |
[, "hour" => (int) hour
|
5093 |
[, (int) hour
|
5094 |
, (int) min
|
5095 |
, (int) sec ]]
|
5096 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5097 |
xparams<sup>2</sup> = (array) ( *[ (string) key => (string) value ] ) // <span class="comment">key prefix "X-"</span>
|
5098 |
</p>
|
5099 |
<p class="label">Example 1</p>
|
5100 |
<p>One day duration.</p>
|
5101 |
<p class="example">
|
5102 |
+
$vtodo->setProperty(
|
5103 |
+
Kigkonsult\Icalcreator\Util\Util::$DURATION,
|
5104 |
+
new DateInterval( "P1D" )
|
5105 |
+
);
|
5106 |
|
5107 |
</p>
|
5108 |
<p class="label">Example 2</p>
|
5109 |
<p>Four hours duration.</p>
|
5110 |
<p class="example">
|
5111 |
+
$vtodo->setProperty(
|
5112 |
+
Kigkonsult\Icalcreator\Util\Util::$DURATION,
|
5113 |
+
"PT4H"
|
5114 |
+
);
|
5115 |
|
5116 |
</p>
|
5117 |
<br>
|
5125 |
</p>
|
5126 |
<p>The default value type for EXDATE is DATE-TIME, can be set to a DATE value type.</p>
|
5127 |
<p>
|
5128 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$EXDATE as used in code snippets is available.
|
5129 |
</p>
|
5130 |
<h5>Create EXDATE</h5>
|
5131 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
5142 |
<p class="format">calendarComponent::deleteProperty( "EXDATE" )</p>
|
5143 |
<p class="label">Example 1</p>
|
5144 |
<p class="example">
|
5145 |
+
$vtodo->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$EXDATE );
|
5146 |
|
5147 |
</p>
|
5148 |
<p class="label">Example 2</p>
|
5149 |
<P>Delete EXDATE property no 2.</p>
|
5150 |
<p class="example">
|
5151 |
+
$vjournal->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$EXDATE, 2 );
|
5152 |
|
5153 |
</p>
|
5154 |
<p class="label">Example 3</p>
|
5155 |
<p>Deleting all EXDATE properties.</p>
|
5156 |
<p class="example">
|
5157 |
+
while( $vjournal->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$EXDATE )) {
|
5158 |
+
while( $vjournal->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$EXDATE )) {
|
5159 |
+
continue;
|
5160 |
+
}
|
5161 |
</p>
|
5162 |
<h5>Get EXDATE</h5>
|
5163 |
<p>If set, returns property value, otherwise bool false.</p>
|
5164 |
<p class="label">Format 1</p>
|
5165 |
<p class="format">calendarComponent::getProperty( "EXDATE" )<p>
|
5166 |
+
<p class="comment">output = exdates<sup>1</sup> (with date<sup>1</sup>)</p>
|
5167 |
<p class="label">Format 2</p>
|
5168 |
<p class="format">calendarComponent::getProperty( "exdate", propOrderNo/false, true )</p>
|
5169 |
<p class="comment">propOrderNo = (int) specific property value</p>
|
5170 |
+
<p class="comment">output = array( "value" => exdates<sup>1</sup> (with date<sup>1</sup>)
|
5171 |
, "params" => xparams<sup>2</sup> )</p>
|
|
|
|
|
|
|
|
|
5172 |
<p class="label">Example</p>
|
5173 |
<p class="example">
|
5174 |
+
$exdate = $vtodo->getProperty( Kigkonsult\Icalcreator\Util\Util::$EXDATE );
|
5175 |
|
5176 |
</p>
|
5177 |
<h5>Set EXDATE</h5>
|
5178 |
+
<p>Set property value.</p>
|
5179 |
<p>The value type for EXDATE should match the <a href="#DTSTART">DTSTART</a> value type.</p>
|
5180 |
<p>
|
5181 |
If DATE value type is set in params ("VALUE" = "DATE"), all timezone or offset in dates are ignored.<br>
|
5182 |
+
If no "VALUE" value type is set, DATE-TIME (default) value type is set.
|
5183 |
</p>
|
5184 |
<p>
|
5185 |
If "TZID" is set in params,
|
5189 |
If none of the above rules are applicable, DATE-TIME and local date is set default.
|
5190 |
</p>
|
5191 |
<p>
|
5192 |
+
Note, if not using DateTime, use function <a href="#transformDateTime">transformDateTime</a>
|
5193 |
+
to change a (local) date value to UTC time zone.
|
5194 |
</p>
|
5195 |
<p>EXDATEs are automatically sorted in ascending order (Y-m-d[-H-i-s]).</p>
|
5196 |
<p>
|
5197 |
In spite of the fact that EXDATE may contain a (comma separated) list of values,
|
5198 |
+
a strong recommendation is to split an EXDATE "list" into multiple single EXDATE entries.
|
5199 |
+
(But if you do, don't mix timezones, may result in incorrect date values.)
|
5200 |
</p>
|
5201 |
<p>Parameters will be ordered as prescribed in [RFC5545].</p>
|
5202 |
<p class="label">Format</p>
|
5203 |
<p class="format">calendarComponent::setProperty( "exdate", exdates [, params [, propOrderNo ]] )</p>
|
5204 |
<p class="comment">exdates<sup>1</sup> = (array) ( date *[, date ] )
|
5205 |
+
|
5206 |
+
// Recommended formats
|
5207 |
+
date = (object) DateTime class instance
|
5208 |
+
date = (string) date/datetime string<sup>*</sup>
|
5209 |
+
|
5210 |
+
// Supported but are objects for removal in future versions
|
5211 |
date = array( (int) year
|
5212 |
, (int) month
|
5213 |
, (int) day
|
5223 |
, "sec" => (int) sec
|
5224 |
[, "tz" => tz ]] )
|
5225 |
date = (array) ( "timestamp" => (int) timestamp [, "tz" => tz])
|
5226 |
+
// <span class="comment">timestamp without tz will result in a <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME</span>
|
5227 |
+
|
5228 |
tz = (string) <timezone identifier> / offset
|
5229 |
+
// <span class="comment">timezone will be used as tzidparam (below), if tzidparam not set</span>
|
5230 |
+
offset = (int) (+/-)HHmm[ss] // <span class="comment">(arr/str) local date + UTC offset will result in a <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME</span>
|
5231 |
params<sup>2</sup> = (array) ([(datetimeparam/dateparam) / tzidparam] *[,xparams])
|
5232 |
+
// <span class="comment">default, output as date-time</span>
|
5233 |
+
datetimeparam = Kigkonsult\Icalcreator\Util\Util::$VALUE => Kigkonsult\Icalcreator\Util\Util::$DATE_TIME
|
5234 |
+
// <span class="comment">output as DATE</span>
|
5235 |
+
dateparam = Kigkonsult\Icalcreator\Util\Util::$VALUE => Kigkonsult\Icalcreator\Util\Util::$DATE
|
5236 |
+
tzidparam = Kigkonsult\Icalcreator\Util\Util::$TZID => (string) <timezone identifier>
|
5237 |
+
// <span class="comment">key prefix "X-"</span>
|
5238 |
+
xparams = (string) key => (string) value
|
5239 |
+
// <span class="comment">1=1st, 2=2nd etc</span>
|
5240 |
+
propOrderNo = (int) order number
|
5241 |
<br>date/datetime string<sup>*</sup> recommended formats
|
5242 |
"20110625", "2011-06-25", "2011/06/26"
|
5243 |
"20110625051015", "20110625 051015"
|
5249 |
<span class="commsnt">(notice <a href="#date_restriction">date restriction</a>)</span></p>
|
5250 |
<p class="label">Example 1</p>
|
5251 |
<p class="example">
|
5252 |
+
$vevent->setProperty(
|
5253 |
+
Kigkonsult\Icalcreator\Util\Util::$EXDATE,
|
5254 |
+
[ new DateTime( '2006-08-11' ) ],
|
5255 |
+
[ Kigkonsult\Icalcreator\Util\Util::$VALUE => Kigkonsult\Icalcreator\Util\Util::$DATE ]
|
5256 |
+
); <span class="comment">// exclude 2006-08-11 from recurrence pattern;</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
5257 |
|
5258 |
</p>
|
5259 |
<br>
|
5267 |
</p>
|
5268 |
<p>EXRULE is deprecated in [RFC5545]!</p>
|
5269 |
<p>
|
5270 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$EXRULE as used in code snippets is available.
|
5271 |
</p>
|
5272 |
<h5>Create EXRULE</h5>
|
5273 |
<p>If set, returns [RFC2445] formatted string, otherwise bool false.</p>
|
5284 |
<p class="format">calendarComponent::deleteProperty( "EXRULE" )</p>
|
5285 |
<p class="label">Example 1</p>
|
5286 |
<p class="example">
|
5287 |
+
$vtodo->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$EXRULE );
|
5288 |
|
5289 |
</p>
|
5290 |
<p class="label">Example 2</p>
|
5291 |
<p>Delete EXRULE property no 2.</p>
|
5292 |
<p class="example">
|
5293 |
+
$vjournal->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$EXRULE, 2 );
|
5294 |
|
5295 |
</p>
|
5296 |
<p class="label">Example 3</p>
|
5297 |
<p>Deleting all EXRULE properties.</p>
|
5298 |
<p class="example">
|
5299 |
+
while( $vjournal->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$EXRULE )) {
|
5300 |
+
continue;
|
5301 |
+
}
|
5302 |
</p>
|
5303 |
<h5>Get EXRULE</h5>
|
5304 |
<p>If set, returns property value, otherwise bool false.</p>
|
5316 |
<p class="comment">Get propOrderNo EXRULE</p>
|
5317 |
<p class="label">Example</p>
|
5318 |
<p class="example">
|
5319 |
+
$exrule = $vtodo->getProperty( Kigkonsult\Icalcreator\Util\Util::$EXRULE );
|
5320 |
|
5321 |
</p>
|
5322 |
<h5>Set EXRULE</h5>
|
5323 |
<p>
|
5324 |
+
Set property value.
|
5325 |
+
Note, if not using DateTime, use function <a href="#transformDateTime">transformDateTime</a>
|
5326 |
+
to change a (local) date value to UTC time zone.
|
5327 |
</p>
|
5328 |
<p>Parameters, will be ordered as prescribed in [RFC5545].</p>
|
5329 |
<p class="label">Format</p>
|
5330 |
<p class="format">calendarComponent::setProperty( "exrule", recur [, xparams [, propOrderNo ]] )</p>
|
5331 |
+
See rules in detail in <a href="https://tools.ietf.org/html/rfc2445" title="RFC2445" target="_blank">RFC2445</a> - Internet Calendaring and Scheduling Core Object Specification (iCalendar).
|
5332 |
<p class="comment">recur<sup>1</sup> = (array) ( "FREQ" => freq
|
5333 |
// <span class="comment">either UNTIL or COUNT may appear in a "recur",
|
5334 |
but UNTIL and COUNT MUST NOT occur in the same "recur"</span>
|
5355 |
"WEEKLY" /
|
5356 |
"MONTHLY" /
|
5357 |
"YEARLY"
|
5358 |
+
enddate = date // <span class="comment">a DATE value or a <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME value</span>
|
5359 |
+
|
5360 |
+
// Recommended formats
|
5361 |
+
date = (object) DateTime class instance, will be set to UTC if not UTC timezone
|
5362 |
+
date = (string) date/datetime string<sup>*</sup>
|
5363 |
+
|
5364 |
+
// Supported but are objects for removal in future versions
|
5365 |
date = (array) ( "year" => (int) year
|
5366 |
, "month" => (int) month
|
5367 |
, "day" => (int) day
|
5368 |
[, "hour" => (int) hour
|
5369 |
, "min" => (int) min
|
5370 |
, "sec" => (int) sec ])
|
5371 |
+
date = (array) ( "timestamp" => (int) timestamp ) // <span class="comment">results in a <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME</span>
|
5372 |
+
|
5373 |
byseclist = seconds
|
5374 |
byseclist = (array) (seconds *(, seconds ))
|
5375 |
seconds = 1DIGIT / 2DIGIT ;0 to 59
|
5418 |
<span class="comment">(notice <a href="#date_restriction">date restriction</a>)</span></p>
|
5419 |
<p class="label">Example</p>
|
5420 |
<p class="example">
|
5421 |
+
$vevent->setProperty(
|
5422 |
+
"Exrule",
|
5423 |
+
[
|
5424 |
+
"FREQ" => "MONTHLY",
|
5425 |
+
"UNTIL" => new DateTime( '20060831' ), // DATE, if DATE-TIME, UTC timezone
|
5426 |
+
"INTERVAL" => 2,
|
5427 |
+
"WKST" => "SU",
|
5428 |
+
"BYSECOND" => 2,
|
5429 |
+
"BYMINUTE" => [ 2, -4, 6 ], // (*)
|
5430 |
+
"BYHOUR" => [ 2, 4, -6 ], // (*)
|
5431 |
+
"BYMONTHDAY" => -2, // (*)
|
5432 |
+
"BYYEARDAY" => 2, // (*)
|
5433 |
+
"BYWEEKNO" => [ 2, -4, 6 ], // (*)
|
5434 |
+
"BYMONTH" => 2, // (*)
|
5435 |
+
"BYSETPOS" => [ 2, -4, 6 [, // (*)
|
5436 |
+
"BYday" => [ // (**)
|
5437 |
+
[ -2, "DAY" => "WE" ],
|
5438 |
+
[ 3, "DAY" => "TH" ],
|
5439 |
+
[ 5, "DAY" => "FR" ],
|
5440 |
+
[ "DAY" => "MO" ]
|
5441 |
+
],
|
5442 |
+
"X-NAME" => "x-value" ),
|
5443 |
+
[ "x-key" => "xparamValue" ]
|
5444 |
+
);
|
5445 |
+
|
5446 |
+
$vtodo->setProperty(
|
5447 |
+
Kigkonsult\Icalcreator\Util\Util::$EXRULE,
|
5448 |
+
[
|
5449 |
+
"FREQ" => "WEEKLY",
|
5450 |
+
"COUNT" => 2,
|
5451 |
+
"INTERVAL" => 2,
|
5452 |
+
"WKST" => "SU",
|
5453 |
+
"BYSECOND" => [ -2, 4, 6 ], // (*)
|
5454 |
+
"BYMINUTE" => -2, // (*)
|
5455 |
+
"BYHOUR" => 2, // (*)
|
5456 |
+
"BYMONTHDAY" => [ 2, -4, 6 ], // (*)
|
5457 |
+
"BYYEARDAY" => [ -2, 4, 6 ], // (*)
|
5458 |
+
"BYWEEKNO" => -2, // (*)
|
5459 |
+
"BYMONTH" => [ 2, 4, -6 ], // (*)
|
5460 |
+
"BYSETPOS" => -2, // (*)
|
5461 |
+
"BYday" => [ 5, "DAY" => "WE" ], // (**)
|
5462 |
+
"X-NAME" => "x-value"
|
5463 |
+
],
|
5464 |
+
[ "x-key" => "xparamValue" ]
|
5465 |
+
);
|
5466 |
// <span class="comment">(*) single value/array of values</span>
|
5467 |
// <span class="comment">(**) single value array /array of arrays</span>
|
5468 |
|
5476 |
The property defines one or more free or busy time intervals in a <a href="#VFREEBUSY">VFREEBUSY</a>
|
5477 |
<strong>calendar</strong> component.
|
5478 |
<p>
|
5479 |
+
<p>The value type for FREEBUSY is PERIOD. A PERIOD is DATE-TIME/DATE-TIME or DATE-TIME/duration and in the <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone</p>
|
5480 |
<p>
|
5481 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$FREEBUSY as used in code snippets is available.
|
5482 |
</p>
|
5483 |
<h5>Create FREEBUSY</h5>
|
5484 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
5496 |
<p class="label">Example 1</p>
|
5497 |
<p>Delete (single/first) FREEBUSY property</p>
|
5498 |
<p class="example">
|
5499 |
+
$vfreebusy->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$FREEBUSY );
|
5500 |
|
5501 |
</p>
|
5502 |
<p class="label">Example 2</p>
|
5503 |
<p>Delete FREEBUSY property no 2.</p>
|
5504 |
<p class="example">
|
5505 |
+
$vfreebusy->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$FREEBUSY, 2 );
|
5506 |
|
5507 |
</p>
|
5508 |
<p class="label">Example 3</p>
|
5509 |
<p>Deleting all FREEBUSY properties.</p>
|
5510 |
<p class="example">
|
5511 |
+
while( $vfreebusy->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$FREEBUSY )) {
|
5512 |
+
continue;
|
5513 |
+
}
|
5514 |
</p>
|
5515 |
<h5>Get FREEBUSY</h5>
|
5516 |
<p>If set, returns property value, otherwise bool false.</p>
|
5517 |
<p class="label">Format 1</p>
|
5518 |
<p class="format">calendarComponent::getProperty( "FREEBUSY" )</p>
|
5519 |
+
<p class="comment">
|
5520 |
+
output = array( "fbtype" => freebusytype<sup>1</sup> , periods )
|
5521 |
+
periods = periods<sup>2</sup> with startdate/enddate<sup>2</sup> below
|
5522 |
+
</p>
|
5523 |
<p class="label">Format 3</p>
|
5524 |
<p class="format">calendarComponent::getProperty( "FREEBUSY", propOrderNo/false , true )</p>
|
5525 |
<p class="comment">propOrderNo = (int) specific property value</p>
|
5526 |
+
<p class="comment">
|
5527 |
+
output = array( "value" => array("fbtype" => freebusytype<sup>1</sup> ,periods)
|
5528 |
+
, "params" => xparams<sup>3</sup> )
|
5529 |
+
periods = periods<sup>2</sup> with startdate/enddate<sup>2</sup> below
|
5530 |
+
</p>
|
|
|
5531 |
<p class="label">Example</p>
|
5532 |
<p class="example">
|
5533 |
+
$freebusy = $vfreebusy->getProperty( Kigkonsult\Icalcreator\Util\Util::$FREEBUSY );
|
5534 |
|
5535 |
</p>
|
5536 |
<h5>Set FREEBUSY</h5>
|
5537 |
+
Set property value. A FREEBUSY input date is always a <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME.
|
5538 |
+
Set dates within the same timezone, otherwise it may lead to unpredictable result;
|
5539 |
<p class="label">Format</p>
|
5540 |
<p class="format">calendarComponent::setProperty( "freebusy",freebusytype,fbperiods [,xparams [,propOrderNo ]] )</p>
|
5541 |
<p class="comment">freebusytype<sup>1</sup> = one of "FREE"
|
5546 |
fbperiods = (array) ( periods<sup>2</sup> )
|
5547 |
periods<sup>2</sup> = (array) ( startdate, enddate/duration ) /
|
5548 |
(array) ( *[, (array) ( startdate, enddate/duration )] )
|
5549 |
+
|
5550 |
+
// Recommended formats
|
5551 |
+
startdate/enddate = (object) DateTime class instance, will be set to UTC if not UTC timezone
|
5552 |
+
startdate/enddate = (string) datetime string<sup>*</sup>
|
5553 |
+
|
5554 |
+
// Supported but are objects for removal in future versions
|
5555 |
+
// <span class="comment">startdate/enddate MUST be an <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME</span>
|
5556 |
startdate/enddate = (array) ( (int) year
|
5557 |
, (int) month
|
5558 |
, (int) day
|
5559 |
, (int) hour
|
5560 |
, (int) min
|
5561 |
, (int) sec )
|
5562 |
+
startdate/enddate<sup>2</sup> = (array) ( "year" => (int) year
|
5563 |
, "month" => (int) month
|
5564 |
, "day" => (int) day
|
5565 |
, "hour" => (int) hour
|
5566 |
, "min" => (int) min
|
5567 |
+
, "sec" => (int) sec ) // <span class="comment">also output format</span>
|
5568 |
+
startdate/enddate = (array) ( "timestamp" => (int) timestamp ) // <span class="comment">results in a <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME</span>
|
5569 |
+
|
5570 |
+
// Recommended formats
|
5571 |
+
duration = (object) DateInterval class instance
|
5572 |
+
duration = (string) dur-value = ("+")"P"(dur-date/dur-time/dur-week) like "P15DT5H0M20S"
|
5573 |
+
|
5574 |
+
dur-date = dur-day [dur-time]
|
5575 |
+
dur-time = "T" (dur-hour / dur-minute / dur-second)
|
5576 |
+
dur-week = 1*DIGIT "W"
|
5577 |
+
dur-hour = 1*DIGIT "H" [dur-minute]
|
5578 |
+
dur-minute = 1*DIGIT "M" [dur-second]
|
5579 |
+
dur-second = 1*DIGIT "S"
|
5580 |
+
dur-day = 1*DIGIT "D"
|
5581 |
+
|
5582 |
+
// Supported but are objects for removal in future versions
|
5583 |
duration = (array) ( (int) week / false
|
5584 |
[, (int) day / false
|
5585 |
, (int) hour
|
5591 |
, "min" => (int) min
|
5592 |
, "sec" => (int) sec ]] ); // <span class="comment">output format</span>
|
5593 |
duration = (array) ( "sec" => (int) sec )
|
5594 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5595 |
xparams<sup>3 </sup> = (array) ( *[ (string) key => (string) value ] ) // <span class="comment">key prefix "X-"</span>
|
5596 |
propOrderNo = (int) order number // <span class="comment">1=1st, 2=2nd etc</span>
|
5597 |
<br>date/datetime string<sup>*</sup> recommended formats
|
5598 |
+
"20110625051015 UTC", "20110625 051015 UTC"
|
5599 |
+
"20110625T051015 UTC", "20110625t051015 UTC"
|
5600 |
+
"2011-06-25 05:10:15 UTC", "2011-06-25T05:10:15 UTC", "2011-06-25t05:10:15 UTC"
|
5601 |
+
"2011/06/25 05:10:15 UTC", "2011/06/25T05:10:15 UTC", "2011/06/25t05:10:15 UTC"
|
5602 |
other string formats, acceptable by <em>PHP</em> strtotime function, may (would) work
|
5603 |
<span class="comment">(notice <a href="#date_restriction">date restriction</a>)</span></p>
|
5604 |
<p class="label">Example</p>
|
5605 |
+
See rules in detail in <a href="https://tools.ietf.org/html/rfc2445" title="RFC2445" target="_blank">RFC2445</a> - Internet Calendaring and Scheduling Core Object Specification (iCalendar).
|
5606 |
+
<p class="example">
|
5607 |
+
$fdate1 = new DateTime( '2001-01-01 01:01:01 UTC' );
|
5608 |
+
$fdate2 = new DateTime( '2002-02-02 02:02:02 UTC' );
|
5609 |
+
$fdate3 = new DateTime( '2003-03-03 03:03:03 UTC' );
|
5610 |
+
$fdate4 = "4 April 2005 4:4:4 UTC";
|
5611 |
+
$fdur6 = new DateInterval( "P5DT5H5M5S" );
|
5612 |
+
$fdur7 = new DateInterval( "PT5H" )
|
5613 |
+
$fdur8 = "P2D";
|
5614 |
+
$freebusy->setProperty
|
5615 |
+
Kigkonsult\Icalcreator\Util\Util::$FREEBUSY,
|
5616 |
+
"FREE",
|
5617 |
+
[
|
5618 |
+
[ $fdate1, $fdate2 ],
|
5619 |
+
[ $fdate3, $fdur6 ],
|
5620 |
+
[ $fdate4, $fdate5 ]
|
5621 |
+
]
|
5622 |
+
);
|
5623 |
+
$freebusy->setProperty(
|
5624 |
+
Kigkonsult\Icalcreator\Util\Util::$FREEBUSY,
|
5625 |
+
"Busy",
|
5626 |
+
[
|
5627 |
+
[ $fdate1, $fdate2 ],
|
5628 |
+
[ $fdate3, $fdur8 ],
|
5629 |
+
[ $fdate4, $fdur7 ],
|
5630 |
+
[ $fdate1, $fdate3 ]
|
5631 |
+
]
|
5632 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
5633 |
|
5634 |
</p>
|
5635 |
<br>
|
5657 |
(only if <a href="#GEO">GEO</a> is set).
|
5658 |
</p>
|
5659 |
<p>
|
5660 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$GEO as used in code snippets is available.
|
5661 |
</p>
|
5662 |
<h5>Create GEO</h5>
|
5663 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
5674 |
<p class="format">calendarComponent::deleteProperty( "GEO" )</p>
|
5675 |
<p class="label">Example</p>
|
5676 |
<p class="example">
|
5677 |
+
$vevent->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$GEO );
|
5678 |
|
5679 |
</p>
|
5680 |
<h5>Get GEO</h5>
|
5690 |
, "params" => xparams<sup>1</sup> )</p>
|
5691 |
<p class="label">Example</p>
|
5692 |
<p class="example">
|
5693 |
+
$geo = $vevent->getProperty( Kigkonsult\Icalcreator\Util\Util::$GEO );
|
5694 |
|
5695 |
</p>
|
5696 |
<h5>Set GEO</h5>
|
5697 |
+
<p>Set property value.</p>
|
5698 |
<p class="label">Format</p>
|
5699 |
<p class="format">calendarComponent::setProperty( "geo", latitude, longitude [, xparams ] )</p>
|
5700 |
<p class="comment">latitude = (float) latitude
|
5703 |
</p>
|
5704 |
<p class="label">Example</p>
|
5705 |
<p class="example">
|
5706 |
+
$vevent->setProperty( Kigkonsult\Icalcreator\Util\Util::$GEO, 11.23456, -23.45678 );
|
|
|
|
|
5707 |
|
5708 |
</p>
|
5709 |
<br>
|
5717 |
The property is OPTIONAL and MUST NOT occur more than once in <a href="#VEVENT">VEVENT</a>,
|
5718 |
<a href="#VTODO">VTODO</a>, <a href="#VJOURNAL">VJOURNAL</a> and <a href="#VTIMEZONE">VTIMEZONE</a> components.
|
5719 |
</p>
|
5720 |
+
<p>The value type for LAST-MODIFIED is <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME.</p>
|
5721 |
<p>For methods and formatting, explore the <a href="#CREATED">CREATED</a> property.</p>
|
5722 |
<p>
|
5723 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$LAST_MODIFIED is available.
|
5724 |
</p>
|
5725 |
<br>
|
5726 |
<a href="#INDEX">[index]</a> <a href="#top">[top]</a> <a href="#Calendar_component_object_property_function_list">[up]</a>
|
5741 |
(only if <a href="#GEO">GEO</a> is set).
|
5742 |
</p>
|
5743 |
<p>
|
5744 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$LOCATION as used in code snippets is available.
|
5745 |
</p>
|
5746 |
<h5>Create LOCATION</h5>
|
5747 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
5758 |
<p class="format">calendarComponent::deleteProperty( "LOCATION" )</p>
|
5759 |
<p class="label">Example</p>
|
5760 |
<p class="example">
|
5761 |
+
$vevent->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$LOCATION );
|
5762 |
|
5763 |
</p>
|
5764 |
<h5>Get LOCATION</h5>
|
5772 |
, "params" => param<sup>2</sup> )</p>
|
5773 |
<p class="label">Example</p>
|
5774 |
<p class="example">
|
5775 |
+
$location = $vevent->getProperty( Kigkonsult\Icalcreator\Util\Util::$LOCATION );
|
5776 |
|
5777 |
</p>
|
5778 |
<h5>Set LOCATION</h5>
|
5779 |
+
<p>Set property value.</p>
|
5780 |
<p>Parameters will be ordered as prescribed in [RFC5545].</p>
|
5781 |
<p class="label">Format</p>
|
5782 |
<p class="format">calendarComponent::setProperty( "location", location [, param] )</p>
|
5789 |
lang<sup>*</sup> = as defined in [RFC5546]</p>
|
5790 |
<p class="label">Example</p>
|
5791 |
<p class="example">
|
5792 |
+
$vevent->setProperty( Kigkonsult\Icalcreator\Util\Util::$LOCATION, "Buckingham Palace" );
|
|
|
5793 |
|
5794 |
</p>
|
5795 |
<br>
|
5806 |
<p>You can <a href="#sort2">SORT</a> <strong>calendar</strong> (components) on (asc) ORGANIZER values.</p>
|
5807 |
<p>You can export <strong>calendar</strong> ORGANIZER values as <a href="#iCal2vCards">vCards</a>.
|
5808 |
<p>
|
5809 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$ORGANIZER as used in code snippets is available.
|
5810 |
</p>
|
5811 |
<h5>Create ORGANIZER</h5>
|
5812 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
5823 |
<p class="format">calendarComponent::deleteProperty( "ORGANIZER" )</p>
|
5824 |
<p class="label">Example</p>
|
5825 |
<p class="example">
|
5826 |
+
$vevent->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$ORGANIZER );
|
5827 |
|
5828 |
</p>
|
5829 |
<h5>Get ORGANIZER</h5>
|
5837 |
, "params" => params<sup>2</sup> )</p>
|
5838 |
<p class="label">Example</p>
|
5839 |
<p class="example">
|
5840 |
+
$organizer = $vevent->getProperty( Kigkonsult\Icalcreator\Util\Util::$ORGANIZER );
|
5841 |
|
5842 |
</p>
|
5843 |
<h5>Set ORGANIZER</h5>
|
5844 |
+
<p>Set property value.
|
5845 |
Property value must be prefixed by protocol (ftp://, http://,mailto:, file:// ref. rfc 1738), "mailto:" prefixed if missing.
|
5846 |
Also DIR parameter must be prefixed by protocol.
|
5847 |
SENT-BY parameter must use protocol "mailto:", prefixed if missing.
|
5865 |
<p class="label">Example</p>
|
5866 |
<p class="example">
|
5867 |
$dir = "ldap://domain.com:6666/o=3DDC%20Comp,c=3DUS??(cn=3DJohn%20Doe)";
|
5868 |
+
$vevent->setProperty(
|
5869 |
+
Kigkonsult\Icalcreator\Util\Util::$ORGANIZER,
|
5870 |
+
"ical@domain.com",
|
5871 |
+
[
|
5872 |
+
"CN" => "John Doe",
|
5873 |
+
"DIR" => $dir,
|
5874 |
+
"SENT-BY" => "secretary@domain.com",
|
5875 |
+
"X-Key1" => "X-Value1",
|
5876 |
+
"X-Key2" => "X-Value2"
|
5877 |
+
]
|
5878 |
+
);
|
5879 |
|
5880 |
</p>
|
5881 |
<br>
|
5895 |
Integer values in between indicate the percent partially complete.
|
5896 |
</p>
|
5897 |
<p>
|
5898 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$PERCENT_COMPLETE as used in code snippets is available.
|
5899 |
</p>
|
5900 |
<h5>Create PERCENT-COMPLETE</h5>
|
5901 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
5912 |
<p class="format">calendarComponent::deleteProperty( "PERCENT-COMPLETE" )</p>
|
5913 |
<p class="label">Example</p>
|
5914 |
<p class="example">
|
5915 |
+
$vtodo->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$PERCENT_COMPLETE )
|
5916 |
|
5917 |
</p>
|
5918 |
<h5>Get PERCENT-COMPLETE</h5>
|
5926 |
, "params" => xparams<sup>2</sup> )</p>
|
5927 |
<p class="label">Example</p>
|
5928 |
<p class="example">
|
5929 |
+
$percent = $vtodo->getProperty( Kigkonsult\Icalcreator\Util\Util::$PERCENT_COMPLETE );
|
5930 |
|
5931 |
</p>
|
5932 |
<h5>Set PERCENT-COMPLETE</h5>
|
5933 |
+
<p>Set property value.</p>
|
5934 |
<p class="label">Format</p>
|
5935 |
<p class="format">calendarComponent::setProperty( "Percent-Complete", percent [, xparams ] )</p>
|
5936 |
<p class="comment">percent<sup>1</sup> = (int) Value type INTEGER
|
5938 |
</p>
|
5939 |
<p class="label">Example</p>
|
5940 |
<p class="example">
|
5941 |
+
$vtodo->setProperty( Kigkonsult\Icalcreator\Util\Util::$PERCENT_COMPLETE, 90 );
|
5942 |
|
5943 |
</p>
|
5944 |
<br>
|
5960 |
</p>
|
5961 |
<p>You can <a href="#sort2">SORT</a> <strong>calendar</strong> (components) on (asc) PRIORITY values.</p>
|
5962 |
<p>
|
5963 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$PRIORITY as used in code snippets is available.
|
5964 |
</p>
|
5965 |
<h5>Create PRIORITY</h5>
|
5966 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
5977 |
<p class="format">calendarComponent::deleteProperty( "PRIORITY" )</p>
|
5978 |
<p class="label">Example</p>
|
5979 |
<p class="example">
|
5980 |
+
$vevent->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$PRIORITY );
|
5981 |
|
5982 |
</p>
|
5983 |
<h5>Get PRIORITY</h5>
|
5991 |
, "params" => xparams<sup>2</sup> )</p>
|
5992 |
<p class="label">Example</p>
|
5993 |
<p class="example">
|
5994 |
+
$priority = $vevent->getProperty( Kigkonsult\Icalcreator\Util\Util::$PRIORITY );
|
5995 |
|
5996 |
</p>
|
5997 |
<h5>Set PRIORITY</h5>
|
5998 |
+
<p>Set property value.</p>
|
5999 |
<p class="label">Format</p>
|
6000 |
<p class="format">calendarComponent::setProperty( "priority", priority [, xparams ] )</p>
|
6001 |
<p class="comment">priority<sup>1</sup> = (int) Value type INTEGER
|
6003 |
</p>
|
6004 |
<p class="label">Example</p>
|
6005 |
<p class="example">
|
6006 |
+
$vevent->setProperty( Kigkonsult\Icalcreator\Util\Util::$PRIORITY, 3 );
|
6007 |
|
6008 |
</p>
|
6009 |
<br>
|
6018 |
</p>
|
6019 |
<p>
|
6020 |
The default value type for RDATE is DATE-TIME, can be set to DATE or PERIOD (params<sup>2</sup>).
|
6021 |
+
In <a href="#VTIMEZONE">STANDARD</a> and <a href="#VTIMEZONE">DAYLIGHT</a> components,
|
6022 |
+
RDATE MUST be specified as a date-time value type with local time value.
|
6023 |
</p>
|
6024 |
<p>
|
6025 |
+
To ease up usage, Kigkonsult\Icalcreator\Util\Util::$RDATE as used in code snippets is available.
|
6026 |
</p>
|
6027 |
<h5>Create RDATE</h5>
|
6028 |
<p>If set, returns [RFC5545] formatted string, otherwise null.</p>
|
6040 |
<p class="label">Example 1</p>
|
6041 |
<p>Delete (single/first) RDATE property.</p>
|
6042 |
<p class="example">
|
6043 |
+
$vtodo->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$RDATE );
|
6044 |
|
6045 |
</p>
|
6046 |
<p class="label">Example 2</p>
|
6050 |
<p class="label">Example 3</p>
|
6051 |
<p>Delete all RDATE properties.</p>
|
6052 |
<p class="example">
|
6053 |
+
while( $vjournal->deleteProperty( Kigkonsult\Icalcreator\Util\Util::$RDATE )) {
|
6054 |
+
continue;
|
6055 |
+
}
|
6056 |
</p>
|
6057 |
<h5>Get RDATE</h5>
|
6058 |
<p>If set, returns property value, otherwise bool false.</p>
|
6070 |
<p class="comment">Get propOrderNo RDATE</p>
|
6071 |
<p class="label">Example</p>
|
6072 |
<p class="example">
|
6073 |
+
$rdates = $vevent->getProperty( Kigkonsult\Icalcreator\Util\Util::$RDATE );
|
6074 |
|
6075 |
</p>
|
6076 |
<h5>Set RDATE</h5>
|
6077 |
+
<p>Set property value.</p>
|
6078 |
<p>The value type for RDATE should match the <a href="#DTSTART">DTSTART</a> value type.</p>
|
6079 |
<p>
|
6080 |
If DATE value type is set in params ("VALUE" = "DATE"), all timezone or offset in dates are ignored.<br>
|
6081 |
+
If no "VALUE" value type is set, DATE-TIME (default) value type is set.
|
6082 |
</p>
|
6083 |
<p>
|
6084 |
If "TZID" is set in params,
|
6088 |
If none of the above rules are applicable, DATE-TIME and local date is set default.
|
6089 |
</p>
|
6090 |
<p>
|
6091 |
+
Note, if not using DateTime, use function <a href="#transformDateTime">transformDateTime</a>
|
6092 |
+
to change a (local) date value to UTC time zone.
|
6093 |
</p>
|
6094 |
<p>RDATEs are automatically sorted in ascending order (Y-m-d[-H-i-s]).</p>
|
6095 |
<p>
|
6096 |
+
A RDATE may contain a (comma separated) list of date values, BUT,
|
6097 |
a strong recommendation is to split a RDATE "list" into multiple single RDATE entries.
|
6098 |
+
(But if you do, don't mix timezones, may result in incorrect date values.)
|
6099 |
</p>
|
6100 |
<p>Parameters will be ordered as prescribed in [RFC5545].</p>
|
6101 |
<p class="label">Format</p>
|
6104 |
date2 = date / (array) ( startdate, enddate/duration )
|
6105 |
startdate = date
|
6106 |
enddate = date
|
6107 |
+
|
6108 |
+
// Recommended formats
|
6109 |
+
date = (object) DateTime class instance
|
6110 |
+
date = (string) date/datetime string<sup>*</sup>
|
6111 |
+
|
6112 |
+
// Supported but are objects for removal in future versions
|
|
|
6113 |
date = (array) ( "year" => (int) year
|
6114 |
, "month" => (int) month
|
6115 |
, "day" => (int) day
|
6117 |
, "min" => (int) min
|
6118 |
, "sec" => (int) sec
|
6119 |
[, "tz" => tz ]] )
|
6120 |
+
// <span class="comment">output format</span>
|
6121 |
+
date = (array) ( (int) year
|
6122 |
+
, (int) month
|
6123 |
+
, (int) day
|
6124 |
+
[, (int) int hour
|
6125 |
+
, (int) min
|
6126 |
+
, (int) day
|
6127 |
+
, tz ] )
|
6128 |
date = (array) ( "timestamp" => (int) timestamp [, "tz" => tz ] )
|
6129 |
+
// <span class="comment">timestamp without tz will result in a <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME</span>
|
6130 |
+
|
6131 |
tz = <timezone identifier> / offset
|
6132 |
+
// <span class="comment">timezone will be used as tzidparam, if tzidparam not set</span>
|
6133 |
+
offset = (int) (+/-)HHmm[ss] // <span class="comment">(arr/str) local date + UTC offset </span>
|
6134 |
+
// <span class="comment">will result in a <a href="#DATE_WITH_UTC_TIME">UTC</a> timezone DATE-TIME</span>
|
6135 |
+
|
6136 |
+
// Recommended formats
|
6137 |
+
duration = (object) DateInterval class instance
|
6138 |
+
duration = (string) dur-value = ("+")"P"(dur-date/dur-time/dur-week) like "P15DT5H0M20S"
|
6139 |
+
dur-date = dur-day [dur-time]
|
6140 |
+
dur-time = "T" (dur-hour / dur-minute / dur-second)
|
6141 |
+
dur-week = 1*DIGIT "W"
|
6142 |
+
dur-day = 1*DIGIT "D"
|
6143 |
+
dur-hour = 1*DIGIT "H" [dur-minute]
|
6144 |
+
dur-minute = 1*DIGIT "M" [dur-second]
|
6145 |
+
dur-second = 1*DIGIT "S"
|
6146 |
+
|
6147 |
+
// Supported but are objects for removal in future versions
|
6148 |
duration = (array) ( (int) week/false
|
6149 |
[, (int) day/false
|
6150 |
, (int) hour
|
6157 |
, "sec" => (int) sec ]] );
|
6158 |
// <span class="comment">output format, only used keys</span>
|
6159 |
duration = (array) ( "sec" => (int) sec );
|
6160 |
+
|
6161 |
params<sup>2</sup> = ([tzidparam ( / datetimeparam / dateparam / periodparam )] *[, xparams ] )
|
6162 |
+
tzidparam = Kigkonsult\Icalcreator\Util\Util::$TZID => (string) <timezone identifier>
|
6163 |
+
// <span class="comment">output as local DATE-TIME with timezone identifier</span>
|
6164 |
+
// <span class="comment">if tzidparam="GMT"/"UTC" then</span>
|
6165 |
+
// <span class="comment">output date-time is suffixed by 'Z'</span>
|
6166 |
+
|
6167 |
+
// <span class="comment">default, output as DATE-TIME</span>
|
6168 |
+
datetimeparam = Kigkonsult\Icalcreator\Util\Util::$VALUE => Kigkonsult\Icalcreator\Util\Util::$DATE_TIME
|
6169 |
+
// <span class="comment">output as DATE</span>
|
6170 |
+
dateparam = Kigkonsult\Icalcreator\Util\Util::$VALUE => Kigkonsult\Icalcreator\Util\Util::$DATE
|
6171 |
+
// <span class="comment">output as PERIOD (datetime)</span>
|
6172 |
+
periodparam = Kigkonsult\Icalcreator\Util\Util::$VALUE => Kigkonsult\Icalcreator\Util\Util::$PERIOD
|
6173 |
xparams = (string) key => (string) value // <span class="comment">key prefix "X-"</span>
|
6174 |
propOrderNo = (int) order number // <span class="comment">1=1st, 2=2nd etc</span>
|
6175 |
<br>date/datetime string<sup>*</sup> recommended formats
|
6182 |
other string formats, acceptable by <em>PHP</em> strtotime function, may (would) work
|
6183 |
<span class="comment">(notice <a href="#date_restriction">date restriction</a>)</span></p>
|
6184 |
<p class="label">Example</p>
|
6185 |
+
See rules in detail in <a href="https://tools.ietf.org/html/rfc2445" title="RFC2445" target="_blank">RFC2445</a> - Internet Calendaring and Scheduling Core Object Specification (iCalendar).<br>
|
6186 |
+
<p class="example">
|
6187 |
+
$rdate1 = new DateTime( "2001-01-01 01:01:01 UTC" );
|
6188 |
+
$rdate2 = new DateTime( "2002-02-02 02:02:02 UTC" );
|
6189 |
+
$rdate3 = "3 March 2003 03
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|