4
4
* Outputs the XML to stdout.
5
5
*/
6
6
7
+ echo "Starting the XML generation process \n\n" ;
8
+
7
9
// Name of the command, eg 'Remote' for Remote.php's XML output
8
10
$ dir = 'PEAR/Command/ ' ;
9
11
foreach (scandir ($ dir ) as $ file ) {
10
12
$ file = explode ('. ' , $ file );
11
13
if (isset ($ file [1 ]) && $ file [1 ] === 'php ' && $ file [0 ] != 'Common ' ) {
14
+ echo "Generating XML for " . $ file [0 ] . " \n" ;
12
15
generateXML ($ file [0 ]);
13
16
}
14
17
}
15
18
19
+ echo "\nDone. \n" ;
20
+
16
21
function generateXML ($ name )
17
22
{
18
23
$ file = 'PEAR/Command/ ' . $ name . '.php ' ;
@@ -39,7 +44,12 @@ function generateXML($name)
39
44
foreach ($ docs ['options ' ] as $ option => $ opt_docs ) {
40
45
$ option = htmlentities ($ option , ENT_QUOTES , 'UTF-8 ' , false );
41
46
$ xml .= ' < ' .$ option .'> ' ."\n" ;
42
- $ xml .= ' <shortopt> ' .htmlentities ($ opt_docs ['shortopt ' ], ENT_QUOTES , 'UTF-8 ' , false )."</shortopt> \n" ;
47
+ $ xml .= ' <shortopt> ' ;
48
+ if (isset ($ opt_docs ['shortopt ' ])) {
49
+ $ xml .= htmlentities ($ opt_docs ['shortopt ' ], ENT_QUOTES , 'UTF-8 ' , false );
50
+ }
51
+
52
+ $ xml .= "</shortopt> \n" ;
43
53
$ xml .= ' <doc> ' .htmlentities ($ opt_docs ['doc ' ], ENT_QUOTES , 'UTF-8 ' , false )."</doc> \n" ;
44
54
if (isset ($ opt_docs ['arg ' ]) && $ opt_docs ['arg ' ] != '' ) {
45
55
$ xml .= ' <arg> ' .htmlentities ($ opt_docs ['arg ' ], ENT_QUOTES , 'UTF-8 ' , false )."</arg> \n" ;
0 commit comments