-#! /usr/bin/php4 -qC
+#!/usr/bin/php4 -qC
<?php
/* vim: set binary expandtab tabstop=4 shiftwidth=4 foldmethod=marker:
-------------------------------------------------------------------------------
$Id$
-----------------------------------------------------------------------------*/
+// CONVERTS A STRING TO XML ENTITIES {{{
+function xmlentities($s) {
+ return str_replace(
+ array('&', '"', '<', '>'),
+ array('&', '"', '<', '>'),
+ $s);
+}
+// }}}
+
//TAG's XML {{{
$xmi_start = <<<EOT
<?xml version="1.0" encoding="UTF-8"?>
$options['type'] = $type;
//If there is more documentation, I add it to the main documentation
if (trim($rest)) {
- $options['documentation'].= "Returns: ".trim($rest);
+ $options['documentation'].= "Returns: ".xmlentities(trim($rest))."\n";
}
$doc_param = 0;
$rest = '';
$rest = substr($rest, strpos($rest,' ') + 1);
}
$options['param'][$cont_param]['type'] = $type;
- $options['param'][$cont_param]['documentation'] = trim(substr(trim($rest), strpos(trim($rest), ' ')));
+ $options['param'][$cont_param]['documentation'] =
+ xmlentities(trim(substr(trim($rest), strpos(trim($rest), ' '))));
$doc_param = 1;
break;
default:
- $tmp2 = str_replace('"', '"', $tmp2);
- $tmp2 = str_replace('<', '<' , $tmp2);
- $tmp2 = str_replace('>', '>' , $tmp2);
- $tmp2 = str_replace('&', '&' , $tmp2);
+ $tmp2 = xmlentities($tmp2);
if (@$doc_param) {
$options['param'][$cont_param]['documentation'].= "\n".$tmp2;
}