xref: /plugin/dev/www/index.php (revision f57a6a5c44ae91ca3f48acd858a81e992d4131f5)
189e2f9d1SAndreas Gohr<?php
289e2f9d1SAndreas Gohrrequire __DIR__ . '/../vendor/autoload.php';
389e2f9d1SAndreas Gohr
489e2f9d1SAndreas Gohr$WIZ = new dokuwiki\plugin\dev\www\PluginWizard();
589e2f9d1SAndreas Gohrtry {
689e2f9d1SAndreas Gohr    $archive = $WIZ->handle();
789e2f9d1SAndreas Gohr    if ($archive) {
889e2f9d1SAndreas Gohr        header('Content-Type: application/zip');
989e2f9d1SAndreas Gohr        header('Content-Disposition: attachment; filename="plugin.zip"');
1089e2f9d1SAndreas Gohr        echo $archive;
1189e2f9d1SAndreas Gohr        exit;
1289e2f9d1SAndreas Gohr    }
13cde324c2SAndreas Gohr} catch (Exception $ignored) {
14cde324c2SAndreas Gohr    // errors should only happen when the frontend validation is ignored
1589e2f9d1SAndreas Gohr}
1689e2f9d1SAndreas Gohr
1789e2f9d1SAndreas Gohrheader('Content-Type: text/html; charset=utf-8');
1889e2f9d1SAndreas Gohr?>
1989e2f9d1SAndreas Gohr<html lang="en">
2089e2f9d1SAndreas Gohr<head>
2189e2f9d1SAndreas Gohr    <title>DokuWiki Plugin Wizard</title>
2289e2f9d1SAndreas Gohr    <script type="text/javascript">
2389e2f9d1SAndreas Gohr        const ACTION_EVENTS = <?php echo json_encode($WIZ->getEvents()); ?>;
2489e2f9d1SAndreas Gohr    </script>
2589e2f9d1SAndreas Gohr
2689e2f9d1SAndreas Gohr    <link rel="stylesheet" href="style.css"/>
27cde324c2SAndreas Gohr    <link rel="stylesheet" href="awesomplete.css"
28cde324c2SAndreas Gohr    /
2989e2f9d1SAndreas Gohr</head>
3089e2f9d1SAndreas Gohr<body>
3189e2f9d1SAndreas Gohr<main>
3289e2f9d1SAndreas Gohr    <h1>DokuWiki Plugin Wizard</h1>
3389e2f9d1SAndreas Gohr
3489e2f9d1SAndreas Gohr
3589e2f9d1SAndreas Gohr    <div class="intro">
3689e2f9d1SAndreas Gohr        <p>
3789e2f9d1SAndreas Gohr            This wizard generates a <a href="https://www.dokuwiki.org/devel:plugins">DokuWiki plugin</a>
3889e2f9d1SAndreas Gohr            skeleton to help you get started with coding your plugin.
39*f57a6a5cSAndreas Gohr            Before using it, you should familiarize your self with how plugins in DokuWiki work
4089e2f9d1SAndreas Gohr            and determine what components your plugin will need.
4189e2f9d1SAndreas Gohr        </p>
4289e2f9d1SAndreas Gohr
4389e2f9d1SAndreas Gohr        <p>
4489e2f9d1SAndreas Gohr            To use it, fill in the general plugin info and add plugin components. Once you're
4589e2f9d1SAndreas Gohr            done, click "create" and download your plugin skeleton.
4689e2f9d1SAndreas Gohr        </p>
4789e2f9d1SAndreas Gohr
4889e2f9d1SAndreas Gohr        <p>
4989e2f9d1SAndreas Gohr            Alternatively you can also use the <a href="https://www.dokuwiki.org/plugin:dev">dev plugin</a>.
5089e2f9d1SAndreas Gohr            This plugin will also come in handy when editing and extending your plugin later.
5189e2f9d1SAndreas Gohr        </p>
5289e2f9d1SAndreas Gohr    </div>
5389e2f9d1SAndreas Gohr
5489e2f9d1SAndreas Gohr    <noscript>
5589e2f9d1SAndreas Gohr        <div class="nojs">
5689e2f9d1SAndreas Gohr            Sorry, this wizard needs JavaScript to do its magic. It will not work with your
5789e2f9d1SAndreas Gohr            current setup.
5889e2f9d1SAndreas Gohr        </div>
5989e2f9d1SAndreas Gohr    </noscript>
6089e2f9d1SAndreas Gohr
6189e2f9d1SAndreas Gohr
6289e2f9d1SAndreas Gohr    <form action="index.php" method="post" id="ajax__plugin_wiz">
6389e2f9d1SAndreas Gohr
6489e2f9d1SAndreas Gohr        <section>
6589e2f9d1SAndreas Gohr            <div id="plugin_info">
6689e2f9d1SAndreas Gohr                <h2>Plugin Information</h2>
6789e2f9d1SAndreas Gohr
6889e2f9d1SAndreas Gohr                <label>
6989e2f9d1SAndreas Gohr                    <span>Plugin base name:</span>
7089e2f9d1SAndreas Gohr                    <input type="text" name="base" required="required" pattern="^[a-z0-9]+$"
7189e2f9d1SAndreas Gohr                           placeholder="yourplugin">
7289e2f9d1SAndreas Gohr                    <small>(lowercase, no special chars)</small>
7389e2f9d1SAndreas Gohr                </label>
7489e2f9d1SAndreas Gohr
7589e2f9d1SAndreas Gohr                <label>
7689e2f9d1SAndreas Gohr                    <span>A short description of what the plugin does:</span>
7789e2f9d1SAndreas Gohr                    <input type="text" name="desc" required="required"
7889e2f9d1SAndreas Gohr                           placeholder="A plugin to flurb the blarg">
7989e2f9d1SAndreas Gohr                </label>
8089e2f9d1SAndreas Gohr
8189e2f9d1SAndreas Gohr                <label>
8289e2f9d1SAndreas Gohr                    <span>Your name:</span>
8389e2f9d1SAndreas Gohr                    <input type="text" name="author" required="required" placeholder="Jane Doe">
8489e2f9d1SAndreas Gohr                </label>
8589e2f9d1SAndreas Gohr
8689e2f9d1SAndreas Gohr                <label>
8789e2f9d1SAndreas Gohr                    <span>Your E-Mail address:</span>
8889e2f9d1SAndreas Gohr                    <input type="text" name="mail" required="required" placeholder="jane@example.com">
8989e2f9d1SAndreas Gohr                </label>
9089e2f9d1SAndreas Gohr
9189e2f9d1SAndreas Gohr                <label>
9289e2f9d1SAndreas Gohr                    <span>URL for the plugin:</span>
9389e2f9d1SAndreas Gohr                    <input type="text" name="url" placeholder="https://www.dokuwiki.org/plugin:yourplugin">
9489e2f9d1SAndreas Gohr                    <small>(leave empty for default dokuwiki.org location)</small>
9589e2f9d1SAndreas Gohr                </label>
9689e2f9d1SAndreas Gohr
9789e2f9d1SAndreas Gohr                <label>
9889e2f9d1SAndreas Gohr                    <input type="checkbox" name="use_lang" value="1"/>
9989e2f9d1SAndreas Gohr                    <span>Use localization</span>
10089e2f9d1SAndreas Gohr                </label>
10189e2f9d1SAndreas Gohr
10289e2f9d1SAndreas Gohr                <label>
10389e2f9d1SAndreas Gohr                    <input type="checkbox" name="use_conf" value="1"/>
10489e2f9d1SAndreas Gohr                    <span>Use configuration</span>
10589e2f9d1SAndreas Gohr                </label>
10689e2f9d1SAndreas Gohr
10789e2f9d1SAndreas Gohr                <label>
10889e2f9d1SAndreas Gohr                    <input type="checkbox" name="use_tests" value="1"/>
10989e2f9d1SAndreas Gohr                    <span>Use unit tests</span>
11089e2f9d1SAndreas Gohr                </label>
11189e2f9d1SAndreas Gohr            </div>
11289e2f9d1SAndreas Gohr
11389e2f9d1SAndreas Gohr            <div id="plugin_components">
11489e2f9d1SAndreas Gohr                <h2>Add Plugin Components</h2>
11589e2f9d1SAndreas Gohr
11689e2f9d1SAndreas Gohr                <label>
11789e2f9d1SAndreas Gohr                    <span>Type:</span>
11889e2f9d1SAndreas Gohr                    <select>
11989e2f9d1SAndreas Gohr                        <?php foreach ($WIZ->getPluginTypes() as $type): ?>
12089e2f9d1SAndreas Gohr                            <option value="<?php echo $type ?>"><?php echo ucfirst($type) ?></option>
12189e2f9d1SAndreas Gohr                        <?php endforeach; ?>
12289e2f9d1SAndreas Gohr                    </select>
12389e2f9d1SAndreas Gohr                </label>
12489e2f9d1SAndreas Gohr
12589e2f9d1SAndreas Gohr                <label>
12689e2f9d1SAndreas Gohr                    <span>Add as a Sub-Component:</span>
12789e2f9d1SAndreas Gohr                    <input type="text" value="" pattern="^[a-z0-9]+$" placeholder="subcomponent"/>
12889e2f9d1SAndreas Gohr                    <small>(leave empty to add top level)</small>
12989e2f9d1SAndreas Gohr                </label>
13089e2f9d1SAndreas Gohr
13189e2f9d1SAndreas Gohr                <button type="button">Add Component</button>
13289e2f9d1SAndreas Gohr
13389e2f9d1SAndreas Gohr                <ul id="output"></ul>
13489e2f9d1SAndreas Gohr
13589e2f9d1SAndreas Gohr            </div>
13689e2f9d1SAndreas Gohr        </section>
13789e2f9d1SAndreas Gohr
13889e2f9d1SAndreas Gohr        <button type="submit" name="plugin_wiz_create">Create and Download<br>Plugin Skeleton</button>
13989e2f9d1SAndreas Gohr
14089e2f9d1SAndreas Gohr    </form>
14189e2f9d1SAndreas Gohr
14289e2f9d1SAndreas Gohr</main>
14389e2f9d1SAndreas Gohr<script src="awesomplete.min.js"></script>
14489e2f9d1SAndreas Gohr<script src="script.js"></script>
14589e2f9d1SAndreas Gohr</body>
14689e2f9d1SAndreas Gohr</html>
147