Moved enumeration of all sources to PluginFactory

This commit is contained in:
2010-08-30 21:56:18 +01:00
parent f05ceada23
commit 16fb478652
3 changed files with 32 additions and 32 deletions

View File

@@ -16,6 +16,27 @@ class RippingCluster_Source_PluginFactory extends RippingCluster_PluginFactory {
self::loadPlugins($candidatePlugins, self::PLUGIN_PREFIX, self::PLUGIN_INTERFACE);
}
public static function enumerate($plugin) {
self::ensureScanned();
if ( ! self::isValidPlugin($plugin)) {
return null;
}
return call_user_func(array(self::classname($plugin), 'enumerate'));
}
public static function enumerateAll() {
self::ensureScanned();
$sources = array();
foreach (self::getValidPlugins() as $plugin) {
$this->sources = array_merge($this->sources, self::enumerate($plugin));
}
return $sources;
}
public static function load($plugin, $source_filename, $scan = true, $use_cache = true) {
self::ensureScanned();
@@ -36,6 +57,16 @@ class RippingCluster_Source_PluginFactory extends RippingCluster_PluginFactory {
return call_user_func(array(self::classname($plugin), 'loadEncoded'), $encoded_filename, $scan, $use_cache);
}
public static function isValidSource($plugin, $source_filename) {
self::ensureScanned();
if ( ! self::isValidPlugin($plugin)) {
return null;
}
return call_user_func(array(self::classname($plugin), 'isValidSource'), source_filename);
}
}
?>