Selaa lähdekoodia

#2247 Meta tags: Keywords cloud doesn't work with Channels

Alex Trofimov 7 vuotta sitten
vanhempi
sitoutus
d426d47d27
2 muutettua tiedostoa jossa 14 lisäystä ja 23 poistoa
  1. 12 3
      inc/classes/BxDolMetatags.php
  2. 2 20
      template/scripts/BxBaseMetatags.php

+ 12 - 3
inc/classes/BxDolMetatags.php

@@ -417,14 +417,23 @@ class BxDolMetatags extends BxDolFactory implements iBxDolFactoryObject
         return $s;
     }
 	
-	public function keywordsGetHashTagUrl($sKeyword, $iId) 
+	public function keywordsGetHashTagUrl($sKeyword, $iId, $mixedSection = false) 
     {   
-        $sUrl = BX_DOL_URL_ROOT . 'searchKeyword.php?type=keyword&keyword=' . rawurlencode($sKeyword);
+        $sSectionPart = '';
+        if (!empty($mixedSection)) {
+            if (is_array($mixedSection))
+                $sSectionPart = '&section[]=' . implode('&section[]=', $mixedSection);
+            elseif (is_string($mixedSection))
+                $sSectionPart = '&section[]=' . $mixedSection;
+        }
+        
+        $sUrl = BX_DOL_URL_ROOT . 'searchKeyword.php?type=keyword&keyword=' . rawurlencode($sKeyword) . $sSectionPart;
         bx_alert('meta_keyword', 'url', 0, false, array(
            'url' => &$sUrl,
            'keyword' => $sKeyword,
 		   'id' => $iId,
-		   'sObject' => $this->_sObject
+           'sObject' => $this->_sObject,
+           'section' => $mixedSection,
         ));
 	    return $sUrl;
 	}

+ 2 - 20
template/scripts/BxBaseMetatags.php

@@ -16,7 +16,6 @@ class BxBaseMetatags extends BxDolMetatags
 {
     protected $_oTemplate;
 
-    protected $_sBrowseUrl;
     protected $_iKeywordsCloudFontSizeMin = 14;
     protected $_iKeywordsCloudFontSizeMax = 32;
 
@@ -28,11 +27,6 @@ class BxBaseMetatags extends BxDolMetatags
             $this->_oTemplate = $oTemplate;
         else
             $this->_oTemplate = BxDolTemplate::getInstance();
-
-		$this->_sBrowseUrl = bx_append_url_params('searchKeyword.php', array(
-    		'type' => 'keyword', 
-    		'keyword' => '{keyword}'
-    	)) . '{sections}';
     }
 
     /**
@@ -53,10 +47,7 @@ class BxBaseMetatags extends BxDolMetatags
         $aUnits = array();
         foreach($aKeywords as $sKeyword) {
             $aUnits[] = array(
-                'href' => BX_DOL_URL_ROOT . bx_replace_markers($this->_sBrowseUrl, array(
-            		'keyword' => rawurlencode($sKeyword),
-            		'sections' => ''
-            	)),
+                'href' => $this->keywordsGetHashTagUrl($sKeyword, $iId),
                 'keyword' => htmlspecialchars_adv($sKeyword),
             );
         }
@@ -87,20 +78,11 @@ class BxBaseMetatags extends BxDolMetatags
         $iRatingDiff = $iMaxRating - $iMinRating;
         $iRatingDiff = $iRatingDiff == 0 ? 1 : $iRatingDiff;
 
-        $sSectionPart = '';
-        if (is_array($mixedSection))
-            $sSectionPart = '&section[]=' . implode('&section[]=', $mixedSection);
-        elseif (is_string($mixedSection))
-            $sSectionPart = '&section[]=' . $mixedSection;
-
         $aUnits = array();
         foreach($aKeywords as $sKeyword => $iCount) {
             $aUnits[] = array(
                 'size' => $this->_iKeywordsCloudFontSizeMin + floor($iFontDiff * (($iCount - $iMinRating) / $iRatingDiff)),
-                'href' => BX_DOL_URL_ROOT . bx_replace_markers($this->_sBrowseUrl, array(
-            		'keyword' => rawurlencode($sKeyword),
-            		'sections' => $sSectionPart
-            	)),
+                'href' => $this->keywordsGetHashTagUrl($sKeyword, 0, $mixedSection),
                 'count' => $iCount,
                 'keyword' => htmlspecialchars_adv($sKeyword),
             );