/**
  * Returns current view keywords seperated by comma
  * If $keywords parameter comes empty, sets to it article title and description.
  * It happens if current view has no meta data defined in oxcontent table
  *
  * @param string $keywords              User defined keywords, keywords content or empty value
  * @param bool   $removeDuplicatedWords Remove duplicated words
  *
  * @return string
  */
 protected function _prepareMetaKeyword($keywords, $removeDuplicatedWords = true)
 {
     if (!$keywords) {
         $article = $this->getProduct();
         $keywords = trim($this->getTitle());
         if ($categoryTree = $this->getCategoryTree()) {
             foreach ($categoryTree->getPath() as $category) {
                 $keywords .= ", " . trim($category->oxcategories__oxtitle->value);
             }
         }
         // Adding search keys info
         if ($searchKeys = trim($article->oxarticles__oxsearchkeys->value)) {
             $keywords .= ", " . $searchKeys;
         }
         $keywords = parent::_prepareMetaKeyword($keywords, $removeDuplicatedWords);
     }
     return $keywords;
 }
 /**
  * Returns current view keywords seperated by comma
  * If $sKeywords parameter comes empty, sets to it current content title
  *
  * @param string $sKeywords               data to use as keywords
  * @param bool   $blRemoveDuplicatedWords remove duplicated words
  *
  * @return string
  */
 protected function _prepareMetaKeyword($sKeywords, $blRemoveDuplicatedWords = true)
 {
     if (!$sKeywords) {
         $sKeywords = $this->getContent()->oxcontents__oxtitle->value;
     }
     return parent::_prepareMetaKeyword($sKeywords, $blRemoveDuplicatedWords);
 }
Esempio n. 3
0
 /**
  * Returns current view keywords seperated by comma
  * If $sKeywords parameter comes empty, sets to it article title and description.
  * It happens if current view has no meta data defined in oxcontent table
  *
  * @param string $sKeywords               data to use as keywords
  * @param bool   $blRemoveDuplicatedWords remove dublicated words
  *
  * @return string
  */
 protected function _prepareMetaKeyword($sKeywords, $blRemoveDuplicatedWords = true)
 {
     if (!$sKeywords && $this->getConfig()->getConfigParam('bl_perfLoadAktion') && ($oArt = $this->getFirstArticle())) {
         $oDescField = $oArt->getLongDescription();
         $sKeywords = $oDescField->value;
     }
     return parent::_prepareMetaKeyword($sKeywords, $blRemoveDuplicatedWords);
 }
Esempio n. 4
0
 /**
  * Returns current view keywords seperated by comma
  * If $sKeywords parameter comes empty, sets to it article title and description.
  * It happens if current view has no meta data defined in oxcontent table
  *
  * @param string $sKeywords               user defined keywords, keywords content or empty value
  * @param bool   $blRemoveDuplicatedWords remove dublicated words
  *
  * @return string
  */
 protected function _prepareMetaKeyword($sKeywords, $blRemoveDuplicatedWords = true)
 {
     if (!$sKeywords) {
         $oProduct = $this->getProduct();
         $sKeywords = trim($this->getTitle());
         if ($oCatTree = $this->getCategoryTree()) {
             foreach ($oCatTree->getPath() as $oCat) {
                 $sKeywords .= ", " . trim($oCat->oxcategories__oxtitle->value);
             }
         }
         //adding search keys info
         if ($sSearchKeys = trim($oProduct->oxarticles__oxsearchkeys->value)) {
             $sKeywords .= ", " . $sSearchKeys;
         }
         $sKeywords = parent::_prepareMetaKeyword($sKeywords, $blRemoveDuplicatedWords);
     }
     return $sKeywords;
 }
 /**
  * Creates a string of keyword filtered by the function prepareMetaDescription and without any duplicates
  * additional the admin defined strings are removed
  *
  * @param string $keywords category path
  *
  * @return string
  */
 protected function _collectMetaKeyword($keywords)
 {
     $maxTextLength = 60;
     $text = '';
     if (count($articleList = $this->getArticleList())) {
         $stringModifier = getStr();
         foreach ($articleList as $article) {
             /** @var oxArticle $article */
             $description = $stringModifier->strip_tags(trim($stringModifier->strtolower($article->getLongDescription()->value)));
             //removing dots from string (they are not cleaned up during general string cleanup)
             $description = $stringModifier->preg_replace("/\\./", " ", $description);
             if ($stringModifier->strlen($description) > $maxTextLength) {
                 $midText = $stringModifier->substr($description, 0, $maxTextLength);
                 $description = $stringModifier->substr($midText, 0, $stringModifier->strlen($midText) - $stringModifier->strpos(strrev($midText), ' '));
             }
             if ($text) {
                 $text .= ', ';
             }
             $text .= $description;
         }
     }
     if (!$keywords) {
         $keywords = $this->_getCatPathString();
     }
     if ($keywords) {
         $text = "{$keywords}, {$text}";
     }
     return parent::_prepareMetaKeyword($text);
 }
Esempio n. 6
0
 /**
  * Creates a string of keyword filtered by the function prepareMetaDescription and without any duplicates
  * additional the admin defined strings are removed
  *
  * @param string $sKeywords category path
  *
  * @return string
  */
 protected function _collectMetaKeyword($sKeywords)
 {
     $iMaxTextLength = 60;
     $sText = '';
     if (count($aArticleList = $this->getArticleList())) {
         $oStr = getStr();
         foreach ($aArticleList as $oProduct) {
             $sDesc = $oStr->strip_tags(trim($oStr->strtolower($oProduct->getLongDescription()->value)));
             //removing dots from string (they are not cleaned up during general string cleanup)
             $sDesc = $oStr->preg_replace("/\\./", " ", $sDesc);
             if ($oStr->strlen($sDesc) > $iMaxTextLength) {
                 $sMidText = $oStr->substr($sDesc, 0, $iMaxTextLength);
                 $sDesc = $oStr->substr($sMidText, 0, $oStr->strlen($sMidText) - $oStr->strpos(strrev($sMidText), ' '));
             }
             if ($sText) {
                 $sText .= ', ';
             }
             $sText .= $sDesc;
         }
     }
     if (!$sKeywords) {
         $sKeywords = $this->_getCatPathString();
     }
     if ($sKeywords) {
         $sText = "{$sKeywords}, {$sText}";
     }
     return parent::_prepareMetaKeyword($sText);
 }