getLocalizedIdentifyType())!=''?"\tarticle-type=\"" . htmlspecialchars(Core::cleanVar($s)) . "\"":'') .
"\txml:lang=\"" . strtoupper(substr($primaryLocale, 0, 2)) . "\">\n" .
"\t\n" .
"\t\t\n" .
"\t\t\t" . htmlspecialchars(Core::cleanVar(($s = Config::getVar('oai', 'nlm_journal_id'))!=''?$s:$journal->getPath())) . "\n" .
"\t\t\t" . htmlspecialchars(Core::cleanVar($journal->getLocalizedTitle())) . "\n";
// Include translated journal titles
foreach ($journal->getTitle(null) as $locale => $title) {
if ($locale == $primaryLocale) continue;
$response .= "\t\t\t" . htmlspecialchars(Core::cleanVar($title)) . "\n";
}
$response .=
(!empty($onlineIssn)?"\t\t\t" . htmlspecialchars(Core::cleanVar($onlineIssn)) . "":'') .
(!empty($printIssn)?"\t\t\t" . htmlspecialchars(Core::cleanVar($printIssn)) . "":'') .
($publisherInstitution != ''?"\t\t\t" . htmlspecialchars(Core::cleanVar($publisherInstitution)) . "\n":'') .
"\t\t\n" .
"\t\t\n" .
"\t\t\t" . htmlspecialchars(Core::cleanVar($article->getBestArticleId())) . "\n" .
(($s = $article->getPubId('doi'))?"\t\t\t" . htmlspecialchars(Core::cleanVar($s)) . "\n":'') .
"\t\t\t" . htmlspecialchars(Core::cleanVar($section->getLocalizedTitle())) . "\n" .
"\t\t\t\n" .
"\t\t\t\t" . htmlspecialchars(Core::cleanVar(strip_tags($article->getLocalizedTitle()))) . "\n";
// Include translated journal titles
foreach ($article->getTitle(null) as $locale => $title) {
if ($locale == $primaryLocale) continue;
$response .= "\t\t\t\t" . htmlspecialchars(Core::cleanVar(strip_tags($title))) . "\n";
}
$response .=
"\t\t\t\n" .
"\t\t\t\n";
// Include authors
foreach ($article->getAuthors() as $author) {
$response .=
"\t\t\t\tgetPrimaryContact()?'corresp="yes" ':'') . "contrib-type=\"author\">\n" .
"\t\t\t\t\t\n" .
"\t\t\t\t\t\t" . htmlspecialchars(Core::cleanVar($author->getLastName())) . "\n" .
"\t\t\t\t\t\t" . htmlspecialchars(Core::cleanVar($author->getFirstName()) . (($s = $author->getMiddleName()) != ''?" $s":'')) . "\n" .
"\t\t\t\t\t\n" .
(($s = $author->getLocalizedAffiliation()) != ''?"\t\t\t\t\t" . htmlspecialchars(Core::cleanVar($s)) . "\n":'') .
"\t\t\t\t\t" . htmlspecialchars(Core::cleanVar($author->getEmail())) . "\n" .
(($s = $author->getUrl()) != ''?"\t\t\t\t\t" . htmlspecialchars(Core::cleanVar($s)) . "\n":'') .
"\t\t\t\t\n";
}
// Include editorships (optimized)
$response .= $this->getEditorialInfo($journal->getId());
$response .= "\t\t\t\n";
if ($datePublished) $response .=
"\t\t\t\n" .
"\t\t\t\t" . strftime('%d', $datePublished) . "\n" .
"\t\t\t\t" . strftime('%m', $datePublished) . "\n" .
"\t\t\t\t" . strftime('%Y', $datePublished) . "\n" .
"\t\t\t\n";
$response .=
($issue->getShowYear()?"\t\t\t" . htmlspecialchars(Core::cleanVar($issue->getYear())) . "\n":'') .
($issue->getShowVolume()?"\t\t\t" . htmlspecialchars(Core::cleanVar($issue->getVolume())) . "\n":'') .
($issue->getShowNumber()?"\t\t\tgetId()]*100) + $article->getSeq())) . "\">" . htmlspecialchars(Core::cleanVar($issue->getNumber())) . "\n":'') .
"\t\t\t" . htmlspecialchars(Core::cleanVar($issue->getBestIssueId())) . "\n" .
($issue->getShowTitle()?"\t\t\t" . htmlspecialchars(Core::cleanVar($issue->getLocalizedTitle())) . "\n":'');
// Include page info, if available and parseable.
$matches = null;
if (String::regexp_match_get('/^[Pp][Pp]?[.]?[ ]?(\d+)$/', $article->getPages(), $matches)) {
$matchedPage = htmlspecialchars(Core::cleanVar($matches[1]));
$response .= "\t\t\t\t$matchedPage$matchedPage\n";
$pageCount = 1;
} elseif (String::regexp_match_get('/^[Pp][Pp]?[.]?[ ]?(\d+)[ ]?-[ ]?([Pp][Pp]?[.]?[ ]?)?(\d+)$/', $article->getPages(), $matches)) {
$matchedPageFrom = htmlspecialchars(Core::cleanVar($matches[1]));
$matchedPageTo = htmlspecialchars(Core::cleanVar($matches[3]));
$response .=
"\t\t\t\t$matchedPageFrom\n" .
"\t\t\t\t$matchedPageTo\n";
$pageCount = $matchedPageTo - $matchedPageFrom + 1;
}
$response .=
"\t\t\t\n" .
"\t\t\t\t" . htmlspecialchars(__('submission.copyrightStatement', array('copyrightYear' => $article->getCopyrightYear(), 'copyrightHolder' => $article->getLocalizedCopyrightHolder()))) . "\n" .
($datePublished?"\t\t\t\t" . $article->getCopyrightYear() . "\n":'') .
"\t\t\t\tgetLicenseURL() . "\">\n" .
(($s = Application::getCCLicenseBadge($article->getLicenseURL()))?"\t\t\t\t\t" . strip_tags($s) . "\n":'') .
"\t\t\t\t\n" .
"\t\t\t\n" .
"\t\t\tgetPath(), 'article', 'view', $article->getBestArticleId()))) . "\" />\n";
// Include galley links
foreach ($article->getGalleys() as $galley) {
$response .= "\t\t\tgetFileType())) . "\" xlink:href=\"" . htmlspecialchars(Core::cleanVar(Request::url($journal->getPath(), 'article', 'view', array($article->getBestArticleId(), $galley->getId())))) . "\" />\n";
}
// Include abstract(s)
$abstract = htmlspecialchars(Core::cleanVar(strip_tags($article->getLocalizedAbstract())));
if (!empty($abstract)) {
$abstract = "$abstract
";
// $abstract = '' . String::regexp_replace('/\n+/', '
', $abstract) . '
';
$response .= "\t\t\t$abstract\n";
}
if (is_array($article->getAbstract(null))) foreach ($article->getAbstract(null) as $locale => $abstract) {
if ($locale == $primaryLocale || empty($abstract)) continue;
$abstract = htmlspecialchars(Core::cleanVar(strip_tags($abstract)));
if (empty($abstract)) continue;
$abstract = "$abstract
";
//$abstract = '' . String::regexp_replace('/\n+/', '
', $abstract) . '
';
$response .= "\t\t\t$abstract\n";
}
$subjects = array();
if (is_array($article->getSubject(null))) foreach ($article->getSubject(null) as $locale => $subject) {
$s = array_map('trim', explode(';', Core::cleanVar($subject)));
if (!empty($s)) $subjects[$locale] = $s;
}
if (!empty($subjects)) foreach ($subjects as $locale => $s) {
$response .= "\t\t\t\n";
foreach ($s as $subject) $response .= "\t\t\t\t" . htmlspecialchars($subject) . "\n";
$response .= "\t\t\t\n";
}
$response .=
(isset($pageCount)?"\t\t\t\n":'') .
"\t\t\n" .
"\t\n";
// Include body text (for search indexing only)
import('classes.search.ArticleSearchIndex');
$text = '';
$galleys = $article->getGalleys();
// Give precedence to HTML galleys, as they're quickest to parse
usort($galleys, create_function('$a, $b', 'return $a->isHtmlGalley()?-1:1;'));
// Determine any access limitations. If there are, do not
// provide the full-text.
import('classes.issue.IssueAction');
$subscriptionRequired = IssueAction::subscriptionRequired($issue);
$isSubscribedDomain = IssueAction::subscribedDomain($journal, $issue->getId(), $article->getId());
if (!$subscriptionRequired || $isSubscribedDomain) foreach ($galleys as $galley) {
$parser =& SearchFileParser::fromFile($galley);
if ($parser && $parser->open()) {
while(($s = $parser->read()) !== false) $text .= $s;
$parser->close();
}
if ($galley->isHtmlGalley()) $text = strip_tags($text);
unset($galley);
// Use the first parseable galley.
if (!empty($text)) break;
}
if (!empty($text)) $response .= "\t" . htmlspecialchars(Core::cleanVar(Core::cleanVar($text))) . "
\n";
// Add NLM citation info
$filterDao =& DAORegistry::getDAO('FilterDAO'); /* @var $filterDao FilterDAO */
$nlmFilters = $filterDao->getObjectsByGroup('submission=>nlm23-article-xml');
assert(count($nlmFilters) == 1);
$nlmFilter = array_pop($nlmFilters);
$nlmXmlDom = new DOMDocument();
$nlmXmlDom->loadXML($nlmFilter->execute($article));
$documentElement =& $nlmXmlDom->documentElement;
// Work-around for hasChildNodes being stupid about whitespace.
$hasChildren = false;
if (isset($documentElement->childNodes)) foreach ($documentElement->childNodes as $c) {
if ($c->nodeType == XML_ELEMENT_NODE) $hasChildren = true;
}
// If there were any citations, include them.
if ($hasChildren) {
$innerXml = $nlmXmlDom->saveXML($documentElement);
$response .= "$innerXml\n";
}
$response .= "";
return $response;
}
function getEditorialInfo($journalId) {
static $editorialInfo = array();
if (isset($editorialInfo[$journalId])) return $editorialInfo[$journalId];
$response = '';
$roleDao =& DAORegistry::getDAO('RoleDAO');
$roleMap = array(ROLE_ID_EDITOR => 'editor', ROLE_ID_SECTION_EDITOR> 'secteditor', ROLE_ID_JOURNAL_MANAGER => 'jmanager');
foreach ($roleMap as $roleId => $roleName) {
$users =& $roleDao->getUsersByRoleId($roleId, $journalId);
$isFirst = true;
while ($user =& $users->next()) {
$response .= "\t\t\t\t