Skip to content

Instantly share code, notes, and snippets.

@m0smith
Last active December 20, 2015 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m0smith/6093045 to your computer and use it in GitHub Desktop.
Save m0smith/6093045 to your computer and use it in GitHub Desktop.
A Lionwiki plugin that will pull data from Delicious. The usage is {delicious}user/tag{/delicious}. See https://delicious.com/developers/rssurls
<?php
/*
* Written by Matthew O. Smith <m0smith@yahoo.com>
* With {delicious}user/tag{/delicious} insert links from the user and tags
* With {delicious}user/tag?count=50{/delicious} you can spcifiy the number of items returned
*/
class Delicious
{
var $desc = array(
array("Delicious plugin", "Pull a list of links from Delicious.com")
);
function pagesList($matches)
{
global $self, $PG_DIR;
$list = array();
$parms = $matches[1];
$request = 'http://feeds.delicious.com/v2/json/' . $parms;
$response = file_get_contents($request, TRUE);
$ret = json_decode($response);
ini_set('display_errors', true);
ini_set('html_errors', true);
$list = array();
foreach($ret as $info)
$list[] = "<a href=\"" . $info->u . "\">" . $info->d . "</a>";
$rtnval = implode(" * ", $list);
return strval($rtnval);
}
function formatBegin()
{
global $CON;
$CON = preg_replace_callback("/\{delicious\}(.*)\{\/delicious\}/U", array
($this, "pagesList"), $CON);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment