function write_dump($collection)
{
    $writer = new XMLWriter();
    $writer->openURI("{$collection['project_id']}.rdf");
    //$writer->openURI('php://output');
    $writer->startDocument('1.0', 'UTF-8');
    $writer->setIndent(true);
    //now we need to define our Indent string,which is basically how many blank spaces we want to have for the indent
    $writer->setIndentString("    ");
    $writer->startElement('rdf:RDF');
    $writer->writeAttribute('xmlns:xsd', 'http://www.w3.org/2001/XMLSchema#');
    $writer->writeAttribute('xmlns:nm', "http://nomisma.org/id/");
    $writer->writeAttribute('xmlns:nmo', "http://nomisma.org/ontology#");
    $writer->writeAttribute('xmlns:dcterms', "http://purl.org/dc/terms/");
    $writer->writeAttribute('xmlns:foaf', "http://xmlns.com/foaf/0.1/");
    $writer->writeAttribute('xmlns:geo', "http://www.w3.org/2003/01/geo/wgs84_pos#");
    $writer->writeAttribute('xmlns:rdf', "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
    $writer->writeAttribute('xmlns:void', "http://rdfs.org/ns/void#");
    //iterate through export sets
    foreach (explode('|', $collection['sets']) as $set) {
        $list = file_get_contents(trim($set));
        $files = explode(PHP_EOL, $list);
        echo "Parsing set {$set}\n";
        $count = 1;
        foreach ($files as $file) {
            if (strlen($file) > 0) {
                process_row($file, $collection, $writer, $count);
                $count++;
            }
        }
    }
    $writer->endElement();
    $writer->flush();
}
示例#2
0
function process_cell_without_row(&$html, $offset)
{
    // Insert missing <tr> tag and fall to the 'process_row'
    // get the LAST tag before offset point; it should be the TD tag outside the row
    preg_match("#<[^>]+>\$#", substr($html, 0, $offset), $matches);
    // Now 'matches' contains the bad TD tag (opening)
    // Insert the TR tag before the TD found
    $html = substr_replace($html, "<tr>" . $matches[0], $offset - strlen($matches[0]), strlen($matches[0]));
    // Restart row processing from the beginning of inserted TR (not inclusing the TR tag itself!, as it will cause the closing
    // tag to be inserted automatically)
    //
    $r = process_row($html, $offset - strlen($matches[0]) + strlen("<tr>"));
    return $r;
}
示例#3
0
        $theheaders_array = explode($ep_separator, $readed[0]);
        // explode the first row, it will be our filelayout
    }
    $lll = 0;
    $filelayout = array();
    foreach ($theheaders_array as $header) {
        $cleanheader = str_replace('"', '', $header);
        // echo "Fileheader was $header<br /><br /><br />";
        $filelayout[$cleanheader] = $lll++;
        //
    }
    unset($readed[0]);
    //  we don't want to process the headers with the data
    // now we've got the array broken into parts by the expicit end-of-row marker.
    foreach ($readed as $tkey => $readed_row) {
        process_row($readed_row, $filelayout, $filelayout_count, $default_these, $ep_separator, $languages, $custom_fields);
    }
    // isn't working in PHP 5
    // array_walk($readed, $filelayout, $filelayout_count, $default_these, 'process_row');
    //*******************************
    //*******************************
    // UPLOAD AND SPLIT FILE
    //*******************************
    //*******************************
} elseif (isset($_FILES['usrfl']) && isset($_GET['split']) && $_GET['split'] == 1) {
    // move the file to where we can work with it
    $file = tep_get_uploaded_file('usrfl');
    //echo "Trying to move file...";
    if (is_uploaded_file($file['tmp_name'])) {
        tep_copy_uploaded_file($file, EP_TEMP_DIRECTORY);
    }
示例#4
0
    if ($Ldata) {
        $query = "INSERT INTO `" . CH_DBBASE . "` " . Gsm_parse(1, $hulpArra);
        $msg['bug'] .= '<br/>id ' . __LINE__ . " " . $query . '<br/>';
        $results = $database->query($query);
        $msg['inf'] .= 'data insert</br>';
    }
}
/*
 * read all the records and display for edit
 */
$query = "SELECT * FROM `" . CH_DBBASE . "`  ORDER BY `section`, `table`, `name`";
$message = __LINE__ . $MOD_GSMOFF['TXT_ERROR_DATABASE'] . $query . "</br>";
$results = $database->query($query);
if (!$results || $results->numRows() == 0) {
    die($message);
}
while ($row = $results->fetchRow()) {
    if ($debug) {
        Gsm_debug($row, __LINE__);
    }
    $regelsArr['descr'] .= process_row(1, $row);
}
$regelsArr['descr'] .= process_row(2, '');
$parseViewArray = array('header' => "<h1>" . $regelsArr['head'] . "</h1>", 'kopregels' => $regelsArr['kopregels'], 'description' => $regelsArr['descr'], 'terug' => $MOD_GSMOFF['cancel'], 'wijzig' => $MOD_GSMOFF['edit'], 'message' => message($msg, $debug), 'return' => CH_RETURN, 'section' => $MOD_GSMOFF['TH_SECTION'], 'file' => $MOD_GSMOFF['TH_FILE'], 'name' => $MOD_GSMOFF['TH_NAME'], 'value' => $MOD_GSMOFF['TH_VALUE'], 'mod' => $regelsArr['module'], 'sel' => $regelsArr['selection']);
$prout .= $TEMPLATE[1];
foreach ($parseViewArray as $key => $value) {
    $prout = str_replace("{" . $key . "}", $value, $prout);
}
if (strstr($set_mode, "vers")) {
    $prout .= "<small>" . $regelsArr['modulen'] . $regelsArr['versie'] . "</small>";
}
$writer->setIndentString("    ");
$writer->startElement('rdf:RDF');
$writer->writeAttribute('xmlns:xsd', 'http://www.w3.org/2001/XMLSchema#');
$writer->writeAttribute('xmlns:nm', "http://nomisma.org/id/");
$writer->writeAttribute('xmlns:nmo', "http://nomisma.org/ontology#");
$writer->writeAttribute('xmlns:dcterms', "http://purl.org/dc/terms/");
$writer->writeAttribute('xmlns:foaf', "http://xmlns.com/foaf/0.1/");
$writer->writeAttribute('xmlns:geo', "http://www.w3.org/2003/01/geo/wgs84_pos#");
$writer->writeAttribute('xmlns:rdf', "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
$writer->writeAttribute('xmlns:void', "http://rdfs.org/ns/void#");
$count = 1;
foreach ($files as $file) {
    if (strlen($file) > 0) {
        $fileArray = explode('/', $file);
        $objectNumber = str_replace('.xml', '', $fileArray[count($fileArray) - 1]);
        process_row($objectNumber, $writer, $count);
        $count++;
    }
}
$writer->endElement();
$writer->flush();
function process_row($id, $writer, $count)
{
    $file = 'http://ww2.smb.museum/mk_edit/coin_export/17/' . $id . '.xml';
    $dom = new DOMDocument('1.0', 'UTF-8');
    if ($dom->load($file) === FALSE) {
        echo "{$file} failed to load.\n";
    } else {
        $xpath = new DOMXpath($dom);
        $xpath->registerNamespace("lido", "http://www.lido-schema.org");
        //look for the Price URI