=== Serapeum Multi-Catalog Bibliographic Search ===
Contributors: masino1967
Tags: university, bibliographic, catalogue, public library
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Multi-server bibliographic search via SRU with advanced filters, export (BibTeX/CSV) and import into WordPress.

== Description ==
Serapeum Multi-Catalog Bibliographic Search allows WordPress administrators and editors to consult national and international library catalogues in real time via the SRU (Search/Retrieve via URL) protocol.

Features include:
* Search supported library catalogs using Title, Author/Creator, and Year filters.
* Import records directly into WordPress as Draft Posts using native 2-column Gutenberg block layouts.
* Export search results to CSV or BibTeX (.bib) formats for integration with reference managers (Zotero, Mendeley, EndNote).
* Clean, single-file lightweight architecture with zero external PHP dependencies.


== External services ==
Supported Catalogs:
* BnF - Bibliothèque nationale de France (France)
  base_url: https://catalogue.bnf.fr/api/SRU
  Documentation: https://api.bnf.fr/fr/api-sru-catalogue-general
  Conditions & Lienses: https://www.bnf.fr/fr/conditions-de-reutilisations-des-donnees-de-la-bnf  
* Hispana - Ministerio de Cultura y Deporte (Spain)
  base_url: https://hispana.mcu.es/es/sru/sru.do
  Documentation: https://hispana.mcu.es/en/estaticos/contenido.do?pagina=estaticos%2Fsru
  Conditions: https://hispana.mcu.es/es/contenido/aviso-legal.do
  Warning: The year field does not work if you select Hispana
* DNB - Deutsche Nationalbibliothek (Germany)
  base_url: https://services.dnb.de/sru/dnb
  Documentation & licenses: https://www.dnb.de/EN/Professionell/Metadatendienste/metadatendienste_node.html
* Library of Congress (USA)
  base_url: http://lx2.loc.gov:210/lcdb
  Documentation: https://www.loc.gov/standards/sru/sru-1-1.html
  Privacy policy: https://www.loc.gov/legal/security-copyright-and-privacy/privacy-policy/

== Installation ==
1. Log in to your WordPress Admin panel.
1. Go to Plugins > Add Plugin.
1. Search "Serapeum Multi-Catalog Bibliographic Search".
1. Click install Now.

== Screenshots ==
1. The Serapeum search page
2. Serapeum\'s search page with export buttons
3. Records found with the import button

== Frequently Asked Questions ==
= What is SRU and how does this plugin use it? =
SRU (Search/Retrieve via URL) is a standard protocol for internet search queries using CQL (Contextual Query Language). The plugin communicates directly with official library APIs to pull real-time bibliographic data without storing external databases on your server.

= Does this plugin require any external libraries or dependencies? =
No. It is completely standalone and built as a lightweight, single-file PHP solution utilizing native WordPress functions (wp_remote_get, wp_insert_post, etc.).

= Which libraries are currently supported? =
The plugin includes built-in endpoint configurations for BnF (France), Hispana (Spain), DNB (Germany) and Library of Congress (USA).

= What search filters can I use? =
You can perform targeted queries using Book Title, Author / Creator, and Year of Publication. You can search using any single field or combine multiple fields for precise CQL query results.

= Why do search results vary between different library catalogs? =
Each institution uses specific indexes and operators (e.g., bib.title, dc.title, or tit). The plugin automatically maps your search fields to the correct CQL schema and operator (= or all) required by the selected library.

= How does the \"Import as WP Draft\" feature work? =
Next to each record in the search results, click the \"Import as WP Draft\" button. The plugin automatically generates a new WordPress Draft Post pre-filled with the title and structured metadata.

= How is the imported data formatted inside the post? =
Records are formatted natively using Gutenberg Block Columns (30% width for metadata keys and 70% width for values). This ensures a clean, modern layout that fits seamlessly with your theme without requiring shortcodes or custom stylesheets.

= Can I edit imported bibliographic cards before publishing? =
Yes. Upon importing, a direct link (\"Edit post #ID\") will appear at the top of the page. Clicking it opens the standard WordPress Block Editor, allowing you to add featured images, tags, categories, or custom text before publishing.

= Can I export bibliographic results for citation managers? =
Yes! You can export your search results in BibTeX (.bib) format, which is fully compatible with reference management software like Zotero, Mendeley, and EndNote.

= What data is included in the CSV export? =
The CSV file includes key metadata fields: ID, Title, Creator/Author, Identifier/ISBN, Publisher, Date, Type, and Language.

= Does exporting cost extra server memory or database space? =
No. Export files are generated on-the-fly directly from the active search session memory and downloaded straight through your browser.

= Who can access the bibliographic search tool in WordPress? =
Access is restricted to users with editors and administrators privileges (manage_options capability) to ensure security and prevent unauthorized draft generation.

= Where can I find the plugin page in WP-Admin? =
Once activated, a menu item labeled \"Serapeum\" (with a book icon) will appear in your left-hand WordPress admin menu.

= Is there a limit on how many records can be retrieved per search? =
Yes. To ensure fast response times and prevent HTTP timeouts, the plugin fetches up to 100 records per query and displays them paginated at 20 records per page.

= Can I display search results on the public frontend of my website? =
This plugin is designed as a backend management tool for editors and administrators. However, once you import records as draft posts and publish them, they become visible to your site visitors as standard WordPress posts.

= Why am I getting an HTTP connection error or timeout? =
Remote library servers (like DNB) may occasionally experience temporary downtime or rate-limiting. If a query times out, wait a few moments and try refining your search with specific terms.

= I received an error saying \"The response received from the server was empty\" or \"Unable to parse XML\". =
This happens if the remote library returns invalid formatting or blocks the request. Ensure your server firewall allows outgoing HTTP requests (wp_remote_get) and that the PHP SimpleXML extension is active.

= Why does a search return no results when I know the book exists? =
Search terms must match the specific catalog\'s index rules. Try searching with broader terms (e.g., entering only the author\'s surname or a key word from the title).

= Is this plugin compliant with GDPR and privacy regulations? =
Yes. The plugin is designed with "Privacy by Design" principles. It operates strictly in the WordPress backend and does not collect, track, or store any personal data from your website's front-end visitors.

= Does the plugin transmit user data to external library servers? =
All search queries are executed via secure Server-to-Server requests (`wp_remote_get`). The remote library APIs only see the IP address of your website's hosting server, never the personal IP address of the editor or the end-user. No data is shared with third parties until an editor explicitly clicks "Import as WP Draft" to save the bibliographic metadata locally in your database.

== Changelog ==

= 1.1.0 =
* Modified information to readme.txt.
* Added Library of Congress (USA) option.

= 1.0.1 =
* Added information to readme.txt and removed servers with insufficient information.

= 1.0.0 =
* Initial release.