1<?php 2/** 3 * RawDataSql Action Plugin 4 * 5 * Provides table sort to rawdatasql plugin 6 * 7 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 8 */ 9 10// must be run within Dokuwiki 11if(!defined('DOKU_INC')) die(); 12if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 13require_once DOKU_PLUGIN.'action.php'; 14 15class action_plugin_sqlraw extends DokuWiki_Action_Plugin { 16 17 /** 18 * Register its handlers with the DokuWiki's event controller 19 */ 20 function register(&$controller) { 21 $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'sqlraw_hookjs'); 22 } 23 24 /** 25 * Hook js script into page headers. 26 */ 27 function sqlraw_hookjs(&$event, $param) { 28 global $INFO; 29 global $ID; 30 $key = 'keywords'; 31 $metadata = p_get_metadata($ID, $key, false); 32 33 // keyword sqlSort used to include sort javascript files 34 if (strpos($metadata, 'sqlRawSort') !== false) { 35 $event->data['script'][] = array( 36 'type' => 'text/javascript', 37 'charset' => 'utf-8', 38 '_data' => '', 39 'src' => DOKU_BASE."lib/plugins/sqlraw/sorttable.min.js"); 40 } 41 } 42}