AntonLV %!s(int64=8) %!d(string=hai) anos
pai
achega
85e9f3f7b3

+ 2 - 2
template/menu_footer.html

@@ -1,8 +1,8 @@
 <ul id="bx-menu-footer" class="bx-menu-hor bx-menu-object-__object__ bx-clearfix">
     <bx_repeat:menu_items>
         <li class="bx-def-margin-right-auto bx-def-margin-thd-bottom __class_add__">
-            <a href="__link__" target="__target__" onclick="__onclick__" title="__alt__">
-                <bx_if:image><img title="__alt__" src="__icon_url__" /></bx_if:image>
+            <a href="__link__" target="__target__" onclick="__onclick__" title="__title_attr__">
+                <bx_if:image><img title="__title_attr__" src="__icon_url__" /></bx_if:image>
                 <bx_if:icon><i class="sys-icon __icon__"></i></bx_if:icon>
                 <bx_if:title>__title__</bx_if:title>
             </a>

+ 21 - 7
template/scripts/BxBaseMenuFooter.php

@@ -23,7 +23,11 @@ class BxBaseMenuFooter extends BxTemplMenu
         foreach($aItems as $iKey => $aItem) {
             switch($aItem['name']) {
                 case 'switch_language':
-                    $aItems[$iKey]['title'] = _t('_sys_menu_item_title_switch_language_mask', $aItems[$iKey]['title'], genFlag());
+                    $sTitle = _t('_sys_menu_item_title_switch_language_mask', $aItems[$iKey]['title'], genFlag());
+
+                    $aItems[$iKey]['title'] = $sTitle;
+                    $aItems[$iKey]['bx_if:title']['condition'] = (bool)$sTitle;
+                    $aItems[$iKey]['bx_if:title']['content']['title'] = $sTitle;
                     break;
 
                 case 'switch_template':
@@ -32,16 +36,26 @@ class BxBaseMenuFooter extends BxTemplMenu
                 	$sTemplateName = $this->_oTemplate->getCode();                    
                     $sTemplateTitle = isset($aTemplates[$sTemplateName]) ? $aTemplates[$sTemplateName] : '';
 
-                    $aItems[$iKey]['title'] = _t('_sys_menu_item_title_switch_template_mask', $aItems[$iKey]['title'], $sTemplateTitle);
+                    $sTitle = _t('_sys_menu_item_title_switch_template_mask', $aItems[$iKey]['title'], $sTemplateTitle);
+
+                    $aItems[$iKey]['title'] = $sTitle;
+                    $aItems[$iKey]['bx_if:title']['condition'] = (bool)$sTitle;
+                    $aItems[$iKey]['bx_if:title']['content']['title'] = $sTitle;
                     break;
+
                 case 'powered_by':
-                    $aItems[$iKey]['alt'] = _t('_sys_txt_powered_by');
-                    $aItems[$iKey]['bx_if:image']['content']['alt'] = _t('_sys_txt_powered_by');
+                    $sTitleAttr = bx_html_attribute(_t('_sys_txt_powered_by'));
+
+                    $aItems[$iKey]['title_attr'] = $sTitleAttr;
+                    $aItems[$iKey]['bx_if:image']['content']['title_attr'] = $sTitleAttr;
                     break;
             }
-            if (!isset($aItems[$iKey]['alt'])) {
-                $aItems[$iKey]['alt'] = $aItems[$iKey]['title'];
-                $aItems[$iKey]['bx_if:image']['content']['alt'] = $aItems[$iKey]['title'];
+
+            if (!isset($aItems[$iKey]['title_attr'])) {
+                $sTitleAttr = bx_html_attribute(strip_tags($aItems[$iKey]['title']));
+
+                $aItems[$iKey]['title_attr'] = $sTitleAttr;
+                $aItems[$iKey]['bx_if:image']['content']['title_attr'] = $sTitleAttr;
             }
         }
 

+ 51 - 21
template/scripts/BxBaseMenuSwitchLanguage.php

@@ -12,9 +12,13 @@
  */
 class BxBaseMenuSwitchLanguage extends BxTemplMenu
 {
+    protected $_sType;
+
     public function __construct ($aObject, $oTemplate)
     {
         parent::__construct ($aObject, $oTemplate);
+
+        $this->_sType = str_replace('sys_switch_language_', '', $this->_sObject);
     }
 
     public function getMenuItems ()
@@ -33,26 +37,10 @@ class BxBaseMenuSwitchLanguage extends BxTemplMenu
         $sLanguage = BxDolLanguages::getInstance()->getCurrentLangName();
         $this->setSelected('', $sLanguage);
 
-        $oPermalink = BxDolPermalinks::getInstance();
-
-        $aBaseLink = parse_url(BX_DOL_URL_ROOT);
-        $sBaseLink = (!empty($aBaseLink['scheme']) ? $aBaseLink['scheme'] : 'http') . '://' . $aBaseLink['host'];
-        $sPageLink = $oPermalink->unpermalink($sBaseLink . $_SERVER['REQUEST_URI'], false);
-
-        $sPageParams = '';
-        if(strpos($sPageLink, '?') !== false)
-        	list($sPageLink, $sPageParams) = explode('?', $sPageLink);
-
-        $aPageParams = array();
-        if(!empty($sPageParams))
-        	parse_str($sPageParams, $aPageParams);
+        list($sPageLink, $aPageParams) = $this->{'getBaseUrl' . bx_gen_method_name($this->_sType)}();
 
-		$aPageParamsAdd = array();
-		if(!empty($_SERVER['QUERY_STRING'])) {
-			parse_str($_SERVER['QUERY_STRING'], $aPageParamsAdd);
-			if(!empty($aPageParamsAdd) && is_array($aPageParamsAdd))
-				$aPageParams = array_merge($aPageParams, $aPageParamsAdd);
-		}
+        $oPermalink = BxDolPermalinks::getInstance();
+		$sMethod = 'getItemTitle' . bx_gen_method_name($this->_sType);
 
         $aItems = array();
         foreach( $aLanguages as $sName => $sLang ) {
@@ -62,7 +50,7 @@ class BxBaseMenuSwitchLanguage extends BxTemplMenu
                 'id' => $sName,
                 'name' => $sName,
                 'class' => '',
-                'title' => $this->getItemTitle($sName, $sLang),
+                'title' => $this->$sMethod($sName, $sLang),
                 'target' => '_self',
                 'icon' => '',
                 'link' => bx_html_attribute(bx_append_url_params($oPermalink->permalink($sPageLink), $aPageParams)),
@@ -73,7 +61,49 @@ class BxBaseMenuSwitchLanguage extends BxTemplMenu
         $this->_aObject['menu_items'] = $aItems;
     }
 
-    protected function getItemTitle($sName, $sTitle)
+    protected function getBaseUrlPopup()
+    {
+        return $this->getBaseUrl($_SERVER['HTTP_REFERER']);
+    }
+
+    protected function getBaseUrlInline()
+    {
+        $aBaseLink = parse_url(BX_DOL_URL_ROOT);
+        $sPageLink = (!empty($aBaseLink['scheme']) ? $aBaseLink['scheme'] : 'http') . '://' . $aBaseLink['host'] . $_SERVER['REQUEST_URI'];
+
+        list($sPageLink, $aPageParams) = $this->getBaseUrl($sPageLink);
+
+        $aPageParamsAdd = array();
+		if(!empty($_SERVER['QUERY_STRING'])) {
+			parse_str($_SERVER['QUERY_STRING'], $aPageParamsAdd);
+			if(!empty($aPageParamsAdd) && is_array($aPageParamsAdd))
+				$aPageParams = array_merge($aPageParams, $aPageParamsAdd);
+		}
+
+		return array($sPageLink, $aPageParams);
+    }
+
+    protected function getBaseUrl($sPageLink)
+    {
+        $sPageLink = BxDolPermalinks::getInstance()->unpermalink($sPageLink);
+
+        $sPageParams = '';
+        if(strpos($sPageLink, '?') !== false)
+        	list($sPageLink, $sPageParams) = explode('?', $sPageLink);
+
+        $aPageParams = array();
+        if(!empty($sPageParams))
+        	parse_str($sPageParams, $aPageParams);
+
+        return array($sPageLink, $aPageParams);
+    }
+
+    protected function getItemTitlePopup($sName, $sTitle)
+    {
+    	return genFlag($sName) . ' ' . $sTitle;
+    }
+
+    protected function getItemTitleInline($sName, $sTitle)
     {
     	return genFlag($sName);
     }