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

Download this file

79 lines (68 with data), 3.7 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?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';
$wgHooks['SkinBuildSidebar'][] = 'SocialSidebar';
$wgHooks['BeforePageDisplay'][] = 'SocialSidebarScripts';
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;
}
function SocialSidebar ($skin, &$bar ) {
$out .= '<ul><li id="twitter"><span class="social">\n';
$out .= '<a href="https://twitter.com/share" class="twitter-share-button" data-via="WeCoWi" data-lang="de">Twittern</a>';
$out .= '</span></li><li id="google"><span class="social"><g:plusone size="small"></g:plusone></span></li>';
$out .= '<li id="facebook"><span class="social"><fb:like send="false" layout="button_count" width="60" show_faces="true"></fb:like></span></li></ul>';
$bar['Social Networks'] = $out;
return true;
}
function onBeforePageDisplay( OutputPage &$out, Skin &$skin ) {
$out->addScript( '<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>' );
$out->addScript('<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, "script", "facebook-jssdk"));</script>');
$out->addScript( '<script type="text/javascript" src="https://apis.google.com/js/plusone.js">{lang:de} </script>');
}

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

Sign up for the SourceForge newsletter:





No, thanks