You are here

function biblio_citeproc_validate_csl in Bibliography Module 7.2

Same name and namespace in other branches
  1. 6.2 modules/CiteProc/biblio_citeproc.admin.inc \biblio_citeproc_validate_csl()
  2. 7 modules/CiteProc/biblio_citeproc.admin.inc \biblio_citeproc_validate_csl()
2 calls to biblio_citeproc_validate_csl()
biblio_citeproc_csl_editor_validate in modules/CiteProc/biblio_citeproc.admin.inc
biblio_citeproc_validate_csl_file in modules/CiteProc/biblio_citeproc.admin.inc

File

modules/CiteProc/biblio_citeproc.admin.inc, line 451

Code

function biblio_citeproc_validate_csl($csl) {
  $rng_schema = drupal_get_path('module', 'biblio_citeproc') . '/schema/csl.rng';
  $doc = new DOMDocument();
  $doc
    ->loadXML($csl);
  $updated = $doc
    ->getElementsByTagName('updated')
    ->item(0);
  $updated->nodeValue = date(DATE_ATOM, time());
  $valid = $doc
    ->relaxNGValidate($rng_schema);
  $csl = $doc
    ->saveXML();
  return $valid ? array() : array(
    t('The supplied CSL file did not pass CSL 1.0 validation'),
  );
}