_hrefs = array(); if (! empty($data['href'])) { array_push($this->_hrefs, $data['href']); $xref[$data['href']] = $data['question']; } array_push($this->_hrefs, "{$section_number}_{$entry_number}"); $this->_question = $data['question']; $this->_answer = $data['answer']; /* Save a reference to the xref table for later use. */ $this->_xref = &$xref; } /* Get the primary anchor name for this entry. */ public function getHref() { return $this->_hrefs[0]; } /* Get all anchor names for this entry. */ public function getHrefs() { return $this->_hrefs; } /* Get the question for this entry. */ public function getQuestion() { return $this->_question; } /* Get the answer for this entry. */ public function getAnswer() { $answer = &$this->_answer; $xref = &$this->_xref; /* If we find a xref we need to make the final conversion to HTML. */ if (strpos($answer, '_xref as $anchor => $text) { $xref['pattern'][] = "/<\/a>/"; $xref['replace'][] = "{$text}"; } } $answer = preg_replace($xref['pattern'], $xref['replace'], $answer); } return $this->_answer; } } ?>