Extension:Social Sidebar
(Redirected from Extension:SocialSideBar)
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 . |
This extension is currently not actively maintained! Although it may still work, any bug reports or feature requests will more than likely be ignored. |
Social Sidebar Release status: unmaintained |
|
---|---|
Implementation | Skin |
Description | Adds Links to Twitter and Facebook in the sidebar |
Author(s) | Joachim De Schrijver (joa_dstalk) |
Latest version | 0.2 (2011-09-12) |
MediaWiki | 1.15+ |
Database changes | No |
License | LGPL |
Download | see here |
Example | MountWiki.com |
$wgFBLink, $wgTwitterLink |
|
The Social Sidebar extension adds links to a Twitter and Facebook account in the sidebar.
Installation
edit- Copy the code into a file and place the file(s) in a directory called
SocialSidebar
in yourextensions/
folder. - Add the following code at the bottom of your LocalSettings.php file:
require_once "$IP/extensions/SocialSidebar/SocialSidebar.php"; // Specifiy the Twitter and Facebook pages: $wgFacebook = "The complete link to your Facebook page"; // e.g. $wgFacebook = "https://www.facebook.com/pages/Mount-Wiki/94013348117"; $wgTwitter = "The name of your Twitter account"; // e.g. $wgTwitter = "MountWiki";
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
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
Update History
edit12 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
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 {
static function FacebookTwitter( $skin, &$bar ) {
global $wgFacebook,$wgTwitter;
if ($wgFacebook != "")
$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>';
if ($wgTwitter != "")
$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;
}
}