From 031f5a98f7554c4a396903a010e4d99f93444f6c Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 5 Mar 2011 14:47:37 -0500 Subject: [PATCH] add a couple of methods to MicroAppPlugin --- lib/microapp.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/microapp.php b/lib/microapp.php index 77e6abb7e3..23b4b5bb84 100644 --- a/lib/microapp.php +++ b/lib/microapp.php @@ -49,11 +49,22 @@ if (!defined('STATUSNET')) { * @link http://status.net/ */ -class MicroAppPlugin extends Plugin +abstract class MicroAppPlugin extends Plugin { - abstract function isMyNotice($notice); - abstract function isMyActivity($activity); + abstract function types(); abstract function saveNoticeFromActivity($activity); abstract function activityFromNotice($notice); abstract function showNotice($notice, $out); + abstract function entryForm(); + + function isMyNotice($notice) { + $types = $this->types(); + return in_array($notice->object_type, $types); + } + + function isMyActivity($activity) { + $types = $this->types(); + return (count($activity->objects) == 1 && + in_array($activity->objects[0]->type, $types)); + } } -- 2.39.5