11aeb2b4dSghi<?php 21aeb2b4dSghi 31aeb2b4dSghiif(!defined('DOKU_INC')) die(); 41aeb2b4dSghi 51aeb2b4dSghiclass action_plugin_approve_revisions extends DokuWiki_Action_Plugin { 61aeb2b4dSghi 7*50481663SSzymon Olewniczak private $hlp; 8*50481663SSzymon Olewniczak function __construct(){ 9*50481663SSzymon Olewniczak $this->hlp = plugin_load('helper', 'approve'); 10*50481663SSzymon Olewniczak } 11*50481663SSzymon Olewniczak 12*50481663SSzymon Olewniczak function register(Doku_Event_Handler $controller) { 131aeb2b4dSghi $controller->register_hook('HTML_REVISIONSFORM_OUTPUT', 'BEFORE', $this, 'handle_revisions', array()); 147efbcc93Sghi $controller->register_hook('HTML_RECENTFORM_OUTPUT', 'BEFORE', $this, 'handle_revisions', array()); 151aeb2b4dSghi } 161aeb2b4dSghi 171aeb2b4dSghi function handle_revisions(Doku_Event &$event, $param) { 181aeb2b4dSghi global $ID; 191aeb2b4dSghi global $INFO; 201aeb2b4dSghi 21*50481663SSzymon Olewniczak if ($this->hlp->in_namespace($this->getConf('no_apr_namespaces'), $ID)) return; 22*50481663SSzymon Olewniczak 231aeb2b4dSghi $member = NULL; 241aeb2b4dSghi foreach ($event->data->_content as $key => $ref) { 251aeb2b4dSghi if(isset($ref['_elem']) && $ref['_elem'] == 'opentag' && $ref['_tag'] == 'div' && $ref['class'] == 'li') 261aeb2b4dSghi $member = $key; 271aeb2b4dSghi 281aeb2b4dSghi if (is_string($ref) && strstr($ref, 'Approved')) 291aeb2b4dSghi $event->data->_content[$member]['class'] = 'li approved_yes'; 301aeb2b4dSghi } 311aeb2b4dSghi 321aeb2b4dSghi return true; 331aeb2b4dSghi } 341aeb2b4dSghi 351aeb2b4dSghi} 36