From f12185395b4406927ff78b7049cedadded9939b3 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sun, 12 Jul 2009 22:51:15 -0400 Subject: [PATCH] PHP garbage collection fix --- functions.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/functions.php b/functions.php index 75cdbf4..008d236 100644 --- a/functions.php +++ b/functions.php @@ -16,6 +16,7 @@ function __comicpress_init() { $comicpress = new ComicPress(); $comicpress->init(); + $addons = array(); if (is_dir($addons_dir = (dirname(__FILE__) . '/addons'))) { $entries = glob($addons_dir . '/*'); @@ -27,19 +28,19 @@ function __comicpress_init() { require_once($entry . "/${classname}.inc"); $classname = "ComicPressAddon${classname}"; if (class_exists($classname)) { - $addon = new $classname(); - $addon->init(&$comicpress); + $addons[] = new $classname(); + end($addons)->init(&$comicpress); if (is_admin()) { - add_action('admin_notices', array(&$addon, 'display_messages')); if (is_array($_POST['cp'])) { if (isset($_POST['cp']['_nonce'])) { if (wp_verify_nonce($_POST['cp']['_nonce'], 'comicpress')) { - if (method_exists($addon, 'handle_update')) { - $addon->handle_update(); + if (method_exists(end($addons), 'handle_update')) { + end($addons)->handle_update(); } } } } + add_action('admin_notices', array(end($addons), 'display_messages')); } } }