1<?php
2
3/**
4 * DokuWiki DAVCal PlugIn - Cache component
5 */
6
7if(!defined('DOKU_INC')) die();
8
9class action_plugin_davcal_cache extends DokuWiki_Action_Plugin {
10
11    /**
12     * @var helper_plugin_davcal
13     */
14    private $hlp = null;
15
16    function __construct() {
17        $this->hlp =& plugin_load('helper','davcal');
18    }
19
20    function register(Doku_Event_Handler $controller) {
21        $controller->register_hook('PARSER_CACHE_USE', 'BEFORE', $this, 'handle_parser_cache_use');
22    }
23
24    function handle_parser_cache_use(&$event, $param) {
25      global $ID;
26      $cache = &$event->data;
27      if(!isset($cache->page)) return;
28
29      $davcalMeta = p_get_metadata($ID, 'plugin_davcal');
30      if(!$davcalMeta)
31        return;
32
33      if(isset($davcalMeta['table']) && $davcalMeta['table'] === true)
34      {
35            $event->preventDefault();
36            $event->stopPropagation();
37            $event->result = false;
38      }
39    }
40
41}