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