• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP XMLCustomWriter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中XMLCustomWriter的典型用法代码示例。如果您正苦于以下问题:PHP XMLCustomWriter类的具体用法?PHP XMLCustomWriter怎么用?PHP XMLCustomWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了XMLCustomWriter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: switch

 function &generateSuppFileDom(&$doc, &$journal, &$issue, &$article, &$suppFile)
 {
     $root =& XMLCustomWriter::createElement($doc, 'supplemental_file');
     // FIXME: These should be constants!
     switch ($suppFile->getType()) {
         case Locale::translate('author.submit.suppFile.researchInstrument'):
             $suppFileType = 'research_instrument';
             break;
         case Locale::translate('author.submit.suppFile.researchMaterials'):
             $suppFileType = 'research_materials';
             break;
         case Locale::translate('author.submit.suppFile.researchResults'):
             $suppFileType = 'research_results';
             break;
         case Locale::translate('author.submit.suppFile.transcripts'):
             $suppFileType = 'transcripts';
             break;
         case Locale::translate('author.submit.suppFile.dataAnalysis'):
             $suppFileType = 'data_analysis';
             break;
         case Locale::translate('author.submit.suppFile.dataSet'):
             $suppFileType = 'data_set';
             break;
         case Locale::translate('author.submit.suppFile.sourceText'):
             $suppFileType = 'source_text';
             break;
         default:
             $suppFileType = 'other';
             break;
     }
     XMLCustomWriter::setAttribute($root, 'type', $suppFileType);
     XMLCustomWriter::setAttribute($root, 'public_id', $suppFile->getPublicSuppFileId(), false);
     XMLCustomWriter::setAttribute($root, 'language', $suppFile->getLanguage(), false);
     if (is_array($suppFile->getTitle(null))) {
         foreach ($suppFile->getTitle(null) as $locale => $title) {
             $titleNode =& XMLCustomWriter::createChildWithText($doc, $root, 'title', $title, false);
             if ($titleNode) {
                 XMLCustomWriter::setAttribute($titleNode, 'locale', $locale);
             }
             unset($titleNode);
         }
     }
     if (is_array($suppFile->getCreator(null))) {
         foreach ($suppFile->getCreator(null) as $locale => $creator) {
             $creatorNode =& XMLCustomWriter::createChildWithText($doc, $root, 'creator', $creator, false);
             if ($creatorNode) {
                 XMLCustomWriter::setAttribute($creatorNode, 'locale', $locale);
             }
             unset($creatorNode);
         }
     }
     if (is_array($suppFile->getSubject(null))) {
         foreach ($suppFile->getSubject(null) as $locale => $subject) {
             $subjectNode =& XMLCustomWriter::createChildWithText($doc, $root, 'subject', $subject, false);
             if ($subjectNode) {
                 XMLCustomWriter::setAttribute($subjectNode, 'locale', $locale);
             }
             unset($subjectNode);
         }
     }
     if ($suppFileType == 'other') {
         if (is_array($suppFile->getTypeOther(null))) {
             foreach ($suppFile->getTypeOther(null) as $locale => $typeOther) {
                 $typeOtherNode =& XMLCustomWriter::createChildWithText($doc, $root, 'type_other', $typeOther, false);
                 if ($typeOtherNode) {
                     XMLCustomWriter::setAttribute($typeOtherNode, 'locale', $locale);
                 }
                 unset($typeOtherNode);
             }
         }
     }
     if (is_array($suppFile->getDescription(null))) {
         foreach ($suppFile->getDescription(null) as $locale => $description) {
             $descriptionNode =& XMLCustomWriter::createChildWithText($doc, $root, 'description', $description, false);
             if ($descriptionNode) {
                 XMLCustomWriter::setAttribute($descriptionNode, 'locale', $locale);
             }
             unset($descriptionNode);
         }
     }
     if (is_array($suppFile->getPublisher(null))) {
         foreach ($suppFile->getPublisher(null) as $locale => $publisher) {
             $publisherNode =& XMLCustomWriter::createChildWithText($doc, $root, 'publisher', $publisher, false);
             if ($publisherNode) {
                 XMLCustomWriter::setAttribute($publisherNode, 'locale', $locale);
             }
             unset($publisherNode);
         }
     }
     if (is_array($suppFile->getSponsor(null))) {
         foreach ($suppFile->getSponsor(null) as $locale => $sponsor) {
             $sponsorNode =& XMLCustomWriter::createChildWithText($doc, $root, 'sponsor', $sponsor, false);
             if ($sponsorNode) {
                 XMLCustomWriter::setAttribute($sponsorNode, 'locale', $locale);
             }
             unset($sponsorNode);
         }
     }
     XMLCustomWriter::createChildWithText($doc, $root, 'date_created', NativeExportDom::formatDate($suppFile->getDateCreated()), false);
     if (is_array($suppFile->getSource(null))) {
//.........这里部分代码省略.........
开发者ID:Jouper,项目名称:jouper,代码行数:101,代码来源:NativeExportDom.inc.php


示例2: foreach

 /**
  * Create a description text element.
  *
  * @param $workOrProduct string
  * @param $relationCode string One of the O4DOI_RELATION_* constants.
  * @param $ids array
  *
  * @return XMLNode|DOMImplementation
  */
 function &_relationElement($workOrProduct, $relationCode, $ids)
 {
     $relationElement =& XMLCustomWriter::createElement($this->getDoc(), "Related{$workOrProduct}");
     // Relation code (mandatory)
     XMLCustomWriter::createChildWithText($this->getDoc(), $relationElement, 'RelationCode', $relationCode);
     // Work/Product ID (mandatory)
     foreach ($ids as $idType => $id) {
         XMLCustomWriter::appendChild($relationElement, $this->_idElement($workOrProduct, $idType, $id));
     }
     return $relationElement;
 }
开发者ID:reconciler,项目名称:ojs,代码行数:20,代码来源:O4DOIExportDom.inc.php


示例3:

 function &createChildWithText(&$doc, &$node, $name, $value, $appendIfEmpty = true)
 {
     $childNode = null;
     if ($appendIfEmpty || $value != '') {
         $childNode =& XMLCustomWriter::createElement($doc, $name);
         $textNode =& XMLCustomWriter::createTextNode($doc, $value);
         XMLCustomWriter::appendChild($childNode, $textNode);
         XMLCustomWriter::appendChild($node, $childNode);
     }
     return $childNode;
 }
开发者ID:LiteratimBi,项目名称:jupitertfn,代码行数:11,代码来源:XMLCustomWriter.inc.php


示例4: exportArticles

 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;
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:28,代码来源:NativeImportExportPlugin.inc.php


示例5: array

 /**
  * Create an XML element with a text node.
  *
  * FIXME: Move this to XMLCustomWriter? I leave the decision up to PKP...
  *
  * @param $name string
  * @param $value string
  * @param $attributes array An array with the attribute names as array
  *  keys and attribute values as array values.
  *
  * @return XMLNode|DOMImplementation
  */
 function &createElementWithText($name, $value, $attributes = array())
 {
     $element =& XMLCustomWriter::createElement($this->getDoc(), $name);
     $elementContent =& XMLCustomWriter::createTextNode($this->getDoc(), String::html2text($value));
     XMLCustomWriter::appendChild($element, $elementContent);
     foreach ($attributes as $attributeName => $attributeValue) {
         XMLCustomWriter::setAttribute($element, $attributeName, $attributeValue);
     }
     return $element;
 }
开发者ID:jalperin,项目名称:ojs,代码行数:22,代码来源:DOIExportDom.inc.php


示例6: date

 function &generatePubDateDom(&$doc, $pubdate, $pubstatus)
 {
     $root =& XMLCustomWriter::createElement($doc, 'PubDate');
     XMLCustomWriter::setAttribute($root, 'PubStatus', $pubstatus);
     XMLCustomWriter::createChildWithText($doc, $root, 'Year', date('Y', strtotime($pubdate)));
     XMLCustomWriter::createChildWithText($doc, $root, 'Month', date('m', strtotime($pubdate)), false);
     XMLCustomWriter::createChildWithText($doc, $root, 'Day', date('d', strtotime($pubdate)), false);
     return $root;
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:9,代码来源:PubMedExportDom.inc.php


示例7: date

 /**
  *  Create METS:metsHdr for export
  */
 function &createmetsHdr($doc)
 {
     $root =& XMLCustomWriter::createElement($doc, 'METS:metsHdr');
     XMLCustomWriter::setAttribute($root, 'CREATEDATE', date('c'));
     XMLCustomWriter::setAttribute($root, 'LASTMODDATE', date('c'));
     $agentNode =& XMLCustomWriter::createElement($doc, 'METS:agent');
     XMLCustomWriter::setAttribute($agentNode, 'ROLE', 'DISSEMINATOR');
     XMLCustomWriter::setAttribute($agentNode, 'TYPE', 'ORGANIZATION');
     $organization = Request::getUserVar('organization');
     if ($organization == '') {
         $siteDao =& DAORegistry::getDAO('SiteDAO');
         $site = $siteDao->getSite();
         $organization = $site->getLocalizedTitle();
     }
     XMLCustomWriter::createChildWithText($doc, $agentNode, 'METS:name', $organization, false);
     XMLCustomWriter::appendChild($root, $agentNode);
     $agentNode2 =& XMLCustomWriter::createElement($doc, 'METS:agent');
     XMLCustomWriter::setAttribute($agentNode2, 'ROLE', 'CREATOR');
     XMLCustomWriter::setAttribute($agentNode2, 'TYPE', 'OTHER');
     XMLCustomWriter::createChildWithText($doc, $agentNode2, 'METS:name', MetsExportDom::getCreatorString(), false);
     XMLCustomWriter::appendChild($root, $agentNode2);
     return $root;
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:26,代码来源:MetsExportDom.inc.php


示例8: exportIssues

 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;
 }
开发者ID:philschatz,项目名称:ojs,代码行数:50,代码来源:CrossRefExportPlugin.inc.php


示例9: _createUrlTree

 /**
  * Create a url entry with children
  * @param $doc XMLNode Reference to the XML document object
  * @param $loc string URL of page (required)
  * @param $lastmod string Last modification date of page (optional)
  * @param $changefreq Frequency of page modifications (optional)
  * @param $priority string Subjective priority assesment of page (optional) 
  * @return XMLNode
  */
 function _createUrlTree(&$doc, $loc, $lastmod = null, $changefreq = null, $priority = null)
 {
     $url =& XMLCustomWriter::createElement($doc, 'url');
     XMLCustomWriter::createChildWithText($doc, $url, htmlentities('loc'), $loc, false);
     XMLCustomWriter::createChildWithText($doc, $url, 'lastmod', $lastmod, false);
     XMLCustomWriter::createChildWithText($doc, $url, 'changefreq', $changefreq, false);
     XMLCustomWriter::createChildWithText($doc, $url, 'priority', $priority, false);
     return $url;
 }
开发者ID:mariojp,项目名称:ojs,代码行数:18,代码来源:SitemapHandler.inc.php


示例10: trim

 function &generateAuthorDom(&$doc, &$author)
 {
     $root =& XMLCustomWriter::createElement($doc, 'Author');
     $foreName = trim($author->getFirstName() . ' ' . $author->getMiddleName());
     XMLCustomWriter::createChildWithText($doc, $root, 'LastName', ucfirst($author->getLastName()));
     XMLCustomWriter::createChildWithText($doc, $root, 'ForeName', ucwords($foreName));
     return $root;
 }
开发者ID:ramonsodoma,项目名称:ocs,代码行数:8,代码来源:NLMExportDom.inc.php


示例11: strtotime

 /**
  * Generate publisher date - order matters
  * @param $doc XMLNode
  * @param $pubdate string
  * @return XMLNode
  */
 function &_generatePublisherDateDom(&$doc, $pubdate)
 {
     $publicationDateNode =& XMLCustomWriter::createElement($doc, 'publication_date');
     XMLCustomWriter::setAttribute($publicationDateNode, 'media_type', 'online');
     $parsedPubdate = strtotime($pubdate);
     XMLCustomWriter::createChildWithText($doc, $publicationDateNode, 'year', date('Y', $parsedPubdate));
     return $publicationDateNode;
 }
开发者ID:ulsdevteam,项目名称:EzidDOI,代码行数:14,代码来源:EzidExportDom.inc.php


示例12: generatePubId

 /**
  * Add ID-nodes to the given node.
  * @param $doc DOMDocument
  * @param $node DOMNode
  * @param $pubObject object
  * @param $journalId int
  */
 function generatePubId(&$doc, &$node, &$pubObject, $journalId)
 {
     $pubIdPlugins =& PluginRegistry::loadCategory('pubIds', true, $journalId);
     foreach ($pubIdPlugins as $pubIdPlugin) {
         $pubIdType = $pubIdPlugin->getPubIdType();
         $pubId = $pubObject->getStoredPubId($pubIdType);
         if ($pubId) {
             $pubObjectType = $pubIdPlugin->getPubObjectType($pubObject);
             $pubIdNode =& XMLCustomWriter::createChildWithText($doc, $node, 'pubId', $pubId);
             XMLCustomWriter::setAttribute($pubIdNode, 'pubIdType', $pubIdType);
             XMLCustomWriter::setAttribute($pubIdNode, 'pubObjectType', $pubObjectType);
             XMLCustomWriter::setAttribute($pubIdNode, 'pubObjectId', $pubObject->getId());
         }
     }
 }
开发者ID:relaciones-internacionales-journal,项目名称:ojs,代码行数:22,代码来源:PubIdImportExportPlugin.inc.php


示例13: generatePubId

 /**
  * Add ID-nodes to the given node.
  * @param $doc DOMDocument
  * @param $node DOMNode
  * @param $pubObject object
  * @param $issue Issue
  */
 function generatePubId(&$doc, &$node, &$pubObject, &$issue)
 {
     $pubIdPlugins =& PluginRegistry::loadCategory('pubIds', true, $issue->getJournalId());
     if (is_array($pubIdPlugins)) {
         foreach ($pubIdPlugins as $pubIdPlugin) {
             if ($issue->getPublished()) {
                 $pubId = $pubIdPlugin->getPubId($pubObject);
             } else {
                 $pubId = $pubIdPlugin->getPubId($pubObject, true);
             }
             if ($pubId) {
                 $pubIdType = $pubIdPlugin->getPubIdType();
                 $idNode =& XMLCustomWriter::createChildWithText($doc, $node, 'id', $pubId);
                 XMLCustomWriter::setAttribute($idNode, 'type', $pubIdType);
             }
         }
     }
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:25,代码来源:NativeExportDom.inc.php


示例14: callbackFinish

 /**
  * Index rebuild cleanup: mark select options as clean.
  */
 function callbackFinish($hookName, $args)
 {
     $searchFormElementDao =& DAORegistry::getDAO('SearchFormElementDAO');
     $searchFormElements =& $searchFormElementDao->getSearchFormElements();
     while ($searchFormElement =& $searchFormElements->next()) {
         $searchFormElement->setIsClean(true);
         $searchFormElementDao->updateSearchFormElement($searchFormElement);
         unset($searchFormElement);
     }
     if ($this->isUsingSolr()) {
         import('lib.pkp.classes.xml.XMLCustomWriter');
         $doc =& XMLCustomWriter::createDocument('commit', SOLR_DTD_ID, SOLR_DTD_URL);
         $docNode =& XMLCustomWriter::createElement($doc, 'commit');
         XMLCustomWriter::appendChild($doc, $docNode);
         $this->solrQuery($doc);
         unset($doc);
         $doc =& XMLCustomWriter::createDocument('optimize', SOLR_DTD_ID, SOLR_DTD_URL);
         $docNode =& XMLCustomWriter::createElement($doc, 'optimize');
         XMLCustomWriter::appendChild($doc, $docNode);
         $this->solrQuery($doc);
         unset($doc);
     } else {
         $index =& $this->getIndex();
         $index->optimize();
     }
 }
开发者ID:ramonsodoma,项目名称:harvester,代码行数:29,代码来源:ZendSearchPlugin.inc.php


示例15: current

 /**
  * Generate the author export DOM tree.
  * @param $doc object DOM object
  * @param $journal object Journal
  * @param $issue object Issue
  * @param $article object Article
  * @param $author object Author
  * @param $affilList array List of author affiliations
  */
 function &generateAuthorDom(&$doc, &$journal, &$issue, &$article, &$author, &$affilList)
 {
     $root =& XMLCustomWriter::createElement($doc, 'author');
     XMLCustomWriter::createChildWithText($doc, $root, 'name', $author->getFullName());
     XMLCustomWriter::createChildWithText($doc, $root, 'email', $author->getEmail(), false);
     if (in_array($author->getLocalizedAffiliation(), $affilList) && !empty($affilList[0])) {
         XMLCustomWriter::createChildWithText($doc, $root, 'affiliationId', current(array_keys($affilList, $author->getLocalizedAffiliation())));
     }
     return $root;
 }
开发者ID:reconciler,项目名称:ojs,代码行数:19,代码来源:DOAJExportDom.inc.php


示例16: _appendNonMandatoryChild

 /**
  * Datacite does not allow empty nodes. So we have to
  * check nodes before we add them.
  * @param $parentNode XmlNode|DOMElement
  * @param $child XmlNode|DOMElement
  */
 function _appendNonMandatoryChild(&$parentNode, &$child)
 {
     if (is_a($child, 'XMLNode')) {
         $childChildren = $child->getChildren();
         $childEmpty = empty($childChildren);
     } else {
         $childEmpty = !$child->hasChildNodes();
     }
     if ($childEmpty) {
         return;
     }
     XMLCustomWriter::appendChild($parentNode, $child);
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:19,代码来源:DataciteExportDom.inc.php


示例17: exportIssues

 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;
 }
开发者ID:mosvits,项目名称:ojs,代码行数:29,代码来源:PubMedExportPlugin.inc.php


示例18: exportPapers

 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;
 }
开发者ID:artkuo,项目名称:ocs,代码行数:28,代码来源:NativeImportExportPlugin.inc.php


示例19: foreach

 function &exportUsers(&$journal, &$users, $allowedRoles = null)
 {
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $doc =& XMLCustomWriter::createDocument('users', USERS_DTD_ID, USERS_DTD_URL);
     $root =& XMLCustomWriter::createElement($doc, 'users');
     foreach ($users as $user) {
         $userNode =& XMLCustomWriter::createElement($doc, 'user');
         XMLCustomWriter::createChildWithText($doc, $userNode, 'username', $user->getUserName(), false);
         $passwordNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'password', $user->getPassword());
         XMLCustomWriter::setAttribute($passwordNode, 'encrypted', Config::getVar('security', 'encryption'));
         XMLCustomWriter::createChildWithText($doc, $userNode, 'salutation', $user->getSalutation(), false);
         XMLCustomWriter::createChildWithText($doc, $userNode, 'first_name', $user->getFirstName());
         XMLCustomWriter::createChildWithText($doc, $userNode, 'middle_name', $user->getMiddleName(), false);
         XMLCustomWriter::createChildWithText($doc, $userNode, 'last_name', $user->getLastName());
         XMLCustomWriter::createChildWithText($doc, $userNode, 'initials', $user->getInitials(), false);
         XMLCustomWriter::createChildWithText($doc, $userNode, 'gender', $user->getGender(), false);
         XMLCustomWriter::createChildWithText($doc, $userNode, 'email', $user->getEmail());
         XMLCustomWriter::createChildWithText($doc, $userNode, 'url', $user->getUrl(), false);
         XMLCustomWriter::createChildWithText($doc, $userNode, 'phone', $user->getPhone(), false);
         XMLCustomWriter::createChildWithText($doc, $userNode, 'fax', $user->getFax(), false);
         XMLCustomWriter::createChildWithText($doc, $userNode, 'mailing_address', $user->getMailingAddress(), false);
         XMLCustomWriter::createChildWithText($doc, $userNode, 'country', $user->getCountry(), false);
         if (is_array($user->getAffiliation(null))) {
             foreach ($user->getAffiliation(null) as $locale => $value) {
                 $affiliationNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'affiliation', $value, false);
                 if ($affiliationNode) {
                     XMLCustomWriter::setAttribute($affiliationNode, 'locale', $locale);
                 }
                 unset($affiliationNode);
             }
         }
         if (is_array($user->getSignature(null))) {
             foreach ($user->getSignature(null) as $locale => $value) {
                 $signatureNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'signature', $value, false);
                 if ($signatureNode) {
                     XMLCustomWriter::setAttribute($signatureNode, 'locale', $locale);
                 }
                 unset($signatureNode);
             }
         }
         $interestsNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'interests', $user->getInterests(), false);
         if ($interestsNode) {
             XMLCustomWriter::setAttribute($interestsNode, 'locale', $locale);
         }
         if (is_array($user->getGossip(null))) {
             foreach ($user->getGossip(null) as $locale => $value) {
                 $gossipNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'gossip', $value, false);
                 if ($gossipNode) {
                     XMLCustomWriter::setAttribute($gossipNode, 'locale', $locale);
                 }
                 unset($gossipNode);
             }
         }
         if (is_array($user->getBiography(null))) {
             foreach ($user->getBiography(null) as $locale => $value) {
                 $biographyNode =& XMLCustomWriter::createChildWithText($doc, $userNode, 'biography', $value, false);
                 if ($biographyNode) {
                     XMLCustomWriter::setAttribute($biographyNode, 'locale', $locale);
                 }
                 unset($biographyNode);
             }
         }
         XMLCustomWriter::createChildWithText($doc, $userNode, 'locales', join(':', $user->getLocales()), false);
         $roles =& $roleDao->getRolesByUserId($user->getId(), $journal->getId());
         foreach ($roles as $role) {
             $rolePath = $role->getRolePath();
             if ($allowedRoles !== null && !in_array($rolePath, $allowedRoles)) {
                 continue;
             }
             $roleNode =& XMLCustomWriter::createElement($doc, 'role');
             XMLCustomWriter::setAttribute($roleNode, 'type', $rolePath);
             XMLCustomWriter::appendChild($userNode, $roleNode);
             unset($roleNode);
         }
         XMLCustomWriter::appendChild($root, $userNode);
     }
     XMLCustomWriter::appendChild($doc, $root);
     return $doc;
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:79,代码来源:UserExportDom.inc.php


示例20: _addArticleXml

 /**
  * Add the metadata XML of a single article to an
  * XML article list.
  *
  * @param $articleDoc DOMDocument
  * @param $article PublishedArticle
  * @param $journal Journal
  * @param $markToDelete boolean If true the returned XML
  *  will only contain a deletion marker.
  */
 function _addArticleXml(&$articleDoc, &$article, &$journal, $markToDelete = false)
 {
     assert(is_a($article, 'Article'));
     // Get the root node of the list.
     assert(is_a($articleDoc, 'DOMDocument'));
     $articleList =& $articleDoc->documentElement;
     // Create a new article node.
     $articleNode =& XMLCustomWriter::createElement($articleDoc, 'article');
     // Add ID information.
     XMLCustomWriter::setAttribute($articleNode, 'id', $article->getId());
     XMLCustomWriter::setAttribute($articleNode, 'sectionId', $article->getSectionId());
     XMLCustomWriter::setAttribute($articleNode, 'journalId', $article->getJournalId());
     XMLCustomWriter::setAttribute($articleNode, 'instId', $this->_instId);
     // Set the load action.
     $loadAction = $markToDelete ? 'delete' : 'replace';
     XMLCustomWriter::setAttribute($articleNode, 'loadAction', $loadAction);
     XMLCustomWriter::appendChild($articleList, $articleNode);
     // The XML for an article marked to be deleted contains no metadata.
     if ($markToDelete) {
         return;
     }
     assert(is_a($article, 'PublishedArticle'));
     // Add authors.
     $authors = $article->getAuthors();
     if (!empty($authors)) {
         $authorList =& XMLCustomWriter::createElement($articleDoc, 'authorList');
         foreach ($authors as $author) {
             /* @var $author Author */
             XMLCustomWriter::createChildWithText($articleDoc, $authorList, 'author', $author->getFullName(true));
         }
         XMLCustomWriter::appendChild($articleNode, $authorList);
     }
     // We need the request to retrieve locales and build URLs.
     $request = PKPApplication::getRequest();
     // Get all supported locales.
     $site = $request->getSite();
     $supportedLocales = $site->getSupportedLocales() + array_keys($journal->getSupportedLocaleNames());
     assert(!empty($supportedLocales));
     // Add titles.
     $titleList =& XMLCustomWriter::createElement($articleDoc, 'titleList');
     // Titles are used for sorting, we therefore need
     // them in all supported locales.
     assert(!empty($supportedLocales));
     foreach ($supportedLocales as $locale) {
         $localizedTitle = $article->getLocalizedTitle($locale);
         if (!is_null($localizedTitle)) {
             // Add the localized title.
             $titleNode =& XMLCustomWriter::createChildWithText($articleDoc, $titleList, 'title', $localizedTitle);
             XMLCustomWriter::setAttribute($titleNode, 'locale', $locale);
             // If the title does not exist in the given locale
             // then use the localized title for sorting only.
             $title = $article->getTitle($locale);
             $sortOnly = empty($title) ? 'true' : 'false';
             XMLCustomWriter::setAttribute($titleNode, 'sortOnly', $sortOnly);
         }
     }
     XMLCustomWriter::appendChild($articleNode, $titleList);
     // Add abstracts.
     $abstracts = $article->getAbstract(null);
     // return all locales
     if (!empty($abstracts)) {
         $abstractList =& XMLCustomWriter::createElement($articleDoc, 'abstractList');
         foreach ($abstracts as $locale => $abstract) {
             $abstractNode =& XMLCustomWriter::createChildWithText($articleDoc, $abstractList, 'abstract', $abstract);
             XMLCustomWriter::setAttribute($abstractNode, 'locale', $locale);
         }
         XMLCustomWriter::appendChild($articleNode, $abstractList);
     }
     // Add discipline.
     $disciplines = $article->getDiscipline(null);
     // return all locales
     if (!empty($disciplines)) {
         $disciplineList =& XMLCustomWriter::createElement($articleDoc, 'disciplineList');
         foreach ($disciplines as $locale => $discipline) {
             $disciplineNode =& XMLCustomWriter::createChildWithText($articleDoc, $disciplineList, 'discipline', $discipline);
             XMLCustomWriter::setAttribute($disciplineNode, 'locale', $locale);
         }
         XMLCustomWriter::appendChild($articleNode, $disciplineList);
     }
     // Add subjects and subject classes.
     $subjectClasses = $article->getSubjectClass(null);
     $subjects = $article->getSubject(null);
     if (!empty($subjectClasses) || !empty($subjects)) {
         $subjectList =& XMLCustomWriter::createElement($articleDoc, 'subjectList');
         if (!is_array($subjectClasses)) {
             $subjectClasses = array();
         }
         if (!is_array($subjects)) {
             $subjects = array();
         }
//.........这里部分代码省略.........
开发者ID:mosvits,项目名称:ojs,代码行数:101,代码来源:SolrWebService.inc.php



注:本文中的XMLCustomWriter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP XMLDAO类代码示例发布时间:2022-05-23
下一篇:
PHP XML2Array类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap