]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/microappplugin.php
Misses this file to merge. I like the comments.
[quix0rs-gnu-social.git] / lib / microappplugin.php
index c6cf4554ddd01de43bd088fd604ff7aa234e87c8..53fe5e9995eab4d7bf467c7015d769c8122dbd04 100644 (file)
@@ -61,15 +61,6 @@ abstract class MicroAppPlugin extends ActivityHandlerPlugin
      */
     abstract function appTitle();
 
-    /**
-     * Returns a key string which represents this micro-app in HTML
-     * ids etc, as when offering selection of what type of post to make.
-     * This is paired with the user-visible localizable $this->appTitle().
-     *
-     * All micro-app classes must override this method.
-     */
-    abstract function tag();
-
     /**
      * When building the primary notice form, we'll fetch also some
      * alternate forms for specialized types -- that's you!
@@ -99,25 +90,21 @@ abstract class MicroAppPlugin extends ActivityHandlerPlugin
      * @param NoticeListItem $nli The list item being shown.
      *
      * @return boolean hook value
-     *
-     * @fixme WARNING WARNING WARNING this closes a 'div' that is implicitly opened in BookmarkPlugin's showNotice implementation
      */
-    function onStartShowNoticeItem($nli)
+    function onStartShowNoticeItem(NoticeListItem $nli)
     {
         if (!$this->isMyNotice($nli->notice)) {
             return true;
         }
 
-        $adapter = $this->adaptNoticeListItem($nli);
+        // Legacy use was creating a "NoticeListItemAdapter", but
+        // nowadays we solve that using event handling for microapps.
+        // This section will remain until all plugins are fixed.
+        $adapter = $this->adaptNoticeListItem($nli) ?: $nli;
 
-        if (!empty($adapter)) {
-            $adapter->showNotice();
-            $adapter->showNoticeAttachments();
-            $adapter->showNoticeInfo();
-            $adapter->showNoticeOptions();
-        } else {
-            $this->oldShowNotice($nli);
-        }
+        $adapter->showNotice();
+        $adapter->showNoticeAttachments();
+        $adapter->showNoticeFooter();
 
         return false;
     }
@@ -135,32 +122,6 @@ abstract class MicroAppPlugin extends ActivityHandlerPlugin
       return null;
     }
 
-    function oldShowNotice($nli)
-    {
-        $out = $nli->out;
-        $notice = $nli->notice;
-
-        try {
-            $this->showNotice($notice, $out);
-        } catch (Exception $e) {
-            common_log(LOG_ERR, $e->getMessage());
-            // try to fall back
-            $out->elementStart('div');
-            $nli->showAuthor();
-            $nli->showContent();
-        }
-
-        $nli->showNoticeLink();
-        $nli->showNoticeSource();
-        $nli->showNoticeLocation();
-        $nli->showContext();
-        $nli->showRepeat();
-
-        $out->elementEnd('div');
-
-        $nli->showNoticeOptions();
-    }
-
     function onStartShowEntryForms(&$tabs)
     {
         $tabs[$this->tag()] = array('title' => $this->appTitle(),
@@ -178,10 +139,4 @@ abstract class MicroAppPlugin extends ActivityHandlerPlugin
 
         return true;
     }
-
-    function showNotice($notice, $out)
-    {
-        // TRANS: Server exception thrown when a micro app plugin developer has not done his job too well.
-        throw new ServerException(_('You must implement either adaptNoticeListItem() or showNotice().'));
-    }
 }