summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2012-08-21 14:37:43 +0400
committerAndrew Dolgov <[email protected]>2012-08-21 14:37:43 +0400
commit9aceda3afc70eba20fa236c46c050b1e63ca07ca (patch)
tree74f3e8db16db3b9eb4aef5389be6ed4e00f0347f
parent23d2471c925ed31228e68210e7a55c836234645e (diff)
remove hook-based plugins
-rw-r--r--backend.php2
-rw-r--r--classes/feeds.php15
-rw-r--r--classes/plugin.php21
-rw-r--r--classes/plugin/example.php11
-rw-r--r--classes/plugins.php44
-rw-r--r--include/functions.php6
-rw-r--r--include/rssfuncs.php6
-rwxr-xr-xupdate.php2
-rwxr-xr-xupdate_daemon2.php2
9 files changed, 0 insertions, 109 deletions
diff --git a/backend.php b/backend.php
index b0ef5e0f1..13568d165 100644
--- a/backend.php
+++ b/backend.php
@@ -77,8 +77,6 @@
return;
}
- $plugins = new Plugins($link);
-
$purge_intervals = array(
0 => __("Use default"),
-1 => __("Never purge"),
diff --git a/classes/feeds.php b/classes/feeds.php
index 7598b0af8..c3b20df97 100644
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -121,8 +121,6 @@ class Feeds extends Handler_Protected {
$next_unread_feed, $offset, $vgr_last_feed = false,
$override_order = false, $include_children = false) {
- global $plugins;
-
$disable_cache = false;
$reply = array();
@@ -222,8 +220,6 @@ class Feeds extends Handler_Protected {
$headlines_count = db_num_rows($result);
- $plugins->hook('headlines_before', $reply);
-
if (get_pref($this->link, 'COMBINED_DISPLAY_MODE')) {
$button_plugins = array();
foreach (explode(",", ARTICLE_BUTTON_PLUGINS) as $p) {
@@ -248,13 +244,6 @@ class Feeds extends Handler_Protected {
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PS", $timing_info);
while ($line = db_fetch_assoc($result)) {
-
- if (get_pref($this->link, 'COMBINED_DISPLAY_MODE')) {
- $plugins->hook('cdm_article_before', $line);
- } else {
- $plugins->hook('headlines_row', $line);
- }
-
$class = ($lnum % 2) ? "even" : "odd";
$id = $line["id"];
@@ -683,15 +672,11 @@ class Feeds extends Handler_Protected {
$reply['content'] .= "</div>";
- $plugins->hook('cdm_article_after', $reply['content']);
-
}
++$lnum;
}
- $plugins->hook('headlines_after', $reply);
-
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PE", $timing_info);
} else {
diff --git a/classes/plugin.php b/classes/plugin.php
deleted file mode 100644
index b96874a20..000000000
--- a/classes/plugin.php
+++ /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
index e10781aa0..000000000
--- a/classes/plugin/example.php
+++ /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
index 6f3720ca9..000000000
--- a/classes/plugins.php
+++ /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);
- }
- }
- }
- }
-
-}
-?>
diff --git a/include/functions.php b/include/functions.php
index 632c1e628..957146f1f 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -3212,8 +3212,6 @@
}
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();
@@ -3275,8 +3273,6 @@
$line = db_fetch_assoc($result);
- $plugins->hook('article_before', $line);
-
if ($line["icon_url"]) {
$feed_icon = "<img src=\"" . $line["icon_url"] . "\">";
} else {
@@ -3489,8 +3485,6 @@
$rv['content'] .= "</body></html>";
}
- $plugins->hook('article_after', $rv);
-
return $rv;
}
diff --git a/include/rssfuncs.php b/include/rssfuncs.php
index 4ad08df32..241896f8b 100644
--- a/include/rssfuncs.php
+++ b/include/rssfuncs.php
@@ -212,8 +212,6 @@
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';
@@ -559,10 +557,6 @@
}
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);
}
diff --git a/update.php b/update.php
index 2c7f347d9..292b5c1be 100755
--- a/update.php
+++ b/update.php
@@ -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);
diff --git a/update_daemon2.php b/update_daemon2.php
index b79a1a2b2..6410709ad 100755
--- a/update_daemon2.php
+++ b/update_daemon2.php
@@ -189,8 +189,6 @@
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')) {