It looks like you're new here. If you want to get involved, click one of these buttons!
public function RegisterPlugins() {
// Loop through all declared classes looking for ones that implement Gdn_iPlugin.
foreach (get_declared_classes() as $ClassName) {
// Only register the plugin if it implements the Gdn_IPlugin interface
if (in_array('Gdn_IPlugin', class_implements($ClassName))) {
// If this plugin was already indexed, skip it.
if (array_key_exists($ClassName, $this->RegisteredPlugins))
continue;
// Register this plugin's methods
$this->RegisterPlugin($ClassName);
}
}
}
So, if there is any class loaded that implements Gdn_IPlugin, Vanilla tries to instantiate it as plugin, even if it is abstract. The simple fix looks like this:
// Register only non abstract classes.
$Reflection = new ReflectionClass($ClassName);
if (!$Reflection->isAbstract())
// Register this plugin's methods
$this->RegisterPlugin($ClassName);
But the question is - is this a proper way to go? Would such patch be committed?
Comments
Vanilla developer [GitHub, Twitter]
That is, the part of connection process is fetching user data, which is being accomplished not with oAuth API, but with service specific one. Facebook has it's own API, Vkontakte - it's own.
There just cannot be working oAuth dummy plugin. That's why it is supposed to be abstract.
But as I said, if I leave it out somewhere in plugin directory Vanilla will attempt to run this plugin. Even if it is not complete.
And yes, AuthCore is listed as RequiredPlugin in plugins for specific services.
And I could bear with non abstract class if Vanilla wouldn't have been trying to initiate it.
My addons: NillaBlog | Vanoogle
I understand that an abstract class would be the good-and-proper PHP approach, but I'm concerned about creating some corner case of plugin extensibility we need to support from now until the end of time, and wonder if that will be hard to communicate to plugin developers anyway.
Is it *possible* to create a plugin that simply provides a framework/inheritance for your other plugins and then list that as a RequiredPlugin for the others?
Vanilla developer [GitHub, Twitter]