function GetContents() { $out = ''; foreach ($this->parent->refs as $refraw) { $ref = $refraw; $out .= "TY - " . (isset($ref['type']) ? strtoupper($ref['type']) : 'ELEC') . "\n"; foreach ($this->_mapHashArray as $k => $v) { if (isset($ref[$v])) { foreach ((array) $ref[$v] as $val) { $out .= "{$k} - " . $this->Escape($val) . "\n"; } unset($ref[$v]); // Remove it from the reference copy so we dont process it twice } } foreach ($this->_mapHash as $k => $v) { if (isset($ref[$v])) { $out .= "{$k} - " . $this->Escape($ref[$v]) . "\n"; unset($ref[$v]); // Remove it from the reference copy so we dont process it twice } } if (isset($ref['pages'])) { if (preg_match('!(.*?)-(.*)$!', $ref['pages'], $pages)) { $out .= "SP - {$pages[1]}\n"; $out .= "EP - {$pages[2]}\n"; } else { $out .= "SP - " . $this->Escape($ref['pages']) . "\n"; } } if (isset($ref['date']) && ($date = $this->parent->ToDate($ref['date'], '/', true))) { $out .= "PY - {$date}/\n"; } $out .= "ER - \n"; } return $out; }
/** * Return the raw XML of the $refs array * @see $refs */ function GetContents() { $out = '<' . '?xml version="1.0" encoding="UTF-8"?' . '><xml><records>'; $number = 0; foreach ($this->parent->refs as $id => $ref) { $out .= '<record>'; $out .= '<database name="' . $this->endNoteFile . '" path="C:\\' . $this->endNoteFile . '">' . $this->_export($this->endNoteFile) . '</database>'; $out .= '<source-app name="EndNote" version="16.0">EndNote</source-app>'; $out .= '<rec-number>' . $number . '</rec-number>'; $out .= '<foreign-keys><key app="EN" db-id="s55prpsswfsepue0xz25pxai2p909xtzszzv">' . $number . '</key></foreign-keys>'; if ($ref['type'] && isset($this->refTypes[$ref['type']])) { $out .= "<ref-type name=\"{$ref['type']}\">{$this->refTypes[$ref['type']]}</ref-type>"; } else { $out .= '<ref-type name="Journal Article">17</ref-type>'; } $out .= '<contributors><authors>'; foreach ($ref['authors'] as $author) { $out .= '<author><style face="normal" font="default" size="100%">' . $this->_export($author) . '</style></author>'; } $out .= '</authors></contributors>'; $out .= '<titles>'; $out .= '<title><style face="normal" font="default" size="100%">' . $this->_export($ref['title']) . '</style></title>'; $out .= '<secondary-title><style face="normal" font="default" size="100%">' . (isset($ref['title-secondary']) && $ref['title-secondary'] ? $this->_export($ref['title-secondary']) : '') . '</style></secondary-title>'; if (isset($ref['title-short']) && $ref['title-short']) { $out .= '<short-title><style face="normal" font="default" size="100%">' . $this->_export($ref['title-short']) . '</style></short-title>'; } if (isset($ref['alt-journal']) && $ref['alt-journal']) { $out .= '<alt-title><style face="normal" font="default" size="100%">' . $this->_export($ref['alt-journal']) . '</style></alt-title>'; } $out .= '</titles>'; $out .= '<periodical><full-title><style face="normal" font="default" size="100%">' . (isset($ref['periodical-title']) && $ref['periodical-title'] ? $this->_export($ref['periodical-title']) : '') . '</style></full-title></periodical>'; // Simple key values // EndNote field on left, RefLib on right foreach (array('access-date' => 'access-date', 'accession-num' => 'accession-num', 'auth-address' => 'address', 'electronic-resource-num' => 'doi', 'pages' => 'pages', 'volume' => 'volume', 'number' => 'number', 'section' => 'section', 'abstract' => 'abstract', 'isbn' => 'isbn', 'label' => 'label', 'caption' => 'caption', 'language' => 'language', 'notes' => 'notes', 'research-notes' => 'research-notes', 'remote-database-provider' => 'database-provider', 'remote-database-name' => 'database', 'work-type' => 'work-type', 'custom1' => 'custom1', 'custom2' => 'custom2', 'custom3' => 'custom3', 'custom4' => 'custom4', 'custom5' => 'custom5', 'custom6' => 'custom6', 'custom7' => 'custom7') as $enkey => $ourkey) { if (isset($ref[$ourkey]) && $ref[$ourkey]) { $out .= "<{$enkey}><style face=\"normal\" font=\"default\" size=\"100%\">" . $this->_export($ref[$ourkey]) . "</style></{$enkey}>"; } } $out .= '<dates>'; $out .= '<year><style face="normal" font="default" size="100%">' . (isset($ref['year']) && $ref['year'] ? $this->_export($ref['year']) : '') . '</style></year>'; $out .= '<pub-dates><date><style face="normal" font="default" size="100%">' . (isset($ref['date']) && $ref['date'] ? $this->_export($this->parent->ToDate($ref['date'])) : '') . '</style></date></pub-dates>'; $out .= '</dates>'; if (isset($ref['urls']) && $ref['urls']) { $out .= '<urls><related-urls>'; foreach ((array) $ref['urls'] as $url) { $out .= '<url><style face="normal" font="default" size="100%">' . $this->_export($url) . '</style></url>'; } $out .= '</related-urls></urls>'; } if (isset($ref['keywords']) && $ref['keywords']) { $out .= '<keywords>'; foreach ((array) $ref['keywords'] as $keyword) { $out .= '<keyword><style face="normal" font="default" size="100%">' . $this->_export($keyword) . '</style></keyword>'; } $out .= '</keywords>'; } $out .= '</record>'; $number++; } $out .= '</records></xml>'; return $out; }