From a217b243f84c3479283e9fd6d9ba7ff5601a68bf Mon Sep 17 00:00:00 2001 From: joomlart Date: Fri, 1 Feb 2013 14:36:30 +0700 Subject: [PATCH] Clean system-message-container if no message found --- source/plg_system_t3/includes/core/t3.php | 9 +++++++ .../plg_system_t3/includes/core/template.php | 26 +++++++++++++++++++ .../tpls/blocks/mainbody-content-left.php | 2 ++ .../tpls/blocks/mainbody-content-right.php | 2 ++ source/tpl_t3_blank/tpls/blocks/mainbody.php | 2 ++ 5 files changed, 41 insertions(+) diff --git a/source/plg_system_t3/includes/core/t3.php b/source/plg_system_t3/includes/core/t3.php index 34e21ee16c..49fcf69eda 100644 --- a/source/plg_system_t3/includes/core/t3.php +++ b/source/plg_system_t3/includes/core/t3.php @@ -143,6 +143,15 @@ public static function relativePath($path1, $path2='') { return rtrim ($path, '/'); } + + public static function error($msg, $code = 500){ + if (JError::$legacy) { + JError::setErrorHandling(E_ERROR, 'die'); + return JError::raiseError($code, $msg); + } else { + throw new Exception($msg, $code); + } + } } T3::init(); diff --git a/source/plg_system_t3/includes/core/template.php b/source/plg_system_t3/includes/core/template.php index 559a526d15..ea9edab7be 100644 --- a/source/plg_system_t3/includes/core/template.php +++ b/source/plg_system_t3/includes/core/template.php @@ -323,6 +323,32 @@ function checkSpotlight($name, $positions) return $this->_tpl && method_exists($this->_tpl, 'countModules') ? $this->_tpl->countModules (implode(' or ', $poss)) : 0; } + /** + * Check system messages + */ + private function checkSysMsg() + { + // Initialise variables. + $lists = array(); + + // Get the message queue + $messages = JFactory::getApplication()->getMessageQueue(); + + // Build the sorted message list + if (is_array($messages) && !empty($messages)) + { + foreach ($messages as $msg) + { + if (isset($msg['type']) && isset($msg['message'])) + { + $lists[$msg['type']][] = $msg['message']; + } + } + } + + return count($lists); + } + /** * Get position name * diff --git a/source/tpl_t3_blank/tpls/blocks/mainbody-content-left.php b/source/tpl_t3_blank/tpls/blocks/mainbody-content-left.php index d3780fd1e0..f479781063 100644 --- a/source/tpl_t3_blank/tpls/blocks/mainbody-content-left.php +++ b/source/tpl_t3_blank/tpls/blocks/mainbody-content-left.php @@ -57,7 +57,9 @@
getData ($layout, $col++) ?>> + checkSysMsg()):?> +
diff --git a/source/tpl_t3_blank/tpls/blocks/mainbody-content-right.php b/source/tpl_t3_blank/tpls/blocks/mainbody-content-right.php index 2a5ddc2297..ca09e531d9 100644 --- a/source/tpl_t3_blank/tpls/blocks/mainbody-content-right.php +++ b/source/tpl_t3_blank/tpls/blocks/mainbody-content-right.php @@ -57,7 +57,9 @@
getData ($layout, $col++) ?>> + checkSysMsg()):?> +
diff --git a/source/tpl_t3_blank/tpls/blocks/mainbody.php b/source/tpl_t3_blank/tpls/blocks/mainbody.php index cd6a6ea46f..476e4939f2 100644 --- a/source/tpl_t3_blank/tpls/blocks/mainbody.php +++ b/source/tpl_t3_blank/tpls/blocks/mainbody.php @@ -61,7 +61,9 @@
getData ($layout, $col++) ?>> + checkSysMsg()):?> +