function PARSEENTRIES::reduceFields in Bibliography Module 6        
                          
                  
                        Same name and namespace in other branches
- 5 bibtexParse/PARSEENTRIES.php \PARSEENTRIES::reduceFields()
- 6.2 modules/bibtexParse/PARSEENTRIES.php \PARSEENTRIES::reduceFields()
- 7.3 plugins/biblio_style/bibtex/PARSEENTRIES.php \PARSEENTRIES::reduceFields()
- 7 modules/bibtexParse/PARSEENTRIES.php \PARSEENTRIES::reduceFields()
- 7.2 modules/bibtexParse/PARSEENTRIES.php \PARSEENTRIES::reduceFields()
1 call to PARSEENTRIES::reduceFields()
  - PARSEENTRIES::fullSplit in bibtexParse/PARSEENTRIES.php
File
 
   - bibtexParse/PARSEENTRIES.php, line 248
Class
  
  - PARSEENTRIES 
Code
function reduceFields($oldString) {
  
  $lg = strlen($oldString);
  if ($oldString[$lg - 1] == "}" || $oldString[$lg - 1] == ")" || $oldString[$lg - 1] == ",") {
    $oldString = substr($oldString, 0, $lg - 1);
  }
  
  $split = preg_split("/=/", $oldString, 2);
  $string = $split[1];
  while ($string) {
    list($entry, $string) = $this
      ->fieldSplit($string);
    $values[] = $entry;
  }
  foreach ($values as $value) {
    $pos = strpos($oldString, $value);
    $oldString = substr_replace($oldString, '', $pos, strlen($value));
  }
  $rev = strrev(trim($oldString));
  if ($rev[0] != ',') {
    $oldString .= ',';
  }
  $keys = preg_split("/=,/", $oldString);
  
  array_pop($keys);
  foreach ($keys as $key) {
    $value = trim(array_shift($values));
    $rev = strrev($value);
    
    if ($rev[0] == ',') {
      $value = rtrim($value, ",");
    }
    if (!$value) {
      continue;
    }
    
    $key = strtolower(trim($key));
    $value = trim($value);
    $this->entries[$this->count][$key] = $value;
  }
  
}