Ticket #41: Phergie_Plugin_Acronym_Patch.patch
| File Phergie_Plugin_Acronym_Patch.patch, 1.7 kB (added by caseyw, 5 months ago) |
|---|
-
Acronym.php
old new 138 138 "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n". 139 139 "Accept-Language: en-us,en;q=0.8\r\n". 140 140 "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n". 141 "Referer: http:// www.acronymfinder.com/\r\n",141 "Referer: http://acronyms.thefreedictionary.com/\r\n", 142 142 ) 143 143 ); 144 144 $context = stream_context_create($opts); 145 $url = 'http:// www.acronymfinder.com/af-query.asp?Acronym=' . urlencode($acronym) . '&Find=find&string=exact';145 $url = 'http://acronyms.thefreedictionary.com/' . urlencode($acronym); 146 146 $contents = @file_get_contents($url, false, $context); 147 147 148 148 if (empty ($contents) || 149 strpos($contents, 'no abbreviation matches') !== false || 150 strpos($contents, 'has exceeded the daily query limit') !== false) { 149 strpos($contents, 'Word not found') !== false) { 151 150 $this->randomAction($source); 152 151 return; 153 152 } else { … … 155 154 $offset = 0; 156 155 157 156 do { 158 $count = preg_match('/<td width="65%"[^>]+>([^<]+)</i', $contents, $match, PREG_OFFSET_CAPTURE, $offset);157 $count = preg_match('/<td>([^<]+)</i', $contents, $match, PREG_OFFSET_CAPTURE, $offset); 159 158 if ($count == 1) { 160 159 $matches[] = html_entity_decode($match[1][0]); 161 160 $offset = $match[1][1];