xref: /dokuwiki/inc/Action/Plugin.php (revision a3f6fae668f2438bb3018620d664a9e7f1e6cd21)
1*a3f6fae6SAndreas Gohr<?php
2*a3f6fae6SAndreas Gohr
3*a3f6fae6SAndreas Gohrnamespace dokuwiki\Action;
4*a3f6fae6SAndreas Gohr
5*a3f6fae6SAndreas Gohr/**
6*a3f6fae6SAndreas Gohr * Class Plugin
7*a3f6fae6SAndreas Gohr *
8*a3f6fae6SAndreas Gohr * Used to run action plugins
9*a3f6fae6SAndreas Gohr *
10*a3f6fae6SAndreas Gohr * @package dokuwiki\Action
11*a3f6fae6SAndreas Gohr */
12*a3f6fae6SAndreas Gohrclass Plugin extends AbstractAction {
13*a3f6fae6SAndreas Gohr
14*a3f6fae6SAndreas Gohr    /** @inheritdoc */
15*a3f6fae6SAndreas Gohr    function minimumPermission() {
16*a3f6fae6SAndreas Gohr        return AUTH_NONE;
17*a3f6fae6SAndreas Gohr    }
18*a3f6fae6SAndreas Gohr
19*a3f6fae6SAndreas Gohr    /**
20*a3f6fae6SAndreas Gohr     * Outputs nothing but a warning unless an action plugin overwrites it
21*a3f6fae6SAndreas Gohr     *
22*a3f6fae6SAndreas Gohr     * @inheritdoc
23*a3f6fae6SAndreas Gohr     * @triggers TPL_ACT_UNKNOWN
24*a3f6fae6SAndreas Gohr     */
25*a3f6fae6SAndreas Gohr    public function tplContent() {
26*a3f6fae6SAndreas Gohr        $evt = new \Doku_Event('TPL_ACT_UNKNOWN', $this->actionname);
27*a3f6fae6SAndreas Gohr        if($evt->advise_before()) {
28*a3f6fae6SAndreas Gohr            msg('Failed to handle action: ' . hsc($this->actionname), -1);
29*a3f6fae6SAndreas Gohr        }
30*a3f6fae6SAndreas Gohr        $evt->advise_after();
31*a3f6fae6SAndreas Gohr    }
32*a3f6fae6SAndreas Gohr
33*a3f6fae6SAndreas Gohr    /**
34*a3f6fae6SAndreas Gohr     * Set the action name
35*a3f6fae6SAndreas Gohr     *
36*a3f6fae6SAndreas Gohr     * This class handles arbitrary names by passing them to action plugins
37*a3f6fae6SAndreas Gohr     * later in tplContent(). The actual name (=$ACT) is via this function
38*a3f6fae6SAndreas Gohr     * in ActionRouter::setupAction()
39*a3f6fae6SAndreas Gohr     *
40*a3f6fae6SAndreas Gohr     * @param string $actionname
41*a3f6fae6SAndreas Gohr     */
42*a3f6fae6SAndreas Gohr    public function setActionName($actionname) {
43*a3f6fae6SAndreas Gohr        $this->actionname = $actionname;
44*a3f6fae6SAndreas Gohr    }
45*a3f6fae6SAndreas Gohr}
46