コード例 #1
0
 /**
  * Generate an XML sitemap for webcrawlers
  */
 function index()
 {
     if (Request::getRequestedConferencePath() == 'index') {
         $doc = SitemapHandler::createSitemapIndex();
         header("Content-Type: application/xml");
         header("Cache-Control: private");
         header("Content-Disposition: inline; filename=\"sitemap_index.xml\"");
         XMLCustomWriter::printXML($doc);
     } else {
         if (Request::getRequestedSchedConfPath() == 'index') {
             // At conference level
             $doc = SitemapHandler::createConfSitemap();
             header("Content-Type: application/xml");
             header("Cache-Control: private");
             header("Content-Disposition: inline; filename=\"sitemap.xml\"");
             XMLCustomWriter::printXML($doc);
         } else {
             // At scheduled conference level
             $doc = SitemapHandler::createSchedConfSitemap();
             header("Content-Type: application/xml");
             header("Cache-Control: private");
             header("Content-Disposition: inline; filename=\"sitemap.xml\"");
             XMLCustomWriter::printXML($doc);
         }
     }
 }
コード例 #2
0
ファイル: SitemapHandler.inc.php プロジェクト: mariojp/ojs
 /**
  * Generate an XML sitemap for webcrawlers
  * Creates a sitemap index if in site context, else creates a sitemap
  */
 function index()
 {
     if (Request::getRequestedJournalPath() == 'index') {
         $doc = $this->_createSitemapIndex();
         header("Content-Type: application/xml");
         header("Cache-Control: private");
         header("Content-Disposition: inline; filename=\"sitemap_index.xml\"");
         XMLCustomWriter::printXML($doc);
     } else {
         $doc = $this->_createJournalSitemap();
         header("Content-Type: application/xml");
         header("Cache-Control: private");
         header("Content-Disposition: inline; filename=\"sitemap.xml\"");
         XMLCustomWriter::printXML($doc);
     }
 }
コード例 #3
0
 function exportArticle(&$journal, &$issue, &$article, &$galley, $outputFile = null)
 {
     $this->import('EruditExportDom');
     $doc =& XMLCustomWriter::createDocument('article', '-//ERUDIT//Erudit Article DTD 3.0.0//EN', 'http://www.erudit.org/dtd/article/3.0.0/en/eruditarticle.dtd');
     $articleNode =& EruditExportDom::generateArticleDom($doc, $journal, $issue, $article, $galley);
     XMLCustomWriter::appendChild($doc, $articleNode);
     if (!empty($outputFile)) {
         if (($h = fopen($outputFile, 'wb')) === false) {
             return false;
         }
         fwrite($h, XMLCustomWriter::getXML($doc));
         fclose($h);
     } else {
         header("Content-Type: application/xml");
         header("Cache-Control: private");
         header("Content-Disposition: attachment; filename=\"erudit.xml\"");
         XMLCustomWriter::printXML($doc);
     }
     return true;
 }
コード例 #4
0
ファイル: MetsExportPlugin.inc.php プロジェクト: jalperin/ocs
 function exportSchedConfs(&$conference, &$schedConfIdArray)
 {
     $this->import('MetsExportDom');
     $schedConfDAO =& DAORegistry::getDAO('SchedConfDAO');
     $doc =& XMLCustomWriter::createDocument();
     $root =& XMLCustomWriter::createElement($doc, 'METS:mets');
     XMLCustomWriter::setAttribute($root, 'xmlns:METS', 'http://www.loc.gov/METS/');
     XMLCustomWriter::setAttribute($root, 'xmlns:xlink', 'http://www.w3.org/TR/xlink');
     XMLCustomWriter::setAttribute($root, 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     XMLCustomWriter::setAttribute($root, 'PROFILE', 'Australian METS Profile 1.0');
     XMLCustomWriter::setAttribute($root, 'TYPE', 'conference');
     XMLCustomWriter::setAttribute($root, 'OBJID', 'C-' . $conference->getId());
     XMLCustomWriter::setAttribute($root, 'xsi:schemaLocation', 'http://www.loc.gov/METS/ http://www.loc.gov/mets/mets.xsd');
     $headerNode =& MetsExportDom::createmetsHdr($doc);
     XMLCustomWriter::appendChild($root, $headerNode);
     MetsExportDom::generateConfDmdSecDom($doc, $root, $conference);
     $fileSec =& XMLCustomWriter::createElement($doc, 'METS:fileSec');
     $fileGrp =& XMLCustomWriter::createElement($doc, 'METS:fileGrp');
     XMLCustomWriter::setAttribute($fileGrp, 'USE', 'original');
     $i = 0;
     while ($i < sizeof($schedConfIdArray)) {
         $schedConf =& $schedConfDAO->getSchedConf($schedConfIdArray[$i]);
         MetsExportDom::generateSchedConfDmdSecDom($doc, $root, $conference, $schedConf);
         MetsExportDom::generateSchedConfFileSecDom($doc, $fileGrp, $conference, $schedConf);
         $i++;
     }
     $amdSec =& MetsExportDom::createmetsamdSec($doc, $root, $conference);
     XMLCustomWriter::appendChild($root, $amdSec);
     XMLCustomWriter::appendChild($fileSec, $fileGrp);
     XMLCustomWriter::appendChild($root, $fileSec);
     MetsExportDom::generateConfstructMapWithSchedConfsIdArray($doc, $root, $conference, $schedConfIdArray);
     XMLCustomWriter::appendChild($doc, $root);
     header("Content-Type: application/xml");
     header("Cache-Control: private");
     header("Content-Disposition: attachment; filename=\"" . $conference->getPath() . "-mets.xml\"");
     XMLCustomWriter::printXML($doc);
     return true;
 }
コード例 #5
0
 /**
  * Export a journal's content
  * @param $journal object
  * @param $outputFile string
  */
 function exportJournal(&$journal, $outputFile = null)
 {
     $this->import('DOAJExportDom');
     $doc =& XMLCustomWriter::createDocument();
     $journalNode =& DOAJExportDom::generateJournalDom($doc, $journal);
     $journalNode->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     $journalNode->setAttribute('xsi:noNamespaceSchemaLocation', DOAJ_XSD_URL);
     XMLCustomWriter::appendChild($doc, $journalNode);
     if (!empty($outputFile)) {
         if (($h = fopen($outputFile, 'wb')) === false) {
             return false;
         }
         fwrite($h, XMLCustomWriter::getXML($doc));
         fclose($h);
     } else {
         header("Content-Type: application/xml");
         header("Cache-Control: private");
         header("Content-Disposition: attachment; filename=\"journal-" . $journal->getId() . ".xml\"");
         XMLCustomWriter::printXML($doc);
     }
     return true;
 }
コード例 #6
0
 function exportArticles(&$results, $outputFile = null)
 {
     $this->import('NativeExportDom');
     $doc =& XMLCustomWriter::createDocument('articles', NATIVE_DTD_ID, NATIVE_DTD_URL);
     $articlesNode =& XMLCustomWriter::createElement($doc, 'articles');
     XMLCustomWriter::appendChild($doc, $articlesNode);
     foreach ($results as $result) {
         $article =& $result['publishedArticle'];
         $section =& $result['section'];
         $issue =& $result['issue'];
         $journal =& $result['journal'];
         $articleNode =& NativeExportDom::generateArticleDom($doc, $journal, $issue, $section, $article);
         XMLCustomWriter::appendChild($articlesNode, $articleNode);
     }
     if (!empty($outputFile)) {
         if (($h = fopen($outputFile, 'w')) === false) {
             return false;
         }
         fwrite($h, XMLCustomWriter::getXML($doc));
         fclose($h);
     } else {
         header("Content-Type: application/xml");
         header("Cache-Control: private");
         header("Content-Disposition: attachment; filename=\"articles.xml\"");
         XMLCustomWriter::printXML($doc);
     }
     return true;
 }
コード例 #7
0
 function exportIssues(&$journal, &$issues)
 {
     $this->import('MetsExportDom');
     $doc =& XMLCustomWriter::createDocument('', null);
     $root =& XMLCustomWriter::createElement($doc, 'METS:mets');
     XMLCustomWriter::setAttribute($root, 'xmlns:METS', 'http://www.loc.gov/METS/');
     XMLCustomWriter::setAttribute($root, 'xmlns:xlink', 'http://www.w3.org/TR/xlink');
     XMLCustomWriter::setAttribute($root, 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     XMLCustomWriter::setAttribute($root, 'PROFILE', 'Australian METS Profile 1.0');
     XMLCustomWriter::setAttribute($root, 'TYPE', 'journal');
     XMLCustomWriter::setAttribute($root, 'OBJID', 'J-' . $journal->getJournalId());
     XMLCustomWriter::setAttribute($root, 'xsi:schemaLocation', 'http://www.loc.gov/METS/ http://www.loc.gov/mets/mets.xsd');
     $HeaderNode =& MetsExportDom::createmetsHdr($doc);
     XMLCustomWriter::appendChild($root, $HeaderNode);
     MetsExportDom::generateJournalDmdSecDom($doc, $root, $journal);
     $fileSec =& XMLCustomWriter::createElement($doc, 'METS:fileSec');
     $fileGrpOriginal =& XMLCustomWriter::createElement($doc, 'METS:fileGrp');
     XMLCustomWriter::setAttribute($fileGrpOriginal, 'USE', 'original');
     $fileGrpDerivative =& XMLCustomWriter::createElement($doc, 'METS:fileGrp');
     XMLCustomWriter::setAttribute($fileGrpDerivative, 'USE', 'derivative');
     foreach ($issues as $issue) {
         MetsExportDom::generateIssueDmdSecDom($doc, $root, $issue, $journal);
         MetsExportDom::generateIssueFileSecDom($doc, $fileGrpOriginal, $issue);
         MetsExportDom::generateIssueHtmlGalleyFileSecDom($doc, $fileGrpDerivative, $issue);
     }
     $amdSec =& MetsExportDom::createmetsamdSec($doc, $root, $journal);
     XMLCustomWriter::appendChild($root, $amdSec);
     XMLCustomWriter::appendChild($fileSec, $fileGrpOriginal);
     XMLCustomWriter::appendChild($fileSec, $fileGrpDerivative);
     XMLCustomWriter::appendChild($root, $fileSec);
     MetsExportDom::generateStructMap($doc, $root, $journal, $issues);
     XMLCustomWriter::appendChild($doc, $root);
     header("Content-Type: application/xml");
     header("Cache-Control: private");
     header("Content-Disposition: attachment; filename=\"" . $journal->getPath() . "-mets.xml\"");
     XMLCustomWriter::printXML($doc);
     return true;
 }
コード例 #8
0
 function exportIssues(&$journal, &$issues, $outputFile = null)
 {
     $this->import('PubMedExportDom');
     $doc =& PubMedExportDom::generatePubMedDom();
     $articleSetNode =& PubMedExportDom::generateArticleSetDom($doc);
     $sectionDao = DAORegistry::getDAO('SectionDAO');
     $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
     foreach ($issues as $issue) {
         foreach ($sectionDao->getByIssueId($issue->getId()) as $section) {
             foreach ($publishedArticleDao->getPublishedArticlesBySectionId($section->getId(), $issue->getId()) as $article) {
                 $articleNode = PubMedExportDom::generateArticleDom($doc, $journal, $issue, $section, $article);
                 XMLCustomWriter::appendChild($articleSetNode, $articleNode);
             }
         }
     }
     if (!empty($outputFile)) {
         if (($h = fopen($outputFile, 'w')) === false) {
             return false;
         }
         fwrite($h, XMLCustomWriter::getXML($doc));
         fclose($h);
     } else {
         header("Content-Type: application/xml");
         header("Cache-Control: private");
         header("Content-Disposition: attachment; filename=\"pubmed.xml\"");
         XMLCustomWriter::printXML($doc);
     }
     return true;
 }
コード例 #9
0
 function exportPapers(&$results, $outputFile = null)
 {
     $this->import('NativeExportDom');
     $doc =& XMLCustomWriter::createDocument('papers', NATIVE_DTD_ID, NATIVE_DTD_URL);
     $papersNode =& XMLCustomWriter::createElement($doc, 'papers');
     XMLCustomWriter::appendChild($doc, $papersNode);
     foreach ($results as $result) {
         $paper =& $result['publishedPaper'];
         $track =& $result['track'];
         $conference =& $result['conference'];
         $schedConf =& $result['schedConf'];
         $paperNode =& NativeExportDom::generatePaperDom($doc, $schedConf, $track, $paper);
         XMLCustomWriter::appendChild($papersNode, $paperNode);
     }
     if (!empty($outputFile)) {
         if (($h = fopen($outputFile, 'w')) === false) {
             return false;
         }
         fwrite($h, XMLCustomWriter::getXML($doc));
         fclose($h);
     } else {
         header("Content-Type: application/xml");
         header("Cache-Control: private");
         header("Content-Disposition: attachment; filename=\"papers.xml\"");
         XMLCustomWriter::printXML($doc);
     }
     return true;
 }
コード例 #10
0
 function exportIssues(&$journal, &$issues, $outputFile = null)
 {
     $this->import('CrossRefExportDom');
     $doc =& CrossRefExportDom::generateCrossRefDom();
     $doiBatchNode =& CrossRefExportDom::generateDoiBatchDom($doc);
     $journal =& Request::getJournal();
     // Create Head Node and all parts inside it
     $head =& CrossRefExportDom::generateHeadDom($doc, $journal);
     // attach it to the root node
     XMLCustomWriter::appendChild($doiBatchNode, $head);
     $bodyNode =& XMLCustomWriter::createElement($doc, 'body');
     XMLCustomWriter::appendChild($doiBatchNode, $bodyNode);
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     foreach ($issues as $issue) {
         foreach ($sectionDao->getSectionsForIssue($issue->getId()) as $section) {
             foreach ($publishedArticleDao->getPublishedArticlesBySectionId($section->getId(), $issue->getId()) as $article) {
                 // Create the metadata node
                 // this does not need to be repeated for every article
                 // but its allowed to be and its simpler to do so
                 $journalNode =& XMLCustomWriter::createElement($doc, 'journal');
                 $journalMetadataNode =& CrossRefExportDom::generateJournalMetadataDom($doc, $journal);
                 XMLCustomWriter::appendChild($journalNode, $journalMetadataNode);
                 $journalIssueNode =& CrossRefExportDom::generateJournalIssueDom($doc, $journal, $issue, $section, $article);
                 XMLCustomWriter::appendChild($journalNode, $journalIssueNode);
                 // Article node
                 $journalArticleNode =& CrossRefExportDom::generateJournalArticleDom($doc, $journal, $issue, $section, $article);
                 XMLCustomWriter::appendChild($journalNode, $journalArticleNode);
                 // DOI data node
                 $DOIdataNode =& CrossRefExportDom::generateDOIdataDom($doc, $article->getDOI(), Request::url(null, 'article', 'view', $article->getId()));
                 XMLCustomWriter::appendChild($journalArticleNode, $DOIdataNode);
                 XMLCustomWriter::appendChild($bodyNode, $journalNode);
             }
         }
     }
     // dump out results
     if (!empty($outputFile)) {
         if (($h = fopen($outputFile, 'w')) === false) {
             return false;
         }
         fwrite($h, XMLCustomWriter::getXML($doc));
         fclose($h);
     } else {
         header("Content-Type: application/xml");
         header("Cache-Control: private");
         header("Content-Disposition: attachment; filename=\"crossref.xml\"");
         XMLCustomWriter::printXML($doc);
     }
     return true;
 }
 /**
  * Export public identifiers of one or more issues.
  * @param $journal object
  * @param $issues array
  * @param $outputFile xml file containing the exported public identifiers
  */
 function exportPubIdsForIssues($journal, $issues, $outputFile = null)
 {
     $doc =& XMLCustomWriter::createDocument('pubIds', PID_DTD_URL, PID_DTD_URL);
     $pubIdsNode =& XMLCustomWriter::createElement($doc, 'pubIds');
     XMLCustomWriter::appendChild($doc, $pubIdsNode);
     foreach ($issues as $issue) {
         $this->generatePubId($doc, $pubIdsNode, $issue, $journal->getId());
         $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
         foreach ($publishedArticleDao->getPublishedArticles($issue->getId()) as $publishedArticle) {
             $this->generatePubId($doc, $pubIdsNode, $publishedArticle, $journal->getId());
             $articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
             $galleys = $articleGalleyDao->getBySubmissionId($publishedArticle->getId());
             while ($galley = $galleys->next()) {
                 $this->generatePubId($doc, $pubIdsNode, $galley, $journal->getId());
             }
         }
     }
     if (!empty($outputFile)) {
         if (($h = fopen($outputFile, 'w')) === false) {
             return false;
         }
         fwrite($h, XMLCustomWriter::getXML($doc));
         fclose($h);
     } else {
         header("Content-Type: application/xml");
         header("Cache-Control: private");
         header("Content-Disposition: attachment; filename=\"pubIds.xml\"");
         XMLCustomWriter::printXML($doc);
     }
     return true;
 }
コード例 #12
0
ファイル: NLMExportPlugin.inc.php プロジェクト: jalperin/ocs
 function exportPapers(&$results, $outputFile = null)
 {
     $this->import('NLMExportDom');
     $doc =& NLMExportDom::generateNLMDom();
     $paperSetNode =& NLMExportDom::generatePaperSetDom($doc);
     foreach ($results as $result) {
         $conference =& $result['conference'];
         $track =& $result['track'];
         $paper =& $result['publishedPaper'];
         $paperNode =& NLMExportDom::generatePaperDom($doc, $conference, $track, $paper);
         XMLCustomWriter::appendChild($paperSetNode, $paperNode);
     }
     if (!empty($outputFile)) {
         if (($h = fopen($outputFile, 'w')) === false) {
             return false;
         }
         fwrite($h, XMLCustomWriter::getXML($doc));
         fclose($h);
     } else {
         header("Content-Type: application/xml");
         header("Cache-Control: private");
         header("Content-Disposition: attachment; filename=\"nlm.xml\"");
         XMLCustomWriter::printXML($doc);
         //echo '<pre>'.htmlentities(preg_replace('/></', ">\n<", XMLCustomWriter::getXML($doc))).'</pre>';
     }
     return true;
 }
コード例 #13
0
 /**
  * Handle fetch requests for this plugin.
  */
 function fetch($args)
 {
     if (!$this->getEnabled()) {
         return false;
     }
     if (empty($args)) {
         $errors = array();
         $pages = null;
         $publisherList =& $this->getPublisherList($pages, $errors);
         if ($publisherList) {
             header('Content-Type: application/xml');
             XMLCustomWriter::printXML($publisherList);
             return true;
         }
     } else {
         $errors = array();
         $pageNum = (int) array_shift($args);
         $metadataPage =& $this->getMetadataPage($pageNum, $errors);
         if ($metadataPage) {
             header('Content-Type: application/xml');
             XMLCustomWriter::printXML($metadataPage);
             return true;
         }
     }
     // Failure.
     header("HTTP/1.0 500 Internal Server Error");
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('message', 'plugins.gateways.googleScholar.errors.errorMessage');
     $templateMgr->display('common/message.tpl');
     exit;
 }
コード例 #14
0
 /**
  * Export the selected email templates as XML
  * @param $args array
  * @@param $request PKPRequest
  */
 function exportEmails($args, $request)
 {
     $this->validate();
     import('lib.pkp.classes.xml.XMLCustomWriter');
     $selectedEmailKeys = (array) $request->getUserVar('tplId');
     if (empty($selectedEmailKeys)) {
         $request->redirect(null, null, 'emails');
     }
     $journal = Request::getJournal();
     $doc = XMLCustomWriter::createDocument();
     $emailTexts = XMLCustomWriter::createElement($doc, 'email_texts');
     $emailTexts->setAttribute('locale', AppLocale::getLocale());
     $emailTexts->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     $emailTemplateDao = DAORegistry::getDAO('EmailTemplateDAO');
     $emailTemplates = $emailTemplateDao->getEmailTemplates(AppLocale::getLocale(), $journal->getId());
     foreach ($emailTemplates as $emailTemplate) {
         $emailKey = $emailTemplate->getData('emailKey');
         if (!in_array($emailKey, $selectedEmailKeys)) {
             continue;
         }
         $subject = $emailTemplate->getData('subject');
         $body = $emailTemplate->getData('body');
         $emailTextNode = XMLCustomWriter::createElement($doc, 'email_text');
         XMLCustomWriter::setAttribute($emailTextNode, 'key', $emailKey);
         //append subject node
         $subjectNode = XMLCustomWriter::createChildWithText($doc, $emailTextNode, 'subject', $subject, false);
         XMLCustomWriter::appendChild($emailTextNode, $subjectNode);
         //append body node
         $bodyNode = XMLCustomWriter::createChildWithText($doc, $emailTextNode, 'body', $body, false);
         XMLCustomWriter::appendChild($emailTextNode, $bodyNode);
         //append email_text node
         XMLCustomWriter::appendChild($emailTexts, $emailTextNode);
     }
     XMLCustomWriter::appendChild($doc, $emailTexts);
     header("Content-Type: application/xml");
     header("Cache-Control: private");
     header("Content-Disposition: attachment; filename=\"email-templates-" . date('Y-m-d-H-i-s') . ".xml\"");
     XMLCustomWriter::printXML($doc);
 }
コード例 #15
0
 /**
  * Export a journal's content
  * @param $journal object
  * @param $outputFile string
  */
 function exportJournal(&$journal, $outputFile = null)
 {
     $this->import('DOAJExportDom');
     $doc =& XMLCustomWriter::createDocument('journal', DOAJ_XSD_URL);
     $journalNode =& DOAJExportDom::generateJournalDom($doc, $journal);
     XMLCustomWriter::appendChild($doc, $journalNode);
     if (!empty($outputFile)) {
         if (($h = fopen($outputFile, 'wb')) === false) {
             return false;
         }
         fwrite($h, XMLCustomWriter::getXML($doc));
         fclose($h);
     } else {
         header("Content-Type: application/xml");
         header("Cache-Control: private");
         header("Content-Disposition: attachment; filename=\"journal-" . $journal->getJournalId() . ".xml\"");
         XMLCustomWriter::printXML($doc);
     }
     return true;
 }