Version Description
Download this release
Release Info
Developer | radgeek |
Plugin | FeedWordPress |
Version | 0.991 |
Comparing to | |
See all releases |
Code changes from version 0.99 to 0.991
- ChangeLog.text +39 -0
- {OPTIONAL/wp-includes → MagpieRSS-upgrade}/rss-functions.php +0 -0
- {OPTIONAL/wp-includes → MagpieRSS-upgrade}/rss.php +106 -96
- README.text +0 -507
- wp-content/plugins/feedwordpress/feedwordpress.php → feedwordpress.php +102 -70
- readme.txt +157 -0
- wp-content/plugins/feedwordpress/syndication-options.php → syndication-options.php +0 -0
ChangeLog.text
CHANGED
@@ -1,6 +1,45 @@
|
|
1 |
FeedWordPress Change Log
|
2 |
========================
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
Changes from 0.981 to 0.99
|
5 |
--------------------------
|
6 |
Version 0.99 adds several significant new features, fixes some bugs, and
|
1 |
FeedWordPress Change Log
|
2 |
========================
|
3 |
|
4 |
+
Changes from 0.99 to 0.991
|
5 |
+
--------------------------
|
6 |
+
* WORDPRESS MU COMPATABILITY: FeedWordPress should now be compatible with
|
7 |
+
recent releases of WordPress MU. Once FeedWordPress is made available
|
8 |
+
as a plugin, each individual blog can choose to activate FeedWordPress
|
9 |
+
and syndicate content from its own set of contributors.
|
10 |
+
|
11 |
+
* DISPLAY OF MAGPIE WARNINGS: A number of MagpieRSS warnings or error
|
12 |
+
messages that were displayed when performing an automatic update are
|
13 |
+
no longer displayed, unless debugging parameters have been explicitly
|
14 |
+
enabled.
|
15 |
+
|
16 |
+
* BUG RELATED TO INTERNATIONAL CHARACTERS IN AUTHOR NAMES FIXED: Due to a
|
17 |
+
subtle incompatability between the way that FeedWordPress generated new
|
18 |
+
user information, and the way that WordPress 2.0 and later added new
|
19 |
+
authors to the database, FeedWordPress might end up creating duplicate
|
20 |
+
authors, or throwing a critical error message, when it encountered
|
21 |
+
authors whose names included international characters. This
|
22 |
+
incompatability has now been fixed; hopefully, authors with
|
23 |
+
international characters in their names should now be handled properly.
|
24 |
+
|
25 |
+
* media:content BUG IN MAGPIERSS FIXED: A bug in MagpieRSS's handling of
|
26 |
+
namespaced elements has been fixed. Among other things, this bug caused
|
27 |
+
items containing a Yahoo MediaRSS `<media:content>` element (such as
|
28 |
+
many of the feeds produced by wordpress.com) to be represented
|
29 |
+
incorrectly, with only a capital "A" where the content of the post
|
30 |
+
should have been. Feeds containing `<media:content>` elements should now
|
31 |
+
be syndicated correctly.
|
32 |
+
|
33 |
+
* update_feedwordpress PARAMETER: You can now use an HTTP GET parameter
|
34 |
+
(`update_feedwordpress=1`) to request that FeedWordPress poll its feeds
|
35 |
+
for updates. When used together with a crontab or other means of
|
36 |
+
scheduling tasks, this means that you can keep your blog automatically
|
37 |
+
updated on a regular schedule, even if you do not choose to use the
|
38 |
+
cron-less automatic updates option.
|
39 |
+
|
40 |
+
* Some minor interface-related bugs were also fixed.
|
41 |
+
|
42 |
+
|
43 |
Changes from 0.981 to 0.99
|
44 |
--------------------------
|
45 |
Version 0.99 adds several significant new features, fixes some bugs, and
|
{OPTIONAL/wp-includes → MagpieRSS-upgrade}/rss-functions.php
RENAMED
File without changes
|
{OPTIONAL/wp-includes → MagpieRSS-upgrade}/rss.php
RENAMED
@@ -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: 0.85wp (2007.
|
8 |
* License: GPL
|
9 |
*
|
10 |
* Provenance:
|
@@ -144,7 +144,8 @@ class MagpieRSS {
|
|
144 |
'http://purl.org/rss/1.0/modules/annotate/' => 'annotate',
|
145 |
'http://xmlns.com/foaf/0.1/' => 'foaf',
|
146 |
'http://madskills.com/public/xml/rss/module/trackback/' => 'trackback',
|
147 |
-
'http://web.resource.org/cc/' => 'cc'
|
|
|
148 |
);
|
149 |
|
150 |
var $_XMLBASE_RESOLVE = array (
|
@@ -197,7 +198,7 @@ class MagpieRSS {
|
|
197 |
var $_KNOWN_ENCODINGS = array('UTF-8', 'US-ASCII', 'ISO-8859-1');
|
198 |
|
199 |
// parser variables, useless if you're not a parser, treat as private
|
200 |
-
var $stack = array('element' => array (), 'xmlns' => array (), 'xml:base' => array ()); // stack of XML data
|
201 |
|
202 |
var $inchannel = false;
|
203 |
var $initem = false;
|
@@ -324,6 +325,7 @@ class MagpieRSS {
|
|
324 |
if ( empty($this->incontent) ) {
|
325 |
$el = strtolower($ns['element']);
|
326 |
$this->current_namespace = $ns['effective'];
|
|
|
327 |
}
|
328 |
|
329 |
$nsc = $ns['canonical']; $nse = $ns['element'];
|
@@ -358,7 +360,6 @@ class MagpieRSS {
|
|
358 |
$this->feed_type = ATOM;
|
359 |
$this->root_namespaces = array('atom');
|
360 |
if ($ns['uri'] == 'http://www.w3.org/2005/Atom') { // Atom 1.0
|
361 |
-
$this->root_namespaces = array('atom');
|
362 |
$this->feed_version = '1.0';
|
363 |
}
|
364 |
else { // Atom 0.3, probably.
|
@@ -435,14 +436,14 @@ class MagpieRSS {
|
|
435 |
// as being equivalent to RSS's simple link element.
|
436 |
|
437 |
$atom_link = false;
|
438 |
-
if ($
|
439 |
$atom_link = true;
|
440 |
if (isset($attrs['rel']) and $attrs['rel'] != 'alternate') {
|
441 |
$el = $el . "_" . $attrs['rel']; // pseudo-element names for Atom link elements
|
442 |
}
|
443 |
}
|
444 |
# handle atom content constructs
|
445 |
-
elseif ( $
|
446 |
{
|
447 |
// avoid clashing w/ RSS mod_content
|
448 |
if ($el == 'content' ) {
|
@@ -569,9 +570,9 @@ class MagpieRSS {
|
|
569 |
}
|
570 |
array_shift( $this->stack['element'] );
|
571 |
}
|
572 |
-
|
573 |
if ( !$this->incontent ) { // Don't munge the namespace after finishing with elements in namespaced content constructs -CWJ
|
574 |
-
$this->current_namespace =
|
575 |
}
|
576 |
array_pop($this->stack['xmlns']);
|
577 |
array_pop($this->stack['xml:base']);
|
@@ -684,8 +685,8 @@ class MagpieRSS {
|
|
684 |
function append_content($text) {
|
685 |
$construct = reset($this->incontent);
|
686 |
$ns = $construct['effective'];
|
687 |
-
|
688 |
-
|
689 |
// properly handle atom:source and its children elements
|
690 |
$tag = join('_', array_reverse($this->stack['element']));
|
691 |
|
@@ -832,101 +833,101 @@ class MagpieRSS {
|
|
832 |
function normalize () {
|
833 |
// if atom populate rss fields and normalize 0.3 and 1.0 feeds
|
834 |
if ( $this->is_atom() ) {
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
|
848 |
-
|
849 |
-
|
850 |
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
|
857 |
-
|
858 |
-
|
859 |
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
|
|
|
|
|
|
898 |
}
|
899 |
-
}
|
900 |
}
|
901 |
-
}
|
902 |
-
}
|
903 |
-
|
904 |
-
// Atom elements to RSS elements
|
905 |
-
$this->normalize_element($item, 'author', $item['dc'], 'creator', 'normalize_atom_person');
|
906 |
-
$this->normalize_element($item, 'contributor', $item['dc'], 'contributor', 'normalize_atom_person');
|
907 |
-
$this->normalize_element($item, 'summary', $item, 'description');
|
908 |
-
$this->normalize_element($item, 'atom_content', $item['content'], 'encoded');
|
909 |
-
$this->normalize_element($item, 'link_enclosure', $item, 'enclosure', 'normalize_enclosure');
|
910 |
-
|
911 |
-
// Categories
|
912 |
-
if ( isset($item['category#']) ) { // Atom 1.0 categories to dc:subject and RSS 2.0 categories
|
913 |
-
$this->normalize_element($item, 'category', $item['dc'], 'subject', 'normalize_category');
|
914 |
-
}
|
915 |
-
elseif ( isset($item['dc']['subject#']) ) { // dc:subject to Atom 1.0 and RSS 2.0 categories
|
916 |
-
$this->normalize_element($item['dc'], 'subject', $item, 'category', 'normalize_dc_subject');
|
917 |
-
}
|
918 |
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
930 |
}
|
931 |
elseif ( $this->is_rss() ) {
|
932 |
// RSS elements to Atom elements
|
@@ -1355,7 +1356,11 @@ function error ($errormsg, $lvl=E_USER_WARNING) {
|
|
1355 |
if ( $errormsg ) {
|
1356 |
$errormsg = "MagpieRSS: $errormsg";
|
1357 |
$MAGPIE_ERROR = $errormsg;
|
1358 |
-
|
|
|
|
|
|
|
|
|
1359 |
}
|
1360 |
}
|
1361 |
|
@@ -1638,6 +1643,11 @@ class RSSCache {
|
|
1638 |
|
1639 |
$rss = get_option( $cache_option );
|
1640 |
|
|
|
|
|
|
|
|
|
|
|
1641 |
return $rss;
|
1642 |
}
|
1643 |
|
4 |
* Author: Kellan Elliot-McCrea <kellan@protest.net>
|
5 |
* WordPress development team <http://www.wordpress.org/>
|
6 |
* Charles Johnson <technophilia@radgeek.com>
|
7 |
+
* Version: 0.85wp (2007.11.21)
|
8 |
* License: GPL
|
9 |
*
|
10 |
* Provenance:
|
144 |
'http://purl.org/rss/1.0/modules/annotate/' => 'annotate',
|
145 |
'http://xmlns.com/foaf/0.1/' => 'foaf',
|
146 |
'http://madskills.com/public/xml/rss/module/trackback/' => 'trackback',
|
147 |
+
'http://web.resource.org/cc/' => 'cc',
|
148 |
+
'http://search.yahoo.com/mrss' => 'media',
|
149 |
);
|
150 |
|
151 |
var $_XMLBASE_RESOLVE = array (
|
198 |
var $_KNOWN_ENCODINGS = array('UTF-8', 'US-ASCII', 'ISO-8859-1');
|
199 |
|
200 |
// parser variables, useless if you're not a parser, treat as private
|
201 |
+
var $stack = array('element' => array (), 'ns' => array (), 'xmlns' => array (), 'xml:base' => array ()); // stack of XML data
|
202 |
|
203 |
var $inchannel = false;
|
204 |
var $initem = false;
|
325 |
if ( empty($this->incontent) ) {
|
326 |
$el = strtolower($ns['element']);
|
327 |
$this->current_namespace = $ns['effective'];
|
328 |
+
array_push($this->stack['ns'], $ns['effective']);
|
329 |
}
|
330 |
|
331 |
$nsc = $ns['canonical']; $nse = $ns['element'];
|
360 |
$this->feed_type = ATOM;
|
361 |
$this->root_namespaces = array('atom');
|
362 |
if ($ns['uri'] == 'http://www.w3.org/2005/Atom') { // Atom 1.0
|
|
|
363 |
$this->feed_version = '1.0';
|
364 |
}
|
365 |
else { // Atom 0.3, probably.
|
436 |
// as being equivalent to RSS's simple link element.
|
437 |
|
438 |
$atom_link = false;
|
439 |
+
if ( ($ns['canonical']=='atom') and $el == 'link') {
|
440 |
$atom_link = true;
|
441 |
if (isset($attrs['rel']) and $attrs['rel'] != 'alternate') {
|
442 |
$el = $el . "_" . $attrs['rel']; // pseudo-element names for Atom link elements
|
443 |
}
|
444 |
}
|
445 |
# handle atom content constructs
|
446 |
+
elseif ( ($ns['canonical']=='atom') and in_array($el, $this->_ATOM_CONTENT_CONSTRUCTS) )
|
447 |
{
|
448 |
// avoid clashing w/ RSS mod_content
|
449 |
if ($el == 'content' ) {
|
570 |
}
|
571 |
array_shift( $this->stack['element'] );
|
572 |
}
|
573 |
+
|
574 |
if ( !$this->incontent ) { // Don't munge the namespace after finishing with elements in namespaced content constructs -CWJ
|
575 |
+
$this->current_namespace = array_pop($this->stack['ns']);
|
576 |
}
|
577 |
array_pop($this->stack['xmlns']);
|
578 |
array_pop($this->stack['xml:base']);
|
685 |
function append_content($text) {
|
686 |
$construct = reset($this->incontent);
|
687 |
$ns = $construct['effective'];
|
688 |
+
|
689 |
+
// Keeping data about parent elements is necessary to
|
690 |
// properly handle atom:source and its children elements
|
691 |
$tag = join('_', array_reverse($this->stack['element']));
|
692 |
|
833 |
function normalize () {
|
834 |
// if atom populate rss fields and normalize 0.3 and 1.0 feeds
|
835 |
if ( $this->is_atom() ) {
|
836 |
+
// Atom 1.0 elements <=> Atom 0.3 elements (Thanks, o brilliant wordsmiths of the Atom 1.0 standard!)
|
837 |
+
if ($this->feed_version < 1.0) {
|
838 |
+
$this->normalize_element($this->channel, 'tagline', $this->channel, 'subtitle');
|
839 |
+
$this->normalize_element($this->channel, 'copyright', $this->channel, 'rights');
|
840 |
+
$this->normalize_element($this->channel, 'modified', $this->channel, 'updated');
|
841 |
+
} else {
|
842 |
+
$this->normalize_element($this->channel, 'subtitle', $this->channel, 'tagline');
|
843 |
+
$this->normalize_element($this->channel, 'rights', $this->channel, 'copyright');
|
844 |
+
$this->normalize_element($this->channel, 'updated', $this->channel, 'modified');
|
845 |
+
}
|
846 |
+
$this->normalize_element($this->channel, 'author', $this->channel['dc'], 'creator', 'normalize_atom_person');
|
847 |
+
$this->normalize_element($this->channel, 'contributor', $this->channel['dc'], 'contributor', 'normalize_atom_person');
|
848 |
|
849 |
+
// Atom elements to RSS elements
|
850 |
+
$this->normalize_element($this->channel, 'subtitle', $this->channel, 'description');
|
851 |
|
852 |
+
if ( isset($this->channel['logo']) ) {
|
853 |
+
$this->normalize_element($this->channel, 'logo', $this->image, 'url');
|
854 |
+
$this->normalize_element($this->channel, 'link', $this->image, 'link');
|
855 |
+
$this->normalize_element($this->channel, 'title', $this->image, 'title');
|
856 |
+
}
|
857 |
|
858 |
+
for ( $i = 0; $i < count($this->items); $i++) {
|
859 |
+
$item = $this->items[$i];
|
860 |
|
861 |
+
// Atom 1.0 elements <=> Atom 0.3 elements
|
862 |
+
if ($this->feed_version < 1.0) {
|
863 |
+
$this->normalize_element($item, 'modified', $item, 'updated');
|
864 |
+
$this->normalize_element($item, 'issued', $item, 'published');
|
865 |
+
} else {
|
866 |
+
$this->normalize_element($item, 'updated', $item, 'modified');
|
867 |
+
$this->normalize_element($item, 'published', $item, 'issued');
|
868 |
+
}
|
869 |
|
870 |
+
// "If an atom:entry element does not contain
|
871 |
+
// atom:author elements, then the atom:author elements
|
872 |
+
// of the contained atom:source element are considered
|
873 |
+
// to apply. In an Atom Feed Document, the atom:author
|
874 |
+
// elements of the containing atom:feed element are
|
875 |
+
// considered to apply to the entry if there are no
|
876 |
+
// atom:author elements in the locations described
|
877 |
+
// above." <http://atompub.org/2005/08/17/draft-ietf-atompub-format-11.html#rfc.section.4.2.1>
|
878 |
+
if (!isset($item["author#"])) {
|
879 |
+
if (isset($item["source_author#"])) { // from aggregation source
|
880 |
+
$source = $item;
|
881 |
+
$author = "source_author";
|
882 |
+
} elseif (isset($this->channel["author#"])) { // from containing feed
|
883 |
+
$source = $this->channel;
|
884 |
+
$author = "author";
|
885 |
+
} else {
|
886 |
+
$author = null;
|
887 |
+
}
|
888 |
|
889 |
+
if (!is_null($author)) {
|
890 |
+
$item["author#"] = $source["{$author}#"];
|
891 |
+
for ($au = 1; $au <= $item["author#"]; $au++) {
|
892 |
+
$id_to = $this->element_id('author', $au);
|
893 |
+
$id_from = $this->element_id($author, $au);
|
894 |
|
895 |
+
$item[$id_to] = $source[$id_from];
|
896 |
+
foreach (array('name', 'email', 'uri', 'url') as $what) {
|
897 |
+
if (isset($source["{$id_from}_{$what}"])) {
|
898 |
+
$item["{$id_to}_{$what}"] = $source["{$id_from}_{$what}"];
|
899 |
+
}
|
900 |
+
}
|
901 |
+
}
|
902 |
}
|
|
|
903 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
904 |
|
905 |
+
// Atom elements to RSS elements
|
906 |
+
$this->normalize_element($item, 'author', $item['dc'], 'creator', 'normalize_atom_person');
|
907 |
+
$this->normalize_element($item, 'contributor', $item['dc'], 'contributor', 'normalize_atom_person');
|
908 |
+
$this->normalize_element($item, 'summary', $item, 'description');
|
909 |
+
$this->normalize_element($item, 'atom_content', $item['content'], 'encoded');
|
910 |
+
$this->normalize_element($item, 'link_enclosure', $item, 'enclosure', 'normalize_enclosure');
|
911 |
+
|
912 |
+
// Categories
|
913 |
+
if ( isset($item['category#']) ) { // Atom 1.0 categories to dc:subject and RSS 2.0 categories
|
914 |
+
$this->normalize_element($item, 'category', $item['dc'], 'subject', 'normalize_category');
|
915 |
+
}
|
916 |
+
elseif ( isset($item['dc']['subject#']) ) { // dc:subject to Atom 1.0 and RSS 2.0 categories
|
917 |
+
$this->normalize_element($item['dc'], 'subject', $item, 'category', 'normalize_dc_subject');
|
918 |
+
}
|
919 |
+
|
920 |
+
// Normalized item timestamp
|
921 |
+
$atom_date = (isset($item['published']) ) ? $item['published'] : $item['updated'];
|
922 |
+
if ( $atom_date ) {
|
923 |
+
$epoch = @parse_w3cdtf($atom_date);
|
924 |
+
if ($epoch and $epoch > 0) {
|
925 |
+
$item['date_timestamp'] = $epoch;
|
926 |
+
}
|
927 |
+
}
|
928 |
+
|
929 |
+
$this->items[$i] = $item;
|
930 |
+
}
|
931 |
}
|
932 |
elseif ( $this->is_rss() ) {
|
933 |
// RSS elements to Atom elements
|
1356 |
if ( $errormsg ) {
|
1357 |
$errormsg = "MagpieRSS: $errormsg";
|
1358 |
$MAGPIE_ERROR = $errormsg;
|
1359 |
+
if ( MAGPIE_DEBUG ) {
|
1360 |
+
trigger_error( $errormsg, $lvl);
|
1361 |
+
} else {
|
1362 |
+
error_log($errormsg, 0);
|
1363 |
+
}
|
1364 |
}
|
1365 |
}
|
1366 |
|
1643 |
|
1644 |
$rss = get_option( $cache_option );
|
1645 |
|
1646 |
+
// failsafe; seems to break at odd points in WP MU
|
1647 |
+
if (is_string($rss)) {
|
1648 |
+
$rss = $this->unserialize($rss);
|
1649 |
+
}
|
1650 |
+
|
1651 |
return $rss;
|
1652 |
}
|
1653 |
|
README.text
DELETED
@@ -1,507 +0,0 @@
|
|
1 |
-
FeedWordPress
|
2 |
-
=============
|
3 |
-
|
4 |
-
* Author: [Charles Johnson](http://radgeek.com/contact)
|
5 |
-
* Version: 0.99
|
6 |
-
* Project URI: <http://projects.radgeek.com/feedwordpress>
|
7 |
-
* License: GPL 2. See License below for copyright jots and tittles.
|
8 |
-
|
9 |
-
Introduction
|
10 |
-
------------
|
11 |
-
FeedWordPress is an Atom/RSS aggregator for the WordPress weblog software. It
|
12 |
-
syndicates content from newsfeeds that you choose into your WordPress webblog;
|
13 |
-
if you syndicate several newsfeeds then you can use WordPress's posts database
|
14 |
-
and templating engine as the back-end of an aggregation ("planet") website. I
|
15 |
-
originally developed it because I needed a more flexible replacement for
|
16 |
-
[Planet][] to use at [Feminist Blogs][].
|
17 |
-
|
18 |
-
[Planet]: http://www.planetplanet.org/ "Planet Planet"
|
19 |
-
[Feminist Blogs]: http://www.feministblogs.org/
|
20 |
-
|
21 |
-
FeedWordPress is designed with flexibility, ease of use, and ease of
|
22 |
-
configuration in mind. You'll need a working installation of WordPress (version
|
23 |
-
[2.3][], [2.2][], [2.1][], [2.0][] or [1.5][]), and also FTP or SFTP access to
|
24 |
-
your web host. The ability to create cron jobs on your web host would be very
|
25 |
-
helpful but it's not absolutely necessary. You *don't* need to tweak any
|
26 |
-
plain-text configuration files and you *don't* need shell access to your web
|
27 |
-
host to make it work. (Although, I should point out, web hosts that *don't*
|
28 |
-
offer shell access are *bad web hosts*.)
|
29 |
-
|
30 |
-
[2.3]: http://codex.wordpress.org/Version_2.3
|
31 |
-
[2.2]: http://codex.wordpress.org/Version_2.2
|
32 |
-
[2.1]: http://codex.wordpress.org/Version_2.1
|
33 |
-
[2.0]: http://codex.wordpress.org/Version_2.0
|
34 |
-
[1.5]: http://codex.wordpress.org/Version_1.5
|
35 |
-
|
36 |
-
Installation
|
37 |
-
------------
|
38 |
-
### Requirements ###
|
39 |
-
|
40 |
-
To use version 0.99 of FeedWordPress, you will need:
|
41 |
-
|
42 |
-
1. an installed and configured copy of WordPress 2.3.x, 2.2.x, 2.1.x,
|
43 |
-
2.0.x, or 1.5.x. (FeedWordPress currently *will not work* with older
|
44 |
-
versions of WordPress, or with WordPress MU.)
|
45 |
-
|
46 |
-
2. FTP or SFTP access to your web host
|
47 |
-
|
48 |
-
### Installation ###
|
49 |
-
|
50 |
-
#### Upgrades ####
|
51 |
-
|
52 |
-
To *upgrade* an existing installation of FeedWordPress to version 0.99:
|
53 |
-
|
54 |
-
1. Download the FeedWordPress archive in zip or gzipped tar format and
|
55 |
-
extract the files on your computer.
|
56 |
-
|
57 |
-
2. If you are upgrading from version 0.98 or earlier, then you need to
|
58 |
-
create a new directory named `feedwordpress` in the `wp-content/plugins`
|
59 |
-
directory of your WordPress installation, and you also need to *delete*
|
60 |
-
your existing `wp-content/update-feeds.php` and
|
61 |
-
`wp-content/plugins/feedwordpress.php` files. The file structure for
|
62 |
-
FeedWordPress has changed and the files from your old version will not
|
63 |
-
be overwritten, which could cause conflicts if you leave them in place.
|
64 |
-
|
65 |
-
3. Upload the new PHP files to `wp-content/plugins/feedwordpress`,
|
66 |
-
overwriting any existing FeedWordPress files that are there. Also be
|
67 |
-
sure to upgrade `wp-includes/rss.php` and
|
68 |
-
`wp-includes/rss-functions.php` if you use the optional MagpieRSS
|
69 |
-
upgrade, or don't use it yet but do want to syndicate Atom 1.0 feeds.
|
70 |
-
|
71 |
-
3. If you are upgrading from version 0.96 or earlier, **immediately** log
|
72 |
-
in to the WordPress Dashboard, and go to Options --> Syndicated. Follow
|
73 |
-
the directions to launch the database upgrade procedure. The new
|
74 |
-
versions of FeedWordPress incorporate some long-needed improvements, but
|
75 |
-
old meta-data needs to be updated to prevent duplicate posts and other
|
76 |
-
possible maladies. If you're upgrading an existing installation, updates
|
77 |
-
and FeedWordPress template functions *will not work* until you've done
|
78 |
-
the upgrade. Then take a coffee break while the upgrade runs. It should,
|
79 |
-
hopefully, finish within a few minutes even on relatively large
|
80 |
-
databases.
|
81 |
-
|
82 |
-
4. If you are upgrading from version 0.98 or earlier, note that the old
|
83 |
-
`update-feeds.php` has been eliminated in favor of a (hopefully) more
|
84 |
-
humane method for automatic updating. If you used a cron job for
|
85 |
-
scheduled updates, it will not work anymore, but there is another,
|
86 |
-
simpler method which will. See [Setting Up Feed Updates][] below to get
|
87 |
-
scheduled updates back on track.
|
88 |
-
|
89 |
-
5. Enjoy your new installation of FeedWordPress.
|
90 |
-
|
91 |
-
#### New Installations ####
|
92 |
-
|
93 |
-
1. Download the FeedWordPress archive in zip or gzipped tar format and
|
94 |
-
extract the files on your computer.
|
95 |
-
|
96 |
-
2. Create a new directory named `feedwordpress` in the `wp-content/plugins`
|
97 |
-
directory of your WordPress installation. Use an FTP or SFTP client to
|
98 |
-
upload the contents of the `wp-content/plugins/feedwordpress` directory
|
99 |
-
in the FeedWordPress archive to the new directory that you just created
|
100 |
-
on your web host.
|
101 |
-
|
102 |
-
3. (Optional) Upgrade the copy of MagpieRSS packaged with WordPress by
|
103 |
-
installing the new `rss.php` and `rss-functions.php` (archived in
|
104 |
-
`OPTIONAL/wp-includes`) into your WordPress `wp-includes` directory.
|
105 |
-
Upgrading MagpieRSS is necessary if you want to take advantage of
|
106 |
-
support for Atom 1.0, multiple post categories, RSS enclosures, and
|
107 |
-
multiple character encodings. (Note, however, that support for
|
108 |
-
transliterating between character encodings is a very complex and
|
109 |
-
iffy prospect in some PHP environments, so if you intend to use
|
110 |
-
a lot of feeds with alternate encodings you should make sure that
|
111 |
-
your installation of PHP is up-to-date and that you keep a copy of
|
112 |
-
the old MagpieRSS around to compare results.)
|
113 |
-
|
114 |
-
4. Log in to the WordPress Dashboard and activate the FeedWordPress
|
115 |
-
plugin.
|
116 |
-
|
117 |
-
5. While you're at the Dashboard, once the plugin is activated, you can
|
118 |
-
go to **Syndication --> Options** and set (1) the link category that
|
119 |
-
FeedWordPress will syndicate links from (by default, "Contributors"),
|
120 |
-
and (2) whether FeedWordPress will use automatic updates or only
|
121 |
-
manual updates.
|
122 |
-
|
123 |
-
5. Go to the main **Syndication** page to set up the list of sites that
|
124 |
-
you want FeedWordPress to syndicate onto your blog. (If you have the
|
125 |
-
feeds you want to aggregate in a service such as Bloglines,
|
126 |
-
you may prefer to export them to an OPML file and use WordPress's
|
127 |
-
**Blogroll --> Import Links** to import them into the contributors
|
128 |
-
category.)
|
129 |
-
|
130 |
-
#### Setting Up Feed Updates ####
|
131 |
-
|
132 |
-
FeedWordPress is now ready to accept posts from its syndication sources. The
|
133 |
-
next thing to do is to make sure it knows *when* to go get them.
|
134 |
-
|
135 |
-
**N.B.:** If you are upgrading from version 0.981 or earlier of FeedWordPress,
|
136 |
-
the system for checking for new posts has been overhauled, hopefully making it
|
137 |
-
more humane, and also easier to use for people who do not have access to task
|
138 |
-
scheduling tools such as `cron`. You will need to re-read this section and
|
139 |
-
change your set-up accordingly.
|
140 |
-
|
141 |
-
FeedWordPress allows you to choose whether it will check for new posts
|
142 |
-
automatically, or only when you manually request for it to check. By default,
|
143 |
-
FeedWordPress opts for the **manual** option -- so that you can get your feeds
|
144 |
-
set up properly before FeedWordPress begins importing new posts. If you want
|
145 |
-
to use automatically scheduled updates, remember to enable them in
|
146 |
-
**Syndication --> Options** after you finish setting up FeedWordPress.
|
147 |
-
|
148 |
-
##### Manual Feed Updates #####
|
149 |
-
|
150 |
-
To manually check for new posts, log in to the WordPress Dashboard and go to the
|
151 |
-
main page under **Syndication**. You can use the "Update feeds now" button to
|
152 |
-
check for new posts on feeds that are due for a scheduled update, or use the
|
153 |
-
checkboxes and "Update Checked Feeds" button to force FeedWordPress to check one
|
154 |
-
or more specific feeds for new posts. FeedWordPress will check the selected
|
155 |
-
feed or feeds for new posts, and import any new content available.
|
156 |
-
|
157 |
-
##### Automatic Feed Updates #####
|
158 |
-
|
159 |
-
If you choose an automatic update schedule, then FeedWordPress will
|
160 |
-
automatically check for new posts based on a schedule you determine. When
|
161 |
-
automatic updates are enabled, FeedWordPress will check for new posts when
|
162 |
-
(1) at least ten minutes have passed since the last update, and (2) a viewer
|
163 |
-
visits your FeedWordPress-enabled blog. (If you want the interval of time to
|
164 |
-
be shorter or longer, you can change the interval in the Dashboard under
|
165 |
-
**Syndication --> Options**.)
|
166 |
-
|
167 |
-
Note that this is not quite the same thing as precisely scheduled updating.
|
168 |
-
If you get at least one viewer every ten minutes, then FeedWordPress will be
|
169 |
-
regularly checking for new posts on schedule; if not, not. But for a relatively
|
170 |
-
active aggregator blog this is probably close enough for government work.
|
171 |
-
|
172 |
-
However, if you want to ensure regular updates, and you have access to a
|
173 |
-
task-scheduling tool such as `cron`, you can use it to schedule regular
|
174 |
-
checks for updates on a fixed schedule. For example, using `cron`, you can
|
175 |
-
easily ensure that FeedWordPress checks for new posts regularly by adding the
|
176 |
-
following line to your crontab, substituting the actual address of your
|
177 |
-
WordPress installation for "http://www.zyx.com/blog/":
|
178 |
-
|
179 |
-
*/15 * * * * curl http://www.zyx.com/blog/ > /dev/null
|
180 |
-
|
181 |
-
If you don't have direct access to `cron` or a similar scheduling tool, you
|
182 |
-
can use online tools such as [WebCron](http://www.webcron.org/?lang=en) to
|
183 |
-
schedule a regular fetch of your blog's front page to much the same effect.
|
184 |
-
|
185 |
-
##### Feed Updates using XML-RPC #####
|
186 |
-
|
187 |
-
FeedWordPress also allows syndicated blogs to notify you of updates using the
|
188 |
-
XML-RPC "recently updated" pings (in the standard format accepted by
|
189 |
-
Weblogs.com, Ping-O-Matic, Technorati, and other blogging services). Most
|
190 |
-
blogging software allows users to add a URI to the list of URIs that get pinged
|
191 |
-
with each new update -- see, for example, **Options --> Writing --> Update
|
192 |
-
Services** in WordPress, or **Configuration --> Preferences --> Publicity /
|
193 |
-
Remote Interfaces / TrackBack** in Movable Type. If you can get a contributor
|
194 |
-
to add your XML-RPC URI to her list of update services to ping, then whenever
|
195 |
-
she updates her blog, her blogging software will notify your FeedWordPress
|
196 |
-
installation, and FeedWordPress will look up her feed to grab the new posts off
|
197 |
-
of it. (If you have WordPress installed at <http://www.zyx.com/blog>, say, the
|
198 |
-
URI for her to ping should be <http://www.zyx.com/blog/xmlrpc.php>).
|
199 |
-
|
200 |
-
Basic Concepts
|
201 |
-
--------------
|
202 |
-
FeedWordPress is written as a plugin for the WordPress weblog software. It is
|
203 |
-
designed to store all the data it needs within the WordPress database and to
|
204 |
-
make that data easy to manage from within the WordPress Dashboard.
|
205 |
-
|
206 |
-
### Contributors / Newsfeeds ###
|
207 |
-
|
208 |
-
FeedWordPress uses the WordPress Links database to keep a list of the feeds from
|
209 |
-
which it will syndicate content. WordPress allows you to place links in
|
210 |
-
categories; FeedWordPress will make use of all and only the links in one
|
211 |
-
category (by default, this is a category named "Contributors"; you can change
|
212 |
-
the category that FeedWordPress will use using **Options --> Syndication**).
|
213 |
-
|
214 |
-
From WordPress's perspective, the list of Contributors are normal links, and
|
215 |
-
they can be manipulated like other links through the WordPress Dashboard.
|
216 |
-
However, FeedWordPress provides a nicer interface for adding, removing, or
|
217 |
-
changing information for the Contributor Links from the WordPress Dashboard,
|
218 |
-
under **Links --> Syndicated**.
|
219 |
-
|
220 |
-
If you want to distribute the labor of adding, updating, and managing feeds
|
221 |
-
between several people, you can use the WordPress login andaccess privileges
|
222 |
-
system. Any users with an access level of 5 or greater can add, delete, and
|
223 |
-
modify Contributors; users with an access level of 6 or greater can change
|
224 |
-
syndication options.
|
225 |
-
|
226 |
-
When FeedWordPress looks for new posts, it retrieves one or all of the links
|
227 |
-
from the Contributors category (depending on whether it has been told to scan
|
228 |
-
for new posts on one or all of the feeds), determines which of them should be
|
229 |
-
polled for updates (based on how long it has been since the last time each feed
|
230 |
-
was polled for updates), and then uses an HTTP conditional GET to check for
|
231 |
-
updates at the "RSS URI" for each Link that it selects. Any new posts are added
|
232 |
-
to the database, and old posts that have been updated since the last poll are
|
233 |
-
updated to reflect the new version.
|
234 |
-
|
235 |
-
__Feed settings:__ All of the information for a syndicated feed is stored in the
|
236 |
-
WordPress Links database, and can be easily edited using an interface that
|
237 |
-
FeedWordPress provides under **Links --> Syndicated**. (If you're curious about
|
238 |
-
the technical details of how the information is stored, you can find out more
|
239 |
-
under [API: How feed information is stored][].)
|
240 |
-
|
241 |
-
You can use a feed's **Edit** link under **Links --> Syndicated** to affect how
|
242 |
-
FeedWordPress prcesses posts from that feed. (Most of these options can either
|
243 |
-
be set for *one particular feed* using **Links --> Syndicated --> Edit**, or set
|
244 |
-
as the default for *all feeds* using **Options --> Syndication**.) The **Edit**
|
245 |
-
link also allows you to set **Custom Feed Settings** for use in templates,
|
246 |
-
through the use of the [`get_feed_meta()`][get_feed_meta] template function in a
|
247 |
-
post context (see [Template API][]). For example, many aggregator sites use a
|
248 |
-
"face" image for each feed to visually distinguish posts from different feeds.
|
249 |
-
To implement a face feature, you could add a custom setting for each Contributor
|
250 |
-
Link, with the key of "face" and a URI such as "http://www.zyx.com/mugs/ugly"
|
251 |
-
for the value. (The URI should be changed out for each feed to point to the
|
252 |
-
appropriate image, of course.) Then, to use the setting from within a template,
|
253 |
-
add something like:
|
254 |
-
|
255 |
-
// In a post context
|
256 |
-
<?php $img = get_feed_meta('face'); if (strlen($img) > 0): ?>
|
257 |
-
<img src="<?=$img?>" alt="" />
|
258 |
-
<?php endif; ?>
|
259 |
-
|
260 |
-
... which will display the image, if any, whose URI is set in the "face" setting
|
261 |
-
for the feed that post comes from. If there is no "face" setting for a
|
262 |
-
particular feed, [`get_feed_meta()`][get_feed_meta] will return an empty string
|
263 |
-
and no image will be displayed.
|
264 |
-
|
265 |
-
[API: How feed information is stored]: http://projects.radgeek.com/feedwordpress/api#how-feed-information-is-stored
|
266 |
-
|
267 |
-
### Syndicated Posts ###
|
268 |
-
|
269 |
-
Whenever FeedWordPress updates, it scans one or more of the feeds in its
|
270 |
-
Contributors list and adds any new posts that it finds to the WordPress
|
271 |
-
database. Syndicated posts are displayed on your WordPress pages like any other
|
272 |
-
posts: they can be listed in archives by category, author, or date; they can be
|
273 |
-
found with the search box; and they are included in the newsfeed of your blog.
|
274 |
-
|
275 |
-
In your WordPress templates (**Presentation --> Theme Editor**) you can access
|
276 |
-
special information about syndicated posts using [functions provided by
|
277 |
-
FeedWordPress][Template API], such as [`is_syndicated()`][is_syndicated],
|
278 |
-
[`the_syndication_source()`][the_syndication_source],
|
279 |
-
[`the_syndication_source_link()`][the_syndication_source_link], and
|
280 |
-
[`get_feed_meta()`][get_feed_meta]. For example, here is the template code that
|
281 |
-
I use (in a post context) to display both the author's name and the original
|
282 |
-
source of the post in the templates for [Feminist Blogs][]:
|
283 |
-
|
284 |
-
<cite class="feed">from <?php the_author_posts_link()?><?php
|
285 |
-
if (is_syndicated() and (get_the_author() !== get_syndication_source())):
|
286 |
-
echo ' @ <a href="'; the_syndication_source_link(); echo '">';
|
287 |
-
the_syndication_source();
|
288 |
-
echo '</a>';
|
289 |
-
endif; ?></cite>
|
290 |
-
|
291 |
-
For more information on template functions, see [Template API][].
|
292 |
-
|
293 |
-
### Categories ###
|
294 |
-
|
295 |
-
WordPress allows for posts to be placed in *categories*. Each syndicated post
|
296 |
-
that FeedWordPress adds to the WordPress database is placed into a set of
|
297 |
-
categories. FeedWordPress gets the list of category names to use from two
|
298 |
-
sources:
|
299 |
-
|
300 |
-
1. Categories (or "tags") that the original author placed the post in on
|
301 |
-
her blog
|
302 |
-
|
303 |
-
2. Categories that you set explicitly for each feed using the
|
304 |
-
**Categories** checkbox under **Links --> Syndicated --> Edit**. For
|
305 |
-
example, if you wanted all the posts from Alas, A Blog to be placed in
|
306 |
-
the "Pacific Northwest" category and the "Cartoonists" category (*in
|
307 |
-
addition to* any other categories that they were placed in on Alas, A
|
308 |
-
Blog), you could do this by creating the categories, going to **Links
|
309 |
-
--> Syndicated**, clicking the "Edit" link for Alas, A Blog, and
|
310 |
-
checking those two categories under the checkbox captioned "Categories."
|
311 |
-
|
312 |
-
Given the list of category names, FeedWordPress looks for categories in the
|
313 |
-
WordPress database with the same name as either (1) the category name, or
|
314 |
-
(2) one of the "aliases" listed in the category description.
|
315 |
-
|
316 |
-
__Aliases:__ Different often authors use slightly different names for categories
|
317 |
-
that mean the same thing (contributors to Feminist Blogs, for example, used
|
318 |
-
categories including "Feminism", "feministy stuff", "Women's Issues", "Gender
|
319 |
-
Issues", "Gender Equality", and so on). If you want FeedWordPress to treat one
|
320 |
-
category name as a synonym for another, you can do so by creating an "alias" for
|
321 |
-
the category. For example, to make FeedWordPress treat posts that are placed in
|
322 |
-
the category "feministy stuff" as if they had been placed in the category
|
323 |
-
"Feminism", go to **Manage --> Categories**, find the category "Feminism" and
|
324 |
-
click the "Edit" link for it, and then add the following to the Description
|
325 |
-
field, on a line by itself:
|
326 |
-
|
327 |
-
a.k.a.: feministy stuff
|
328 |
-
|
329 |
-
You can add as many aliases as you like. You can also add any other text that
|
330 |
-
you like to the Description without interfering with FeedWordPress's ability to
|
331 |
-
use the aliases. Each alias must be on a line by itself.
|
332 |
-
|
333 |
-
__Unfamiliar categories:__ If one of the category names that a newsfeed provides
|
334 |
-
is *unfamiliar* -- that is, if there is not yet any category in your WordPress
|
335 |
-
database that either has that name, or uses that name as an alias -- then by
|
336 |
-
default FeedWordPress will *automatically create* a new category with that name
|
337 |
-
and place the current post in it. The default behavior can be changed so that
|
338 |
-
unfamiliar categories will *not* be added to the database, using the
|
339 |
-
**Unfamiliar categories** setting, either for *all* feeds (under **Options -->
|
340 |
-
Syndication**) or for *one particular feed* (under **Links --> Syndicated**).
|
341 |
-
|
342 |
-
If you choose to disable the creation of new categories, either for all feeds or
|
343 |
-
for one particular feed, then you can also choose whether or not FeedWordPress
|
344 |
-
should syndicate posts that do not match *any* of the categories that are
|
345 |
-
currently in the database. This allows you to do some simple filtering of posts
|
346 |
-
by category: if you want to your blog to syndicate only the posts in one
|
347 |
-
particular category from a feed that has several categories, you could do so by
|
348 |
-
creating a category by that name, adding the new feed(s), and then setting
|
349 |
-
**Unfamiliar categories** under **Links --> Syndicated --> Edit** to "don't
|
350 |
-
create new categories and don't syndicate posts unless they match at least one
|
351 |
-
familiar category".
|
352 |
-
|
353 |
-
Since only posts in categories that are in your database will be included, and
|
354 |
-
only the category or categories that you wanted posts from has been added to
|
355 |
-
your database, this will filter out all the posts that aren't in the category or
|
356 |
-
categories that you defined ahead of time. (Similarly, you could set up
|
357 |
-
FeedWordPress so that *all* the feeds are filtered by author by creating the set
|
358 |
-
of users named after the authors you want to syndicate, and then setting the
|
359 |
-
default behavior for *all* feeds at **Options --> Syndication**).
|
360 |
-
|
361 |
-
If you need a category filter with more complex logic, you can always create a
|
362 |
-
`syndicated_item` filter in PHP (see [Plugin API][]) that manipulates the
|
363 |
-
`['categories']` array of a syndicated item.
|
364 |
-
|
365 |
-
### Authors ###
|
366 |
-
|
367 |
-
Most newsfeeds include information about the author of the items on them.
|
368 |
-
(If a feed doesn't, then FeedWordPress will create an author's name based on
|
369 |
-
the title of the feed from which the item was taken.) This information is used
|
370 |
-
to determine the WordPress user that the post will be attributed to. Given the
|
371 |
-
name of the author, FeedWordPress looks for authors in the WordPress database
|
372 |
-
with the same name as either (1) their login, (2) their display name, (3) their
|
373 |
-
e-mail address (if given), or (4) one of the "aliases" listed in the
|
374 |
-
user's profile.
|
375 |
-
|
376 |
-
__Aliases:__ If there is an author who posts under more than one name (for
|
377 |
-
example, one of our contributors at [Feminist Blogs][] posts on several
|
378 |
-
different blogs, sometimes using her full name and sometimes using only her
|
379 |
-
first name), then you can ensure that FeedWordPress will attribute those posts
|
380 |
-
to the same author by creating "aliases" for the author. For example, to make
|
381 |
-
FeedWordPress treat posts by "Joseph Cardinal Ratzinger" and posts by "Pope
|
382 |
-
Benedict XVI" as having the same author, go to **Users --> Authors & Users**,
|
383 |
-
click on the "Edit" link for Pope Benedict XVI, and add a line like this to the
|
384 |
-
Profile text:
|
385 |
-
|
386 |
-
a.k.a.: Joseph Cardinal Ratzinger
|
387 |
-
|
388 |
-
You can add as many aliases as you like. You can also add any other text that
|
389 |
-
you like to the Profile without interfering with FeedWordPress's ability to use
|
390 |
-
the aliases. Each alias must be on a line by itself.
|
391 |
-
|
392 |
-
__Unfamiliar authors:__ By default, if the author named by the newsfeed is
|
393 |
-
unfamiliar -- that is, if there is no-one with that name registered in the
|
394 |
-
WordPress author's database -- then by default FeedWordPress will automatically
|
395 |
-
create a new user account with the given name and attribute the post to the new
|
396 |
-
user. The default behavior can be changed, using either the global settings in
|
397 |
-
**Options --> Syndication** or the [feed settings][] under **Links -->
|
398 |
-
Syndicated --> Edit**, so that posts by unfamiliar authors will either be
|
399 |
-
attributed to a default author (instead of creating a new user account to
|
400 |
-
attribute them to), or filtered out and not syndicated at all.
|
401 |
-
|
402 |
-
One of the uses of this feature is to filtering posts by author: if you want to
|
403 |
-
your blog to syndicate only the posts by one particular author from a feed that
|
404 |
-
has several authors, you could do so by creating a user account with that
|
405 |
-
author's name, adding the new feed(s), and then setting **Unfamiliar authors**
|
406 |
-
under **Links --> Syndicated --> Edit** to "don't syndicate the post". Since
|
407 |
-
only posts by authors that are in your database will be included, and only the
|
408 |
-
author that you wanted posts from has been added to your database, this will
|
409 |
-
filter out posts by anyone else on the feeds with that setting. (Similarly, you
|
410 |
-
could set up FeedWordPress so that *all* the feeds are filtered by author by
|
411 |
-
creating the set of users named after the authors you want to syndicate, and
|
412 |
-
then setting the default behavior for *all* feeds at **Options -->
|
413 |
-
Syndication**).
|
414 |
-
|
415 |
-
If you need an author filter with more complex logic than this allows, you can
|
416 |
-
always create a `syndicated_item` filter in PHP (see [Plugin API][]) that
|
417 |
-
manipulates the `['author_name']` or `['dc']['creator']` elements of a
|
418 |
-
syndicated item.
|
419 |
-
|
420 |
-
Template API
|
421 |
-
------------
|
422 |
-
When activated, FeedWordPress makes the following functions available for use by
|
423 |
-
themes/templates:
|
424 |
-
|
425 |
-
* ``is_syndicated()``: in a post context, returns ``TRUE`` if the post was
|
426 |
-
syndicated from another website, or ``FALSE`` if it was originally
|
427 |
-
posted here
|
428 |
-
|
429 |
-
* ``get_syndication_permalink()``: in a post context, returns the URI of
|
430 |
-
the permalink for this post *on the website it was syndicated from*
|
431 |
-
|
432 |
-
* ``the_syndication_permalink()``: in a post context, outputs the value
|
433 |
-
returned by [``get_syndication_permalink()``][get_syndication_permalink]
|
434 |
-
|
435 |
-
* ``get_syndication_source_link()``: in a post context, returns the URI of
|
436 |
-
the front page (*not* the feed) of the website this post was syndicated
|
437 |
-
from
|
438 |
-
|
439 |
-
* ``the_syndication_source_link()``: in a post context, outputs the URI
|
440 |
-
returned by
|
441 |
-
[``get_syndication_source_link()``][get_syndication_source_link]
|
442 |
-
|
443 |
-
* ``get_syndication_source()``: in a post context, returns the
|
444 |
-
human-readable title of the website that a syndicated post was
|
445 |
-
syndicated from
|
446 |
-
|
447 |
-
* ``the_syndication_source()``: in a post context, outputs the value
|
448 |
-
returned by [``get_syndication_source()``][get_syndication_source]
|
449 |
-
|
450 |
-
* ``get_syndication_feed():`` in a post context, returns the URI of the
|
451 |
-
feed (*not* the front page) that this post was syndicated from
|
452 |
-
|
453 |
-
* ``the_syndication_feed()``: in a post context, outputs the value
|
454 |
-
returned by [``get_syndication_feed()``][get_syndication_feed]
|
455 |
-
|
456 |
-
* ``get_feed_meta($key)``: in a post context, returns the value, if any,
|
457 |
-
of the feed setting ``$key`` for the feed that this post was syndicated
|
458 |
-
from
|
459 |
-
|
460 |
-
By default, FeedWordPress also places a filter on the standard functions
|
461 |
-
``get_permalink()`` and ``the_permalink()`` that substitutes the URI returned by
|
462 |
-
[``get_syndication_permalink()``][get_syndication_permalink] for the URI
|
463 |
-
generated by WordPress. This means that by default the permalinks listed on your
|
464 |
-
website and in your newsfeed will link to the location of the posts on the
|
465 |
-
source website, *not* to their location on your website. You can switch this
|
466 |
-
behavior on or off at **Options --> Syndication** in the WordPress Dashboard.
|
467 |
-
|
468 |
-
Plugin API
|
469 |
-
----------
|
470 |
-
FeedWordPress creates five hooks through the WordPress plugin architecture that
|
471 |
-
you can plug in to using PHP WordPress plugins, to supplement ordinary
|
472 |
-
FeedWordPress behavior, or to filter posts according to criteria that you set.
|
473 |
-
The hooks are the action ``feedwordpress_update``, the action
|
474 |
-
``feedwordpress_check_feed``, the action ``feedwordpress_update_complete``, the
|
475 |
-
filter ``syndicated_item``, the filter ``syndicated_post``, the action
|
476 |
-
``post_syndicated_item``, and the action ``update_syndicated_item``.
|
477 |
-
|
478 |
-
For more information, see <http://projects.radgeek.com/feedwordpress/api>.
|
479 |
-
|
480 |
-
License
|
481 |
-
-------
|
482 |
-
The FeedWordPress plugin is copyright (c) 2005-2007 by Charles Johnson. It uses
|
483 |
-
code derived or translated from:
|
484 |
-
|
485 |
-
- [wp-rss-aggregate.php][] by [Kellan Elliot-McCrea](kellan@protest.net)
|
486 |
-
- [MagpieRSS][] by [Kellan Elliot-McCrea](kellan@protest.net)
|
487 |
-
- [HTTP Navigator 2][] by [Keyvan Minoukadeh](keyvan@k1m.com)
|
488 |
-
- [Ultra-Liberal Feed Finder][] by [Mark Pilgrim](mark@diveintomark.org)
|
489 |
-
|
490 |
-
according to the terms of the [GNU General Public License][].
|
491 |
-
|
492 |
-
This program is free software; you can redistribute it and/or modify it under
|
493 |
-
the terms of the [GNU General Public License][] as published by the Free
|
494 |
-
Software Foundation; either version 2 of the License, or (at your option) any
|
495 |
-
later version.
|
496 |
-
|
497 |
-
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
498 |
-
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
499 |
-
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
500 |
-
|
501 |
-
[wp-rss-aggregate.php]: http://laughingmeme.org/archives/002203.html
|
502 |
-
[MagpieRSS]: http://magpierss.sourceforge.net/
|
503 |
-
[HTTP Navigator 2]: http://www.keyvan.net/2004/11/16/http-navigator/
|
504 |
-
[Ultra-Liberal Feed Finder]: http://diveintomark.org/projects/feed_finder/
|
505 |
-
|
506 |
-
[GNU General Public License]: http://www.gnu.org/copyleft/gpl.html
|
507 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wp-content/plugins/feedwordpress/feedwordpress.php → feedwordpress.php
RENAMED
@@ -3,11 +3,11 @@
|
|
3 |
Plugin Name: FeedWordPress
|
4 |
Plugin URI: http://projects.radgeek.com/feedwordpress
|
5 |
Description: simple and flexible Atom/RSS syndication for WordPress
|
6 |
-
Version: 0.
|
7 |
Author: Charles Johnson
|
8 |
Author URI: http://radgeek.com/
|
9 |
License: GPL
|
10 |
-
Last modified: 2007-09-
|
11 |
*/
|
12 |
|
13 |
# This uses code derived from:
|
@@ -27,7 +27,7 @@ Last modified: 2007-09-16 11:13 PDT
|
|
27 |
|
28 |
# -- Don't change these unless you know what you're doing...
|
29 |
|
30 |
-
define ('FEEDWORDPRESS_VERSION', '0.
|
31 |
define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact');
|
32 |
define ('DEFAULT_SYNDICATION_CATEGORY', 'Contributors');
|
33 |
|
@@ -56,6 +56,8 @@ if (FEEDWORDPRESS_DEBUG) :
|
|
56 |
// make sure FEEDWORDPRESS_DEBUG is FALSE for any site that will be
|
57 |
// used for more than testing purposes!
|
58 |
define('MAGPIE_CACHE_AGE', 1);
|
|
|
|
|
59 |
endif;
|
60 |
|
61 |
// Note that the rss-functions.php that comes prepackaged with WordPress is
|
@@ -74,14 +76,14 @@ if (isset($wp_db_version)) :
|
|
74 |
elseif ($wp_db_version >= FWP_SCHEMA_21) : // WordPress 2.1 and 2.2, but not 2.3
|
75 |
require_once (ABSPATH . WPINC . '/registration.php'); // for wp_insert_user
|
76 |
require_once (ABSPATH . 'wp-admin/admin-db.php'); // for wp_insert_category
|
77 |
-
elseif ($wp_db_version >=
|
78 |
require_once (ABSPATH . WPINC . '/registration-functions.php'); // for wp_insert_user
|
79 |
require_once (ABSPATH . 'wp-admin/admin-db.php'); // for wp_insert_category
|
80 |
endif;
|
81 |
endif;
|
82 |
|
83 |
if (function_exists('wp_enqueue_script')) :
|
84 |
-
wp_enqueue_script( 'ajaxcat' );
|
85 |
endif;
|
86 |
|
87 |
// Magic quotes are just about the stupidest thing ever.
|
@@ -89,69 +91,70 @@ if (is_array($_POST)) :
|
|
89 |
$fwp_post = stripslashes_deep($_POST);
|
90 |
endif;
|
91 |
|
92 |
-
// Is this being loaded from within WordPress 1.5 or later?
|
93 |
-
if (isset($wp_version) and $wp_version >= 1.5):
|
94 |
|
95 |
-
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
|
113 |
-
|
114 |
-
|
115 |
|
116 |
-
|
117 |
-
|
118 |
|
119 |
-
|
120 |
-
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
endif;
|
149 |
|
150 |
function feedwordpress_auto_update () {
|
151 |
if (FeedWordPress::stale()) :
|
152 |
$feedwordpress =& new FeedWordPress;
|
153 |
$feedwordpress->update();
|
154 |
endif;
|
|
|
|
|
|
|
|
|
155 |
} /* feedwordpress_auto_update () */
|
156 |
|
157 |
################################################################################
|
@@ -223,6 +226,11 @@ if (!function_exists('current_user_can')) {
|
|
223 |
} else {
|
224 |
$legacy_capability_hack = false;
|
225 |
}
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
################################################################################
|
228 |
## TEMPLATE API: functions to make your templates syndication-aware ############
|
@@ -380,7 +388,7 @@ function fwp_add_pages () {
|
|
380 |
function fwp_category_box ($checked, $object) {
|
381 |
global $wp_db_version;
|
382 |
|
383 |
-
if (isset($wp_db_version) and $wp_db_version >=
|
384 |
?>
|
385 |
<div id="poststuff">
|
386 |
|
@@ -466,18 +474,27 @@ if ($cont):
|
|
466 |
|
467 |
echo "<div class=\"updated\">\n";
|
468 |
echo "<ul>\n";
|
|
|
469 |
foreach ($update_set as $uri) :
|
470 |
if ($uri == '*') : $uri = NULL; endif;
|
471 |
$delta = $feedwordpress->update($uri);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
endforeach;
|
473 |
echo "</ul>\n";
|
474 |
|
475 |
-
if (is_null($
|
476 |
-
echo "<p><strong>Error:</strong> I don't syndicate <a href=\"$uri\">$uri</a></p>\n";
|
477 |
-
else :
|
478 |
$mesg = array();
|
479 |
-
if (isset($delta['new'])) : $mesg[] = ' '.$
|
480 |
-
if (isset($delta['updated'])) : $mesg[] = ' '.$
|
481 |
echo "<p>Update complete.".implode(' and', $mesg)."</p>";
|
482 |
echo "\n"; flush();
|
483 |
endif;
|
@@ -1558,11 +1575,20 @@ class FeedWordPress {
|
|
1558 |
else :
|
1559 |
FeedWordPress::critical_bug('FeedWordPress::stale::last', $last, __LINE__);
|
1560 |
endif;
|
|
|
|
|
|
|
|
|
|
|
1561 |
else :
|
1562 |
$ret = false;
|
1563 |
endif;
|
1564 |
return $ret;
|
1565 |
-
}
|
|
|
|
|
|
|
|
|
1566 |
|
1567 |
function syndicate_link ($name, $uri, $rss) {
|
1568 |
global $wpdb;
|
@@ -2123,7 +2149,7 @@ class SyndicatedPost {
|
|
2123 |
|
2124 |
// This should never happen.
|
2125 |
if (!is_numeric($this->_wp_id) or ($this->_wp_id == 0)) :
|
2126 |
-
FeedWordPress::critical_bug('SyndicatedPost
|
2127 |
endif;
|
2128 |
|
2129 |
// Unfortunately, as of WordPress 2.3, wp_insert_post()
|
@@ -2312,7 +2338,12 @@ class SyndicatedPost {
|
|
2312 |
$url = $a['uri'];
|
2313 |
|
2314 |
// Never can be too careful...
|
|
|
|
|
|
|
2315 |
$nice_author = sanitize_title($author);
|
|
|
|
|
2316 |
$reg_author = $wpdb->escape(preg_quote($author));
|
2317 |
$author = $wpdb->escape($author);
|
2318 |
$email = $wpdb->escape($email);
|
@@ -2324,7 +2355,7 @@ class SyndicatedPost {
|
|
2324 |
$id = $wpdb->get_var(
|
2325 |
"SELECT ID from $wpdb->users
|
2326 |
WHERE
|
2327 |
-
TRIM(LCASE(user_login)) = TRIM(LCASE('$
|
2328 |
(
|
2329 |
LENGTH(TRIM(LCASE(user_email))) > 0
|
2330 |
AND TRIM(LCASE(user_email)) = TRIM(LCASE('$email'))
|
@@ -2349,7 +2380,7 @@ class SyndicatedPost {
|
|
2349 |
$id = $wpdb->get_var(
|
2350 |
"SELECT ID FROM $wpdb->users
|
2351 |
WHERE
|
2352 |
-
TRIM(LCASE(user_login)) = TRIM(LCASE('$
|
2353 |
OR (
|
2354 |
LENGTH(TRIM(LCASE(user_email))) > 0
|
2355 |
AND TRIM(LCASE(user_email)) = TRIM(LCASE('$email'))
|
@@ -2364,10 +2395,10 @@ class SyndicatedPost {
|
|
2364 |
(meta_key = 'description' AND TRIM(LCASE(meta_value)) = TRIM(LCASE('$author')))
|
2365 |
OR (
|
2366 |
meta_key = 'description'
|
2367 |
-
AND LCASE(meta_value)
|
2368 |
RLIKE CONCAT(
|
2369 |
'(^|\\n)a\\.?k\\.?a\\.?( |\\t)*:?( |\\t)*',
|
2370 |
-
LCASE('$reg_author'),
|
2371 |
'( |\\t|\\r)*(\\n|\$)'
|
2372 |
)
|
2373 |
)
|
@@ -2384,7 +2415,7 @@ class SyndicatedPost {
|
|
2384 |
"INSERT INTO $wpdb->users
|
2385 |
SET
|
2386 |
ID='0',
|
2387 |
-
user_login='$
|
2388 |
user_firstname='$author',
|
2389 |
user_nickname='$author',
|
2390 |
user_nicename='$nice_author',
|
@@ -2398,7 +2429,8 @@ class SyndicatedPost {
|
|
2398 |
|
2399 |
#-- user table data
|
2400 |
$userdata['ID'] = NULL; // new user
|
2401 |
-
$userdata['user_login'] = $
|
|
|
2402 |
$userdata['user_pass'] = substr(md5(uniqid(microtime())), 0, 6); // just something random to lock it up
|
2403 |
$userdata['user_email'] = $email;
|
2404 |
$userdata['user_url'] = $url;
|
@@ -2427,7 +2459,7 @@ class SyndicatedPost {
|
|
2427 |
|
2428 |
$cat_ids = array ();
|
2429 |
foreach ($cats as $cat_name) :
|
2430 |
-
if (preg_match('
|
2431 |
$cat_id = (int) $backref[1];
|
2432 |
if (function_exists('is_term') and is_term($cat_id, 'category')) :
|
2433 |
$cat_ids[] = $cat_id;
|
3 |
Plugin Name: FeedWordPress
|
4 |
Plugin URI: http://projects.radgeek.com/feedwordpress
|
5 |
Description: simple and flexible Atom/RSS syndication for WordPress
|
6 |
+
Version: 0.991
|
7 |
Author: Charles Johnson
|
8 |
Author URI: http://radgeek.com/
|
9 |
License: GPL
|
10 |
+
Last modified: 2007-09-25 12:48 PDT
|
11 |
*/
|
12 |
|
13 |
# This uses code derived from:
|
27 |
|
28 |
# -- Don't change these unless you know what you're doing...
|
29 |
|
30 |
+
define ('FEEDWORDPRESS_VERSION', '0.991');
|
31 |
define ('FEEDWORDPRESS_AUTHOR_CONTACT', 'http://radgeek.com/contact');
|
32 |
define ('DEFAULT_SYNDICATION_CATEGORY', 'Contributors');
|
33 |
|
56 |
// make sure FEEDWORDPRESS_DEBUG is FALSE for any site that will be
|
57 |
// used for more than testing purposes!
|
58 |
define('MAGPIE_CACHE_AGE', 1);
|
59 |
+
else :
|
60 |
+
define('MAGPIE_DEBUG', false);
|
61 |
endif;
|
62 |
|
63 |
// Note that the rss-functions.php that comes prepackaged with WordPress is
|
76 |
elseif ($wp_db_version >= FWP_SCHEMA_21) : // WordPress 2.1 and 2.2, but not 2.3
|
77 |
require_once (ABSPATH . WPINC . '/registration.php'); // for wp_insert_user
|
78 |
require_once (ABSPATH . 'wp-admin/admin-db.php'); // for wp_insert_category
|
79 |
+
elseif ($wp_db_version >= FWP_SCHEMA_20) : // WordPress 2.0
|
80 |
require_once (ABSPATH . WPINC . '/registration-functions.php'); // for wp_insert_user
|
81 |
require_once (ABSPATH . 'wp-admin/admin-db.php'); // for wp_insert_category
|
82 |
endif;
|
83 |
endif;
|
84 |
|
85 |
if (function_exists('wp_enqueue_script')) :
|
86 |
+
wp_enqueue_script( 'ajaxcat' ); // Provides the handy-dandy new category text box
|
87 |
endif;
|
88 |
|
89 |
// Magic quotes are just about the stupidest thing ever.
|
91 |
$fwp_post = stripslashes_deep($_POST);
|
92 |
endif;
|
93 |
|
|
|
|
|
94 |
|
95 |
+
if (!FeedWordPress::needs_upgrade()) : // only work if the conditions are safe!
|
96 |
|
97 |
+
# Syndicated items are generally received in output-ready (X)HTML and
|
98 |
+
# should not be folded, crumpled, mutilated, or spindled by WordPress
|
99 |
+
# formatting filters. But we don't want to interfere with filters for
|
100 |
+
# any locally-authored posts, either.
|
101 |
+
#
|
102 |
+
# What WordPress should really have is a way for upstream filters to
|
103 |
+
# stop downstream filters from running at all. Since it doesn't, and
|
104 |
+
# since a downstream filter can't access the original copy of the text
|
105 |
+
# that is being filtered, what we will do here is (1) save a copy of the
|
106 |
+
# original text upstream, before any other filters run, and then (2)
|
107 |
+
# retrieve that copy downstream, after all the other filters run, *if*
|
108 |
+
# this is a syndicated post
|
109 |
+
|
110 |
+
add_filter('the_content', 'feedwordpress_preserve_syndicated_content', -10000);
|
111 |
+
add_filter('the_content', 'feedwordpress_restore_syndicated_content', 10000);
|
112 |
|
113 |
+
# Filter in original permalinks if the user wants that
|
114 |
+
add_filter('post_link', 'syndication_permalink', 1);
|
115 |
|
116 |
+
# Admin menu
|
117 |
+
add_action('admin_menu', 'fwp_add_pages');
|
118 |
|
119 |
+
# Inbound XML-RPC update methods
|
120 |
+
add_filter('xmlrpc_methods', 'feedwordpress_xmlrpc_hook');
|
121 |
|
122 |
+
# Outbound XML-RPC ping reform
|
123 |
+
remove_action('publish_post', 'generic_ping'); // WP 1.5.x
|
124 |
+
remove_action('do_pings', 'do_all_pings', 10, 1); // WP 2.1, 2.2
|
125 |
+
remove_action('publish_post', '_publish_post_hook', 5, 1); // WP 2.3
|
126 |
+
|
127 |
+
add_action('publish_post', 'fwp_publish_post_hook', 5, 1);
|
128 |
+
add_action('do_pings', 'fwp_do_pings', 10, 1);
|
129 |
+
add_action('feedwordpress_update', 'fwp_hold_pings');
|
130 |
+
add_action('feedwordpress_update_complete', 'fwp_release_pings');
|
131 |
+
|
132 |
+
# Hook in logging functions only if the logging option is ON
|
133 |
+
$update_logging = get_option('feedwordpress_update_logging');
|
134 |
+
if ($update_logging == 'yes') :
|
135 |
+
add_action('post_syndicated_item', 'log_feedwordpress_post', 100);
|
136 |
+
add_action('update_syndicated_item', 'log_feedwordpress_update_post', 100);
|
137 |
+
add_action('feedwordpress_update', 'log_feedwordpress_update_feeds', 100);
|
138 |
+
add_action('feedwordpress_check_feed', 'log_feedwordpress_check_feed', 100);
|
139 |
+
add_action('feedwordpress_update_complete', 'log_feedwordpress_update_complete', 100);
|
140 |
+
endif;
|
141 |
|
142 |
+
# Cron-less auto-update. Hooray!
|
143 |
+
add_action('init', 'feedwordpress_auto_update');
|
144 |
+
else :
|
145 |
+
# Hook in the menus, which will just point to the upgrade interface
|
146 |
+
add_action('admin_menu', 'fwp_add_pages');
|
147 |
+
endif; // if (!FeedWordPress::needs_upgrade())
|
|
|
148 |
|
149 |
function feedwordpress_auto_update () {
|
150 |
if (FeedWordPress::stale()) :
|
151 |
$feedwordpress =& new FeedWordPress;
|
152 |
$feedwordpress->update();
|
153 |
endif;
|
154 |
+
|
155 |
+
if (FeedWordPress::update_requested()) :
|
156 |
+
exit;
|
157 |
+
endif;
|
158 |
} /* feedwordpress_auto_update () */
|
159 |
|
160 |
################################################################################
|
226 |
} else {
|
227 |
$legacy_capability_hack = false;
|
228 |
}
|
229 |
+
if (!function_exists('sanitize_user')) {
|
230 |
+
function sanitize_user ($text, $strict) {
|
231 |
+
return $text; // Don't munge it if it wasn't munged going in...
|
232 |
+
}
|
233 |
+
}
|
234 |
|
235 |
################################################################################
|
236 |
## TEMPLATE API: functions to make your templates syndication-aware ############
|
388 |
function fwp_category_box ($checked, $object) {
|
389 |
global $wp_db_version;
|
390 |
|
391 |
+
if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_20) : // WordPress 2.x
|
392 |
?>
|
393 |
<div id="poststuff">
|
394 |
|
474 |
|
475 |
echo "<div class=\"updated\">\n";
|
476 |
echo "<ul>\n";
|
477 |
+
$tdelta = NULL;
|
478 |
foreach ($update_set as $uri) :
|
479 |
if ($uri == '*') : $uri = NULL; endif;
|
480 |
$delta = $feedwordpress->update($uri);
|
481 |
+
if (!is_null($delta)) :
|
482 |
+
if (is_null($tdelta)) :
|
483 |
+
$tdelta = $delta;
|
484 |
+
else :
|
485 |
+
$tdelta['new'] += $delta['new'];
|
486 |
+
$tdelta['updated'] += $delta['updated'];
|
487 |
+
endif;
|
488 |
+
else :
|
489 |
+
echo "<li><p><strong>Error:</strong> There was a problem updating <a href=\"$uri\">$uri</a></p></li>\n";
|
490 |
+
endif;
|
491 |
endforeach;
|
492 |
echo "</ul>\n";
|
493 |
|
494 |
+
if (!is_null($tdelta)) :
|
|
|
|
|
495 |
$mesg = array();
|
496 |
+
if (isset($delta['new'])) : $mesg[] = ' '.$tdelta['new'].' new posts were syndicated'; endif;
|
497 |
+
if (isset($delta['updated'])) : $mesg[] = ' '.$tdelta['updated'].' existing posts were updated'; endif;
|
498 |
echo "<p>Update complete.".implode(' and', $mesg)."</p>";
|
499 |
echo "\n"; flush();
|
500 |
endif;
|
1575 |
else :
|
1576 |
FeedWordPress::critical_bug('FeedWordPress::stale::last', $last, __LINE__);
|
1577 |
endif;
|
1578 |
+
|
1579 |
+
// Explicit request for an update (e.g. from a cron job).
|
1580 |
+
elseif (FeedWordPress::update_requested()) :
|
1581 |
+
$ret = true;
|
1582 |
+
|
1583 |
else :
|
1584 |
$ret = false;
|
1585 |
endif;
|
1586 |
return $ret;
|
1587 |
+
} // FeedWordPress::stale()
|
1588 |
+
|
1589 |
+
function update_requested () {
|
1590 |
+
return (isset($_REQUEST['update_feedwordpress']) and $_REQUEST['update_feedwordpress']);
|
1591 |
+
} // FeedWordPress::update_requested()
|
1592 |
|
1593 |
function syndicate_link ($name, $uri, $rss) {
|
1594 |
global $wpdb;
|
2149 |
|
2150 |
// This should never happen.
|
2151 |
if (!is_numeric($this->_wp_id) or ($this->_wp_id == 0)) :
|
2152 |
+
FeedWordPress::critical_bug('SyndicatedPost (_wp_id problem)', $this, __LINE__);
|
2153 |
endif;
|
2154 |
|
2155 |
// Unfortunately, as of WordPress 2.3, wp_insert_post()
|
2338 |
$url = $a['uri'];
|
2339 |
|
2340 |
// Never can be too careful...
|
2341 |
+
$login = sanitize_user($author, /*strict=*/ true);
|
2342 |
+
$login = apply_filters('pre_user_login', $login);
|
2343 |
+
|
2344 |
$nice_author = sanitize_title($author);
|
2345 |
+
$nice_author = apply_filters('pre_user_nicename', $nice_author);
|
2346 |
+
|
2347 |
$reg_author = $wpdb->escape(preg_quote($author));
|
2348 |
$author = $wpdb->escape($author);
|
2349 |
$email = $wpdb->escape($email);
|
2355 |
$id = $wpdb->get_var(
|
2356 |
"SELECT ID from $wpdb->users
|
2357 |
WHERE
|
2358 |
+
TRIM(LCASE(user_login)) = TRIM(LCASE('$login')) OR
|
2359 |
(
|
2360 |
LENGTH(TRIM(LCASE(user_email))) > 0
|
2361 |
AND TRIM(LCASE(user_email)) = TRIM(LCASE('$email'))
|
2380 |
$id = $wpdb->get_var(
|
2381 |
"SELECT ID FROM $wpdb->users
|
2382 |
WHERE
|
2383 |
+
TRIM(LCASE(user_login)) = TRIM(LCASE('$login'))
|
2384 |
OR (
|
2385 |
LENGTH(TRIM(LCASE(user_email))) > 0
|
2386 |
AND TRIM(LCASE(user_email)) = TRIM(LCASE('$email'))
|
2395 |
(meta_key = 'description' AND TRIM(LCASE(meta_value)) = TRIM(LCASE('$author')))
|
2396 |
OR (
|
2397 |
meta_key = 'description'
|
2398 |
+
AND TRIM(LCASE(meta_value))
|
2399 |
RLIKE CONCAT(
|
2400 |
'(^|\\n)a\\.?k\\.?a\\.?( |\\t)*:?( |\\t)*',
|
2401 |
+
TRIM(LCASE('$reg_author')),
|
2402 |
'( |\\t|\\r)*(\\n|\$)'
|
2403 |
)
|
2404 |
)
|
2415 |
"INSERT INTO $wpdb->users
|
2416 |
SET
|
2417 |
ID='0',
|
2418 |
+
user_login='$login',
|
2419 |
user_firstname='$author',
|
2420 |
user_nickname='$author',
|
2421 |
user_nicename='$nice_author',
|
2429 |
|
2430 |
#-- user table data
|
2431 |
$userdata['ID'] = NULL; // new user
|
2432 |
+
$userdata['user_login'] = $login;
|
2433 |
+
$userdata['user_nicename'] = $nice_author;
|
2434 |
$userdata['user_pass'] = substr(md5(uniqid(microtime())), 0, 6); // just something random to lock it up
|
2435 |
$userdata['user_email'] = $email;
|
2436 |
$userdata['user_url'] = $url;
|
2459 |
|
2460 |
$cat_ids = array ();
|
2461 |
foreach ($cats as $cat_name) :
|
2462 |
+
if (preg_match('/^{#([0-9]+)}$/', $cat_name, $backref)) :
|
2463 |
$cat_id = (int) $backref[1];
|
2464 |
if (function_exists('is_term') and is_term($cat_id, 'category')) :
|
2465 |
$cat_ids[] = $cat_id;
|
readme.txt
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== FeedWordPress ===
|
2 |
+
Contributors: Charles Johnson
|
3 |
+
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.3.1
|
7 |
+
Stable tag: 0.991
|
8 |
+
|
9 |
+
FeedWordPress is an Atom/RSS aggregator for WordPress. When activated, it syndicates content from feeds you choose into your WordPress weblog.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
* Author: [Charles Johnson](http://radgeek.com/contact)
|
14 |
+
* Project URI: <http://projects.radgeek.com/feedwordpress>
|
15 |
+
* License: GPL 2. See License below for copyright jots and tittles.
|
16 |
+
|
17 |
+
FeedWordPress is an Atom/RSS aggregator for the WordPress weblog software. It
|
18 |
+
syndicates content from newsfeeds that you choose into your WordPress webblog;
|
19 |
+
if you syndicate several newsfeeds then you can use WordPress's posts database
|
20 |
+
and templating engine as the back-end of an aggregation ("planet") website. It
|
21 |
+
was developed, originally, because I needed a more flexible replacement for
|
22 |
+
[Planet](http://www.planetplanet.org/) to use at
|
23 |
+
[Feminist Blogs](http://feministblogs.org/).
|
24 |
+
|
25 |
+
FeedWordPress is designed with flexibility, ease of use, and ease of
|
26 |
+
configuration in mind. You'll need a working installation of WordPress or
|
27 |
+
WordPress MU (versions [2.3][], [2.2][], [2.1][], [2.0][] or [1.5][]), and also
|
28 |
+
FTP or SFTP access to your web host. The ability to create cron jobs on your web
|
29 |
+
host is helpful but not absolutely necessary. You *don't* need to tweak any
|
30 |
+
plain-text configuration files and you *don't* need shell access to your web
|
31 |
+
host to make it work. (Although, I should point out, web hosts that *don't*
|
32 |
+
offer shell access are *bad web hosts*.)
|
33 |
+
|
34 |
+
[2.3]: http://codex.wordpress.org/Version_2.3
|
35 |
+
[2.2]: http://codex.wordpress.org/Version_2.2
|
36 |
+
[2.1]: http://codex.wordpress.org/Version_2.1
|
37 |
+
[2.0]: http://codex.wordpress.org/Version_2.0
|
38 |
+
[1.5]: http://codex.wordpress.org/Version_1.5
|
39 |
+
|
40 |
+
== Installation ==
|
41 |
+
|
42 |
+
To use version 0.991 of FeedWordPress, you will need:
|
43 |
+
|
44 |
+
* an installed and configured copy of WordPress version 2.3.x, 2.2.x,
|
45 |
+
2.1.x, 2.0.x, or 1.5.x. (FeedWordPress will also work with the
|
46 |
+
equivalent versions of WordPress MU.)
|
47 |
+
|
48 |
+
* FTP or SFTP access to your web host
|
49 |
+
|
50 |
+
= New Installations =
|
51 |
+
|
52 |
+
1. Download the FeedWordPress archive in zip or gzipped tar format and
|
53 |
+
extract the files on your computer.
|
54 |
+
|
55 |
+
2. Create a new directory named `feedwordpress` in the `wp-content/plugins`
|
56 |
+
directory of your WordPress installation. Use an FTP or SFTP client to
|
57 |
+
upload the contents of your FeedWordPress archive to the new directory
|
58 |
+
that you just created on your web host.
|
59 |
+
|
60 |
+
3. Upgrade the copy of MagpieRSS packaged with WordPress by installing the
|
61 |
+
new copies of `rss.php` and `rss-functions.php` into the `wp-includes`
|
62 |
+
directory of your FeedWordPress installation. These files are stored in
|
63 |
+
the `MagpieRSS-upgrade` directory of your FeedWordPress archive. Strictly
|
64 |
+
speaking, upgrading MagpieRSS is optional; FeedWordPress will run
|
65 |
+
correctly without the upgrade. But if you hope to take advantage of
|
66 |
+
numerous bug fixes, or support for Atom 1.0, multiple post categories,
|
67 |
+
RSS enclosures, or multiple character encodings, then you need to
|
68 |
+
install the upgrade.
|
69 |
+
|
70 |
+
4. Log in to the WordPress Dashboard and activate the FeedWordPress plugin.
|
71 |
+
|
72 |
+
5. Once the plugin is activated, you can go to **Syndication --> Options**
|
73 |
+
and set (1) the link category that FeedWordPress will syndicate links
|
74 |
+
from (by default, "Contributors"), and (2) whether FeedWordPress will
|
75 |
+
use automatic updates or only manual updates.
|
76 |
+
|
77 |
+
5. Go to the main **Syndication** page to set up the list of sites that
|
78 |
+
you want FeedWordPress to syndicate onto your blog.
|
79 |
+
|
80 |
+
= Upgrades =
|
81 |
+
|
82 |
+
To *upgrade* an existing installation of FeedWordPress to version 0.991:
|
83 |
+
|
84 |
+
1. Download the FeedWordPress archive in zip or gzipped tar format and
|
85 |
+
extract the files on your computer.
|
86 |
+
|
87 |
+
2. If you are upgrading from version 0.98 or earlier, then you need to
|
88 |
+
create a new directory named `feedwordpress` in the `wp-content/plugins`
|
89 |
+
directory of your WordPress installation, and you also need to *delete*
|
90 |
+
your existing `wp-content/update-feeds.php` and
|
91 |
+
`wp-content/plugins/feedwordpress.php` files. The file structure for
|
92 |
+
FeedWordPress has changed and the files from your old version will not
|
93 |
+
be overwritten, which could cause conflicts if you leave them in place.
|
94 |
+
|
95 |
+
3. Upload the new PHP files to `wp-content/plugins/feedwordpress`,
|
96 |
+
overwriting any existing FeedWordPress files that are there. Also be
|
97 |
+
sure to upgrade the MagpieRSS module by uploading `rss.php` and
|
98 |
+
`rss-functions.php` from the `MagpieRSS-upgrade` directory in your
|
99 |
+
archive to the `wp-includes` directory of your WordPress installation.
|
100 |
+
|
101 |
+
3. If you are upgrading from version 0.96 or earlier, **immediately** log
|
102 |
+
in to the WordPress Dashboard, and go to **Options --> Syndicated**.
|
103 |
+
Follow the directions to launch the database upgrade procedure. The new
|
104 |
+
versions of FeedWordPress incorporate some long-needed improvements, but
|
105 |
+
old meta-data needs to be updated to prevent duplicate posts and other
|
106 |
+
possible maladies. If you're upgrading an existing installation, updates
|
107 |
+
and FeedWordPress template functions *will not work* until you've done
|
108 |
+
the upgrade. Then take a coffee break while the upgrade runs. It should,
|
109 |
+
hopefully, finish within a few minutes even on relatively large
|
110 |
+
databases.
|
111 |
+
|
112 |
+
4. If you are upgrading from version 0.98 or earlier, note that the old
|
113 |
+
`update-feeds.php` has been eliminated in favor of a (hopefully) more
|
114 |
+
humane method for automatic updating. If you used a cron job for
|
115 |
+
scheduled updates, it will not work anymore, but there is another,
|
116 |
+
simpler method which will. See [Setting Up Feed Updates](http://projects.radgeek.com/feedwordpress/install/#setting-up-feed-updates)
|
117 |
+
to get scheduled updates back on track.
|
118 |
+
|
119 |
+
5. Enjoy your new installation of FeedWordPress.
|
120 |
+
|
121 |
+
== Using and Customizing FeedWordPress ==
|
122 |
+
|
123 |
+
FeedWordPress has many options which can be accessed through the WordPress
|
124 |
+
Dashboard, and a lot of functionality accessible programmatically through
|
125 |
+
WordPress templates or plugins. For further documentation of the ins and
|
126 |
+
outs, see the documentation at the [FeedWordPress project homepage][].
|
127 |
+
|
128 |
+
[FeedWordPress project homepage]: http://projects.radgeek.com/feedwordpress/
|
129 |
+
|
130 |
+
== License ==
|
131 |
+
|
132 |
+
The FeedWordPress plugin is copyright © 2005-2007 by Charles Johnson. It uses
|
133 |
+
code derived or translated from:
|
134 |
+
|
135 |
+
- [wp-rss-aggregate.php][] by [Kellan Elliot-McCrea](kellan@protest.net)
|
136 |
+
- [MagpieRSS][] by [Kellan Elliot-McCrea](kellan@protest.net)
|
137 |
+
- [HTTP Navigator 2][] by [Keyvan Minoukadeh](keyvan@k1m.com)
|
138 |
+
- [Ultra-Liberal Feed Finder][] by [Mark Pilgrim](mark@diveintomark.org)
|
139 |
+
|
140 |
+
according to the terms of the [GNU General Public License][].
|
141 |
+
|
142 |
+
This program is free software; you can redistribute it and/or modify it under
|
143 |
+
the terms of the [GNU General Public License][] as published by the Free
|
144 |
+
Software Foundation; either version 2 of the License, or (at your option) any
|
145 |
+
later version.
|
146 |
+
|
147 |
+
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
148 |
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
149 |
+
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
150 |
+
|
151 |
+
[wp-rss-aggregate.php]: http://laughingmeme.org/archives/002203.html
|
152 |
+
[MagpieRSS]: http://magpierss.sourceforge.net/
|
153 |
+
[HTTP Navigator 2]: http://www.keyvan.net/2004/11/16/http-navigator/
|
154 |
+
[Ultra-Liberal Feed Finder]: http://diveintomark.org/projects/feed_finder/
|
155 |
+
|
156 |
+
[GNU General Public License]: http://www.gnu.org/copyleft/gpl.html
|
157 |
+
|
wp-content/plugins/feedwordpress/syndication-options.php → syndication-options.php
RENAMED
File without changes
|