Assembla home | Assembla project page
 
Show
Ignore:
Timestamp:
08/02/08 02:13:43 (4 months ago)
Author:
Slynderdale
Message:

--

Files:

Legend:

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

    r278 r279  
    146146 
    147147    /** 
    148      * Obtains configuration settings 
    149      * 
    150      * @return void 
    151      */ 
    152     public function onInit() 
    153     { 
    154         $this->updateSetting('base_format', 'baseFormat'); 
    155         $this->updateSetting('message_format', 'messageFormat'); 
    156         $this->updateSetting('merge_links', 'mergeLinks'); 
    157         $this->updateSetting('title_length', 'titleLength', true); 
    158         $this->updateSetting('show_errors', 'showErrors'); 
    159         $this->updateSetting('detect_schemeless', 'detectSchemeless'); 
    160     } 
    161  
    162     /** 
    163148     * Initializes settings 
    164149     * 
     
    195180 
    196181        // URL Match 
     182        $this->updateSetting('detect_schemeless', 'detectSchemeless'); 
    197183        if (preg_match_all('#'.($this->detectSchemeless ? '' : 'https?://').'(?:([0-9]{1,3}(?:\.[0-9]{1,3}){3})(?![^/]) | 
    198184                            ('.($this->detectSchemeless ? '(?<!http:/|https:/)[@/\\\]' : '').')?(?:(?:[a-z0-9_-]+\.?)+\.[a-z0-9]{1,6}))[^\s]*#xis', 
    199185                            $this->event->getArgument(1), $matches, PREG_SET_ORDER)) { 
     186 
     187            // Update the settings on the fly to take into account any ini changes while the bot is running 
     188            $this->updateSetting('base_format', 'baseFormat'); 
     189            $this->updateSetting('message_format', 'messageFormat'); 
     190            $this->updateSetting('merge_links', 'mergeLinks'); 
     191            $this->updateSetting('title_length', 'titleLength', true); 
     192            $this->updateSetting('show_errors', 'showErrors'); 
    200193 
    201194            $responses = array(); 
     
    260253                } 
    261254 
    262                 self::getTitle($url); 
    263  
    264                 $responses[] = str_replace(array( 
    265                     '%title%', 
    266                     '%link%', 
    267                     '%nick%' 
    268                 ), array( 
    269                     $title, 
    270                     $tinyUrl, 
    271                     $user 
    272                 ), $this->messageFormat); 
     255                $title = self::getTitle($url); 
     256                if (!empty($title)) { 
     257                    $responses[] = str_replace(array( 
     258                        '%title%', 
     259                        '%link%', 
     260                        '%nick%' 
     261                    ), array( 
     262                        $title, 
     263                        $tinyUrl, 
     264                        $user 
     265                    ), $this->messageFormat); 
     266                } 
    273267 
    274268                // Update cache 
     
    603597                        if ($this->errorStatus) { 
    604598                                if (!$this->showErrors || empty($this->errorMessage)) { 
    605                                         continue
     599                                        return
    606600                                } 
    607601                                $title = $this->errorMessage;