]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
add a couple of methods to MicroAppPlugin
authorEvan Prodromou <evan@status.net>
Sat, 5 Mar 2011 19:47:37 +0000 (14:47 -0500)
committerEvan Prodromou <evan@status.net>
Sat, 5 Mar 2011 19:47:37 +0000 (14:47 -0500)
lib/microapp.php

index 77e6abb7e3e2ec86acc0c0cec1636a5a5eaf8105..23b4b5bb8422b7636b7d1896bccbcdba08c107d8 100644 (file)
@@ -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));
+    }
 }