1<?php 2/** 3 * DokuWiki Plugin rawless (Action Component) 4 * 5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6 * @author Gerry Weißbach / i-net /// software <tools@inetsoftware.de> 7 */ 8 9// must be run within Dokuwiki 10if(!defined('DOKU_INC')) die(); 11 12class action_plugin_rawless extends DokuWiki_Action_Plugin { 13 14 /** 15 * Registers a callback function for a given event 16 * 17 * @param Doku_Event_Handler $controller DokuWiki's event controller object 18 * @return void 19 */ 20 public function register(Doku_Event_Handler $controller) { 21 if ( strrpos( $_SERVER['SCRIPT_FILENAME'], 'css.php', -7 ) ) { 22 $controller->register_hook('INIT_LANG_LOAD', 'BEFORE', $this, 'handle_lang_load'); 23 } 24 } 25 26 /** 27 * [Custom event handler which performs action] 28 * 29 * @param Doku_Event $event event object by reference 30 * @param mixed $param [the parameters passed as fifth argument to register_hook() when this 31 * handler was registered] 32 * @return void 33 */ 34 public function handle_lang_load(Doku_Event &$event, $param) { 35 global $INPUT; 36 37 if ( $INPUT->has('rawless') ) { 38 spl_autoload_register(function($class){ 39 if ( $class == 'lessc' ) { 40 include 'lessc.inc.php'; 41 } 42 }, true, true); 43 } 44 } 45 46} 47 48// vim:ts=4:sw=4:et: 49