3 namespace dokuwiki\Extension
;
5 use dokuwiki\Remote\Api
;
6 use dokuwiki\Remote\ApiCall
;
7 use ReflectionException
;
11 * Remote Plugin prototype
13 * Add functionality to the remote API in a plugin
15 abstract class RemotePlugin
extends Plugin
22 public function __construct()
24 $this->api
= new Api();
28 * Get all available methods with remote access.
30 * By default it exports all public methods of a remote plugin. Methods beginning
31 * with an underscore are skipped.
33 * @return ApiCall[] Information about all provided methods. ('methodname' => ApiCall)
34 * @throws ReflectionException
36 public function getMethods()
40 $reflection = new \
ReflectionClass($this);
41 foreach ($reflection->getMethods(ReflectionMethod
::IS_PUBLIC
) as $method) {
42 // skip parent methods, only methods further down are exported
43 $declaredin = $method->getDeclaringClass()->name
;
44 if ($declaredin === 'dokuwiki\Extension\Plugin' ||
$declaredin === 'dokuwiki\Extension\RemotePlugin') {
47 $method_name = $method->name
;
48 if ($method_name[0] === '_') {
51 if ($method_name === 'getMethods') {
52 continue; // skip self, if overridden
56 $result[$method_name] = new ApiCall([$this, $method_name], 'plugins');
63 * @deprecated 2023-11-30
65 public function _getMethods()
67 dbg_deprecated('getMethods()');
75 protected function getApi()