You are here

public function PARSEENTRIES::searchReplaceText in Bibliography Module 7

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

File

modules/bibtexParse/PARSEENTRIES.php, line 184

Class

PARSEENTRIES
// Parse a file $parse = NEW PARSEENTRIES(); $parse->expandMacro = TRUE; // $array = array("RMP" =>"Rev., Mod. Phys."); // $parse->loadStringMacro($array); // $parse->removeDelimit = FALSE; // …

Code

public function searchReplaceText($searchReplaceActionsArray, $sourceString, $includesSearchPatternDelimiters = FALSE) {
  $searchStrings = array_keys($searchReplaceActionsArray);
  if (!$includesSearchPatternDelimiters) {
    foreach ($searchStrings as $key => $value) {

      // Add search pattern delimiters.
      $searchStrings[$key] = "/" . $value . "/";
    }
  }
  $replaceStrings = array_values($searchReplaceActionsArray);

  // Apply the search & replace actions defined in '$searchReplaceActionsArray' to the text passed in '$sourceString':
  return preg_replace($searchStrings, $replaceStrings, $sourceString);
}