本文整理汇总了PHP中TagPeer::tagInstancesForObject方法的典型用法代码示例。如果您正苦于以下问题:PHP TagPeer::tagInstancesForObject方法的具体用法?PHP TagPeer::tagInstancesForObject怎么用?PHP TagPeer::tagInstancesForObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagPeer
的用法示例。
在下文中一共展示了TagPeer::tagInstancesForObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConsolidatedKeywords
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));
}
示例2: getTags
/**
* @return A list of TagInstances (not Tags) which reference this JournalEntry
*/
public function getTags()
{
return TagPeer::tagInstancesForObject($this);
}
示例3: fillFromRssAttributes
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']);
}