diff --git a/includes/date.php b/includes/date.php
index 7895bbc..0155488 100644
--- a/includes/date.php
+++ b/includes/date.php
@@ -26,9 +26,9 @@ class ZDateHelper {
*
* @param int $year is between 1 and 32767 inclusive
*
- * @return int
+ * @return int
*/
- static function DayInMonth($month, $year) {
+ public static function DayInMonth($month, $year) {
$daysInMonth = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
if ($month != 2) return $daysInMonth[$month - 1];
return (checkdate($month, 29, $year)) ? 29 : 28;
@@ -43,7 +43,7 @@ static function DayInMonth($month, $year) {
*
* @return bool
*/
- static function isToday($date, $tzid = "UTC") {
+ public static function isToday($date, $tzid = "UTC") {
$dtz = new DateTimeZone($tzid);
$dt = new DateTime("now", $dtz);
$now = time() + $dtz->getOffset($dt);
@@ -59,7 +59,7 @@ static function isToday($date, $tzid = "UTC") {
*
* @return bool
*/
- static function isBeforeToday($date, $tzid = "UTC"){
+ public static function isBeforeToday($date, $tzid = "UTC"){
$dtz = new DateTimeZone($tzid);
$dt = new DateTime("now", $dtz);
$now = time() + $dtz->getOffset($dt);
@@ -76,7 +76,7 @@ static function isBeforeToday($date, $tzid = "UTC"){
*
* @return bool
*/
- static function isAfterToday($date, $tzid = "UTC"){
+ public static function isAfterToday($date, $tzid = "UTC"){
$dtz = new DateTimeZone($tzid);
$dt = new DateTime("now", $dtz);
$now = time() + $dtz->getOffset($dt);
@@ -93,7 +93,7 @@ static function isAfterToday($date, $tzid = "UTC"){
*
* @return bool
*/
- static function isTomorrow($date, $tzid = "UTC") {
+ public static function isTomorrow($date, $tzid = "UTC") {
$dtz = new DateTimeZone($tzid);
$dt = new DateTime("now", $dtz);
$now = time() + $dtz->getOffset($dt);
@@ -112,7 +112,7 @@ static function isTomorrow($date, $tzid = "UTC") {
*
* @return bool
*/
- static function isFuture($date, $tzid = "UTC"){
+ public static function isFuture($date, $tzid = "UTC"){
$dtz = new DateTimeZone($tzid);
$dt = new DateTime("now", $dtz);
$now = time() + $dtz->getOffset($dt);
@@ -131,7 +131,7 @@ static function isFuture($date, $tzid = "UTC"){
*
* @return bool
*/
- static function isPast($date, $tzid = "UTC") {
+ public static function isPast($date, $tzid = "UTC") {
$dtz = new DateTimeZone($tzid);
$dt = new DateTime("now", $dtz);
$now = time() + $dtz->getOffset($dt);
@@ -145,7 +145,7 @@ static function isPast($date, $tzid = "UTC") {
*
* @return int
*/
- static function now($tzid = "UTC"){
+ public static function now($tzid = "UTC"){
$dtz = new DateTimeZone($tzid);
$dt = new DateTime("now", $dtz);
$now = time() + $dtz->getOffset($dt);
@@ -159,7 +159,7 @@ static function now($tzid = "UTC"){
*
* @return bool
*/
- static function isWeekend($date) {
+ public static function isWeekend($date) {
$dow = gmdate('w',$date);
return $dow == 0 || $dow == 6;
}
@@ -171,7 +171,7 @@ static function isWeekend($date) {
*
* @return string
*/
- static function toSqlDateTime($t = 0)
+ public static function toSqlDateTime($t = 0)
{
date_default_timezone_set('GMT');
if($t == 0)
@@ -186,7 +186,7 @@ static function toSqlDateTime($t = 0)
*
* @return string
*/
- static function toSqlDate($t = 0)
+ public static function toSqlDate($t = 0)
{
date_default_timezone_set('GMT');
if($t == 0)
@@ -198,10 +198,10 @@ static function toSqlDate($t = 0)
* Format iCal date-time string to Unix timestamp
*
* @param string $datetime in iCal time format ( YYYYMMDD or YYYYMMDDTHHMMSS or YYYYMMDDTHHMMSSZ )
- *
+ *
* @return int Unix timestamp
*/
- static function fromiCaltoUnixDateTime($datetime) {
+ public static function fromiCaltoUnixDateTime($datetime) {
// first check format
$formats = array();
$formats[] = "/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/";
@@ -237,19 +237,19 @@ static function fromiCaltoUnixDateTime($datetime) {
*
* @return string
*/
- static function fromUnixDateTimetoiCal($datetime){
+ public static function fromUnixDateTimetoiCal($datetime){
date_default_timezone_set('GMT');
return gmdate("Ymd\THis",$datetime);
}
/**
* Convert iCal duration string to # of seconds
- *
+ *
* @param string $duration iCal duration string
*
- * return int
+ * return int
*/
- static function iCalDurationtoSeconds($duration) {
+ public static function iCalDurationtoSeconds($duration) {
$secs = 0;
if($duration{0} == "P") {
$duration = str_replace(array("H","M","S","T","D","W","P"),array("H,","M,","S,","","D,","W,",""),$duration);
@@ -291,7 +291,7 @@ static function iCalDurationtoSeconds($duration) {
*
* @return bool
*/
- static function inDay($daystart, $begin, $end)
+ public static function inDay($daystart, $begin, $end)
{
//$dayend = $daystart + 60*60*24 - 60;
// add 1 day to determine end of day
@@ -300,7 +300,7 @@ static function inDay($daystart, $begin, $end)
$dayend = self::addDate($daystart, 0,0,0,0,1,0);
$end = max($begin, $end); // $end can't be less than $begin
- $inday =
+ $inday =
($daystart <= $begin && $begin < $dayend)
||($daystart < $end && $end < $dayend)
||($begin <= $daystart && $end > $dayend)
@@ -315,7 +315,7 @@ static function inDay($daystart, $begin, $end)
*
* @return int Unix date-time timestamp
*/
- static function toUnixDate($datetime)
+ public static function toUnixDate($datetime)
{
$year = substr($datetime,0,4);
$month = substr($datetime,5,2);
@@ -331,7 +331,7 @@ static function toUnixDate($datetime)
*
* @return int Unix timestamp
*/
- static function toUnixDateTime($datetime)
+ public static function toUnixDateTime($datetime)
{
// convert to absolute dates if neccessary
$datetime = self::getAbsDate($datetime);
@@ -357,18 +357,18 @@ static function toUnixDateTime($datetime)
* @param int $hour add or subtract hours from date
*
* @param int $min add or subtract minutes from date
- *
+ *
* @param int $sec add or subtract seconds from date
- *
+ *
* @param int $month add or subtract months from date
- *
+ *
* @param int $day add or subtract days from date
- *
+ *
* @param int $year add or subtract years from date
*
* @param string $tzid PHP recognized timezone (default is UTC)
*/
- static function addDate($date, $hour, $min, $sec, $month, $day, $year, $tzid = "UTC") {
+ public static function addDate($date, $hour, $min, $sec, $month, $day, $year, $tzid = "UTC") {
date_default_timezone_set($tzid);
$sqldate = self::toSQLDateTime($date);
$tdate = array();
@@ -401,7 +401,7 @@ static function addDate($date, $hour, $min, $sec, $month, $day, $year, $tzid = "
*
* @return int Unix timestamp
*/
- static function getDateFromDay($date, $week, $wday,$tzid="UTC") {
+ public static function getDateFromDay($date, $week, $wday,$tzid="UTC") {
//echo "getDateFromDay(" . self::toSqlDateTime($date) . ",$week,$wday)
\n";
// determine first day in month
$tdate = getdate($date);
@@ -427,14 +427,14 @@ static function getDateFromDay($date, $week, $wday,$tzid="UTC") {
/**
* Convert UTC date-time to local date-time
- *
+ *
* @param string $sqldate SQL date-time string
*
* @param string $tzid PHP recognized timezone (default is "UTC")
*
* @return string SQL date-time string
*/
- static function toLocalDateTime($sqldate, $tzid = "UTC" ){
+ public static function toLocalDateTime($sqldate, $tzid = "UTC" ){
try
{
$timezone = new DateTimeZone($tzid);
@@ -452,14 +452,14 @@ static function toLocalDateTime($sqldate, $tzid = "UTC" ){
/**
* Convert local date-time to UTC date-time
- *
+ *
* @param string $sqldate SQL date-time string
*
* @param string $tzid PHP recognized timezone (default is "UTC")
*
* @return string SQL date-time string
*/
- static function toUTCDateTime($sqldate, $tzid = "UTC" ){
+ public static function toUTCDateTime($sqldate, $tzid = "UTC" ){
date_default_timezone_set("UTC");
try
@@ -484,7 +484,7 @@ static function toUTCDateTime($sqldate, $tzid = "UTC" ){
*
* Examples of relative dates are "-2y" for 2 years ago, "18m"
* for 18 months after today. Relative date uses "y", "m" and "d" for
- * year, month and day. Relative date can be combined into comma
+ * year, month and day. Relative date can be combined into comma
* separated list, i.e., "-1y,-1d" for 1 year and 1 day ago.
*
* @param string $date relative date string (i.e. "1y" for 1 year from today)
@@ -493,7 +493,7 @@ static function toUTCDateTime($sqldate, $tzid = "UTC" ){
*
* @return string in SQL date-time format
*/
- static function getAbsDate($date,$rdate = ""){
+ public static function getAbsDate($date,$rdate = ""){
if(str_replace(array("y","m","d","h","n"),"",strtolower($date)) != strtolower($date)){
date_default_timezone_set("UTC");
if($rdate == "")
@@ -545,7 +545,7 @@ static function getAbsDate($date,$rdate = ""){
*
* @return string iCal date-time string
*/
- static function toiCalDateTime($datetime = null){
+ public static function toiCalDateTime($datetime = null){
date_default_timezone_set('UTC');
if($datetime == null)
$datetime = time();
@@ -559,7 +559,7 @@ static function toiCalDateTime($datetime = null){
*
* @return string iCal date-time string
*/
- static function toiCalDate($datetime = null){
+ public static function toiCalDate($datetime = null){
date_default_timezone_set('UTC');
if($datetime == null)
$datetime = time();
diff --git a/includes/ical.php b/includes/ical.php
index 29e744b..325b87c 100644
--- a/includes/ical.php
+++ b/includes/ical.php
@@ -24,21 +24,21 @@ class ZCiCalDataNode {
*
* @var string
*/
- var $name = "";
+ public $name = "";
/**
* Node parameters (before the colon ":")
*
* @var array
*/
- var $parameter=array();
+ public $parameter=array();
/**
* Node values (after the colon ":")
- *
+ *
* @var array
*/
- var $value=array();
+ public $value=array();
/**
* Create an object from an unfolded iCalendar line
@@ -48,7 +48,7 @@ class ZCiCalDataNode {
* @return void
*
*/
- function __construct( $line ) {
+ public function __construct( $line ) {
//echo "ZCiCalDataNode($line)
\n";
//separate line into parameters and value
// look for colon separating name or parameter and value
@@ -106,17 +106,17 @@ function __construct( $line ) {
*
* @return string
*/
- function getName(){
+ public function getName(){
return $this->name;
}
/**
* Get $ith parameter from array
* @param int $i
- *
+ *
* @return var
*/
- function getParameter($i){
+ public function getParameter($i){
return $this->parameter[$i];
}
@@ -125,16 +125,16 @@ function getParameter($i){
*
* @return array
*/
- function getParameters(){
+ public function getParameters(){
return $this->parameter;
}
/**
* Get comma separated values
- *
+ *
* @return string
*/
- function getValues(){
+ public function getValues(){
return implode(",",$this->value);
}
}
@@ -159,28 +159,28 @@ class ZCiCalNode {
*
* @var string
*/
- var $name="";
+ public $name="";
/**
* The parent of this node
*
* @var object
*/
- var $parentnode=null;
+ public $parentnode=null;
/**
* Array of children for this node
*
* @var array
*/
- var $child= array();
+ public $child= array();
/**
* Array of $data for this node
*
* @var array
*/
- var $data= array();
+ public $data= array();
/**
@@ -188,14 +188,14 @@ class ZCiCalNode {
*
* @var object
*/
- var $next=null;
+ public $next=null;
/**
* Previous sibling of this node
*
* @var object
*/
- var $prev=null;
+ public $prev=null;
/**
* Create ZCiCalNode
@@ -206,7 +206,7 @@ class ZCiCalNode {
*
* @param bool $first Is this the first child for this parent?
*/
- function __construct( $_name, & $_parent, $first = false) {
+ public function __construct( $_name, & $_parent, $first = false) {
$this->name = $_name;
$this->parentnode = $_parent;
if($_parent != null){
@@ -246,7 +246,7 @@ function __construct( $_name, & $_parent, $first = false) {
*
* @return string
*/
- function getName() {
+ public function getName() {
return $this->name;
}
@@ -256,7 +256,7 @@ function getName() {
* @param object $node
*
*/
- function addNode($node) {
+ public function addNode($node) {
if(array_key_exists($node->getName(), $this->data))
{
if(!is_array($this->data[$node->getName()]))
@@ -279,7 +279,7 @@ function addNode($node) {
*
* @return string
*/
- function getAttrib($i) {
+ public function getAttrib($i) {
return $this->attrib[$i];
}
@@ -289,7 +289,7 @@ function getAttrib($i) {
* @param string $value value of attribute to set
*
*/
- function setAttrib($value) {
+ public function setAttrib($value) {
$this->attrib[] = $value;
}
@@ -298,7 +298,7 @@ function setAttrib($value) {
*
* @return object parent of this object
*/
- function &getParent() {
+ public function &getParent() {
return $this->parentnode;
}
@@ -307,7 +307,7 @@ function &getParent() {
*
* @return object The first child
*/
- function &getFirstChild(){
+ public function &getFirstChild(){
static $nullguard = null;
if(count($this->child) > 0) {
//echo "moving from " . $this->getName() . " to " . $this->child[0]->getName() . "
";
@@ -326,7 +326,7 @@ function &getFirstChild(){
*
* @return string - HTML formatted display of object tree
*/
- function printTree(& $node=null, $level=1){
+ public function printTree(& $node=null, $level=1){
$level += 1;
$html = "";
if($node == null)
@@ -350,12 +350,12 @@ function printTree(& $node=null, $level=1){
* export tree to icalendar format
*
* @param object $node Top level node to export
- *
+ *
* @param int $level Level of recursion (usually leave this blank)
*
* @return string iCalendar formatted output
*/
- function export(& $node=null, $level=0){
+ public function export(& $node=null, $level=0){
$txtstr = "";
if($node == null)
$node = $this;
@@ -433,10 +433,10 @@ function export(& $node=null, $level=0){
* @param object $p properties
*
*/
- function printDataLine($d, $p)
+ public function printDataLine($d, $p)
{
$txtstr = "";
-
+
$values = $d->getValues();
// don't think we need this, Sunbird does not like it in the EXDATE field
//$values = str_replace(",", "\\,", $values);
@@ -471,517 +471,515 @@ class ZCiCal {
*
* @var object
*/
- var $tree=null;
+ public $tree=null;
/**
- * The most recently created node in the tree
+ * The most recently created node in the tree
*
* @var object
*/
- var $curnode=null;
-
-/**
- * The main iCalendar object containing ZCiCalDataNodes and ZCiCalNodes.
- *
- * use maxevents and startevent to read events in multiple passes (to save memory)
- *
- * @param string $data icalendar feed string (empty if creating new feed)
- *
- * @param int $maxevents maximum # of events to read
- *
- * @param int $startevent starting event to read
- *
- * @return void
- *
-*
-*/
-function __construct($data = "", $maxevents = 1000000, $startevent = 0) {
-
- if($data != ""){
- // unfold lines
- // first change all eol chars to "\n"
- $data = str_replace(array("\r\n", "\n\r", "\n", "\r"), "\n", $data);
- // now unfold lines
- //$data = str_replace(array("\n ", "\n "),"!?", $data);
- $data = str_replace(array("\n ", "\n "),"", $data);
- // replace special iCal chars
- $data = str_replace(array("\\\\","\,"),array("\\",","), $data);
-
- // parse each line
- $lines = explode("\n", $data);
-
- $linecount = 0;
- $eventcount = 0;
- $eventpos = 0;
- foreach($lines as $line) {
- //$line = str_replace("!?", "\n", $line); // add nl back into descriptions
- // echo ($linecount + 1) . ": " . $line . "
";
- if(substr($line,0,6) == "BEGIN:") {
- // start new object
- $name = substr($line,6);
- if($name == "VEVENT")
- {
- if($eventcount < $maxevents && $eventpos >= $startevent)
- {
- $this->curnode = new ZCiCalNode($name, $this->curnode);
- if($this->tree == null)
- $this->tree = $this->curnode;
- }
- }
- else
- {
- $this->curnode = new ZCiCalNode($name, $this->curnode);
- if($this->tree == null)
- $this->tree = $this->curnode;
- }
- //echo "new node: " . $this->curnode->name . "
\n";
- /*
- if($this->curnode->getParent() != null)
- echo "parent of " . $this->curnode->getName() . " is " . $this->curnode->getParent()->getName() . "
";
- else
- echo "parent of " . $this->curnode->getName() . " is null
";
- */
- }
- else if(substr($line,0,4) == "END:") {
- $name = substr($line,4);
- if($name == "VEVENT")
- {
- if($eventcount < $maxevents && $eventpos >= $startevent)
- {
- $eventcount++;
- if($this->curnode->getName() != $name) {
- //panic, mismatch in iCal structure
- //die("Can't read iCal file structure, expecting " . $this->curnode->getName() . " but reading $name instead");
- throw new Exception("Can't read iCal file structure, expecting " . $this->curnode->getName() . " but reading $name instead");
- }
- if($this->curnode->getParent() != null) {
- //echo "moving up from " . $this->curnode->getName() ;
- $this->curnode = & $this->curnode->getParent();
- //echo " to " . $this->curnode->getName() . "
";
- //echo $this->curnode->getName() . " has " . count($this->curnode->child) . " children
";
- }
- }
- $eventpos++;
- }
- else
- {
- if($this->curnode->getName() != $name) {
- //panic, mismatch in iCal structure
- //die("Can't read iCal file structure, expecting " . $this->curnode->getName() . " but reading $name instead");
- throw new Exception("Can't read iCal file structure, expecting " . $this->curnode->getName() . " but reading $name instead");
- }
- if($this->curnode->getParent() != null) {
- //echo "moving up from " . $this->curnode->getName() ;
- $this->curnode = & $this->curnode->getParent();
- //echo " to " . $this->curnode->getName() . "
";
- //echo $this->curnode->getName() . " has " . count($this->curnode->child) . " children
";
- }
- }
- }
- else {
- $datanode = new ZCiCalDataNode($line);
- if($this->curnode->getName() == "VEVENT")
- {
- if($eventcount < $maxevents && $eventpos >= $startevent)
- {
- if($datanode->getName() == "EXDATE")
- {
- if(!array_key_exists($datanode->getName(),$this->curnode->data))
- {
- $this->curnode->data[$datanode->getName()] = $datanode;
- }
- else
- {
- $this->curnode->data[$datanode->getName()]->value[] = $datanode->value[0];
- }
- }
- else
- {
- if(!array_key_exists($datanode->getName(),$this->curnode->data))
- {
- $this->curnode->data[$datanode->getName()] = $datanode;
- }
- else
- {
- $tnode = $this->curnode->data[$datanode->getName()];
- $this->curnode->data[$datanode->getName()] = array();
- $this->curnode->data[$datanode->getName()][] = $tnode;
- $this->curnode->data[$datanode->getName()][] = $datanode;
- }
- }
- }
- }
- else
- {
- if($datanode->getName() == "EXDATE")
- {
- if(!array_key_exists($datanode->getName(),$this->curnode->data))
- {
- $this->curnode->data[$datanode->getName()] = $datanode;
- }
- else
- {
- $this->curnode->data[$datanode->getName()]->value[] = $datanode->value[0];
- }
- }
- else
- {
- if(!array_key_exists($datanode->getName(),$this->curnode->data))
- {
- $this->curnode->data[$datanode->getName()] = $datanode;
- }
- else
- {
- $tnode = $this->curnode->data[$datanode->getName()];
- $this->curnode->data[$datanode->getName()] = array();
- $this->curnode->data[$datanode->getName()][] = $tnode;
- $this->curnode->data[$datanode->getName()][] = $datanode;
- }
- }
- }
- }
- $linecount++;
- }
- }
- else {
- $name = "VCALENDAR";
- $this->curnode = new ZCiCalNode($name, $this->curnode);
- $this->tree = $this->curnode;
- $datanode = new ZCiCalDataNode("VERSION:2.0");
- $this->curnode->data[$datanode->getName()] = $datanode;
-
- $datanode = new ZCiCalDataNode("PRODID:-//ZContent.net//ZapCalLib 1.0//EN");
- $this->curnode->data[$datanode->getName()] = $datanode;
- $datanode = new ZCiCalDataNode("CALSCALE:GREGORIAN");
- $this->curnode->data[$datanode->getName()] = $datanode;
- $datanode = new ZCiCalDataNode("METHOD:PUBLISH");
- $this->curnode->data[$datanode->getName()] = $datanode;
- }
-}
+ public $curnode=null;
+
+ /**
+ * The main iCalendar object containing ZCiCalDataNodes and ZCiCalNodes.
+ *
+ * use maxevents and startevent to read events in multiple passes (to save memory)
+ *
+ * @param string $data icalendar feed string (empty if creating new feed)
+ *
+ * @param int $maxevents maximum # of events to read
+ *
+ * @param int $startevent starting event to read
+ *
+ * @return void
+ *
+ *
+ */
+ function __construct($data = "", $maxevents = 1000000, $startevent = 0) {
+
+ if($data != ""){
+ // unfold lines
+ // first change all eol chars to "\n"
+ $data = str_replace(array("\r\n", "\n\r", "\n", "\r"), "\n", $data);
+ // now unfold lines
+ //$data = str_replace(array("\n ", "\n "),"!?", $data);
+ $data = str_replace(array("\n ", "\n "),"", $data);
+ // replace special iCal chars
+ $data = str_replace(array("\\\\","\,"),array("\\",","), $data);
+
+ // parse each line
+ $lines = explode("\n", $data);
+
+ $linecount = 0;
+ $eventcount = 0;
+ $eventpos = 0;
+ foreach($lines as $line) {
+ //$line = str_replace("!?", "\n", $line); // add nl back into descriptions
+ // echo ($linecount + 1) . ": " . $line . "
";
+ if(substr($line,0,6) == "BEGIN:") {
+ // start new object
+ $name = substr($line,6);
+ if($name == "VEVENT")
+ {
+ if($eventcount < $maxevents && $eventpos >= $startevent)
+ {
+ $this->curnode = new ZCiCalNode($name, $this->curnode);
+ if($this->tree == null)
+ $this->tree = $this->curnode;
+ }
+ }
+ else
+ {
+ $this->curnode = new ZCiCalNode($name, $this->curnode);
+ if($this->tree == null)
+ $this->tree = $this->curnode;
+ }
+ //echo "new node: " . $this->curnode->name . "
\n";
+ /*
+ if($this->curnode->getParent() != null)
+ echo "parent of " . $this->curnode->getName() . " is " . $this->curnode->getParent()->getName() . "
";
+ else
+ echo "parent of " . $this->curnode->getName() . " is null
";
+ */
+ }
+ else if(substr($line,0,4) == "END:") {
+ $name = substr($line,4);
+ if($name == "VEVENT")
+ {
+ if($eventcount < $maxevents && $eventpos >= $startevent)
+ {
+ $eventcount++;
+ if($this->curnode->getName() != $name) {
+ //panic, mismatch in iCal structure
+ //die("Can't read iCal file structure, expecting " . $this->curnode->getName() . " but reading $name instead");
+ throw new Exception("Can't read iCal file structure, expecting " . $this->curnode->getName() . " but reading $name instead");
+ }
+ if($this->curnode->getParent() != null) {
+ //echo "moving up from " . $this->curnode->getName() ;
+ $this->curnode = & $this->curnode->getParent();
+ //echo " to " . $this->curnode->getName() . "
";
+ //echo $this->curnode->getName() . " has " . count($this->curnode->child) . " children
";
+ }
+ }
+ $eventpos++;
+ }
+ else
+ {
+ if($this->curnode->getName() != $name) {
+ //panic, mismatch in iCal structure
+ //die("Can't read iCal file structure, expecting " . $this->curnode->getName() . " but reading $name instead");
+ throw new Exception("Can't read iCal file structure, expecting " . $this->curnode->getName() . " but reading $name instead");
+ }
+ if($this->curnode->getParent() != null) {
+ //echo "moving up from " . $this->curnode->getName() ;
+ $this->curnode = & $this->curnode->getParent();
+ //echo " to " . $this->curnode->getName() . "
";
+ //echo $this->curnode->getName() . " has " . count($this->curnode->child) . " children
";
+ }
+ }
+ }
+ else {
+ $datanode = new ZCiCalDataNode($line);
+ if($this->curnode->getName() == "VEVENT")
+ {
+ if($eventcount < $maxevents && $eventpos >= $startevent)
+ {
+ if($datanode->getName() == "EXDATE")
+ {
+ if(!array_key_exists($datanode->getName(),$this->curnode->data))
+ {
+ $this->curnode->data[$datanode->getName()] = $datanode;
+ }
+ else
+ {
+ $this->curnode->data[$datanode->getName()]->value[] = $datanode->value[0];
+ }
+ }
+ else
+ {
+ if(!array_key_exists($datanode->getName(),$this->curnode->data))
+ {
+ $this->curnode->data[$datanode->getName()] = $datanode;
+ }
+ else
+ {
+ $tnode = $this->curnode->data[$datanode->getName()];
+ $this->curnode->data[$datanode->getName()] = array();
+ $this->curnode->data[$datanode->getName()][] = $tnode;
+ $this->curnode->data[$datanode->getName()][] = $datanode;
+ }
+ }
+ }
+ }
+ else
+ {
+ if($datanode->getName() == "EXDATE")
+ {
+ if(!array_key_exists($datanode->getName(),$this->curnode->data))
+ {
+ $this->curnode->data[$datanode->getName()] = $datanode;
+ }
+ else
+ {
+ $this->curnode->data[$datanode->getName()]->value[] = $datanode->value[0];
+ }
+ }
+ else
+ {
+ if(!array_key_exists($datanode->getName(),$this->curnode->data))
+ {
+ $this->curnode->data[$datanode->getName()] = $datanode;
+ }
+ else
+ {
+ $tnode = $this->curnode->data[$datanode->getName()];
+ $this->curnode->data[$datanode->getName()] = array();
+ $this->curnode->data[$datanode->getName()][] = $tnode;
+ $this->curnode->data[$datanode->getName()][] = $datanode;
+ }
+ }
+ }
+ }
+ $linecount++;
+ }
+ }
+ else {
+ $name = "VCALENDAR";
+ $this->curnode = new ZCiCalNode($name, $this->curnode);
+ $this->tree = $this->curnode;
+ $datanode = new ZCiCalDataNode("VERSION:2.0");
+ $this->curnode->data[$datanode->getName()] = $datanode;
+
+ $datanode = new ZCiCalDataNode("PRODID:-//ZContent.net//ZapCalLib 1.0//EN");
+ $this->curnode->data[$datanode->getName()] = $datanode;
+ $datanode = new ZCiCalDataNode("CALSCALE:GREGORIAN");
+ $this->curnode->data[$datanode->getName()] = $datanode;
+ $datanode = new ZCiCalDataNode("METHOD:PUBLISH");
+ $this->curnode->data[$datanode->getName()] = $datanode;
+ }
+ }
+
+ /**
+ * CountEvents()
+ *
+ * Return the # of VEVENTs in the object
+ *
+ * @return int
+ */
+
+ function countEvents() {
+ $count = 0;
+ if(isset($this->tree->child)){
+ foreach($this->tree->child as $child){
+ if($child->getName() == "VEVENT")
+ $count++;
+ }
+ }
+ return $count;
+ }
+
+ /**
+ * CountVenues()
+ *
+ * Return the # of VVENUEs in the object
+ *
+ * @return int
+ */
+
+ function countVenues() {
+ $count = 0;
+ if(isset($this->tree->child)){
+ foreach($this->tree->child as $child){
+ if($child->getName() == "VVENUE")
+ $count++;
+ }
+ }
+ return $count;
+ }
+
+ /**
+ * Export object to string
+ *
+ * This function exports all objects to an iCalendar string
+ *
+ * @return string an iCalendar formatted string
+ */
+
+ function export() {
+ return $this->tree->export($this->tree);
+ }
+
+ /**
+ * Get first event in object list
+ * Use getNextEvent() to navigate through list
+ *
+ * @return object The first event, or null
+ */
+ function &getFirstEvent() {
+ static $nullguard = null;
+ if ($this->countEvents() > 0){
+ $child = $this->tree->child[0];
+ $event=false;
+ while(!$event && $child != null){
+ if($child->getName() == "VEVENT")
+ $event = true;
+ else
+ $child = $child->next;
+ }
+ return $child;
+ }
+ else
+ return $nullguard;
+ }
+
+ /**
+ * Get next event in object list
+ *
+ * @param object $event The current event object
+ *
+ * @return object Returns the next event or null if past last event
+ */
+ function &getNextEvent($event){
+ do{
+ $event = $event->next;
+ } while($event != null && $event->getName() != "VEVENT");
+ return $event;
+ }
+
+ /**
+ * Get first venue in object list
+ * Use getNextVenue() to navigate through list
+ *
+ * @return object The first venue, or null
+ */
+ function &getFirstVenue() {
+ static $nullguard = null;
+ if ($this->countVenues() > 0){
+ $child = $this->tree->child[0];
+ $event=false;
+ while(!$event && $child != null){
+ if($child->getName() == "VVENUE")
+ $event = true;
+ else
+ $child = $child->next;
+ }
+ return $child;
+ }
+ else
+ return $nullguard;
+ }
+
+ /**
+ * Get next venue in object list
+ *
+ * @param object $venue The current venue object
+ *
+ * @return object Returns the next venue or null if past last venue
+ */
+ function &getNextVenue($venue){
+ do{
+ $venue = $venue->next;
+ } while($venue != null && $venue->getName() != "VVENUE");
+ return $venue;
+ }
+
+ /**
+ * Get first child in object list
+ * Use getNextSibling() and getPreviousSibling() to navigate through list
+ *
+ * @param object $thisnode The parent object
+ *
+ * @return object The child object
+ */
+ function &getFirstChild(& $thisnode){
+ $nullvalue = null;
+ if(count($thisnode->child) > 0) {
+ //echo "moving from " . $thisnode->getName() . " to " . $thisnode->child[0]->getName() . "
";
+ return $thisnode->child[0];
+ }
+ else
+ return $nullvalue;
+ }
+
+ /**
+ * Get next sibling in object list
+ *
+ * @param object $thisnode The current object
+ *
+ * @return object Returns the next sibling
+ */
+ function &getNextSibling(& $thisnode){
+ return $thisnode->next;
+ }
+
+ /**
+ * Get previous sibling in object list
+ *
+ * @param object $thisnode The current object
+ *
+ * @return object Returns the previous sibling
+ */
+ function &getPrevSibling(& $thisnode){
+ return $thisnode->prev;
+ }
+
+ /**
+ * Read date/time in iCal formatted string
+ *
+ * @param string iCal formated date/time string
+ *
+ * @return int Unix timestamp
+ * @deprecated Use ZDateHelper::toUnixDateTime() instead
+ */
+
+ function toUnixDateTime($datetime){
+ $year = substr($datetime,0,4);
+ $month = substr($datetime,4,2);
+ $day = substr($datetime,6,2);
+ $hour = 0;
+ $minute = 0;
+ $second = 0;
+ if(strlen($datetime) > 8 && $datetime{8} == "T") {
+ $hour = substr($datetime,9,2);
+ $minute = substr($datetime,11,2);
+ $second = substr($datetime,13,2);
+ }
+ $d1 = mktime($hour, $minute, $second, $month, $day, $year);
+
+ }
+
+ /**
+ * fromUnixDateTime()
+ *
+ * Take Unix timestamp and format to iCal date/time string
+ *
+ * @param int $datetime Unix timestamp, leave blank for current date/time
+ *
+ * @return string formatted iCal date/time string
+ * @deprecated Use ZDateHelper::fromUnixDateTimetoiCal() instead
+ */
+
+ static function fromUnixDateTime($datetime = null){
+ date_default_timezone_set('UTC');
+ if($datetime == null)
+ $datetime = time();
+ return date("Ymd\THis",$datetime);
+ }
+
+
+ /**
+ * fromUnixDate()
+ *
+ * Take Unix timestamp and format to iCal date string
+ *
+ * @param int $datetime Unix timestamp, leave blank for current date/time
+ *
+ * @return string formatted iCal date string
+ * @deprecated Use ZDateHelper::fromUnixDateTimetoiCal() instead
+ */
+
+ static function fromUnixDate($datetime = null){
+ date_default_timezone_set('UTC');
+ if($datetime == null)
+ $datetime = time();
+ return date("Ymd",$datetime);
+ }
+
+ /**
+ * Format into iCal time format from SQL date or SQL date-time format
+ *
+ * @param string $datetime SQL date or SQL date-time string
+ *
+ * @return string iCal formatted string
+ * @deprecated Use ZDateHelper::fromSqlDateTime() instead
+ */
+ static function fromSqlDateTime($datetime = ""){
+ if($datetime == "")
+ $datetime = ZDateHelper::toSqlDateTime();
+ if(strlen($datetime) > 10)
+ return sprintf('%04d%02d%02dT%02d%02d%02d',substr($datetime,0,4),substr($datetime,5,2),substr($datetime,8,2),
+ substr($datetime,11,2),substr($datetime,14,2),substr($datetime,17,2));
+ else
+ return sprintf('%04d%02d%02d',substr($datetime,0,4),substr($datetime,5,2),substr($datetime,8,2));
+ }
+
+ /**
+ * Format iCal time format to either SQL date or SQL date-time format
+ *
+ * @param string $datetime icalendar formatted date or date-time
+ * @return string SQL date or SQL date-time string
+ * @deprecated Use ZDateHelper::toSqlDateTime() instead
+ */
+ static function toSqlDateTime($datetime = ""){
+ if($datetime == "")
+ return ZDateHelper::toSqlDateTime();
+ if(strlen($datetime) > 10)
+ return sprintf('%04d-%02d-%02d %02d:%02d:%02d',substr($datetime,0,4),substr($datetime,5,2),substr($datetime,8,2),
+ substr($datetime,11,2),substr($datetime,14,2),substr($datetime,17,2));
+ else
+ return sprintf('%04d-%02d-%02d',substr($datetime,0,4),substr($datetime,5,2),substr($datetime,8,2));
+ }
+
+ /**
+ * Pull timezone data from node and put in array
+ *
+ * Returning array contains the following array keys: tzoffsetfrom, tzoffsetto, tzname, dtstart, rrule
+ *
+ * @param array $node timezone object
+ *
+ * @return array
+ */
+ static function getTZValues($node){
+ $tzvalues = array();
+
+ $tnode = @$node->data['TZOFFSETFROM'];
+ if($tnode != null){
+ $tzvalues["tzoffsetfrom"] = $tnode->getValues();
+ }
+
+ $tnode = @$node->data['TZOFFSETTO'];
+ if($tnode != null){
+ $tzvalues["tzoffsetto"] = $tnode->getValues();
+ }
+
+ $tnode = @$node->data['TZNAME'];
+ if($tnode != null){
+ $tzvalues["tzname"] = $tnode->getValues();
+ }
+ else
+ $tzvalues["tzname"] = "";
+
+ $tnode = @$node->data['DTSTART'];
+ if($tnode != null){
+ $tzvalues["dtstart"] = ZDateHelper::fromiCaltoUnixDateTime($tnode->getValues());
+ }
+
+ $tnode = @$node->data['RRULE'];
+ if($tnode != null){
+ $tzvalues["rrule"] = $tnode->getValues();
+ //echo "rule: " . $tzvalues["rrule"] . "
\n";
+ }
+ else{
+ // no rule specified, let's create one from based on the date
+ $date = getdate($tzvalues["dtstart"]);
+ $month = $date["mon"];
+ $day = $date["mday"];
+ $tzvalues["rrule"] = "FREQ=YEARLY;INTERVAL=1;BYMONTH=$month;BYMONTHDAY=$day";
+ }
+
+ return $tzvalues;
+ }
+
+ /**
+ * Escape slashes, commas and semicolons in strings
+ *
+ * @param string $content
+ *
+ * @return string
+ */
+ static function formatContent($content)
+ {
+ $content = str_replace(array('\\' , ',' , ';' ), array('\\\\' , '\\,' , '\\;' ),$content);
+ return $content;
+ }
-/**
- * CountEvents()
- *
- * Return the # of VEVENTs in the object
- *
- * @return int
- */
-
-function countEvents() {
- $count = 0;
- if(isset($this->tree->child)){
- foreach($this->tree->child as $child){
- if($child->getName() == "VEVENT")
- $count++;
- }
- }
- return $count;
}
-
-/**
- * CountVenues()
- *
- * Return the # of VVENUEs in the object
- *
- * @return int
- */
-
-function countVenues() {
- $count = 0;
- if(isset($this->tree->child)){
- foreach($this->tree->child as $child){
- if($child->getName() == "VVENUE")
- $count++;
- }
- }
- return $count;
-}
-
-/**
- * Export object to string
- *
- * This function exports all objects to an iCalendar string
- *
- * @return string an iCalendar formatted string
- */
-
-function export() {
- return $this->tree->export($this->tree);
-}
-
-/**
- * Get first event in object list
- * Use getNextEvent() to navigate through list
- *
- * @return object The first event, or null
- */
-function &getFirstEvent() {
- static $nullguard = null;
- if ($this->countEvents() > 0){
- $child = $this->tree->child[0];
- $event=false;
- while(!$event && $child != null){
- if($child->getName() == "VEVENT")
- $event = true;
- else
- $child = $child->next;
- }
- return $child;
- }
- else
- return $nullguard;
-}
-
-/**
- * Get next event in object list
- *
- * @param object $event The current event object
- *
- * @return object Returns the next event or null if past last event
- */
-function &getNextEvent($event){
- do{
- $event = $event->next;
- } while($event != null && $event->getName() != "VEVENT");
- return $event;
-}
-
-/**
- * Get first venue in object list
- * Use getNextVenue() to navigate through list
- *
- * @return object The first venue, or null
- */
-function &getFirstVenue() {
- static $nullguard = null;
- if ($this->countVenues() > 0){
- $child = $this->tree->child[0];
- $event=false;
- while(!$event && $child != null){
- if($child->getName() == "VVENUE")
- $event = true;
- else
- $child = $child->next;
- }
- return $child;
- }
- else
- return $nullguard;
-}
-
-/**
- * Get next venue in object list
- *
- * @param object $venue The current venue object
- *
- * @return object Returns the next venue or null if past last venue
- */
-function &getNextVenue($venue){
- do{
- $venue = $venue->next;
- } while($venue != null && $venue->getName() != "VVENUE");
- return $venue;
-}
-
-/**
- * Get first child in object list
- * Use getNextSibling() and getPreviousSibling() to navigate through list
- *
- * @param object $thisnode The parent object
- *
- * @return object The child object
- */
-function &getFirstChild(& $thisnode){
- $nullvalue = null;
- if(count($thisnode->child) > 0) {
- //echo "moving from " . $thisnode->getName() . " to " . $thisnode->child[0]->getName() . "
";
- return $thisnode->child[0];
- }
- else
- return $nullvalue;
-}
-
-/**
- * Get next sibling in object list
- *
- * @param object $thisnode The current object
- *
- * @return object Returns the next sibling
- */
-function &getNextSibling(& $thisnode){
- return $thisnode->next;
-}
-
-/**
- * Get previous sibling in object list
- *
- * @param object $thisnode The current object
- *
- * @return object Returns the previous sibling
- */
-function &getPrevSibling(& $thisnode){
- return $thisnode->prev;
-}
-
-/**
- * Read date/time in iCal formatted string
- *
- * @param string iCal formated date/time string
- *
- * @return int Unix timestamp
- * @deprecated Use ZDateHelper::toUnixDateTime() instead
- */
-
-function toUnixDateTime($datetime){
- $year = substr($datetime,0,4);
- $month = substr($datetime,4,2);
- $day = substr($datetime,6,2);
- $hour = 0;
- $minute = 0;
- $second = 0;
- if(strlen($datetime) > 8 && $datetime{8} == "T") {
- $hour = substr($datetime,9,2);
- $minute = substr($datetime,11,2);
- $second = substr($datetime,13,2);
- }
- $d1 = mktime($hour, $minute, $second, $month, $day, $year);
-
-}
-
-/**
- * fromUnixDateTime()
- *
- * Take Unix timestamp and format to iCal date/time string
- *
- * @param int $datetime Unix timestamp, leave blank for current date/time
- *
- * @return string formatted iCal date/time string
- * @deprecated Use ZDateHelper::fromUnixDateTimetoiCal() instead
- */
-
-static function fromUnixDateTime($datetime = null){
- date_default_timezone_set('UTC');
- if($datetime == null)
- $datetime = time();
- return date("Ymd\THis",$datetime);
-}
-
-
-/**
- * fromUnixDate()
- *
- * Take Unix timestamp and format to iCal date string
- *
- * @param int $datetime Unix timestamp, leave blank for current date/time
- *
- * @return string formatted iCal date string
- * @deprecated Use ZDateHelper::fromUnixDateTimetoiCal() instead
- */
-
-static function fromUnixDate($datetime = null){
- date_default_timezone_set('UTC');
- if($datetime == null)
- $datetime = time();
- return date("Ymd",$datetime);
-}
-
-/**
- * Format into iCal time format from SQL date or SQL date-time format
- *
- * @param string $datetime SQL date or SQL date-time string
- *
- * @return string iCal formatted string
- * @deprecated Use ZDateHelper::fromSqlDateTime() instead
- */
-static function fromSqlDateTime($datetime = ""){
- if($datetime == "")
- $datetime = ZDateHelper::toSqlDateTime();
- if(strlen($datetime) > 10)
- return sprintf('%04d%02d%02dT%02d%02d%02d',substr($datetime,0,4),substr($datetime,5,2),substr($datetime,8,2),
- substr($datetime,11,2),substr($datetime,14,2),substr($datetime,17,2));
- else
- return sprintf('%04d%02d%02d',substr($datetime,0,4),substr($datetime,5,2),substr($datetime,8,2));
-}
-
-/**
- * Format iCal time format to either SQL date or SQL date-time format
- *
- * @param string $datetime icalendar formatted date or date-time
- * @return string SQL date or SQL date-time string
- * @deprecated Use ZDateHelper::toSqlDateTime() instead
- */
-static function toSqlDateTime($datetime = ""){
- if($datetime == "")
- return ZDateHelper::toSqlDateTime();
- if(strlen($datetime) > 10)
- return sprintf('%04d-%02d-%02d %02d:%02d:%02d',substr($datetime,0,4),substr($datetime,5,2),substr($datetime,8,2),
- substr($datetime,11,2),substr($datetime,14,2),substr($datetime,17,2));
- else
- return sprintf('%04d-%02d-%02d',substr($datetime,0,4),substr($datetime,5,2),substr($datetime,8,2));
-}
-
-/**
- * Pull timezone data from node and put in array
- *
- * Returning array contains the following array keys: tzoffsetfrom, tzoffsetto, tzname, dtstart, rrule
- *
- * @param array $node timezone object
- *
- * @return array
- */
-static function getTZValues($node){
- $tzvalues = array();
-
- $tnode = @$node->data['TZOFFSETFROM'];
- if($tnode != null){
- $tzvalues["tzoffsetfrom"] = $tnode->getValues();
- }
-
- $tnode = @$node->data['TZOFFSETTO'];
- if($tnode != null){
- $tzvalues["tzoffsetto"] = $tnode->getValues();
- }
-
- $tnode = @$node->data['TZNAME'];
- if($tnode != null){
- $tzvalues["tzname"] = $tnode->getValues();
- }
- else
- $tzvalues["tzname"] = "";
-
- $tnode = @$node->data['DTSTART'];
- if($tnode != null){
- $tzvalues["dtstart"] = ZDateHelper::fromiCaltoUnixDateTime($tnode->getValues());
- }
-
- $tnode = @$node->data['RRULE'];
- if($tnode != null){
- $tzvalues["rrule"] = $tnode->getValues();
- //echo "rule: " . $tzvalues["rrule"] . "
\n";
- }
- else{
- // no rule specified, let's create one from based on the date
- $date = getdate($tzvalues["dtstart"]);
- $month = $date["mon"];
- $day = $date["mday"];
- $tzvalues["rrule"] = "FREQ=YEARLY;INTERVAL=1;BYMONTH=$month;BYMONTHDAY=$day";
- }
-
- return $tzvalues;
-}
-
-/**
- * Escape slashes, commas and semicolons in strings
- *
- * @param string $content
- *
- * @return string
- */
-static function formatContent($content)
-{
- $content = str_replace(array('\\' , ',' , ';' ), array('\\\\' , '\\,' , '\\;' ),$content);
- return $content;
-}
-
-}
-
-?>
diff --git a/includes/recurringdate.php b/includes/recurringdate.php
index 9f6920f..d78117b 100644
--- a/includes/recurringdate.php
+++ b/includes/recurringdate.php
@@ -1,7 +1,7 @@
* @copyright Copyright (C) 2006 - 2017 by Dan Cogliano
@@ -23,134 +23,134 @@ class ZCRecurringDate {
*
* @var string
*/
- var $rules = "";
+ public $rules = "";
/**
* start date in Unix Timestamp format (local timezone)
*
* @var integer
*/
- var $startdate = null;
+ public $startdate = null;
/**
* repeating frequency type (i.e. "y" for yearly, "m" for monthly)
*
* @var string
*/
- var $freq = null;
+ public $freq = null;
/**
* timezone of event (using PHP timezones)
*
* @var string
*/
- var $tzid = null;
+ public $tzid = null;
/**
* repeat mode ('c': count, 'u': until)
*
* @var string
*/
- var $repeatmode=null;
+ public $repeatmode=null;
/**
* repeat until date (in UTC Unix Timestamp format)
*
* @var integer
*/
- var $until=null;
+ public $until=null;
/**
* repeat count when repeat mode is 'c'
- *
+ *
* @var integer
*/
- var $count=0;
+ public $count=0;
/**
* array of repeat by seconds values
*
* @var array
*/
- var $bysecond=array();
+ public $bysecond=array();
/**
* array of repeat by minutes values
*
* @var array
*/
- var $byminute=array();
+ public $byminute=array();
/**
* array of repeat by hour values
*
* @var array
*/
- var $byhour=array();
+ public $byhour=array();
/**
* array of repeat by day values
*
* @var array
*/
- var $byday=array();
+ public $byday=array();
/**
* array of repeat by month day values
*
* @var array
*/
- var $bymonthday=array();
+ public $bymonthday=array();
/**
* array of repeat by month values
*
* @var array
*/
- var $bymonth=array();
+ public $bymonth=array();
/**
* array of repeat by year values
*
* @var array
*/
- var $byyear=array();
+ public $byyear=array();
/**
* array of repeat by setpos values
*
* @var array
*/
- var $bysetpos=array();
+ public $bysetpos=array();
/**
* inteval of repeating event (i.e. every 2 weeks, every 6 months)
*
* @var integer
*/
- var $interval = 1;
+ public $interval = 1;
/**
* debug level (for testing only)
*
* @var integer
*/
- var $debug = 0;
+ public $debug = 0;
/**
* error string (future use)
*
* @var string
*/
- var $error;
+ public $error;
/**
* array of exception dates in Unix Timestamp format (UTC dates)
*
* @var array
*/
- var $exdates=array();
-
+ public $exdates=array();
+
/**
* Expand recurring rule to a list of dates
*
@@ -159,14 +159,14 @@ class ZCRecurringDate {
* @param array $exdates array of exception dates
* @param string $tzid timezone of event (using PHP timezones)
*/
- function __construct($rules, $startdate, $exdates = array(),$tzid = "UTC"){
+ public function __construct($rules, $startdate, $exdates = array(),$tzid = "UTC"){
if(strlen($rules) > 0){
//move exdates to event timezone for comparing with event date
for($i = 0; $i < count($exdates); $i++)
{
$exdates[$i] = ZDateHelper::toUnixDateTime(ZDateHelper::toLocalDateTime(ZDateHelper::toSQLDateTime($exdates[$i]),$tzid));
}
-
+
$rules=str_replace("\'","",$rules);
$this->rules = $rules;
if($startdate == null){
@@ -177,7 +177,7 @@ function __construct($rules, $startdate, $exdates = array(),$tzid = "UTC"){
$this->startdate = $startdate;
$this->tzid = $tzid;
$this->exdates = $exdates;
-
+
$rules=explode(";", $rules);
$ruletype = "";
foreach($rules as $rule){
@@ -280,7 +280,7 @@ function __construct($rules, $startdate, $exdates = array(),$tzid = "UTC"){
}
}
}
-
+
/**
* bysetpos rule support
*
@@ -289,7 +289,7 @@ function __construct($rules, $startdate, $exdates = array(),$tzid = "UTC"){
*
* @return array
*/
- function bySetPos($bytype, $bysetpos){
+ public function bySetPos($bytype, $bysetpos){
$result = array();
for($i=0; $i < count($bysetpos); $i++){
for($j=0; $j < count($bytype); $j++){
@@ -303,17 +303,17 @@ function bySetPos($bytype, $bysetpos){
* save error
*
* @param string $msg
- */
- function setError($msg){
+ */
+ public function setError($msg){
$this->error = $msg;
}
-
+
/**
* get error message
*
* @return string error message
*/
- function getError(){
+ public function getError(){
return $this->error;
}
@@ -323,7 +323,7 @@ function getError(){
* @param integer $level
*
*/
- function setDebug($level)
+ public function setDebug($level)
{
$this->debug = $level;
}
@@ -334,14 +334,14 @@ function setDebug($level)
* @param integer $level
* @param string $msg
*/
- function debug($level, $msg){
+ public function debug($level, $msg){
if($this->debug >= $level)
echo $msg . "
\n";
}
-
+
/**
* Get repeating dates by year
- *
+ *
* @param integer $startdate start date of repeating events, in Unix timestamp format
* @param integer $enddate end date of repeating events, in Unix timestamp format
* @param array $rdates array to contain expanded repeating dates
@@ -371,10 +371,10 @@ private function byYear($startdate, $enddate, &$rdates, $tzid="UTC"){
self::debug(1,"byYear() returned " . $count );
return $count;
}
-
+
/**
* Get repeating dates by month
- *
+ *
* @param integer $startdate start date of repeating events, in Unix timestamp format
* @param integer $enddate end date of repeating events, in Unix timestamp format
* @param array $rdates array to contain expanded repeating dates
@@ -407,7 +407,7 @@ private function byMonth($startdate, $enddate, &$rdates, $tzid="UTC"){
/**
* Get repeating dates by month day
- *
+ *
* @param integer $startdate start date of repeating events, in Unix timestamp format
* @param integer $enddate end date of repeating events, in Unix timestamp format
* @param array $rdates array to contain expanded repeating dates
@@ -443,10 +443,10 @@ private function byMonthDay($startdate, $enddate, &$rdates, $tzid="UTC"){
self::debug(1,"byMonthDay() returned " . $count );
return $count;
}
-
+
/**
* Get repeating dates by day
- *
+ *
* @param integer $startdate start date of repeating events, in Unix timestamp format
* @param integer $enddate end date of repeating events, in Unix timestamp format
* @param array $rdates array to contain expanded repeating dates
@@ -473,7 +473,7 @@ private function byDay($startdate, $enddate, &$rdates, $tzid="UTC"){
4 => "TH",
5 => "FR",
6 => "SA");
-
+
$count = 0;
if(count($this->byday) > 0){
if(empty($this->byday[0]))
@@ -537,7 +537,7 @@ private function byDay($startdate, $enddate, &$rdates, $tzid="UTC"){
/**
* Get repeating dates by hour
- *
+ *
* @param integer $startdate start date of repeating events, in Unix timestamp format
* @param integer $enddate end date of repeating events, in Unix timestamp format
* @param array $rdates array to contain expanded repeating dates
@@ -571,7 +571,7 @@ private function byHour($startdate, $enddate, &$rdates, $tzid="UTC"){
/**
* Get repeating dates by minute
- *
+ *
* @param integer $startdate start date of repeating events, in Unix timestamp format
* @param integer $enddate end date of repeating events, in Unix timestamp format
* @param array $rdates array to contain expanded repeating dates
@@ -603,7 +603,7 @@ private function byMinute($startdate, $enddate, &$rdates, $tzid="UTC"){
}
/**
* Get repeating dates by second
- *
+ *
* @param integer $startdate start date of repeating events, in Unix timestamp format
* @param integer $enddate end date of repeating events, in Unix timestamp format
* @param array $rdates array to contain expanded repeating dates
@@ -631,11 +631,11 @@ private function bySecond($startdate, $enddate, &$rdates, $tzid="UTC"){
/**
* Determine if the loop has reached the end date
- *
+ *
* @param array $rdates array of repeating dates
*
* @return boolean
- */
+ */
private function maxDates($rdates){
if($this->repeatmode == "c" && count($rdates) >= $this->count)
return true; // exceeded count
@@ -651,7 +651,7 @@ private function maxDates($rdates){
* @param $maxdate integer maximum date to appear in repeating dates in Unix timestamp format
*
* @return array
- */
+ */
public function getDates($maxdate = null){
//$this->debug = 2;
self::debug(1,"getDates()");
@@ -680,7 +680,7 @@ public function getDates($maxdate = null){
case "m":
if($eventcount > 0)
{
-
+
$nextdate = ZDateHelper::addDate($nextdate,0,0,0,$this->interval,0,0,$this->tzid);
self::debug(2,"addDate() returned " . ZDateHelper::toSqlDateTime($nextdate));
}
@@ -728,7 +728,7 @@ public function getDates($maxdate = null){
$enddate=ZDateHelper::addDate($nextdate,0,0,0,0,1,0);
break;
}
-
+
$count = $this->byYear($nextdate,$enddate,$rdates,$this->tzid);
$eventcount += $count;
if($maxdate > 0 && $maxdate < $nextdate)
@@ -742,7 +742,7 @@ public function getDates($maxdate = null){
}
if($this->maxDates($rdates))
$done = true;
-
+
$year = date("Y", $nextdate);
if($year > _ZAPCAL_MAXYEAR)
{
@@ -763,7 +763,7 @@ public function getDates($maxdate = null){
$count2 = count($rdates);
$dups = $count1 - $count2;
$excount = 0;
-
+
foreach($this->exdates as $exdate)
{
if($pos = array_search($exdate,$rdates))
@@ -773,15 +773,15 @@ public function getDates($maxdate = null){
}
}
self::debug(1,"getDates() returned " . count($rdates) . " dates, removing $dups duplicates, $excount exceptions");
-
-
+
+
if($this->debug >= 2)
{
self::debug(2,"Recurring Dates:");
foreach($rdates as $rdate)
{
$d = getdate($rdate);
- self::debug(2,ZDateHelper::toSQLDateTime($rdate) . " " . $d["wday"] );
+ self::debug(2,ZDateHelper::toSQLDateTime($rdate) . " " . $d["wday"] );
}
self::debug(2,"Exception Dates:");
foreach($this->exdates as $exdate)
@@ -790,7 +790,7 @@ public function getDates($maxdate = null){
}
//exit;
}
-
+
return $rdates;
}
}
diff --git a/includes/timezone.php b/includes/timezone.php
index 5369f05..58614c0 100644
--- a/includes/timezone.php
+++ b/includes/timezone.php
@@ -1,7 +1,7 @@
-
* @copyright Copyright (C) 2006 - 2017 by Dan Cogliano
@@ -35,7 +35,7 @@ class ZCTimeZoneHelper {
*
* @return object return VTIMEZONE object
*/
- static function getTZNode($startyear, $endyear, $tzid, $parentnode)
+ public static function getTZNode($startyear, $endyear, $tzid, $parentnode)
{
$tzmins = array();
$tzmaxs = array();
diff --git a/zapcallib.php b/zapcallib.php
index bbad6f0..8871c29 100644
--- a/zapcallib.php
+++ b/zapcallib.php
@@ -25,4 +25,3 @@
}
require_once(_ZAPCAL_BASE . '/includes/framework.php');
-