瀏覽代碼

Removing hooks where we can from templates; one hook will probably have to stay; see comments in the code

pdontthink 18 年之前
父節點
當前提交
615692933a
共有 2 個文件被更改,包括 5 次插入4 次删除
  1. 3 3
      templates/default/left_main.tpl
  2. 2 1
      templates/default_advanced/left_main.tpl

+ 3 - 3
templates/default/left_main.tpl

@@ -229,7 +229,7 @@ function buildMailboxTree ($box, $settings, $icon_theme_path, $indent_factor=0)
  ********
  ********
     
     
     // let plugins fiddle with end of line
     // let plugins fiddle with end of line
-// FIXME: no hooks in templates!
+// FIXME: no hooks in templates! Although note that I'm not sure we can avoid it here because the context of which folder we are displaying is important to the hook, unless we preemptively iterate through all folders and collect the output from the hook call for that and give that to the template.... seems like overkill; I say this hook remains
     $end .= concat_hook_function('left_main_after_each_folder',
     $end .= concat_hook_function('left_main_after_each_folder',
             $temp=array(isset($numMessages) ? &$numMessages : '',
             $temp=array(isset($numMessages) ? &$numMessages : '',
             &$box['MailboxFullName'], &$settings['imapConnection']));
             &$box['MailboxFullName'], &$settings['imapConnection']));
@@ -263,7 +263,7 @@ extract($t);
 ?>
 ?>
 <body class="sqm_leftMain">
 <body class="sqm_leftMain">
 <div class="sqm_leftMain">
 <div class="sqm_leftMain">
-<?php /* FIXME: no hooks in templates! */ global $null; do_hook('left_main_before', $null); ?>
+<?php if (!empty($plugin_output['left_main_before'])) echo $plugin_output['left_main_before']; ?>
 <table class="sqm_wrapperTable" cellspacing="0">
 <table class="sqm_wrapperTable" cellspacing="0">
  <tr>
  <tr>
   <td>
   <td>
@@ -281,5 +281,5 @@ extract($t);
   </td>
   </td>
  </tr>
  </tr>
 </table>
 </table>
-<?php /* FIXME: no hooks in templates! */ do_hook('left_main_after', $null); ?>
+<?php if (!empty($plugin_output['left_main_after'])) echo $plugin_output['left_main_after']; ?>
 </div>
 </div>

+ 2 - 1
templates/default_advanced/left_main.tpl

@@ -245,6 +245,7 @@ function buildMailboxTree ($box, $settings, $icon_theme_path, $parent_node=-1) {
     }
     }
     
     
     return $out;
     return $out;
+//FIXME: somewhere above, need to insert the left_main_after_each_folder hook, or if no plugin hooks allowed in templates, at least the output from that hook (but I think it might be impossible not to have the hook here in this fxn
 }
 }
 
 
 /* retrieve the template vars */
 /* retrieve the template vars */
@@ -272,7 +273,7 @@ extract($t);
 //-->
 //-->
 </script>
 </script>
 <div class="sqm_leftMain">
 <div class="sqm_leftMain">
-<?php /* FIXME: no hooks in templates! */ global $null; do_hook('left_main_before', $null); ?>
+<?php if (!empty($plugin_output['left_main_before'])) echo $plugin_output['left_main_before']; ?>
 <div class="dtree">
 <div class="dtree">
 <table class="sqm_wrapperTable" cellspacing="0">
 <table class="sqm_wrapperTable" cellspacing="0">
  <tr>
  <tr>