* Raising Extbase and Fluid version numbers to 0.9.12
[Packages/TYPO3.CMS.git] / typo3 / template.php
index 9b3d68e..06b2605 100644 (file)
@@ -215,6 +215,12 @@ class template {
        protected $pageRenderer;
        protected $pageHeaderFooterTemplateFile = '';   // alternative template file
 
+       /**
+        * Whether flashmessages should be rendered or not
+        *
+        * @var $showFlashMessages
+        */
+       public $showFlashMessages = TRUE;
 
        /**
         * Constructor
@@ -270,7 +276,7 @@ class template {
 
        /**
         * Gets instance of PageRenderer
-        * 
+        *
         * @return      t3lib_PageRenderer
         */
        public function getPageRenderer() {
@@ -717,16 +723,16 @@ class template {
                $this->pageRenderer->setCharSet($this->charset);
                $this->pageRenderer->addMetaTag($this->generator());
                $this->pageRenderer->setTitle($title);
-               
+
                // add docstyles
                $this->docStyle();
 
 
                // add jsCode - has to go to headerData as it may contain the script tags already
                $this->pageRenderer->addHeaderData($this->JScode);
-               
+
                foreach ($this->JScodeArray as $name => $code) {
-                       $this->pageRenderer->addJsInlineCode($name, $code);     
+                       $this->pageRenderer->addJsInlineCode($name, $code);
                }
 
                if (count($this->JScodeLibArray)) {
@@ -747,7 +753,7 @@ class template {
                $this->JScodeArray = array();
 
                $this->endOfPageJsBlock = $this->pageRenderer->render(t3lib_PageRenderer::PART_FOOTER);
-               
+
                if ($this->docType=='xhtml_frames')     {
                        return $str;
                } else
@@ -878,14 +884,17 @@ $str.=$this->docBodyTagBegin().
         * @param       string          Additional attributes to h-tag, eg. ' class=""'
         * @return      string          HTML content
         */
-       function sectionHeader($label,$sH=FALSE,$addAttrib='')  {
-               $tag = ($sH?'h3':'h4');
+       function sectionHeader($label, $sH=FALSE, $addAttrib='') {
+               $tag = ($sH ? 'h3' : 'h4');
+               if ($addAttrib && substr($addAttrib, 0, 1) !== ' ') {
+                       $addAttrib = ' ' . $addAttrib;
+               }
                $str='
 
        <!-- Section header -->
-       <'.$tag.$addAttrib.'>'.$label.'</'.$tag.'>
+       <' . $tag . $addAttrib . '>' . $label . '</' . $tag . '>
 ';
-               return $this->sectionBegin().$str;
+               return $this->sectionBegin() . $str;
        }
 
        /**
@@ -1892,26 +1901,28 @@ $str.=$this->docBodyTagBegin().
                        $moduleBody = t3lib_parsehtml::substituteSubpart($moduleBody, $marker, $content);
                }
 
-                       // adding flash messages
-               $flashMessages = t3lib_FlashMessageQueue::renderFlashMessages();
-               if (!empty($flashMessages)) {
-                       $flashMessages = '<div id="typo3-messages">' . $flashMessages . '</div>';
-               }
+               if ($this->showFlashMessages) {
+                               // adding flash messages
+                       $flashMessages = t3lib_FlashMessageQueue::renderFlashMessages();
+                       if (!empty($flashMessages)) {
+                               $flashMessages = '<div id="typo3-messages">' . $flashMessages . '</div>';
+                       }
 
-               if (strstr($moduleBody, '###FLASHMESSAGES###')) {
-                               // either replace a dedicated marker for the messages if present
-                       $moduleBody = str_replace(
-                               '###FLASHMESSAGES###',
-                               $flashMessages,
-                               $moduleBody
-                       );
-               } else {
-                               // or force them to appear before the content
-                       $moduleBody = str_replace(
-                               '###CONTENT###',
-                               $flashMessages . '###CONTENT###',
-                               $moduleBody
-                       );
+                       if (strstr($moduleBody, '###FLASHMESSAGES###')) {
+                                       // either replace a dedicated marker for the messages if present
+                               $moduleBody = str_replace(
+                                       '###FLASHMESSAGES###',
+                                       $flashMessages,
+                                       $moduleBody
+                               );
+                       } else {
+                                       // or force them to appear before the content
+                               $moduleBody = str_replace(
+                                       '###CONTENT###',
+                                       $flashMessages . '###CONTENT###',
+                                       $moduleBody
+                               );
+                       }
                }
 
                        // replacing all markers with the finished markers and return the HTML content
@@ -2100,7 +2111,7 @@ class frontendDoc extends template {
                }
                if (count($this->JScodeArray)) {
                        foreach ($this->JScodeArray as $name => $code) {
-                               $pageRenderer->addJsInlineCode($name, $code);   
+                               $pageRenderer->addJsInlineCode($name, $code);
        }
 }