Social Bookmarking Extension

From Zedomax Wiki

Jump to: navigation, search

Social Bookmarking Extension

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

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.

<?php
# Social Bookmarking extension v.0.1 by Max Lee from http://zedomax.com/wiki

# 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");

# After installation, Bookmark buttons should appear at the bottom of every page.
$wgExtensionCredits['parserhook'][] = array(
'name' => 'Bookmark Extension - 12/02/2007',
'author' => 'Max Lee http://zedomax.net',
'url' => 'http://zedomax.com/wiki',
'version' => 'v.0.1',
'description' => 'Bookmark plugin for MediaWiki',
);

$wgHooks['BeforePageDisplay'][] = array("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;

}

?>
Personal tools