Version Description
Download this release
Release Info
Developer | radgeek |
Plugin | FeedWordPress |
Version | 2009.0613 |
Comparing to | |
See all releases |
Code changes from version 2009.0612 to 2009.0613
- ChangeLog.text +14 -0
- MagpieRSS-upgrade/rss.php +4 -4
- admin-ui.php +4 -2
- feedfinder.class.php +184 -0
- feedwordpress.php +11 -185
- readme.txt +1 -1
- syndication.php +61 -3
ChangeLog.text
CHANGED
@@ -1,5 +1,19 @@
|
|
1 |
FeedWordPress Change Log
|
2 |
========================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
Changes from 2008.1214 to 2009.0612
|
5 |
-----------------------------------
|
1 |
FeedWordPress Change Log
|
2 |
========================
|
3 |
+
Changes from 2009.0612 to Trunk
|
4 |
+
-------------------------------
|
5 |
+
* INTERFACE/BUGFIX: WORDPRESS 2.8 CATEGORY BOX FIX. Thanks to a subtle
|
6 |
+
change in class names between the WordPress 2.7 and 2.8 stylesheets,
|
7 |
+
category boxes in the FeedWordPress settings interface tended to overflow
|
8 |
+
and have a lot of messy-looking overlapping text under WordPress 2.8.
|
9 |
+
This has now been fixed.
|
10 |
+
|
11 |
+
* FeedFinder FAILURE DIAGNOSTICS: When FWP's FeedFinder fails to find any
|
12 |
+
feeds at a given URL (for example, when you are trying to add a
|
13 |
+
subscription through the administrative interface and you run into an
|
14 |
+
error message), FeedWordPress now provides more diagnostic information
|
15 |
+
for the reasons behind the failure. If that helps you, great; if not,
|
16 |
+
it should help me respond more intelligently to your support request..
|
17 |
|
18 |
Changes from 2008.1214 to 2009.0612
|
19 |
-----------------------------------
|
MagpieRSS-upgrade/rss.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Author: Kellan Elliot-McCrea <kellan@protest.net>
|
5 |
* WordPress development team <http://www.wordpress.org/>
|
6 |
* Charles Johnson <technophilia@radgeek.com>
|
7 |
-
* Version:
|
8 |
* License: GPL
|
9 |
*
|
10 |
* Provenance:
|
@@ -1204,7 +1204,7 @@ endif;
|
|
1204 |
version will be return, if it exists (and if MAGPIE_CACHE_FRESH_ONLY is off)
|
1205 |
\*=======================================================================*/
|
1206 |
|
1207 |
-
define('MAGPIE_VERSION', '
|
1208 |
|
1209 |
$MAGPIE_ERROR = "";
|
1210 |
|
@@ -1401,12 +1401,12 @@ function _fetch_remote_file ($url, $headers = "" ) {
|
|
1401 |
);
|
1402 |
|
1403 |
if ( is_wp_error($resp) ) :
|
1404 |
-
$error =
|
1405 |
|
1406 |
$client = new stdClass;
|
1407 |
$client->status = 500;
|
1408 |
$client->response_code = 500;
|
1409 |
-
$client->error = $error
|
1410 |
else :
|
1411 |
$client = new stdClass;
|
1412 |
$client->status = $resp['response']['code'];
|
4 |
* Author: Kellan Elliot-McCrea <kellan@protest.net>
|
5 |
* WordPress development team <http://www.wordpress.org/>
|
6 |
* Charles Johnson <technophilia@radgeek.com>
|
7 |
+
* Version: 2009.0613
|
8 |
* License: GPL
|
9 |
*
|
10 |
* Provenance:
|
1204 |
version will be return, if it exists (and if MAGPIE_CACHE_FRESH_ONLY is off)
|
1205 |
\*=======================================================================*/
|
1206 |
|
1207 |
+
define('MAGPIE_VERSION', '2009.0613');
|
1208 |
|
1209 |
$MAGPIE_ERROR = "";
|
1210 |
|
1401 |
);
|
1402 |
|
1403 |
if ( is_wp_error($resp) ) :
|
1404 |
+
$error = $resp->get_error_messages();
|
1405 |
|
1406 |
$client = new stdClass;
|
1407 |
$client->status = 500;
|
1408 |
$client->response_code = 500;
|
1409 |
+
$client->error = implode(" / ", $error). "\n"; //\n = Snoopy compatibility
|
1410 |
else :
|
1411 |
$client = new stdClass;
|
1412 |
$client->status = $resp['response']['code'];
|
admin-ui.php
CHANGED
@@ -115,12 +115,14 @@ function fwp_category_box ($checked, $object, $tags = array()) {
|
|
115 |
</div>
|
116 |
|
117 |
<ul id="category-tabs">
|
118 |
-
|
|
|
119 |
<p style="font-size:smaller;font-style:bold;margin:0">Give <?php print $object; ?> these categories</p>
|
120 |
</li>
|
121 |
</ul>
|
122 |
|
123 |
-
|
|
|
124 |
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
|
125 |
<?php fwp_category_checklist(NULL, false, $checked) ?>
|
126 |
</ul>
|
115 |
</div>
|
116 |
|
117 |
<ul id="category-tabs">
|
118 |
+
<?php /* ui-tabs-selected in WP 2.7 CSS = tabs in WP 2.8 CSS. Thank you, o brilliant wordsmiths of the WordPress 2.8 stylesheet... */ ?>
|
119 |
+
<li class="ui-tabs-selected tabs"><a href="#categories-all" tabindex="3"><?php _e( 'All posts' ); ?></a>
|
120 |
<p style="font-size:smaller;font-style:bold;margin:0">Give <?php print $object; ?> these categories</p>
|
121 |
</li>
|
122 |
</ul>
|
123 |
|
124 |
+
<?php /* ui-tabs-panel in WP 2.7 CSS = tabs-panel in WP 2.8 CSS. Thank you, o brilliant wordsmiths of the WordPress 2.8 stylesheet... */ ?>
|
125 |
+
<div id="categories-all" class="ui-tabs-panel tabs-panel">
|
126 |
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
|
127 |
<?php fwp_category_checklist(NULL, false, $checked) ?>
|
128 |
</ul>
|
feedfinder.class.php
ADDED
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
################################################################################
|
3 |
+
## class FeedFinder: find likely feeds using autodetection and/or guesswork ####
|
4 |
+
################################################################################
|
5 |
+
|
6 |
+
class FeedFinder {
|
7 |
+
var $uri = NULL;
|
8 |
+
var $_cache_uri = NULL;
|
9 |
+
|
10 |
+
var $verify = FALSE;
|
11 |
+
|
12 |
+
var $_response = NULL;
|
13 |
+
var $_data = NULL;
|
14 |
+
var $_error = NULL;
|
15 |
+
var $_head = NULL;
|
16 |
+
|
17 |
+
# -- Recognition patterns
|
18 |
+
var $_feed_types = array(
|
19 |
+
'application/rss+xml',
|
20 |
+
'text/xml',
|
21 |
+
'application/atom+xml',
|
22 |
+
'application/x.atom+xml',
|
23 |
+
'application/x-atom+xml'
|
24 |
+
);
|
25 |
+
var $_feed_markers = array('\\<feed', '\\<rss', 'xmlns="http://purl.org/rss/1.0');
|
26 |
+
var $_html_markers = array('\\<html');
|
27 |
+
var $_obvious_feed_url = array('[./]rss', '[./]rdf', '[./]atom', '[./]feed', '\.xml');
|
28 |
+
var $_maybe_feed_url = array ('rss', 'rdf', 'atom', 'feed', 'xml');
|
29 |
+
|
30 |
+
function FeedFinder ($uri = NULL, $verify = TRUE) {
|
31 |
+
$this->uri = $uri; $this->verify = $verify;
|
32 |
+
} /* FeedFinder::FeedFinder () */
|
33 |
+
|
34 |
+
function find ($uri = NULL) {
|
35 |
+
$ret = array ();
|
36 |
+
if (!is_null($this->data($uri))) {
|
37 |
+
if ($this->is_feed($uri)) {
|
38 |
+
$ret = array($this->uri);
|
39 |
+
} else {
|
40 |
+
// Assume that we have HTML or XHTML (even if we don't, who's it gonna hurt?)
|
41 |
+
// Autodiscovery is the preferred method
|
42 |
+
$href = $this->_link_rel_feeds();
|
43 |
+
|
44 |
+
// ... but we'll also take the little orange buttons
|
45 |
+
$href = array_merge($href, $this->_a_href_feeds(TRUE));
|
46 |
+
|
47 |
+
// If all that failed, look harder
|
48 |
+
if (count($href) == 0) $href = $this->_a_href_feeds(FALSE);
|
49 |
+
|
50 |
+
// Our search may turn up duplicate URIs. We only need to do any given URI once.
|
51 |
+
// Props to Camilo <http://projects.radgeek.com/2008/12/14/feedwordpress-20081214/#comment-20090122160414>
|
52 |
+
$href = array_unique($href);
|
53 |
+
|
54 |
+
// Verify feeds and resolve relative URIs
|
55 |
+
foreach ($href as $u) {
|
56 |
+
$the_uri = Relative_URI::resolve($u, $this->uri);
|
57 |
+
if ($this->verify) {
|
58 |
+
$feed =& new FeedFinder($the_uri);
|
59 |
+
if ($feed->is_feed()) $ret[] = $the_uri;
|
60 |
+
$feed = NULL;
|
61 |
+
} else {
|
62 |
+
$ret[] = $the_uri;
|
63 |
+
}
|
64 |
+
} /* foreach */
|
65 |
+
} /* if */
|
66 |
+
} /* if */
|
67 |
+
return array_unique($ret);
|
68 |
+
} /* FeedFinder::find () */
|
69 |
+
|
70 |
+
function data ($uri = NULL) {
|
71 |
+
$this->_get($uri);
|
72 |
+
return $this->_data;
|
73 |
+
}
|
74 |
+
|
75 |
+
function status ($uri = NULL) {
|
76 |
+
$this->_get($uri);
|
77 |
+
|
78 |
+
if (isset($this->_response->status)) :
|
79 |
+
$ret = $this->_response->status;
|
80 |
+
else :
|
81 |
+
$ret = NULL;
|
82 |
+
endif;
|
83 |
+
return $ret;
|
84 |
+
}
|
85 |
+
|
86 |
+
function error () {
|
87 |
+
return $this->_error;
|
88 |
+
}
|
89 |
+
|
90 |
+
function is_feed ($uri = NULL) {
|
91 |
+
$data = $this->data($uri);
|
92 |
+
|
93 |
+
return (
|
94 |
+
preg_match (
|
95 |
+
"\007(".implode('|',$this->_feed_markers).")\007i",
|
96 |
+
$data
|
97 |
+
) and !preg_match (
|
98 |
+
"\007(".implode('|',$this->_html_markers).")\007i",
|
99 |
+
$data
|
100 |
+
)
|
101 |
+
);
|
102 |
+
} /* FeedFinder::is_feed () */
|
103 |
+
|
104 |
+
# --- Private methods ---
|
105 |
+
function _get ($uri = NULL) {
|
106 |
+
if ($uri) $this->uri = $uri;
|
107 |
+
|
108 |
+
// Is the result not yet cached?
|
109 |
+
if ($this->_cache_uri !== $this->uri) :
|
110 |
+
$headers['Connection'] = 'close';
|
111 |
+
$headers['Accept'] = 'application/atom+xml application/rdf+xml application/rss+xml application/xml text/html */*';
|
112 |
+
$headers['User-Agent'] = 'feedfinder/1.2 (compatible; PHP FeedFinder) +http://projects.radgeek.com/feedwordpress';
|
113 |
+
|
114 |
+
// Use function provided by MagpieRSS package
|
115 |
+
$client = _fetch_remote_file($this->uri, $headers);
|
116 |
+
if (isset($client->error)) :
|
117 |
+
$this->_error = $client->error;
|
118 |
+
else :
|
119 |
+
$this->_error = NULL;
|
120 |
+
endif;
|
121 |
+
$this->_response = $client;
|
122 |
+
$this->_data = $client->results;
|
123 |
+
|
124 |
+
// Kilroy was here
|
125 |
+
$this->_cache_uri = $this->uri;
|
126 |
+
endif;
|
127 |
+
} /* FeedFinder::_get () */
|
128 |
+
|
129 |
+
function _link_rel_feeds () {
|
130 |
+
$links = $this->_tags('link');
|
131 |
+
$link_count = count($links);
|
132 |
+
|
133 |
+
// now figure out which one points to the RSS file
|
134 |
+
$href = array ();
|
135 |
+
for ($n=0; $n<$link_count; $n++) {
|
136 |
+
if (strtolower($links[$n]['rel']) == 'alternate') {
|
137 |
+
if (in_array(strtolower($links[$n]['type']), $this->_feed_types)) {
|
138 |
+
$href[] = $links[$n]['href'];
|
139 |
+
} /* if */
|
140 |
+
} /* if */
|
141 |
+
} /* for */
|
142 |
+
return $href;
|
143 |
+
}
|
144 |
+
|
145 |
+
function _a_href_feeds ($obvious = TRUE) {
|
146 |
+
$pattern = ($obvious ? $this->_obvious_feed_url : $this->_maybe_feed_url);
|
147 |
+
|
148 |
+
$links = $this->_tags('a');
|
149 |
+
$link_count = count($links);
|
150 |
+
|
151 |
+
// now figure out which one points to the RSS file
|
152 |
+
$href = array ();
|
153 |
+
for ($n=0; $n<$link_count; $n++) {
|
154 |
+
if (preg_match("\007(".implode('|',$pattern).")\007i", $links[$n]['href'])) {
|
155 |
+
$href[] = $links[$n]['href'];
|
156 |
+
} /* if */
|
157 |
+
} /* for */
|
158 |
+
return $href;
|
159 |
+
}
|
160 |
+
|
161 |
+
function _tags ($tag) {
|
162 |
+
$html = $this->data();
|
163 |
+
|
164 |
+
// search through the HTML, save all <link> tags
|
165 |
+
// and store each link's attributes in an associative array
|
166 |
+
preg_match_all('/<'.$tag.'\s+(.*?)\s*\/?>/si', $html, $matches);
|
167 |
+
$links = $matches[1];
|
168 |
+
$ret = array();
|
169 |
+
$link_count = count($links);
|
170 |
+
for ($n=0; $n<$link_count; $n++) {
|
171 |
+
$attributes = preg_split('/\s+/s', $links[$n]);
|
172 |
+
foreach($attributes as $attribute) {
|
173 |
+
$att = preg_split('/\s*=\s*/s', $attribute, 2);
|
174 |
+
if (isset($att[1])) {
|
175 |
+
$att[1] = preg_replace('/([\'"]?)(.*)\1/', '$2', $att[1]);
|
176 |
+
$final_link[strtolower($att[0])] = $att[1];
|
177 |
+
} /* if */
|
178 |
+
} /* foreach */
|
179 |
+
$ret[$n] = $final_link;
|
180 |
+
} /* for */
|
181 |
+
return $ret;
|
182 |
+
}
|
183 |
+
} /* class FeedFinder */
|
184 |
+
|
feedwordpress.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: FeedWordPress
|
4 |
Plugin URI: http://projects.radgeek.com/feedwordpress
|
5 |
Description: simple and flexible Atom/RSS syndication for WordPress
|
6 |
-
Version: 2009.
|
7 |
Author: Charles Johnson
|
8 |
Author URI: http://radgeek.com/
|
9 |
License: GPL
|
@@ -213,8 +213,8 @@ function feedwordpress_check_for_magpie_fix () {
|
|
213 |
|
214 |
$back_to = $_SERVER['REQUEST_URI'];
|
215 |
if (isset($_POST['ignore'])) :
|
216 |
-
// kill error message by telling it
|
217 |
-
update_option('
|
218 |
$ret = 'ignored';
|
219 |
elseif (isset($_POST['upgrade'])) :
|
220 |
$source = dirname(__FILE__)."/MagpieRSS-upgrade/rss.php";
|
@@ -507,7 +507,7 @@ for a production server.</p>
|
|
507 |
endif;
|
508 |
} /* function fwp_check_debug () */
|
509 |
|
510 |
-
define('
|
511 |
function fwp_check_magpie () {
|
512 |
if (isset($_REQUEST['feedwordpress_magpie_fix'])) :
|
513 |
if ($_REQUEST['feedwordpress_magpie_fix']=='ignored') :
|
@@ -553,17 +553,9 @@ automatic upgrade again.</p>
|
|
553 |
endif;
|
554 |
else :
|
555 |
$magpie_version = FeedWordPress::magpie_version();
|
556 |
-
|
557 |
-
$exp = get_option('feedwordpress_expected_magpie');
|
558 |
-
if ($exp) : $expected = array($exp, DEFAULT_EXPECTED_MAGPIE_VERSION);
|
559 |
-
else : $expected = array(DEFAULT_EXPECTED_MAGPIE_VERSION);
|
560 |
-
endif;
|
561 |
|
562 |
-
|
563 |
-
|
564 |
-
update_option('feedwordpress_expected_magpie', $magpie_version);
|
565 |
-
endif;
|
566 |
-
else :
|
567 |
if (current_user_can('edit_files')) :
|
568 |
$youAre = 'you are';
|
569 |
$itIsRecommendedThatYou = 'It is <strong>strongly recommended</strong> that you';
|
@@ -574,7 +566,11 @@ automatic upgrade again.</p>
|
|
574 |
print '<div class="error">';
|
575 |
?>
|
576 |
<p style="font-style: italic"><strong>FeedWordPress has detected that <?php print $youAre; ?> currently using a version of
|
577 |
-
MagpieRSS other than the upgraded version that ships with FeedWordPress.</strong></p>
|
|
|
|
|
|
|
|
|
578 |
<p><?php print $itIsRecommendedThatYou; ?> install the upgraded
|
579 |
version of MagpieRSS supplied with FeedWordPress. The version of
|
580 |
MagpieRSS that ships with WordPress is very old and buggy, and
|
@@ -2360,176 +2356,6 @@ function feedwordpress_pong ($args) {
|
|
2360 |
endif;
|
2361 |
}
|
2362 |
|
2363 |
-
################################################################################
|
2364 |
-
## class FeedFinder: find likely feeds using autodetection and/or guesswork ####
|
2365 |
-
################################################################################
|
2366 |
-
|
2367 |
-
class FeedFinder {
|
2368 |
-
var $uri = NULL;
|
2369 |
-
var $_cache_uri = NULL;
|
2370 |
-
|
2371 |
-
var $verify = FALSE;
|
2372 |
-
|
2373 |
-
var $_data = NULL;
|
2374 |
-
var $_error = NULL;
|
2375 |
-
var $_head = NULL;
|
2376 |
-
|
2377 |
-
# -- Recognition patterns
|
2378 |
-
var $_feed_types = array(
|
2379 |
-
'application/rss+xml',
|
2380 |
-
'text/xml',
|
2381 |
-
'application/atom+xml',
|
2382 |
-
'application/x.atom+xml',
|
2383 |
-
'application/x-atom+xml'
|
2384 |
-
);
|
2385 |
-
var $_feed_markers = array('\\<feed', '\\<rss', 'xmlns="http://purl.org/rss/1.0');
|
2386 |
-
var $_html_markers = array('\\<html');
|
2387 |
-
var $_obvious_feed_url = array('[./]rss', '[./]rdf', '[./]atom', '[./]feed', '\.xml');
|
2388 |
-
var $_maybe_feed_url = array ('rss', 'rdf', 'atom', 'feed', 'xml');
|
2389 |
-
|
2390 |
-
function FeedFinder ($uri = NULL, $verify = TRUE) {
|
2391 |
-
$this->uri = $uri; $this->verify = $verify;
|
2392 |
-
} /* FeedFinder::FeedFinder () */
|
2393 |
-
|
2394 |
-
function find ($uri = NULL) {
|
2395 |
-
$ret = array ();
|
2396 |
-
if (!is_null($this->data($uri))) {
|
2397 |
-
if ($this->is_feed($uri)) {
|
2398 |
-
$ret = array($this->uri);
|
2399 |
-
} else {
|
2400 |
-
// Assume that we have HTML or XHTML (even if we don't, who's it gonna hurt?)
|
2401 |
-
// Autodiscovery is the preferred method
|
2402 |
-
$href = $this->_link_rel_feeds();
|
2403 |
-
|
2404 |
-
// ... but we'll also take the little orange buttons
|
2405 |
-
$href = array_merge($href, $this->_a_href_feeds(TRUE));
|
2406 |
-
|
2407 |
-
// If all that failed, look harder
|
2408 |
-
if (count($href) == 0) $href = $this->_a_href_feeds(FALSE);
|
2409 |
-
|
2410 |
-
// Our search may turn up duplicate URIs. We only need to do any given URI once.
|
2411 |
-
// Props to Camilo <http://projects.radgeek.com/2008/12/14/feedwordpress-20081214/#comment-20090122160414>
|
2412 |
-
$href = array_unique($href);
|
2413 |
-
|
2414 |
-
// Verify feeds and resolve relative URIs
|
2415 |
-
foreach ($href as $u) {
|
2416 |
-
$the_uri = Relative_URI::resolve($u, $this->uri);
|
2417 |
-
if ($this->verify) {
|
2418 |
-
$feed =& new FeedFinder($the_uri);
|
2419 |
-
if ($feed->is_feed()) $ret[] = $the_uri;
|
2420 |
-
$feed = NULL;
|
2421 |
-
} else {
|
2422 |
-
$ret[] = $the_uri;
|
2423 |
-
}
|
2424 |
-
} /* foreach */
|
2425 |
-
} /* if */
|
2426 |
-
} /* if */
|
2427 |
-
return array_unique($ret);
|
2428 |
-
} /* FeedFinder::find () */
|
2429 |
-
|
2430 |
-
function data ($uri = NULL) {
|
2431 |
-
$this->_get($uri);
|
2432 |
-
return $this->_data;
|
2433 |
-
}
|
2434 |
-
|
2435 |
-
function error () {
|
2436 |
-
return $this->_error;
|
2437 |
-
}
|
2438 |
-
|
2439 |
-
function is_feed ($uri = NULL) {
|
2440 |
-
$data = $this->data($uri);
|
2441 |
-
|
2442 |
-
return (
|
2443 |
-
preg_match (
|
2444 |
-
"\007(".implode('|',$this->_feed_markers).")\007i",
|
2445 |
-
$data
|
2446 |
-
) and !preg_match (
|
2447 |
-
"\007(".implode('|',$this->_html_markers).")\007i",
|
2448 |
-
$data
|
2449 |
-
)
|
2450 |
-
);
|
2451 |
-
} /* FeedFinder::is_feed () */
|
2452 |
-
|
2453 |
-
# --- Private methods ---
|
2454 |
-
function _get ($uri = NULL) {
|
2455 |
-
if ($uri) $this->uri = $uri;
|
2456 |
-
|
2457 |
-
// Is the result not yet cached?
|
2458 |
-
if ($this->_cache_uri !== $this->uri) :
|
2459 |
-
$headers['Connection'] = 'close';
|
2460 |
-
$headers['Accept'] = 'application/atom+xml application/rdf+xml application/rss+xml application/xml text/html */*';
|
2461 |
-
$headers['User-Agent'] = 'feedfinder/1.2 (compatible; PHP FeedFinder) +http://projects.radgeek.com/feedwordpress';
|
2462 |
-
|
2463 |
-
// Use function provided by MagpieRSS package
|
2464 |
-
$client = _fetch_remote_file($this->uri, $headers);
|
2465 |
-
if (isset($client->error)) :
|
2466 |
-
$this->_error = $client->error;
|
2467 |
-
else :
|
2468 |
-
$this->_error = NULL;
|
2469 |
-
endif;
|
2470 |
-
$this->_data = $client->results;
|
2471 |
-
|
2472 |
-
// Kilroy was here
|
2473 |
-
$this->_cache_uri = $this->uri;
|
2474 |
-
endif;
|
2475 |
-
} /* FeedFinder::_get () */
|
2476 |
-
|
2477 |
-
function _link_rel_feeds () {
|
2478 |
-
$links = $this->_tags('link');
|
2479 |
-
$link_count = count($links);
|
2480 |
-
|
2481 |
-
// now figure out which one points to the RSS file
|
2482 |
-
$href = array ();
|
2483 |
-
for ($n=0; $n<$link_count; $n++) {
|
2484 |
-
if (strtolower($links[$n]['rel']) == 'alternate') {
|
2485 |
-
if (in_array(strtolower($links[$n]['type']), $this->_feed_types)) {
|
2486 |
-
$href[] = $links[$n]['href'];
|
2487 |
-
} /* if */
|
2488 |
-
} /* if */
|
2489 |
-
} /* for */
|
2490 |
-
return $href;
|
2491 |
-
}
|
2492 |
-
|
2493 |
-
function _a_href_feeds ($obvious = TRUE) {
|
2494 |
-
$pattern = ($obvious ? $this->_obvious_feed_url : $this->_maybe_feed_url);
|
2495 |
-
|
2496 |
-
$links = $this->_tags('a');
|
2497 |
-
$link_count = count($links);
|
2498 |
-
|
2499 |
-
// now figure out which one points to the RSS file
|
2500 |
-
$href = array ();
|
2501 |
-
for ($n=0; $n<$link_count; $n++) {
|
2502 |
-
if (preg_match("\007(".implode('|',$pattern).")\007i", $links[$n]['href'])) {
|
2503 |
-
$href[] = $links[$n]['href'];
|
2504 |
-
} /* if */
|
2505 |
-
} /* for */
|
2506 |
-
return $href;
|
2507 |
-
}
|
2508 |
-
|
2509 |
-
function _tags ($tag) {
|
2510 |
-
$html = $this->data();
|
2511 |
-
|
2512 |
-
// search through the HTML, save all <link> tags
|
2513 |
-
// and store each link's attributes in an associative array
|
2514 |
-
preg_match_all('/<'.$tag.'\s+(.*?)\s*\/?>/si', $html, $matches);
|
2515 |
-
$links = $matches[1];
|
2516 |
-
$ret = array();
|
2517 |
-
$link_count = count($links);
|
2518 |
-
for ($n=0; $n<$link_count; $n++) {
|
2519 |
-
$attributes = preg_split('/\s+/s', $links[$n]);
|
2520 |
-
foreach($attributes as $attribute) {
|
2521 |
-
$att = preg_split('/\s*=\s*/s', $attribute, 2);
|
2522 |
-
if (isset($att[1])) {
|
2523 |
-
$att[1] = preg_replace('/([\'"]?)(.*)\1/', '$2', $att[1]);
|
2524 |
-
$final_link[strtolower($att[0])] = $att[1];
|
2525 |
-
} /* if */
|
2526 |
-
} /* foreach */
|
2527 |
-
$ret[$n] = $final_link;
|
2528 |
-
} /* for */
|
2529 |
-
return $ret;
|
2530 |
-
}
|
2531 |
-
} /* class FeedFinder */
|
2532 |
-
|
2533 |
# Relative URI static class: PHP class for resolving relative URLs
|
2534 |
#
|
2535 |
# This class is derived (under the terms of the GPL) from URL Class 0.3 by
|
3 |
Plugin Name: FeedWordPress
|
4 |
Plugin URI: http://projects.radgeek.com/feedwordpress
|
5 |
Description: simple and flexible Atom/RSS syndication for WordPress
|
6 |
+
Version: 2009.0613
|
7 |
Author: Charles Johnson
|
8 |
Author URI: http://radgeek.com/
|
9 |
License: GPL
|
213 |
|
214 |
$back_to = $_SERVER['REQUEST_URI'];
|
215 |
if (isset($_POST['ignore'])) :
|
216 |
+
// kill error message by telling it we ignored the upgrade request for this version
|
217 |
+
update_option('feedwordpress_magpie_ignored_upgrade_to', EXPECTED_MAGPIE_VERSION);
|
218 |
$ret = 'ignored';
|
219 |
elseif (isset($_POST['upgrade'])) :
|
220 |
$source = dirname(__FILE__)."/MagpieRSS-upgrade/rss.php";
|
507 |
endif;
|
508 |
} /* function fwp_check_debug () */
|
509 |
|
510 |
+
define('EXPECTED_MAGPIE_VERSION', '2009.0613');
|
511 |
function fwp_check_magpie () {
|
512 |
if (isset($_REQUEST['feedwordpress_magpie_fix'])) :
|
513 |
if ($_REQUEST['feedwordpress_magpie_fix']=='ignored') :
|
553 |
endif;
|
554 |
else :
|
555 |
$magpie_version = FeedWordPress::magpie_version();
|
|
|
|
|
|
|
|
|
|
|
556 |
|
557 |
+
$ignored = get_option('feedwordpress_magpie_ignored_upgrade_to');
|
558 |
+
if (EXPECTED_MAGPIE_VERSION != $magpie_version and EXPECTED_MAGPIE_VERSION != $ignored) :
|
|
|
|
|
|
|
559 |
if (current_user_can('edit_files')) :
|
560 |
$youAre = 'you are';
|
561 |
$itIsRecommendedThatYou = 'It is <strong>strongly recommended</strong> that you';
|
566 |
print '<div class="error">';
|
567 |
?>
|
568 |
<p style="font-style: italic"><strong>FeedWordPress has detected that <?php print $youAre; ?> currently using a version of
|
569 |
+
MagpieRSS other than the upgraded version that ships with this version of FeedWordPress.</strong></p>
|
570 |
+
<ul>
|
571 |
+
<li><strong>Currently running:</strong> MagpieRSS <?php print $magpie_version; ?></li>
|
572 |
+
<li><strong>Version included with FeedWordPress <?php print FEEDWORDPRESS_VERSION; ?>:</strong> MagpieRSS <?php print EXPECTED_MAGPIE_VERSION; ?></li>
|
573 |
+
</ul>
|
574 |
<p><?php print $itIsRecommendedThatYou; ?> install the upgraded
|
575 |
version of MagpieRSS supplied with FeedWordPress. The version of
|
576 |
MagpieRSS that ships with WordPress is very old and buggy, and
|
2356 |
endif;
|
2357 |
}
|
2358 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2359 |
# Relative URI static class: PHP class for resolving relative URLs
|
2360 |
#
|
2361 |
# This class is derived (under the terms of the GPL) from URL Class 0.3 by
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://projects.radgeek.com/feedwordpress/
|
|
4 |
Tags: syndication, aggregation, feed, atom, rss
|
5 |
Requires at least: 1.5
|
6 |
Tested up to: 2.8
|
7 |
-
Stable tag: 2009.
|
8 |
|
9 |
FeedWordPress syndicates content from feeds you choose into your WordPress weblog.
|
10 |
|
4 |
Tags: syndication, aggregation, feed, atom, rss
|
5 |
Requires at least: 1.5
|
6 |
Tested up to: 2.8
|
7 |
+
Stable tag: 2009.0613
|
8 |
|
9 |
FeedWordPress syndicates content from feeds you choose into your WordPress weblog.
|
10 |
|
syndication.php
CHANGED
@@ -1,6 +1,48 @@
|
|
1 |
<?php
|
2 |
require_once(dirname(__FILE__) . '/admin-ui.php');
|
3 |
require_once(dirname(__FILE__) . '/magpiemocklink.class.php');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
################################################################################
|
6 |
## ADMIN MENU ADD-ONS: implement Dashboard management pages ####################
|
@@ -387,6 +429,7 @@ jQuery(document).ready( function () {
|
|
387 |
|
388 |
function fwp_feedfinder_page () {
|
389 |
global $wpdb;
|
|
|
390 |
|
391 |
$lookup = (isset($_REQUEST['lookup'])?$_REQUEST['lookup']:NULL);
|
392 |
|
@@ -486,11 +529,26 @@ function fwp_feedfinder_page () {
|
|
486 |
<?php
|
487 |
endforeach;
|
488 |
else:
|
489 |
-
print "<p><strong>".__('Error').":</strong> ".__("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
490 |
if (!is_null($f->error())) :
|
491 |
-
print "
|
|
|
|
|
|
|
|
|
492 |
endif;
|
493 |
-
print "
|
|
|
|
|
|
|
|
|
494 |
endif;
|
495 |
?>
|
496 |
</div>
|
1 |
<?php
|
2 |
require_once(dirname(__FILE__) . '/admin-ui.php');
|
3 |
require_once(dirname(__FILE__) . '/magpiemocklink.class.php');
|
4 |
+
require_once(dirname(__FILE__) . '/feedfinder.class.php');
|
5 |
+
|
6 |
+
$FeedWordPressHTTPStatusMessages = array (
|
7 |
+
200 => 'OK. FeedWordPress had no problems retrieving the content at this URL but the content does not seem to be a feed, and does not seem to include links to any feeds.',
|
8 |
+
201 => 'Created',
|
9 |
+
202 => 'Accepted',
|
10 |
+
203 => 'Non-Authoritative information',
|
11 |
+
204 => 'No Content',
|
12 |
+
205 => 'Reset Content',
|
13 |
+
206 => 'Partial Content',
|
14 |
+
300 => 'Multiple Choices',
|
15 |
+
301 => 'Moved Permanently',
|
16 |
+
302 => 'Found',
|
17 |
+
303 => 'See Other',
|
18 |
+
304 => 'Not Modified',
|
19 |
+
305 => 'Use Proxy',
|
20 |
+
307 => 'Temporary Redirect',
|
21 |
+
400 => 'Bad Request',
|
22 |
+
401 => 'Unauthorized. This URL probably needs a username and password for you to access it.',
|
23 |
+
402 => 'Payment Required',
|
24 |
+
403 => 'Forbidden. The URL is not made available for the machine that FeedWordPress is running on.',
|
25 |
+
404 => 'Not Found. There is nothing at this URL. Have you checked the address for typos?',
|
26 |
+
405 => 'Method Not Allowed',
|
27 |
+
406 => 'Not Acceptable',
|
28 |
+
407 => 'Proxy Authentication Required',
|
29 |
+
408 => 'Request Timeout',
|
30 |
+
409 => 'Conflict',
|
31 |
+
410 => 'Gone. This URL is no longer available on this server and no forwarding address is known.',
|
32 |
+
411 => 'Length Required',
|
33 |
+
412 => 'Precondition Failed',
|
34 |
+
413 => 'Request Entity Too Large',
|
35 |
+
414 => 'Request URI Too Long',
|
36 |
+
415 => 'Unsupported Media Type',
|
37 |
+
416 => 'Requested Range Not Satisfiable',
|
38 |
+
417 => 'Expectation Failed',
|
39 |
+
500 => 'Internal Server Error. Something unexpected went wrong with the configuration of the server that hosts this URL. You might try again later to see if this issue has been resolved.',
|
40 |
+
501 => 'Not Implemented',
|
41 |
+
502 => 'Bad Gateway',
|
42 |
+
503 => 'Service Unavailable. The server is currently unable to handle the request due to a temporary overloading or maintenance of the server that hosts this URL. This is probably a temporary condition and you should try again later to see if the issue has been resolved.',
|
43 |
+
504 => 'Gateway Timeout',
|
44 |
+
505 => 'HTTP Version Not Supported',
|
45 |
+
);
|
46 |
|
47 |
################################################################################
|
48 |
## ADMIN MENU ADD-ONS: implement Dashboard management pages ####################
|
429 |
|
430 |
function fwp_feedfinder_page () {
|
431 |
global $wpdb;
|
432 |
+
global $FeedWordPressHTTPStatusMessages;
|
433 |
|
434 |
$lookup = (isset($_REQUEST['lookup'])?$_REQUEST['lookup']:NULL);
|
435 |
|
529 |
<?php
|
530 |
endforeach;
|
531 |
else:
|
532 |
+
print "<p><strong>".__('Error').":</strong> ".__("FeedWordPress couldn't find any feeds at").' <code><a href="'.htmlspecialchars($lookup).'">'.htmlspecialchars($lookup).'</a></code>';
|
533 |
+
print ". ".__('Try another URL').".</p>";
|
534 |
+
|
535 |
+
// Diagnostics
|
536 |
+
$httpObject = _wp_http_get_object();
|
537 |
+
$transports = $httpObject->_getTransport();
|
538 |
+
print "<div class=\"updated\" style=\"margin-left: 3.0em; margin-right: 3.0em;\">\n";
|
539 |
+
print "<h3>".__('Diagnostic information')."</h3>\n";
|
540 |
if (!is_null($f->error())) :
|
541 |
+
print "<h4>".__('HTTP request failure')."</h4>\n";
|
542 |
+
print "<p>".$f->error()."</p>\n";
|
543 |
+
else :
|
544 |
+
print "<h4>".__('HTTP request completed')."</h4>\n";
|
545 |
+
print "<p><strong>Status ".$f->status().":</strong> ".$FeedWordPressHTTPStatusMessages[$f->status()]."</p>\n";
|
546 |
endif;
|
547 |
+
print "<h4>".__('HTTP Transports available').":</h4>\n";
|
548 |
+
print "<ol>\n";
|
549 |
+
print "<li>".implode("</li>\n<li>", array_map('get_class', $transports))."</li>\n";
|
550 |
+
print "</ol>\n";
|
551 |
+
print "</div>\n";
|
552 |
endif;
|
553 |
?>
|
554 |
</div>
|