mybb/mybb — pull request #412 by askamn (2014-04-22 12:59:31+00:00)
Title: Update class_xml.php

Add function/s:

parse() -> Initiates Parser, easier to use this.
getXMLElement -> If you have complex XML like:

INS Test Addon
AskAmn
Test build for testing INS Applications/Hooks Pages

MyBB's parser will surely give you something that you wont like :)

a print_r after parsing gives:

Array
(
[info] => Array
(
[data] => Array
(
[name] => INS Test Addon
[author] => AskAmn
[description] => Test build for testing INS Applications/Hooks Pages
)

)

)

That also needs a lot of work to get to 'name', 'author', etc.
But now, you can use: (Example given in Comment in code.)
$xml->getXMLElement($array); to get to 'name', 'author', etc easily.
This gives us:

Array
(
[name] => INS Test Addon
[author] => AskAmn
[description] => Test build for testing INS Applications/Hooks Pages
[last] => 1
)

Wow, that's so cool! :P

Also changed the constructor function so that we can directly open an XML file.
Also added a var $init to constructor for lazy dudes to automatically feed the self::parsedXML var.
Also added $parsedXML for easy access to parsed XML.