示例#1
0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
 */

error_reporting(E_ERROR);

require_once( 'iCalcreator.class.php' );
require_once( 'tz.php' );
$out = new vcalendar();
$v = new vcalendar(); // create a new calendar instance
$out->setXprop("X-WR-CALNAME","Facebook events");
$out->setConfig( 'unique_id', 'tevp.net-projects-calendars-fbevents' ); // set Your unique id, required if property UID is missing
$out->setProperty( 'method', 'PUBLISH' ); // required of some calendar software

$uid = $_GET["uid"];
$key = $_GET["key"];
$timezone = $_GET["timezone"];
$fb_url = $_GET["fb_url"];

if (!isset($timezone))
	$timezone = "Europe/London";

if (isset($action) && $action == "generate")
{
	preg_match("/fbcalendar.com\/cal\/(\d+)\/([\da-z]+)-\d+\/events\/ics/", $fb_url, $matches);
	if (count($matches) == 3)
示例#2
0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
 */

error_reporting(E_ERROR);

require_once( 'iCalcreator.class.php' );
require_once( 'tz.php' );
$out = new vcalendar();
$v = new vcalendar(); // create a new calendar instance
$out->setXprop("X-WR-CALNAME","Upcoming events");
$out->setConfig( 'unique_id', 'tevp.net-projects-calendars-upcoming' ); // set Your unique id, required if property UID is missing
$out->setProperty( 'method', 'PUBLISH' ); // required of some calendar software

$timezone = $_GET["timezone"];
$webcal = $_GET["webcal"];

if (!isset($timezone))
	$timezone = "Europe/London";

if (isset($action) && $action == "generate")
{
	preg_match("/webcal:\/\/upcoming.yahoo.com\/calendar\/v2\/my_events\/(\d+)\//", $webcal, $matches);
	if (count($matches) == 2)
	{
		$url = "http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']."?id=".$matches[1]."&timezone=".$timezone;
示例#3
0
 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
require_once 'lastRSS.php';
require_once 'iCalcreator.class.php';
$lr = new lastRSS();
$data = $lr->Get("http://feeds.feedburner.com/danaevents");
/*print_r($data);
exit;*/
$v = new vcalendar();
// create a new calendar instance
$v->setConfig('unique_id', $data['link']);
// set your unique id
$v->setProperty('method', 'PUBLISH');
// required of some calendar software
$v->setConfig('filename', "danaevents-" . $v->getConfig('filename'));
$v->setXprop("X-WR-CALNAME", $data['title']);
$v->setXprop("X-WR-CALDESC", $data['description']);
foreach ($data['items'] as $item) {
    $lines = explode("\n", $item['description']);
    //<p>28/05/2008, 19:00 - 20:30</p>
    //print $lines[count($lines)-1];
    preg_match("/(\\d+)\\/(\\d+)\\/(\\d+), (\\d+):(\\d+) - (\\d+):(\\d+)/", $lines[count($lines) - 1], $matches);
    //print_r($matches);
    //exit;
    $vevent = new vevent();
    // create an event calendar component
    $vevent->setProperty('dtstart', array('year' => $matches[3], 'month' => $matches[2], 'day' => $matches[1], 'hour' => $matches[4], 'min' => $matches[5], 'sec' => 0));
    $vevent->setProperty('dtend', array('year' => $matches[3], 'month' => $matches[2], 'day' => $matches[1], 'hour' => $matches[6], 'min' => $matches[7], 'sec' => 0));
    $vevent->setProperty('LOCATION', '165 Queen\'s Gate, South Kensington, London, SW7 5HD');
    // property name - case independent
    $vevent->setProperty('summary', $item['title']);
示例#4
0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
require_once 'iCalcreator.class.php';
require_once 'tz.php';
$v = new vcalendar();
// create a new calendar instance
$data = get("http://dorkbotlondon.org/feeds/icalendar/");
$v->parseString($data);
$out = new vcalendar();
$out->setXprop("X-WR-CALNAME", "Dorkbot London events");
$out->setConfig('unique_id', 'tevp.net-projects-calendars-dorkbot');
// set Your unique id, required if property UID is missing
$out->setProperty('method', 'PUBLISH');
// required of some calendar software
function get($url, $max_age = 3600)
{
    if (!file_exists("cache")) {
        mkdir("cache");
    }
    $fname = "cache/" . md5($url);
    $age = filemtime($fname);
    if (!$age || $max_age != -1 && time() - $age > $max_age) {
        $ret = file_get_contents($url);
        file_put_contents($fname, $ret);
    } else {