Last active
December 20, 2015 07:28
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Written by Matthew O. Smith <[email protected]> | |
* 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