This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
firestats [2010/05/05 13:04] ben |
— (current) | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Firestats Plugin for Dokuwiki ====== | ||
| - | It is noted in the code, but I'll repeat it here: | ||
| - | |||
| - | //This code is almost entirely copied from the Google Analytics plugin by Terence J. Grant. See [[http://tatewake.com/wiki/projects:google_analytics_for_dokuwiki|his plugin page]] for details. | ||
| - | // | ||
| - | Credit should stay entirely with him. | ||
| - | |||
| - | Concerning this rendering of the code: | ||
| - | |||
| - | See [[http://www.firestats.cc|firestats.cc]] for information on what Firestats is and how to use it. | ||
| - | |||
| - | Plugin installation consists of: | ||
| - | *Unarchiving the plugin .tgz file to your dokuwiki lib/plugins directory | ||
| - | *Visiting the site Admin => Configuration page to set the URL for your firestats installation. | ||
| - | |||
| - | An example URL looks like: http://yoursite.com/yourfirestats/js/fs.js.php?site_id=2 | ||
| - | |||
| - | ====== File/Directory structure: ====== | ||
| - | |||
| - | dokufirestats/\\ | ||
| - | dokufirestats/action.php\\ | ||
| - | dokufirestats/lang/\\ | ||
| - | dokufirestats/lang/en/\\ | ||
| - | dokufirestats/lang/en/settings.php\\ | ||
| - | dokufirestats/conf/\\ | ||
| - | dokufirestats/conf/metadata.php\\ | ||
| - | ====== Action.php ====== | ||
| - | <code> | ||
| - | <?php | ||
| - | /* | ||
| - | * | ||
| - | * | ||
| - | * This code is almost entirely copied from the Google Analytics plugin by: | ||
| - | * | ||
| - | * Terence J. Grant | ||
| - | * See: http://tatewake.com/wiki/projects:google_analytics_for_dokuwiki | ||
| - | * | ||
| - | */ | ||
| - | |||
| - | if(!defined('DOKU_INC')) die(); | ||
| - | if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); | ||
| - | require_once(DOKU_PLUGIN.'action.php'); | ||
| - | |||
| - | class action_plugin_dokufirestats extends DokuWiki_Action_Plugin { | ||
| - | |||
| - | function getInfo(){ | ||
| - | |||
| - | return array( | ||
| - | 'author' => 'Benjamin Hall (code HEAVILY borrowed from Terrence J. Grant\'s Google Analytics Plugin)', | ||
| - | 'email' => 'ben@benhall.com', | ||
| - | 'date' => '2010-05-05', | ||
| - | 'name' => 'Firestats Plugin', | ||
| - | 'desc' => 'Plugin to call firestats on pageload', | ||
| - | 'url' => 'http://benhall.com/doku/doku.php?id=firestats', | ||
| - | ); | ||
| - | } | ||
| - | |||
| - | function register(&$controller) { | ||
| - | $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, '_addHeaders'); | ||
| - | } | ||
| - | |||
| - | function _addHeaders (&$event, $param) { | ||
| - | global $INFO; | ||
| - | if(!$this->getConf('FIRESTATSURL')) return; | ||
| - | if($this->getConf('dont_count_admin') && $INFO['isadmin']) return; | ||
| - | if($this->getConf('dont_count_users') && $_SERVER['REMOTE_USER']) return; | ||
| - | $event->data["script"][] = array ( | ||
| - | "type" => "text/javascript", | ||
| - | "src" => $this->getConf('FIRESTATSURL'), | ||
| - | ); | ||
| - | |||
| - | } | ||
| - | } | ||
| - | ?> | ||
| - | </code> | ||
| - | |||
| - | ====== Metadata.php ====== | ||
| - | <code> | ||
| - | <?php | ||
| - | $meta['FIRESTATSURL'] = array('string'); | ||
| - | $meta['dont_count_admin'] = array('onoff'); | ||
| - | $meta['dont_count_users'] = array('onoff'); | ||
| - | </code> | ||
| - | ====== Settings.php ====== | ||
| - | <code> | ||
| - | <?php | ||
| - | $lang['FIRESTATSURL'] = 'Your Firestats Site URL:'; | ||
| - | $lang['dont_count_admin'] = 'Don\'t count admin/superuser'; | ||
| - | $lang['dont_count_users'] = 'Don\'t count logged in users'; | ||
| - | </code> | ||