/** * Override parent function to make links unique * @see html2text::_build_link_list() */ function _build_link_list($link, $display) { // If links already exists, return its existing reference if (array_key_exists($link, $this->links)) { return $display . ' [' . $this->links[$link] . ']'; } else { $result = parent::_build_link_list($link, $display); preg_match('/\\[(\\d+)\\]$/', $result, $m); $reference = $m[1]; $this->links[$link] = $reference; return $result; } }