1<?php
2
3require_once DOKU_INC . 'inc/form.php';
4
5class ajax_loader {
6    public static function getLoader($plugin, $data) {
7        $form = new Doku_Form(array('class' => 'ajax_loader'));
8        $form->addHidden('call', "ajax_loader_$plugin");
9        foreach($data as $k => $v) {
10            $form->addHidden("ajax_loader_data[$k]", $v);
11        }
12        return '<div>' . $form->getForm() . '</div>';
13    }
14
15    public static function isLoader($plugin, $call) {
16        return $call === "ajax_loader_$plugin";
17    }
18
19    public static function handleLoad() {
20        @session_start();
21        return $_REQUEST['ajax_loader_data'];
22    }
23}
24