From c2884f40f80227c1459e9ebafb9afd1d65f180a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 23 Dec 2017 01:02:30 +0100 Subject: [PATCH] Continued a bit: - re-added missing method, ops - removed break/continue where it is not allowed (according to PHP 7.1) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- classes/Notice.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/classes/Notice.php b/classes/Notice.php index 4adba35307..2cfdc7cce6 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -3290,6 +3290,29 @@ class Notice extends Managed_DataObject } } + public function delPref($namespace, $topic) { + return Notice_prefs::setData($this, $namespace, $topic, null); + } + + public function getPref($namespace, $topic, $default=null) { + // If you want an exception to be thrown, call Notice_prefs::getData directly + try { + return Notice_prefs::getData($this, $namespace, $topic, $default); + } catch (NoResultException $e) { + return null; + } + } + + // The same as getPref but will fall back to common_config value for the same namespace/topic + public function getConfigPref($namespace, $topic) + { + return Notice_prefs::getConfigData($this, $namespace, $topic); + } + + public function setPref($namespace, $topic, $data) { + return Notice_prefs::setData($this, $namespace, $topic, $data); + } + /** * Checks whether the current profile is allowed (in scope) to see this notice. * -- 2.39.5