Changeset 65
- Timestamp:
- 02/17/08 19:03:21 (5 years ago)
- Files:
-
- 1 modified
-
trunk/Phergie/Plugin/Url.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Phergie/Plugin/Url.php
r64 r65 21 21 */ 22 22 protected $format = '%title% [ %link% ]'; 23 24 /** 25 * Saves the last url parsed to avoid spamming/looping with multiple bots 26 * 27 * It's saved in an array containing (url, tinyurl) so both are checked 28 * 29 * @var array 30 */ 31 protected $lastUrl = array(); 23 32 24 33 /** … … 47 56 if (preg_match('#(https?://(?:[a-z0-9_-]+\.)+[a-z]{2,6}[^\s]*)#is', $this->event->getArgument(1), $m)) { 48 57 $url = rtrim($m[1], '), ]'); 58 // Spam check on base URL 59 if(array_search($url, $this->lastUrl) !== false) 60 return; 49 61 // @todo if image or something, output content type 62 // Convert url 50 63 $tinyUrl = $this->tinyUrl($url); 64 // Spam check on tinyURL 65 if(array_search($tinyUrl, $this->lastUrl) !== false) 66 return; 67 51 68 $titleLength = $this->getIni('title_length'); 52 69 … … 96 113 ) 97 114 ); 115 116 $this->lastUrl = array($url, $tinyUrl); 98 117 } 99 118 }