From d1581fc53b26e10afe63a1a6c5942e09418b7199 Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Wed, 10 Sep 2008 16:46:23 +0000 Subject: [PATCH] MDL-16423 - make the button object more robust by detecting errors better --- lib/portfoliolib.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/portfoliolib.php b/lib/portfoliolib.php index e0672347f3..fc3cb35a24 100644 --- a/lib/portfoliolib.php +++ b/lib/portfoliolib.php @@ -144,6 +144,12 @@ class portfolio_add_button { } $formats = call_user_func(array($this->callbackclass, 'supported_formats')); } + $allformats = portfolio_supported_formats(); + foreach ($formats as $f) { + if (!array_key_exists($f, $allformats)) { + throw new portfolio_button_exception('invalidformat', 'portfolio', $f); + } + } $this->formats = $formats; } -- 2.39.5