Example #1
0
function load_xml($str)
{
    static $entities_names = null, $entities_values = null;
    if (null === $entities_names) {
        $entities = load_entities();
        $entities_values = array_values($entities);
        $entities_names = array();
        foreach (array_keys($entities) as $v) {
            $entities_names[] = '&' . $v . ';';
        }
    }
    return str_replace($entities_names, $entities_values, file_get_contents($str));
}
Example #2
0
            '&'   => '&',
            '"'  => '"',
            '''  => '"',
            '°'   => '°',
            '&return.success;' => 'Returns TRUE on success or FALSE on failure.',
            '&warn.undocumented.func;' => '',
            '&note.gd.2;' => 'This function requires GD 2.0.1 or later.',
            '&php.ini;' => 'php.ini',
            '&url.mysql.docs.error;' => 'http://dev.mysql.com/doc/mysql/en/Error-returns.html',
            '&example.outputs;' => 'The above example will output something similar to:'
    ));
    */
    $data = preg_replace('/\\&([^;]+;)/', '&\\1', $data);
    $res = $p->setInputString($data);
    $res = $p->parse();
    if ($p->refname) {
        $p->paragraphlist[0] = preg_replace('/^([^ ]*)/', '*\\1*', $p->paragraphlist[0]);
        $fp = fopen($out, 'wb') or die("Could not open {$out}!");
        fwrite($fp, implode("\n\n", $p->paragraphlist));
        fwrite($fp, "\n\nvim:ft=help:\n");
        fclose($fp);
    }
}
$ents = file('ent.txt');
foreach ($ents as $e) {
    load_entities(trim($e));
}
$refs = file('references.txt');
foreach ($refs as $f) {
    process_all(trim($f));
}