Difference between revisions of "Extension:When.php"
From Organic Design wiki
m |
m (When.php moved to Extension:When.php) |
(No difference)
|
Revision as of 05:51, 10 May 2007
<?
- Extension:When{{#Security:*|dev}}{{#Security:view|*}}Template:Php
- - See http://www.mediawiki.org/Extension:When for installation and usage details
- - Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html)
$wgExtensionFunctions[] = 'wfSetupWhen'; $wgHooks['LanguageGetMagic'][] = 'wfWhenLanguageGetMagic';
function wfSetupWhen() {
global $wgParser; $wgParser->setFunctionHook('when','wfExpandWhen'); return true; }
function wfExpandWhen(&$parser,$when) {
$time = strtotime($when); $cats = ; $formats = array('A','d','B','Y'); if (ereg(':|[ap]m',$when)) array_unshift($formats,'T'); foreach($formats as $f) $cats .= ; return $cats; }
function wfWhenLanguageGetMagic(&$magicWords,$langCode = 0) {
$magicWords['when'] = array(0,'when'); return true; }
?>