items AS $k => $v) { $i++; if($i > $options['count']) { break; } $return .= AppleLunch_RSS_PrintItem($v, $options['formatting']); } } else if($mode == 'ReviewsExcluded') { $feed['all'] = fetch_rss($feed['all']); $feed['review'] = fetch_rss($feed['reviews']); $feed['applelunch'] = fetch_rss($feed['applelunch']); $exclude = FALSE; foreach($feed['review']->items AS $k => $v) { $i++; if($i > $options['count']) { break; } $exclude[$v['guid']] = TRUE; } $i = 0; foreach($feed['applelunch']->items AS $k => $v) { $i++; if($i > $options['count']) { break; } $exclude[$v['guid']] = TRUE; } $i = 0; foreach($feed['all']->items AS $k => $v) { if(!$exclude[$v['guid']]) { $i++; if($i > $options['count']) { break; } $return .= AppleLunch_RSS_PrintItem($v, $options['formatting']); } } } else if($mode == 'All') { $feed['all'] = fetch_rss($feed['all']); $feed['applelunch'] = fetch_rss($feed['applelunch']); $exclude = FALSE; foreach($feed['applelunch']->items AS $k => $v) { $i++; if($i > $options['count']) { break; } $exclude[$v['guid']] = TRUE; } $i = 0; foreach($feed['all']->items AS $k => $v) { if(!$exclude[$v['guid']]) { $i++; if($i > $options['count']) { break; } $return .= AppleLunch_RSS_PrintItem($v, $options['formatting']); } } } $return .= $options['list_end']; return $return; } function AppleLunch_RSS_DataFormatting($date) { $months_str = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); $months_int = array('01', '02', '03', '04', '05', '06', '07', '08', '09', 10, 11, 12); $day = substr($date, strpos($date, ', ')+2, 2); $month = substr($date, strpos($date, ', ')+5, 3); $year = substr($date, strpos($date, $month)+4, 4); $month = str_replace($months_str, $months_int, $month); $hour = substr($date, strpos($date, $year)+5, 2); $date = mktime($hour+2, 0, 0, $month, $day, $year); return date('m/d', $date); } function AppleLunch_RSS_PrintItem($v, $item_formatting) { return str_replace(array('[link]', '[title]', '[description]', '[date]'), array($v['link'], $v['title'], $v['description'], AppleLunch_RSS_DataFormatting($v['pubdate'])), $item_formatting); } function AppleLunch_RSS_Widget($args) { $options = get_option('AppleLunch_RSS_Widget'); $options = AppleLunch_RSS_LoadDefaults($options); extract($args); echo $before_widget.$before_title.$options['title'].$after_title.AppleLunch_RSS().$after_widget; } function AppleLunch_RSS_LoadDefaults($options) { $options['title'] = empty($options['title']) ? __('Apple rumors & reviews') : $options['title']; $options['list_start'] = empty($options['list_start']) ? __('