11aeb2b4dSghi<?php 21aeb2b4dSghi 31aeb2b4dSghiif(!defined('DOKU_INC')) die(); 41aeb2b4dSghi 51aeb2b4dSghiclass action_plugin_approve_revisions extends DokuWiki_Action_Plugin { 61aeb2b4dSghi 750481663SSzymon Olewniczak private $hlp; 850481663SSzymon Olewniczak function __construct(){ 950481663SSzymon Olewniczak $this->hlp = plugin_load('helper', 'approve'); 1050481663SSzymon Olewniczak } 1150481663SSzymon Olewniczak 1250481663SSzymon 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 17d0c5854eSSzymon Olewniczak function handle_revisions(Doku_Event $event, $param) { 181aeb2b4dSghi global $ID; 191aeb2b4dSghi 2050481663SSzymon Olewniczak if ($this->hlp->in_namespace($this->getConf('no_apr_namespaces'), $ID)) return; 2150481663SSzymon Olewniczak 221aeb2b4dSghi $member = NULL; 231aeb2b4dSghi foreach ($event->data->_content as $key => $ref) { 241aeb2b4dSghi 25*55f447f4SSzymon Olewniczak if (is_array($ref) && isset($ref['_elem']) && $ref['_elem'] == 'opentag' && $ref['_tag'] == 'div' && $ref['class'] == 'li') { 26*55f447f4SSzymon Olewniczak $member = $key; 27*55f447f4SSzymon Olewniczak } elseif (is_string($ref) && strstr($ref, 'Approved')) { 28*55f447f4SSzymon Olewniczak $event->data->_content[$member]['class'] .= ' plugin__approve_green'; 29*55f447f4SSzymon Olewniczak } 30*55f447f4SSzymon Olewniczak 311aeb2b4dSghi } 321aeb2b4dSghi 331aeb2b4dSghi return true; 341aeb2b4dSghi } 351aeb2b4dSghi 361aeb2b4dSghi} 37