1<?php
2/**
3 * Code3 plugin
4 *
5 * $Id: action.php 22 2007-01-04 02:08:26Z wingedfox $
6 * $HeadURL$
7 *
8 * @license    LGPL 2 (http://www.gnu.org/licenses/lgpl.html)
9 * @author     Ilya Lebedev <ilya@lebedev.net>
10 * @copyright  2007 Ilya Lebedev
11 */
12
13if(!defined('DOKU_INC')) die();
14if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
15require_once(DOKU_PLUGIN.'action.php');
16
17class action_plugin_code extends DokuWiki_Action_Plugin {
18
19  /**
20   * return some info
21   */
22  function getInfo(){
23    return array(
24                 'author' => 'Ilya Lebedev',
25                 'email'  => 'ilya@lebedev.net',
26                 'date'   => '2008-02-02',
27                 'name'   => '<Code> tag replacement',
28                 'desc'   => 'Replaces GeSHi server-side code highlighting with PSyHi clientside one',
29                 'url'    => 'https://www.dokuwiki.org/plugin:code3',
30                 );
31  }
32
33  /*
34   * plugin should use this method to register its handlers with the dokuwiki's event controller
35   */
36  function register(&$controller) {
37    $controller->register_hook('TPL_METAHEADER_OUTPUT','BEFORE', $this, '_inject_loader');
38  }
39
40  /**
41   *  Inject the virtual keyboard loaders
42   *
43   *  @author Ilya Lebedev <ilya@lebedev.net>
44   *  @param $event object target event
45   *  @param $param mixed event parameters passed from register_hook
46   */
47  function _inject_loader (&$event, $param) {
48      global $INFO;
49      global $ACT;
50
51      $event->data['link'][] = array( 'rel'=>'stylesheet'
52                                     ,'type'=>'text/css'
53                                     ,'title'=>'PSyHi styles'
54                                     ,'href'=>DOKU_BASE.'lib/plugins/code/styles/styles.css'
55                                     ,'_data'=>'');
56      $event->data['link'][] = array( 'rel'=>'stylesheet'
57                                     ,'type'=>'text/css'
58                                     ,'title'=>'PSyHi styles'
59                                     ,'href'=>DOKU_BASE.'lib/plugins/code/styles/schemes/idea_alloy.css'
60                                     ,'_data'=>'');
61  }
62
63}