source/php/Module/Rss/Rss.php
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;
    }
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;
    }
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 ; }
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
Returns the RSS entries