当前位置: 首页>>代码示例>>PHP>>正文


PHP XMLCustomWriter::setAttribute方法代码示例

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


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

示例1: createJournalSitemap

 /**
  * Construct the sitemap
  * @return XMLNode
  */
 function createJournalSitemap()
 {
     $issueDao =& DAORegistry::getDAO('IssueDAO');
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     $doc =& XMLCustomWriter::createDocument();
     $root =& XMLCustomWriter::createElement($doc, 'urlset');
     XMLCustomWriter::setAttribute($root, 'xmlns', SITEMAP_XSD_URL);
     // Journal home
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'index', 'index')));
     // About page
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'about')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'about', 'editorialTeam')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'about', 'editorialPolicies')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'about', 'submissions')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'about', 'siteMap')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'about', 'aboutThisPublishingSystem')));
     // Search
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'search')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'search', 'authors')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'search', 'titles')));
     // Issues
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'issue', 'current')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'issue', 'archive')));
     $publishedIssues =& $issueDao->getPublishedIssues($journalId);
     while ($issue =& $publishedIssues->next()) {
         XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'issue', 'view', $issue->getId())));
         // Articles for issue
         $articles = $publishedArticleDao->getPublishedArticles($issue->getId());
         foreach ($articles as $article) {
             // Abstract
             XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'article', 'view', array($article->getId()))));
             // Galley files
             $galleys = $galleyDao->getGalleysByArticle($article->getId());
             foreach ($galleys as $galley) {
                 XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($journal->getPath(), 'article', 'view', array($article->getId(), $galley->getId()))));
             }
         }
         unset($issue);
     }
     XMLCustomWriter::appendChild($doc, $root);
     return $doc;
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:49,代码来源:SitemapHandler.inc.php

示例2: 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

示例3: 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

示例4: elseif

 /**
  * Generate the DOM tree for a given article.
  * @param $doc object DOM object
  * @param $journal object Journal
  * @param $issue object Issue
  * @param $section object Section
  * @param $article object Article
  */
 function &generateArticleDom(&$doc, &$journal, &$issue, &$section, &$article)
 {
     $root =& XMLCustomWriter::createElement($doc, 'record');
     /* --- Article Language --- */
     XMLCustomWriter::createChildWithText($doc, $root, 'language', DOAJExportDom::mapLang($article->getLanguage()), false);
     /* --- Publisher name (i.e. institution name) --- */
     XMLCustomWriter::createChildWithText($doc, $root, 'publisher', $journal->getSetting('publisherInstitution'), false);
     /* --- Journal's title --- */
     XMLCustomWriter::createChildWithText($doc, $root, 'journalTitle', $journal->getLocalizedTitle(), false);
     /* --- Identification Numbers --- */
     XMLCustomWriter::createChildWithText($doc, $root, 'issn', $journal->getSetting('printIssn'), false);
     XMLCustomWriter::createChildWithText($doc, $root, 'eissn', $journal->getSetting('onlineIssn'), false);
     /* --- Article's publication date, volume, issue, DOI --- */
     XMLCustomWriter::createChildWithText($doc, $root, 'publicationDate', DOAJExportDom::formatDate($issue->getDatePublished()), false);
     XMLCustomWriter::createChildWithText($doc, $root, 'volume', $issue->getVolume(), false);
     XMLCustomWriter::createChildWithText($doc, $root, 'issue', $issue->getNumber(), false);
     /** --- FirstPage / LastPage (from PubMed plugin)---
      * there is some ambiguity for online journals as to what
      * "page numbers" are; for example, some journals (eg. JMIR)
      * use the "e-location ID" as the "page numbers" in PubMed
      */
     $pages = $article->getPages();
     if (preg_match("/([0-9]+)\\s*-\\s*([0-9]+)/i", $pages, $matches)) {
         // simple pagination (eg. "pp. 3-8")
         XMLCustomWriter::createChildWithText($doc, $root, 'startPage', $matches[1]);
         XMLCustomWriter::createChildWithText($doc, $root, 'endPage', $matches[2]);
     } elseif (preg_match("/(e[0-9]+)/i", $pages, $matches)) {
         // elocation-id (eg. "e12")
         XMLCustomWriter::createChildWithText($doc, $root, 'startPage', $matches[1]);
         XMLCustomWriter::createChildWithText($doc, $root, 'endPage', $matches[1]);
     }
     XMLCustomWriter::createChildWithText($doc, $root, 'doi', $article->getPubId('doi'), false);
     /* --- Article's publication date, volume, issue, DOI --- */
     XMLCustomWriter::createChildWithText($doc, $root, 'publisherRecordId', $article->getPublishedArticleId(), false);
     XMLCustomWriter::createChildWithText($doc, $root, 'documentType', $article->getLocalizedType(), false);
     /* --- Article title --- */
     foreach ((array) $article->getTitle(null) as $locale => $title) {
         if (empty($title)) {
             continue;
         }
         $titleNode =& XMLCustomWriter::createChildWithText($doc, $root, 'title', $title);
         if (strlen($locale) == 5) {
             XMLCustomWriter::setAttribute($titleNode, 'language', DOAJExportDom::mapLang(String::substr($locale, 0, 2)));
         }
     }
     /* --- Authors and affiliations --- */
     $authors =& XMLCustomWriter::createElement($doc, 'authors');
     XMLCustomWriter::appendChild($root, $authors);
     $affilList = DOAJExportDom::generateAffiliationsList($article->getAuthors());
     foreach ($article->getAuthors() as $author) {
         $authorNode =& DOAJExportDom::generateAuthorDom($doc, $root, $issue, $article, $author, $affilList);
         XMLCustomWriter::appendChild($authors, $authorNode);
         unset($authorNode);
     }
     if (!empty($affilList[0])) {
         $affils =& XMLCustomWriter::createElement($doc, 'affiliationsList');
         XMLCustomWriter::appendChild($root, $affils);
         for ($i = 0; $i < count($affilList); $i++) {
             $affilNode =& XMLCustomWriter::createChildWithText($doc, $affils, 'affiliationName', $affilList[$i]);
             XMLCustomWriter::setAttribute($affilNode, 'affiliationId', $i);
             unset($affilNode);
         }
     }
     /* --- Abstract --- */
     foreach ((array) $article->getAbstract(null) as $locale => $abstract) {
         if (empty($abstract)) {
             continue;
         }
         $abstractNode =& XMLCustomWriter::createChildWithText($doc, $root, 'abstract', $abstract);
         if (strlen($locale) == 5) {
             XMLCustomWriter::setAttribute($abstractNode, 'language', DOAJExportDom::mapLang(String::substr($locale, 0, 2)));
         }
     }
     /* --- FullText URL --- */
     $fullTextUrl =& XMLCustomWriter::createChildWithText($doc, $root, 'fullTextUrl', Request::url(null, 'article', 'view', $article->getId()));
     XMLCustomWriter::setAttribute($fullTextUrl, 'format', 'html');
     /* --- Keywords --- */
     $keywords =& XMLCustomWriter::createElement($doc, 'keywords');
     XMLCustomWriter::appendChild($root, $keywords);
     $subjects = array_map('trim', explode(';', $article->getLocalizedSubject()));
     foreach ($subjects as $keyword) {
         XMLCustomWriter::createChildWithText($doc, $keywords, 'keyword', $keyword, false);
     }
     return $root;
 }
开发者ID:reconciler,项目名称:ojs,代码行数:93,代码来源:DOAJExportDom.inc.php

示例5: isset

 function &generateArticleDom(&$doc, &$journal, &$issue, &$article, &$galley)
 {
     $unavailableString = Locale::translate('plugins.importexport.erudit.unavailable');
     $root =& XMLCustomWriter::createElement($doc, 'article');
     XMLCustomWriter::setAttribute($root, 'idprop', $journal->getJournalId() . '-' . $issue->getIssueId() . '-' . $article->getArticleId() . '-' . $galley->getGalleyId(), false);
     XMLCustomWriter::setAttribute($root, 'arttype', 'article');
     $lang = $article->getLanguage();
     XMLCustomWriter::setAttribute($root, 'lang', isset($lang) ? $lang : 'en');
     XMLCustomWriter::setAttribute($root, 'processing', 'cart');
     /* --- admin --- */
     $adminNode =& XMLCustomWriter::createElement($doc, 'admin');
     XMLCustomWriter::appendChild($root, $adminNode);
     /* --- articleinfo --- */
     $articleInfoNode =& XMLCustomWriter::createElement($doc, 'articleinfo');
     XMLCustomWriter::appendChild($adminNode, $articleInfoNode);
     // The first public ID should be a full URL to the article.
     $urlIdNode =& XMLCustomWriter::createChildWithText($doc, $articleInfoNode, 'idpublic', Request::url($journal->getPath(), 'article', 'view', array($article->getArticleId(), $galley->getGalleyId())));
     XMLCustomWriter::setAttribute($urlIdNode, 'scheme', 'sici');
     /* --- journal --- */
     $journalNode =& XMLCustomWriter::createElement($doc, 'journal');
     XMLCustomWriter::appendChild($adminNode, $journalNode);
     XMLCustomWriter::setAttribute($journalNode, 'id', 'ojs-' . $journal->getPath());
     XMLCustomWriter::createChildWithText($doc, $journalNode, 'jtitle', $journal->getJournalTitle());
     XMLCustomWriter::createChildWithText($doc, $journalNode, 'jshorttitle', $journal->getLocalizedSetting('initials'), false);
     if (!($printIssn = $journal->getSetting('printIssn'))) {
         $printIssn = $unavailableString;
     }
     XMLCustomWriter::createChildWithText($doc, $journalNode, 'idissn', $printIssn);
     if (!($onlineIssn = $journal->getSetting('onlineIssn'))) {
         $onlineIssn = $unavailableString;
     }
     XMLCustomWriter::createChildWithText($doc, $journalNode, 'iddigissn', $onlineIssn);
     /* --- issue --- */
     $issueNode =& XMLCustomWriter::createElement($doc, 'issue');
     XMLCustomWriter::appendChild($adminNode, $issueNode);
     XMLCustomWriter::setAttribute($issueNode, 'id', 'ojs-' . $issue->getBestIssueId());
     XMLCustomWriter::createChildWithText($doc, $issueNode, 'volume', $issue->getVolume(), false);
     XMLCustomWriter::createChildWithText($doc, $issueNode, 'issueno', $issue->getNumber(), false);
     $pubNode =& XMLCustomWriter::createElement($doc, 'pub');
     XMLCustomWriter::appendChild($issueNode, $pubNode);
     XMLCustomWriter::createChildWithText($doc, $pubNode, 'year', $issue->getYear());
     $digPubNode =& XMLCustomWriter::createElement($doc, 'digpub');
     XMLCustomWriter::appendChild($issueNode, $digPubNode);
     XMLCustomWriter::createChildWithText($doc, $digPubNode, 'date', EruditExportDom::formatDate($issue->getDatePublished()));
     /* --- Publisher & DTD --- */
     $publisherInstitution =& $journal->getSetting('publisherInstitution');
     $publisherNode =& XMLCustomWriter::createElement($doc, 'publisher');
     XMLCustomWriter::setAttribute($publisherNode, 'id', 'ojs-' . $journal->getJournalId() . '-' . $issue->getIssueId() . '-' . $article->getArticleId());
     XMLCustomWriter::appendChild($adminNode, $publisherNode);
     $publisherInstitution = $unavailableString;
     if (empty($publisherInstitution)) {
         $publisherInstitution = $unavailableString;
     }
     XMLCustomWriter::createChildWithText($doc, $publisherNode, 'orgname', $publisherInstitution);
     $digprodNode =& XMLCustomWriter::createElement($doc, 'digprod');
     XMLCustomWriter::createChildWithText($doc, $digprodNode, 'orgname', $publisherInstitution);
     XMLCustomWriter::setAttribute($digprodNode, 'id', 'ojs-prod-' . $journal->getJournalId() . '-' . $issue->getIssueId() . '-' . $article->getArticleId());
     XMLCustomWriter::appendChild($adminNode, $digprodNode);
     $digdistNode =& XMLCustomWriter::createElement($doc, 'digdist');
     XMLCustomWriter::createChildWithText($doc, $digdistNode, 'orgname', $publisherInstitution);
     XMLCustomWriter::setAttribute($digdistNode, 'id', 'ojs-dist-' . $journal->getJournalId() . '-' . $issue->getIssueId() . '-' . $article->getArticleId());
     XMLCustomWriter::appendChild($adminNode, $digdistNode);
     $dtdNode =& XMLCustomWriter::createElement($doc, 'dtd');
     XMLCustomWriter::appendChild($adminNode, $dtdNode);
     XMLCustomWriter::setAttribute($dtdNode, 'name', 'Erudit Article');
     XMLCustomWriter::setAttribute($dtdNode, 'version', '3.0.0');
     /* --- copyright --- */
     $copyright = $journal->getLocalizedSetting('copyrightNotice');
     XMLCustomWriter::createChildWithText($doc, $adminNode, 'copyright', empty($copyright) ? $unavailableString : $copyright);
     /* --- frontmatter --- */
     $frontMatterNode =& XMLCustomWriter::createElement($doc, 'frontmatter');
     XMLCustomWriter::appendChild($root, $frontMatterNode);
     $titleGroupNode =& XMLCustomWriter::createElement($doc, 'titlegr');
     XMLCustomWriter::appendChild($frontMatterNode, $titleGroupNode);
     XMLCustomWriter::createChildWithText($doc, $titleGroupNode, 'title', strip_tags($article->getArticleTitle()));
     /* --- authorgr --- */
     $authorGroupNode =& XMLCustomWriter::createElement($doc, 'authorgr');
     XMLCustomWriter::appendChild($frontMatterNode, $authorGroupNode);
     $authorNum = 1;
     foreach ($article->getAuthors() as $author) {
         $authorNode =& XMLCustomWriter::createElement($doc, 'author');
         XMLCustomWriter::appendChild($authorGroupNode, $authorNode);
         XMLCustomWriter::setAttribute($authorNode, 'id', 'ojs-' . $journal->getJournalId() . '-' . $issue->getIssueId() . '-' . $article->getArticleId() . '-' . $galley->getGalleyId() . '-' . $authorNum);
         $persNameNode =& XMLCustomWriter::createElement($doc, 'persname');
         XMLCustomWriter::appendChild($authorNode, $persNameNode);
         // Opatan Inc.
         foreach ((array) $author->getFirstName(null) as $locale => $firstName) {
             $firstName = strip_tags($firstName);
             $firstNameNode =& XMLCustomWriter::createElement($doc, 'firstname');
             XMLCustomWriter::setAttribute($firstNameNode, 'lang', $locale);
             XMLCustomWriter::appendChild($persNameNode, $firstNameNode);
             XMLCustomWriter::createChildWithText($doc, $firstNameNode, 'blocktext', $firstName);
             unset($firstNameNode);
         }
         // Opatan Inc.
         foreach ((array) $author->getMiddleName(null) as $locale => $middleName) {
             $middleName = strip_tags($middleName);
             $middleNameNode =& XMLCustomWriter::createElement($doc, 'middlename');
             XMLCustomWriter::setAttribute($middleNameNode, 'lang', $locale);
             XMLCustomWriter::appendChild($persNameNode, $middleNameNode);
//.........这里部分代码省略.........
开发者ID:alenoosh,项目名称:ojs,代码行数:101,代码来源:EruditExportDom.inc.php

示例6: import

 function &getMetadataPage($pageNum, &$errors)
 {
     import('xml.XMLCustomWriter');
     import('db.DBResultRange');
     $journal =& Request::getJournal();
     $journalId = $journal->getJournalId();
     $falseVar = false;
     if ($pageNum < 1) {
         return $falseVar;
     }
     $rangeInfo =& new DBResultRange(GOOGLE_SCHOLAR_ITEMS_PER_PAGE, $pageNum);
     $document =& XMLCustomWriter::createDocument('articles', 'articles.dtd');
     $articlesNode =& XMLCustomWriter::createElement($document, 'articles');
     XMLCustomWriter::appendChild($document, $articlesNode);
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $publishedArticles =& $publishedArticleDao->getPublishedArticlesByJournalId($journalId, $rangeInfo);
     $issueDao =& DAORegistry::getDAO('IssueDAO');
     $issueCache = array();
     while ($publishedArticle =& $publishedArticles->next()) {
         $articleNode =& XMLCustomWriter::createElement($document, 'article');
         XMLCustomWriter::appendChild($articlesNode, $articleNode);
         $frontNode =& XMLCustomWriter::createElement($document, 'front');
         XMLCustomWriter::appendChild($articleNode, $frontNode);
         $journalMetaNode =& XMLCustomWriter::createElement($document, 'journal-meta');
         XMLCustomWriter::appendChild($frontNode, $journalMetaNode);
         // Journal Metadata
         $journal =& Request::getJournal();
         XMLCustomWriter::createChildWithText($document, $journalMetaNode, 'journal-title', $journal->getJournalTitle(), true);
         XMLCustomWriter::createChildWithText($document, $journalMetaNode, 'abbrev-journal-title', $journal->getLocalizedSetting('initials'), false);
         $issn = $journal->getSetting('onlineIssn');
         if (empty($issn)) {
             array_push($errors, Locale::translate('plugins.gateways.googleScholar.errors.noIssn'));
             return $falseVar;
         }
         XMLCustomWriter::createChildWithText($document, $journalMetaNode, 'issn', $issn, false);
         $publisherNode =& XMLCustomWriter::createElement($document, 'publisher');
         $publisherName = $this->getSetting($journalId, 'publisher-name');
         if (empty($publisherName)) {
             array_push($errors, Locale::translate('plugins.gateways.googleScholar.errors.noPublisherName'));
             return $falseVar;
         }
         XMLCustomWriter::createChildWithText($document, $publisherNode, 'publisher-name', $publisherName, true);
         XMLCustomWriter::appendChild($journalMetaNode, $publisherNode);
         $articleMetaNode =& XMLCustomWriter::createElement($document, 'article-meta');
         XMLCustomWriter::appendChild($frontNode, $articleMetaNode);
         // Article Metadata
         $titleGroupNode =& XMLCustomWriter::createElement($document, 'title-group');
         XMLCustomWriter::appendChild($articleMetaNode, $titleGroupNode);
         $titles = $publishedArticle->getTitle(null);
         $primaryLocale = $journal->getPrimaryLocale();
         XMLCustomWriter::createChildWithText($document, $titleGroupNode, 'article-title', $titles[$primaryLocale], true);
         unset($titles[$primaryLocale]);
         foreach ($titles as $locale => $title) {
             XMLCustomWriter::createChildWithText($document, $titleGroupNode, 'trans-title', $title, false);
         }
         $contribGroupNode =& XMLCustomWriter::createElement($document, 'contrib-group');
         XMLCustomWriter::appendChild($articleMetaNode, $contribGroupNode);
         foreach ($publishedArticle->getAuthors() as $author) {
             $contribNode =& XMLCustomWriter::createElement($document, 'contrib');
             XMLCustomWriter::appendChild($contribGroupNode, $contribNode);
             XMLCustomWriter::setAttribute($contribNode, 'contrib-type', 'author');
             $nameNode =& XMLCustomWriter::createElement($document, 'name');
             XMLCustomWriter::appendChild($contribNode, $nameNode);
             // Opatan Inc.
             XMLCustomWriter::createChildWithText($document, $nameNode, 'surname', $author->getAuthorLastName(), true);
             // Given names in the form: FirstName MiddleName, where MiddleName is optional
             $name = $author->getAuthorFirstName();
             // Opatan Inc. : gets Localized author firstName
             if (($middleName = $author->getAuthorMiddleName()) != '') {
                 $name .= " {$middleName}";
             }
             // Opatan Inc.
             XMLCustomWriter::createChildWithText($document, $nameNode, 'given-names', $name, true);
         }
         $dateParts = getdate(strtotime($publishedArticle->getDatePublished()));
         $pubDateNode =& XMLCustomWriter::createElement($document, 'pub-date');
         XMLCustomWriter::appendChild($articleMetaNode, $pubDateNode);
         XMLCustomWriter::createChildWithText($document, $pubDateNode, 'day', $dateParts['mday']);
         XMLCustomWriter::createChildWithText($document, $pubDateNode, 'month', $dateParts['mon']);
         XMLCustomWriter::createChildWithText($document, $pubDateNode, 'year', $dateParts['year']);
         $issueId = $publishedArticle->getIssueId();
         if (!isset($issueCache[$issueId])) {
             $issueCache[$issueId] =& $issueDao->getIssueById($issueId);
         }
         $issue =& $issueCache[$issueId];
         XMLCustomWriter::createChildWithText($document, $articleMetaNode, 'volume', $issue->getVolume());
         XMLCustomWriter::createChildWithText($document, $articleMetaNode, 'issue', $issue->getNumber());
         $canonicalUriNode =& XMLCustomWriter::createElement($document, 'self-uri');
         XMLCustomWriter::setAttribute($canonicalUriNode, 'xlink:href', Request::url(null, 'article', 'viewArticle', array($publishedArticle->getArticleId())));
         XMLCustomWriter::appendChild($articleMetaNode, $canonicalUriNode);
         foreach ($publishedArticle->getGalleys() as $galley) {
             $galleyUriNode =& XMLCustomWriter::createElement($document, 'self-uri');
             if ($galley->isHTMLGalley()) {
                 XMLCustomWriter::setAttribute($galleyUriNode, 'xlink:href', Request::url(null, 'article', 'viewArticle', array($publishedArticle->getArticleId(), $galley->getGalleyId())));
             } else {
                 XMLCustomWriter::setAttribute($galleyUriNode, 'xlink:href', Request::url(null, 'article', 'viewFile', array($publishedArticle->getArticleId(), $galley->getGalleyId())));
             }
             XMLCustomWriter::appendChild($articleMetaNode, $galleyUriNode);
         }
         unset($issue);
//.........这里部分代码省略.........
开发者ID:alenoosh,项目名称:ojs,代码行数:101,代码来源:GoogleScholarPlugin.inc.php

示例7: assert

 /**
  * Create a work or product id element.
  *
  * @param $locale string e.g. 'en_US'
  * @param $localizedTitle string
  * @param $titleType string One of the O4DOI_TITLE_TYPE_* constants.
  *
  * @return XMLNode|DOMImplementation
  */
 function &_titleElement($locale, $localizedTitle, $titleType)
 {
     $titleElement =& XMLCustomWriter::createElement($this->getDoc(), 'Title');
     // Text format
     XMLCustomWriter::setAttribute($titleElement, 'textformat', O4DOI_TEXTFORMAT_ASCII);
     // Language
     $language = AppLocale::get3LetterIsoFromLocale($locale);
     assert(!empty($language));
     XMLCustomWriter::setAttribute($titleElement, 'language', $language);
     // Title type (mandatory)
     XMLCustomWriter::createChildWithText($this->getDoc(), $titleElement, 'TitleType', $titleType);
     // Title text (mandatory)
     XMLCustomWriter::createChildWithText($this->getDoc(), $titleElement, 'TitleText', $localizedTitle);
     return $titleElement;
 }
开发者ID:reconciler,项目名称:ojs,代码行数:24,代码来源:O4DOIExportDom.inc.php

示例8: 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

示例9: createSchedConfSitemap

 /**
  * Construct a sitemap for a scheduled conference
  * @return XMLNode
  */
 function createSchedConfSitemap()
 {
     $publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO');
     $galleyDao =& DAORegistry::getDAO('PaperGalleyDAO');
     $conference =& Request::getConference();
     $conferenceId = $conference->getId();
     $schedConf = Request::getSchedConf();
     $doc =& XMLCustomWriter::createDocument();
     $root =& XMLCustomWriter::createElement($doc, 'urlset');
     XMLCustomWriter::setAttribute($root, 'xmlns', SITEMAP_XSD_URL);
     // Sched. Conf. home
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath())));
     // About page
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'about')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'about', 'submissions')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'about', 'siteMap')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'about', 'aboutThisPublishingSystem')));
     // Search
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'search')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'search', 'authors')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'search', 'titles')));
     // Conference Information
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'overview')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'trackPolicies')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'presentations')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'accommodation')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'location')));
     XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'schedConf', 'organizingTeam')));
     // Individual Papers
     $publishedPapers =& $publishedPaperDao->getPublishedPapers($schedConf->getId());
     while ($paper =& $publishedPapers->next()) {
         // Abstract
         XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'paper', 'view', $paper->getId())));
         // Galley files
         $galleys = $galleyDao->getGalleysByPaper($paper->getId());
         foreach ($galleys as $galley) {
             XMLCustomWriter::appendChild($root, SitemapHandler::createUrlTree($doc, Request::url($conference->getPath(), $schedConf->getPath(), 'paper', 'view', array($paper->getId(), $galley->getId()))));
         }
     }
     XMLCustomWriter::appendChild($doc, $root);
     return $doc;
 }
开发者ID:pulipulichen,项目名称:ocs,代码行数:46,代码来源:SitemapHandler.inc.php

示例10: date

 function &generatePaperDom(&$doc, &$conference, &$track, &$paper)
 {
     // register the editor submission DAO for use later
     //		$editorSubmissionDao =& DAORegistry::getDAO('EditorSubmissionDAO');
     /* --- MeetingAbstract --- */
     $root =& XMLCustomWriter::createElement($doc, 'MeetingAbstract');
     XMLCustomWriter::setAttribute($root, 'Status', 'Completed');
     /* --- DateCreated --- */
     $dateNode =& XMLCustomWriter::createElement($doc, 'DateCreated');
     XMLCustomWriter::appendChild($root, $dateNode);
     XMLCustomWriter::createChildWithText($doc, $dateNode, 'Year', date('Y'));
     XMLCustomWriter::createChildWithText($doc, $dateNode, 'Month', date('m'));
     XMLCustomWriter::createChildWithText($doc, $dateNode, 'Day', date('d'));
     /* --- Article/Paper --- */
     $articleNode =& XMLCustomWriter::createElement($doc, 'Article');
     XMLCustomWriter::setAttribute($articleNode, 'PubModel', 'Electronic');
     XMLCustomWriter::appendChild($root, $articleNode);
     /* --- Journal/Book --- */
     // FIXME: at the moment this is a null element required by NLM
     $journalNode =& XMLCustomWriter::createChildWithText($doc, $articleNode, 'Journal', null);
     $journalIssueNode =& XMLCustomWriter::createElement($doc, 'JournalIssue');
     XMLCustomWriter::setAttribute($journalIssueNode, 'CitedMedium', 'Internet');
     XMLCustomWriter::appendChild($journalNode, $journalIssueNode);
     $journalDateNode =& XMLCustomWriter::createElement($doc, 'PubDate');
     XMLCustomWriter::appendChild($journalIssueNode, $journalDateNode);
     XMLCustomWriter::createChildWithText($doc, $journalDateNode, 'MedlineDate', date('Y'));
     /* --- ArticleTitle --- */
     // NLM requires english titles for PaperTitle
     XMLCustomWriter::createChildWithText($doc, $articleNode, 'ArticleTitle', $paper->getLocalizedTitle());
     /* --- Pagination --- */
     // If there is no page number, then use abstract number
     $paginationNode =& XMLCustomWriter::createElement($doc, 'Pagination');
     XMLCustomWriter::appendChild($articleNode, $paginationNode);
     $pages = $paper->getPages();
     if (preg_match("/([0-9]+)\\s*-\\s*([0-9]+)/i", $pages, $matches)) {
         // simple pagination (eg. "pp. 3- 		8")
         XMLCustomWriter::createChildWithText($doc, $paginationNode, 'MedlinePgn', $matches[1] . '-' . $matches[2]);
     } elseif (preg_match("/(e[0-9]+)/i", $pages, $matches)) {
         // elocation-id (eg. "e12")
         XMLCustomWriter::createChildWithText($doc, $paginationNode, 'MedlinePgn', $matches[1]);
     } else {
         // we need to insert something, so use the best ID possible
         XMLCustomWriter::createChildWithText($doc, $paginationNode, 'MedlinePgn', $paper->getBestPaperId($conference));
     }
     /* --- Abstract --- */
     $abstractNode =& XMLCustomWriter::createElement($doc, 'Abstract');
     XMLCustomWriter::appendChild($articleNode, $abstractNode);
     XMLCustomWriter::createChildWithText($doc, $abstractNode, 'AbstractText', strip_tags($paper->getLocalizedAbstract()), false);
     /* --- Affiliation --- */
     $sponsor = $paper->getLocalizedSponsor();
     if ($sponsor != '') {
         XMLCustomWriter::createChildWithText($doc, $articleNode, 'Affiliation', $sponsor);
     }
     /* --- AuthorList --- */
     $authorListNode =& XMLCustomWriter::createElement($doc, 'AuthorList');
     XMLCustomWriter::setAttribute($authorListNode, 'CompleteYN', 'Y');
     XMLCustomWriter::appendChild($articleNode, $authorListNode);
     foreach ($paper->getAuthors() as $author) {
         $authorNode =& NLMExportDom::generateAuthorDom($doc, $author);
         XMLCustomWriter::appendChild($authorListNode, $authorNode);
     }
     /* --- Conference --- */
     $conferenceNode =& XMLCustomWriter::createElement($doc, 'Author');
     XMLCustomWriter::appendChild($authorListNode, $conferenceNode);
     XMLCustomWriter::createChildWithText($doc, $conferenceNode, 'CollectiveName', $conference->getConferenceTitle());
     // OtherInformation element goes here with location for current conference
     /* --- Language --- */
     XMLCustomWriter::createChildWithText($doc, $articleNode, 'Language', strtolower($paper->getLanguage()), false);
     /* --- MedlineJournalInfo--- */
     // FIXME: at the moment this is a null element required by NLM
     $journalInfoNode =& XMLCustomWriter::createChildWithText($doc, $root, 'MedlineJournalInfo', null);
     XMLCustomWriter::createChildWithText($doc, $journalInfoNode, 'MedlineTA', null);
     return $root;
 }
开发者ID:ramonsodoma,项目名称:ocs,代码行数:74,代码来源:NLMExportDom.inc.php

示例11: 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

示例12: 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

示例13: 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

示例14: explode

 /**
  * Create a new XML node.
  * @param $doc XMLNode|DOMImplementation
  * @param $nodePath string an XPath-like string that describes the
  *  node to be created.
  * @param $value string the value to be added as a text node (if any)
  * @return XMLNode|DOMDocument
  */
 function &_createNode($doc, $nodePath, $value = null)
 {
     // Separate the element name from the attributes.
     $elementPlusAttributes = explode('[', $nodePath);
     $element = $elementPlusAttributes[0];
     assert(!empty($element));
     // Create the element.
     $newNode =& XMLCustomWriter::createElement($doc, $element);
     // Check for configurable attributes in element value, remove them from value
     // and add them to regular attributes
     $attributeOffset = strpos($value, '[@');
     if ($attributeOffset !== false) {
         // no configurable attributes
         if (count($elementPlusAttributes) < 2) {
             $elementPlusAttributes[] = '';
         }
         if ($attributeOffset !== 0) {
             $elementPlusAttributes[1] = rtrim($elementPlusAttributes[1], ']') . ltrim(substr($value, $attributeOffset), '[');
             $value = substr($value, 0, $attributeOffset);
         } else {
             $elementPlusAttributes[1] = rtrim($elementPlusAttributes[1], ']') . ltrim(substr($value, $attributeOffset), '[');
             $value = "";
         }
     }
     // Add attributes.
     if (count($elementPlusAttributes) == 2) {
         // Separate the attribute key/value pairs.
         $unparsedAttributes = explode('@', rtrim(ltrim($elementPlusAttributes[1], '@'), ']'));
         foreach ($unparsedAttributes as $unparsedAttribute) {
             // Split attribute expressions into key and value.
             list($attributeName, $attributeValue) = explode('=', rtrim($unparsedAttribute, ' '));
             $attributeValue = trim($attributeValue, '"');
             XMLCustomWriter::setAttribute($newNode, $attributeName, $attributeValue);
         }
     }
     // Insert a text node if we got a value for it.
     if (!is_null($value)) {
         $textNode =& XMLCustomWriter::createTextNode($doc, $value);
         XMLCustomWriter::appendChild($newNode, $textNode);
     }
     return $newNode;
 }
开发者ID:kadowa,项目名称:omp-xepicur-metadata-plugin,代码行数:50,代码来源:Epc10DescriptionXmlFilter.inc.php

示例15: 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


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