*/ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'admin.php'); /** * All DokuWiki plugins to extend the admin function * need to inherit from this class */ class admin_plugin_ahrefmenu extends DokuWiki_Admin_Plugin { var $output = 'init'; var $plug_dir = './lib/plugins/ahrefmenu/'; /** * return some info */ function getInfo(){ return array( 'author' => 'Robert Srna', 'email' => 'srnar@volny.cz', 'date' => '2009-03-11', 'name' => 'admin plugin ahrefmenu', 'desc' => 'Generates html tree based on A HREF attributes', 'url' => 'http://www.dokuwiki.org/plugin:ahrefmenu', ); } /** * return sort order for position in admin menu */ function getMenuSort() { return 999; } /** * return a menu prompt for the admin menu * NOT REQUIRED - its better to place $lang['menu'] string in localised string file * only use this function when you need to vary the string returned */ // function getMenuText() { // return 'a menu prompt'; // } /** * handle user request */ function handle() { global $conf; if (!isset($_REQUEST['cmd'])) return; // first time - nothing to do $this->output = 'invalid'; if (!is_array($_REQUEST['cmd'])) return; // verify valid values switch (key($_REQUEST['cmd'])) { case 'init' : //$this->output = 'init'; break; case 'generate' : if ($conf['template'] != "default") { $this->output = 'invalidtemplate'; break; } //run external xml generation exec($this->getConf('pythonpath') . ' "' . $this->plug_dir . 'generate_map.py" "' . $this->getConf('rooturl'). '" "'. $this->getConf('deeppages') . '" "' . $this->getConf('ignorepages') . '" > "' . $this->plug_dir . 'local_map.xml"'); $this->output = 'init'; break; } } // function refresh_date() { global $conf; return strftime($conf['dformat'], filemtime($this->plug_dir . "local_map.xml")); } /** * output appropriate html */ function html() { ptln('

'.htmlspecialchars($this->getLang($this->output)).'

'); ptln('
'); // output hidden values to ensure dokuwiki will return back to this plugin ptln(' '); ptln(' '); ptln(' ' .$this->getLang('output_msg'). ' ' .$this->refresh_date(). '

'); ptln(' '); ptln('
'); } }