You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
4.6 KiB

  1. <?php
  2. // Project: Web Reference Database (refbase) <http://www.refbase.net>
  3. // Copyright: Matthias Steffens <mailto:refbase@extracts.de> and the file's
  4. // original author(s).
  5. //
  6. // This code is distributed in the hope that it will be useful,
  7. // but WITHOUT ANY WARRANTY. Please see the GNU General Public
  8. // License for more details.
  9. //
  10. // File: ./includes/unapi.inc.php
  11. // Repository: $HeadURL: file:///svn/p/refbase/code/branches/bleeding-edge/includes/unapi.inc.php $
  12. // Author(s): Matthias Steffens <mailto:refbase@extracts.de>
  13. //
  14. // Created: 15-Jul-06, 15:25
  15. // Modified: $Date: 2015-01-08 00:03:12 +0000 (Thu, 08 Jan 2015) $
  16. // $Author: karnesky $
  17. // $Revision: 1400 $
  18. // This include file contains functions that deal with unAPI response XML.
  19. // Requires ActiveLink PHP XML Package, which is available under the GPL from:
  20. // <http://www.active-link.com/software/>. See 'unapi.php' for more info.
  21. // Incorporate some include files:
  22. include_once 'includes/webservice.inc.php'; // include functions that are commonly used with the refbase webservices
  23. // Import the ActiveLink Packages
  24. require_once("classes/include.php");
  25. import("org.active-link.xml.XML");
  26. import("org.active-link.xml.XMLDocument");
  27. // --------------------------------------------------------------------
  28. // return an unAPI XML response if the unAPI request issued either of the following:
  29. // - http://.../refs/unapi.php
  30. // - http://.../refs/unapi.php?id=http://polaris.ipoe.uni-kiel.de/refs/show.php?record=1
  31. function unapiExplainResponse($unapiID)
  32. {
  33. global $contentTypeCharset; // these variables are specified in 'ini.inc.php'
  34. $unapiCollectionDoc = new XMLDocument();
  35. $unapiCollectionDoc->setEncoding($contentTypeCharset);
  36. $unapiCollection = new XML("formats");
  37. if (!empty($unapiID)) //TODO: we may want to ensure the unapi we are using does, indeed, point back to a record or return an error.
  38. $unapiCollection->setTagAttribute("id", encodeHTML($unapiID));
  39. // Recommended format names are given at <http://unapi.stikipad.com/unapi/show/existing+formats>
  40. // TODO: add 'ISI', 'ODF XML' and 'Word XML'
  41. addNewBranch($unapiCollection, "format", array("name" => "bibtex", "type" => "text/plain", "docs" => "http://en.wikipedia.org/wiki/BibTeX"), ""); // function 'addNewBranch()' is defined in 'webservice.inc.php'
  42. addNewBranch($unapiCollection, "format", array("name" => "endnote", "type" => "text/plain", "docs" => "http://www.ecst.csuchico.edu/~jacobsd/bib/formats/endnote.html"), "");
  43. addNewBranch($unapiCollection, "format", array("name" => "ris", "type" => "text/plain", "docs" => "http://www.adeptscience.co.uk/kb/article/A626"), "");
  44. addNewBranch($unapiCollection, "format", array("name" => "atom", "type" => "application/atom+xml", "docs" => "http://www.atomenabled.org/developers/syndication/"), "");
  45. addNewBranch($unapiCollection, "format", array("name" => "mods", "type" => "application/xml", "docs" => "http://www.loc.gov/standards/mods/"), "");
  46. addNewBranch($unapiCollection, "format", array("name" => "oai_dc", "type" => "application/xml", "docs" => "http://www.openarchives.org/OAI/openarchivesprotocol.html#dublincore"), "");
  47. addNewBranch($unapiCollection, "format", array("name" => "srw_dc", "type" => "application/xml", "docs" => "http://www.loc.gov/standards/sru/"), "");
  48. addNewBranch($unapiCollection, "format", array("name" => "srw_mods", "type" => "application/xml", "docs" => "http://www.loc.gov/standards/sru/"), "");
  49. addNewBranch($unapiCollection, "format", array("name" => "html", "type" => "text/html", "docs" => "http://www.w3.org/MarkUp/"), "");
  50. addNewBranch($unapiCollection, "format", array("name" => "rtf", "type" => "application/rtf", "docs" => "http://en.wikipedia.org/wiki/Rich_Text_Format"), "");
  51. addNewBranch($unapiCollection, "format", array("name" => "pdf", "type" => "application/pdf", "docs" => "http://partners.adobe.com/public/developer/pdf/index_reference.html"), "");
  52. addNewBranch($unapiCollection, "format", array("name" => "latex", "type" => "application/x-latex", "docs" => "http://en.wikipedia.org/wiki/LaTeX"), "");
  53. addNewBranch($unapiCollection, "format", array("name" => "markdown", "type" => "text/plain", "docs" => "http://daringfireball.net/projects/markdown/"), "");
  54. addNewBranch($unapiCollection, "format", array("name" => "text", "type" => "text/plain"), "");
  55. $unapiCollectionDoc->setXML($unapiCollection);
  56. $unapiCollectionString = $unapiCollectionDoc->getXMLString();
  57. return $unapiCollectionString;
  58. }
  59. // --------------------------------------------------------------------
  60. ?>