Extension:Social Bookmarking
![]() | 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 Bookmarking Release status: unmaintained |
|
---|---|
Implementation | Parser 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) | Jung Lee aka Max Lee (zedomaxtalk) |
Latest version | 0.1 (2007-12-19) |
MediaWiki | 1.11.x, 1.16.x |
License | Creative Commons Attribution Share Alike 3.0 |
Download | see below |
The Social Bookmarking 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 .='<div align="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></div>';
return $out;
}
See also[edit]
- AddThis extension - Requires MW1.17+