Creates sitelinks feed items and add it to the feed.
495296
private static function createSitelinksFeedItems(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        array $sitelinksData
    ) {
        $feedItemService =
            $adWordsServices->get($session, FeedItemService::class);

        // Create operations to add feed items.
        $home = self::newSitelinkFeedItemAddOperation(
            $sitelinksData,
            'Home',
            'http://www.example.com',
            'Home line 2',
            'Home line 3'
        );
        $stores = self::newSitelinkFeedItemAddOperation(
            $sitelinksData,
            'Stores',
            'http://www.example.com/stores',
            'Stores line 2',
            'Stores line 3'
        );
        $onSale = self::newSitelinkFeedItemAddOperation(
            $sitelinksData,
            'On Sale',
            'http://www.example.com/sale',
            'On Sale line 2',
            'On Sale line 3'
        );
        $support = self::newSitelinkFeedItemAddOperation(
            $sitelinksData,
            'Support',
            'http://www.example.com/support',
            'Support line 2',
            'Support line 3'
        );
        $products = self::newSitelinkFeedItemAddOperation(
            $sitelinksData,
            'Products',
            'http://www.example.com/products',
            'Products line 2',
            'Products line 3'
        );
        // This site link is using geographical targeting to use
        // LOCATION_OF_PRESENCE.
        $aboutUs = self::newSitelinkFeedItemAddOperation(
            $sitelinksData,
            'About Us',
            'http://www.example.com/about',
            'About Us line 2',
            'About Us line 3',
            true
        );

        // Add feed item operations on the server and print out some information.
        $result = $feedItemService->mutate(
            [$home, $stores, $onSale, $support, $products, $aboutUs]
        );
        $sitelinksData['sitelinkFeedItemIds'] = [];

        foreach ($result->getValue() as $feedItem) {
            printf(
                'Feed item with feed item ID %d was added.%s',
                $feedItem->getFeedItemId(),
                PHP_EOL
            );
            $sitelinksData['sitelinkFeedItemIds'][] =
                $feedItem->getFeedItemId();
        }

        // Target the "aboutUs" sitelink to geographically target California.
        // See https://developers.google.com/adwords/api/docs/appendix/geotargeting
        // for location criteria of supported locations.
        self::restrictFeedItemToGeoTarget(
            $adWordsServices,
            $session,
            $result->getValue()[5],
            21137
        );

        return $sitelinksData;
    }
616086
function addItem(item = {}) {
    if (!item.id) {
        console.warn('Cannot add menuitem. A unique identifier is required for the menuitem to work correctly.');
        return;
    }
    let el = doc.createElement('menuItem');
    // assign unique id
    item.attributes = _.assign({}, item.attributes, {
        id: item.id
    });
    // add all attributes
    setAttributes(el, item.attributes);
    // add title
    el.innerHTML = `<title>${(_.isFunction(item.name) ? item.name() : item.name)}</title>`;
    // add page reference
    el.page = item.page;
    // appends to the menu
    menuBarEl.insertBefore(el, null);
    // cache for later use
    itemsCache[item.id] = el;

    return el;
}
305892
public function populate_home_items() {
		$trail    = $this->get_trail();
		$renderer = $trail->get_renderer();
		if ( ! $renderer->get_display_home_item() ) {
			return;
		}

		$home_title = $renderer->get_home_item_title();
		$home_link  = home_url( '/' );
		$trail->add_custom_item( $home_title, $home_link, 10 );
	}
51830
private static function createSitelinksCampaignFeed(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        array $sitelinksData,
        $campaignId
    ) {
        $campaignFeedService =
            $adWordsServices->get($session, CampaignFeedService::class);
        $matchingFunctionString = sprintf(
            'AND( IN(FEED_ITEM_ID, {%s}), EQUALS(CONTEXT.DEVICE, "Mobile") )',
            implode(',', $sitelinksData['sitelinkFeedItemIds'])
        );

        // Create a campaign feed and its feed function.
        $campaignFeed = new CampaignFeed();
        $campaignFeed->setFeedId($sitelinksData['sitelinksFeedId']);
        $campaignFeed->setCampaignId($campaignId);

        $matchingFunction = new MatchingFunction();
        $matchingFunction->setFunctionString($matchingFunctionString);
        $campaignFeed->setMatchingFunction($matchingFunction);
        $campaignFeed->setPlaceholderTypes([self::PLACEHOLDER_SITELINKS]);

        // Create the campaign feed operation.
        $operation = new CampaignFeedOperation();
        $operation->setOperand($campaignFeed);
        $operation->setOperator(Operator::ADD);

        // Create the campaign feed on the server and print out some information.
        $result = $campaignFeedService->mutate([$operation]);
        foreach ($result->getValue() as $savedCampaignFeed) {
            printf(
                'Campaign with ID %d was associated with feed with ID %d.%s',
                $savedCampaignFeed->getCampaignId(),
                $savedCampaignFeed->getFeedId(),
                PHP_EOL
            );
        }
    }
330004
function addUrl(when, feed) {
  if (!types.check(feed, 'feed') && !types.check(feed, ['feed']))
    throw Error('sandcrawler.spider.url(s): wrong argument.');

  var a = !(feed instanceof Array) ? [feed] : feed,
      c = !this.state.running ? this.initialBuffer.length : this.index,
      job,
      i,
      l;

  for (i = 0, l = a.length; i < l; i++) {
    job = createJob(a[i]);

    // Don't add if already at limit
    if (this.options.limit && c >= this.options.limit)
      break;

    if (!this.state.running) {
      this.initialBuffer[when === 'later' ? 'push' : 'unshift'](job);
    }
    else {
      this.queue[when === 'later' ? 'push' : 'unshift'](job);
      this.emit('job:add', job);
    }
  }

  return this;
}
544084
public function addItem(string $title, string $link, string $description): RssFeedItem
    {
        return $this->items[] = RssFeedItem::create($title, $link, $description);
    }
828218
def setup(app):
    """"""
    app.add_config_value(
        'site_url',
        default=None,
        rebuild=False
    )
    try:
        app.add_config_value(
            'html_baseurl',
            default=None,
            rebuild=False
        )
    except:
        pass

    app.connect('html-page-context', add_html_link)
    app.connect('build-finished', create_sitemap)
    app.sitemap_links = []
    app.locales = []
727001
private function makeItems()
    {
        $out = '';

        foreach ($this->items as $item) {
            $thisItems = $item->getElements();

            // The argument is printed as rdf:about attribute of item in RSS 1.0
            // We're using the link set in the item (which is mandatory) as the about attribute.
            if ($this->version == Feed::RSS1)
                $out .= $this->startItem($thisItems['link']['content']);
            else
                $out .= $this->startItem();

            foreach ($thisItems as $feedItem) {
                $name = $feedItem['name'];

                // Strip all ATOM namespace prefixes from tags when feed is an ATOM feed.
                // Not needed here, because the ATOM namespace name is used as default namespace.
                if ($this->version == Feed::ATOM && strncmp($name, 'atom', 4) == 0)
                    $name = substr($name, 5);

                $out .= $this->makeNode($name, $feedItem['content'], $feedItem['attributes']);
            }
            $out .= $this->endItem();
        }

        return $out;
    }
1069324
protected function addFeed()
	{
		if ($this->params->get('show_feed_link', 1) == 1)
		{
			$link    = '&format=feed&limitstart=';
			$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
			$this->document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
			$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
			$this->document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
		}
	}
610403
def insert(self, anchor):
        
        self.prec = anchor.prec        # point to neighbors
        self.succ = anchor
        self.succ.prec = self          # make neighbors point to item
        self.prec.succ = self
242935
def _CreateFeedItems(client, feed_details, label_name):
  
  # Get the FeedItemService.
  feed_item_service = client.GetService('FeedItemService', version='v201809')

  # For page feed URL recommendations and rules, see:
  # https://support.google.com/adwords/answer/7166527
  urls = ('http://www.example.com/discounts/rental-cars?id={feeditem}',
          'http://www.example.com/discounts/hotel-deals?id={feeditem}',
          'http://www.example.com/discounts/flight-deals?id={feeditem}')

  # Create the operation.
  operations = [{
      # Create the feed item.
      'operand': {
          'feedId': feed_details.feed_id,
          'attributeValues': [
              {
                  'feedAttributeId': feed_details.url_attribute_id,
                  'stringValues': [url]
              },
              {
                  'feedAttributeId': feed_details.label_attribute_id,
                  'stringValues': [label_name]
              }
          ]
      },
      'operator': 'ADD'
  } for url in urls]

  # Add the feed item.
  feed_item_service.mutate(operations)
906239
public function feed()
    {
        if (isset($_POST[$this->name]) && is_array($_POST[$this->name])) {
            $this->setValue(array_values($_POST[$this->name]));
        }
    }
175013
private void addLeftItems() {
        // Log.w(TAG,"addLeftItems() {.... (0)");

        if (leftItems.size() == 0) {
            return;
        }
        // Log.w(TAG,"addLeftItems() {.... (1)");
        ArrayList<T> currentLeftItems = new ArrayList<T>();
        currentLeftItems.addAll(leftItems);
        // Log.w(TAG,"addLeftItems() {.... (2)");

        synchronized (leftItems) {
            // Log.w(TAG,"addLeftItems() {.... (3.1)");
            leftItems.clear();
            // Log.w(TAG,"addLeftItems() {.... (3.1)");
        }
        // Log.w(TAG,"addLeftItems() {.... (4)");
        for (T currentLeftItem : currentLeftItems) {
            // Log.w(TAG,"addLeftItems() {.... (5.1)");
            addItem(currentLeftItem);
            // Log.w(TAG,"addLeftItems() {.... (5.2)");
        }
    }
1347490
def CreateCustomizerFeed(client, feed_name):
  
  # Get the AdCustomizerFeedService
  ad_customizer_feed_service = client.GetService('AdCustomizerFeedService',
                                                 'v201809')
  customizer_feed = {
      'feedName': feed_name,
      'feedAttributes': [
          {'type': 'STRING', 'name': 'Name'},
          {'type': 'STRING', 'name': 'Price'},
          {'type': 'DATE_TIME', 'name': 'Date'}
      ]
  }

  feed_service_operation = {
      'operator': 'ADD',
      'operand': customizer_feed
  }

  response = ad_customizer_feed_service.mutate([feed_service_operation])

  if response and 'value' in response:
    feed = response['value'][0]
    feed_data = {
        'feedId': feed['feedId'],
        'nameId': feed['feedAttributes'][0]['id'],
        'priceId': feed['feedAttributes'][1]['id'],
        'dateId': feed['feedAttributes'][2]['id']
    }
    print ('Feed with name "%s" and ID %s was added with:\n'
           '\tName attribute ID %s and price attribute ID %s and date attribute'
           'ID %s') % (feed['feedName'], feed['feedId'], feed_data['nameId'],
                       feed_data['priceId'], feed_data['dateId'])
    return feed
  else:
    raise errors.GoogleAdsError('No feeds were added')
605445
private function AddItem(Item $rssItem, $useCDATA = true)
    {
            $itemEl = $this->domDoc->createElement("item");

            if($rssItem->Title != null)
              $this->AppendTextChild($itemEl, "title", $rssItem->Title);

            if ($rssItem->Link != null)
              $this->AppendTextChild($itemEl, "link", $rssItem->Link);

            if ($rssItem->Description != null)
            {
                    if ($useCDATA)
                      $this->AppendCDATAChild($itemEl, "description", $rssItem->Description);
                    else
                      $this->AppendTextChild($itemEl, "description", $rssItem->Description);
            }

            if ($rssItem->GetPubDate() != null)
              $this->AppendTextChild($itemEl, "pubDate", $rssItem->GetPubDate()->ToString(\DATE_RSS));

            if ($rssItem->Author != null)
              $this->AppendTextChild($itemEl, "author", $rssItem->Author);

            if ($rssItem->Comments != null)
              $this->AppendTextChild($itemEl, "comments", $rssItem->Comments);

            if ($rssItem->Guid != null)
              $this->AppendTextChild($itemEl, "guid", $rssItem->Guid);
            
            //objects
            $this->AddCategory($itemEl, $rssItem->GetCategory());
            $this->AddSource($itemEl, $rssItem->GetSource());
            $this->AddEnclosure($itemEl, $rssItem->GetEnclosure());
            $this->channel->appendChild($itemEl);
    }
1369038
def add(self, *args, **kwargs):
        
        if len(args) == 1 and not kwargs and isinstance(args[0], FeedEntry):
            self.entries.append(args[0])
        else:
            kwargs['feed_url'] = self.feed_url
            kwargs['timezone'] = self.timezone
            self.entries.append(FeedEntry(*args, **kwargs))
884904
public function generateFeed()
    {
        if ($this->version != Feed::ATOM && !array_key_exists('link', $this->channels))
            throw new InvalidOperationException('RSS1 & RSS2 feeds need a link element. Call the setLink method before this method.');

        return $this->makeHeader()
            . $this->makeChannels()
            . $this->makeItems()
            . $this->makeFooter();
    }