]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Event/EventPlugin.php
Merge branch 'fixes/type-hints' into social-master
[quix0rs-gnu-social.git] / plugins / Event / EventPlugin.php
index 07394d30c35099c3d989fb615f0dc7762899fffa..7f95bd79550327fb572152a410021f30a2e13849 100644 (file)
@@ -44,7 +44,7 @@ if (!defined('STATUSNET')) {
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
  * @link      http://status.net/
  */
-class EventPlugin extends MicroappPlugin
+class EventPlugin extends MicroAppPlugin
 {
     /**
      * Set up our tables (event and rsvp)
@@ -67,11 +67,11 @@ class EventPlugin extends MicroappPlugin
     /**
      * Map URLs to actions
      *
-     * @param Net_URL_Mapper $m path-to-action mapper
+     * @param URLMapper $m path-to-action mapper
      *
      * @return boolean hook value; true means continue processing, false means stop.
      */
-    function onRouterInitialized($m)
+    function onRouterInitialized(URLMapper $m)
     {
         $m->connect('main/event/new',
                     array('action' => 'newevent'));
@@ -90,7 +90,7 @@ class EventPlugin extends MicroappPlugin
         return true;
     }
 
-    function onPluginVersion(&$versions)
+    function onPluginVersion(array &$versions)
     {
         $versions[] = array('name' => 'Event',
                             'version' => GNUSOCIAL_VERSION,
@@ -128,7 +128,7 @@ class EventPlugin extends MicroappPlugin
      *
      * @return Notice the resulting notice
      */
-    function saveNoticeFromActivity($activity, $actor, $options=array())
+    function saveNoticeFromActivity(Activity $activity, Profile $actor, array $options=array())
     {
         if (count($activity->objects) != 1) {
             // TRANS: Exception thrown when there are too many activity objects.
@@ -182,7 +182,7 @@ class EventPlugin extends MicroappPlugin
      *
      * @return ActivityObject
      */
-    function activityObjectFromNotice($notice)
+    function activityObjectFromNotice(Notice $notice)
     {
         $happening = null;
 
@@ -216,7 +216,7 @@ class EventPlugin extends MicroappPlugin
         $obj->type    = Happening::OBJECT_TYPE;
         $obj->title   = $happening->title;
         $obj->summary = $happening->description;
-        $obj->link    = $notice->bestUrl();
+        $obj->link    = $notice->getUrl();
 
         // XXX: how to get this stuff into JSON?!
 
@@ -243,12 +243,12 @@ class EventPlugin extends MicroappPlugin
      *
      * @return ActivityObject
      */
-    function onEndNoticeAsActivity($notice, &$act) {
-        switch ($notice->object_type) {
+    protected function extendActivity(Notice $stored, Activity $act, Profile $scoped=null) {
+        switch ($stored->object_type) {
         case RSVP::POSITIVE:
         case RSVP::NEGATIVE:
         case RSVP::POSSIBLE:
-            $act->verb = $notice->object_type;
+            $act->verb = $stored->object_type;
             break;
         }
         return true;
@@ -288,35 +288,35 @@ class EventPlugin extends MicroappPlugin
      *
      * @param Notice $notice
      */
-    function deleteRelated($notice)
+    function deleteRelated(Notice $notice)
     {
         switch ($notice->object_type) {
         case Happening::OBJECT_TYPE:
-            common_log(LOG_DEBUG, "Deleting event from notice...");
+            common_debug("Deleting event from notice...");
             $happening = Happening::fromNotice($notice);
             $happening->delete();
             break;
         case RSVP::POSITIVE:
         case RSVP::NEGATIVE:
         case RSVP::POSSIBLE:
-            common_log(LOG_DEBUG, "Deleting rsvp from notice...");
+            common_debug("Deleting rsvp from notice...");
             $rsvp = RSVP::fromNotice($notice);
-            common_log(LOG_DEBUG, "to delete: $rsvp->id");
+            common_debug("to delete: $rsvp->id");
             $rsvp->delete();
             break;
         default:
-            common_log(LOG_DEBUG, "Not deleting related, wtf...");
+            common_debug("Not deleting related, wtf...");
         }
     }
 
     function onEndShowScripts($action)
     {
-        $action->script($this->path('event.js'));
+        $action->script($this->path('js/event.js'));
     }
 
     function onEndShowStyles($action)
     {
-        $action->cssLink($this->path('event.css'));
+        $action->cssLink($this->path('css/event.css'));
         return true;
     }