Extension:Social Bookmarking

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
Social Bookmarking

Release status:Extension status stable

ImplementationTemplate:Extension#type Parser extension
DescriptionTemplate:Extension#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)Template:Extension#username Jung Lee aka Max Lee (zedomaxtalk)
Latest versionTemplate:Extension#version 0.1 (2007-12-19)
MediaWikiTemplate:Extension#mediawiki 1.11.x, 1.16.x
LicenseTemplate:Extension#license CC BY-SA
Download see below
Hooks usedTemplate:Extension#hook
BeforePageDisplay

Translate the Social Bookmarking extension if it is available at translatewiki.net

Check usage and version matrix.

What can this extension do?[edit]

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

Usage[edit]

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

Download instructions[edit]

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

Installation[edit]

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

require_once("extensions/SocialBookmarking.php");

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

Code[edit]

original version[edit]

for SocialBookmarking.php see how other Social Bookmarking sites have added this 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;
}

alternative version[edit]

for SocialBookmarking.php Note: This alternative version centers the bookmarking button and uses just addthis.com.

<?php
/**
 * Social Bookmarking extension
 * 
 * @version 0.1var
 * @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.1var',
        'description' => 'Ermöglicht Links zu Bookmarkingdiensten',
);
 
$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 .='<center><script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12"></script>';
 
        $out->mBodytext.='<a href="javascript:window.location = +encodeURIComponent (location.href)+\'&title=\'+encodeURIComponent( document.title);"></a></center>';
 
        return $out;
}

See also[edit]

Websites using this plugin[edit]