-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaddCmd.php
83 lines (81 loc) · 2.15 KB
/
addCmd.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/*
* pmt.mcpe.me
*
* Copyright (C) 2015 PEMapModder
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PEMapModder
*/
include_once __DIR__ . "/utils.php";
$proj = forceProject();
?>
<html>
<head>
<title>Create Command | Plugin Generator</title>
<?= INCLUDE_JQUERY ?>
<link href="style/form.css" rel="stylesheet" type="text/css">
<script>
$(document).ready(function(){
setTimeout("loop()", 50);
$("#usage").focus(function(){
var usage = $("#usage");
if(usage.val() === ""){
usage.val(usage.attr("placeholder"));
}
});
$("#submit").click(function(){
var name = $("#name");
name.val(validate(name.val().trim()));
});
});
function loop(){
var usage = $("#usage");
var name = $("#name");
if(usage.val() === ""){
usage.attr("placeholder", "/" + name.val() + " ");
}
var regex = /[ :]+/g;
if(name.val().search(regex) != -1){
name.val(name.val().replace(regex, "-"));
}
setTimeout("loop()", 50);
}
function validate(str){
return str.replace(/[ :]+/g, "-");
}
</script>
</head>
<body>
<h1>Add New Plugin Command</h1>
<hr>
<?php if(isset($_GET["err"])): ?>
<div>
<a class="error"><?= $_GET["err"] ?></a>
</div>
<?php endif ?>
<form action="addCmdCallback.php" method="post">
<table>
<tr>
<td class="left"><label for="name">Command Name:</label></td>
<td class="right">/ <input type="text" name="name" class="codebox" placeholder="do not put space or colons (:) here" id="name" autofocus></td>
</tr>
<tr>
<td class="left"><label for="desc">Descrption:</label></td>
<td class="right"><input type="text" name="desc" class="textbox" placeholder=""></td>
</tr>
<tr>
<td class="left"><label for="usage">Usage:</label></td>
<td class="right"><input type="text" name="usage" class="textbox" placeholder="" id="usage" value=""></td>
</tr>
</table>
<p>
<input class="button" type="submit" id="submit" value="Continue">
</p>
</form>
</body>
</html>