Returns the RSS entries
@param  string  $rss   RSS feed URL
@param  integer $items Number of items to return
@param  string  $order Sorting order, asc or desc
@return array          List of RSS entries
970990
public function getFeedContents($rss, $items = 10, $order = '') : array
    {
        $entries = array();

        if (! empty($rss)) {
            $rss = fetch_feed($rss);
        } else {
            $entries['error'] = __('RSS feed URL is missing', 'modularity');
            return $entries;
        }

        if (is_wp_error($rss)) {
            if (is_admin() || current_user_can('manage_options')) {
                $entries['error'] = __('RSS Error:', 'modularity') . ' ' . $rss->get_error_message();
            }
            return $entries;
        }

        if (!$rss->get_item_quantity()) {
            $entries['error'] = __( 'An error has occurred, which probably means the feed is down. Try again later.', 'modularity');
            $rss->__destruct();
            unset($rss);
            return $entries;
        }

        $items = ($items <= 0) ? 0 : (int) $items;
        $entries = $rss->get_items(0, $items);
        if ($order == 'asc') {
            $entries = array_reverse($entries);
        }

        $rss->__destruct();
        unset($rss);
        return $entries;
    }
477382
public function getContentsBySlugsFunction($slugs, $keepOrder = false)
    {
        $search = $this->repository->createSearch();
        $search->addQuery(new TermsQuery('slug', $slugs), 'should');

        $result = $this->repository->execute($search);

        if ($keepOrder) {
            $orderedResult = [];
            foreach ($slugs as $slug) {
                foreach ($result as $document) {
                    if ($document->slug == $slug) {
                        $orderedResult[] = $document;
                    }
                }
            }

            $result = $orderedResult;
        }

        return $result;
    }
1166186
public function getVisits($items)
  {
    $result = [];
    foreach ($items as $item) {
      $result[] = new Visit($item);
    }

    return $result;
  }
902800
public function getDocumentListFeed($location = null)
    {
        if ($location === null) {
            $uri = self::DOCUMENTS_LIST_FEED_URI;
        } else if ($location instanceof Zend_Gdata_Query) {
            $uri = $location->getQueryUrl();
        } else {
            $uri = $location;
        }
        return parent::getFeed($uri, 'Zend_Gdata_Docs_DocumentListFeed');
    }
1187671
@Override
    protected List<Element> getItems(final Element rssRoot) {

        final Element eChannel = rssRoot.getChild("channel", getRSSNamespace());

        if (eChannel != null) {
            return eChannel.getChildren("item", getRSSNamespace());
        } else {
            return Collections.emptyList();
        }

    }
222512
private function sort($items, $order)
    {
        uasort($items, function (Item $item1, Item $item2) use ($order) {
            return ($item1->getValue() < $item2->getValue()) ? (-1 * $order) : $order;
        });

        return $items;
    }
122280
public function rss()
    {
        //This method works only for RSS
        is_true_or_fail($this->RequestHandler->prefers('rss'), ForbiddenException::class);

        $posts = $this->Posts->find('active')
            ->select(['title', 'preview', 'slug', 'text', 'created'])
            ->limit(getConfigOrFail('default.records_for_rss'))
            ->order([sprintf('%s.created', $this->Posts->getAlias()) => 'DESC'])
            ->cache('rss', $this->Posts->getCacheName());

        $this->set(compact('posts'));
    }
278104
public static function order($items) {
		if (empty($items)) {
			return array();
		}

		$_items = array_combine(array_keys($items), Hash::extract($items, '{s}.weight'));
		asort($_items);

		foreach (array_keys($_items) as $key) {
			$_items[$key] = $items[$key];
		}

		return $items;
	}
275278
def parse(data)
      rss = SimpleRSS.parse data
      news = Array.new

      rss.items.each do |item|
        news_item = NewsItem.new(item.title, item.link, item.description.force_encoding("UTF-8"), item.pubDate)

        news.push news_item
      end

      unless @limit.nil?
        news.take(@limit)
      else
        news
      end
    end
1106099
public function add($item, $rss, $time)
  {
     return $this->cache->add($item, $rss, $time);
  }
974535
private function generateItems()
	{
		$out = '';
		foreach ($this->items as $item)
		{
			$thisItems = $item->getElements();

			//the argument is printed as rdf:about attribute of item in rss 1.0
			$out .= $this->startItem($thisItems['link']['content']);

			foreach ($thisItems as $feedItem )
			{
				$out .= $this->makeNode($feedItem['name'], $feedItem['content'], $feedItem['attributes']);
			}
			$out .= $this->endItem();
		}
		return $out;
	}
858880
private function getArchiveItems($otherNews, $limit, $sort, $related, $params)
    {
        $filter = array(
            'Live' => 1, // only work on live items
        );
        if (class_exists('Translatable')) {
            $filter['Locale'] = Translatable::get_current_locale();
        }
        $exclude = array(
            'PublishFrom:GreaterThan' => SS_Datetime::now()->Rfc2822(), // same as above

        );

        if ($related && $params['Action'] === 'show') { // @todo This only works with the default action, not allowed actions
            $filter = array_merge(
                $filter,
                array('Tags.ID:ExactMatch' => $otherNews->Tags()->column('ID'))
            );
            $exclude = array_merge(
                $exclude, array('ID' => $otherNews->ID)
            );
        }
        if ($sort) {
            $sort = 'RAND()';
        }
        /** @var DataList||News[] $news */
        $news = News::get()
            ->filter($filter)
            ->exclude($exclude)
            ->sort($sort)
            ->limit($limit);

        return $news;
    }
251287
public function rssAction($rssId)
    {
        $notificationManager = $this->getNotificationManager();
        try {
            $result = $notificationManager->getUserNotificationsListRss($rssId);
            $result['systemName'] = $notificationManager->getPlatformName();
        } catch (NoResultException $nre) {
            $result = ['error' => 'no_rss_defined'];
        } catch (NotFoundHttpException $nfe) {
            $result = ['error' => 'zero_notifications'];
        }

        return $this->render('IcapNotificationBundle:notification:rss.xml.twig', $result);
    }
1015043
public static function orderedList( $items, $level = 0, $attributes = array() )
	{
		$content	= "\n".implode( "\n", $items )."\n";
		$indent		= str_repeat( "	", 2 * abs( (int) $level ) );
		$tag		= UI_HTML_Tag::create( "ol", $content, $attributes );
		$code		= $indent.$tag;
		return $code;
	}
1275307
@Override
    protected WireFeed parseChannel(final Element rssRoot, final Locale locale) {
        final WireFeed wFeed = super.parseChannel(rssRoot, locale);
        wFeed.setFeedType("rss_2.0");

        return wFeed;
    }
480447
public function getTickets($items)
  {
    if (!count($items)) {
      return [];
    }

    $result = [];
    foreach ($items as $item) {
      $result[] = new Ticket($item);
    }

    return $result;
  }
769728
private function sortByArray($items, array $order)
    {
        $unordered = [];
        foreach ($items as $content) {
            $unordered[$content->getId()] = $content;
        }

        $ordered = [];
        foreach ($order as $id) {
            if (isset($unordered[$id])) {
                $ordered[] = $unordered[$id];
            }
        }

        return $ordered;
    }