Remove "hook_getSubject", use a new param of hook_formatDisplayHeader instead
authorx2003bruneau <x2003bruneau@9869982d-c50d-0410-be91-f2a2ec7c7c7b>
Sat, 13 Jan 2007 14:35:59 +0000 (14:35 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:35:17 +0000 (00:35 +0100)
git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@161 9869982d-c50d-0410-be91-f2a2ec7c7c7b

banana/message.inc.php
banana/spool.inc.php

index 295af5b..17fcf5c 100644 (file)
@@ -107,12 +107,8 @@ final class BananaMessage extends BananaMimePart
             return $rsl;
 
           case "subject":
-            $link = null;
             $text = stripslashes($text);
-            if (function_exists('hook_getSubject')) {
-                $link = hook_getSubject($text);
-            }
-            return banana_catchFormats($text) . $link;
+            return banana_catchFormats($text);
 
           default:
             return $text;
index 73641e6..505c2c1 100644 (file)
@@ -49,7 +49,7 @@ class BananaSpoolHead
     public function __construct(array &$message)
     {
         $this->date       = $message['date'];
-        $this->subject    = stripslashes($message['subject']);
+        $this->subject    = $message['subject'];
         $this->from       = $message['from'];
         $this->desc       = 1;
         $this->isread     = true;
@@ -395,9 +395,7 @@ class BananaSpool
      * @param $_pfx_end STRING prefix used for children of current node
      * @param $_head BOOLEAN true if first post in thread
      *
-     * If you want to analyse subject, you can define the function hook_getSubject(&$subject) which
-     * take the subject as a reference parameter, transform this subject to be displaid in the spool
-     * view and return a string. This string will be put after the subject.
+     * If you want to analyse subject, you can define the function hook_formatDisplayHeader
      */
     private function _to_html($_id, $_index, $_first=0, $_last=0, $_ref="", $_pfx_node="", $_pfx_end="", $_head=true)
     {
@@ -429,14 +427,15 @@ class BananaSpool
             $res .= '<td class="subj' . ($_index == $_ref ? ' cur' : '') . '">'
                 . $_pfx_node .($hc ? ($_head ? $spfx_f : ($overview->parent_direct ? $spfx_s : $spfx_snd)) : $spfx_n);
             $subject = $overview->subject;
+            if (function_exists('hook_formatDisplayHeader')) {
+                list($subject, $link) = hook_formatDisplayHeader('subject', $subject, true);
+            } else {
+                $subject = banana_catchFormats(stripslashes($subject));
+                $link = null;
+            }
             if (empty($subject)) {
                 $subject = _b_('(pas de sujet)');
             }
-            $link = null;
-            if (function_exists('hook_getSubject')) {
-                $link = hook_getSubject($subject);
-            }
-            $subject = banana_catchFormats($subject);
             if ($_index != $_ref) {
                 $subject = Banana::$page->makeLink(Array('group' => $this->group, 'artid' => $_id,
                                                     'text'  => $subject, 'popup' => $subject));