Changeset 279 for trunk/Phergie/Plugin/Url.php
- Timestamp:
- 08/02/08 02:13:43 (4 months ago)
- Files:
-
- trunk/Phergie/Plugin/Url.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Phergie/Plugin/Url.php
r278 r279 146 146 147 147 /** 148 * Obtains configuration settings149 *150 * @return void151 */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 /**163 148 * Initializes settings 164 149 * … … 195 180 196 181 // URL Match 182 $this->updateSetting('detect_schemeless', 'detectSchemeless'); 197 183 if (preg_match_all('#'.($this->detectSchemeless ? '' : 'https?://').'(?:([0-9]{1,3}(?:\.[0-9]{1,3}){3})(?![^/]) | 198 184 ('.($this->detectSchemeless ? '(?<!http:/|https:/)[@/\\\]' : '').')?(?:(?:[a-z0-9_-]+\.?)+\.[a-z0-9]{1,6}))[^\s]*#xis', 199 185 $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'); 200 193 201 194 $responses = array(); … … 260 253 } 261 254 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 } 273 267 274 268 // Update cache … … 603 597 if ($this->errorStatus) { 604 598 if (!$this->showErrors || empty($this->errorMessage)) { 605 continue;599 return; 606 600 } 607 601 $title = $this->errorMessage;