* @version 0.1 - Aug 25 2006 */ //error_reporting(E_ALL); require_once('../../../../wp-config.php'); require_once('clsParseXML.php'); array('•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•', '•'); array('A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'ETH', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 'ss', 'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'e', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'eth', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y'); class Scrib_importer{ private function prep_xml($xmlsrc, $is_string = NULL) { if ($is_string) { $xmlraw = $xmlsrc; } else { $xmlraw = utf8_encode(file_get_contents($xmlsrc)); } // This is where we compensate for stoned XML $xmlraw = preg_replace('%>[#&\x80-\xFF](.*?)<\/%s', '>GarbageData', $xmlraw); $xml = simplexml_load_string($xmlraw); return($xml); } public function summarize($text){ // api: http://api.scriblio.net/v01a/summarize/?text=... // The POST URL and parameters $request = 'http://api.scriblio.net/v01a/summarize/'; $postargs = 'text='.urlencode($text); // Get the curl session object $session = curl_init($request); // Set the POST options. curl_setopt ($session, CURLOPT_POST, true); curl_setopt ($session, CURLOPT_POSTFIELDS, $postargs); curl_setopt($session, CURLOPT_HEADER, FALSE); curl_setopt($session, CURLOPT_RETURNTRANSFER, true); // Do the POST and then close the session $response = curl_exec($session); curl_close($session); return($response); } public function post_exists($sourceid) { global $wpdb, $bsuite, $btaggy; return $wpdb->get_var("SELECT post_id FROM $btaggy->meta_table WHERE tag_type = 'sourceid' AND tag_small = '$sourceid'"); } public function insertharvest($bibr) { global $wpdb, $scrib; $wpdb->get_results("REPLACE INTO $scrib->harvest_table (source_id, harvest_date, imported, content) VALUES ('". $wpdb->escape($bibr['the_sourceid']) ."', NOW(), 0, '". $wpdb->escape(serialize($bibr)) ."')"); echo "
'; print_r($bibr); echo ''; } */ return($post_id); } public function get_altisbn($isbn) { $result = array(); // OCLC's xISBN // http://www.oclc.org/research/projects/xisbn/ $xmlopacurl = 'http://labs.oclc.org/xisbn/' . $isbn; $xml = self::prep_xml($xmlopacurl); foreach ($xml->xpath('/idlist/isbn') as $temp) { $result[] = (string) $temp; } // the first element of the array is always the same as the query ISBN, delete it array_shift($result); /* // LibraryThing's thingISBN // http://www.librarything.com/thingology/2006/06/introducing-thingisbn_14.php $xmlopacurl = 'http://www.librarything.com/api/thingISBN/' . $isbn; $xml = self::prep_xml($xmlopacurl); foreach ($xml->xpath('/idlist/isbn') as $temp) { $result[] = (string) $temp; } */ return($result); } public function enrich($isbn_list){ foreach($isbn_list as $isbn){ //echo $isbn . "