didou Thu Jan 15 07:43:44 2004 EDT
Modified files: /phpdoc/en/reference/xml reference.xml /phpdoc/en/reference/xml/functions xml-parse-into-struct.xml xml-set-object.xml Log: CS : Function declarations follow the 'one true brace' convention Index: phpdoc/en/reference/xml/reference.xml diff -u phpdoc/en/reference/xml/reference.xml:1.13 phpdoc/en/reference/xml/reference.xml:1.14 --- phpdoc/en/reference/xml/reference.xml:1.13 Mon Dec 15 11:54:27 2003 +++ phpdoc/en/reference/xml/reference.xml Thu Jan 15 07:43:43 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.13 $ --> +<!-- $Revision: 1.14 $ --> <reference id="ref.xml"> <title>XML parser functions</title> <titleabbrev>XML</titleabbrev> @@ -282,7 +282,8 @@ $file = "data.xml"; $depth = array(); -function startElement($parser, $name, $attrs) { +function startElement($parser, $name, $attrs) +{ global $depth; for ($i = 0; $i < $depth[$parser]; $i++) { echo " "; @@ -291,7 +292,8 @@ $depth[$parser]++; } -function endElement($parser, $name) { +function endElement($parser, $name) +{ global $depth; $depth[$parser]--; } @@ -339,21 +341,24 @@ "LITERAL" => "TT" ); -function startElement($parser, $name, $attrs) { +function startElement($parser, $name, $attrs) +{ global $map_array; if ($htmltag == $map_array[$name]) { echo "<$htmltag>"; } } -function endElement($parser, $name) { +function endElement($parser, $name) +{ global $map_array; if ($htmltag == $map_array[$name]) { echo "</$htmltag>"; } } -function characterData($parser, $data) { +function characterData($parser, $data) +{ echo $data; } @@ -403,7 +408,8 @@ <?php $file = "xmltest.xml"; -function trustedFile($file) { +function trustedFile($file) +{ // only trust local files owned by ourselves if (!eregi("^([a-z]+)://", $file) && fileowner($file) == getmyuid()) { @@ -412,7 +418,8 @@ return false; } -function startElement($parser, $name, $attribs) { +function startElement($parser, $name, $attribs) +{ echo "<<font color=\"#0000cc\">$name</font>"; if (sizeof($attribs)) { while (list($k, $v) = each($attribs)) { @@ -423,15 +430,18 @@ echo ">"; } -function endElement($parser, $name) { +function endElement($parser, $name) +{ echo "</<font color=\"#0000cc\">$name</font>>"; } -function characterData($parser, $data) { +function characterData($parser, $data) +{ echo "<b>$data</b>"; } -function PIHandler($parser, $target, $data) { +function PIHandler($parser, $target, $data) +{ switch (strtolower($target)) { case "php": global $parser_file; @@ -448,7 +458,8 @@ } } -function defaultHandler($parser, $data) { +function defaultHandler($parser, $data) +{ if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { printf('<font color="#aa00aa">%s</font>', htmlspecialchars($data)); @@ -481,7 +492,8 @@ return false; } -function new_xml_parser($file) { +function new_xml_parser($file) +{ global $parser_file; $xml_parser = xml_parser_create(); Index: phpdoc/en/reference/xml/functions/xml-parse-into-struct.xml diff -u phpdoc/en/reference/xml/functions/xml-parse-into-struct.xml:1.8 phpdoc/en/reference/xml/functions/xml-parse-into-struct.xml:1.9 --- phpdoc/en/reference/xml/functions/xml-parse-into-struct.xml:1.8 Sat Dec 20 22:17:53 2003 +++ phpdoc/en/reference/xml/functions/xml-parse-into-struct.xml Thu Jan 15 07:43:44 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <!-- splitted from ./en/functions/xml.xml, last change in rev 1.11 --> <refentry id="function.xml-parse-into-struct"> <refnamediv> @@ -144,13 +144,15 @@ var $code; // one letter code var $type; // hydrophobic, charged or neutral - function AminoAcid ($aa) { + function AminoAcid ($aa) + { foreach ($aa as $k=>$v) $this->$k = $aa[$k]; } } -function readDatabase($filename) { +function readDatabase($filename) +{ // read the XML database of aminoacids $data = implode("", file($filename)); $parser = xml_parser_create(); @@ -177,9 +179,11 @@ return $tdb; } -function parseMol($mvalues) { - for ($i=0; $i < count($mvalues); $i++) +function parseMol($mvalues) +{ + for ($i=0; $i < count($mvalues); $i++) { $mol[$mvalues[$i]["tag"]] = $mvalues[$i]["value"]; + } return new AminoAcid($mol); } Index: phpdoc/en/reference/xml/functions/xml-set-object.xml diff -u phpdoc/en/reference/xml/functions/xml-set-object.xml:1.7 phpdoc/en/reference/xml/functions/xml-set-object.xml:1.8 --- phpdoc/en/reference/xml/functions/xml-set-object.xml:1.7 Mon Dec 15 11:54:28 2003 +++ phpdoc/en/reference/xml/functions/xml-set-object.xml Thu Jan 15 07:43:44 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <!-- splitted from ./en/functions/xml.xml, last change in rev 1.2 --> <refentry id="function.xml-set-object"> <refnamediv> @@ -25,7 +25,8 @@ class xml { var $parser; - function xml() { + function xml() + { $this->parser = xml_parser_create(); xml_set_object($this->parser, &$this); @@ -33,19 +34,23 @@ xml_set_character_data_handler($this->parser, "cdata"); } - function parse($data) { + function parse($data) + { xml_parse($this->parser, $data); } - function tag_open($parser, $tag, $attributes) { + function tag_open($parser, $tag, $attributes) + { var_dump($parser, $tag, $attributes); } - function cdata($parser, $cdata) { + function cdata($parser, $cdata) + { var_dump($parser, $cdata); } - function tag_close($parser, $tag) { + function tag_close($parser, $tag) + { var_dump($parser, $tag); }