]> git.wh0rd.org Git - tt-rss.git/commitdiff
remove hook-based plugins
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 21 Aug 2012 10:37:43 +0000 (14:37 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 21 Aug 2012 10:37:43 +0000 (14:37 +0400)
backend.php
classes/feeds.php
classes/plugin.php [deleted file]
classes/plugin/example.php [deleted file]
classes/plugins.php [deleted file]
include/functions.php
include/rssfuncs.php
update.php
update_daemon2.php

index b0ef5e0f1f2db261b54faa052a52874850c3dd95..13568d1657d605277362672a7d6fe6fcac7f1049 100644 (file)
@@ -77,8 +77,6 @@
                return;
        }
 
-       $plugins = new Plugins($link);
-
        $purge_intervals = array(
                0  => __("Use default"),
                -1 => __("Never purge"),
index 7598b0af80061ddbc19c7532bdba0572ffe7939c..c3b20df97e728a029b55cd52d1c382f3d2d2761b 100644 (file)
@@ -121,8 +121,6 @@ class Feeds extends Handler_Protected {
                                        $next_unread_feed, $offset, $vgr_last_feed = false,\r
                                        $override_order = false, $include_children = false) {\r
 \r
-               global $plugins;\r
-\r
                $disable_cache = false;\r
 \r
                $reply = array();\r
@@ -222,8 +220,6 @@ class Feeds extends Handler_Protected {
 \r
                $headlines_count = db_num_rows($result);\r
 \r
-               $plugins->hook('headlines_before', $reply);\r
-\r
                if (get_pref($this->link, 'COMBINED_DISPLAY_MODE')) {\r
                        $button_plugins = array();\r
                        foreach (explode(",", ARTICLE_BUTTON_PLUGINS) as $p) {\r
@@ -248,13 +244,6 @@ class Feeds extends Handler_Protected {
                        if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PS", $timing_info);\r
 \r
                        while ($line = db_fetch_assoc($result)) {\r
-\r
-                               if (get_pref($this->link, 'COMBINED_DISPLAY_MODE')) {\r
-                                       $plugins->hook('cdm_article_before', $line);\r
-                               } else {\r
-                                       $plugins->hook('headlines_row', $line);\r
-                               }\r
-\r
                                $class = ($lnum % 2) ? "even" : "odd";\r
 \r
                                $id = $line["id"];\r
@@ -683,15 +672,11 @@ class Feeds extends Handler_Protected {
 \r
                                        $reply['content'] .= "</div>";\r
 \r
-                                       $plugins->hook('cdm_article_after', $reply['content']);\r
-\r
                                }\r
 \r
                                ++$lnum;\r
                        }\r
 \r
-                       $plugins->hook('headlines_after', $reply);\r
-\r
                        if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PE", $timing_info);\r
 \r
                } else {\r
diff --git a/classes/plugin.php b/classes/plugin.php
deleted file mode 100644 (file)
index b96874a..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-class Plugin {
-       protected $link;
-       protected $handler;
-
-       function __construct($link, $handler) {
-               $this->link = $link;
-               $this->handler = $handler;
-               $this->initialize();
-       }
-
-       function initialize() {
-
-
-       }
-
-       function add_listener($hook) {
-               $this->handler->add_listener($hook, $this);
-       }
-}
-?>
diff --git a/classes/plugin/example.php b/classes/plugin/example.php
deleted file mode 100644 (file)
index e10781a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?
-       class Plugin_Example extends Plugin {
-               function initialize() {
-                       $this->add_listener('article_before');
-               }
-
-               function article_before(&$line) {
-                       $line["title"] = "EXAMPLE/REPLACED:" . $line["title"];
-               }
-       }
-?>
diff --git a/classes/plugins.php b/classes/plugins.php
deleted file mode 100644 (file)
index 6f3720c..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-class Plugins {
-       protected $link;
-       protected $plugins;
-       protected $listeners;
-
-       function __construct($link) {
-               $this->link = $link;
-               $this->listeners = array();
-               $this->load_plugins();
-       }
-
-       function load_plugins() {
-               if (defined('_ENABLE_PLUGINS')) {
-                       $plugins = explode(",", _ENABLE_PLUGINS);
-
-                       foreach ($plugins as $p) {
-                               $plugin_class = "plugin_$p";
-                               if (class_exists($plugin_class)) {
-                                       $plugin = new $plugin_class($this->link, $this);
-                               }
-                       }
-               }
-       }
-
-       function add_listener($hook_name, $plugin) {
-               if (!is_array($this->listeners[$hook_name]))
-                       $this->listeners[$hook_name] = array();
-
-               array_push($this->listeners[$hook_name], $plugin);
-       }
-
-       function hook($hook_name, &$params) {
-               if (is_array($this->listeners[$hook_name])) {
-                       foreach ($this->listeners[$hook_name] as $p) {
-                               if (method_exists($p, $hook_name)) {
-                                       $p->$hook_name($params);
-                               }
-                       }
-               }
-       }
-
-}
-?>
index 632c1e628134964790b33f8c51e4022b808a99e5..957146f1f77ec3827195170d902f6655688539eb 100644 (file)
        }
 
        function format_article($link, $id, $mark_as_read = true, $zoom_mode = false, $owner_uid = false) {
-               global $plugins;
-
                if (!$owner_uid) $owner_uid = $_SESSION["uid"];
 
                $rv = array();
 
                        $line = db_fetch_assoc($result);
 
-                       $plugins->hook('article_before', $line);
-
                        if ($line["icon_url"]) {
                                $feed_icon = "<img src=\"" . $line["icon_url"] . "\">";
                        } else {
                        $rv['content'] .= "</body></html>";
                }
 
-               $plugins->hook('article_after', $rv);
-
                return $rv;
 
        }
index 4ad08df32e7be7713d0bb45b3fff01e9be136004..241896f8bcb737ed749cea292e265efea9656441 100644 (file)
        function update_rss_feed($link, $feed, $ignore_daemon = false, $no_cache = false,
                $override_url = false) {
 
-               global $plugins;
-
                require_once "lib/simplepie/simplepie.inc";
                require_once "lib/magpierss/rss_fetch.inc";
                require_once 'lib/magpierss/rss_utils.inc';
                        }
 
                        foreach ($iterator as $item) {
-                               $hook_params = array("item" => &$item, "feed" => $feed);
-
-                               $plugins->hook('rss_update_item', $hook_params);
-
                                if ($_REQUEST['xdebug'] == 2) {
                                        print_r($item);
                                }
index 2c7f347d91ce86f41674956e926d7a1c3effe5fb..292b5c1be12a9c2b52961fce00b3ca80d8d4948b 100755 (executable)
@@ -56,8 +56,6 @@
 
        init_connection($link);
 
-       $plugins = new Plugins($link);
-
        if (in_array("-feeds", $op)) {
                // Update all feeds needing a update.
                update_daemon_common($link);
index b79a1a2b282e32b6a015051063a702b83c990230..6410709adf37882be1df4a7dc51bc663f4c13bd4 100755 (executable)
 
                                        if (!init_connection($link)) return;
 
-                                       $plugins = new Plugins($link);
-
                                        // We disable stamp file, since it is of no use in a multiprocess update.
                                        // not really, tho for the time being -fox
                                        if (!make_stampfile('update_daemon.stamp')) {