コード例 #1
0
function theme_updates()
{
    global $newversion, $version, $themename, $shortname;
    // Get latest version
    // Use MagpieRSS
    require_once ABSPATH . WPINC . '/rss.php';
    // Feed where updates are located
    $rss = fetch_rss('http://www.photocrati.com/theme-updates/photocrati-updates-v' . $version . '.xml');
    if ($rss) {
        //loop through the latest rss items
        foreach ($rss->items as $item) {
            // Do our shornames match up?
            if ($item['shortname'] == $shortname) {
                $newversion = $item['version'];
            }
        }
    }
    if ($newversion > $version) {
        echo '<input type="hidden" name="theme-version" value="' . $newversion . '">';
        echo '<input type="hidden" name="theme-name" value="photocrati-theme">';
        echo '<p><div class="submit-button-wrapper"><input type="button" id="update-theme" value="&raquo; Get Update Now" style="clear:none;background:#0F7C11;color:#FFF;" /></div>';
        echo '<div id="loader" style="float:left;display:none;margin-top:7px;"><img src="' . get_template_directory_uri() . '/admin/images/ajax-loader.gif"></div><div id="msg" style="float:left;"></div></p>';
    } else {
        echo '<p>There are no updates to this theme available at this time.</p>';
    }
}
コード例 #2
0
ファイル: via-latest.php プロジェクト: robbiespire/paQui
		function widget($args = array()) {
			$show = get_option('show_yoast_widget');
			if ($show != 'noshow') {
				if (is_array($args))
					extract( $args, EXTR_SKIP );
				echo $before_widget.$before_title.$widget_name.$after_title;
				
				include_once(ABSPATH . WPINC . '/rss.php');
				$rss = fetch_rss('http://feeds.feedburner.com/viadat');
				if ($rss) {
					$items = array_slice($rss->items, 0, 4);
				}
				?>
				<?php if (empty($items)) { echo '<li>No items</li>'; }
				else {
				echo '<div class="rss-widget"><ul>';
				//<!--div style="float:right"><a href="http://www.viadat.com/"><img style="margin: 0 0 5px 5px;" src="http://www.viadat.com/images/viadat_emblem_white.jpg" alt="Viadat Creations"/></a></div-->
				foreach ( $items as $item ) : ?>
				<li><a class="rsswidget" href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'><?php echo $item['title']; ?></a>   <span class="rss-date"><?php echo date('F j, Y',strtotime($item['pubdate'])); ?></span><!--br/><br/--> 
				<!--p><?php //$item['description'] /*echo substr($item['description'],0,strpos($item['description'], "This is a post from"))*/; ?></p--></li>
				<?php endforeach;
				print "</ul></div>";
				}
				echo $after_widget;
			}
		}
コード例 #3
0
function OW_liste_rss($maxbillets = 10)
{
    global $db;
    $rssman = new rssManager($db);
    $urls = $rssman->getUrlList();
    $billets = array();
    foreach ($urls as $url) {
        $rss = fetch_rss($url['uti_rss']);
        if ($rss) {
            foreach ($rss->items as $item) {
                $item['channel_title'] = $rss->channel['title'];
                $item['channel_link'] = $rss->channel['link'];
                $item['ow_auteur'] = $url['uti_prenom'] . ' ' . $url['uti_nom'];
                $billets[] = $item;
            }
        }
    }
    if (count($billets)) {
        usort($billets, "cmpBillets");
        echo '<ul>';
        $i = 0;
        foreach ($billets as $billet) {
            echo '<li><a href="', $billet['link'], '">', htmlspecialchars($billet['title']), '</a> ';
            echo 'sur ', htmlspecialchars($billet['channel_title']);
            echo ' le ', date('d-m-Y H:i:s', $billet['date_timestamp']);
            echo '</li>';
            if (++$i > $maxbillets) {
                break;
            }
        }
        echo '</ul>';
    } else {
        echo '<p>Pas de billets pour le moment.</p>';
    }
}
コード例 #4
0
ファイル: navselect.php プロジェクト: radicaldesigns/amp
 function magpienav($url, $num_items = NULL, $title = NULL, $html1 = NULL, $html2 = NULL, $html3 = NULL, $html4 = NULL, $html5 = NULL, $format = NULL)
 {
     define('MAGPIE_DIR', 'FeedOnFeeds/magpierss/');
     require_once MAGPIE_DIR . 'rss_fetch.inc';
     $error_level_tmp = error_reporting();
     error_reporting(E_ERROR);
     $rss = fetch_rss($url);
     error_reporting($error_level_tmp);
     if ($rss) {
         if (!$num_items) {
             $num_items = 5;
         }
         $items = array_slice($rss->items, 0, $num_items);
         if (!$title) {
             $title = $rss->channel['title'];
         }
         $shownav .= $html1 . $title . $html2;
         foreach ($items as $item) {
             if (isset($format) && function_exists($format)) {
                 $shownav = $format($item);
             } else {
                 $href = $item['link'];
                 $title = $item['title'];
                 $shownav .= $html3 . "<a href={$href} class=sidelist>{$title}</a>" . $html4;
             }
         }
     } else {
         $shownav .= $html1 . $html2;
     }
     $shownav .= $html5;
     return $shownav;
 }
コード例 #5
0
ファイル: show_rss.php プロジェクト: emilymeyer/freedosweb
function show_rss($url, $max_count, $show_descr)
{
    $count = 0;
    $rss = fetch_rss($url);
    foreach ($rss->items as $item) {
        $link = $item['link'];
        $title = $item['title'];
        $pubdate = date('Y-m-d g:i', strtotime($item['pubdate']));
        /* BUG FIX: the new SourceForge news system now includes
           comments on news items in the news feed. we don't want
           that, so only print items that DON'T have "discussion"
           in the title. (i.e. strpos is FALSE) */
        if (strpos($title, "discussion") == FALSE) {
            if ($count++ < $max_count) {
                echo "<h4><a href=\"{$link}\">{$title}</a></h4>\n";
                echo "<p><span class=\"date\">{$pubdate}</span>\n";
                if ($show_descr) {
                    $description = $item['description'];
                    echo "{$description}\n";
                }
                echo "</p>\n";
            }
        }
    }
}
コード例 #6
0
ファイル: print_rss.php プロジェクト: emilymeyer/freedosweb
function print_rss($feed, $maxcount)
{
    // print at most $maxcount items from an RSS feed.
    // if $maxcount is negative, print items in reverse order, from the end.
    /* assumes MagpieRSS */
    $rss = fetch_rss($feed);
    /* MagpieRSS */
    if ($maxcount < 0) {
        $rss_items = array_reverse($rss->items);
    } else {
        $rss_items = $rss->items;
    }
    $max_count = abs($maxcount);
    $count = 0;
    foreach ($rss_items as $item) {
        /*
        		BUGFIX: The updated SourceForge news system now includes
        		comments on news items from the news feed. We don't want
        		that, so only print items that DO NOT have "discussion"
        		in the title. (i.e. strpos is FALSE) */
        /*
        
        /*
        TODO: a better solution is to fix the rss so it doesn't
        include the SF comments.
        */
        if (strpos($item['title'], "discussion") === FALSE) {
            if ($count++ < $max_count) {
                print_rss_item($item['title'], $item['pubdate'], $item['description'], $item['link']);
            }
        }
    }
}
コード例 #7
0
ファイル: class.rssimport.php プロジェクト: hyrmedia/modules
 function EIP_Feed_Field_Select($feed_url = "")
 {
     $rss = fetch_rss($feed_url);
     $x = sizeof($rss->items[1]);
     $z = $rss->items[0];
     $TheTextToReturn = "\toptions: {";
     $count = 0;
     foreach ($z as $item => $key) {
         if ($count < $x) {
             //echo $item . "<BR>";
             if (is_array($z[$item])) {
                 foreach ($z[$item] as $item2 => $key) {
                     if ($count > 0) {
                         $TheTextToReturn .= ", ";
                     }
                     $TheTextToReturn .= $item . "_ne_st_ed_" . $item2 . ": '" . $item . " : " . $item2 . "'";
                     $count = $count + 1;
                 }
             } else {
                 if ($count > 0) {
                     $TheTextToReturn .= ", ";
                 }
                 $TheTextToReturn .= $item . ": '" . $item . "'";
                 $count = $count + 1;
             }
         }
     }
     $TheTextToReturn .= "}";
     return $TheTextToReturn;
 }
コード例 #8
0
ファイル: rss-corefeed.php プロジェクト: Mrhjx2/nagios
function do_corefeed_html()
{
    $url = "http://www.nagios.org/backend/feeds/corepromo";
    $rss = fetch_rss($url);
    $x = 0;
    //build content string
    if ($rss) {
        $html = " \n\t\t<ul>";
        foreach ($rss->items as $item) {
            $x++;
            if ($x > 3) {
                break;
            }
            //$href = $item['link'];
            //$title = $item['title'];
            $desc = $item['description'];
            $html .= "<li>{$item['description']}</li>";
        }
        $html .= "</ul>";
        print $html;
    } else {
        $html = "\n\t\tAn error occurred while trying to fetch the Nagios Core feed.  Stay on top of what's happening by visiting <a href='http://www.nagios.org/' target='_blank'>http://www.nagios.org/</a>.\n\t\t";
        print $html;
    }
}
コード例 #9
0
 public function display()
 {
     $disp = Display::current();
     require_once 'packages/magpierss/rss_fetch.inc';
     $rss = fetch_rss('http://shortsoup.net.au/?feed=rss2&p=11');
     $disp->setValue('comments', $rss->items);
     $disp->setValue('add_comment', $rss->channel['link']);
     print_r($rss->items);
     // Include the javascript for the page
     JsRegister::current()->registerScript('home');
     //			if(Application::current()->user()->authorise('SeeingsystemSetup'))
     $disp->setValue('logged_in', true);
     //			else
     //			{
     //				$disp->setValue('login_error',$this->login_error);
     //				$login_form = Form::load('seeingsystem.views.Login');
     //				$disp->addForm($login_form);
     //			}
     $disp->setTitle('SeeingSystem - A Flickr Slideshow of Ordinary Beautiful Things');
     $disp->addView('page_content', 'seeingsystem.views.Home');
     /*
     			echo "<br />DEBUG: Home::display()<br />\n";
     			exit;
     */
     $disp->displaySiteTemplate();
 }
コード例 #10
0
ファイル: rss-newsfeed.php プロジェクト: Mrhjx2/nagios
function do_newsfeed_html()
{
    $url = "http://www.nagios.org/backend/feeds/frontpage/";
    $rss = fetch_rss($url);
    if ($rss) {
        $x = 0;
        $html = "\n\t\t<ul>\n";
        foreach ($rss->items as $item) {
            $x++;
            if ($x > 3) {
                break;
            }
            $href = $item['link'];
            $title = $item['title'];
            $html .= "<li><a href='{$href}' target='_blank'>{$title}</a></li>";
        }
        $html .= '
		<li><a href="http://www.nagios.org/news" target="_blank">More news...</a></li>
		</ul>';
        print $html;
    } else {
        $html = "\n\t\tAn error occurred while trying to fetch the latest Nagios news.  Stay on top of what's happening by visiting <a href='http://www.nagios.org/news' target='_blank'>http://www.nagios.org/news</a>.\n\t\t";
        print $html;
    }
}
コード例 #11
0
function widget_flickr($args) {
	
	require_once(ABSPATH . WPINC . '/rss.php');
	
	extract($args);
	
	$options = get_option('widget_flickr');
	$url = 'http://flickr.com/services/feeds/photos_public.gne?id=' . $options['account'] . '&format=rss_200';
	$rss = fetch_rss($url);
	
	if (!empty($rss->items)) {
		$data = array_slice($rss->items, 0, $options['display']);
		
		foreach ($data as $item) {
			preg_match_all('/src=["\']([^"\']+)/si', $item['description'], $src);
			
			$src = str_replace('_m.jpg', '_s.jpg', $src[1][0]);
			$items = $items . '<li><a href="' . $item['link']. '"><img src="' . $src . '" alt="' . $item['title'] . '" /></a></li>';
		}
		
		echo
			$before_widget,
				$before_title . $options['title'] . $after_title,
				'<ul>',
					$items,
				'</ul>',
			$after_widget;
	}
}
コード例 #12
0
function get_rss($url, $inputch, $outputch, $limit)
{
    if ($url) {
        $rss = fetch_rss($url);
        //	Generating HTML Code
        $rsscontent = '<b class="rss-channel">' . $rss->channel['title'] . '</b><p>';
        $rsscontent .= "<ul>";
        $counter = 1;
        foreach ($rss->items as $item) {
            $href = $item['link'];
            $title = $item['title'];
            $rsscontent .= "<li><a href={$href}>{$title}</a></li>";
            if ($counter >= $limit) {
                break;
            } else {
                $counter++;
            }
        }
        $rsscontent .= "</ul>";
        //	Charset Conversion
        $conv = new convertor();
        $conv->convertor($inputch, $outputch, $rsscontent);
        $rssconv = $conv->pull();
    }
    return $rssconv;
}
コード例 #13
0
ファイル: Rss.php プロジェクト: newga/newga
 public function getRss($feed)
 {
     if (!strlen($feed)) {
         // Always use http protocol
         $feed = '';
     }
     /*
     Array
     (
     	[title] => 
     	[description] => 
     	[link] => 
     	[guid] => 
     	[pubdate] => 
     	[summary] => 
     	[date_timestamp] => 
     )
     */
     $this->items = array();
     $numberOfItems = 10;
     $rssFeed = fetch_rss($feed);
     if (sizeof($rssFeed->items)) {
         $this->items = array_slice($rssFeed->items, 0, $numberOfItems);
     }
 }
コード例 #14
0
function widget_untappd()
{
    require_once ABSPATH . 'wp-includes/rss-functions.php';
    $wp_untappd_rss = get_option('untappd_rss');
    $wp_untappd_title = get_option('untappd_title') == '' ? "Beers I'm Drinking" : get_option('untappd_title');
    $wp_untappd_userid = get_option('untappd_userid');
    echo wptexturize('<div id="widget_untappd">');
    echo wptexturize('<div id="widget_untappd_header">' . $wp_untappd_title . '</div>');
    echo wptexturize('<div id="widget_untappd_beer_list">');
    if ($wp_untappd_rss != '') {
        $rss = fetch_rss($wp_untappd_rss);
        if (count($rss->items) != 0) {
            $limit = 5;
            foreach ($rss->items as $item) {
                if ($limit == 0) {
                    break;
                }
                echo wptexturize('<div class="widget_untappd_beer"><a target="_blank" href="' . $item['link'] . '">' . $item['title'] . '</a></div>');
                $limit++;
            }
        } else {
            echo wptexturize('<div class="widget_untappd_beer">What?!?  No beers yet?!?<br /><br /></div>');
        }
    } else {
        echo wptexturize('<div class="widget_untappd_beer">Widget not setup yet<br /><br /></div>');
    }
    echo wptexturize('</div>');
    if ($wp_untappd_userid != '') {
        echo wptexturize('<div id="widget_untappd_follow"><a target="_blank" href="http://untappd.com/user/' . $wp_untappd_userid . '">Follow me on Untappd!</a></div>');
    } else {
        echo wptexturize('<div id="widget_untappd_follow"><a target="_blank" href="http://untappd.com/">Drink Socially at Untappd!</a></div>');
    }
    echo wptexturize('</div>');
    echo wptexturize('<div id="widget_untappd_logo"><a target="_blank" href="http://untappd.com"><span></span></a></div>');
}
コード例 #15
0
ファイル: rss-newsfeed.php プロジェクト: PKDSP/Sources
function do_newsfeed_html()
{
    $html = '';
    $rss = fetch_rss('https://www.nagios.org/backend/feeds/frontpage');
    // Output an unordered list of the first n items if any were returned.
    if ($rss && $rss->items) {
        $html = '<ul>';
        $x = 0;
        foreach ($rss->items as $item) {
            if (++$x > 3) {
                break;
            }
            // Only 3 items.
            $href = $item['link'];
            $title = $item['title'];
            $html .= "<li><a href='{$href}' target='_blank'>{$title}</a></li>";
        }
        $html .= '
		<li><a href="https://www.nagios.org/news" target="_blank">More news...</a></li>
		</ul>';
    } else {
        $html = "Unable to fetch the latest Nagios news. Stay on top of what's happening by visiting <a href='https://www.nagios.org/news' target='_blank'>https://www.nagios.org/news</a>.";
    }
    print $html;
}
コード例 #16
0
ファイル: RSSFeedEGlet.php プロジェクト: uzerpllp/uzerp
 function populate()
 {
     require_once LIB_ROOT . 'magpie/rss_fetch.inc';
     $rss = fetch_rss($this->source);
     $this->contents = $rss->items;
     parent::populate();
 }
コード例 #17
0
function show_wcp($items = 20, $style = "full")
{
    include_once ABSPATH . WPINC . '/rss.php';
    $wcp_rss = fetch_rss('http://feed.feedsky.com/WordPressChinesePlanet');
    if (empty($wcp_rss)) {
        return -1;
    }
    if (empty($wcp_rss->items)) {
        return -1;
    }
    $wcp_items = array_slice($wcp_rss->items, 0, $items);
    $output = '';
    if ($style == "full") {
        foreach ($wcp_items as $wcp_item) {
            $output .= '<div class="wcp">';
            $output .= '<h3><a href="' . $wcp_item['link'] . '" title="' . $wcp_item['title'] . '">' . $wcp_item['title'] . '</a></h3>';
            $output .= '<p>' . $wcp_item['description'] . ' <br /><a href="' . $wcp_item['link'] . '" class="more-link"><span class="moretext"> 查看全文... </span></a></p>';
            $output .= '<p class="info"><em class="date">' . date('F jS, Y - h:ia', strtotime($wcp_item["pubdate"])) . '</em><em class="author">' . $wcp_item['author'] . '</em></p>';
            $output .= '</div>';
        }
    } else {
        $output .= '<ul class="wcp">';
        foreach ($wcp_items as $wcp_item) {
            $output .= '<li><a href="' . $wcp_item['link'] . '" title="' . $wcp_item['title'] . '">' . $wcp_item['title'] . '</a></li>';
        }
        $output .= '</ul>';
    }
    echo $output;
}
コード例 #18
0
ファイル: syndicate.php プロジェクト: kldeepak/swara
function syndicate($content)
{
    //gets data from an rss- or atom-feed and builds an unordered list
    //This is based on MagPieRSS and a nice php-script by Richard Eriksson
    $att = getattributes($content);
    if (isset($att['number'])) {
        $number = $att['number'];
    } else {
        $number = 10;
    }
    if (isset($att['url'])) {
        $return = "<ul>";
        require_once "loudblog/inc/magpierss/rss_fetch.inc";
        $yummy = fetch_rss($att['url']);
        $yummyitems = array_slice($yummy->items, 0, $number);
        foreach ($yummyitems as $yummyitem) {
            $return .= '<li>';
            $return .= '<a href="';
            $return .= $yummyitem['link'];
            $return .= '">';
            $return .= $yummyitem['title'];
            $return .= '</a>';
            $return .= '</li>';
        }
        $return .= "</ul>";
    }
    return $return;
}
コード例 #19
0
 function parse_rss()
 {
     $months = array("Jan" => "01", "Feb" => "02", "Mar" => "03", "Apr" => "04", "May" => "05", "Jun" => "06", "Jul" => "07", "Aug" => "08", "Sep" => "09", "Oct" => "10", "Nov" => "11", "Dec" => "12");
     require_once './magpierss/rss_fetch.inc';
     $url = 'http://developer.berlios.de/export/rss20_bsnews.php?group_id=4806';
     $rss = fetch_rss($url);
     if ($rss and !$rss->ERROR) {
         $num_items = 10;
         $items = array_slice($rss->items, 0, $num_items);
         $ret = '<dl typeof="rss:channel" about="http://swaml.berlios.de/rss/news">';
         foreach ($items as $item) {
             $title = $item[title];
             $parted = explode('=', $item[link]);
             $id = $parted[1];
             $link = 'http://swaml.berlios.de/news/' . $id;
             $description = $item[description];
             $description = $this->acronyms_replace($description);
             $description = $this->make_clickable($description);
             $pubDate = $item[pubdate];
             $date = explode(" ", $pubDate);
             $ret .= '<dt>[' . $date[1] . '-' . $months[$date[2]] . '-' . $date[3] . '] ';
             $ret .= '<a href="' . $link . '"><strong>' . $title . '</strong></a></dt>';
             $ret .= '<dd>' . $description . '</dd>';
         }
         $ret .= '</dl>';
     } else {
         $ret = 'Error: ' . $rss->ERROR;
     }
     return $ret;
 }
コード例 #20
0
 /**
  * Perform on the action call
  *
  * @param mixed $data Data passed to this action
  */
 public function perform($data = FALSE)
 {
     if (!defined('MAGPIE_OUTPUT_ENCODING')) {
         if (isset($data['encoding'])) {
             define('MAGPIE_OUTPUT_ENCODING', $data['encoding']);
         }
     }
     if (isset($data['cache_time'])) {
         define('MAGPIE_CACHE_ON', TRUE);
         define('MAGPIE_CACHE_AGE', (int) $data['cache_time']);
         define('MAGPIE_CACHE_DIR', SMART_BASE_DIR . 'data/common/rss_cache');
     }
     if (!($rss = fetch_rss($data['url']))) {
         trigger_error('Rss feed not available: ' . magpie_error(), E_USER_WARNING);
         $data['result']['items'] = array();
         $data['result']['channel'] = array();
         $data['result']['image'] = array();
         $data['result']['textinput'] = array();
         return;
     }
     $data['result']['items'] = $rss->items;
     $data['result']['channel'] = $rss->channel;
     $data['result']['image'] = $rss->image;
     $data['result']['textinput'] = $rss->textinput;
 }
コード例 #21
0
ファイル: fetch.php プロジェクト: nemein/openpsa
 /**
  * Static method for actually fetching a feed
  */
 public static function raw_fetch($url)
 {
     $items = array();
     try {
         // TODO: Ensure Magpie uses conditional GETs here
         error_reporting(E_WARNING);
         $rss = fetch_rss($url);
         error_reporting(E_ALL);
     } catch (Exception $e) {
         // Magpie failed fetching or parsing the feed somehow
         debug_add("Failed to fetch or parse feed {$url}: " . $e->getMessage(), MIDCOM_LOG_INFO);
         return $items;
     }
     if (!$rss) {
         // Magpie failed fetching or parsing the feed somehow
         debug_add("Failed to fetch or parse feed {$url}: " . $GLOBALS['MAGPIE_ERROR'], MIDCOM_LOG_INFO);
         return $items;
     }
     foreach ($rss->items as $item) {
         // Normalize the item
         $item = self::normalize_item($item);
         if ($item) {
             $items[] = $item;
         }
     }
     $rss->items = $items;
     return $rss;
 }
コード例 #22
0
ファイル: check.php プロジェクト: anodyne/sms
 function version($notify)
 {
     /* pull in the main fetch file */
     require_once 'framework/rss/rss_fetch.inc';
     /* set the url of the XML file */
     /* DO NOT CHANGE THIS URL! Doing so will break the version checking function! */
     $url = "http://www.anodyne-productions.com/feeds/version_sms.xml";
     $rss = fetch_rss($url);
     $continue = 1;
     /* define the variables coming out of the XML file */
     foreach ($rss->items as $item) {
         $rssVersion = $item['version'];
         $notes = $item['notes'];
         $severity = $item['severity'];
     }
     /* logic to figure out if we're supposed to show the update notification */
     if ($notify == "none") {
         $continue = 0;
     }
     if ($notify == "major" && $severity == "minor") {
         $continue = 0;
     }
     /* check the major version info */
     $major = substr($rssVersion, 0, 1);
     /* make sure we're using the right label, Nova/SMS */
     $label = $major >= 3 ? 'Nova' : 'SMS';
     /* do some replacement for a fixed version based on the product */
     $versionFixed = $major >= 3 ? substr_replace($rssVersion, '1', 0, 1) : $rssVersion;
     /* if we're supposed to show the update info, do it */
     if ($continue == 1) {
         if (version_compare(VER_FILES, $rssVersion, '<') && version_compare(VER_DB, $rssVersion, '<')) {
             $this->output_array[0][1] = "<div class='notify-red'>";
             $this->output_array[0][1] .= "<b class='red case'>Update Available</b> &mdash; ";
             $this->output_array[0][1] .= $label . " " . $versionFixed . " is now available.<br /><br />";
             $this->output_array[0][1] .= $notes;
             $this->output_array[0][1] .= "<br /><br />";
             $this->output_array[0][1] .= "Go to the <a href='http://www.anodyne-productions.com/' target='_blank'>Anodyne site</a> to download this update.";
             $this->output_array[0][1] .= "</div>";
         }
         if (version_compare(VER_DB, VER_FILES, '>') && version_compare(VER_DB, $rssVersion, '==')) {
             $this->output_array[0][1] = "<div class='notify-orange'>";
             $this->output_array[0][1] .= "<b class='orange case'>Update Warning</b> &mdash; ";
             $this->output_array[0][1] .= "Your database is running SMS version " . VER_DB . ", however, your files are running version " . VER_FILES . " and need to be updated. Please upload the correct files before continuing. If you do not update your files and database SMS will not work correctly!";
             $this->output_array[0][1] .= "</div>";
         }
         if (version_compare(VER_FILES, VER_DB, '>') && version_compare(VER_FILES, $rssVersion, '==')) {
             /* format the version right for the URL pass */
             $urlVersion = str_replace(".", "", VER_DB);
             /* do some logic to make sure that the urlVersion var is right */
             if ($urlVersion == "20" || $urlVersion == "21" || $urlVersion == "22" || $urlVersion == "23" || $urlVersion == "24" || $urlVersion == "25" || $urlVersion == "26") {
                 $urlVersion = $urlVersion . "0";
             }
             $this->output_array[0][1] = "<div class='notify-orange'>";
             $this->output_array[0][1] .= "<b class='orange case'>Update Warning</b> &mdash; ";
             $this->output_array[0][1] .= "Your files are running SMS version " . VER_FILES . ", however, your database is running version " . VER_DB . " and needs to be updated. Please use the link below to finish your update. If you do not update your files and database SMS will not work correctly!<br /><br />";
             $this->output_array[0][1] .= "<a href='" . WEBLOC . "update.php?version=" . $urlVersion . "'>Update SMS Database</a>";
             $this->output_array[0][1] .= "</div>";
         }
     }
 }
コード例 #23
0
function widget_twitter($args) {
	
	require_once(ABSPATH . WPINC . '/rss.php');
	
	extract($args);
	
	$options = get_option('widget_twitter');
	$url = 'http://twitter.com/statuses/user_timeline/' . $options['account'] . '.rss';
	$rss = fetch_rss($url);
	
	if (!empty($rss->items)) {
		$data = array_slice($rss->items, 0, $options['display']);
		
		foreach ($data as $item) {
			$items = $items . '<li>' . $item['title'] .'</li>';
		}
		
		echo
			$before_widget,
				$before_title . $options['title'] . $after_title,
				'<div class="arrows">',
					'<p class="next"><a href="javascript:;">NEXT</a></p>',
					'<p class="previous"><a href="javascript:;">PREVIOUS</a></p>',
				'</div>',
				
				'<ul>',
					$items,
				'</ul>',
			$after_widget;
	}
}
コード例 #24
0
function writePcgenFileItems($url, $viewProd, $maxRecs)
{
    if ($url) {
        $rss = fetch_rss($url);
        $outCount = 0;
        $prevVerNum = array(0, 0, 0);
        $ver2 = '';
        foreach ($rss->items as $item) {
            $title = $item['title'];
            $title = strtolower($title);
            $title = str_replace("_", " ", $title);
            $title = str_replace("<br>", "<br /> ", $title);
            $title = ucwords($title);
            $found = nth_position($title, '/', 2);
            $found2 = nth_position($title, '/', 3);
            $ver = substr($title, $found + 1, $found2 - $found - 1);
            if ($ver != $ver2) {
                $ver2 = $ver;
                $display = true;
            } else {
                $display = false;
            }
            // Check its PRD status
            $verNum = split("\\.", $ver);
            $isProd = false;
            $isSnapshot = false;
            if (count($verNum > 1)) {
                if ($verNum[1] % 2 == 0) {
                    if (strpos(strtolower($title), "rc") == 0) {
                        $isProd = true;
                    }
                }
            }
            if (strpos(strtolower($title), "snapshot") != 0) {
                $isSnapshot = true;
            }
            if ($viewProd && $isProd && $verNum[0] == $prevVerNum[0] && $verNum[1] == $prevVerNum[1]) {
                // When showing multiple prod versions, get the latest patch from each
                $isProd = false;
            }
            if ($outCount < $maxRecs && !$isSnapshot && ($viewProd && $isProd || !$viewProd && !$isProd) && $display) {
                //$pub    = date("Y-m-d", strtotime($item['pubDate']));
                $pub = $item['pubdate'];
                $href = 'http://sourceforge.net/projects/pcgen/files/PCGen%20Unstable/';
                $ver = str_replace("Rc", "RC", $ver);
                echo "<h3><a href='{$href}{$ver}'>{$ver}</a></h3>\n";
                echo "Released: {$pub}\n";
                $outCount++;
                if ($isProd) {
                    $prevVerNum = $verNum;
                }
            }
        }
    }
}
コード例 #25
0
 /**
  * @brief Returns status flag and data in html tags
  * @desc Here we use 3rd-part extension magpierss which fetches rss feeds from given url
  */
 public function getRssFeeds()
 {
     $this->response->setVal('status', false);
     $options = $this->request->getVal('options', false);
     $this->response->setCacheValidity(3600);
     //cache it on varnish for 1h
     //somehow empty arrays are lost
     //we need to restore then its default values
     foreach (array('highlight', 'filter', 'filterout') as $option) {
         if (!isset($options[$option])) {
             $options[$option] = array();
         }
     }
     if (!empty($options) && !empty($options['url'])) {
         $url = html_entity_decode($options['url']);
         $status = null;
         $rss = @fetch_rss($url, $status);
         if (!is_null($status) && $status !== 200) {
             $this->response->setVal('error', wfMsg('wikia-rss-error-wrong-status-' . $status, $url));
             return;
         }
         if (!is_object($rss) || !is_array($rss->items)) {
             $this->response->setVal('error', wfMsg('wikia-rss-empty', $url));
             return;
         }
         if ($rss->ERROR) {
             $this->response->setVal('error', wfMsg('wikia-rss-error', $url, $rss->ERROR));
             return;
         }
         $short = $options['short'] == 'true' ? true : false;
         $reverse = $options['reverse'] == 'true' ? true : false;
         if ($reverse) {
             $rss->items = array_reverse($rss->items);
         }
         $description = false;
         foreach ($rss->items as $item) {
             if (isset($item['description']) && $item['description']) {
                 $description = true;
                 break;
             }
         }
         if (!$short && $description) {
             $items = $this->getFullItemList($rss->items, $options);
             $html = $this->app->renderView('WikiaRssExternal', 'fullList', array('items' => $items));
         } else {
             $items = $this->getShortItemList($rss->items, $options);
             $html = $this->app->renderView('WikiaRssExternal', 'shortList', array('items' => $items));
         }
         $this->response->setVal('status', true);
         $this->response->setVal('html', $html);
     } else {
         $this->response->setVal('error', wfMsg('wikia-rss-error-invalid-options'));
     }
 }
コード例 #26
0
ファイル: debugfeed.php プロジェクト: jphpsf/gregarius
 function render()
 {
     $res = rss_query("select url from " . getTable("channels") . " where id = " . $this->fid);
     if (!defined('MAGPIE_DEBUG') || !MAGPIE_DEBUG) {
         define('MAGPIE_DEBUG', true);
     }
     list($url) = rss_fetch_row($res);
     define('MAGPIE_CACHE_ON', false);
     $rss = fetch_rss($url);
     echo "<pre>\n";
     echo htmlentities(print_r($rss, 1));
     echo "</pre>\n";
 }
コード例 #27
0
ファイル: NewsAgent.php プロジェクト: nbarrientos/miex
 function printNews()
 {
     $url = 'http://sourceforge.net/export/rss2_projnews.php?group_id=187602';
     $rss = fetch_rss($url);
     foreach ($rss->items as $item) {
         $title = $item[title];
         $url = $item[link];
         $pubDate = $item[pubdate];
         $date = explode(" ", $pubDate);
         $ret .= "<li><span style=\"font-size: 9pt;\">[{$date['1']}/{$date['2']}/{$date['3']}]</span> <a href=\"{$url}\">{$title}</a></li>";
     }
     return $ret;
 }
コード例 #28
0
ファイル: feed.class.php プロジェクト: ruucla/mwf
 public function fetch_items()
 {
     try {
         $rss = fetch_rss($this->get_path());
     } catch (Exception $e) {
         return false;
     }
     $this->_items = array();
     foreach ($rss->items as $item) {
         $this->_items[] = new Feed_Item($this, $item);
     }
     return $this->_items;
 }
コード例 #29
0
 /**
  * Récupère le flux RSS à partir d'une URL.
  * Utilise MagpieRss http://magpierss.sourceforge.net/
  */
 public function getRss($url, $nbMax = -1)
 {
     $arFeeds = array();
     // Test and Create rss temp_dir
     $cachePath = COPIX_CACHE_PATH . 'fluxrss/';
     $cacheTestFile = 'rss.txt';
     if (!file_exists($cachePath . $cacheTestFile)) {
         require_once COPIX_UTILS_PATH . 'CopixFile.class.php';
         $objectWriter = new CopixFile();
         $objectWriter->write($cachePath . $cacheTestFile, date('Y/m/d H:i'));
     }
     // Use Magpie to parse current RSS file
     define('MAGPIE_CACHE_DIR', COPIX_CACHE_PATH . 'rss');
     require_once 'rss_fetch.inc';
     $rss = fetch_rss($url);
     if ($rss) {
         if ($nbMax > 0) {
             $arFeeds = array_slice($rss->items, 0, intval($nbMax));
         } else {
             $arFeeds = $rss->items;
         }
     }
     foreach ($arFeeds as $key => $Feed) {
         //print_r($Feed);
         if (isset($Feed['dc']['date'])) {
             $currentDate = @parse_w3cdtf($Feed['dc']['date']);
             // Ok with dotclear that uses w3c date format
             //var_dump($currentDate);
         } else {
             $currentDate = -1;
         }
         if ($currentDate != -1) {
             $Feed['dc']['datecopix'] = date("Ymd", $currentDate);
             if (!isset($Feed['date_timestamp'])) {
                 $Feed['date_timestamp'] = $currentDate;
             }
         } else {
             if (isset($Feed['date_timestamp'])) {
                 // Ok with b2evolution that uses timestamp format
                 $Feed['dc']['datecopix'] = date('Ymd', $Feed['date_timestamp']);
             } else {
                 $Feed['dc']['datecopix'] = null;
                 $Feed['date_timestamp'] = null;
             }
         }
         //var_dump($Feed);
         //die();
         $arFeeds[$key] = $Feed;
     }
     return $arFeeds;
 }
コード例 #30
0
 /**
  * Parses an RSS feed
  *
  * @param rssFeed The URL of the RSS feed.
  * @return Returns true if the parsing was successful.
  */
 function parse($rssFeed)
 {
     $rss = fetch_rss($rssFeed);
     if (!$rss) {
         return false;
     }
     $this->_channel = new RSSChannel($rss->channel);
     $this->_items = array();
     foreach ($rss->items as $item) {
         $itemObject = new RSSItem($item);
         array_push($this->_items, $itemObject);
     }
     return true;
 }