You are here

function PARSEENTRIES::removeDelimitersAndExpand in Bibliography Module 6.2

Same name and namespace in other branches
  1. 5 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()
3 calls to PARSEENTRIES::removeDelimitersAndExpand()
PARSEENTRIES::extractStringValue in modules/bibtexParse/PARSEENTRIES.php
PARSEENTRIES::getEntries in modules/bibtexParse/PARSEENTRIES.php
PARSEENTRIES::returnArrays in modules/bibtexParse/PARSEENTRIES.php

File

modules/bibtexParse/PARSEENTRIES.php, line 417

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;
}