Google Calendar MediaWiki plugin
The statements and opinions on this page are solely those of its authors and do not necessarily represent the official position of CouchSurfing International.

THIS PAGE IS OUTDATED

Now you're rocking with the Tech team
( documentsstatusmeetingswhy we work on CS )

GuakaCS created a plugin for MediaWiki to include Google Calendars into the CouchSurfing Wiki.

He can send you the code if you ask him and will probably paste it onto this page some time.

Example

<googlecalendar>ht3jlfaac5lfd6263ulfh4tql8%40group.calendar.google.com</googlecalendar> What is it

Code

Available under the GNU General Public License.

Add the following line to your LocalSettings.php, somewhere at the end (e.g. right before the last line, containing ?>):

 require_once('extensions/googleCalendar.php');

Create extensions/googleCalendar.php, with the following:

<?php
# Google Calendars
#
# Tag :
#   <googlecalendar>docid</googlecalendar>
# Ex :
#   from url http://calendar.google.com/calendarplay?docid=6444586097901795775
#   <googlecalendar>6444586097901795775</googlecalendar>
#
# Enjoy !

$wgExtensionFunctions[] = 'wfGoogleCalendar';
$wgExtensionCredits['parserhook'][] = array(
        'name' => 'Google Calendar',
        'description' => 'Display Google Calendar',
        'author' => 'Kasper Souren',
        'url' => 'http://wiki.couchsurfing.com/en/Google_Calendar_MediaWiki_plugin'
);

function wfGoogleCalendar() {
        global $wgParser;
        $wgParser->setHook('googlecalendar', 'renderGoogleCalendar');
}

# The callback function for converting the input text to HTML output
function renderGoogleCalendar($input) {
        $input = htmlspecialchars($input);
        //$input = "6444586097901795775"
        $width = 425;
        $height = 350;

        $output = '<iframe src="http://www.google.com/calendar/embed?src=g43t277um81su1tjvgvah609qk%40group.calendar.google.com&pvttk=db8cdde758254dbe5a511723cac5da46&title=CSC-NZ&chrome=NAVIGATION&height=600&epr=4" style=" border-width:0 " width="480" frameborder="0" height="600"></iframe>';
        $output = '<iframe src="http://www.google.com/calendar/embed?src='.$input.'&title=CSC-NZ&chrome=NAVIGATION&height=600&epr=4" style=" border-width:0 " width="480" frameborder="0" height="600"></iframe>';

        /*

        $output = '<embed style="width:'.$width.'px; height:'.$height.'px;" '
                .'id="CalendarPlayback" type="application/x-shockwave-flash" '
                .'src="http://calendar.google.com/googleplayer.swf?docId='
                .$input.'"> </embed>';
        */
        return $output;
}
?>

Agenda alternative Code

This should work to display a small agenda to fit neatly into city pages side bar

Available under the GNU General Public License.

Add the following line to your LocalSettings.php, somewhere at the end (e.g. right before the last line, containing ?>):

 require_once('extensions/googleAgenda.php');

Create extensions/googleAgenda.php, with the following:

<?php
# Google Agendas
#
# Tag :
#   <googleagenda>docid</googleagenda>
# Ex :
#   from url http://calendar.google.com/calendarplay?docid=6444586097901795775
#   <googleagenda>6444586097901795775</googleagenda>
#
# Enjoy !

$wgExtensionFunctions[] = 'wfGoogleAgenda';
$wgExtensionCredits['parserhook'][] = array(
        'name' => 'Google Agenda',
        'description' => 'Display Google Agenda',
        'author' => 'Kasper Souren', 'James Smith',
        'url' => 'http://wiki.couchsurfing.com/en/Google_Calendar_MediaWiki_plugin'
);

function wfGoogleAgenda() {
        global $wgParser;
        $wgParser->setHook('googleagenda', 'renderGoogleAgenda');
}

# The callback function for converting the input text to HTML output
function renderGoogleAgenda($input) {
        $input = htmlspecialchars($input);
        //$input = "6444586097901795775"
        $width = 425;
        $height = 350;

        $output = '<iframe src="http://www.google.com/calendar/embed?showTitle=0&showNav=0&showTabs=0&showCurrentTime=0&mode=AGENDA&height=350&wkst=1&bgcolor=%23FFFFFF&src='.$input.'&color=%23B1365F" style=" border-width:0 " width="240" height="350" frameborder="0" scrolling="no"></iframe>';

        /*

        $output = '<embed style="width:'.$width.'px; height:'.$height.'px;" '
                .'id="CalendarPlayback" type="application/x-shockwave-flash" '
                .'src="http://calendar.google.com/googleplayer.swf?docId='
                .$input.'"> </embed>';
        */
        return $output;
}
?>
article history edit