From: Evan Prodromou Date: Fri, 13 Aug 2010 18:35:16 +0000 (-0700) Subject: helper static method to get title text based on a notice X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=67ff9ea49011fd8cc1c102c6fb236c47cd034342;p=quix0rs-gnu-social.git helper static method to get title text based on a notice --- diff --git a/plugins/NoticeTitle/Notice_title.php b/plugins/NoticeTitle/Notice_title.php index 44d56b4968..c2d1a83ca4 100644 --- a/plugins/NoticeTitle/Notice_title.php +++ b/plugins/NoticeTitle/Notice_title.php @@ -115,4 +115,22 @@ class Notice_title extends Memcached_DataObject { return array(false, false, false); } + + /** + * Get a notice title based on the notice + * + * @param Notice $notice Notice to fetch a title for + * + * @return string title of the notice, or null if none + */ + + static function fromNotice(Notice $notice) + { + $nt = Notice_title::staticGet('notice_id', $notice->id); + if (empty($nt)) { + return null; + } else { + return $nt->title; + } + } }