You are here

public function citeproc::init in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 modules/CiteProc/CSL.inc \citeproc::init()
  2. 7.2 modules/CiteProc/CSL.inc \citeproc::init()
1 call to citeproc::init()
citeproc::__construct in modules/CiteProc/CSL.inc

File

modules/CiteProc/CSL.inc, line 50
CiteProc-PHP.

Class

citeproc

Code

public function init($csl, $lang) {
  $this->mapper = new csl_mapper();
  $this->quash = array();
  $csl_doc = new DOMDocument();
  if ($csl_doc
    ->loadXML($csl)) {
    $style_nodes = $csl_doc
      ->getElementsByTagName('style');
    if ($style_nodes) {
      foreach ($style_nodes as $style) {
        $this->style = new csl_style($style);
      }
    }
    $info_nodes = $csl_doc
      ->getElementsByTagName('info');
    if ($info_nodes) {
      foreach ($info_nodes as $info) {
        $this->info = new csl_info($info);
      }
    }
    $this->locale = new csl_locale($lang);
    $this->locale
      ->set_style_locale($csl_doc);
    $macro_nodes = $csl_doc
      ->getElementsByTagName('macro');
    if ($macro_nodes) {
      $this->macros = new csl_macros($macro_nodes, $this);
    }
    $citation_nodes = $csl_doc
      ->getElementsByTagName('citation');
    foreach ($citation_nodes as $citation) {
      $this->citation = new csl_citation($citation, $this);
    }
    $bibliography_nodes = $csl_doc
      ->getElementsByTagName('bibliography');
    foreach ($bibliography_nodes as $bibliography) {
      $this->bibliography = new csl_bibliography($bibliography, $this);
    }
  }
}