1<?php 2 3 4use ComboStrap\PluginUtility; 5use ComboStrap\TplConstant; 6 7/** 8 * Class action_plugin_combo_hidden 9 * Hide page 10 */ 11class action_plugin_combo_hiddenpage extends DokuWiki_Action_Plugin 12{ 13 14 15 public function register(Doku_Event_Handler $controller) 16 { 17 /** 18 * https://www.dokuwiki.org/devel:event:pageutils_id_hidepage 19 */ 20 $controller->register_hook('PAGEUTILS_ID_HIDEPAGE', 'BEFORE', $this, 'handleIsHidden', array()); 21 } 22 23 function handleIsHidden(&$event, $param) 24 { 25 global $conf; 26 27 /** 28 * Caching the strap bars and private namespace 29 */ 30 $pattern = "(" . $conf['sidebar'] . "|" . PluginUtility::COMBOSTRAP_NAMESPACE_NAME; 31 if ($conf['template'] == PluginUtility::TEMPLATE_STRAP_NAME) { 32 $constantFile = __DIR__ . '/../../../tpl/strap/class/TplConstant.php'; 33 if (file_exists($constantFile)) { 34 /** @noinspection PhpIncludeInspection */ 35 require_once($constantFile); 36 $footer = tpl_getConf(TplConstant::CONF_FOOTER); 37 $sidekick = tpl_getConf(TplConstant::CONF_SIDEKICK); 38 $header = tpl_getConf(TplConstant::CONF_HEADER); 39 $pattern .= "|" . $footer . "|" . $sidekick . "|" . $header; 40 } 41 } 42 $pattern .= ")"; 43 if (preg_match('/' . $pattern . '/ui', ':' . $event->data['id'])) { 44 $event->data['hidden'] = true; 45 } 46 47 } 48 49 50} 51