Changeset 273
- Timestamp:
- 08/01/08 09:58:43 (4 months ago)
- Files:
-
- trunk/Phergie/Bot.php (modified) (1 diff)
- trunk/Phergie/Plugin/Abstract/Base.php (modified) (3 diffs)
- trunk/Phergie/Plugin/Autojoin.php (modified) (1 diff)
- trunk/Phergie/Plugin/ChuckNorris.php (modified) (1 diff)
- trunk/Phergie/Plugin/Convert.php (modified) (1 diff)
- trunk/Phergie/Plugin/Drink.php (modified) (1 diff)
- trunk/Phergie/Plugin/FeedTicker.php (modified) (1 diff)
- trunk/Phergie/Plugin/Karma.php (modified) (1 diff)
- trunk/Phergie/Plugin/Lart.php (modified) (1 diff)
- trunk/Phergie/Plugin/Sed.php (modified) (1 diff)
- trunk/Phergie/Plugin/Seen.php (modified) (1 diff)
- trunk/Phergie/Plugin/Spellcheck.php (modified) (1 diff)
- trunk/Phergie/Plugin/Tld.php (modified) (1 diff)
- trunk/Phergie/Plugin/Toggle.php (modified) (2 diffs)
- trunk/Phergie/Plugin/Weather.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Phergie/Bot.php
r267 r273 223 223 * $class::checkDependencies($client, $plugins); 224 224 */ 225 if (call_user_func(array($class, 'checkDependencies'), $client, $plugins)) { 225 $result = call_user_func(array($class, 'checkDependencies'), $client, $plugins); 226 if ($result === true) { 226 227 $instance = new $class($client); 227 228 $client->addPlugin($instance); 228 229 $client->debug('Loaded ' . $plugin); 229 230 } else { 230 $client->debug('Unable to load ' . $plugin); 231 // handle bc 232 if ($plugin === false) { 233 $client->debug('Unable to load ' . $plugin); 234 } else { 235 $client->debug('Unable to load ' . $plugin . ":\r\n " . implode("\r\n ", (array) $result)); 236 } 231 237 } 232 238 } trunk/Phergie/Plugin/Abstract/Base.php
r249 r273 465 465 $plugins = array_map('strtolower', $plugins); 466 466 if (in_array(strtolower($plugin), $plugins) && class_exists('Phergie_Plugin_' . $plugin) && 467 call_user_func(array('Phergie_Plugin_' . $plugin, 'checkDependencies'), $client, $plugins) ) {467 call_user_func(array('Phergie_Plugin_' . $plugin, 'checkDependencies'), $client, $plugins) === true) { 468 468 return true; 469 469 } … … 487 487 $plugins = array_map('strtolower', $plugins); 488 488 if (in_array(strtolower($plugin), $plugins) && class_exists('Phergie_Plugin_' . $plugin) && 489 call_user_func(array('Phergie_Plugin_' . $plugin, 'checkDependencies'), $client, $plugins) ) {489 call_user_func(array('Phergie_Plugin_' . $plugin, 'checkDependencies'), $client, $plugins) === true) { 490 490 return true; 491 491 } … … 546 546 * @return bool TRUE if dependencies are met, FALSE otherwise 547 547 */ 548 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins)548 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins) 549 549 { 550 550 return true; trunk/Phergie/Plugin/Autojoin.php
r247 r273 60 60 * @return bool TRUE if dependencies are met, FALSE otherwise 61 61 */ 62 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins)62 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins) 63 63 { 64 64 $channels = $client->getIni('autojoin.channels'); 65 65 66 if (empty($channels)) { 66 return false;67 return 'Ini setting autojoin.channels must be filled-in'; 67 68 } 68 69 trunk/Phergie/Plugin/ChuckNorris.php
r232 r273 114 114 * @return bool TRUE if dependencies are met, FALSE otherwise 115 115 */ 116 public static function checkDependencies(Phergie_Driver_Abstract $client, array$plugins) 117 { 118 if (!extension_loaded('PDO') || !extension_loaded('pdo_sqlite')) { 119 return false; 120 } 121 122 return true; 116 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins) 117 { 118 $errors = array(); 119 120 if (!extension_loaded('PDO')) { 121 $errors[] = 'PDO php extension is required'; 122 } 123 if (!extension_loaded('pdo_sqlite')) { 124 $errors[] = 'pdo_sqlite php extension is required'; 125 } 126 127 return empty($errors) ? true : $errors; 123 128 } 124 129 trunk/Phergie/Plugin/Convert.php
r266 r273 16 16 * @return bool TRUE if dependencies are met, FALSE otherwise 17 17 */ 18 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins)18 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins) 19 19 { 20 20 if (!extension_loaded('Dom')) { 21 return false;21 return 'Dom php extension is required'; 22 22 } 23 23 trunk/Phergie/Plugin/Drink.php
r252 r273 207 207 * @return bool TRUE if dependencies are met, FALSE otherwise 208 208 */ 209 public static function checkDependencies(Phergie_Driver_Abstract $client, array$plugins) 210 { 211 if (!extension_loaded('PDO') || !extension_loaded('pdo_sqlite')) { 212 return false; 213 } 214 215 return true; 209 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins) 210 { 211 $errors = array(); 212 213 if (!extension_loaded('PDO')) { 214 $errors[] = 'PDO php extension is required'; 215 } 216 if (!extension_loaded('pdo_sqlite')) { 217 $errors[] = 'pdo_sqlite php extension is required'; 218 } 219 220 return empty($errors) ? true : $errors; 216 221 } 217 222 trunk/Phergie/Plugin/FeedTicker.php
r270 r273 151 151 * @return bool TRUE if dependencies are met, FALSE otherwise 152 152 */ 153 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins)154 { 155 if (!extension_loaded('SimpleXML')) {156 return false;157 }153 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins) 154 { 155 if (!extension_loaded('SimpleXML')) { 156 return 'SimpleXML php extension is required'; 157 } 158 158 159 159 return true; trunk/Phergie/Plugin/Karma.php
r265 r273 202 202 * @return bool TRUE if dependencies are met, FALSE otherwise 203 203 */ 204 public static function checkDependencies(Phergie_Driver_Abstract $client, array$plugins) 205 { 206 if (!extension_loaded('PDO') || !extension_loaded('pdo_sqlite')) { 207 return false; 208 } 209 210 return true; 204 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins) 205 { 206 $errors = array(); 207 208 if (!extension_loaded('PDO')) { 209 $errors[] = 'PDO php extension is required'; 210 } 211 if (!extension_loaded('pdo_sqlite')) { 212 $errors[] = 'pdo_sqlite php extension is required'; 213 } 214 215 return empty($errors) ? true : $errors; 211 216 } 212 217 trunk/Phergie/Plugin/Lart.php
r253 r273 147 147 * @return bool TRUE if dependencies are met, FALSE otherwise 148 148 */ 149 public static function checkDependencies(Phergie_Driver_Abstract $client, array$plugins) 150 { 151 if (!extension_loaded('PDO') || !extension_loaded('pdo_sqlite')) { 152 return false; 153 } 154 155 return true; 149 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins) 150 { 151 $errors = array(); 152 153 if (!extension_loaded('PDO')) { 154 $errors[] = 'PDO php extension is required'; 155 } 156 if (!extension_loaded('pdo_sqlite')) { 157 $errors[] = 'pdo_sqlite php extension is required'; 158 } 159 160 return empty($errors) ? true : $errors; 156 161 } 157 162 trunk/Phergie/Plugin/Sed.php
r230 r273 55 55 * @return bool TRUE if dependencies are met, FALSE otherwise 56 56 */ 57 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins)57 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins) 58 58 { 59 59 if (self::staticPluginLoaded('Logging', $client, $plugins)) { 60 return false;60 return 'Logging plugin must be enabled'; 61 61 } 62 62 return true; trunk/Phergie/Plugin/Seen.php
r264 r273 136 136 * @return bool TRUE if dependencies are met, FALSE otherwise 137 137 */ 138 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins)138 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins) 139 139 { 140 140 if (self::staticPluginLoaded('Logging', $client, $plugins)) { 141 return false;141 return 'Logging plugin must be enabled'; 142 142 } 143 143 return true; trunk/Phergie/Plugin/Spellcheck.php
r258 r273 57 57 * @return bool TRUE if dependencies are met, FALSE otherwise 58 58 */ 59 static public function checkDependencies(Phergie_Driver_Abstract $client, array$plugins) 60 { 61 if (!extension_loaded('pspell') || !$client->getIni('spellcheck.lang')) { 62 return false; 63 } 64 65 return true; 59 static public function checkDependencies(Phergie_Driver_Abstract $client, array $plugins) 60 { 61 $errors = array(); 62 63 if (!extension_loaded('pspell')) { 64 $errors[] = 'pspell php extension is required'; 65 } 66 if (!$client->getIni('spellcheck.lang')) { 67 $errors[] = 'Ini setting spellcheck.lang must be filled-in'; 68 } 69 70 return empty($errors) ? true : $errors; 66 71 } 67 72 trunk/Phergie/Plugin/Tld.php
r237 r273 164 164 * @return bool TRUE if dependencies are met, FALSE otherwise 165 165 */ 166 public static function checkDependencies(Phergie_Driver_Abstract $client, array$plugins) 167 { 168 if (!extension_loaded('PDO') || !extension_loaded('pdo_sqlite')) { 169 return false; 170 } 171 172 return true; 166 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins) 167 { 168 $errors = array(); 169 170 if (!extension_loaded('PDO')) { 171 $errors[] = 'PDO php extension is required'; 172 } 173 if (!extension_loaded('pdo_sqlite')) { 174 $errors[] = 'pdo_sqlite php extension is required'; 175 } 176 177 return empty($errors) ? true : $errors; 173 178 } 174 179 trunk/Phergie/Plugin/Toggle.php
r232 r273 170 170 if (in_array($plugin, $plugins)) { 171 171 $class = 'Phergie_Plugin_' . $plugin; 172 if (call_user_func(array($class, 'checkDependencies'), $this->client, $plugins)) { 172 $result = call_user_func(array($class, 'checkDependencies'), $this->client, $plugins); 173 if ($result === true) { 173 174 $instance = new $class($this->client); 174 175 $this->client->addPlugin($instance); … … 176 177 $this->doNotice($user, 'Plugin ' . $plugin . ' loaded.'); 177 178 } else { 178 $this->doNotice($user, 'Plugin ' . $plugin . ' can not be loaded, missing dependencies.'); 179 if ($plugin === false) { 180 $this->doNotice($user, 'Plugin ' . $plugin . ' can not be loaded, missing dependencies.'); 181 } else { 182 $this->doNotice($user, 'Plugin ' . $plugin . ' can not be loaded : '. implode(', ', (array) $plugin)); 183 } 179 184 } 180 185 // Plugin file not found trunk/Phergie/Plugin/Weather.php
r256 r273 46 46 * @return bool TRUE if dependencies are met, FALSE otherwise 47 47 */ 48 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins)48 public static function checkDependencies(Phergie_Driver_Abstract $client, array $plugins) 49 49 { 50 50 $partnerId = $client->getIni('weather.partner_id'); 51 51 $licenseKey = $client->getIni('weather.license_key'); 52 52 53 if (!$partnerId || !$licenseKey) { 54 return false; 53 $errors = array(); 54 55 if (!$licenseKey) { 56 $errors[] = 'Ini setting weather.license_key must be filled-in'; 57 } 58 if (!$partnerId) { 59 $errors[] = 'Ini setting weather.partner_id must be filled-in'; 55 60 } 56 61 57 return true;62 return empty($errors) ? true : $errors; 58 63 } 59 64