Bring the left_main_after_each_folder hook to life
[squirrelmail.git] / functions / template / folder_list_util.php
index 1ce9c09ce21df621879ce857dd2c6112ce503919..61c4322acf1013df5e7896e673a2faf2fd311c46 100644 (file)
  * @since 1.5.2
  */
 function getMessageCount ($boxes, $type='total') {
+
+    global $trash_folder;
+
     // The Trash folder isn't counted...
-    if ($boxes->mailboxname_full == $GLOBALS['trash_folder'])
+    if ($boxes->mailboxname_full == $trash_folder)
         return 0;
         
     $count = 0;
@@ -44,6 +47,7 @@ function getMessageCount ($boxes, $type='total') {
 /**
  * Recursively iterates a mailboxes object to build a data structure that is
  * easy for template authors to work with.
+FIXME: well.... why not document that data structure here?
  * 
  * @param object $boxes Object of the class mailboxes
  * @author Steve Brown
@@ -112,5 +116,16 @@ function getBoxStructure ($boxes) {
         $box['ChildBoxes'][] = getBoxStructure($boxes->mbxs[$i]);
     }
     
+    // if plugins want to add some text or link after the folder name in
+    // the folder list, they should add to the "ExtraOutput" array element
+    // in $box (remember, it's passed through the hook by reference) -- making
+    // sure to play nice with other plugins by *concatenating* to "ExtraOutput"
+    // and NOT by overwriting it
+    //
+    // known users of this hook:
+    // empty_folders
+    //
+    do_hook('left_main_after_each_folder', $box);
+
     return $box;
 }