1<?php 2 3use ComboStrap\LogUtility; 4use ComboStrap\MetadataUtility; 5use ComboStrap\PluginUtility; 6use ComboStrap\Page; 7use ComboStrap\SnippetManager; 8use ComboStrap\TplUtility; 9use dokuwiki\Cache\CacheRenderer; 10 11if (!defined('DOKU_INC')) die(); 12 13/** 14 * 15 * 16 * Add cache information to the head 17 * 18 */ 19class action_plugin_combo_cache extends DokuWiki_Action_Plugin 20{ 21 22 const tag = "cache"; 23 const COMBO_CACHE_PREFIX = "combo:cache:"; 24 25 26 function __construct() 27 { 28 // enable direct access to language strings 29 // ie $this->lang 30 $this->setupLocale(); 31 } 32 33 public function register(Doku_Event_Handler $controller) 34 { 35 $controller->register_hook('PARSER_CACHE_USE', 'AFTER', $this, 'cache', array()); 36 } 37 38 /** 39 * 40 * @param $event 41 */ 42 function cache($event) 43 { 44 $data = $event->data; 45 if ($data->mode == "xhtml") { 46 47 /* @var CacheRenderer $data */ 48 $page = $data->page; 49 $result = $event->result; 50 51 PluginUtility::getSnippetManager()->addHeadTagEachTime( 52 self::tag, 53 "meta", 54 array("name" => self::COMBO_CACHE_PREFIX . $page, "content" => var_export($result, true)) 55 ); 56 57 } 58 59 60 } 61 62 63} 64