Assembla home | Assembla project page
 

Changeset 262

Show
Ignore:
Timestamp:
07/05/08 01:00:07 (5 months ago)
Author:
tobias382
Message:

Fixes #42 Modified URL detection to include closing parentheses and made some method naming case corrections

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Phergie/Plugin/Url.php

    r230 r262  
    167167            $responses = array(); 
    168168            foreach($matches as $m) { 
    169                 $url = trim(rtrim($m[0], '), ].?!;')); 
    170  
    171                 // Check to see if the URL was from an email address, is a directory, ect 
     169                $url = trim(rtrim($m[0], ', ].?!;')); 
     170 
     171                // Check to see if the URL was from an email address, is a directory, etc 
    172172                if (!empty($m[3])) { 
    173173                    $this->debug('Invalid Url: URL is either an email or a directory path. (' . $url . ')'); 
     
    176176 
    177177                // Parse the given URL 
    178                 if (!$parsed = $this->parseURL($url)) { 
     178                if (!$parsed = $this->parseUrl($url)) { 
    179179                    $this->debug('Invalid Url: Could not parse the URL. (' . $url . ')'); 
    180180                    continue; 
     
    218218 
    219219                // Prevent spamfest 
    220                 if ($this->checkURLCache($url, $tinyUrl)) { 
     220                if ($this->checkUrlCache($url, $tinyUrl)) { 
    221221                    $this->debug('Invalid Url: URL is in the cache. (' . $url . ')'); 
    222222                    continue; 
     
    305305 
    306306                // Update cache 
    307                 $this->updateURLCache($url, $tinyUrl); 
     307                $this->updateUrlCache($url, $tinyUrl); 
    308308                unset($title, $tinyUrl, $title); 
    309309            } 
     
    344344     * @return bool 
    345345     */ 
    346     protected function checkURLCache($url, $tiny) 
     346    protected function checkUrlCache($url, $tiny) 
    347347    { 
    348348        $source = $this->event->getSource(); 
     
    352352         * and minimize the size of the cache for less cache bloat. 
    353353         */ 
    354         $url = $this->getURLChecksum($url); 
    355         $tiny = $this->getURLChecksum($tiny); 
     354        $url = $this->getUrlChecksum($url); 
     355        $tiny = $this->getUrlChecksum($tiny); 
    356356 
    357357        $cache = array( 
     
    382382     * @return bool 
    383383     */ 
    384     protected function updateURLCache($url, $tiny) 
     384    protected function updateUrlCache($url, $tiny) 
    385385    { 
    386386        $source = $this->event->getSource(); 
     
    390390         * and minimize the size of the cache for less cache bloat. 
    391391         */ 
    392         $url = $this->getURLChecksum($url); 
    393         $tiny = $this->getURLChecksum($tiny); 
     392        $url = $this->getUrlChecksum($url); 
     393        $tiny = $this->getUrlChecksum($tiny); 
    394394        $time = time(); 
    395395 
     
    461461     * and then return the hex checksum of the url. 
    462462     */ 
    463     protected function getURLChecksum($url) 
     463    protected function getUrlChecksum($url) 
    464464    { 
    465465        $checksum = strtolower(urldecode($this->glueUrl($url, true))); 
     
    472472    * or missing values. 
    473473    */ 
    474     protected function parseURL($url) 
     474    protected function parseUrl($url) 
    475475    { 
    476476        if (is_array($url)) return $url; 
     
    509509        $parsed = $uri; 
    510510        if (!is_array($parsed)) { 
    511             $parsed = $this->parseURL($parsed); 
     511            $parsed = $this->parseUrl($parsed); 
    512512        } 
    513513