Revision [11620]

This is an old revision of DeliciousAction made by DarTar on 2005-10-27 10:27:02.

 

Del.icio.us 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 WikkaMenulets 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:
Bookmark this page

The code
Save the following as actions/delicious.php

  1. <?php
  2. /**
  3.  * Display a link to bookmark the current page at del.icio.us
  4.  *
  5.  * @package     Actions
  6.  * @name        Del.icio.us
  7.  *
  8.  * @author      {@link http://wikka.jsnx.com/DarTar Dario Taraborelli}
  9.  * @copyright   Copyright © 2005, Dario Taraborelli
  10.  * @version     0.1
  11.  * @since       Wikka 1.1.X.X
  12.  *
  13.  * @access      public
  14.  * @uses        PageTitle()
  15.  * @uses        Href()
  16.  * @output      bookmark link with urlencoded page URL and title
  17.  *
  18.  * @todo        move style to Wikka stylesheet
  19.  * @todo        add support for "tag" URL parameter
  20.  *
  21.  */
  22.  
  23. /* Constants section */
  24. define('ICON_PATH', 'images/icons/logos/del.icio.us_small.png');
  25. define('STYLE', 'border:1px dotted #999; height:10px; color:#666; text-decoration:none; font-size:.7em');
  26. define('DELICIOUS_BASE_URL', 'http://del.icio.us/post?url=');
  27.  
  28. /* i18n */
  29. define('LINK_TEXT', 'Bookmark this page');
  30. define('LINK_TITLE', 'Bookmark this page at del.icio.us');
  31.  
  32. //build bookmark link
  33. $url = $this->Href();
  34. $title = $this->PageTitle();
  35. if (isset($url) && isset($title)){
  36.     $delicious = DELICIOUS_BASE_URL.urlencode($url).'&amp;title='.urlencode($title);
  37.     $icon = '<img src="'.ICON_PATH.'" />';
  38.     $output = '<a style="'.STYLE.'" href="'.$delicious.'" target="_blank" title="'.LINK_TITLE.'">'.$icon.' '.LINK_TEXT.'</a>';
  39.     echo $output;
  40. }
  41. ?>



CategoryDevelopmentActions
There is one comment on this page. [Display comment]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki