private function parse()
 {
     // Iterates for all bibtex items.
     while ($this->nextItem() !== FALSE) {
         // Create a new bib item
         $item = new BibtexItem();
         $item->addType($this->getItemType());
         $item->addID($this->getItemID());
         $property;
         while (($property = $this->getItemProperty()) !== FALSE) {
             $item->addProperty($property[0], $property[1]);
         }
         array_push($this->items, $item);
     }
 }
 private function parse()
 {
     $itemsLines = explode("\n", $this->fileContent);
     $uniqueID = "";
     $item;
     $currentType = "";
     foreach ($itemsLines as $line) {
         $propertyValue = explode("\t", $line);
         $propertyValue[0] = strtolower($propertyValue[0]);
         // Transformation of some properties
         if ($currentType == "person") {
             switch ($propertyValue[0]) {
                 case "title":
                     $propertyValue[0] = "name";
                     break;
             }
         }
         if ($currentType == "subject") {
             switch ($propertyValue[0]) {
                 case "title":
                     $propertyValue[0] = "subjectTitle";
                     break;
             }
         }
         if ($propertyValue[0] == "id_local") {
             if (isset($item) && count($item) > 0) {
                 $this->items[$uniqueID] = $item;
             }
             $item = new BibtexItem();
             $uniqueID = $propertyValue[1];
             $item->addID($uniqueID);
         } else {
             if ($propertyValue[0] == "bibtype") {
                 $propertyValue[1] = strtolower($propertyValue[1]);
                 $item->addType($propertyValue[1]);
                 $currentType = $propertyValue[1];
             } else {
                 if ($propertyValue[0] == "author") {
                     $authors = "";
                     preg_match_all("|\"#(.*)\"|U", $propertyValue[1], $matches);
                     foreach ($matches[1] as $author) {
                         if ($authors != "") {
                             $authors .= ",";
                         }
                         $authors .= $author;
                     }
                     $item->addProperty($propertyValue[0], $authors);
                 } else {
                     $process = TRUE;
                     // Cleaning
                     if ($propertyValue[0] == "subject") {
                         $propertyValue[0] = "subjects";
                     }
                     if ($propertyValue[0] == "subjects") {
                         $propertyValue[1] = str_replace(" ", ",", $propertyValue[1]);
                     }
                     if (($propertyValue[0] == "bibliography" || $propertyValue[0] == "honor" || $propertyValue[0] == "image" || $propertyValue[0] == "biography" || $propertyValue[0] == "memorial") && strlen($propertyValue[1]) > 0) {
                         $pos = strpos($propertyValue[1], "href=\"");
                         if ($pos) {
                             $pos2 = strpos($propertyValue[1], "\"", $pos + 6);
                         }
                         if ($pos && $pos2) {
                             $propertyValue[1] = substr($propertyValue[1], $pos + 6, $pos2 - 9);
                         }
                     }
                     if ($propertyValue[0] == "publisher") {
                         $propertyValue[1] = strip_tags($propertyValue[1]);
                     }
                     if ($propertyValue[0] == "sici") {
                         $propertyValue[1] = str_replace(array("<", ">"), array("&lt;", "&gt;"), $propertyValue[1]);
                     }
                     if ($propertyValue[0] == "dates") {
                         $dates = explode("--", $propertyValue[1]);
                         $item->addProperty("born_date", $dates[0]);
                         $item->addProperty("death_date", $dates[1]);
                         $process = FALSE;
                     }
                     // Adding
                     if ($process && $propertyValue[0] != "") {
                         $item->addProperty($propertyValue[0], $propertyValue[1]);
                     }
                 }
             }
         }
     }
 }