1<?php
2/**
3 * DokuWiki Plugin Matrix Notifier ( Action Component )
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * Original author: zTeeed (aurelien@duboc.xyz)
7 */
8
9if ( !defined ( 'DOKU_INC' ) ) die ( );
10
11//require_once ( DOKU_INC.'inc/changelog.php' );
12
13if ( !defined ( 'DOKU_LF' ) ) define ( 'DOKU_LF', "\n" );
14if ( !defined ( 'DOKU_TAB' ) ) define ( 'DOKU_TAB', "\t" );
15if ( !defined ( 'DOKU_PLUGIN' ) ) define ( 'DOKU_PLUGIN', DOKU_INC . 'lib/plugins/' );
16
17class action_plugin_matrixnotifierwas extends DokuWiki_Action_Plugin {
18
19	function register ( Doku_Event_Handler $controller ) {
20		$controller -> register_hook ( 'COMMON_WIKIPAGE_SAVE', 'AFTER', $this, '_handle' );
21	}
22
23	function _handle ( Doku_Event $event, $param ) {
24		/** @var helper_plugin_approve $helper */
25		$helper = plugin_load('helper', 'matrixnotifierwas');
26
27		// filter writes to attic
28		if ( $helper -> attic_write ( $event -> data['file'] ) ) return;
29
30		// filter namespace
31		if ( !$helper -> valid_namespace ( ) ) return;
32
33		// filer event
34		if ( !$helper -> set_event ( $event ) ) return;
35
36		// set payload text
37		$helper -> set_payload_text ( $event );
38
39		// submit payload
40		$helper -> submit_payload ( );
41	}
42
43}
44