function display() { global $lang; $html = '<table cellpadding="0" cellspacing="0" border="0" class="ref-item">'; if ($this->type == 'Method' || $this->type == 'Field') { $html .= refTableRow('<!--*-->Class<!--*-->', '<p>' . $this->category . '</p>'); } $html .= refTableRow('<!--*-->Name<!--*-->', '<h3>' . $this->name . '</h3>', 'name-row'); if (!empty($this->hasCode)) { // Change for 149! $examples = ''; $count = 0; foreach ($this->examples as $ex) { //echo $ex[code]; //$ex[code] = codeExampleConvert($ex[code]); // Adding this line to try to fix problems with match() and matchAll() //echo $ex['code']; $examples .= '<div class="example">'; $path = $lang != 'en' ? '../media' : 'media'; $examples .= !empty($ex['image']) ? "<img src=\"{$path}/{$ex['image']}\" alt=\"example pic\" />" : ''; $examples .= !empty($ex['image']) ? "<pre class=\"margin\">{$ex['code']}</pre>" : "<pre>{$ex['code']}</pre>"; $examples .= '</div>'; if (count($this->examples) != ++$count && empty($ex['image'])) { $examples .= '<hr class="noShade" noshade="noshade" size="1" />'; } } $html .= refTableRow('<!--*-->Examples<!--*-->', $examples); } $html .= refTableRow('<!--*-->Description<!--*-->', $this->description); if (!empty($this->syntax)) { $html .= refTableRow('<!--*-->Syntax<!--*-->', '<pre>' . $this->syntax . '</pre>'); } if (!empty($this->fields)) { $fields = '<table cellpadding="0" cellspacing="0" border="0">'; foreach ($this->fields as $f) { $fields .= refTableRow("<a href=\"{$this->name}_" . convertToFilename($f['fname']) . "\">{$f['fname']}</a>", $f['fdescription']); } $fields .= '</table>'; $html .= refTableRow('<!--*-->Fields<!--*-->', $fields); } if (!empty($this->methods)) { $methods = '<table cellpadding="0" cellspacing="0" border="0">'; foreach ($this->methods as $m) { $methods .= refTableRow("<a href=\"{$this->name}_" . convertToFilename($m['mname']) . "\">{$m['mname']}</a>", $m['mdescription']); } $methods .= '</table>'; $html .= refTableRow('<!--*-->Methods<!--*-->', $methods); } if (!empty($this->constructor)) { $html .= refTableRow('<!--*-->Constructor<!--*-->', '<pre>' . $this->constructor . '</pre>'); } if (!empty($this->hasParameter)) { // Change for 149! $parameters = '<table cellpadding="0" cellspacing="0" border="0">'; foreach ($this->parameters as $p) { $parameters .= refTableRow($p['label'], $p['description']); } $parameters .= '</table>'; $html .= refTableRow('<!--*-->Parameters<!--*-->', $parameters); } if (!empty($this->cparameters)) { $cparameters = '<table cellpadding="0" cellspacing="0" border="0">'; foreach ($this->cparameters as $c) { $cparameters .= refTableRow($c['clabel'], $c['cdescription']); } $cparameters .= '</table>'; $html .= refTableRow('<!--*-->Parameters<!--*-->', $cparameters); } if (!empty($this->returns)) { $html .= refTableRow('<!--*-->Returns<!--*-->', $this->returns); } $html .= refTableRow('<!--*-->Usage<!--*-->', $this->usage); if (!empty($this->related)) { $related = ''; foreach ($this->related as $r) { $related .= '<a href="' . convertToFilename($r) . '">' . $r . '</a><br />'; } $html .= refTableRow('<!--*-->Related<!--*-->', $related); } $html .= '</table>'; return $html; }
} echo 'parsing xml files<br/>'; $names = array(); // create Ref objects for each file foreach ($files as $lang => $array) { foreach ($array as $file) { $ref = new Ref(CONTENTDIR . "api_{$lang}/" . $file); $names[$ref->name] = $ref->name(); } } echo '<table>'; foreach ($names as $name => $file) { echo '<tr>'; echo "<td width=\"200\">{$name}</td>"; echo "<td>{$file}</td>"; echo "<td>" . convertToFilename($name, $lang == 'zh') . "</td>"; echo '</tr>'; } echo '</table>'; /* echo '<table>'; foreach ($names as $name) { echo '<tr>'; echo "<td width=\"200\">$name</td>"; if (($s = convertToFilename($name)) != $name) { echo '<td>'.convertToFilename($name).'</td>'; } else { echo '<td></td>'; } echo '</tr>'; }