Extension:Social Bookmarking

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
Social Bookmarking

Release status: stable

Description This extension allows you to add social bookmarking for digg, delicious, stumbleupon,etc...etc... The extension uses addthis.com and socialmarker.com bookmarking system.
Author(s) Jung Lee aka Max Lee (zedomaxTalk)
Last Version 0.1
MediaWiki 1.11.0
License No license specified
Download see below

Contents

[edit] What can this extension do?

This extension allows you to add social bookmarking for Digg, delicious, StumbleIpon, etc...etc... The extension uses addthis.com and socialmarker.com bookmarking system.

[edit] Usage

Make it easy for your visitors to submit your wiki pages to Digg, StumbleUpon, Reddit, etc...etc...

[edit] Download instructions

Copy and paste following code and save as bookmark.php.

[edit] Installation

To install it put this file in the extensions directory. To activate the extension, include it from your LocalSettings.php with:

require_once("extensions/bookmark.php");

Once activated, you should see bookmarks appear at the bottom of your pages.

[edit] Code

<?php
/**
 * Social Bookmarking extension
 * 
 * @version 0.1
 * @author Max Lee
 * @link http://www.mediawiki.org/wiki/Extension:Social_Bookmarking
 */
 
//Extension credits that show up on Special:Version
$wgExtensionCredits['parserhook'][] = array(
	'name' => 'Social Bookmarking',
	'author' => 'Max Lee',
	'url' => 'http://www.mediawiki.org/wiki/Extension:Social_Bookmarking',
	'version' => '0.1',
	'description' => 'Bookmark plugin for MediaWiki',
);
 
$wgHooks['BeforePageDisplay'][] = 'wfBookmark';
 
function wfBookmark(&$out) {
	global $wgArticle, $wgTitle;
	if ($wgArticle == null) return $out;
	//if ($wgArticle->getTitle()->mNamespace != 0 || $wgTitle->getArticleId()<=1) return  $out;
	if ($wgArticle->getTitle()->mNamespace != 0) return  $out;
 
	$out->mBodytext .='<script type="text/javascript">';
	$out->mBodytext .='addthis_url    = location.href;';
	$out->mBodytext .='addthis_title  = document.title;';
	$out->mBodytext .='addthis_pub    = \'zedomax\';';
	$out->mBodytext .='</script>';
	$out->mBodytext .='<script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12"></script>';
 
	$out->mBodytext.='<a href="javascript:window.location = \'http://www.socialmarker.com/?link=\'+encodeURIComponent (location.href)+\'&title=\'+encodeURIComponent( document.title);"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a>';
 
	return $out;
}

[edit] Website using this plugin

Personal tools