-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgenerator.php
44 lines (36 loc) · 1.12 KB
/
generator.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
<?php
$js = stripslashes($_POST['text']);
$keys = explode(",", $_POST['keys']);
$keys = array_filter($keys);
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author></author>
<documentationURL></documentationURL>
<sampleQuery></sampleQuery>
</meta>
<bindings>
<select itemPath="" produces="XML">
<inputs>';
if (count($keys)) {
foreach ($keys as $k) {
$xml .= '<key id="' . $k . '" type="xs:string" paramType="variable" required="true" />';
}
}
$xml .='
</inputs>
<execute><![CDATA[';
$xml .= $js;
$xml .= ']]></execute>
</select>
</bindings>
</table>';
$filename = "tables/" . md5($xml) . ".xml";
if (!file_exists($filename)) {
file_put_contents($filename, $xml);
}
header("content-type: application/json");
echo json_encode(array(
"filename" => "http://derek.io/~/executor/" . $filename
))
?>