1<?php 2 3/** 4 * DokuWiki Plugin vshare (Action Component) 5 * 6 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 7 * @author Andreas Gohr <andi@splitbrain.org> 8 */ 9class action_plugin_vshare extends \dokuwiki\Extension\ActionPlugin 10{ 11 12 /** @inheritDoc */ 13 public function register(Doku_Event_Handler $controller) 14 { 15 $controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'addSites'); 16 17 } 18 19 /** 20 * Add the site regexes 21 * 22 * @param Doku_Event $event event object by reference 23 * @param mixed $param optional parameter passed when event was registered 24 * @return void 25 */ 26 public function addSites(Doku_Event $event, $param) 27 { 28 global $JSINFO; 29 30 $sites = parse_ini_file(__DIR__ . '/sites.ini', true, INI_SCANNER_RAW); 31 $js = []; 32 33 foreach ($sites as $site => $data) { 34 if (empty($data['rex'])) continue; 35 $js[$site] = $data['rex']; 36 } 37 38 $JSINFO['plugins']['vshare'] = $js; 39 } 40 41} 42 43