*/
// must be run within Dokuwiki
if (!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
class helper_plugin_wikistats extends DokuWiki_Plugin
{
/**
* Get an associative array with plugin info.
*
*
* The returned array holds the following fields:
*
* - author
- Author of the plugin
* - email
- Email address to contact the author
* - date
- Last modified date of the plugin in
* YYYY-MM-DD format
* - name
- Name of the plugin
* - desc
- Short description of the plugin (Text only)
* - url
- Website with more information on the plugin
* (eg. syntax description)
*
* @param none
* @return Array Information about this plugin class.
* @public
* @static
*/
function getInfo()
{
return confToHash(dirname(__FILE__).'/plugin.info.txt');
}
function getMethods()
{
$result = array();
$result[] = array(
'name' => 'add_stats_link',
'desc' => 'Include a html link',
'params' => array(),
'return' => array()
);
return $result;
}
/**
* Create the HTML for the stats link
*
* If $return is set to FALSE, will directly echo the HTML
*
* @param bool $return
* @return string
*/
public function add_stats_link($return = false)
{
global $conf;
$label = $this->getLang('btn_display_stats');
if (!$label) {
// Translation not found
$label = 'Stats';
}
$tip = htmlspecialchars($label);
// Filter id (without urlencoding)
$id = idfilter($this->getConf('stats_page'), false);
$url = DOKU_BASE.DOKU_SCRIPT.'/'.$id;
$ret = ''.$label.'';
if (!$return) echo $ret;
return $ret;
}
}