From 5a0e03923f47bc1140fd71b4899cd1e35fd59006 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 23 Dec 2012 15:29:16 +0400 Subject: [PATCH] add and check plugin base class --- classes/plugin.php | 11 +++++++++++ classes/pluginhost.php | 2 +- plugins/flattr/flattr.php | 2 +- plugins/googleplus/googleplus.php | 2 +- plugins/identica/identica.php | 2 +- plugins/mail/mail.php | 2 +- plugins/note/note.php | 2 +- plugins/pinterest/pinterest.php | 2 +- plugins/pocket/pocket.php | 2 +- plugins/redditimgur/redditimgur.php | 2 +- plugins/share/share.php | 2 +- 11 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 classes/plugin.php diff --git a/classes/plugin.php b/classes/plugin.php new file mode 100644 index 000000000..59cb64f53 --- /dev/null +++ b/classes/plugin.php @@ -0,0 +1,11 @@ +link = $host->get_link(); + $this->host = $host; + } +} +?> diff --git a/classes/pluginhost.php b/classes/pluginhost.php index 4274ec37b..f4e01178b 100644 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -59,7 +59,7 @@ class PluginHost { if (file_exists($file)) require_once $file; - if (class_exists($class)) { + if (class_exists($class) && is_subclass_of($class, "Plugin")) { $plugin = new $class($this); $this->register_plugin($class, $plugin); diff --git a/plugins/flattr/flattr.php b/plugins/flattr/flattr.php index 6af6cb9c3..3bc427211 100644 --- a/plugins/flattr/flattr.php +++ b/plugins/flattr/flattr.php @@ -1,5 +1,5 @@