Assembla home | Assembla project page
 

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  
    138138                                                "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". 
    139139                                                "Accept-Language: en-us,en;q=0.8\r\n". 
    140140                                                "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", 
    142142                ) 
    143143            ); 
    144144            $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)
    146146            $contents = @file_get_contents($url, false, $context); 
    147147 
    148148                        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) { 
    151150                $this->randomAction($source); 
    152151                return; 
    153152            } else { 
     
    155154                $offset = 0; 
    156155 
    157156                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); 
    159158                    if ($count == 1) { 
    160159                        $matches[] = html_entity_decode($match[1][0]); 
    161160                        $offset = $match[1][1];