<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Delicious bookmarks</title>
<style type="text/css">
a {
overflow:auto;
font-family:Tahoma, "sans serif";
text-decoration:none;
color:#0E1B36;
background-color:#9BA7B8;
padding:10px;
margin:10px;
text-shadow:#FEFEFE 1px 1px 1px;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
border:2px solid #A2A2A2;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF', endColorstr='#94A0BA'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#FFF), to(#94A0BA)); /* for webkit browsers */
background: -moz-linear-gradient(top, #FFF, #94A0BA); /* for firefox 3.6+ */
}
ul li {
height: 6em;
list-style:none;
margin:10px;
float:left;
margin:10px;
}
ul.links li {
height:auto;
line-height:4em;
float: none;
}
ul.links li a {
font-size: 125%;
}
ul.links li a:hover, ul li a:hover {
color: #210672;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#BDBF30', endColorstr='#FDFF73'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#BDBF30), to(#FDFF73)); /* for webkit browsers */
background: -moz-linear-gradient(top, #BDBF30, #FDFF73); /* for firefox 3.6+ */
text-shadow:#FFF 1px 1px 1px;
}
ul.links li a.tag {
font-size:75%;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#94A0BA', endColorstr='#FFF'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#94A0BA), to(#FFF)); /* for webkit browsers */
background: -moz-linear-gradient(top, #94A0BA, #FFF); /* for firefox 3.6+ */
}
ul.links li a.tag:hover {
color: #210672;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FDFF73', endColorstr='#BDBF30'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#FDFF73), to(#BDBF30)); /* for webkit browsers */
background: -moz-linear-gradient(top, #FDFF73, #BDBF30); /* for firefox 3.6+ */
text-shadow:#FFF 1px 1px 1px;
}
br {
clear:both;
}
</style>
</head>
<body>
<h2>My 10 most recent Delicious links:</h2>
<br/>
<?php
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://feeds.delicious.com/v2/json/pajtai?count=10");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// grab URL and pass it to the browser
$json = curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
// Decode JSON into associative array
$obj = json_decode($json, true);
echo '<ul class="links">';
foreach ($obj as $key)
{
echo '<li><a href="' . $key["u"] . '">' . $key["d"] . '</a> Tags:';
foreach ($key["t"] as $tag)
echo ' <a class="tag" href="http://delicious.com/pajtai/' . $tag . '">' . $tag . "</a>";
echo '</li> ';
}
?>
</ul>
<br/><br/><br/><br/>
<h2>My most commonly used Delicious tags:</h2>
<br/>
<?php
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://feeds.delicious.com/v2/json/tags/pajtai");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// grab URL and pass it to the browser
$json = curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
// Decode JSON into associative array
$obj = json_decode($json, true);
$max = max(array_values(($obj)));
$min = 9;
$maxFont = 5;
echo "<ul>";
foreach ($obj as $key => $value)
{
if ($value >= $min)
{
$font = number_format($maxFont * ($value / $max), 2);
echo '<li><a href="http://delicious.com/pajtai/' . $key . '" style="font-size:' . $font . 'em;" title="Used ' . $value . ' times">' . $key . '</a></li> ';
}
}
?>
</ul>
<br/><br/><br/><br/>
<h2>The Code (fresh off the presses, displaying what was used above):</h2>
<p>
<?php
// Show code ##################################################################
highlight_file(__FILE__);
?>
</p>
</body>
</html>