[r481]: trunk / extensions / WeCoWi / WeCoWi.php  Maximize  Restore  History

Download this file

57 lines (47 with data), 2.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
if( !defined( 'MEDIAWIKI' ) ) die( "Not an entry point." );
$wgExtensionCredits['other'][] = array (
'path'=> __FILE__ ,
'name'=>'Web Community Wiki Mod',
'url'=>'https://sourceforge.net/apps/trac/wecowi/wiki/WeCoWi-Mod',
'description'=>'Spezielle Modifikationen der MediaWiki-Software und ihrer Erweiterungen zur besseren Nutzbarkeit. Integriert sind [http://www.mediawiki.org/wiki/Extension:NoTitle Extension:NoTitle] und [http://www.mediawiki.org/wiki/Extension:MagicNoCache Extension:MagicNoCache].',
'author'=>'[http://www.dasch-tour.de DaSch]',
'version'=>'0.5',
);
/** EXTENSION */
$wgCustomVariables = array('CURRENTUSER','CURRENTUSERREALNAME','LOGO');
$wgHooks['MagicWordMagicWords'][] = 'wfAddCustomVariable';
$wgHooks['MagicWordwgVariableIDs'][] = 'wfAddCustomVariableID';
$wgHooks['LanguageGetMagic'][] = 'wfAddCustomVariableLang';
$wgHooks['ParserGetVariableValueSwitch'][] = 'wfGetCustomVariable';
function wfAddCustomVariable(&$magicWords) {
foreach($GLOBALS['wgCustomVariables'] as $var) $magicWords[] = "MAG_$var";
return true;
}
function wfAddCustomVariableID(&$variables) {
foreach($GLOBALS['wgCustomVariables'] as $var) $variables[] = constant("MAG_$var");
return true;
}
function wfAddCustomVariableLang(&$langMagic, $langCode = 0) {
foreach($GLOBALS['wgCustomVariables'] as $var) {
$magic = "MAG_$var";
$langMagic[defined($magic) ? constant($magic) : $magic] = array(0,$var);
}
return true;
}
function wfGetCustomVariable(&$parser,&$cache,&$index,&$ret) {
switch ($index) {
case MAG_CURRENTUSER:
$parser->disableCache(); # Mark this content as uncacheable
$ret = $GLOBALS['wgUser']->mName;
break;
case MAG_LOGO:
$ret = $GLOBALS['wgLogo'];
break;
case MAG_CURRENTUSERREALNAME:
$parser->disableCache(); # Mark this content as uncacheable
$ret = $GLOBALS['wgUser']->mRealName;
break;
}
return true;
}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks