Merge "New getHTML() method for QuickTemplate to get the HTML of a template."
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 21 Nov 2013 21:53:13 +0000 (21:53 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 21 Nov 2013 21:53:13 +0000 (21:53 +0000)
includes/OutputPage.php
includes/SkinTemplate.php

index 5ffb802..638887b 100644 (file)
@@ -1629,10 +1629,7 @@ class OutputPage extends ContextSource {
         * @param $template QuickTemplate
         */
        public function addTemplate( &$template ) {
-               ob_start();
-               $template->execute();
-               $this->addHTML( ob_get_contents() );
-               ob_end_clean();
+               $this->addHTML( $template->getHTML() );
        }
 
        /**
index 014d514..2808cf9 100644 (file)
@@ -1457,6 +1457,20 @@ abstract class QuickTemplate {
        public function getSkin() {
                return $this->data['skin'];
        }
+
+       /**
+        * Fetch the output of a QuickTemplate and return it
+        *
+        * @since 1.23
+        * @return String
+        */
+       public function getHTML() {
+               ob_start();
+               $this->execute();
+               $html = ob_get_contents();
+               ob_end_clean();
+               return $html;
+       }
 }
 
 /**