]> git.wh0rd.org - tt-rss.git/commitdiff
add and check plugin base class
authorAndrew Dolgov <fox@fakecake.org>
Sun, 23 Dec 2012 11:29:16 +0000 (15:29 +0400)
committerAndrew Dolgov <fox@fakecake.org>
Sun, 23 Dec 2012 11:29:16 +0000 (15:29 +0400)
classes/plugin.php [new file with mode: 0644]
classes/pluginhost.php
plugins/flattr/flattr.php
plugins/googleplus/googleplus.php
plugins/identica/identica.php
plugins/mail/mail.php
plugins/note/note.php
plugins/pinterest/pinterest.php
plugins/pocket/pocket.php
plugins/redditimgur/redditimgur.php
plugins/share/share.php

diff --git a/classes/plugin.php b/classes/plugin.php
new file mode 100644 (file)
index 0000000..59cb64f
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+class Plugin {
+       private $link;
+       private $host;
+
+       function __construct($host) {
+               $this->link = $host->get_link();
+               $this->host = $host;
+       }
+}
+?>
index 4274ec37b1b46f6efa6168eb00bdcaf324087ac2..f4e01178b5ebce2f04b4eedc95a68eca0e2fe520 100644 (file)
@@ -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);
index 6af6cb9c315809e082dd4314b442d4b36716bab7..3bc42721156f871a0c57398ec1842aa0ece9fdfc 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-class Flattr {
+class Flattr extends Plugin {
        private $link;
        private $host;
 
index 1c5128eed5ad8a382a4451b696b5032e16a7f906..9505b409612f50da19af4316c64649f582ade155 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-class GooglePlus {
+class GooglePlus extends Plugin {
        private $link;
        private $host;
 
index e7a5b3573c3c8c7a3506c2aa85605d8a62dd83b9..5b7d4b3f6571902f239f4956e09b90ae8572d0cf 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-class Identica {
+class Identica extends Plugin {
        private $link;
        private $host;
 
index a633d815f33e1f60c30fdaf1b33b2efb4057eff5..c9b6ed541c0150806acb715942bec4fecba01c19 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-class Mail {
+class Mail extends Plugin {
 
        private $link;
        private $host;
index a856b5ac875e3dad3f5cd11eccde493c54b206d3..ebb0b5a25be5f069f090fcc7464c2d04fcd95f69 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-class Note {
+class Note extends Plugin {
        private $link;
        private $host;
 
index 83a95a449744e7f6d98a88edb59cc378182a1544..d50691baf4bf156f116f01e9fc847fd97a735b96 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-class Pinterest {
+class Pinterest extends Plugin {
        private $link;
        private $host;
 
index 56592a526403121a7dd9f4378fded9a1ebe3a314..6449b891dcb6fac81f391641f200960b83a2c356 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-class Pocket {
+class Pocket extends Plugin {
 
        private $link;
        private $host;
index 21aaed6e1d511ee76fb635a6b8f4fa5745e9531b..0255dd71b6b8bb176265a97589b557156c208b6a 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-class RedditImgur {
+class RedditImgur extends Plugin {
 
        private $link;
        private $host;
index 157c937ea7b1996ace7bd1c8b5697e40a2e39dbc..ce7c4a83cd01dc104d90db6f12466c4b296dc6dd 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-class Share {
+class Share extends Plugin {
        private $link;
        private $host;