checked="checked" />

checked="checked" />

checked="checked" />

'Book list', 'AWC_searchType' => 'srw.kw', 'AWC_searchString' => '', 'AWC_libraryLimit' => '', 'AWC_numberResults' => 5, 'AWC_showBookCovers' => 0, 'AWC_Amazon_developer_key' => '', 'AWC_ShowGoogleLinks' => 0, 'AWC_showRating' => 0); $options = (array) get_option('widget_AddWorldCatSearch'); foreach ( $defaults as $key => $value ) { if ( !isset($options[$key]) ) $options[$key] = $defaults[$key]; } echo $before_widget; echo $before_title; echo $options['title']; echo $after_title; //Our Widget Content $searchURL = 'http://worldcat.org/webservices/catalog/search/sru?query=' . $options['AWC_searchType'] . '%3D%22' . urlencode($options['AWC_searchString']) . '%22'; // Need to insert maximumRecords syntax if ( isset($option['AWC_libraryLimit']) ) { $searchURL = $searchURL . '+and+srw.li%3D%22' . $options['AWC_libraryLimit'] . '%22'; } $searchURL = $searchURL . '&maximumRecords=' . $options['AWC_numberResults']; $xml = simplexml_load_file($searchURL); // Go get the ISBNs in the search results $xml->registerXPathNamespace("marc", "http://www.loc.gov/MARC21/slim"); $google_ids = ""; $lt_ids = ""; $isbns = $xml->xpath("//marc:record/marc:datafield[@tag='020']/marc:subfield[@code='a']"); foreach ((array)$isbns as $isbn) { $google_ids = $google_ids . '"ISBN:' . substr($isbn, 0, strpos($isbn, " ")) . '"'; if ($isbn != end($isbns) ) { $google_ids = $google_ids . ', '; } $lt_ids = $lt_ids . substr($isbn, 0, strpos($isbn, " ")); if ($isbn != end($isbns) ) { $lt_ids = $lt_ids . ','; } } $xml->registerXPathNamespace("marc", "http://www.loc.gov/MARC21/slim"); foreach($xml->xpath('//marc:record') as $book ) { $book['xmlns:marc'] = 'http://www.loc.gov/MARC21/slim'; $field = simplexml_load_string($book->asXML()); $title = $field->xpath("marc:datafield[@tag='245']/marc:subfield[@code='a']"); $publisher = $field->xpath("marc:datafield[@tag='260']/marc:subfield[@code='b']"); $publication_date = $field->xpath("marc:datafield[@tag='260']/marc:subfield[@code='c']"); $isbn = $field->xpath("marc:datafield[@tag='020']/marc:subfield[@code='a']"); $isbn_1 = substr($isbn[0], 0, strpos($isbn[0], " ")); $author = $field->xpath("marc:datafield[@tag='100']/marc:subfield[@code='a']"); $oclcnumber = $field->xpath("marc:controlfield[@tag='001']"); // if Show Book Covers is true then go get covers if ( $options['AWC_showBookCovers'] == 1 ) { if ( strlen($isbn_1) > 1 ) { $aws_developer_key = $options['AWC_Amazon_developer_key']; $request = 'http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=' . $aws_developer_key . '&Operation=ItemLookup&ItemId=' . $isbn_1 . '&ResponseGroup=Images'; $aws_xml = simplexml_load_file($request) or die("xml response not loading"); $image = $aws_xml->Items->Item->SmallImage->URL; $URI = $aws_xml->Items->Item->DetailPageURL; echo '

'; } } echo '

' . $title[0] . ''; if ( strlen($isbn_1) > 1 ) { // if GoogleLinks is true get links to Google if ( $options['AWC_ShowGoogleLinks'] == 1 ) { echo '
'; echo ''; } // if ShowRating is true go get LibraryThing ratings if ($options['AWC_showRating'] == 1 ) { echo '
'; echo ''; } } echo '

'; } echo '
'; echo $after_widget; ?>