Example #1
0
/**
 * Initializes SimplePie and loads the feeds into the global <tt>$list</tt> array.
 *
 * Loads feeds from conf/feeds.data into the global <tt>$list</tt> array if not already done.
 * Then calls <tt>lilina_return_items()</tt> and stores the SimplePie object returned in the
 * global <tt>$list</tt> array if not already done.
 * Increments the <tt>$item_number</tt> if the <tt>$increment</tt> parameter is true, or
 * initializes the <tt>$item_number</tt> if not already done. Then sets the <tt>$showtime</tt>
 * variable if not already done.
 *
 * Checks if the current item's date is less than the <tt>$showtime</tt> variable and if so,
 * returns false to stop processing items. If not, checks if the <tt>$item_number</tt> is
 * less than the total number of items and if so, returns true. Otherwise, returns false.
 *
 * @return boolean Are items available?
 * @todo This is somewhat ugly code. Clean it up.
 */
function has_items($increment = true)
{
    global $lilina_items;
    if (count(Feeds::get_instance()->getAll()) === 0) {
        return false;
    }
    if (empty($lilina_items)) {
        $lilina_items = lilina_return_items();
    }
    return $lilina_items->has_items();
}
Example #2
0
/**
 * Initializes SimplePie and loads the feeds into the global <tt>$list</tt> array.
 *
 * Loads feeds from conf/feeds.data into the global <tt>$list</tt> array if not already done.
 * Then calls <tt>lilina_return_items()</tt> and stores the SimplePie object returned in the
 * global <tt>$list</tt> array if not already done.
 * Increments the <tt>$item_number</tt> if the <tt>$increment</tt> parameter is true, or
 * initializes the <tt>$item_number</tt> if not already done. Then sets the <tt>$showtime</tt>
 * variable if not already done.
 *
 * Checks if the current item's date is less than the <tt>$showtime</tt> variable and if so,
 * returns false to stop processing items. If not, checks if the <tt>$item_number</tt> is
 * less than the total number of items and if so, returns true. Otherwise, returns false.
 * @global <tt>$data</tt> contains feed information
 * @global <tt>$item_number</tt> contains the current item's position in the item list
 * @global <tt>$settings</tt> contains filename information and default time to display
 * @global <tt>$showtime</tt> contains the
 *
 * @return boolean Are items available?
 * @todo This is somewhat ugly code. Clean it up.
 */
function has_items($increment = true)
{
    global $lilina_items;
    global $data, $item, $item_number, $settings, $showtime, $total_items;
    if (empty($data)) {
        load_feeds();
    }
    if (!isset($data['feeds']) || count($data['feeds']) === 0) {
        return false;
    }
    if (empty($lilina_items)) {
        $lilina_items = lilina_return_items($data);
    }
    return $lilina_items->has_items();
}