You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

43 lines
1.1 KiB

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