Exemplo n.º 1
0
                $startP = $endP = '';
                if (preg_match('/([0-9]+)\\s*-+\\s*([0-9]+)/', $value, $matches)) {
                    $startP = $matches[1];
                    $endP = $matches[2];
                    if (intval($endP) < intval($startP) && strlen($endP) < strlen($startP)) {
                        /* e.g. pp300-23  .. should become pp300-323 */
                        $endP = substr($startP, 0, strlen($startP) - strlen($endP)) . $endP;
                    }
                } else {
                    if (preg_match('/([ivxlcdm]+)\\s*-+\\s*([ivxlcdm]+)/', $value, $matches)) {
                        $startP = $matches[1];
                        $endP = $matches[2];
                    } else {
                        $startP = $value;
                    }
                }
                $supp_fields[] =& new HeuristReferSuppField('startP', $startP);
                $supp_fields[] =& new HeuristReferSuppField('endP', $endP);
                @($entry->_tag_names['startP'] .= $startP . " ");
                @($entry->_tag_names['endP'] .= $endP . " ");
                $field->_superseded = true;
            }
        }
    }
    foreach (array_keys($supp_fields) as $i) {
        $entry->_fields[] =& $supp_fields[$i];
    }
    $entry->_have_supplementary_fields = true;
}
registerHeuristFiletypeParser(new HeuristReferParser());
Exemplo n.º 2
0
                }
                break;
        }
        return $geometries;
    }
    function _parseLinearRing($innerTags)
    {
        if (preg_match_all('/([^\\s,]+),([^\\s,]+)(?:,[^\\s+])?/', $innerTags["coordinates"][0]["-text"][0], $coords, PREG_SET_ORDER)) {
            $coordString = "";
            foreach ($coords as $coord) {
                if ($coordString) {
                    $coordString .= ",";
                }
                $coordString .= floatval($coord[1]) . " " . floatval($coord[2]);
            }
            return $coordString;
        }
        return NULL;
    }
    function _parseExtendedData(&$entry, $innerTags)
    {
        foreach ($innerTags["data"] as $data) {
            if ($data["name"] === "HeuristID") {
                $id = $data["value"][0]["-text"][0];
                setPermanentBiblioID($entry, $id);
            }
        }
    }
}
registerHeuristFiletypeParser(new HeuristKMLParser());
    }
    function _makeNewEntry($lines)
    {
        return new HeuristEndnoteReferEntry($lines);
    }
}
class HeuristEndnoteReferEntry extends HeuristReferEntry
{
    function HeuristEndnoteReferEntry($lines)
    {
        parent::HeuristReferEntry($lines);
        foreach ($lines as $line) {
            if (preg_match('/^%0\\s*(.*)\\s*$/', $line, $matches)) {
                $this->_type = $matches[1];
                break;
            }
        }
    }
    function crosswalk()
    {
        global $refer_to_heurist_map;
        if (!in_array(strtolower($this->_type), array_keys($refer_to_heurist_map))) {
            // we don't have a translation for this
            array_push($this->_errors, 'no Heurist support for reference type: ' . $this->_type);
            return NULL;
        }
        return parent::crosswalk();
    }
}
registerHeuristFiletypeParser(new HeuristEndnoteReferParser());