1<?php 2/** 3 * Action Plugin: Load AsciiMath javascript module as a header link 4 * 5 * Based on example action plugin by: @author Samuele Tognini <samuele@cli.di.unipi.it> 6 * @author Jens Lauritsen <info at epidata.dk> 7 * This plugin uses ASCIIMathML.js version 1.4.8 Aug 30, 2007, (c) Peter Jipsen http://www.chapman.edu/~jipsen 8 * But in the form used in the R-project. Copied from the javascript used in: 9 * http://wiki.r-project.org/rwiki/doku.php?do=show&id=wiki%3Aasciimathml 10 * Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js 11 * For changes see http://www.chapman.edu/~jipsen/mathml/asciimathchanges.txt 12 * If you use it on a webpage, please send the URL to jipsen@chapman.edu 13 * Note: This plugin ONLY SUPPORTS version 1.4.8 of ASCIIMathML.js 14 */ 15 16if(!defined('DOKU_INC')) die(); 17if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 18require_once(DOKU_PLUGIN.'action.php'); 19 20class action_plugin_asciimath extends DokuWiki_Action_Plugin { 21 22 /** 23 * return some info 24 */ 25 function getInfo(){ 26 return array( 27 'author' => 'J Lauritsen', 28 'email' => 'Info at EpiData.dk', 29 'date' => '2009-02-09', 30 'name' => 'Asciimathml (action plugin component)', 31 'desc' => 'Add Math shwoing to dokuwiki pages based on AsciiMathML component', 32 'url' => 'http://www.epidata.org/dokuwiki', 33 ); 34 } 35 36 /** 37 * Register its handlers with the DokuWiki's event controller 38 */ 39 function register(&$controller) { 40 $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, '_hookjs'); 41 } 42 43 /** 44 * Hook js script into page headers. 45 * 46 * Copied from example by: @author Samuele Tognini <samuele@cli.di.unipi.it> 47 * J Lauritsen <info at Epidata.dk> 48 */ 49 50 function _hookjs(&$event, $param) { 51 $event->data["script"][] = array ("type" => "text/javascript", 52 "charset" => "utf-8", 53 "_data" => "", 54 "src" => DOKU_BASE."lib/plugins/asciimath/asciimathml148r.js" 55 ); 56 } 57} 58