From: Richard Whitehouse Date: Sun, 13 Feb 2011 02:30:24 +0000 (+0000) Subject: Moved index.php functionality to ical.php. index.php now contains primitive front... X-Git-Url: https://git.richardwhiuk.com/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=ical-relay.git Moved index.php functionality to ical.php. index.php now contains primitive front end. Added caching to allow for future development --- diff --git a/cache/.gitignore b/cache/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/ical.php b/ical.php new file mode 100644 index 0000000..e79ac41 --- /dev/null +++ b/ical.php @@ -0,0 +1,116 @@ +_data[$name]); + } + function __get($name){ + return $this->_data[$name]; + } + function __set($name, $value){ + return ($this->_data[$name][] = $value); + } + function __unset($name){ + unset($this->_data[$name]); + } + function display($t = 0){ + foreach($this->_data as $k => $l){ + foreach($l as $v){ + for($i = 0; $i < $t; $i ++){ echo "\t"; } + echo $k . ': '; + if(is_object($v)){ + echo "\r\n"; $v->display($t + 1); + } else { + echo $v . "\r\n"; + } + } + } + } +} + +foreach($directives as $line){ + $directive = explode(':', $line, 2); + if($directive[0] == 'BEGIN'){ + $child = new ical_obj(); + $child->_type = $type = $directive[1]; + $child->_parent = $current; + $current->$type = $child; + $current = $child; + } elseif($directive[0] == 'END'){ + if($current->_type != $directive[1]){ + exit('INVALID .ICAL FILE'); + } + $current = $current->_parent; + } else { + $type = $directive[0]; + $current->$type = $directive[1]; + } +} + +$ical->display(); + +fclose($fp); + diff --git a/index.php b/index.php index 3f41850..9faa6f5 100644 --- a/index.php +++ b/index.php @@ -1,87 +1,12 @@ -_data[$name]); - } - function __get($name){ - return $this->_data[$name]; - } - function __set($name, $value){ - return ($this->_data[$name][] = $value); - } - function __unset($name){ - unset($this->_data[$name]); - } - function display($t = 0){ - foreach($this->_data as $k => $l){ - foreach($l as $v){ - for($i = 0; $i < $t; $i ++){ echo "\t"; } - echo $k . ': '; - if(is_object($v)){ - echo "\r\n"; $v->display($t + 1); - } else { - echo $v . "\r\n"; - } - } - } - } -} - -foreach($directives as $line){ - $directive = explode(':', $line, 2); - if($directive[0] == 'BEGIN'){ - $child = new ical_obj(); - $child->_type = $type = $directive[1]; - $child->_parent = $current; - $current->$type = $child; - $current = $child; - } elseif($directive[0] == 'END'){ - if($current->_type != $directive[1]){ - exit('INVALID .ICAL FILE'); - } - $current = $current->_parent; - } else { - $type = $directive[0]; - $current->$type = $directive[1]; - } -} - -$ical->display(); - + + + + iCal Relay + + +
+

URL:

+

+
+ +