You are here

function PARSEENTRIES::searchReplaceText in Bibliography Module 5

Same name and namespace in other branches
  1. 6.2 modules/bibtexParse/PARSEENTRIES.php \PARSEENTRIES::searchReplaceText()
  2. 6 bibtexParse/PARSEENTRIES.php \PARSEENTRIES::searchReplaceText()
  3. 7.3 plugins/biblio_style/bibtex/PARSEENTRIES.php \PARSEENTRIES::searchReplaceText()
  4. 7 modules/bibtexParse/PARSEENTRIES.php \PARSEENTRIES::searchReplaceText()
  5. 7.2 modules/bibtexParse/PARSEENTRIES.php \PARSEENTRIES::searchReplaceText()
1 call to PARSEENTRIES::searchReplaceText()
PARSEENTRIES::parseEntry in bibtexParse/PARSEENTRIES.php

File

bibtexParse/PARSEENTRIES.php, line 169

Class

PARSEENTRIES

Code

function searchReplaceText($searchReplaceActionsArray, $sourceString, $includesSearchPatternDelimiters = FALSE) {
  set_time_limit(30);

  // reset the script timer to avoid timeouts
  // apply the search & replace actions defined in '$searchReplaceActionsArray' to the text passed in '$sourceString':
  foreach ($searchReplaceActionsArray as $searchString => $replaceString) {
    if (!$includesSearchPatternDelimiters) {
      $searchString = "/" . $searchString . "/";
    }

    // add search pattern delimiters
    if (preg_match($searchString, $sourceString)) {
      $sourceString = preg_replace($searchString, $replaceString, $sourceString);
    }
  }
  return $sourceString;
}