Extension:Social Sidebar
From MediaWiki.org
|
|
This extension stores its code inside a wiki page. Please be aware that MediaWiki developers do not review or keep track of extensions that put their code on the wiki.
|
|
Social Sidebar Release status: beta |
|||
|---|---|---|---|
![]() |
|||
| Implementation | Skin | ||
| Description | Adds Links to Twitter and Facebook in the sidebar | ||
| Author(s) | Joachim De Schrijver (joa_dsTalk) | ||
| Last version | 0.2 (2011-09-12) | ||
| MediaWiki | 1.15 or newer | ||
| Database changes | no | ||
| License | LGPL | ||
| Download | see here | ||
| Example | MountWiki.com | ||
|
|||
|
|||
|
Check usage (experimental) |
|||
The Social Sidebar extension adds links to a Twitter and Facebook account in the sidebar.
Contents |
[edit] Installation
- Download the extension (copy/paste the file from below)
- Create a directory
SocialSidebarin your$IP/extensionsdirectory. - Add the files to that
$IP/extensions/SocialSidebardirectory. - Add to the end of LocalSettings.php (MW 1.17+):
require_once("$IP/extensions/SocialSidebar/SocialSidebar.php");
- Specifiy the Twitter and Facebook pages that should be used by adding
just after that line.$wgFacebook = The complete link to your Facebook page // e.g. "https://www.facebook.com/pages/Mount-Wiki/94013348117";
$wgTwitter = The name of your Twitter account // e.g. "MountWiki" - Installation can now be verified through Special:Version on your wiki
Note:
- The description (label) of the portlet should be set in [[MediaWiki:Socialsidebar]].
- When used in combination with another plugin that adds boxes to the sidebar, the order of calling the extension in the LocalSettings.php will determine the order of the extension boxes in the sidebar.
- Because of inconsistencies in the skin implementation, this extension will work with the following skins: cologneblue, standard, nostalgia
[edit] Update History
12 September 2011: v 0.2
- Using Twitter's Follow button instead of own image
- Using Facebook's Like button instead of own image
24 July 2011: v 0.1
- First public version
[edit] Code
[edit] SocialSidebar.php
<?php
/**
* MediaWiki extension to add a social sidebar in a portlet in the sidebar.
* Installation instructions can be found on
* https://www.mediawiki.org/wiki/Extension:Social_Sidebar
*
* This extension will not add the Social Sidebar portlet to *any* skin
* that is used with MediaWiki. Because of inconsistencies in the skin
* implementation, it will not be add to the following skins:
* cologneblue, standard, nostalgia
*
* @addtogroup Extensions
* @author Joachim De Schrijver
* @license LGPL
*
* Social Sidebar
*/
/**
* Exit if called outside of MediaWiki
*/
if( !defined( 'MEDIAWIKI' ) ) {
echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
die( 1 );
}
/**
* SETTINGS
* --------
* The description of the portlet can be changed in [[MediaWiki:Socialsidebar]].
*.
* Variables should be set in the LocalSettings.php
*/
$wgTwitter = "";
$wgFacebook = "";
$wgExtensionCredits['other'][] = array(
'name' => 'Social Sidebar',
'version' => '0.2',
'author' => '[https://www.mediawiki.org/wiki/User:Joa_ds Joachim De Schrijver]',
'description' => 'Adds [http://www.twitter.com Twitter] and [http://www.facebook.com Facebook] links to the sidebar',
'url' => 'https://www.mediawiki.org/wiki/Extension:Social_Sidebar',
);
// Hook to modify the sidebar
$wgHooks['SkinBuildSidebar'][] = 'SocialSidebar::FacebookTwitter';
// Class & functions
class SocialSidebar {
function FacebookTwitter( $skin, &$bar ) {
global $wgFacebook,$wgTwitter;
$bar['socialsidebar'] = '<iframe src="http://www.facebook.com/plugins/like.php?app_id=150743178336313&href='.rawurlencode($wgFacebook).'&send=false&layout=button_count&width=135&show_faces=false&action=like&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:135px; height:21px;" allowTransparency="true"></iframe>';
$bar['socialsidebar'] .= '<a href="http://twitter.com/'.$wgTwitter.'" class="twitter-follow-button" data-show-count="false">Follow @'.$wgTwitter.'</a><script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>';
return true;
}
}
/**
* MediaWiki extension to add a social sidebar in a portlet in the sidebar.
* Installation instructions can be found on
* https://www.mediawiki.org/wiki/Extension:Social_Sidebar
*
* This extension will not add the Social Sidebar portlet to *any* skin
* that is used with MediaWiki. Because of inconsistencies in the skin
* implementation, it will not be add to the following skins:
* cologneblue, standard, nostalgia
*
* @addtogroup Extensions
* @author Joachim De Schrijver
* @license LGPL
*
* Social Sidebar
*/
/**
* Exit if called outside of MediaWiki
*/
if( !defined( 'MEDIAWIKI' ) ) {
echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
die( 1 );
}
/**
* SETTINGS
* --------
* The description of the portlet can be changed in [[MediaWiki:Socialsidebar]].
*.
* Variables should be set in the LocalSettings.php
*/
$wgTwitter = "";
$wgFacebook = "";
$wgExtensionCredits['other'][] = array(
'name' => 'Social Sidebar',
'version' => '0.2',
'author' => '[https://www.mediawiki.org/wiki/User:Joa_ds Joachim De Schrijver]',
'description' => 'Adds [http://www.twitter.com Twitter] and [http://www.facebook.com Facebook] links to the sidebar',
'url' => 'https://www.mediawiki.org/wiki/Extension:Social_Sidebar',
);
// Hook to modify the sidebar
$wgHooks['SkinBuildSidebar'][] = 'SocialSidebar::FacebookTwitter';
// Class & functions
class SocialSidebar {
function FacebookTwitter( $skin, &$bar ) {
global $wgFacebook,$wgTwitter;
$bar['socialsidebar'] = '<iframe src="http://www.facebook.com/plugins/like.php?app_id=150743178336313&href='.rawurlencode($wgFacebook).'&send=false&layout=button_count&width=135&show_faces=false&action=like&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:135px; height:21px;" allowTransparency="true"></iframe>';
$bar['socialsidebar'] .= '<a href="http://twitter.com/'.$wgTwitter.'" class="twitter-follow-button" data-show-count="false">Follow @'.$wgTwitter.'</a><script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>';
return true;
}
}
