本文整理汇总了PHP中Tag::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::getValue方法的具体用法?PHP Tag::getValue怎么用?PHP Tag::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::getValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TagFilterIterator
/**
* Constructor
*
* @param object TagIterator $sourceIterator
* @param array $filterValues Values to filter out of the resulting tags.
* @return object
* @access public
* @since 12/8/06
*/
function TagFilterIterator($sourceIterator, $filterValues = array())
{
$this->HarmoniIterator($null = null);
$this->_sourceIterator = $sourceIterator;
$this->_toFilter = array();
foreach ($filterValues as $string) {
$tag = new Tag($string);
if ($tag->getValue()) {
$this->_toFilter[] = $tag->getValue();
}
}
$this->_nextElement = null;
$this->_numSoFar = 0;
// Load our first element
$this->advance();
}
示例2: execute
/**
* Execute this action.
*
* @param object Harmoni $harmoni
* @return mixed
* @access public
* @since 11/10/06
*/
function execute()
{
$harmoni = Harmoni::instance();
$harmoni->request->startNamespace("polyphony-tags");
$itemId = RequestContext::value('item_id');
$system = RequestContext::value('system');
$tagValue = RequestContext::value('tag');
$harmoni->request->endNamespace();
$item = TaggedItem::forId($itemId, $system);
// Add the tag
$tag = new Tag($tagValue);
if (!$tag->getValue()) {
$this->error(_("Cannot tag with an empty value."));
} else {
$tag->tagItem($item);
}
// send the new tag list
$this->writeXmlResponse($item->getUserTags());
}
示例3: renameForAgent
/**
* Rename the tag for the given agent
*
* @param object Id $agentId
* @param string $newValue
* @return void
* @access public
* @since 11/27/06
*/
function renameForAgent($agentId, $newValue)
{
$newTag = new Tag($newValue);
$query = new UpdateQuery();
$query->setTable('tag');
$query->setColumns(array('value'));
$query->setValues(array("'" . addslashes($newTag->getValue()) . "'"));
$query->addWhere("tag.value='" . addslashes($this->getValue()) . "'");
$query->addWhere("tag.user_id='" . addslashes($agentId->getIdString()) . "'");
$dbc = Services::getService("DatabaseManager");
$dbc->query($query, $this->getDatabaseIndex());
}
示例4: printTag
/**
* Prints tag to <code>$wgOut</code>
*
* @param $tag Tag
* @param $attribute
*/
private function printTag(Tag $tag, $attribute)
{
global $wgOut;
$wgOut->addHTML(sprintf('<div class="fptc_tag" style="font-size:%dpx;">%s</div>', $this->fontSizeMin + ($this->fontSizeMax - $this->fontSizeMin) * $tag->getRate(), $attribute == wfMsg('fptc-categoryname') ? $wgOut->parseInline(sprintf('[[:%s:%s|%s]]', self::CATEGORY_PAGE, $tag->getValue(), $tag->getValue())) : $wgOut->parseInline(sprintf('[[:%s:%s/%s/%s|%s]]', self::SPECIALPAGE_PREFIX, self::ATTRIBUTE_VALUE_INDEX_SPECIALPAGE, $attribute, $tag->getValue(), $tag->getValue()))));
}
示例5: updateAssetTags
/**
* Update the auto-generated tags for the asset
*
* @param object Id $assetId
* @return void
* @access public
* @since 11/21/06
*/
function updateAssetTags($assetId)
{
// Clean the values into nice tag values
$newTagValues = array();
foreach ($this->_newStructuredTagValues[$assetId->getIdString()] as $value) {
$tag = new Tag($value);
if ($tag->getValue()) {
$newTagValues[] = $tag->getValue();
}
}
// Get the TaggedItem for this asset
$idManager = Services::getService("Id");
$systemAgentId = $idManager->getId('system:concerto');
$item = TaggedItem::forId($assetId, 'concerto');
// Remove any missing tags
$systemTags = $item->getTagsByAgent($systemAgentId);
$existingTagValues = array();
while ($systemTags->hasNext()) {
$tag = $systemTags->next();
if (in_array($tag->getValue(), $newTags)) {
$existingTagValues[] = $tag->getValue();
} else {
$tag->removeFromItemsForAgent($item, $systemAgentId);
printpre("Removing tag '{$tagValue}'");
}
}
// Add any new tags
foreach ($newTagValues as $tagValue) {
if (!in_array($tagValue, $existingTagValues)) {
printpre("Adding tag '{$tagValue}'");
$tag = new Tag($tagValue);
$tag->tagItemForAgent($item, $systemAgentId);
}
}
unset($this->_newStructuredTagValues[$assetId->getIdString()]);
}
示例6: regenerateTagsForAsset
/**
* Regenerate tags for a single Asset
*
* @param object Asset $asset
* @param object Id $agent Id The agent id to associate with these tags
* @param string $system The system to associate with these tags
* @param optional object Id $repositoryId Not required, but can enhance
* efficiency if it is known ahead of time.
* @return void
* @access public
* @since 11/27/06
*/
function regenerateTagsForAsset($asset, $agentId, $system, $repositoryId = null)
{
if (!is_object($repositoryId)) {
$repository = $asset->getRepository();
$repositoryId = $repository->getId();
}
$assetId = $asset->getId();
printpre("<hr/>Asset: " . $assetId->getIdString() . " " . $asset->getDisplayName());
$item = TaggedItem::forId($asset->getId(), $system);
$item->deleteTagsByAgent($agentId);
// Loop through the records and generate tags from the values
$partStructIds = $this->getPartStructureIdsForTagGeneration($repositoryId);
while ($partStructIds->hasNext()) {
$values = $asset->getPartValuesByPartStructure($partStructIds->next());
while ($values->hasNext()) {
$value = $values->next();
$tag = new Tag($value->asString());
$tag->tagItemForAgent($item, $agentId);
printpre("Adding Tag: " . $tag->getValue());
}
}
}