| 38 | | $start = stripos($contents, '<dl>'); |
|---|
| 39 | | $end = stripos($contents, '</dl>', $start); |
|---|
| 40 | | $contents = substr($contents, $start, $end - $start); |
|---|
| 41 | | preg_match_all('/<dd><b><a[^>]+>([^<]+)/', $contents, $matches); |
|---|
| | 40 | if ($contents === false) { |
|---|
| | 41 | $this->doPrivmsg($channel, 'Sorry, the acronym database seems to be down right now.'); |
|---|
| | 42 | } else { |
|---|
| | 43 | $start = stripos($contents, '<dl>'); |
|---|
| | 44 | $end = stripos($contents, '</dl>', $start); |
|---|
| | 45 | $contents = substr($contents, $start, $end - $start); |
|---|
| | 46 | preg_match_all('/<dd><b><a[^>]+>([^<]+)/', $contents, $matches); |
|---|
| 43 | | $matches = array_unique($matches[1]); |
|---|
| 44 | | if ($this->_limit != 0) { |
|---|
| 45 | | $matches = array_slice($matches, 0, $this->_limit); |
|---|
| | 48 | $matches = array_unique($matches[1]); |
|---|
| | 49 | if ($this->_limit != 0) { |
|---|
| | 50 | $matches = array_slice($matches, 0, $this->_limit); |
|---|
| | 51 | } |
|---|
| | 52 | $text = 'Possible matches for ' . $acronym . ': ' . implode(', ', $matches); |
|---|
| | 53 | $this->doPrivmsg($channel, $text); |
|---|