Delicious Extension


Jump to: navigation, search

I made a delicious extension for my MediaWiki site. The extension lets you insert all of the stories with a given tag into the wiki. Note, I made the extension for my purposes; not general use. This means the extension has 2 downsides: right now it is hard coded to my username and the you have to edit a CSS file and add an image somewhere. These things can be easily modified by someone in the future. (If someone does modify the code, I would be glad to host/link to your modifications). Also, when you manually add the css to MediaWiki:Common.css you do not impact load times as much as if the CSS would be a separate file that the script calls.

The extension uses thumbnails from I am using the free server, so it only shows the homepage of the site. It's not very useful, but I think it adds some color to the list.

This extension is released under the Creative Commons BY license.



  1. Save the Extension code as /extensions/Delicious.php
  2. Save the Delicious logo to /extensions/delicious.20.gif
  3. Copy the CSS code to MediaWiki:Common.css
  4. Link to the Delicious Code in LocalSettings.php: include("/extensions/Delicious.php");


  • User is hardcoded in the script. Someone should make it multi user.


Extension Code

# Delicious MediaWiki extension v.1
#   Michael Plasmeier ( 2010.07

$wgExtensionFunctions[] = 'wfDelicious';
$wgExtensionCredits['parserhook'][] = array(
        'name' => 'Delicious Reader',
        'description' => 'Displays Delicious sets.',
        'author' => 'Michael Plasmeier (ThePlaz)',
        'url' => ''
function wfDelicious() {
        global $wgParser;
        $wgParser->setHook('delicious', 'renderDeliciousTag');
function renderDeliciousTag($tag){
	$feed_xml = getURL(''.$tag);
	$feed = simplexml_load_string($feed_xml);
	$output = '';
	$output .= '<div id="delicious">';
	$output .= '<h3><a href=""><img src="" /><strong style="color:#3274D1">Delicious</strong></a> / <a href="">theplaz</a> / <a href="'.$tag.'/">'.$tag.'</a></h3>';
	foreach ($feed->channel->item as $item) {
		/*["title"]=>  string(62) "Design // Amtrak Subway Map - Cameron Booth | Graphic Designer" ["pubDate"]=>  string(31) "Wed, 21 Jul 2010 20:36:56 +0000" ["guid"]=>  string(65) "" ["link"]=>  string(36) "" ["comments"]=>  string(57) "" ["source"]=>  string(19) "theplaz's bookmarks" ["description"]=>  string(18) "A really nice job!" ["category"]=>  array(2) { [0]=>  string(6) "design" [1]=>  string(7) "transit" } }  */
		$output .= '<div class="deliciousitem">
			<span class="date">'.date("n/j", strtotime($item->pubDate)).'</span>
			<img src="'.$item->link.'" />
			<div class="info">
			<a href="'.$item->link.'" class="title">'.$item->title.'</a>
			<div class="description">'.$item->description.'</div>
			<a href="'.$item->link.'" class="url">'.$item->link.'</a>
			<div class="othertags">';
			foreach ($item->category as $category) {
				$output .= '<a href="'.$tag.'/">'.$category.'</a> | ';
		$output .= '</div></div></div>';
	$output .= '</div>';
	return $output;
function getURL($url) {
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL,$url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
	$http_result = curl_exec($ch);
	$error = curl_error($ch);
	$http_code = curl_getinfo($ch ,CURLINFO_HTTP_CODE);
	//should really throw an exception here
	if ($error) {
	   print "<br /><br />CURL Error: $error";
	   return FALSE;
	return $http_result;


#delicious .date{font-size:smaller;color:gray;position:relative;float:left;}
#delicious img{padding-right:5px;padding-left:5px;float:left;}
#delicious .deliciousitem{padding-top:10px;clear:both;}
#delicious .info{padding-left:150px;}
#delicious .title{font-weight:700;}
#delicious .description{background:url("") no-repeat scroll 0 5px transparent;padding-left:18px;}


Delicious.20.gif Save to /extensions/delicious.20.gif