1<?php 2/** 3 * Mikio Plugin 4 * 5 * @version 1.0 6 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 7 * @author James Collins <james.collins@outlook.com.au> 8 */ 9 10if(!defined('DOKU_INC')) die(); 11 12class action_plugin_mikioplugin extends DokuWiki_Action_Plugin { 13 14 public function register(Doku_Event_Handler $controller) { 15 $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, '_load'); 16 } 17 18 public function _load(Doku_Event $event, $param) { 19 global $conf; 20 21 $baseDir = DOKU_BASE.'lib/plugins' . str_replace(dirname(dirname(__FILE__)), '', dirname(__FILE__)) . '/'; 22 $stylesheets = []; 23 $scripts = []; 24 25 if($conf['template'] !== 'mikio') { 26 if($this->getConf('loadBootstrap')) { 27 $stylesheets[] = $baseDir . 'css/bootstrap.min.css'; 28 $scripts[] = $baseDir . 'js/bootstrap.min.css'; 29 $scripts[] = $baseDir . 'js/popper.min.css'; 30 } 31 32 if($this->getConf('loadFontAwesome')) { 33 $stylesheets[] = $baseDir . 'css/fontawesome.min.css'; 34 } 35 } 36 37 foreach ($stylesheets as $style) { 38 array_unshift($event->data['link'], array( 39 'type' => 'text/css', 40 'rel' => 'stylesheet', 41 'href' => $style 42 )); 43 } 44 45 foreach ($scripts as $script) { 46 $event->data['script'][] = array( 47 'type' => 'text/javascript', 48 '_data' => '', 49 'src' => $script 50 ); 51 } 52 } 53} 54