Exemplo n.º 1
0
 public function getConsolidatedKeywords($sLanguageId = null, $bReturnArray = false)
 {
     if ($sLanguageId == null) {
         $sLanguageId = Session::language();
     }
     $aKeywords = array();
     $aKeywords[] = TranslationPeer::getString('meta.keywords', null, '');
     $aTags = TagPeer::tagInstancesForObject($this);
     foreach ($aTags as $iKey => $oTag) {
         $aTags[$iKey] = $oTag->getTag()->getName();
     }
     $aKeywords[] = $aTags;
     $aKeywords[] = Settings::getSetting('frontend', 'keywords', '');
     $aKeywords[] = $this->getActivePageString()->getMetaKeywords();
     $aResult = array();
     foreach ($aKeywords as $iKey => $mKeywords) {
         if (!is_array($mKeywords)) {
             $mKeywords = explode(',', $mKeywords);
         }
         foreach ($mKeywords as $sKeyword) {
             $sKeyword = trim($sKeyword);
             if (!isset($aResult[$sKeyword]) && $sKeyword !== '') {
                 $aResult[$sKeyword] = true;
             }
         }
     }
     if ($bReturnArray) {
         return array_keys($aResult);
     }
     return implode(', ', array_keys($aResult));
 }
Exemplo n.º 2
0
 /**
  * @return A list of TagInstances (not Tags) which reference this JournalEntry
  */
 public function getTags()
 {
     return TagPeer::tagInstancesForObject($this);
 }
Exemplo n.º 3
0
 public function fillFromRssAttributes($aAttributes)
 {
     if (isset($aAttributes['categories'])) {
         $aTags = $aAttributes['categories'];
         $aTagInstances = TagPeer::tagInstancesForObject($this);
         $aOldTags = array();
         foreach ($aTagInstances as $oTagInstance) {
             if (!in_array($oTagInstance->getTagName(), $aTags)) {
                 $oTagInstance->delete();
             } else {
                 $aOldTags[] = $oTagInstance->getTagName();
             }
         }
         foreach ($aTags as $sTagName) {
             if (!in_array($sTagName, $aOldTags)) {
                 TagInstancePeer::newTagInstanceForObject($sTagName, $this);
             }
         }
     }
     $this->setText($aAttributes['description']);
     $this->setTitle($aAttributes['title']);
 }