You are here

function PARSEENTRIES::removeDelimitersAndExpand in Bibliography Module 5

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

File

bibtexParse/PARSEENTRIES.php, line 409

Class

PARSEENTRIES

Code

function removeDelimitersAndExpand($string, $inpreamble = FALSE) {

  // only expand the macro if flag set, if strings defined and not in preamble
  if (!$this->expandMacro || empty($this->strings) || $inpreamble) {
    $string = $this
      ->removeDelimiters($string);
  }
  else {
    $stringlist = $this
      ->explodeString($string);
    $string = "";
    foreach ($stringlist as $str) {

      // trim the string since usually # is enclosed by spaces
      $str = trim($str);

      // replace the string if macro is already defined
      // strtolower is used since macros are case insensitive
      if (isset($this->strings[strtolower($str)])) {
        $string .= $this->strings[strtolower($str)];
      }
      else {
        $string .= $this
          ->removeDelimiters(trim($str));
      }
    }
  }
  return $string;
}