1<?php 2/** 3 * ODP Plugin: Exports to ODP 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author damien clochard <damien@taadeem.net> 7 */ 8// must be run within Dokuwiki 9if(!defined('DOKU_INC')) die(); 10 11if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 12require_once(DOKU_PLUGIN.'action.php'); 13 14/** 15 * Add the template as a page dependency for the caching system 16 */ 17class action_plugin_odp extends DokuWiki_Action_Plugin { 18 19 function register(Doku_Event_Handler $controller) { 20 $controller->register_hook('PARSER_CACHE_USE','BEFORE', $this, 'handle_cache_prepare'); 21 } 22 23 function handle_cache_prepare(&$event, $param) { 24 global $conf, $ID; 25 $cache =& $event->data; 26 // only the ODP rendering mode needs caching tweaks 27 if ($cache->mode != "odp") return; 28 $odt_meta = p_get_metadata($ID, 'relation odp'); 29 $template_name = $odt_meta["template"]; 30 if (!$template_name) { 31 return; 32 } 33 $template_path = $conf['mediadir'].'/'.$this->getConf("tpl_dir")."/".$template_name; 34 if (file_exists($template_path)) { 35 $cache->depends['files'][] = $template_path; 36 } 37 } 38 39} 40 41//Setup VIM: ex: et ts=4 enc=utf-8 : 42