aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2012-02-03 02:17:49 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2012-03-18 02:48:55 -0400
commitbe23445b8c40b99c0d27bfb99521022d7b4705e8 (patch)
tree25242346a80bda9628e071d432a7b5bfb22240a2 /phpBB
parentfbf34f16ab5526669dae5b7eb130aac0803e3aed (diff)
downloadforums-be23445b8c40b99c0d27bfb99521022d7b4705e8.tar
forums-be23445b8c40b99c0d27bfb99521022d7b4705e8.tar.gz
forums-be23445b8c40b99c0d27bfb99521022d7b4705e8.tar.bz2
forums-be23445b8c40b99c0d27bfb99521022d7b4705e8.tar.xz
forums-be23445b8c40b99c0d27bfb99521022d7b4705e8.zip
[feature/event-dispatcher] Add get_data_filtered function to event data.
Its purpose is to discard any keys added by hooks to data stored in the event, such that only keys that the ledge knows how to handle are processed. PHPBB3-9550
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/event/data.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/phpBB/includes/event/data.php b/phpBB/includes/event/data.php
index 62e2f2312e..5780ddbfff 100644
--- a/phpBB/includes/event/data.php
+++ b/phpBB/includes/event/data.php
@@ -36,6 +36,16 @@ class phpbb_event_data extends Event implements ArrayAccess
return $this->data;
}
+ /*
+ * Returns data filtered to only include specified keys.
+ *
+ * This effectively discards any keys added to data by hooks.
+ */
+ public function get_data_filtered($keys)
+ {
+ return array_intersect_key($this->data, array_flip($keys));
+ }
+
public function offsetExists($offset)
{
return isset($this->data[$offset]);