Changeset 131
- Timestamp:
- 03/06/08 03:32:18 (5 years ago)
- Files:
-
- 1 modified
-
trunk/Phergie/Plugin/Url.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Phergie/Plugin/Url.php
r127 r131 21 21 */ 22 22 protected $format = '%title% [ %link% ]'; 23 24 /** 25 * Url cache to prevent spamming, especially with multiple bots on the same channel 26 */ 27 protected $cache = array(); 23 28 24 29 /** … … 51 56 // Convert url 52 57 $tinyUrl = $this->tinyUrl($url); 58 59 // Prevent spamfest 60 if(array_search($url, $this->cache, true) !== false || array_search($tinyUrl, $this->cache, true) !== false) 61 return; 53 62 54 63 $opts = array('http' => … … 106 115 ); 107 116 117 // Update cache 118 $this->cache[] = $url; 119 $this->cache[] = $tinyUrl; 120 if (count($this->cache) > 10) { 121 array_shift($this->cache); 122 array_shift($this->cache); 123 } 124 108 125 unset($title, $tinyUrl, $title); 109 126 }