Index: trunk/extensions/ExternalData/ED_ParserFunctions.php |
— | — | @@ -34,8 +34,8 @@ |
35 | 35 | $edgXMLValues = array(); |
36 | 36 | |
37 | 37 | $xml_parser = xml_parser_create(); |
38 | | - xml_set_element_handler( $xml_parser, "EDParserFunctions::startElement", "EDParserFunctions::endElement" ); |
39 | | - xml_set_character_data_handler( $xml_parser, "EDParserFunctions::getContent" ); |
| 38 | + xml_set_element_handler( $xml_parser, array( 'EDParserFunctions', 'startElement' ), array( 'EDParserFunctions', 'endElement' ) ); |
| 39 | + xml_set_character_data_handler( $xml_parser, array( 'EDParserFunctions', 'getContent' ) ); |
40 | 40 | if (!xml_parse($xml_parser, $xml, true)) { |
41 | 41 | echo(sprintf("XML error: %s at line %d", |
42 | 42 | xml_error_string(xml_get_error_code($xml_parser)), |
— | — | @@ -63,7 +63,7 @@ |
64 | 64 | static function parseTree( $tree, &$retrieved_values ) { |
65 | 65 | foreach ($tree as $key => $val) { |
66 | 66 | if (is_array( $val )) { |
67 | | - self::parseTree( $val, &$retrieved_values ); |
| 67 | + self::parseTree( $val, $retrieved_values ); |
68 | 68 | } else { |
69 | 69 | $retrieved_values[$key] = $val; |
70 | 70 | } |
— | — | @@ -71,10 +71,15 @@ |
72 | 72 | } |
73 | 73 | |
74 | 74 | static function getJSONData( $json ) { |
| 75 | + // escape if json_decode() isn't supported |
| 76 | + if ( ! function_exists( 'json_decode' ) ) { |
| 77 | + echo( "Error: json_decode() is not supported in this version of PHP" ); |
| 78 | + return array(); |
| 79 | + } |
75 | 80 | $json_tree = json_decode($json, true); |
76 | 81 | $values = array(); |
77 | 82 | if ( is_array( $json_tree ) ) { |
78 | | - self::parseTree( $json_tree, &$values ); |
| 83 | + self::parseTree( $json_tree, $values ); |
79 | 84 | } |
80 | 85 | return $values; |
81 | 86 | } |