1<?php 2 3if(!defined('DOKU_INC')) die(); 4 5class action_plugin_publish_recent extends DokuWiki_Action_Plugin { 6 7 private $hlp; 8 9 function __construct() { 10 $this->hlp = plugin_load('helper','publish'); 11 } 12 13 function register(&$controller) { 14 $controller->register_hook('HTML_RECENTFORM_OUTPUT', 'BEFORE', $this, handle_recent, array()); 15 } 16 17 18 function handle_recent(&$event, $param) { 19 20 $member = null; 21 foreach($event->data->_content as $key => $ref) { 22 if ($ref['_elem'] == 'opentag' && $ref['_tag'] == 'div' && $ref['class'] == 'li') { 23 $member = $key; 24 } 25 26 if ($member && $ref['_elem'] == 'opentag' && 27 $ref['_tag'] == 'a' && $ref['class'] == 'diff_link'){ 28 $name = $ref['href']; 29 $name = explode('?', $name); 30 $name = explode('&', $name[1]); 31 $usename = null; 32 33 foreach($name as $n) { 34 $fields = explode('=', $n); 35 if($fields[0] == 'id') { 36 $usename = $fields[1]; 37 break; 38 } 39 } 40 41 if ($usename) { 42 if ($this->hlp->in_namespace($this->getConf('apr_namespaces'), $usename)) { 43 $meta = p_get_metadata($usename); 44 45 if ($meta['approval'][$meta['last_change']['date']]) { 46 $event->data->_content[$member]['class'] = 'li approved_revision'; 47 } else { 48 $event->data->_content[$member]['class'] = 'li unapproved_revision'; 49 } 50 } 51 } 52 $member = null; 53 } 54 } 55 return true; 56 } 57} 58