GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Main page
  • Get MediaWiki
  • Get extensions
  • Tech blog
  • Contribute
  • User help
  • FAQ
  • Technical manual
  • Support desk
  • Communication
  • Developer portal
  • Code statistics
  • Community portal
  • Recent changes

This view

  • Original page
  • New address

GeezerVison is showing www.mediawiki.org — Extension:SNSButtonsInSidebar - MediaWiki

This extension stores its source code on a editable wiki page rather than in a code repository. As a result, this code may be maliciously altered.
It may contain security vulnerabilities, and will not receive localisation updates from translatewiki.net . Developers are strongly encouraged to host their code in a code repository rather than a wiki page so that the extension can be properly maintained, reviewed, and kept secure.

This extension is currently not actively maintained! Although it may still work, any bug reports or feature requests will more than likely be ignored.

MediaWiki extensions manual
SNSButtonsInSidebar
Release status: unmaintained
Implementation Tag
Description Adds SNS buttons in the sidebar
Author(s) Jmkim dot com
Latest version 1.0.0 (2012-08-18)
MediaWiki 1.18+
Database changes No
Hooks used
  • SkinBuildSidebar
Licence GNU General Public License 2.0
Download see below

The SNSButtonsInSidebar adds SNS buttons in the sidebar on every page.

Installation

  • Copy the code into the respective files and place the file(s) in a directory called SNSButtonsInSidebar in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    require_once "$IP/extensions/SNSButtonsInSidebar/SNSButtonsInSidebar.php";
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Code

SNSButtonsInSidebar.php
<?php
/**
 * MediaWiki extension to add SNS buttons in the sidebar
 * Installation instructions can be found on
 * http://www.mediawiki.org/wiki/Extension:SNSButtonsInSidebar
 *
 * @ingroup Extensions
 * @author Jmkim dot com
 * @license GNU Public License
 */

// Exit if called outside of MediaWiki
if( !defined( 'MEDIAWIKI' ) ) exit;

// SETTINGS
$wgSNSButtonsTitle = 'Recommendations';

$wgExtensionCredits['parserhook'][] = array(
	'path'        => __FILE__,
	'name'        => 'SNSButtonsInSidebar',
	'version'     => '1.0.0',
	'author'      => 'Jmkim dot com',
	'description' => 'SNSButtonsInSidebar Extension',
	'url'         => 'https://www.mediawiki.org/wiki/Extension:SNSButtonsInSidebar'
);

// Register class and localisations
$dir = dirname(__FILE__) . '/';
$wgAutoloadClasses['SNSButtonsInSidebar'] = $dir.'SNSButtonsInSidebar.class.php';
	
// Hook to modify the sidebar
$wgHooks['SkinBuildSidebar'][] = 'SNSButtonsInSidebar::renderSNSButtonsInSidebar';
SNSButtonsInSidebar.class.php
<?php
if (!defined('MEDIAWIKI')) exit;

class SNSButtonsInSidebar {
	static function renderSNSButtonsInSidebar( $skin, &$bar ) {
		global $wgFacebookCommonScriptWritten, $wgFacebookAppId;
		$btnsText = '';
		if( !isset($wgFacebookCommonScriptWritten) || !$wgFacebookCommonScriptWritten ) {
			if( !isset($wgFacebookAppId) ) $wgFacebookAppId = '';
			$wgFacebookCommonScriptWritten = true;
			$btnsText .= '<div id="fb-root">';
			$btnsText .= '</div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1&appId='.$wgFacebookAppId.'"></script>';
		}
		$btnsText .= '<script type="text/javascript">';
		$btnsText .= '(function() {';
		$btnsText .= "var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;";
		$btnsText .= "po.src = 'https://apis.google.com/js/plusone.js';";
		$btnsText .= "var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);";
		$btnsText .= '})();';
		$btnsText .= '</script>';

		global $wgServer;
		$btnsText .= '<div class="fb-like" data-href="'.$wgServer.'"';
		$btnsText .= ' data-send="false" data-layout="button_count"';
		$btnsText .= ' data-width="130" data-show-faces="false"';
		$btnsText .= ' data-action="like" data-colorscheme="light"';
		$btnsText .= '></div>';
		$btnsText .= '<div style="height:5px"></div>';
		$btnsText .= '<div class="g-plusone" data-width="130" data-href="'.$wgServer.'"></div>';
		global $wgSNSButtonsTitle;
		$bar[$wgSNSButtonsTitle] = $btnsText;
		return true;
	}
}

See also

  • Extension:FacebookComments
Retrieved from "https://www.mediawiki.org/w/index.php?title=Extension:SNSButtonsInSidebar&oldid=4305750"
Categories:
  • Extensions which host their code in-wiki
  • Unmaintained extensions
  • Tag extensions
  • SkinBuildSidebar extensions
  • GPL licensed extensions
  • All extensions
  • Extensions not using extension registration
  • Facebook extensions
Hidden categories:
  • Extensions without an image
  • Extensions without a compatibility policy
  • Extensions with manual MediaWiki version
  • Extensions not in ExtensionJson
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.