xref: /plugin/dev/skel/remote.php (revision 8673a04e3e6febe85a87104acdf3ce3205315685)
170316b84SAndreas Gohr<?php
2*8673a04eSAndreas Gohr
3*8673a04eSAndreas Gohruse dokuwiki\Extension\RemotePlugin;
4*8673a04eSAndreas Gohruse dokuwiki\Remote\AccessDeniedException;
5*8673a04eSAndreas Gohr
670316b84SAndreas Gohr/**
770316b84SAndreas Gohr * DokuWiki Plugin @@PLUGIN_NAME@@ (Action Component)
870316b84SAndreas Gohr *
970316b84SAndreas Gohr * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
1070316b84SAndreas Gohr * @author @@AUTHOR_NAME@@ <@@AUTHOR_MAIL@@>
1170316b84SAndreas Gohr */
12*8673a04eSAndreas Gohrclass @@PLUGIN_COMPONENT_NAME@@ extends RemotePlugin
1370316b84SAndreas Gohr{
1470316b84SAndreas Gohr    /**
1570316b84SAndreas Gohr     * Example function
1670316b84SAndreas Gohr     *
1770316b84SAndreas Gohr     * All public methods become automatically part of the API
1870316b84SAndreas Gohr     */
1970316b84SAndreas Gohr    public function myExample($id)
2070316b84SAndreas Gohr    {
2170316b84SAndreas Gohr        // FIXME handle security in your method!
2270316b84SAndreas Gohr        $id = cleanID($id);
2370316b84SAndreas Gohr        if (auth_quickaclcheck($id) < AUTH_READ) {
24*8673a04eSAndreas Gohr            throw new AccessDeniedException('You are not allowed to read this file', 111);
2570316b84SAndreas Gohr        }
2670316b84SAndreas Gohr
2770316b84SAndreas Gohr        return 'example';
2870316b84SAndreas Gohr    }
2970316b84SAndreas Gohr}
30