function fs_load_item_data($name, $days) { // Calculate out the dates $minussev = mktime(0, 0, 0, date("m"), date("d") - $days, date("Y")); $end = date("Y-m-d"); $start = date("Y-m-d", $minussev); // Get data from FeedBurner return fs_fetch_feedburner_data($name, "GetItemData", "dates=" . $start . "," . $end); }
function testFeedBurnerSuccess() { // Create a Mock http object $fetcher =& new Mockhttp(); $fetcher->setReturnReference('fetch', $fetcher); // Set the result of the Mock http object $fetcher->body = '<?xml version="1.0" encoding="UTF-8"?> <rsp stat="ok"> <!--This information is part of the FeedBurner Awareness API. If you want to hide this information, you may do so via your FeedBurner Account.--> <feed id="jr03po9jr2s063gei3v9obmcl0" uri="Speedbreeze"> <entry date="2009-06-20" circulation="19" hits="32" reach="1" /> </feed> </rsp>'; $fetcher->status = 200; // Set what we're expecting from the function $fetcher->expect('fetch', array("https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=protected-feed&")); // Run the function $response = fs_fetch_feedburner_data("http://feeds.feedburner.com/protected-feed", "GetFeedData", "", $fetcher); // Assert what kind of response we want $this->assertTrue($response['success']); }
/* Copyright (c) 2008 - 2009 Jonathan Wilde This file is part of Feed Stats for WordPress. Feed Stats for WordPress is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. Feed Stats for WordPress is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Feed Stats for WordPress. If not, see <http://www.gnu.org/licenses/>. */ // Figure out the URL for the information at FeedBurner $feed = urldecode($_GET['feed']); $response = fs_fetch_feedburner_data($feed, "GetFeedData", false); $template = "[result][%+d] %s[result]"; // If there are no errors, tell the user that the feed is valid; if // there are errors, print them out directly. if ($response['success'] == true) { $status = fs_translatable_error("Valid"); printf($template, $status['code'], $status['title']); } else { printf($template, $response['error']['code'], $response['error']['title']); }