Extension:Bookmarking

From MediaWiki.org

Jump to: navigation, search

           

Manual on MediaWiki Extensions
List of MediaWiki Extensions
Crystal Clear action run.png
Bookmarking

Release status: beta

Implementation  Tag
Description Create a social bookmarking strip (currently supports del.icio.us)
Author(s)  wikipug
Last Version  0.1
MediaWiki  tested on 1.9.1
License No license specified
Download Copy from this page

check usage (experimental)

Contents

[edit] What can this extension do?

Adds social bookmarking links strip in to a page. Currently supports del.icio.us with plans to add digg. Allows users to "bookmark this page".

[edit] Usage

  • enter the code <bookmarking></bookmarking> where you want the bookmark strip to appear

[edit] Installation

  • create an account with del.icio.us
  • copy the code below in to a file named extensions/Bookmarking.php
  • update LocalSettings.php as shown below
  • create an icon with the name \common\images\delicious.gif
  • modify the text <your site> with the url of your site
  • modify the the text in the link that is created as you see fit. Take care not to change the \" characters.

[edit] Changes to LocalSettings.php

Add the following to your wiki's LocalSettings.php:

require_once 'extensions/Bookmarking.php';

[edit] Code

<?php
# delicious bookmarking

//Extension credits that show up on Special:Version
$wgExtensionCredits['parserhook'][] = array(
        'name' => 'Bookmarking',
        'version' => 0.1,
        'author' => 'wikipug',
        'url' => 'http://www.mediawiki.org/wiki/Extension:Bookmarking',
        'description' => 'Create a social bookmarking strip (currently supports del.icio.us)',
);
 
 
#install extension hook
$wgExtensionFunctions[] = 'wfBookmarkingExtension'; 
 
function wfBookmarkingExtension() {
    global $wgParser;
    $wgParser->setHook( "bookmarking", "renderBookmarking" );
}
 
function renderBookmarking( $input, $argv, $parser ) {
    # get the page title
    global $wgTitle; 
    $title=$wgTitle->mPrefixedText; 
 
    # get the pages url
    $thisurl = "http://<your site>".$_SERVER['REQUEST_URI'];
 
    $output  = "<a href=\"http://del.icio.us/post\" onclick=\"window.open('http://del.icio.us/post?tags=".$title."&v=4&noui&jump=close&url=".$thisurl."&title=".$title."&notes=share the latest information about ".$title.".', 'delicious','toolbar=no,width=700,height=400'); return false;\" title=\"Add to your del.icio.us account\" class=\"storyTool\"><img src=\"/common/images/delicious.gif\" width=\"14\" height=\"14\" border=\"0\" alt=\"Add to your del.icio.us\" />del.icio.us</a>";
 
    return $output;
}