[Svn] r4561 - trunk/roundcubemail/program/include

trac at roundcube.net trac at roundcube.net
Fri Feb 18 10:54:19 CET 2011


Author: thomasb
Date: 2011-02-18 03:54:19 -0600 (Fri, 18 Feb 2011)
New Revision: 4561

Modified:
   trunk/roundcubemail/program/include/rcube_html_page.php
Log:
Add plugin hook before the final HTML content of a page is sent

Modified: trunk/roundcubemail/program/include/rcube_html_page.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_html_page.php	2011-02-17 14:35:06 UTC (rev 4560)
+++ trunk/roundcubemail/program/include/rcube_html_page.php	2011-02-18 09:54:19 UTC (rev 4561)
@@ -266,19 +266,23 @@
             $output = substr($output, 0, $pos) . $css . substr($output, $pos);
         }
 
-	    $this->base_path = $base_path;
+        $this->base_path = $base_path;
 
         // correct absolute paths in images and other tags
-	    // add timestamp to .js and .css filename
+        // add timestamp to .js and .css filename
         $output = preg_replace_callback(
             '!(src|href|background)=(["\']?)([a-z0-9/_.-]+)(["\'\s>])!i',
-	        array($this, 'file_callback'), $output);
+            array($this, 'file_callback'), $output);
         $output = str_replace('$__skin_path', $base_path, $output);
 
-        if ($this->charset != RCMAIL_CHARSET)
-	        echo rcube_charset_convert($output, RCMAIL_CHARSET, $this->charset);
-	    else
-	        echo $output;
+        // trigger hook with final HTML content to be sent
+        $hook = rcmail::get_instance()->plugins->exec_hook("send_page", array('content' => $output));
+        if (!$hook['abort']) {
+            if ($this->charset != RCMAIL_CHARSET)
+                echo rcube_charset_convert($hook['content'], RCMAIL_CHARSET, $this->charset);
+            else
+                echo $hook['content'];
+        }
     }
     
     /**

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list