Add tag to images.

@param string $tag
@param array  $publicIds
@param array  $options
356770
public function addTag($tag, $publicIds = array(), $options = array())
    {
        return $this->getUploader()->add_tag($tag, $publicIds, $options);
    }
17310
public static function addTags($tags)
    {
        self::updateAllCounters(['frequency' => 1], ['name' => $tags]);

        foreach ($tags as $name) {
            if (!self::find()->where(['name' => $name])->exists()) {
                (new self([
                    'name' => $name,
                    'frequency' => 1
                ]))->save();
            }
        }
    }
829854
public function addTag(Tag $tag)
    {
        if (!$this->tags->contains($tag)) {
            $this->tags->add($tag);
            return true;
        }
        return false;
    }
230241
public void addTag(String tag) {
   		if (insertTagDb(tag)) {
   			this.tags.add(tag);
   			notifyEvent(HistoryReferenceEventPublisher.EVENT_TAG_ADDED);
   		}
   	}
172900
public function upload($source, $publicId, $tags = array())
    {
        $defaults = array(
            'public_id' => null,
            'tags'      => array()
        );

        $options = array_merge($defaults, array(
            'public_id' => $publicId,
            'tags'      => $tags
        ));

        $this->uploadedResult = $this->getUploader()->upload($source, $options);

        return $this;
    }
1190991
public function unsignedUpload($source, $publicId = null, $uploadPresets = array(),
        $uploadOptions = array(), $tags = array())
    {
        $defaults = array(
            'public_id' => null,
            'tags'      => array()
        );

        $options = array_merge($defaults, array(
            'public_id' => $publicId,
            'tags'      => $tags,
        ));

        $options = array_merge($options, $uploadOptions);
        $this->uploadedResult = $this->getUploader()->unsigned_upload($source, $uploadPresets, $options);

        return $this;
    }
1302484
public function addTags(array $tags)
    {
        $this->tagsChanges['added'] = array_unique(
            array_merge($this->tagsChanges['added'], $tags)
        );

        return $this;
    }
852117
public function add($tag)
    {
        if (!$tag instanceof TagInterface) {
            throw new \InvalidArgumentException('This tag is not allowed');
        }
        if ($this->isUniqueTag($tag->getName())) {
            $this->removeByName($tag->getName());
        }

        return parent::add($tag);
    }
1086821
public function renderTags($subjectOrTags, array $options = [])
    {
        if ($subjectOrTags instanceof TagsSubjectInterface) {
            $tags = $subjectOrTags->getTags();
        } elseif ($subjectOrTags instanceof Collection) {
            $tags = new ArrayCollection($subjectOrTags->getValues());
        } elseif (is_array($subjectOrTags)) {
            $tags = new ArrayCollection($subjectOrTags);
        } else {
            throw new \InvalidArgumentException(sprintf(
                "Expected instance of %s, %s or array of %s.",
                TagsSubjectInterface::class,
                Collection::class,
                TagInterface::class
            ));
        }

        if (0 == $tags->count()) {
            return '';
        }

        $options = array_replace([
            'text'  => true,
            'badge' => true,
        ], $options);

        $output = '';

        $renderer = $this->getRenderer($options);

        foreach ($tags as $tag) {
            $output .= $renderer($tag);
        }

        return $output;
    }
614134
public function add_related_tags($tagnames) {
        $context = context_system::instance();
        $tagobjects = static::create_if_missing($this->tagcollid, $tagnames);

        $currenttags = static::get_item_tags('core', 'tag', $this->id);

        foreach ($tagobjects as $name => $tag) {
            foreach ($currenttags as $currenttag) {
                if ($currenttag->name === $name) {
                    continue 2;
                }
            }
            $this->add_instance('core', 'tag', $tag->id, $context, 0);
            $tag->add_instance('core', 'tag', $this->id, $context, 0);
            $currenttags[] = $tag;
        }
    }
464488
@SuppressWarnings("PMD.AvoidArrayLoops")
  ArrayTagSet add(Tag tag) {
    if (length == 0) {
      return new ArrayTagSet(new String[] {tag.key(), tag.value()});
    } else {
      String[] newTags = new String[length + 2];
      String k = tag.key();
      int i = 0;
      for (; i < length && tags[i].compareTo(k) < 0; i += 2) {
        newTags[i] = tags[i];
        newTags[i + 1] = tags[i + 1];
      }
      if (i < length && tags[i].equals(k)) {
        // Override
        newTags[i++] = tag.key();
        newTags[i++] = tag.value();
        System.arraycopy(tags, i, newTags, i, length - i);
        i = length;
      } else {
        // Insert
        newTags[i] = tag.key();
        newTags[i + 1] = tag.value();
        System.arraycopy(tags, i, newTags, i + 2, length - i);
        i = newTags.length;
      }
      return new ArrayTagSet(newTags, i);
    }
  }
1194981
public function addTag($tag, $value, array $options = [])
    {
        $this->config("tags.twitter.$tag", $options ? [$value, $options] : $value);
        return $this;
    }
837686
public void addTags(String photoId, String[] tags) throws FlickrException {
        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("method", METHOD_ADD_TAGS);

        parameters.put("photo_id", photoId);
        parameters.put("tags", StringUtilities.join(tags, " ", true));

        Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
        if (response.isError()) {
            throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
        }
    }
770985
public function tag($tags)
    {
        $tags = array_slice((array)$tags, 0, 3);
        foreach ($tags as $tag) {
            $this->messageBuilder->addTag($tag);
        }

        return $this;
    }
935723
public function addTag(string $name, string $fg = '', string $bg = '', array $options = [])
    {
        $this->tags[$name] = Color::make($fg, $bg, $options);
    }
1003867
protected function setTagFor( $paragraphId, $tag )
    {
        $rows       = 0;
        $tagSql     = $this->sql( $this->getTableInSchema( static::$tagTableName ) );
        $tagJoinSql = $this->sql( $this->getTableInSchema( static::$tagJoinTableName ) );
        $tagId      = $this->getTagIdByName( $tag );

        if ( empty( $tagId ) )
        {
           $insert = $tagSql->insert()
                            ->values( array(
                                'locale'   => $this->getLocale(),
                                'name'     => $tag,
                            ) );

           $rows += $tagSql->prepareStatementForSqlObject( $insert )
                           ->execute()
                           ->getAffectedRows();

           $tagId = $this->getTagIdByName( $tag );
        }

        $data = array(
            'paragraphId'   => $paragraphId,
            'tagId'         => $tagId,
        );

        $select = $tagJoinSql->select()
                             ->where( $data );

        if ( ! $tagJoinSql->prepareStatementForSqlObject( $select )
                          ->execute()
                          ->getAffectedRows() )
        {
            $insert = $tagJoinSql->insert()
                                 ->values( $data );

            $rows += $tagJoinSql->prepareStatementForSqlObject( $insert )
                                ->execute()
                                ->getAffectedRows();
        }

        return $rows;
    }
434969
protected function insertTag(Tag $tag)
	{
		if (!$this->tagStackIsSorted)
		{
			$this->tagStack[] = $tag;
		}
		else
		{
			// Scan the stack and copy every tag to the next slot until we find the correct index
			$i = count($this->tagStack);
			while ($i > 0 && self::compareTags($this->tagStack[$i - 1], $tag) > 0)
			{
				$this->tagStack[$i] = $this->tagStack[$i - 1];
				--$i;
			}
			$this->tagStack[$i] = $tag;
		}
	}