Update CS:GO team score gamedata.
7 public $items = array();
10 class ProfReportParser
16 public function Parse($file)
18 $this->report = FALSE;
19 $this->curtype = FALSE;
21 if (($contents = file_get_contents($file)) === FALSE)
23 $this->last_error = 'File not found';
27 $xml = xml_parser_create();
28 xml_set_object($xml, $this);
29 xml_set_element_handler($xml, 'tag_open', 'tag_close');
30 xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, false);
32 if (!xml_parse($xml, $contents))
34 $this->last_error = 'Line: ' . xml_get_current_line_number($xml) . ' -- ' . xml_error_string(xml_get_error_code($xml));
41 public function tag_open($parser, $tag, $attrs)
43 if ($tag == 'profile')
45 $this->report = new ProfReport();
46 $this->report->time = $attrs['time'];
47 $this->report->uptime = $attrs['uptime'];
49 else if ($tag == 'report')
51 $this->curtype = $attrs['name'];
53 else if ($tag == 'item')
55 if ($this->report === FALSE || $this->curtype === FALSE)
59 $attrs['type'] = $this->curtype;
60 $this->report->items[] = $attrs;
64 public function tag_close($parser, $tag)
68 $this->curtype = FALSE;