Extension:Toggl
From MediaWiki.org
| This extension stores its source code on a wiki page. Please be aware that this code may be unreviewed or maliciously altered. They may contain security holes, outdated interfaces that are no longer compatible etc. Note: No localisation updates are provided for this extension by translatewiki.net. |
|
Release status: beta |
|||
|---|---|---|---|
| Implementation | User interface | ||
| Description | Allows user to embed a Toggl timer into a wiki page. | ||
| Author(s) | Clif Johnston (Cliftalk) | ||
| Last version | 0.1 (12/01/2009) | ||
| MediaWiki | Tested on 1.11.0 | ||
| License | GPL | ||
| Download | No link | ||
|
|||
| Check usage and version matrix | |||
Contents |
What can this extension do? [edit]
Allows user to embed a Toggl timer into a wiki page.
Usage [edit]
There are two styles of Toggl timers, "classic" and "nano". You can choose which timer to embed using the style argument. "Classic" is the default.
<toggl /> or <toggl style="nano" />
Download instructions [edit]
Please cut and paste the code found below and place it in $IP/extensions/toggl.php. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.
Installation [edit]
To install this extension, add the following to LocalSettings.php:
require_once("$IP/extensions/toggl.php");
Code [edit]
<?php # Toggl Timer Embed # # Tag : # <toggl style="" /> # Args : style: 'classic' or 'nano' (classic is default) $wgExtensionFunctions[] = 'wfToggl'; $wgExtensionCredits['parserhook'][] = array( 'name' => 'Toggl', 'description' => 'Display Toggl Timer', 'author' => 'Clif Johnston', 'url' => 'http://www.musicin2d.com/wiki/Code/MediaWiki/Toggl' ); function wfToggl() { global $wgParser; $wgParser->setHook('toggl', 'renderToggl'); } function renderToggl($text, $args = array(), $parser) { $parser->disableCache(); if (array_key_exists('style', $args) && strtolower($args['style']) == 'nano') { $togglStyle = "nano"; } else { $togglStyle = "classic"; } if ($togglStyle == "nano") { $output = '<iframe src="http://www.toggl.com/nano" style="width:175px;height:320px;border:none;"></iframe>'; } else { $output = '<iframe src="http://www.toggl.com/timer" style="width:275px;height:500px;border:none;"></iframe>'; } return $output; }
