From f2619bb105bb5a90eacb25d9c74eeecc22301638 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Wed, 22 Oct 2014 13:40:44 +0000 Subject: [PATCH] Simplify threads filtering --- Plugin.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Plugin.php b/Plugin.php index 0b01e88..6e7d2ba 100644 --- a/Plugin.php +++ b/Plugin.php @@ -74,17 +74,15 @@ class Plugin extends AbstractPlugin implements PluginInterface */ public function alterThreads(&$args) { - $modified = false; - foreach ($args['threads'] as $key => $thread) { + $threads = array(); + foreach ($args['threads'] as $thread) { if ($thread['ban']) { - unset($args['threads'][$key]); - $modified = true; + // Skip banned threads + continue; } + $threads[] = $thread; } - if ($modified) { - // Keep keys of the array serial. - $args['threads'] = array_values($args['threads']); - } + $args['threads'] = $threads; } }