<?php
/**
 * DokuWiki Plugin cronojob (Action Component)
 *
 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
 * @author  Luigi Micco <l.micco@tiscali.it>
 */

// must be run within Dokuwiki
if (!defined('DOKU_INC')) die();

if (!defined('DOKU_LF')) define('DOKU_LF', "\n");
if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t");
if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once DOKU_PLUGIN.'action.php';

class action_plugin_cronojob extends DokuWiki_Action_Plugin {

    /**
     * return some info
     */
    function getInfo() {
      return array(
              'author' => 'Luigi micco',
              'email'  => 'l.micco@tiscali.it',
              'date'   => '2010-04-22',
              'name'   => 'cronojob Plugin',
              'desc'   => 'A plugin for schedule jobs',
              'url'    => 'http://www.bitlibero.com/dokuwiki/cronojob-22.04.2010.zip',
              );
    }
    
    function register(&$controller) {
      $controller->register_hook('DOKUWIKI_DONE', 'AFTER', $this, 'handle');  
    }

    function handle(&$event, $param) {
      global $ID;

      $p = array();
      $p['src']    = DOKU_URL.'lib/plugins/cronojob/pseudocron.php?id='.rawurlencode($ID).'&'.time();
      $p['width']  = 1;
      $p['height'] = 1;
      $p['alt']    = '';
      $att = buildAttributes($p);
      echo "<img $att />";
    }

}

// vim:ts=4:sw=4:et:enc=utf-8:
