Del.icio.us Bookmark Action
This is the development page for the del.icio.us action.
Documentation
Short description
Display a del.icio.us bookmark link for the current page.
Parameters
This action currently does not accept any parameter.
Long description
This simple action displays a link to bookmark the current page at
del.icio.us∞. It can be used as a stand-alone plugin in the page body or as a
menulet in the page header/footer. It retrieves the title from the page body (unicode supported). Obviously, you must be registered at del.icio.us in order to be able to bookmark a page.
Usage:
{{delicious}}
Example:
Post to del.icio.us
The code
Save the following as
actions/delicious.php and modify the ICON_PATH constant to match the path to the icon on your server. The del.icio.us icon used on this server can be downloaded
here∞.
<?php
/**
* Display a link to bookmark the current page at del.icio.us
*
* @package Actions
* @name Del.icio.us
*
* @author {@link http://wikka.jsnx.com/DarTar Dario Taraborelli}
* @copyright Copyright © 2005, Dario Taraborelli
* @version 0.1
* @since Wikka 1.1.X.X
*
* @access public
* @uses PageTitle()
* @uses Href()
* @output bookmark link with urlencoded page URL and title
*
* @todo move style to Wikka stylesheet
* @todo add support for "tag" URL parameter
*
*/
/* Constants section */
define('ICON_PATH',
'images/icons/logos/del.icio.us_small.png');
define('STYLE',
'border:1px dotted #999; height:10px; color:#666; text-decoration:none; font-size:.7em');
define('DELICIOUS_BASE_URL',
'http://del.icio.us/post?url=');
/* i18n */
define('LINK_TEXT',
'Post to del.icio.us');
define('LINK_TITLE',
'Bookmark this page at del.icio.us');
//build bookmark link
$url = $this->Href();
$title = $this->PageTitle();
$delicious = DELICIOUS_BASE_URL.urlencode($url).'&title='.urlencode($title);
$icon = '<img src="'.ICON_PATH.'" />';
$output = '<a style="'.STYLE.'" href="'.$delicious.'" title="'.LINK_TITLE.'">'.$icon.' '.LINK_TEXT.'</a>';
}
?>
CategoryDevelopmentActions