Skip to content

Commit

Permalink
pkp/pkp-lib#1118 Rename String to PKPString
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Feb 19, 2016
1 parent 5c55af1 commit 1f42436
Show file tree
Hide file tree
Showing 28 changed files with 84 additions and 84 deletions.
2 changes: 1 addition & 1 deletion classes/article/AuthorDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function getAuthorsAlphabetizedByJournal($journalId = null, $initial = null, $ra

if (isset($journalId)) $params[] = $journalId;
if (isset($initial)) {
$params[] = String::strtolower($initial) . '%';
$params[] = PKPString::strtolower($initial) . '%';
$initialSql = ' AND LOWER(aa.last_name) LIKE LOWER(?)';
} else {
$initialSql = '';
Expand Down
2 changes: 1 addition & 1 deletion classes/subscription/SubscriptionAction.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ function selectSubscriber($args, $request, $institutional = false) {
$searchMatch = $request->getUserVar('searchMatch');

} else if (isset($searchInitial)) {
$searchInitial = String::strtoupper($searchInitial);
$searchInitial = PKPString::strtoupper($searchInitial);
$searchType = USER_FIELD_INITIAL;
$search = $searchInitial;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function readInputData() {

// If provided ensure IP ranges have IP address format; IP addresses may contain wildcards
if ($ipRangeProvided) {
$this->addCheck(new FormValidatorArrayCustom($this, 'ipRanges', 'required', 'manager.subscriptions.form.ipRangeValid', create_function('$ipRange, $regExp', 'return String::regexp_match($regExp, $ipRange);'),
$this->addCheck(new FormValidatorArrayCustom($this, 'ipRanges', 'required', 'manager.subscriptions.form.ipRangeValid', create_function('$ipRange, $regExp', 'return PKPString::regexp_match($regExp, $ipRange);'),
array(
'/^' .
// IP4 address (with or w/o wildcards) or IP4 address range (with or w/o wildcards) or CIDR IP4 address
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function readInputData() {
// If provided ensure IP ranges have IP address format; IP addresses may contain wildcards
if ($ipRangeProvided) {
import('classes.subscription.InstitutionalSubscription');
$this->addCheck(new FormValidatorArrayCustom($this, 'ipRanges', 'required', 'user.subscriptions.form.ipRangeValid', create_function('$ipRange, $regExp', 'return String::regexp_match($regExp, $ipRange);'),
$this->addCheck(new FormValidatorArrayCustom($this, 'ipRanges', 'required', 'user.subscriptions.form.ipRangeValid', create_function('$ipRange, $regExp', 'return PKPString::regexp_match($regExp, $ipRange);'),
array(
'/^' .
// IP4 address (with or w/o wildcards) or IP4 address range (with or w/o wildcards) or CIDR IP4 address
Expand Down
2 changes: 1 addition & 1 deletion lib/pkp
Submodule pkp updated 65 files
+3 −3 classes/citation/Citation.inc.php
+2 −2 classes/citation/CitationListTokenizerFilter.inc.php
+1 −1 classes/controllers/grid/citation/form/CitationForm.inc.php
+1 −1 classes/controllers/grid/filter/form/FilterForm.inc.php
+7 −7 classes/controllers/modals/editorDecision/PKPEditorDecisionHandler.inc.php
+6 −6 classes/core/Core.inc.php
+2 −2 classes/core/PKPApplication.inc.php
+7 −7 classes/core/PKPComponentRouter.inc.php
+31 −31 classes/core/PKPString.inc.php
+3 −3 classes/db/SQLParser.inc.php
+2 −2 classes/file/EditableEmailFile.inc.php
+2 −2 classes/file/EditableLocaleFile.inc.php
+5 −5 classes/file/FileManager.inc.php
+4 −4 classes/file/PKPLibraryFileManager.inc.php
+1 −1 classes/file/TemporaryFileManager.inc.php
+1 −1 classes/filter/Filter.inc.php
+1 −1 classes/filter/FilterHelper.inc.php
+1 −1 classes/form/validation/FormValidatorLength.inc.php
+1 −1 classes/handler/PKPHandler.inc.php
+1 −1 classes/i18n/PKPLocale.inc.php
+1 −1 classes/install/form/InstallForm.inc.php
+4 −4 classes/mail/Mail.inc.php
+2 −2 classes/mail/MailTemplate.inc.php
+1 −1 classes/mail/SubmissionMailTemplate.inc.php
+1 −1 classes/metadata/DateStringNormalizerFilter.inc.php
+1 −1 classes/metadata/MetadataProperty.inc.php
+1 −1 classes/notification/managerDelegate/EditorDecisionNotificationManager.inc.php
+1 −1 classes/plugins/PluginGalleryDAO.inc.php
+2 −2 classes/plugins/PluginHelper.inc.php
+1 −1 classes/search/SearchHTMLParser.inc.php
+5 −5 classes/search/SubmissionSearch.inc.php
+7 −7 classes/search/SubmissionSearchIndex.inc.php
+2 −2 classes/security/Validation.inc.php
+1 −1 classes/site/VersionCheck.inc.php
+2 −2 classes/statistics/PKPMetricsDAO.inc.php
+1 −1 classes/submission/Submission.inc.php
+1 −1 classes/submission/form/PKPSubmissionSubmitStep1Form.inc.php
+27 −27 classes/template/PKPTemplateManager.inc.php
+1 −1 classes/user/PKPUserDAO.inc.php
+1 −1 classes/validation/ValidatorRegExp.inc.php
+2 −2 classes/validation/ValidatorTypeDescription.inc.php
+2 −2 classes/webservice/WebService.inc.php
+13 −13 classes/xml/XMLParser.inc.php
+1 −1 controllers/grid/eventLog/SubmissionEventLogGridHandler.inc.php
+8 −3 controllers/grid/submissions/SubmissionsListGridCellProvider.inc.php
+1 −1 controllers/modals/editorDecision/form/EditorDecisionWithEmailForm.inc.php
+2 −2 includes/functions.inc.php
+1 −1 pages/login/PKPLoginHandler.inc.php
+2 −0 pages/workflow/PKPWorkflowHandler.inc.php
+2 −2 plugins/citationLookup/crossref/filter/CrossrefNlm30CitationSchemaFilter.inc.php
+4 −4 plugins/citationLookup/isbndb/filter/IsbndbIsbnNlm30CitationSchemaFilter.inc.php
+1 −1 plugins/citationLookup/isbndb/filter/IsbndbNlm30CitationSchemaFilter.inc.php
+8 −8 plugins/citationLookup/pubmed/filter/PubmedNlm30CitationSchemaFilter.inc.php
+4 −4 plugins/citationLookup/worldcat/filter/WorldcatNlm30CitationSchemaFilter.inc.php
+8 −8 plugins/citationParser/paracite/filter/ParaciteRawCitationNlm30CitationSchemaFilter.inc.php
+3 −3 plugins/citationParser/parscit/filter/ParscitRawCitationNlm30CitationSchemaFilter.inc.php
+17 −17 plugins/citationParser/regex/filter/RegexRawCitationNlm30CitationSchemaFilter.inc.php
+3 −3 plugins/metadata/nlm30/filter/Nlm30CitationDemultiplexerFilter.inc.php
+6 −6 plugins/metadata/nlm30/filter/Nlm30CitationSchemaFilter.inc.php
+2 −2 plugins/metadata/nlm30/filter/Nlm30NameSchemaPersonStringFilter.inc.php
+14 −14 plugins/metadata/nlm30/filter/PersonStringNlm30NameSchemaFilter.inc.php
+1 −1 plugins/oaiMetadataFormats/dc/PKPOAIMetadataFormat_DC.inc.php
+8 −8 tests/classes/core/StringTest.php
+1 −1 tests/functional/pages/submission/FunctionalSubmissionBaseTestCase.inc.php
+3 −3 tests/functional/plugins/importexport/FunctionalImportExportBaseTestCase.inc.php
12 changes: 6 additions & 6 deletions plugins/citationFormats/abnt/AbntCitationPlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ function getManagementVerbLinkAction($request, $verb) {
}

/**
* Display an HTML-formatted citation. We register String::strtoupper modifier
* Display an HTML-formatted citation. We register PKPString::strtoupper modifier
* in order to convert author names to uppercase.
* @param $article Article
* @param $issue Issue
* @param $journal Journal
*/
function displayCitation(&$article, &$issue, &$journal) {
$templateMgr = TemplateManager::getManager($this->getRequest());
$templateMgr->register_modifier('mb_upper', array('String', 'strtoupper'));
$templateMgr->register_modifier('mb_upper', array('PKPString', 'strtoupper'));
$templateMgr->register_modifier('abnt_date_format', array($this, 'abntDateFormat'));
$templateMgr->register_modifier('abnt_date_format_with_day', array($this, 'abntDateFormatWithDay'));
return parent::displayCitation($article, $issue, $journal);
Expand Down Expand Up @@ -197,11 +197,11 @@ function abntDateFormat($string) {
$timestamp = strtotime($string);
}
$format = "%B %Y";
if (String::strlen(strftime("%B", $timestamp)) > 4) {
if (PKPString::strlen(strftime("%B", $timestamp)) > 4) {
$format = "%b. %Y";
}

return String::strtolower(strftime($format, $timestamp));
return PKPString::strtolower(strftime($format, $timestamp));
}

/**
Expand All @@ -217,11 +217,11 @@ function abntDateFormatWithDay($string) {
$timestamp = strtotime($string);
}
$format = "%d %B %Y";
if (String::strlen(strftime("%B", $timestamp)) > 4) {
if (PKPString::strlen(strftime("%B", $timestamp)) > 4) {
$format = "%d %b. %Y";
}

return String::strtolower(strftime($format, $timestamp));
return PKPString::strtolower(strftime($format, $timestamp));
}
}

Expand Down
4 changes: 2 additions & 2 deletions plugins/gateways/resolver/ResolverPlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ function fetch($args, $request) {
foreach ($articles as $article) {
// Look for the correct page in the list of articles.
$matches = null;
if (String::regexp_match_get('/^[Pp][Pp]?[.]?[ ]?(\d+)$/', $article->getPages(), $matches)) {
if (PKPString::regexp_match_get('/^[Pp][Pp]?[.]?[ ]?(\d+)$/', $article->getPages(), $matches)) {
$matchedPage = $matches[1];
if ($page == $matchedPage) $request->redirect(null, 'article', 'view', $article->getBestArticleId());
}
if (String::regexp_match_get('/^[Pp][Pp]?[.]?[ ]?(\d+)[ ]?-[ ]?([Pp][Pp]?[.]?[ ]?)?(\d+)$/', $article->getPages(), $matches)) {
if (PKPString::regexp_match_get('/^[Pp][Pp]?[.]?[ ]?(\d+)[ ]?-[ ]?([Pp][Pp]?[.]?[ ]?)?(\d+)$/', $article->getPages(), $matches)) {
$matchedPageFrom = $matches[1];
$matchedPageTo = $matches[3];
if ($page >= $matchedPageFrom && ($page < $matchedPageTo || ($page == $matchedPageTo && $matchedPageFrom = $matchedPageTo))) $request->redirect(null, 'article', 'view', $article->getBestArticleId());
Expand Down
18 changes: 9 additions & 9 deletions plugins/generic/lucene/classes/SolrWebService.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1724,9 +1724,9 @@ function _translateSearchPhrase($searchPhrase, $backwards = false) {
if (is_null($queryKeywords)) {
// Query keywords.
$queryKeywords = array(
String::strtoupper(__('search.operator.not')) => 'NOT',
String::strtoupper(__('search.operator.and')) => 'AND',
String::strtoupper(__('search.operator.or')) => 'OR'
PKPString::strtoupper(__('search.operator.not')) => 'NOT',
PKPString::strtoupper(__('search.operator.and')) => 'AND',
PKPString::strtoupper(__('search.operator.or')) => 'OR'
);
}

Expand All @@ -1738,7 +1738,7 @@ function _translateSearchPhrase($searchPhrase, $backwards = false) {

// Translate the search phrase.
foreach($translationTable as $translateFrom => $translateTo) {
$searchPhrase = String::regexp_replace("/(^|\s)$translateFrom(\s|$)/i", "\\1$translateTo\\2", $searchPhrase);
$searchPhrase = PKPString::regexp_replace("/(^|\s)$translateFrom(\s|$)/i", "\\1$translateTo\\2", $searchPhrase);
}

return $searchPhrase;
Expand Down Expand Up @@ -1864,12 +1864,12 @@ function _getSuggesterAutosuggestions($url, $userInput, $fieldName) {
// Check whether the suggestion really concerns the
// last word of the user input.
if (!(isset($startOffset) && isset($endOffset)
&& String::strlen($userInput) == $endOffset)) return array();
&& PKPString::strlen($userInput) == $endOffset)) return array();

// Replace the last word in the user input
// with the suggestions maintaining case.
foreach($suggestions as &$suggestion) {
$suggestion = $userInput . String::substr($suggestion, $endOffset - $startOffset);
$suggestion = $userInput . PKPString::substr($suggestion, $endOffset - $startOffset);
}
return $suggestions;
}
Expand All @@ -1895,7 +1895,7 @@ function _getFacetingAutosuggestions($url, $searchRequest, $userInput, $fieldNam
// facet results. This may be an invalid query
// but edismax will deal gracefully with syntax
// errors.
$userInput = String::substr($userInput, 0, -String::strlen($facetPrefix));
$userInput = PKPString::substr($userInput, 0, -PKPString::strlen($facetPrefix));
switch ($fieldName) {
case 'query':
// The 'query' filter goes against all fields.
Expand Down Expand Up @@ -1927,7 +1927,7 @@ function _getFacetingAutosuggestions($url, $searchRequest, $userInput, $fieldNam
} else {
$params['facet.field'] = $fieldName . '_spell';
}
$facetPrefixLc = String::strtolower($facetPrefix);
$facetPrefixLc = PKPString::strtolower($facetPrefix);
$params['facet.prefix'] = $facetPrefixLc;

// Make the request.
Expand All @@ -1947,7 +1947,7 @@ function _getFacetingAutosuggestions($url, $searchRequest, $userInput, $fieldNam
foreach($termSuggestions as $termSuggestion) {
// Restore case if possible.
if (strpos($termSuggestion, $facetPrefixLc) === 0) {
$termSuggestion = $facetPrefix . String::substr($termSuggestion, String::strlen($facetPrefix));
$termSuggestion = $facetPrefix . PKPString::substr($termSuggestion, PKPString::strlen($facetPrefix));
}
$suggestions[] = $userInput . $termSuggestion;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/generic/tinymce
Submodule tinymce updated 1 files
+1 −1 TinyMCEPlugin.inc.php
4 changes: 2 additions & 2 deletions plugins/importexport/datacite/DataciteExportPlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function registerDoi($request, $journal, &$objects, $file) {
$doi = $object->getPubId('doi');
assert(!empty($doi));
if ($this->isTestMode($request)) {
$doi = String::regexp_replace('#^[^/]+/#', DATACITE_API_TESTPREFIX . '/', $doi);
$doi = PKPString::regexp_replace('#^[^/]+/#', DATACITE_API_TESTPREFIX . '/', $doi);
}
$url = $this->_getObjectUrl($request, $journal, $object);
assert(!empty($url));
Expand Down Expand Up @@ -232,7 +232,7 @@ function _getObjectUrl($request, $journal, $object) {

if ($this->isTestMode($request)) {
// Change server domain for testing.
$url = String::regexp_replace('#://[^\s]+/index.php#', '://example.com/index.php', $url);
$url = PKPString::regexp_replace('#://[^\s]+/index.php#', '://example.com/index.php', $url);
}
return $url;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/importexport/datacite/classes/DOIExportDom.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function &rootElement() {
*/
function &createElementWithText($name, $value, $attributes = array()) {
$element =& XMLCustomWriter::createElement($this->getDoc(), $name);
$elementContent =& XMLCustomWriter::createTextNode($this->getDoc(), String::html2text($value));
$elementContent =& XMLCustomWriter::createTextNode($this->getDoc(), PKPString::html2text($value));
XMLCustomWriter::appendChild($element, $elementContent);
foreach($attributes as $attributeName => $attributeValue) {
XMLCustomWriter::setAttribute($element, $attributeName, $attributeValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ function markRegistered($request, $object, $testPrefix) {
$registeredDoi = $object->getPubId('doi');
assert(!empty($registeredDoi));
if ($this->isTestMode($request)) {
$registeredDoi = String::regexp_replace('#^[^/]+/#', $testPrefix . '/', $registeredDoi);
$registeredDoi = PKPString::regexp_replace('#^[^/]+/#', $testPrefix . '/', $registeredDoi);
}
$this->saveRegisteredDoi($object, $registeredDoi);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function &generate(&$object) {

// Rights
$rights = $this->getPrimaryTranslation($journal->getSetting('copyrightNotice', null), $objectLocalePrecedence);
if (!empty($rights)) XMLCustomWriter::createChildWithText($this->getDoc(), $rootElement, 'rights', String::html2text($rights));
if (!empty($rights)) XMLCustomWriter::createChildWithText($this->getDoc(), $rootElement, 'rights', PKPString::html2text($rights));

// Descriptions
$descriptionsElement =& $this->_descriptionsElement($issue, $article, $objectLocalePrecedence, $articlesByIssue);
Expand Down Expand Up @@ -249,7 +249,7 @@ function &_identifierElement(&$object) {
return $falseVar;
}
if ($this->getTestMode()) {
$doi = String::regexp_replace('#^[^/]+/#', DATACITE_API_TESTPREFIX . '/', $doi);
$doi = PKPString::regexp_replace('#^[^/]+/#', DATACITE_API_TESTPREFIX . '/', $doi);
}
return $this->createElementWithText('identifier', $doi, array('identifierType' => 'DOI'));
}
Expand Down Expand Up @@ -617,7 +617,7 @@ function &_relatedIdentifierElement(&$object, $relationType) {
$nullVar = null;
}
if ($this->getTestMode()) {
$id = String::regexp_replace('#^[^/]+/#', DATACITE_API_TESTPREFIX . '/', $id);
$id = PKPString::regexp_replace('#^[^/]+/#', DATACITE_API_TESTPREFIX . '/', $id);
}

return $this->createElementWithText(
Expand Down
4 changes: 2 additions & 2 deletions plugins/importexport/doaj/DOAJExportDom.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function &generateArticleDom(&$doc, &$journal, &$issue, &$section, &$article) {
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)));
if (strlen($locale) == 5) XMLCustomWriter::setAttribute($titleNode, 'language', DOAJExportDom::mapLang(PKPString::substr($locale, 0, 2)));
}

/* --- Authors and affiliations --- */
Expand Down Expand Up @@ -133,7 +133,7 @@ function &generateArticleDom(&$doc, &$journal, &$issue, &$section, &$article) {
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)));
if (strlen($locale) == 5) XMLCustomWriter::setAttribute($abstractNode, 'language', DOAJExportDom::mapLang(PKPString::substr($locale, 0, 2)));
}

/* --- FullText URL --- */
Expand Down
2 changes: 1 addition & 1 deletion plugins/importexport/doaj/DOAJPlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function contact($journal, $send = false) {
'name' => $user->getFullName(),
'email' => $user->getEmail(),
'title' => $journal->getLocalizedName(),
'description' => String::html2text($journal->getLocalizedSetting('focusScopeDesc')),
'description' => PKPString::html2text($journal->getLocalizedSetting('focusScopeDesc')),
'url' => $request->url($journal->getPath()),
'charging' => $journal->getSetting('submissionFee') > 0 ? 'Y' : 'N',
'issn' => $issn,
Expand Down
6 changes: 3 additions & 3 deletions plugins/importexport/medra/classes/MedraWebservice.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ function _doRequest($action, $arg, $attachment = null) {
// than instantiating a DOM.
if (is_string($response)) {
$matches = array();
String::regexp_match_get('#<faultstring>([^<]*)</faultstring>#', $response, $matches);
PKPString::regexp_match_get('#<faultstring>([^<]*)</faultstring>#', $response, $matches);
if (empty($matches)) {
if ($attachment) {
assert(String::regexp_match('#<returnCode>success</returnCode>#', $response));
assert(PKPString::regexp_match('#<returnCode>success</returnCode>#', $response));
} else {
$parts = explode("\r\n\r\n", $response);
$result = array_pop($parts);
$result = String::regexp_replace('/>[^>]*$/', '>', $result);
$result = PKPString::regexp_replace('/>[^>]*$/', '>', $result);
}
} else {
$result = 'mEDRA: ' . $status . ' - ' . $matches[1];
Expand Down
10 changes: 5 additions & 5 deletions plugins/importexport/medra/classes/O4DOIExportDom.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ function &_objectElement(&$object) {
assert(!empty($url));
if ($this->getTestMode()) {
// Change server domain for testing.
$url = String::regexp_replace('#://[^\s]+/index.php#', '://example.com/index.php', $url);
$url = PKPString::regexp_replace('#://[^\s]+/index.php#', '://example.com/index.php', $url);
}
XMLCustomWriter::createChildWithText($this->getDoc(), $objectElement, 'DOIWebsiteLink', $url);

Expand Down Expand Up @@ -739,7 +739,7 @@ function &_titleElement($locale, $localizedTitle, $titleType) {
XMLCustomWriter::createChildWithText($this->getDoc(), $titleElement, 'TitleType', $titleType);

// Title text (mandatory)
XMLCustomWriter::createChildWithText($this->getDoc(), $titleElement, 'TitleText', String::html2text($localizedTitle));
XMLCustomWriter::createChildWithText($this->getDoc(), $titleElement, 'TitleText', PKPString::html2text($localizedTitle));

return $titleElement;
}
Expand Down Expand Up @@ -782,7 +782,7 @@ function &_serialVersionElement($issn, $productForm) {

// ISSN
if (!empty($issn)) {
$issn = String::regexp_replace('/[^0-9]/', '', $issn);
$issn = PKPString::regexp_replace('/[^0-9]/', '', $issn);
XMLCustomWriter::appendChild($serialVersionElement, $this->_idElement('Product', O4DOI_ID_TYPE_ISSN, $issn));
}

Expand Down Expand Up @@ -1046,7 +1046,7 @@ function &_contributorElement(&$author, $objectLocalePrecedence) {
// Biographical note
$bioNote = $this->getPrimaryTranslation($author->getBiography(null), $objectLocalePrecedence);
if (!empty($bioNote)) {
XMLCustomWriter::createChildWithText($this->getDoc(), $contributorElement, 'BiographicalNote', String::html2text($bioNote));
XMLCustomWriter::createChildWithText($this->getDoc(), $contributorElement, 'BiographicalNote', PKPString::html2text($bioNote));
}

return $contributorElement;
Expand Down Expand Up @@ -1142,7 +1142,7 @@ function &_relationElement($workOrProduct, $relationCode, $ids) {
function _getDoi(&$object) {
$doi = $object->getPubId('doi');
if (!empty($doi) && $this->getTestMode()) {
$doi = String::regexp_replace('#^[^/]+/#', MEDRA_WS_TESTPREFIX . '/', $doi);
$doi = PKPString::regexp_replace('#^[^/]+/#', MEDRA_WS_TESTPREFIX . '/', $doi);
}
return $doi;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,13 +403,13 @@ public function testNonExistentObjectIdCliError() {
*/
protected function cleanXml($xml) {
// Fix URLs.
$xml = String::regexp_replace('#http://[^\s]+/index.php/(test|index)#', 'http://example.com/index.php/test', $xml);
$xml = PKPString::regexp_replace('#http://[^\s]+/index.php/(test|index)#', 'http://example.com/index.php/test', $xml);

// Fix sent date.
$xml = String::regexp_replace('/<SentDate>[0-9]{12}<\/SentDate>/', '<SentDate>201111082218</SentDate>', $xml);
$xml = PKPString::regexp_replace('/<SentDate>[0-9]{12}<\/SentDate>/', '<SentDate>201111082218</SentDate>', $xml);

// Fix version.
$xml = String::regexp_replace('/(<MessageNote>[^<]*)([0-9]\.){4}(<\/MessageNote>)/', '\1x.x.x.x.\3', $xml);
$xml = PKPString::regexp_replace('/(<MessageNote>[^<]*)([0-9]\.){4}(<\/MessageNote>)/', '\1x.x.x.x.\3', $xml);

return parent::cleanXml($xml);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function toXml(&$record, $format = null) {

$templateMgr->assign(array(
'subject' => isset($subjects[$journal->getPrimaryLocale()])?$subjects[$journal->getPrimaryLocale()]:'',
'abstract' => String::html2text($article->getAbstract($article->getLocale())),
'abstract' => PKPString::html2text($article->getAbstract($article->getLocale())),
'language' => AppLocale::get3LetterIsoFromLocale($article->getLocale())
));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function toXml(&$record, $format = null) {

$templateMgr->assign(array(
'subject' => isset($subjects[$journal->getPrimaryLocale()])?$subjects[$journal->getPrimaryLocale()]:'',
'abstract' => String::html2text($article->getAbstract($article->getLocale())),
'abstract' => PKPString::html2text($article->getAbstract($article->getLocale())),
'language' => AppLocale::get3LetterIsoFromLocale($article->getLocale())
));

Expand Down
8 changes: 4 additions & 4 deletions plugins/oaiMetadataFormats/nlm/OAIMetadataFormat_NLM.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ function toXml(&$record, $format = null) {

// Include page info, if available and parseable.
$matches = null;
if (String::regexp_match_get('/^[Pp][Pp]?[.]?[ ]?(\d+)$/', $article->getPages(), $matches)) {
if (PKPString::regexp_match_get('/^[Pp][Pp]?[.]?[ ]?(\d+)$/', $article->getPages(), $matches)) {
$matchedPage = htmlspecialchars(Core::cleanVar($matches[1]));
$response .= "\t\t\t\t<fpage>$matchedPage</fpage><lpage>$matchedPage</lpage>\n";
$pageCount = 1;
} elseif (String::regexp_match_get('/^[Pp][Pp]?[.]?[ ]?(\d+)[ ]?-[ ]?([Pp][Pp]?[.]?[ ]?)?(\d+)$/', $article->getPages(), $matches)) {
} elseif (PKPString::regexp_match_get('/^[Pp][Pp]?[.]?[ ]?(\d+)[ ]?-[ ]?([Pp][Pp]?[.]?[ ]?)?(\d+)$/', $article->getPages(), $matches)) {
$matchedPageFrom = htmlspecialchars(Core::cleanVar($matches[1]));
$matchedPageTo = htmlspecialchars(Core::cleanVar($matches[3]));
$response .=
Expand Down Expand Up @@ -169,15 +169,15 @@ function toXml(&$record, $format = null) {
$abstract = htmlspecialchars(Core::cleanVar(strip_tags($article->getLocalizedAbstract())));
if (!empty($abstract)) {
$abstract = "<p>$abstract</p>";
// $abstract = '<p>' . String::regexp_replace('/\n+/', '</p><p>', $abstract) . '</p>';
// $abstract = '<p>' . PKPString::regexp_replace('/\n+/', '</p><p>', $abstract) . '</p>';
$response .= "\t\t\t<abstract xml:lang=\"" . strtoupper(substr($primaryLocale, 0, 2)) . "\">$abstract</abstract>\n";
}
if (is_array($article->getAbstract(null))) foreach ($article->getAbstract(null) as $locale => $abstract) {
if ($locale == $primaryLocale || empty($abstract)) continue;
$abstract = htmlspecialchars(Core::cleanVar(strip_tags($abstract)));
if (empty($abstract)) continue;
$abstract = "<p>$abstract</p>";
//$abstract = '<p>' . String::regexp_replace('/\n+/', '</p><p>', $abstract) . '</p>';
//$abstract = '<p>' . PKPString::regexp_replace('/\n+/', '</p><p>', $abstract) . '</p>';
$response .= "\t\t\t<abstract-trans xml:lang=\"" . strtoupper(substr($locale, 0, 2)) . "\">$abstract</abstract-trans>\n";
}

Expand Down
Loading

0 comments on commit 1f42436

Please sign in to comment.