/** * Reads the data of a variables.xml file. * * @param string $string contents of a variable.xml file * @return array data */ public static function readVariablesData($string) { // open variables.xml $variablesXML = new XML(); $variablesXML->loadString($string); $variablesXMLContent = $variablesXML->getElementTree('variables'); // get variables $variables = array(); foreach ($variablesXMLContent['children'] as $variable) { if (isset($variable['attrs']['name'])) { $variables[$variable['attrs']['name']] = $variable['cdata']; } } return $variables; }