FeedWordPress - Version 0.96

Version Description

Download this release

Release Info

Developer radgeek
Plugin Icon wp plugin FeedWordPress
Version 0.96
Comparing to
See all releases

Code changes from version 0.95 to 0.96

ChangeLog.text CHANGED
@@ -1,109 +1,150 @@
1
  Change Log
2
  ==========
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  Changes from 0.91 to 0.95
5
  -------------------------
6
 
7
- * BUG FIX: Fixed an obscure bug in the handling of categories: categories
8
- with trailing whitespace could cause categories with duplicate names to
9
- be created. This no longer happens. While I was at it I tightened up the
10
- operation of FeedWordPress::lookup_categories() a bit in general.
 
11
 
12
  * FEATURE DEPRECATED: the feed setting `hardcode categories` is now
13
- deprecated in favor of `unknown categories` (see below), which allows
14
- you to strip off any syndication categories not already in your database
15
- using `unknown categories: default` or `unknown categories: filter`. If
16
- you have `hardcode categories: yes` set on a feed, this will be treated
17
- as `unknown categories: default` (i.e., no new categories will be added,
18
- but if a post doesn't match any of the categories it will be added in
19
- the default category--usually "Uncategorized" or "General").
 
20
 
21
  * FEATURE: You can now set global defaults as to whether or not
22
- FeedWordPress will update the Link Name and Link Description settings
23
- for feeds automatically from the feed title and feed tagline. (By
24
- default, it does, as it has in past versions.) Whether this behavior is
25
- turned on or off, you can still override the default behavior using
26
- feed settings of `hardcode name: yes`, `hardcode name: no`,
27
- `hardcode description: yes`, or `hardcode description: no`.
 
28
 
29
- * FEATURE: Users can now provide one or several "aliases" for an author,
30
- just as they can for a category. For example, to make FeedWordPress
31
- treat posts by "Joseph Cardinal Ratzinger" and "Pope Benedict XVI" as
32
- by the same author, edit the user profile for Pope Benedict XVI and add
33
- a line like this to the "User profile" field:
34
 
35
  a.k.a.: Joseph Cardinal Ratzinger
36
 
37
- You can add several aliases, each on a line by itself. You can also add
38
- any other text you like to the Profile without interfering with the
39
- aliases.
40
 
41
- * FEATURE: Users can now choose how to handle syndicated posts that are
42
- in unfamiliar categories or by unfamiliar authors (i.e., categories or
43
- authors whose names are not yet in the WordPress database). By default,
44
- FeedWordPress will (as before) create a new category (or new author) and
45
- use it for the current post and any future posts. This behavior can be
46
- changed, either for all feeds or for one or another particular feed.
 
47
 
48
  There are now three different options for an unfamiliar author: (1)
49
  FeedWordPress can create a new author account and attribute the
50
- syndicated post to the new account; (2) FeedWordPress can attribute the
51
- post to an author if the author's name is familiar, and to a default
52
- author (currently, this means the Site Administrator account) if it is
53
- not; (3) FeedWordPress can drop posts by unfamiliar authors and
54
- syndicate only posts by authors who are already in the database.
 
55
 
56
- There are, similarly, two different options for an unfamiliar category:
57
- (1) FeedWordPress can create new categories and place the syndicated
58
- post in them; (2) FeedWordPress can drop the unfamiliar categories and
59
- place syndicated posts only in categories that it is already familiar
60
- with. In addition, FeedWordPress 0.95 lets you choose whether posts that
61
- are in *no* familiar categories should be syndicated (and placed in the
62
- default category for the blog) or simply dropped.
 
63
 
64
- You can set the default behavior for both authors and categories using
65
- the settings in Options --> Syndication. You can also set different
66
- behavior for specific feeds by adding the `unfamiliar author` and / or
67
- `unfamiliar categories` settings to the Link Notes section of a feed:
 
68
 
69
  unfamiliar author: (create|default|filter)
70
  unfamiliar categories: (create|default|filter)
71
 
72
- A setting of `unfamiliar author: create` will make FeedWordPress create
73
- new authors to match unfamiliar author names *for this feed alone*. A
74
- setting of `unfamiliar author: default` will make it assign posts from
75
- unfamiliar authors to the default user account. A setting of
76
- `unfamiliar author: filter` will cause all posts (from this feed alone)
77
- to be dropped unless they are by an author already listed in the
78
- database. Similiarly, `unfamiliar categories: create` will make
79
- FeedWordPress create new categories to match unfamiliar category names
80
- *for this feed alone*; `unfamiliar categories: default` will cause it
81
- to drop any unfamiliar category names; and
82
  `unfamiliar categories: filter` will cause it to *both* drop any
83
- unfamiliar category names *and* to only syndicate posts that are placed
84
- in one or more familiar categories.
85
 
86
- These two new features allow users to do some coarse-grained filtering
87
- without having to write a PHP filter. Specifically, they offer an easy
88
- way for you to filter feeds by category or by author. Suppose, for
89
- example, that you only wanted to syndicate posts that your contributors
90
- place in the "Llamas" category. You could do so by setting up your
91
- installation of WordPress so that the only category in the database is
92
- "Llamas," and then use Options --> Syndication to set "Unfamiliar
93
- categories" to "don't create new categories and don't syndicate posts
94
- unless they match at least one familiar category". Now, when you update,
95
- only posts in the "Llamas" category will be syndicated by FeedWordPress.
 
96
 
97
  Similarly, if you wanted to filter one particular feed so that only
98
  posts by (for example) the author "Earl J. Llama" were syndicated to
99
- your site, you could do so by creating a user account for Earl J. Llama,
100
- then adding the following line to the settings for the feed in Link
101
- Notes:
102
 
103
  unfamiliar author: filter
104
 
105
- This will cause any posts from this feed that are not authored by Earl
106
- J. Llama to be discarded, and only the posts by Earl J. Llama will be
107
- syndicated. (If the setting is used on one specific feed, it will not
108
- affect how posts from other feeds are syndicated.)
109
 
1
  Change Log
2
  ==========
3
 
4
+ Changes from 0.95 to 0.96
5
+ -------------------------
6
+
7
+ * FEATURE: support has been added for enclosures in RSS 2.0 and Atom
8
+ 0.6+ newsfeeds. WordPress already supports adding enclosures to an
9
+ item; FeedWordPress merely gets the information on the enclosure
10
+ from the feed it is syndicating and plugs that information directly
11
+ into the WordPress database so that (among other things) that post
12
+ will have its enclosure listed in your blog's RSS 2 newsfeed.
13
+
14
+ Note that enclosure support requires using the optional MagpieRSS
15
+ upgrade (i.e., replacing your `wp-includes/rss-functions.php` with `OPTIONAL/wp-includes/rss-functions.php` from the FWP archive)
16
+
17
+ * FEATURE: for completeness's sake, there is now a feed setting,
18
+ `hardcode url`, that allows you to set the URI for the front page
19
+ of a contributor's website manually (that is, prevent it from being
20
+ automatically updated from the feed channel link on each update). To
21
+ set the URI manually, put a line like this in the Link Notes section
22
+ of a feed:
23
+
24
+ hardcode url: yes
25
+
26
+ You can also instruct FeedWordPress to use hardcoded URIs by default
27
+ on all feeds using Options --> Syndication
28
+
29
+ * FEATURE: by default, when FeedWordPress finds new syndicated posts,
30
+ it (1) publishes them immediately, (2) turns comments off, and (3)
31
+ turns trackback / pingback pings off. You can now alter all three
32
+ default behaviors (e.g., to allow pings on syndicated posts, or to
33
+ send newly-syndicated posts to the draft pile for moderation) using
34
+ Options --> Syndication
35
+
36
+
37
  Changes from 0.91 to 0.95
38
  -------------------------
39
 
40
+ * BUG FIX: Fixed an obscure bug in the handling of categories:
41
+ categories with trailing whitespace could cause categories with
42
+ duplicate names to be created. This no longer happens. While I was
43
+ at it I tightened up the operation of
44
+ FeedWordPress::lookup_categories() a bit in general.
45
 
46
  * FEATURE DEPRECATED: the feed setting `hardcode categories` is now
47
+ deprecated in favor of `unknown categories` (see below), which
48
+ allows you to strip off any syndication categories not already in
49
+ your database using `unknown categories: default` or `unknown
50
+ categories: filter`. If you have `hardcode categories: yes` set on a
51
+ feed, this will be treated as `unknown categories: default` (i.e.,
52
+ no new categories will be added, but if a post doesn't match any of
53
+ the categories it will be added in the default category--usually
54
+ "Uncategorized" or "General").
55
 
56
  * FEATURE: You can now set global defaults as to whether or not
57
+ FeedWordPress will update the Link Name and Link Description
58
+ settings for feeds automatically from the feed title and feed
59
+ tagline. (By default, it does, as it has in past versions.) Whether
60
+ this behavior is turned on or off, you can still override the
61
+ default behavior using feed settings of `hardcode name: yes`,
62
+ `hardcode name: no`, `hardcode description: yes`, or `hardcode
63
+ description: no`.
64
 
65
+ * FEATURE: Users can now provide one or several "aliases" for an
66
+ author, just as they can for a category. For example, to make
67
+ FeedWordPress treat posts by "Joseph Cardinal Ratzinger" and "Pope
68
+ Benedict XVI" as by the same author, edit the user profile for Pope
69
+ Benedict XVI and add a line like this to the "User profile" field:
70
 
71
  a.k.a.: Joseph Cardinal Ratzinger
72
 
73
+ You can add several aliases, each on a line by itself. You can also
74
+ add any other text you like to the Profile without interfering with
75
+ the aliases.
76
 
77
+ * FEATURE: Users can now choose how to handle syndicated posts that
78
+ are in unfamiliar categories or by unfamiliar authors (i.e.,
79
+ categories or authors whose names are not yet in the WordPress
80
+ database). By default, FeedWordPress will (as before) create a new
81
+ category (or new author) and use it for the current post and any
82
+ future posts. This behavior can be changed, either for all feeds or
83
+ for one or another particular feed.
84
 
85
  There are now three different options for an unfamiliar author: (1)
86
  FeedWordPress can create a new author account and attribute the
87
+ syndicated post to the new account; (2) FeedWordPress can attribute
88
+ the post to an author if the author's name is familiar, and to a
89
+ default author (currently, this means the Site Administrator
90
+ account) if it is not; (3) FeedWordPress can drop posts by
91
+ unfamiliar authors and syndicate only posts by authors who are
92
+ already in the database.
93
 
94
+ There are, similarly, two different options for an unfamiliar
95
+ category: (1) FeedWordPress can create new categories and place the
96
+ syndicated post in them; (2) FeedWordPress can drop the unfamiliar
97
+ categories and place syndicated posts only in categories that it is
98
+ already familiar with. In addition, FeedWordPress 0.95 lets you
99
+ choose whether posts that are in *no* familiar categories should be
100
+ syndicated (and placed in the default category for the blog) or
101
+ simply dropped.
102
 
103
+ You can set the default behavior for both authors and categories
104
+ using the settings in Options --> Syndication. You can also set
105
+ different behavior for specific feeds by adding the `unfamiliar
106
+ author` and / or `unfamiliar categories` settings to the Link Notes
107
+ section of a feed:
108
 
109
  unfamiliar author: (create|default|filter)
110
  unfamiliar categories: (create|default|filter)
111
 
112
+ A setting of `unfamiliar author: create` will make FeedWordPress
113
+ create new authors to match unfamiliar author names *for this feed
114
+ alone*. A setting of `unfamiliar author: default` will make it
115
+ assign posts from unfamiliar authors to the default user account. A
116
+ setting of `unfamiliar author: filter` will cause all posts (from
117
+ this feed alone) to be dropped unless they are by an author already
118
+ listed in the database. Similiarly, `unfamiliar categories: create`
119
+ will make FeedWordPress create new categories to match unfamiliar
120
+ category names *for this feed alone*; `unfamiliar categories:
121
+ default` will cause it to drop any unfamiliar category names; and
122
  `unfamiliar categories: filter` will cause it to *both* drop any
123
+ unfamiliar category names *and* to only syndicate posts that are
124
+ placed in one or more familiar categories.
125
 
126
+ These two new features allow users to do some coarse-grained
127
+ filtering without having to write a PHP filter. Specifically, they
128
+ offer an easy way for you to filter feeds by category or by author.
129
+ Suppose, for example, that you only wanted to syndicate posts that
130
+ your contributors place in the "Llamas" category. You could do so by
131
+ setting up your installation of WordPress so that the only category
132
+ in the database is "Llamas," and then use Options --> Syndication to
133
+ set "Unfamiliar categories" to "don't create new categories and
134
+ don't syndicate posts unless they match at least one familiar
135
+ category". Now, when you update, only posts in the "Llamas" category
136
+ will be syndicated by FeedWordPress.
137
 
138
  Similarly, if you wanted to filter one particular feed so that only
139
  posts by (for example) the author "Earl J. Llama" were syndicated to
140
+ your site, you could do so by creating a user account for Earl J.
141
+ Llama, then adding the following line to the settings for the feed
142
+ in Link Notes:
143
 
144
  unfamiliar author: filter
145
 
146
+ This will cause any posts from this feed that are not authored by
147
+ Earl J. Llama to be discarded, and only the posts by Earl J. Llama
148
+ will be syndicated. (If the setting is used on one specific feed, it
149
+ will not affect how posts from other feeds are syndicated.)
150
 
OPTIONAL/wp-includes/rss-functions.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: 0.7wp
8
  * License: GPL
9
  *
10
  * Provenance:
@@ -34,8 +34,28 @@
34
  * 4. There are two WordPress-specific functions, get_rss() and wp_rss()
35
  *
36
  * 5. New cases added to MagpieRSS::feed_start_element(),
37
- * MagpieRSS::feed_end_element(), and MagpieRSS::normalize() to handle
38
- * multiple categories correctly.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  */
40
 
41
  define('RSS', 'RSS');
@@ -232,6 +252,15 @@ class MagpieRSS {
232
  $this->inimage = true;
233
  }
234
 
 
 
 
 
 
 
 
 
 
235
  # handle atom content constructs
236
  elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
237
  {
@@ -265,10 +294,22 @@ class MagpieRSS {
265
  //
266
  elseif ($this->feed_type == ATOM and $el == 'link' )
267
  {
268
- if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
 
269
  {
270
  $link_el = 'link';
271
  }
 
 
 
 
 
 
 
 
 
 
 
272
  else {
273
  $link_el = 'link_' . $attrs['rel'];
274
  }
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.7wp (2005.05.07)
8
  * License: GPL
9
  *
10
  * Provenance:
34
  * 4. There are two WordPress-specific functions, get_rss() and wp_rss()
35
  *
36
  * 5. New cases added to MagpieRSS::feed_start_element(),
37
+ * MagpieRSS::feed_end_element(), and MagpieRSS::normalize() to handle:
38
+ *
39
+ * (a) Multiple categories
40
+ * (b) RSS 2.0 and Atom 0.6+ enclosures
41
+ *
42
+ * Categories are stored in $item['category'], $item['categories'],
43
+ * $item['dc']['subject'], and $item['dc']['subjects'] (the singular keys
44
+ * point to string values for the first category used; the plural keys
45
+ * point to an array of all the categories the item is in)
46
+ *
47
+ * Enclosures are stored in the array $item['enclosure'] as suggested
48
+ * at <http://magpie.laughingmeme.org/blog/?p=101>. So the URL of the first
49
+ * enclosure is $item['enclosure'][0]['url']; the length is
50
+ * $item['enclosure'][0]['length']; and the type is
51
+ * $item['enclosure'][0]['type']
52
+ *
53
+ * Note that these are hacked-in solutions for inherited problems with
54
+ * MagpieRSS as of version 0.7. They are not guaranteed to be
55
+ * forward-compatible when/if Kellan solves these problems in the official
56
+ * Magpie branch in the future. If you have filters (for example) that
57
+ * depend on either categories or enclosures working as they currently do,
58
+ * keep an eye on the ChangeLog in future releases.
59
  */
60
 
61
  define('RSS', 'RSS');
252
  $this->inimage = true;
253
  }
254
 
255
+ # -- Handle RSS 2 enclosures. Suggested by <http://magpie.laughingmeme.org/blog/?p=101>
256
+ elseif (
257
+ $this->feed_type == RSS and
258
+ $el == 'enclosure' )
259
+ {
260
+ $this->current_item[$el][] = $attrs;
261
+ $this->incontent = $el;
262
+ }
263
+
264
  # handle atom content constructs
265
  elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
266
  {
294
  //
295
  elseif ($this->feed_type == ATOM and $el == 'link' )
296
  {
297
+ # -- CWJ: Treat <link> elements without explicit rel as rel="alternate"
298
+ if ( !isset($attrs['rel']) or isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
299
  {
300
  $link_el = 'link';
301
  }
302
+ # -- CWJ: support Atom 0.6+ enclosures
303
+ elseif ( isset($attrs['rel']) and $attrs['rel'] == 'enclosure' )
304
+ {
305
+ $link_el = 'link_' . $attrs['rel'];
306
+
307
+ # -- CWJ: Normalize to RSS 2.0 enclosure handling
308
+ $n = count($this->current_item[$attrs['rel']]);
309
+ $this->current_item[$attrs['rel']][$n] = $attrs;
310
+ $this->current_item[$attrs['rel']][$n]['url'] =
311
+ $this->current_item[$attrs['rel']][$n]['href'];
312
+ }
313
  else {
314
  $link_el = 'link_' . $attrs['rel'];
315
  }
README.text CHANGED
@@ -2,7 +2,7 @@ FeedWordPress
2
  =============
3
 
4
  * Author: [Charles Johnson](http://www.radgeek.com/contact)
5
- * Version: 0.95
6
  * Project URI: <http://projects.radgeek.com/feedwordpress>
7
  * License: GPL. See License below for copyright jots and tittles.
8
 
@@ -10,21 +10,22 @@ Introduction
10
  ------------
11
  FeedWordPress is an Atom/RSS aggregator for WordPress. It syndicates content
12
  from newsfeeds that you select into your WordPress blog; if you syndicate
13
- several newsfeeds then you can WordPress's posts database and templating engine
14
- as the back-end of an aggregation ("planet") website. I originally developed it
15
- because I needed a more flexible replacement for [Planet][] to use at
16
- [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 1.5][]
23
- and FTP or SFTP access to your web host. The ability to create cron jobs on your
24
- web host would be very helpful but it's not absolutely necessary. You *don't*
25
- need to tweak any plain-text configuration files and you *don't* need shell
26
- access to your web host to make it work. (Although, I should point out, web
27
- hosts that *don't* offer shell access are *bad web hosts*.)
 
28
 
29
  [WordPress 1.5]: http://wordpress.org/development/2005/02/strayhorn/
30
 
@@ -35,34 +36,44 @@ SFTP access to your web space. You'll probably also want to have either (1)
35
  the ability to create cron jobs on your web host, or (2) a computer of your
36
  own that has always-on Internet access.
37
 
38
- 1. Install `feedwordpress.php` in your WordPress `plugins` directory and
39
- `update.php` in your WordPress `wp-content` directory.
40
 
41
  2. (Optional) Upgrade the copy of MagpieRSS packaged with WordPress by
42
  installing the new `rss-functions.php` (archived in
43
  `OPTIONAL/wp-includes`) into your WordPress `wp-includes` directory.
44
-
45
- 3. Log in to the WordPress Dashboard and activate the FeedWordPress plugin.
46
- Go to Options --> Syndication to set up initial settings for the
47
- syndication link category ("Contributors") by default and the RPC secret
48
- word (blank by default, but you should probably set it to something.)
 
 
 
 
 
 
 
 
 
49
 
50
  4. Set up links for syndication from the WordPress Dashboard using
51
  Links --> Syndicated or Links --> Import.
52
 
53
- 5. FeedWordPress is now *ready* to feed syndicated content into WordPress.
54
- In order for it to actually receive that content, either (1) have your
55
- contributors add WordPress's XML-RPC URI to their blog's list of URIs
56
- to ping when they update posts, (2) set up a cron job to check in on all
57
- the feeds on a regular basis, or (3) both. If you do (2), you can either
58
- set up a job to run `php update-feeds.php` on your web host, or set one
59
- up on any computer with always-on Internet access to request
60
- `update-feeds.php` over the web.
 
61
 
62
- If your copy of WordPress is installed at <http://www.zyx.com/blog>, and
63
- you set the secret word for XML-RPC pings to "foo", then your XML-RPC
64
- URI will be <http://www.zyx.com/blog/xmlrpc.php>, and the URI to request
65
- for `update-feeds.php` to update all feeds will be
66
  <http://www.zyx.com/blog/wp-content/update-feeds.php?shibboleth=foo>
67
 
68
  For detailed installation instructions, point your web browser to
@@ -70,14 +81,14 @@ For detailed installation instructions, point your web browser to
70
 
71
  Basic Concepts
72
  --------------
73
- FeedWordPress is written as a plugin for [WordPress 1.5][]. It is designed to
74
- store all the data it needs within the WordPress database and to make that data
75
- easy to manage from within the WordPress Dashboard.
76
 
77
  ### Contributors / Newsfeeds ###
78
 
79
- FeedWordPress uses the WordPress Links database to keep a list of the feeds from
80
- which it will syndicate content. WordPress allows you to place links in
81
  categories; FeedWordPress will treat all and only the links in one category
82
  (by default, this is a category named "Contributors"; you can change the
83
  category that FeedWordPress will use using Options --> Syndication).
@@ -85,15 +96,15 @@ category that FeedWordPress will use using Options --> Syndication).
85
  From WordPress's perspective, the list of Contributors are normal links, and
86
  they can be manipulated like other links through the WordPress Dashboard. If
87
  you need to add, remove, or change information for any contributors, you can
88
- do so easily under Links --> Syndicated. If you want to distribute the labor of
89
- adding, updating, and managing feeds, you can use the WordPress login and
90
- access privileges system. Users with an access level of 5 or greater can add,
91
- delete, and modify Contributors; users with an access level of 6 or greater can
92
- change syndication options.
93
 
94
- When FeedWordPress looks for new posts, it does so by retrieving one or all of
95
- the links from the Contributors category (depending on whether it has been told
96
- to scan for new posts on one or all of the feeds).
97
 
98
  __Feed settings:__ All of the information for a syndicated feed is stored in
99
  the WordPress Links database. Feeds in the category to be syndicated (by
@@ -101,15 +112,16 @@ default, "Contributors") use several fields of the standard WordPress Link
101
  record:
102
 
103
  - The RSS URI is used to store the URI for the feed to be syndicated.
104
- (Note that this is *not* the same as the Link URI. The Link URI points
105
- to the human-readable *front page* of the website that the feed
106
- syndicates.)
107
 
108
  - The Link URI is used to store a URI to the human-readable front page
109
- (*not* the feed!) of the syndicated website. FeedWordPress automatically
110
- updates this URI using the URI that is reported by the newsfeed whenever
111
- it checks the feed for new posts, so if the page moves this will be
112
- reflected automatically on your Contributors links list.
 
113
 
114
  - The Link Name is used to store the title of the syndicated website.
115
  By default, FeedWordPress automatically updates the name of the link
@@ -122,18 +134,18 @@ record:
122
  `hardcode name`.
123
 
124
  - The Short Description is used to store the tagline of the syndicated
125
- website. By default, FeedWordPress automatically updates the description
126
- whenever it checks for new posts, using the tagline or description that
127
- the newsfeed reports (so that if a Contributor changes the tagline of
128
- her website, this is reflected automatically on your Contributors links
129
- list). his behavior can be turned off for all feeds through the
130
- settings in Options --> Syndication. The default behavior can be
131
- overridden for specific feeds using the feed setting
132
- `hardcode description`.
133
-
134
- - The Link Notes are used to store a collection of manually-encoded and
135
- automatically-generated settings that apply to this feed. The format of
136
- settings in Link Notes is:
137
 
138
  key1: value1
139
  key2: value2
@@ -141,13 +153,13 @@ record:
141
  feed/key2: value2
142
 
143
  And so on. Values that are prefixed by 'feed/' are automatically
144
- generated from feed data every time the feed syndicated by this link is
145
- checked for updates. Values without the prefix are set manually by the
146
- user.
147
 
148
  The Link Notes section can be used to add, remove, and change custom feed
149
- settings. For example, if you want to *add* the feed setting for
150
- `unfamiliar author` with the value `filter`, you can do so by going to Links -->
151
  Syndicated, clicking the "Edit" link for the feed that you wish to add this
152
  setting for, and then adding the following, on a line by itself, to the Link
153
  Notes section:
@@ -155,30 +167,31 @@ Notes section:
155
  unfamiliar author: filter
156
 
157
  To remove the setting, follow the same procedure, but find the line for the
158
- feed setting that you want to remove and remove it. To change the value, simply
159
- change the text that follows after the colon.
160
 
161
- Most settings in the Link Notes have no effect on FeedWordPress, but you can use
162
- them to store information for templates to retrieve using the `get_feed_meta()`
163
- template function in a post context (see Template API below). For example, many
164
- aggregator sites use a "face" image for each feed to visually distinguish posts
165
- from different feeds. To implement a face feature, you could add something
166
- like this to each feed's Link Notes, on a line by itself:
 
167
 
168
  face: http://www.zyx.com/mugs/ugly
169
 
170
- The URI should be changed out for each feed to point to the appropriate image,
171
- of course. Then, to use the setting from within a template:
172
 
173
- // In a post context
174
- <?php $img = get_feed_meta('face'); if (strlen($img) > 0): ?>
175
- <img src="<?=$img?>" alt="" />
176
- <?php endif; ?>
177
 
178
- ... which will display the image, if any, whose URI is set in the "face" setting
179
- for the feed that post comes from. If there is no "face" setting for a
180
- particular feed, ``get_feed_meta()`` will return an empty string and no image
181
- will be displayed.
182
 
183
  Not all feed settings are only for templates. Some affect how FeedWordPress
184
  processes posts from that feed. Currently, the settings with special effects
@@ -191,16 +204,18 @@ effects, see Special Feed Settings below.
191
 
192
  Whenever FeedWordPress updates, it scans one or more of the feeds in its
193
  Contributors list and adds any new posts that it finds to the WordPress
194
- database. Syndicated posts are displayed on your WordPress pages like any other
195
- posts: they can be listed in archives by category, author, or date; they can be
196
- found with the search box; and they are included in the newsfeed of your blog.
 
197
 
198
  In your WordPress templates (Presentation --> Theme Editor) you can access
199
  special information about syndicated posts using functions provided by
200
  FeedWordPress, such as `is_syndicated()`, `the_syndication_source()`,
201
  `the_syndication_source_link()`, and `get_feed_meta()`. For example, here is
202
- the template code that I use (in a post context) to display both the author's
203
- name and the original source of the post in the templates for [Feminist Blogs][]:
 
204
 
205
  <cite class="feed">from <?php the_author_posts_link()?><?php
206
  if (is_syndicated() and (get_the_author() !== get_syndication_source())):
@@ -213,21 +228,21 @@ For more information on template functions, see Template API below.
213
 
214
  ### Categories ###
215
 
216
- WordPress allows for posts to be placed in *categories*. Each syndicated post
217
- that FeedWordPress adds to the WordPress database is placed into a set of
218
- categories. FeedWordPress gets the list of category names to use from two
219
  sources:
220
 
221
- 1. Categories (or "tags") that the original author placed the post in on
222
- her blog
223
 
224
  2. Categories that you set explicitly for each feed using the `cats`
225
- feed setting. For example, if you wanted all the posts from Alas, A Blog
226
- to be placed in the "Pacific Northwest" category and the "Cartoonists"
227
- category (in addition to any categories that they were placed in on
228
- Alas, A Blog), you could do this by going to Links --> Syndicated,
229
- clicking the "Edit" link for Alas, A Blog, and adding the following line
230
- to the Link Notes section:
231
 
232
  cats: Pacific Northwest:Cartoonists
233
 
@@ -239,158 +254,165 @@ WordPress database with the same name as either (1) the category name, or
239
 
240
  __Aliases:__ Different often authors use slightly different names for
241
  categories that mean the same thing (contributors to Feminist Blogs, for
242
- example, used categories including "Feminism", "feministy stuff",
243
- "Women's Issues", "Gender Issues", "Gender Equality", and so on). If you want
244
  FeedWordPress to treat one category name as a synonym for another, you can
245
  do so by creating an "alias" for the category. For example, to make
246
- FeedWordPress treat posts that are placed in the category "feministy stuff" as
247
- if they had been placed in the category "Feminism", go to Manage --> Categories,
248
- find the category "Feminism" and click the "Edit" link for it, and then add
249
- the following to the Description field, on a line by itself:
250
 
251
  a.k.a.: feministy stuff
252
 
253
- You can add as many aliases as you like. You can also add any other text that
254
- you like to the Description without interfering with FeedWordPress's ability to
255
- use the aliases. Each alias must be on a line by itself.
256
 
257
  __Unfamiliar categories:__ By default, if one of the category names that a
258
  newsfeed provides is unfamiliar -- that is, if there is not yet any category
259
  with that name (or with that name as an alias) in your WordPress database --
260
- then by default FeedWordPress will *automatically create* a new category with
261
- that name and place the current post in it. The default behavior can be changed,
262
- using either the global settings in Options --> Syndication or the
263
- `unfamiliar categories` feed setting (see Feed Settings above), so that unfamiliar
264
- categories will not be added to the database. If you choose to disable the
265
- creation of new categories, you can also choose whether or not FeedWordPress
266
- should syndicate posts that do not match *any* of the categories that are
267
- currently in the database.
268
-
269
- One of the uses of this feature is filtering posts by category: if you want to
270
- your blog to syndicate only the posts in one particular category from a feed
271
- that has several categories, you could do so by creating a category by that
272
- name, adding the new feed(s), and then adding the following line to the Link
273
- Notes section of the feed(s) that you want to filter:
274
 
275
  unfamiliar categories: filter
276
 
277
- Since only posts in categories that are in your database will be included, and
278
- only the category or categories that you wanted posts from has been added to
279
- your database, this will filter out all the posts that aren't in the category
280
- or categories that you defined ahead of time. (Similarly, you could set up
281
- FeedWordPress so that *all* the feeds are filtered by author by creating the set
282
- of users named after the authors you want to syndicate, and then setting the
283
- default behavior for *all* feeds at Options --> Syndication).
 
284
 
285
- If you need a category filter with more complex logic, you can always create a
286
- `syndicated_item` filter in PHP (see Plugin API below) that manipulates the
287
- `['categories']` array of a syndicated item.
288
 
289
  ### Authors ###
290
 
291
  Most newsfeeds include information about the author of the items on them.
292
  (If a feed doesn't, then FeedWordPress will create an author's name based on
293
- the title of the feed from which the item was taken.) This information is used
294
- to determine the WordPress user that the post will be attributed to. Given the
295
- name of the author, FeedWordPress looks for authors in the WordPress database
296
- with the same name as either (1) their login, (2) their first name, (3) their
297
- nickname, (4) their full name, or (5) one of the "aliases" listed in the
298
- user's profile.
299
 
300
  __Aliases:__ If there is an author who posts under more than one name (for
301
  example, one of our contributors at [Feminist Blogs][] posts on several
302
  different blogs, sometimes using her full name and sometimes using only her
303
- first name), then you can ensure that FeedWordPress will attribute those posts
304
- to the same author by creating "aliases" for the author. For example, to make
305
- FeedWordPress treat posts by "Joseph Cardinal Ratzinger" and posts by "Pope
306
- Benedict XVI" as having the same author, go to Users --> Authors & Users, click
307
- on the "Edit" link for Pope Benedict XVI, and add a line like this to the
308
- Profile text:
309
 
310
  a.k.a.: Joseph Cardinal Ratzinger
311
 
312
- You can add as many aliases as you like. You can also add any other text that
313
- you like to the Profile without interfering with FeedWordPress's ability to use
314
- the aliases. Each alias must be on a line by itself.
315
 
316
  __Unfamiliar authors:__ By default, if the author named by the newsfeed is
317
  unfamiliar -- that is, if there is no-one with that name registered in the
318
- WordPress author's database -- then by default FeedWordPress will automatically
319
- create a new user account with the given name and attribute the post to the new
320
- user. The default behavior can be changed, using either the global settings in
321
- Options --> Syndication or the `unfamiliar author` feed setting (see Feed
322
- Settings above), so that posts by unfamiliar authors will either be attributed
323
- to a default author (instead of creating a new user account to attribute them
324
- to), or filtered out and not syndicated at all.
 
325
 
326
  One of the uses of this feature is filtering posts by author: if you want to
327
- your blog to syndicate only the posts by one particular author from a feed that
328
- has several authors, you could do so by creating a user account with that
329
- author's name, adding the new feed(s), and then adding the following line to the
330
- Link Notes section of the feed(s) that you want to filter:
331
 
332
  unfamiliar author: filter
333
 
334
- Since only posts by authors that are in your database will be included, and only
335
- the author that you wanted posts from has been added to your database, this will
336
- filter out posts by anyone else on the feeds with that setting. (Similarly, you
337
- could set up FeedWordPress so that *all* the feeds are filtered by author by
338
- creating the set of users named after the authors you want to syndicate, and
339
- then setting the default behavior for *all* feeds at Options --> Syndication).
340
-
341
- If you need an author filter with more complex logic than this allows, you can
342
- always create a `syndicated_item` filter in PHP (see Plugin API below) that
343
- manipulates the `['author_name']` or `['dc']['creator']` elements of a
 
344
  syndicated item.
345
 
346
  Special Feed Settings
347
  ---------------------
348
  Most feed settings (see Feed Settings above) have no effect on FeedWordPress
349
- itself, but can be useful because they can be accessed from templates using the
350
- `get_feed_meta()` template function in a post context (see Feed Settings above
351
- for an example). However, you can use some feed settings to affect how
352
  FeedWordPress will process posts from that particular feed. Currently, these
353
  special settings are:
354
 
355
- - `cats:` a colon-separated list of default categories for any post coming
356
- from this feed. So, for example, a this line in its Notes section:
 
357
 
358
  cats: computers:web
359
 
360
- ... will make FeedWordPress place any posts syndicated from that feed in
361
- the "computers" and "web" categories. Note that by default,
362
- FeedWordPress will place them in those categories *in addition to* any
363
- categories that the author of the post put them in on her own website.
364
- If you want to place posts from a feed *only* in the categories you
365
- explicitly set, then you should use the `cats` setting together with
366
- the `unfamiliar categories` setting. (See Categories above and
367
- `unfamiliar categories` below for the nitty-gritty.)
 
368
 
369
  - `hardcode name: (yes|no)`
370
 
371
  By default, FeedWordPress updates the value of the Link Name field
372
  automatically to reflect the title that is reported by a syndicated
373
  feed--so that if one of your contributors changes the title of her
374
- website, the change will be reflected on your Contributors list after
375
- the next update. If you want to stop this behavior (so that you can
376
- set the title of a Contributor link manually -- e.g. so that you can use
377
- an abbreviated form for reasons of space), you can change the default
378
- behavior for *all* feeds using the settings in Options --> Syndication.
379
- If you want to override the default behavior for only *one* feed, you
380
- can use the `hardcode name` feed setting. If FeedWordPress updates the
381
- title of all feeds by default, but you wish to use a manually-set title
382
- for one particular feed, you can add a line like this to the Link Notes
383
- section of the feed that you want to manually set the title for:
 
384
 
385
  hardcode name: yes
386
 
387
- Similarly, if FeedWordPress uses your manually-entered titles for all
388
- feeds by default, but you wish to use an automatically updated title for
389
- one particular feed, you can add a line like this to the Link Notes
390
- section of the feed that you want to manually set the title for:
391
-
 
392
  hardcode name: no
393
-
394
  If `hardcode name` is absent, or set to a value other than `yes` or
395
  `no`, FeedWordPress will follow the default behavior set under
396
  Options --> Syndication.
@@ -401,143 +423,212 @@ special settings are:
401
  field automatically to reflect the tagline or description that is
402
  reported by a syndicated feed--so that if one of your contributors
403
  changes the tagline for her website, the change will be reflected on
404
- your Contributors list after the next update. If you want to stop this
405
- behavior (so that you can set the taglien of a Contributor link manually
406
- -- e.g. so that you can use it to provide information of another sort or
407
- use an abbreviated form for reasons of space), you can change the
408
- default behavior for *all* feeds using the settings in Options -->
409
- Syndication. If you want to override the default behavior for only *one*
410
- feed, you can use the `hardcode description` feed setting. If
411
- FeedWordPress updates the description of all feeds by default, but you
412
- wish to use a manually-set description for one particular feed, you can
413
- add a line like this to the Link Notes section of that particular feed:
 
414
 
415
  hardcode description: yes
416
 
417
- Similarly, if FeedWordPress uses your manually-entered descriptions for
418
- all feeds by default, but you wish to use an automatically updated
419
- description for one particular feed, you can add a line like this to the
420
- Link Notes section of that particular feed:
421
 
422
  hardcode description: no
423
 
424
- If `hardcode description` is absent, or set to a value other than `yes`
425
- or `no`, FeedWordPress will follow the default behavior set under
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
426
  Options --> Syndication.
427
 
428
  - `hardcode categories: (yes|no)`
429
 
430
- **This setting has been deprecated.** If set to `yes` it is now treated
431
- as equivalent to `unfamiliar categories: default`. (See below.)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
432
 
433
- - `post status:` sets the default post status for posts from this feed
434
- This can be 'publish', 'draft', or 'private'. By default, it is set to
435
- 'publish' (syndicated posts go online immediately).
436
 
437
- - `comment status:` sets the default status for comments on posts
438
- syndicated from this feed. By default, all comments on syndicated posts
439
- are closed, but you can set it to 'open', 'closed', or 'registered_only'
440
- for particular feeds.
 
 
 
 
 
 
 
441
 
442
- - `ping status:` sets the default status for receiving TrackBack and
443
- PingBack pings on posts syndicated from this feed. By default,
444
- syndicated posts are closed to pings, but you can set this to 'open' or
445
- 'closed' for particular feeds.
446
 
447
  - `unfamiliar authors: (create|default|filter)`
448
 
449
- By default, FeedWordPress creates new author accounts whenever it finds
450
- a new post that is by an author whose name is not already in the
451
- WordPress database, and uses that account for this post and any future
452
- posts by an author of that name. FeedWordPress also allows you to
453
- attribute posts by unfamiliar authors to a *default* user account
454
- (currently, this means the System Administrator account), *instead of*
455
- creating a new author, or simply not to syndicate posts by unfamiliar
456
- authors (thus only syndicating posts by authors who are already in the
457
- database).
458
 
459
  Which of these FeedWordPress does by default can be set using the
460
- settings in Options --> Syndicated. You can also override the default
461
- behavior for specific feeds by adding the `unfamiliar author` feed
462
- setting to the Link Notes section of a feed. For example, to ensure that
463
- FeedWordPress filters out posts by unfamiliar authors for one particular
464
- feed, add the setting:
465
 
466
  unfamiliar author: filter
467
 
468
- To ensure that FeedWordPress assigns posts by unfamiliar authors to the
469
- default user account instead of creating a new user account, add the
470
- setting:
471
 
472
  unfamiliar author: default
473
 
474
- If you changed the default behavior under Options --> Syndicated but
475
- want to ensure that FeedWordPress creates new author accounts for
476
- unfamiliar authors on one specific feed, add the setting:
477
 
478
  unfamiliar author: create
479
 
480
- If the setting is anything other than `create`, `default`, or `filter`,
481
- FeedWordPress will ignore the setting and follow the default behavior
482
- that you specified under Options --> Syndication.
483
 
484
  - `unfamiliar categories: (create|default|filter)`
485
 
486
  By default, FeedWordPress creates categories whenever it finds a new
487
  post that is placed in categories whose names are not already in the
488
- WordPress database. FeedWordPress allows you to change this behavior,
489
- so that it will *not* create new category names. It also allows you to
490
- choose whether or not posts must match *at least one* familiar category
491
- to be syndicated at all.
492
 
493
  Which of these FeedWordPress does by default can be set using the
494
- settings in Options --> Syndicated. You can also override the default
495
- behavior for specific feeds by adding the `unfamiliar categories` feed
496
- setting to the Link Notes section of a feed. For example, to ensure
497
- that, when adding new posts from *one particular feed*, FeedWordPress
498
- does *not* create new categories, and filters out any posts that don't
499
- match *at least one* of the categories that you have already defined,
500
- add the setting:
501
 
502
  unfamiliar categories: filter
503
 
504
  To ensure that FeedWordPress does *not* create new categories, but
505
- *will* still syndicate categories even if they don't match any of the
506
- pre-defined categories, add the following to the feed settings:
507
 
508
  unfamiliar categories: default
509
 
510
- If you changed the default behavior under Options --> Syndicated but
511
- want to ensure that FeedWordPress creates new categories for posts
512
- from one particular feed, add the setting:
513
 
514
  unfamiliar categories: create
515
 
516
- If the setting is anything other than `create`, `default`, or `filter`,
517
- FeedWordPress will ignore the setting and follow the default behavior
518
- that you specified under Options --> Syndication.
519
 
520
  Template API
521
  ------------
522
- When activated, FeedWordPress makes the following functions available for use by
523
- themes/templates:
524
 
525
- * ``is_syndicated()``: in a post context, returns ``TRUE`` if the post was
526
- syndicated from another website, or ``FALSE`` if it was originally
527
- posted here
528
 
529
- * ``get_syndication_permalink()``: in a post context, returns the URI of
530
- the permalink for this post *on the website it was syndicated from*
531
 
532
- * ``the_syndication_permalink()``: in a post context, outputs the value
533
- returned by ``get_syndication_permalink()``
534
 
535
- * ``get_syndication_source_link()``: in a post context, returns the URI of
536
- the front page (*not* the feed) of the website this post was syndicated
537
- from
538
 
539
- * ``the_syndication_source_link()``: in a post context, outputs the URI
540
- returned by ``get_syndication_source_link()``
541
 
542
  * ``get_syndication_source()``: in a post context, returns the
543
  human-readable title of the website that a syndicated post was
@@ -546,55 +637,56 @@ themes/templates:
546
  * ``the_syndication_source()``: in a post context, outputs the value
547
  returned by ``get_syndication_source()``
548
 
549
- * ``get_syndication_feed():`` in a post context, returns the URI of the
550
- feed (*not* the front page) that this post was syndicated from
551
 
552
  * ``the_syndication_feed()``: in a post context, outputs the value
553
  returned by ``get_syndication_feed()``
554
 
555
- * ``get_feed_meta($key)``: in a post context, returns the value, if any,
556
- of the feed setting ``$key`` for the feed that this post was syndicated
557
- from
558
 
559
  By default, FeedWordPress also places a filter on the standard functions
560
- ``get_permalink()`` and ``the_permalink()`` that substitutes the URI returned by
561
- ``get_syndication_permalink()`` for the URI generated by WordPress. This means
562
- that by default the permalinks listed on your website and in your newsfeed will
563
- link to the location of the posts on the source website, *not* to their location
564
- on your website. You can switch this behavior on or off at Options -->
565
- Syndication in the WordPress Dashboard.
566
 
567
  ### Plugin API ###
568
 
569
- FeedWordPress creates five hooks through the WordPress plugin architecture that
570
- you can plug in to using PHP WordPress plugins, to supplement ordinary
571
- FeedWordPress behavior, or to filter posts according to criteria that you set.
572
- The hooks are the action ``feedwordpress_update``, the action
573
- ``feedwordpress_check_feed``, the action ``feedwordpress_update_complete``, the
574
- filter ``syndicated_item``, the filter ``syndicated_post``, the action
575
  ``post_syndicated_item``, and the action ``update_syndicated_item``.
576
 
577
  For more information, see <http://projects.radgeek.com/feedwordpress/api>.
578
 
579
  License
580
  -------
581
- The FeedWordPress plugin is copyright (c) 2005 by Charles Johnson. It uses code
582
- derived or translated from:
583
 
584
- - [wp-rss-aggregate.php][] by [Kellan Elliot-McCrea](kellan@protest.net)
585
- - [HTTP Navigator 2][] by [Keyvan Minoukadeh](keyvan@k1m.com)
586
- - [Ultra-Liberal Feed Finder][] by [Mark Pilgrim](mark@diveintomark.org)
587
 
588
  according to the terms of the [GNU General Public License][].
589
 
590
- This program is free software; you can redistribute it and/or modify it under
591
- the terms of the [GNU General Public License][] as published by the Free Software
592
- Foundation; either version 2 of the License, or (at your option) any later
593
- version.
594
 
595
- This program is distributed in the hope that it will be useful, but WITHOUT ANY
596
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
597
- PARTICULAR PURPOSE. See the GNU General Public License for more details.
 
598
 
599
  [wp-rss-aggregate.php]: http://laughingmeme.org/archives/002203.html
600
  [HTTP Navigator 2]: http://www.keyvan.net/2004/11/16/http-navigator/
2
  =============
3
 
4
  * Author: [Charles Johnson](http://www.radgeek.com/contact)
5
+ * Version: 0.96
6
  * Project URI: <http://projects.radgeek.com/feedwordpress>
7
  * License: GPL. See License below for copyright jots and tittles.
8
 
10
  ------------
11
  FeedWordPress is an Atom/RSS aggregator for WordPress. It syndicates content
12
  from newsfeeds that you select into your WordPress blog; if you syndicate
13
+ several newsfeeds then you can WordPress's posts database and templating
14
+ engine as the back-end of an aggregation ("planet") website. I originally
15
+ developed it because I needed a more flexible replacement for [Planet][] to
16
+ 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
23
+ 1.5][] and FTP or SFTP access to your web host. The ability to create cron
24
+ jobs on your web host would be very helpful but it's not absolutely
25
+ necessary. You *don't* need to tweak any plain-text configuration files and
26
+ you *don't* need shell access to your web host to make it work. (Although, I
27
+ should point out, web hosts that *don't* offer shell access are *bad web
28
+ hosts*.)
29
 
30
  [WordPress 1.5]: http://wordpress.org/development/2005/02/strayhorn/
31
 
36
  the ability to create cron jobs on your web host, or (2) a computer of your
37
  own that has always-on Internet access.
38
 
39
+ 1. Install `feedwordpress.php` in your WordPress `plugins` directory
40
+ and `update.php` in your WordPress `wp-content` directory.
41
 
42
  2. (Optional) Upgrade the copy of MagpieRSS packaged with WordPress by
43
  installing the new `rss-functions.php` (archived in
44
  `OPTIONAL/wp-includes`) into your WordPress `wp-includes` directory.
45
+ Upgrading MagpieRSS is necessary if you want to take advantage of
46
+ support for multiple post categories, RSS enclosures, and multiple
47
+ character encodings. (Note, however, that support for
48
+ transliterating between character encodings is a very complex and
49
+ iffy prospect in some PHP environments, so if you intend to use
50
+ a lot of feeds with alternate encodings you should make sure that
51
+ your installation of PHP is up-to-date and that you keep a copy of
52
+ the old MagpieRSS around to compare results.)
53
+
54
+ 3. Log in to the WordPress Dashboard and activate the FeedWordPress
55
+ plugin. Go to Options --> Syndication to set up initial settings for
56
+ the syndication link category ("Contributors") by default and the
57
+ RPC secret word (blank by default, but you should probably set it to
58
+ something.)
59
 
60
  4. Set up links for syndication from the WordPress Dashboard using
61
  Links --> Syndicated or Links --> Import.
62
 
63
+ 5. FeedWordPress is now *ready* to feed syndicated content into
64
+ WordPress. In order for it to actually receive that content, either
65
+ (1) have your contributors add WordPress's XML-RPC URI to their
66
+ blog's list of URIs to ping when they update posts, (2) set up a
67
+ cron job to check in on all the feeds on a regular basis, or (3)
68
+ both. If you do (2), you can either set up a job to run `php
69
+ update-feeds.php` on your web host, or set one up on any computer
70
+ with always-on Internet access to request `update-feeds.php` over
71
+ the web.
72
 
73
+ If your copy of WordPress is installed at <http://www.zyx.com/blog>,
74
+ and you set the secret word for XML-RPC pings to "foo", then your
75
+ XML-RPC URI will be <http://www.zyx.com/blog/xmlrpc.php>, and the
76
+ URI to request for `update-feeds.php` to update all feeds will be
77
  <http://www.zyx.com/blog/wp-content/update-feeds.php?shibboleth=foo>
78
 
79
  For detailed installation instructions, point your web browser to
81
 
82
  Basic Concepts
83
  --------------
84
+ FeedWordPress is written as a plugin for [WordPress 1.5][]. It is designed
85
+ to store all the data it needs within the WordPress database and to make
86
+ that data easy to manage from within the WordPress Dashboard.
87
 
88
  ### Contributors / Newsfeeds ###
89
 
90
+ FeedWordPress uses the WordPress Links database to keep a list of the feeds
91
+ from which it will syndicate content. WordPress allows you to place links in
92
  categories; FeedWordPress will treat all and only the links in one category
93
  (by default, this is a category named "Contributors"; you can change the
94
  category that FeedWordPress will use using Options --> Syndication).
96
  From WordPress's perspective, the list of Contributors are normal links, and
97
  they can be manipulated like other links through the WordPress Dashboard. If
98
  you need to add, remove, or change information for any contributors, you can
99
+ do so easily under Links --> Syndicated. If you want to distribute the labor
100
+ of adding, updating, and managing feeds, you can use the WordPress login and
101
+ access privileges system. Users with an access level of 5 or greater can
102
+ add, delete, and modify Contributors; users with an access level of 6 or
103
+ greater can change syndication options.
104
 
105
+ When FeedWordPress looks for new posts, it does so by retrieving one or all
106
+ of the links from the Contributors category (depending on whether it has
107
+ been told to scan for new posts on one or all of the feeds).
108
 
109
  __Feed settings:__ All of the information for a syndicated feed is stored in
110
  the WordPress Links database. Feeds in the category to be syndicated (by
112
  record:
113
 
114
  - The RSS URI is used to store the URI for the feed to be syndicated.
115
+ (Note that this is *not* the same as the Link URI. The Link URI
116
+ points to the human-readable *front page* of the website that the
117
+ feed syndicates.)
118
 
119
  - The Link URI is used to store a URI to the human-readable front page
120
+ (*not* the feed!) of the syndicated website. FeedWordPress
121
+ automatically updates this URI using the URI that is reported by the
122
+ newsfeed whenever it checks the feed for new posts, so if the page
123
+ moves this will be reflected automatically on your Contributors
124
+ links list.
125
 
126
  - The Link Name is used to store the title of the syndicated website.
127
  By default, FeedWordPress automatically updates the name of the link
134
  `hardcode name`.
135
 
136
  - The Short Description is used to store the tagline of the syndicated
137
+ website. By default, FeedWordPress automatically updates the
138
+ description whenever it checks for new posts, using the tagline or
139
+ description that the newsfeed reports (so that if a Contributor
140
+ changes the tagline of her website, this is reflected automatically
141
+ on your Contributors links list). his behavior can be turned off for
142
+ all feeds through the settings in Options --> Syndication. The
143
+ default behavior can be overridden for specific feeds using the feed
144
+ setting `hardcode description`.
145
+
146
+ - The Link Notes are used to store a collection of manually-encoded
147
+ and automatically-generated settings that apply to this feed. The
148
+ format of settings in Link Notes is:
149
 
150
  key1: value1
151
  key2: value2
153
  feed/key2: value2
154
 
155
  And so on. Values that are prefixed by 'feed/' are automatically
156
+ generated from feed data every time the feed syndicated by this link
157
+ is checked for updates. Values without the prefix are set manually
158
+ by the user.
159
 
160
  The Link Notes section can be used to add, remove, and change custom feed
161
+ settings. For example, if you want to *add* the feed setting for `unfamiliar
162
+ author` with the value `filter`, you can do so by going to Links -->
163
  Syndicated, clicking the "Edit" link for the feed that you wish to add this
164
  setting for, and then adding the following, on a line by itself, to the Link
165
  Notes section:
167
  unfamiliar author: filter
168
 
169
  To remove the setting, follow the same procedure, but find the line for the
170
+ feed setting that you want to remove and remove it. To change the value,
171
+ simply change the text that follows after the colon.
172
 
173
+ Most settings in the Link Notes have no effect on FeedWordPress, but you can
174
+ use them to store information for templates to retrieve using the
175
+ `get_feed_meta()` template function in a post context (see Template API
176
+ below). For example, many aggregator sites use a "face" image for each feed
177
+ to visually distinguish posts from different feeds. To implement a face
178
+ feature, you could add something like this to each feed's Link Notes, on a
179
+ line by itself:
180
 
181
  face: http://www.zyx.com/mugs/ugly
182
 
183
+ The URI should be changed out for each feed to point to the appropriate
184
+ image, of course. Then, to use the setting from within a template:
185
 
186
+ // In a post context
187
+ <?php $img = get_feed_meta('face'); if (strlen($img) > 0): ?>
188
+ <img src="<?=$img?>" alt="" />
189
+ <?php endif; ?>
190
 
191
+ ... which will display the image, if any, whose URI is set in the "face"
192
+ setting for the feed that post comes from. If there is no "face" setting for
193
+ a particular feed, ``get_feed_meta()`` will return an empty string and no
194
+ image will be displayed.
195
 
196
  Not all feed settings are only for templates. Some affect how FeedWordPress
197
  processes posts from that feed. Currently, the settings with special effects
204
 
205
  Whenever FeedWordPress updates, it scans one or more of the feeds in its
206
  Contributors list and adds any new posts that it finds to the WordPress
207
+ database. Syndicated posts are displayed on your WordPress pages like any
208
+ other posts: they can be listed in archives by category, author, or date;
209
+ they can be found with the search box; and they are included in the newsfeed
210
+ of your blog.
211
 
212
  In your WordPress templates (Presentation --> Theme Editor) you can access
213
  special information about syndicated posts using functions provided by
214
  FeedWordPress, such as `is_syndicated()`, `the_syndication_source()`,
215
  `the_syndication_source_link()`, and `get_feed_meta()`. For example, here is
216
+ the template code that I use (in a post context) to display both the
217
+ author's name and the original source of the post in the templates for
218
+ [Feminist Blogs][]:
219
 
220
  <cite class="feed">from <?php the_author_posts_link()?><?php
221
  if (is_syndicated() and (get_the_author() !== get_syndication_source())):
228
 
229
  ### Categories ###
230
 
231
+ WordPress allows for posts to be placed in *categories*. Each syndicated
232
+ post that FeedWordPress adds to the WordPress database is placed into a set
233
+ of categories. FeedWordPress gets the list of category names to use from two
234
  sources:
235
 
236
+ 1. Categories (or "tags") that the original author placed the post in
237
+ on her blog
238
 
239
  2. Categories that you set explicitly for each feed using the `cats`
240
+ feed setting. For example, if you wanted all the posts from Alas, A
241
+ Blog to be placed in the "Pacific Northwest" category and the
242
+ "Cartoonists" category (in addition to any categories that they were
243
+ placed in on Alas, A Blog), you could do this by going to Links -->
244
+ Syndicated, clicking the "Edit" link for Alas, A Blog, and adding
245
+ the following line to the Link Notes section:
246
 
247
  cats: Pacific Northwest:Cartoonists
248
 
254
 
255
  __Aliases:__ Different often authors use slightly different names for
256
  categories that mean the same thing (contributors to Feminist Blogs, for
257
+ example, used categories including "Feminism", "feministy stuff", "Women's
258
+ Issues", "Gender Issues", "Gender Equality", and so on). If you want
259
  FeedWordPress to treat one category name as a synonym for another, you can
260
  do so by creating an "alias" for the category. For example, to make
261
+ FeedWordPress treat posts that are placed in the category "feministy stuff"
262
+ as if they had been placed in the category "Feminism", go to Manage -->
263
+ Categories, find the category "Feminism" and click the "Edit" link for it,
264
+ and then add the following to the Description field, on a line by itself:
265
 
266
  a.k.a.: feministy stuff
267
 
268
+ You can add as many aliases as you like. You can also add any other text
269
+ that you like to the Description without interfering with FeedWordPress's
270
+ ability to use the aliases. Each alias must be on a line by itself.
271
 
272
  __Unfamiliar categories:__ By default, if one of the category names that a
273
  newsfeed provides is unfamiliar -- that is, if there is not yet any category
274
  with that name (or with that name as an alias) in your WordPress database --
275
+ then by default FeedWordPress will *automatically create* a new category
276
+ with that name and place the current post in it. The default behavior can be
277
+ changed, using either the global settings in Options --> Syndication or the
278
+ `unfamiliar categories` feed setting (see Feed Settings above), so that
279
+ unfamiliar categories will not be added to the database. If you choose to
280
+ disable the creation of new categories, you can also choose whether or not
281
+ FeedWordPress should syndicate posts that do not match *any* of the
282
+ categories that are currently in the database.
283
+
284
+ One of the uses of this feature is filtering posts by category: if you want
285
+ to your blog to syndicate only the posts in one particular category from a
286
+ feed that has several categories, you could do so by creating a category by
287
+ that name, adding the new feed(s), and then adding the following line to the
288
+ Link Notes section of the feed(s) that you want to filter:
289
 
290
  unfamiliar categories: filter
291
 
292
+ Since only posts in categories that are in your database will be included,
293
+ and only the category or categories that you wanted posts from has been
294
+ added to your database, this will filter out all the posts that aren't in
295
+ the category or categories that you defined ahead of time. (Similarly, you
296
+ could set up FeedWordPress so that *all* the feeds are filtered by author by
297
+ creating the set of users named after the authors you want to syndicate, and
298
+ then setting the default behavior for *all* feeds at Options -->
299
+ Syndication).
300
 
301
+ If you need a category filter with more complex logic, you can always create
302
+ a `syndicated_item` filter in PHP (see Plugin API below) that manipulates
303
+ the `['categories']` array of a syndicated item.
304
 
305
  ### Authors ###
306
 
307
  Most newsfeeds include information about the author of the items on them.
308
  (If a feed doesn't, then FeedWordPress will create an author's name based on
309
+ the title of the feed from which the item was taken.) This information is
310
+ used to determine the WordPress user that the post will be attributed to.
311
+ Given the name of the author, FeedWordPress looks for authors in the
312
+ WordPress database with the same name as either (1) their login, (2) their
313
+ first name, (3) their nickname, (4) their full name, or (5) one of the
314
+ "aliases" listed in the user's profile.
315
 
316
  __Aliases:__ If there is an author who posts under more than one name (for
317
  example, one of our contributors at [Feminist Blogs][] posts on several
318
  different blogs, sometimes using her full name and sometimes using only her
319
+ first name), then you can ensure that FeedWordPress will attribute those
320
+ posts to the same author by creating "aliases" for the author. For example,
321
+ to make FeedWordPress treat posts by "Joseph Cardinal Ratzinger" and posts
322
+ by "Pope Benedict XVI" as having the same author, go to Users --> Authors &
323
+ Users, click on the "Edit" link for Pope Benedict XVI, and add a line like
324
+ this to the Profile text:
325
 
326
  a.k.a.: Joseph Cardinal Ratzinger
327
 
328
+ You can add as many aliases as you like. You can also add any other text
329
+ that you like to the Profile without interfering with FeedWordPress's
330
+ ability to use the aliases. Each alias must be on a line by itself.
331
 
332
  __Unfamiliar authors:__ By default, if the author named by the newsfeed is
333
  unfamiliar -- that is, if there is no-one with that name registered in the
334
+ WordPress author's database -- then by default FeedWordPress will
335
+ automatically create a new user account with the given name and attribute
336
+ the post to the new user. The default behavior can be changed, using either
337
+ the global settings in Options --> Syndication or the `unfamiliar author`
338
+ feed setting (see Feed Settings above), so that posts by unfamiliar authors
339
+ will either be attributed to a default author (instead of creating a new
340
+ user account to attribute them to), or filtered out and not syndicated at
341
+ all.
342
 
343
  One of the uses of this feature is filtering posts by author: if you want to
344
+ your blog to syndicate only the posts by one particular author from a feed
345
+ that has several authors, you could do so by creating a user account with
346
+ that author's name, adding the new feed(s), and then adding the following
347
+ line to the Link Notes section of the feed(s) that you want to filter:
348
 
349
  unfamiliar author: filter
350
 
351
+ Since only posts by authors that are in your database will be included, and
352
+ only the author that you wanted posts from has been added to your database,
353
+ this will filter out posts by anyone else on the feeds with that setting.
354
+ (Similarly, you could set up FeedWordPress so that *all* the feeds are
355
+ filtered by author by creating the set of users named after the authors you
356
+ want to syndicate, and then setting the default behavior for *all* feeds at
357
+ Options --> Syndication).
358
+
359
+ If you need an author filter with more complex logic than this allows, you
360
+ can always create a `syndicated_item` filter in PHP (see Plugin API below)
361
+ that manipulates the `['author_name']` or `['dc']['creator']` elements of a
362
  syndicated item.
363
 
364
  Special Feed Settings
365
  ---------------------
366
  Most feed settings (see Feed Settings above) have no effect on FeedWordPress
367
+ itself, but can be useful because they can be accessed from templates using
368
+ the `get_feed_meta()` template function in a post context (see Feed Settings
369
+ above for an example). However, you can use some feed settings to affect how
370
  FeedWordPress will process posts from that particular feed. Currently, these
371
  special settings are:
372
 
373
+ - `cats:` a colon-separated list of default categories for any post
374
+ coming from this feed. So, for example, a this line in its Notes
375
+ section:
376
 
377
  cats: computers:web
378
 
379
+ ... will make FeedWordPress place any posts syndicated from that
380
+ feed in the "computers" and "web" categories. Note that by default,
381
+ FeedWordPress will place them in those categories *in addition to*
382
+ any categories that the author of the post put them in on her own
383
+ website. If you want to place posts from a feed *only* in the
384
+ categories you explicitly set, then you should use the `cats`
385
+ setting together with the `unfamiliar categories` setting. (See
386
+ Categories above and `unfamiliar categories` below for the
387
+ nitty-gritty.)
388
 
389
  - `hardcode name: (yes|no)`
390
 
391
  By default, FeedWordPress updates the value of the Link Name field
392
  automatically to reflect the title that is reported by a syndicated
393
  feed--so that if one of your contributors changes the title of her
394
+ website, the change will be reflected on your Contributors list
395
+ after the next update. If you want to stop this behavior (so that
396
+ you can set the title of a Contributor link manually -- e.g. so that
397
+ you can use an abbreviated form for reasons of space), you can
398
+ change the default behavior for *all* feeds using the settings in
399
+ Options --> Syndication. If you want to override the default
400
+ behavior for only *one* feed, you can use the `hardcode name` feed
401
+ setting. If FeedWordPress updates the title of all feeds by default,
402
+ but you wish to use a manually-set title for one particular feed,
403
+ you can add a line like this to the Link Notes section of the feed
404
+ that you want to manually set the title for:
405
 
406
  hardcode name: yes
407
 
408
+ Similarly, if FeedWordPress uses your manually-entered titles for
409
+ all feeds by default, but you wish to use an automatically updated
410
+ title for one particular feed, you can add a line like this to the
411
+ Link Notes section of the feed that you want to manually set the
412
+ title for:
413
+
414
  hardcode name: no
415
+
416
  If `hardcode name` is absent, or set to a value other than `yes` or
417
  `no`, FeedWordPress will follow the default behavior set under
418
  Options --> Syndication.
423
  field automatically to reflect the tagline or description that is
424
  reported by a syndicated feed--so that if one of your contributors
425
  changes the tagline for her website, the change will be reflected on
426
+ your Contributors list after the next update. If you want to stop
427
+ this behavior (so that you can set the tagline of a Contributor link
428
+ manually -- e.g. so that you can use it to provide information of
429
+ another sort or use an abbreviated form for reasons of space), you
430
+ can change the default behavior for *all* feeds using the settings
431
+ in Options --> Syndication. If you want to override the default
432
+ behavior for only *one* feed, you can use the `hardcode description`
433
+ feed setting. If FeedWordPress updates the description of all feeds
434
+ by default, but you wish to use a manually-set description for one
435
+ particular feed, you can add a line like this to the Link Notes
436
+ section of that particular feed:
437
 
438
  hardcode description: yes
439
 
440
+ Similarly, if FeedWordPress uses your manually-entered descriptions
441
+ for all feeds by default, but you wish to use an automatically
442
+ updated description for one particular feed, you can add a line like
443
+ this to the Link Notes section of that particular feed:
444
 
445
  hardcode description: no
446
 
447
+ If `hardcode description` is absent, or set to a value other than
448
+ `yes` or `no`, FeedWordPress will follow the default behavior set
449
+ under Options --> Syndication.
450
+
451
+ - `hardcode url: (yes|no)`
452
+
453
+ By default, FeedWordPress updates the value of the Link URI field
454
+ automatically to reflect the link to the front page of the website
455
+ you are syndicating, as reported by the syndicated feed--so that if
456
+ one of your contributors changes the front page of her website (from
457
+ <http://www.zyx.com/blog/> to <http://www.zyx.com/>, say), the
458
+ change will be reflected on your Contributors list after the next
459
+ update. If you want to stop this behavior (so that you can set the
460
+ human-readable URI that a Contributor link points to manually), you
461
+ can change the default behavior for *all* feeds using the settings
462
+ in Options --> Syndication. If you want to override the default
463
+ behavior for only *one* feed, you can use the `hardcode url` feed
464
+ setting. If FeedWordPress updates the human-readable URI of all
465
+ feeds by default, but you wish to use a manually-set URI for one
466
+ particular feed, you can add a line like this to the Link Notes
467
+ section of that particular feed:
468
+
469
+ hardcode url: yes
470
+
471
+ Similarly, if FeedWordPress uses your manually-entered URIs for all
472
+ feeds by default, but you wish to use an automatically updated URI
473
+ for one particular feed, you can add a line like this to the Link
474
+ Notes section of that particular feed:
475
+
476
+ hardcode url: no
477
+
478
+ If `hardcode url` is absent, or set to a value other than `yes` or
479
+ `no`, FeedWordPress will follow the default behavior set under
480
  Options --> Syndication.
481
 
482
  - `hardcode categories: (yes|no)`
483
 
484
+ **This setting has been deprecated.** If set to `yes` it is now
485
+ treated as equivalent to `unfamiliar categories: default`. (See
486
+ below.)
487
+
488
+ - `post status: (publish|draft|private)`
489
+
490
+ By default, FeedWordPress sets all new syndicated posts to be
491
+ published immediately. If you want syndicated posts to have some
492
+ other status (for example, to hold them as drafts for moderation, or
493
+ to hold them as private posts), you can change the default behavior
494
+ using Options --> Syndication. If you want to override the default
495
+ post status for syndicated posts from *one particular feed*, you
496
+ can do so using the `post status` feed setting. So, for example, if
497
+ you have FeedWordPress set to publish new syndicated posts
498
+ immediately, but you want posts from one particular feed to be put
499
+ into the drafts pile for moderation, you can do so by placing the
500
+ following line in the Link Notes section of that feed's Contributor
501
+ link:
502
+
503
+ post status: draft
504
+
505
+ - `comment status: (open|closed)`
506
+
507
+ By default, FeedWordPress sets all new syndicated posts to be
508
+ closed for comments--if users want to comment on posts then it's
509
+ often best for them to comment on the *original* website rather than
510
+ your syndication site. But if you want syndicated posts to be open
511
+ for comments, you can change the default behavior for all syndicated
512
+ posts using the settings in Options --> Syndication. If you want to
513
+ override the default comment status for *one particular feed*, you
514
+ can do so using the `comment status` feed setting. So, for example,
515
+ if you have FeedWordPress set not to open up new syndicated posts
516
+ for comments, but you want posts from *one particular feed* to be
517
+ opened for comments, then you can do so by placing the following
518
+ line in the Link Notes section of that feed's Contributor link:
519
+
520
+ comment status: open
521
 
522
+ - `ping status: (open|closed)`
 
 
523
 
524
+ By default, FeedWordPress sets all new syndicated posts *not* to
525
+ accept PingBack or TrackBack link notifications ("pings"). If you
526
+ want syndicated posts on your syndication site to accept pings, you
527
+ can change the default behavior for all syndicated posts using the
528
+ settings in Options --> Syndication. If you want to override the
529
+ default ping status for *one particular feed*, you can do so using
530
+ the `ping status` feed setting. So, for example, if you have
531
+ FeedWordPress set not to accept pings for new syndicated posts, but
532
+ you want posts from *one particular feed* to accept pings, then you
533
+ can do so by placing the following line in the Link Notes section of
534
+ that feed's Contributor link:
535
 
536
+ ping status: open
 
 
 
537
 
538
  - `unfamiliar authors: (create|default|filter)`
539
 
540
+ By default, FeedWordPress creates new author accounts whenever it
541
+ finds a new post that is by an author whose name is not already in
542
+ the WordPress database, and uses that account for this post and any
543
+ future posts by an author of that name. FeedWordPress also allows
544
+ you to attribute posts by unfamiliar authors to a *default* user
545
+ account (currently, this means the System Administrator account),
546
+ *instead of* creating a new author, or simply not to syndicate posts
547
+ by unfamiliar authors (thus only syndicating posts by authors who
548
+ are already in the database).
549
 
550
  Which of these FeedWordPress does by default can be set using the
551
+ settings in Options --> Syndication. You can also override the
552
+ default behavior for specific feeds by adding the `unfamiliar
553
+ author` feed setting to the Link Notes section of a feed. For
554
+ example, to ensure that FeedWordPress filters out posts by
555
+ unfamiliar authors for one particular feed, add the setting:
556
 
557
  unfamiliar author: filter
558
 
559
+ To ensure that FeedWordPress assigns posts by unfamiliar authors to
560
+ the default user account instead of creating a new user account, add
561
+ the setting:
562
 
563
  unfamiliar author: default
564
 
565
+ If you changed the default behavior under Options --> Syndication
566
+ but want to ensure that FeedWordPress creates new author accounts
567
+ for unfamiliar authors on one specific feed, add the setting:
568
 
569
  unfamiliar author: create
570
 
571
+ If the setting is anything other than `create`, `default`, or
572
+ `filter`, FeedWordPress will ignore the setting and follow the
573
+ default behavior that you specified under Options --> Syndication.
574
 
575
  - `unfamiliar categories: (create|default|filter)`
576
 
577
  By default, FeedWordPress creates categories whenever it finds a new
578
  post that is placed in categories whose names are not already in the
579
+ WordPress database. FeedWordPress allows you to change this
580
+ behavior, so that it will *not* create new category names. It also
581
+ allows you to choose whether or not posts must match *at least one*
582
+ familiar category to be syndicated at all.
583
 
584
  Which of these FeedWordPress does by default can be set using the
585
+ settings in Options --> Syndication. You can also override the
586
+ default behavior for specific feeds by adding the `unfamiliar
587
+ categories` feed setting to the Link Notes section of a feed. For
588
+ example, to ensure that, when adding new posts from *one particular
589
+ feed*, FeedWordPress does *not* create new categories, and filters
590
+ out any posts that don't match *at least one* of the categories that
591
+ you have already defined, add the setting:
592
 
593
  unfamiliar categories: filter
594
 
595
  To ensure that FeedWordPress does *not* create new categories, but
596
+ *will* still syndicate categories even if they don't match any of
597
+ the pre-defined categories, add the following to the feed settings:
598
 
599
  unfamiliar categories: default
600
 
601
+ If you changed the default behavior under Options --> Syndication
602
+ but want to ensure that FeedWordPress creates new categories for
603
+ posts from one particular feed, add the setting:
604
 
605
  unfamiliar categories: create
606
 
607
+ If the setting is anything other than `create`, `default`, or
608
+ `filter`, FeedWordPress will ignore the setting and follow the
609
+ default behavior that you specified under Options --> Syndication.
610
 
611
  Template API
612
  ------------
613
+ When activated, FeedWordPress makes the following functions available for
614
+ use by themes/templates:
615
 
616
+ * ``is_syndicated()``: in a post context, returns ``TRUE`` if the post
617
+ was syndicated from another website, or ``FALSE`` if it was
618
+ originally posted here
619
 
620
+ * ``get_syndication_permalink()``: in a post context, returns the URI
621
+ of the permalink for this post *on the website it was syndicated from*
622
 
623
+ * ``the_syndication_permalink()``: in a post context, outputs the
624
+ value returned by ``get_syndication_permalink()``
625
 
626
+ * ``get_syndication_source_link()``: in a post context, returns the
627
+ URI of the front page (*not* the feed) of the website this post was
628
+ syndicated from
629
 
630
+ * ``the_syndication_source_link()``: in a post context, outputs the
631
+ URI returned by ``get_syndication_source_link()``
632
 
633
  * ``get_syndication_source()``: in a post context, returns the
634
  human-readable title of the website that a syndicated post was
637
  * ``the_syndication_source()``: in a post context, outputs the value
638
  returned by ``get_syndication_source()``
639
 
640
+ * ``get_syndication_feed():`` in a post context, returns the URI of
641
+ the feed (*not* the front page) that this post was syndicated from
642
 
643
  * ``the_syndication_feed()``: in a post context, outputs the value
644
  returned by ``get_syndication_feed()``
645
 
646
+ * ``get_feed_meta($key)``: in a post context, returns the value, if
647
+ any, of the feed setting ``$key`` for the feed that this post was
648
+ syndicated from
649
 
650
  By default, FeedWordPress also places a filter on the standard functions
651
+ ``get_permalink()`` and ``the_permalink()`` that substitutes the URI
652
+ returned by ``get_syndication_permalink()`` for the URI generated by
653
+ WordPress. This means that by default the permalinks listed on your website
654
+ and in your newsfeed will link to the location of the posts on the source
655
+ website, *not* to their location on your website. You can switch this
656
+ behavior on or off at Options --> Syndication in the WordPress Dashboard.
657
 
658
  ### Plugin API ###
659
 
660
+ FeedWordPress creates five hooks through the WordPress plugin architecture
661
+ that you can plug in to using PHP WordPress plugins, to supplement ordinary
662
+ FeedWordPress behavior, or to filter posts according to criteria that you
663
+ set. The hooks are the action ``feedwordpress_update``, the action
664
+ ``feedwordpress_check_feed``, the action ``feedwordpress_update_complete``,
665
+ the filter ``syndicated_item``, the filter ``syndicated_post``, the action
666
  ``post_syndicated_item``, and the action ``update_syndicated_item``.
667
 
668
  For more information, see <http://projects.radgeek.com/feedwordpress/api>.
669
 
670
  License
671
  -------
672
+ The FeedWordPress plugin is copyright (c) 2005 by Charles Johnson. It uses
673
+ code derived or translated from:
674
 
675
+ - [wp-rss-aggregate.php][] by [Kellan Elliot-McCrea](mailto:kellan@protest.net)
676
+ - [HTTP Navigator 2][] by [Keyvan Minoukadeh](mailto:keyvan@k1m.com)
677
+ - [Ultra-Liberal Feed Finder][] by [Mark Pilgrim](mailto:mark@diveintomark.org)
678
 
679
  according to the terms of the [GNU General Public License][].
680
 
681
+ This program is free software; you can redistribute it and/or modify it
682
+ under the terms of the [GNU General Public License][] as published by the
683
+ Free Software Foundation; either version 2 of the License, or (at your
684
+ option) any later version.
685
 
686
+ This program is distributed in the hope that it will be useful, but WITHOUT
687
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
688
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
689
+ more details.
690
 
691
  [wp-rss-aggregate.php]: http://laughingmeme.org/archives/002203.html
692
  [HTTP Navigator 2]: http://www.keyvan.net/2004/11/16/http-navigator/
wp-content/plugins/feedwordpress.php CHANGED
@@ -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.95
7
  Author: Charles Johnson
8
  Author URI: http://www.radgeek.com/
9
  License: GPL
10
- Last modified: 2005-04-20 10:58pm EDT
11
  */
12
 
13
  # This uses code derived from:
@@ -27,7 +27,7 @@ Last modified: 2005-04-20 10:58pm EDT
27
 
28
  # -- Don't change these unless you know what you're doing...
29
  define ('RPC_MAGIC', 'tag:radgeek.com/projects/feedwordpress/');
30
- define ('FEEDWORDPRESS_VERSION', '0.95');
31
  define ('DEFAULT_SYNDICATION_CATEGORY', 'Contributors');
32
 
33
  // Note that the rss-functions.php that comes prepackaged with WordPress is
@@ -134,12 +134,8 @@ function get_feed_meta ($key) {
134
  SELECT link_notes FROM $wpdb->links
135
  WHERE link_rss = '".$wpdb->escape($feed)."'"
136
  );
137
-
138
- $notes = explode("\n", $result);
139
- foreach ($notes as $note):
140
- list($k, $v) = explode(': ', $note, 2);
141
- $meta[$k] = stripcslashes(trim($v));
142
- endforeach;
143
  $ret = $meta[$key];
144
  endif; /* if */
145
  return $ret;
@@ -207,6 +203,19 @@ function fwp_syndication_options_page () {
207
  update_option('feedwordpress_update_logging', $_REQUEST['update_logging']);
208
  update_option('feedwordpress_unfamiliar_author', $_REQUEST['unfamiliar_author']);
209
  update_option('feedwordpress_unfamiliar_category', $_REQUEST['unfamiliar_category']);
 
 
 
 
 
 
 
 
 
 
 
 
 
210
 
211
  if (isset($_REQUEST['hardcode_name']) and ($_REQUEST['hardcode_name'] == 'no')) :
212
  update_option('feedwordpress_hardcode_name', 'no');
@@ -219,6 +228,12 @@ function fwp_syndication_options_page () {
219
  else :
220
  update_option('feedwordpress_hardcode_description', 'yes');
221
  endif;
 
 
 
 
 
 
222
  ?>
223
  <div class="updated">
224
  <p><?php _e('Options saved.')?></p>
@@ -234,6 +249,11 @@ function fwp_syndication_options_page () {
234
 
235
  $hardcode_name = get_settings('feedwordpress_hardcode_name');
236
  $hardcode_description = get_settings('feedwordpress_hardcode_description');
 
 
 
 
 
237
 
238
  $unfamiliar_author = array ('create' => '','default' => '','filter' => '');
239
  $ua = FeedWordPress::on_unfamiliar('author');
@@ -251,21 +271,7 @@ function fwp_syndication_options_page () {
251
  <h2>Syndication Options</h2>
252
  <form action="" method="post">
253
  <fieldset class="options">
254
- <legend>Template Options</legend>
255
- <table class="editform" width="100%" cellspacing="2" cellpadding="5">
256
- <tr>
257
- <th width="33%" scope="row">Permalinks for syndicated posts point to:</th>
258
- <td width="67%"><select name="munge_permalink" size="1">
259
- <option value="yes"<?=($munge_permalink=='yes')?' selected="selected"':''?>>source website</option>
260
- <option value="no"<?=($munge_permalink=='no')?' selected="selected"':''?>>this website</option>
261
- </select></td>
262
- </tr>
263
- </table>
264
- <div class="submit"><input type="submit" name="action" value="<?=$caption?>" /></div>
265
- </fieldset>
266
-
267
- <fieldset class="options">
268
- <legend>Syndication Options</legend>
269
  <table class="editform" width="100%" cellspacing="2" cellpadding="5">
270
  <tr>
271
  <th width="33%" scope="row">Syndicate links in category:</th>
@@ -288,6 +294,35 @@ function fwp_syndication_options_page () {
288
  <td width="67%"><ul style="margin:0;list-style:none">
289
  <li><input type="checkbox" name="hardcode_name" value="no"<?=(($hardcode_name=='yes')?'':' checked="checked"')?>/> Contributor name (feed title)</li>
290
  <li><input type="checkbox" name="hardcode_description" value="no"<?=(($hardcode_description=='yes')?'':' checked="checked"')?>/> Contributor description (feed tagline)</li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  </ul></td></tr>
292
 
293
  <tr><th width="33%" scope="row" style="vertical-align:top">Unfamiliar authors:</th>
@@ -301,9 +336,6 @@ function fwp_syndication_options_page () {
301
  <li><label><input type="radio" name="unfamiliar_category" value="create"<?=$unfamiliar_category['create']?>/> create any categories the post is in</label></li>
302
  <li><label><input type="radio" name="unfamiliar_category" value="default"<?=$unfamiliar_category['default']?>/> don't create new categories</li>
303
  <li><label><input type="radio" name="unfamiliar_category" value="filter"<?=$unfamiliar_category['filter']?>/> don't create new categories and don't syndicate posts unless they match at least one familiar category</label></li>
304
- </ul>
305
-
306
- </ul></li>
307
  </ul></td></tr>
308
 
309
  </select></td></tr>
@@ -340,9 +372,9 @@ function fwp_syndication_manage_page () {
340
  <?php $cont = true;
341
  if (isset($_REQUEST['action'])):
342
  //die("ACTION: '".$_REQUEST['action']."'");
343
- if ($_REQUEST['action'] == 'feedfinder'): $cont = fwp_feedfinder_page();
344
- elseif ($_REQUEST['action'] == 'switchfeed'): $cont = fwp_switchfeed_page();
345
- elseif ($_REQUEST['action'] == 'Delete Checked'): $cont = fwp_multidelete_page();
346
  endif;
347
  endif;
348
 
@@ -691,24 +723,8 @@ class FeedWordPress {
691
 
692
  $feeds = array ();
693
  if ($result): foreach ($result as $link):
694
- $sec = array ();
695
-
696
  if (strlen($link->link_rss) > 0):
697
- $notes = explode("\n", $link->link_notes);
698
- foreach ($notes as $note):
699
- list($key, $value) = explode(": ", $note, 2);
700
-
701
- if (strlen($key) > 0) :
702
- // Unescape and trim() off the
703
- // whitespace. Thanks to Ray
704
- // Lischner for pointing out the
705
- // need to trim.
706
- $sec[$key] = stripcslashes (
707
- trim($value)
708
- );
709
- endif;
710
- endforeach;
711
-
712
  $sec['uri'] = $link->link_rss;
713
  $sec['name'] = $link->link_name;
714
 
@@ -731,7 +747,24 @@ class FeedWordPress {
731
  endforeach; endif;
732
 
733
  $this->feeds = $feeds;
734
- } // function acquire_feeds ()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
735
 
736
  function update ($uri) {
737
  global $wpdb;
@@ -824,6 +857,18 @@ class FeedWordPress {
824
  return $ret;
825
  }
826
 
 
 
 
 
 
 
 
 
 
 
 
 
827
  function negative ($f, $setting) {
828
  $nego = array ('n', 'no', 'f', 'false');
829
  return (isset($f[$setting]) and in_array(strtolower($f[$setting]), $nego));
@@ -842,7 +887,7 @@ class FeedWordPress {
842
  endif;
843
 
844
  $update = array();
845
- if (isset($channel['link'])) :
846
  $update[] = "link_url = '".$wpdb->escape($channel['link'])."'";
847
  endif;
848
 
@@ -911,6 +956,7 @@ class FeedWordPress {
911
  // Cf.: <http://mosquito.wordpress.org/view.php?id=901>
912
  global $fwp_channel, $fwp_feedmeta;
913
  $fwp_channel = $channel; $fwp_feedmeta = $f;
 
914
  $item = apply_filters('syndicated_item', $item);
915
 
916
  // Filters can halt further processing by returning NULL
@@ -960,7 +1006,7 @@ class FeedWordPress {
960
  # in the feed, and if it's in the content itself we'd have
961
  # to do yet more XML parsing to do things right. For now
962
  # this will have to do.
963
-
964
  $this->_base = $item['link']; // Reset the base for resolving relative URIs
965
  foreach ($this->uri_attrs as $pair):
966
  list($tag,$attr) = $pair;
@@ -1002,7 +1048,7 @@ class FeedWordPress {
1002
  # --- cut here ---
1003
  $post['post_name'] = sanitize_title($post['post_title']);
1004
  # --- cut here ---
1005
-
1006
  # RSS is a fucking mess. Figure out whether we have a date in
1007
  # dc:date, <issued>, <pubDate>, etc., and get it into Unix epoch
1008
  # format for reformatting. If you can't find anything, use the
@@ -1029,25 +1075,36 @@ class FeedWordPress {
1029
  $post['post_modified'] = date('Y-m-d H:i:s', $post['epoch']['modified']);
1030
  $post['post_date_gmt'] = gmdate('Y-m-d H:i:s', $post['epoch']['issued']);
1031
  $post['post_modified_gmt'] = gmdate('Y-m-d H:i:s', $post['epoch']['modified']);
1032
-
1033
- # Use feed-level preferences or a sensible default.
1034
- $post['post_status'] = (isset($f['post status']) ? $wpdb->escape(trim(strtolower($f['post status']))) : 'publish');
1035
- $post['comment_status'] = (isset($f['comment status']) ? $wpdb->escape(trim(strtolower($f['comment status']))) : 'closed');
1036
- $post['ping_status'] = (isset($f['ping status']) ? $wpdb->escape(trim(strtolower($f['ping status']))) : 'closed');
1037
-
1038
  // Unique ID (hopefully a unique tag: URI); failing that, the permalink
1039
  if (isset($item['id'])):
1040
  $post['guid'] = $wpdb->escape($item['id']);
1041
  else:
1042
  $post['guid'] = $wpdb->escape($item['link']);
1043
  endif;
1044
-
1045
- if (isset($channel['title'])) $post['syndication_source'] = $channel['title'];
1046
- if (isset($channel['link'])) $post['syndication_source_uri'] = $channel['link'];
1047
- $post['syndication_feed'] = $f['uri'];
 
 
 
 
 
 
 
 
 
 
 
1048
 
1049
  // In case you want to know the external permalink...
1050
- $post['syndication_permalink'] = $item['link'];
1051
 
1052
  // Feed-by-feed options for author and category creation
1053
  $post['named']['unfamiliar']['author'] = $f['unfamiliar author'];
@@ -1234,31 +1291,42 @@ class FeedWordPress {
1234
  } // function FeedWordPress::add_to_category ()
1235
  # --- cut here ---
1236
 
1237
- // FeedWordPress::add_rss_meta: adds feed meta-data to user-defined keys
1238
- // for each entry. Interesting feed meta-data is tagged in the $post
1239
- // array using the prefix 'syndication_'. This should be used for
1240
- // anything that the WordPress user might want to access about a post's
1241
- // original source that isn't provided for by standard WP meta-data
1242
- // (i.e., beyond author, title, timestamp, and categories)
 
 
 
1243
  function add_rss_meta ($wpdb, $postId, $post) {
1244
- foreach ($post as $key => $value):
1245
- if (strpos($key, "syndication_") === 0):
1246
- $value = $wpdb->escape($value);
1247
 
 
 
 
 
1248
  $result = $wpdb->query("
1249
  DELETE FROM $wpdb->postmeta
1250
  WHERE post_id='$postId' AND meta_key='$key'
1251
  ");
1252
 
1253
- $result = $wpdb->query("
1254
- INSERT INTO $wpdb->postmeta
1255
- SET
1256
- post_id='$postId',
1257
- meta_key='$key',
1258
- meta_value='$value'
1259
- ");
1260
- endif;
1261
- endforeach;
 
 
 
 
 
1262
  } /* FeedWordPress::add_rss_meta () */
1263
 
1264
  // FeedWordPress::author_to_id (): get the ID for an author name from
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.96
7
  Author: Charles Johnson
8
  Author URI: http://www.radgeek.com/
9
  License: GPL
10
+ Last modified: 2005-05-08 1:54pm EDT
11
  */
12
 
13
  # This uses code derived from:
27
 
28
  # -- Don't change these unless you know what you're doing...
29
  define ('RPC_MAGIC', 'tag:radgeek.com/projects/feedwordpress/');
30
+ define ('FEEDWORDPRESS_VERSION', '0.96');
31
  define ('DEFAULT_SYNDICATION_CATEGORY', 'Contributors');
32
 
33
  // Note that the rss-functions.php that comes prepackaged with WordPress is
134
  SELECT link_notes FROM $wpdb->links
135
  WHERE link_rss = '".$wpdb->escape($feed)."'"
136
  );
137
+
138
+ $meta = FeedWordPress::notes_to_settings($result);
 
 
 
 
139
  $ret = $meta[$key];
140
  endif; /* if */
141
  return $ret;
203
  update_option('feedwordpress_update_logging', $_REQUEST['update_logging']);
204
  update_option('feedwordpress_unfamiliar_author', $_REQUEST['unfamiliar_author']);
205
  update_option('feedwordpress_unfamiliar_category', $_REQUEST['unfamiliar_category']);
206
+ update_option('feedwordpress_syndicated_post_status', $_REQUEST['post_status']);
207
+
208
+ if (isset($_REQUEST['comment_status']) and ($_REQUEST['comment_status'] == 'open')) :
209
+ update_option('feedwordpress_syndicated_comment_status', 'open');
210
+ else :
211
+ update_option('feedwordpress_syndicated_comment_status', 'closed');
212
+ endif;
213
+
214
+ if (isset($_REQUEST['ping_status']) and ($_REQUEST['ping_status'] == 'open')) :
215
+ update_option('feedwordpress_syndicated_ping_status', 'open');
216
+ else :
217
+ update_option('feedwordpress_syndicated_ping_status', 'closed');
218
+ endif;
219
 
220
  if (isset($_REQUEST['hardcode_name']) and ($_REQUEST['hardcode_name'] == 'no')) :
221
  update_option('feedwordpress_hardcode_name', 'no');
228
  else :
229
  update_option('feedwordpress_hardcode_description', 'yes');
230
  endif;
231
+
232
+ if (isset($_REQUEST['hardcode_url']) and ($_REQUEST['hardcode_url'] == 'no')) :
233
+ update_option('feedwordpress_hardcode_url', 'no');
234
+ else :
235
+ update_option('feedwordpress_hardcode_url', 'yes');
236
+ endif;
237
  ?>
238
  <div class="updated">
239
  <p><?php _e('Options saved.')?></p>
249
 
250
  $hardcode_name = get_settings('feedwordpress_hardcode_name');
251
  $hardcode_description = get_settings('feedwordpress_hardcode_description');
252
+ $hardcode_url = get_settings('feedwordpress_hardcode_url');
253
+
254
+ $post_status = FeedWordPress::syndicated_status('post', array(), 'publish');
255
+ $comment_status = FeedWordPress::syndicated_status('comment', array(), 'closed');
256
+ $ping_status = FeedWordPress::syndicated_status('ping', array(), 'closed');
257
 
258
  $unfamiliar_author = array ('create' => '','default' => '','filter' => '');
259
  $ua = FeedWordPress::on_unfamiliar('author');
271
  <h2>Syndication Options</h2>
272
  <form action="" method="post">
273
  <fieldset class="options">
274
+ <legend>Syndicated Feeds</legend>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
  <table class="editform" width="100%" cellspacing="2" cellpadding="5">
276
  <tr>
277
  <th width="33%" scope="row">Syndicate links in category:</th>
294
  <td width="67%"><ul style="margin:0;list-style:none">
295
  <li><input type="checkbox" name="hardcode_name" value="no"<?=(($hardcode_name=='yes')?'':' checked="checked"')?>/> Contributor name (feed title)</li>
296
  <li><input type="checkbox" name="hardcode_description" value="no"<?=(($hardcode_description=='yes')?'':' checked="checked"')?>/> Contributor description (feed tagline)</li>
297
+ <li><input type="checkbox" name="hardcode_url" value="no"<?=(($hardcode_url=='yes')?'':' checked="checked"')?>/> Homepage (feed link)</li>
298
+ </ul></td></tr>
299
+ </table>
300
+ </fieldset>
301
+
302
+ <fieldset class="options">
303
+ <legend>Syndicated Posts</egend>
304
+ <table class="editform" width="100%" cellspacing="2" cellpadding="5">
305
+ <tr><th width="33%" scope="row">Permalinks point to:</th>
306
+ <td width="67%"><select name="munge_permalink" size="1">
307
+ <option value="yes"<?=($munge_permalink=='yes')?' selected="selected"':''?>>original website</option>
308
+ <option value="no"<?=($munge_permalink=='no')?' selected="selected"':''?>>this website</option>
309
+ </select></td></tr>
310
+
311
+ <tr><th width="33%" scope="row">Publication:</th>
312
+ <td width="67%"><ul style="list-style:none">
313
+ <li><label><input type="radio" name="post_status" value="publish"<?=($post_status=='publish')?' checked="checked"':''?> /> Publish syndicated posts immediately</label></li>
314
+ <li><label><input type="radio" name="post_status" value="draft"<?=($post_status=='draft')?' checked="checked"':''?> /> Hold syndicated posts as drafts</label></li>
315
+ <li><label><input type="radio" name="post_status" value="private"<?=($post_status=='private')?' checked="checked"':''?> /> Hold syndicated posts as private posts</label></li>
316
+ </ul></td></tr>
317
+
318
+ <tr><th width="33%" scope="row">Comments:</th>
319
+ <td width="67%"><ul style="list-style:none">
320
+ <li><input type="checkbox" name="comment_status" value="open"<?=($comment_status=='open')?' checked="checked"':''?> /> Allow comments on syndicated posts</label></li>
321
+ </ul></td></tr>
322
+
323
+ <tr><th width="33%" scope="row">Trackback and Pingback:</th>
324
+ <td width="67%"><ul style="list-style:none">
325
+ <li><input type="checkbox" name="ping_status" value="open"<?=($ping_status=='open')?' checked="checked"':''?> /> Accept pings on syndicated posts</li>
326
  </ul></td></tr>
327
 
328
  <tr><th width="33%" scope="row" style="vertical-align:top">Unfamiliar authors:</th>
336
  <li><label><input type="radio" name="unfamiliar_category" value="create"<?=$unfamiliar_category['create']?>/> create any categories the post is in</label></li>
337
  <li><label><input type="radio" name="unfamiliar_category" value="default"<?=$unfamiliar_category['default']?>/> don't create new categories</li>
338
  <li><label><input type="radio" name="unfamiliar_category" value="filter"<?=$unfamiliar_category['filter']?>/> don't create new categories and don't syndicate posts unless they match at least one familiar category</label></li>
 
 
 
339
  </ul></td></tr>
340
 
341
  </select></td></tr>
372
  <?php $cont = true;
373
  if (isset($_REQUEST['action'])):
374
  //die("ACTION: '".$_REQUEST['action']."'");
375
+ if ($_REQUEST['action'] == 'feedfinder') : $cont = fwp_feedfinder_page();
376
+ elseif ($_REQUEST['action'] == 'switchfeed') : $cont = fwp_switchfeed_page();
377
+ elseif ($_REQUEST['action'] == 'Delete Checked') : $cont = fwp_multidelete_page();
378
  endif;
379
  endif;
380
 
723
 
724
  $feeds = array ();
725
  if ($result): foreach ($result as $link):
 
 
726
  if (strlen($link->link_rss) > 0):
727
+ $sec = FeedWordPress::notes_to_settings($link->link_notes);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
728
  $sec['uri'] = $link->link_rss;
729
  $sec['name'] = $link->link_name;
730
 
747
  endforeach; endif;
748
 
749
  $this->feeds = $feeds;
750
+ } // FeedWordPress::FeedWordPress ()
751
+
752
+ function notes_to_settings ($link_notes) {
753
+ $notes = explode("\n", $link_notes);
754
+
755
+ $sec = array ();
756
+ foreach ($notes as $note):
757
+ list($key, $value) = explode(": ", $note, 2);
758
+
759
+ if (strlen($key) > 0) :
760
+ // Unescape and trim() off the whitespace.
761
+ // Thanks to Ray Lischner for pointing out the
762
+ // need to trim off whitespace.
763
+ $sec[$key] = stripcslashes (trim($value));
764
+ endif;
765
+ endforeach;
766
+ return $sec;
767
+ } // FeedWordPress::notes_to_settings ()
768
 
769
  function update ($uri) {
770
  global $wpdb;
857
  return $ret;
858
  }
859
 
860
+ function syndicated_status ($what, $f, $default) {
861
+ global $wpdb;
862
+
863
+ $ret = get_settings("feedwordpress_syndicated_{$what}_status");
864
+ if ( isset($f["$what status"]) ) :
865
+ $ret = $f["$what status"];
866
+ elseif (!$ret) :
867
+ $ret = $default;
868
+ endif;
869
+ return $wpdb->escape(trim(strtolower($ret)));
870
+ }
871
+
872
  function negative ($f, $setting) {
873
  $nego = array ('n', 'no', 'f', 'false');
874
  return (isset($f[$setting]) and in_array(strtolower($f[$setting]), $nego));
887
  endif;
888
 
889
  $update = array();
890
+ if (!FeedWordPress::hardcode('url', $f) and isset($channel['link'])) :
891
  $update[] = "link_url = '".$wpdb->escape($channel['link'])."'";
892
  endif;
893
 
956
  // Cf.: <http://mosquito.wordpress.org/view.php?id=901>
957
  global $fwp_channel, $fwp_feedmeta;
958
  $fwp_channel = $channel; $fwp_feedmeta = $f;
959
+
960
  $item = apply_filters('syndicated_item', $item);
961
 
962
  // Filters can halt further processing by returning NULL
1006
  # in the feed, and if it's in the content itself we'd have
1007
  # to do yet more XML parsing to do things right. For now
1008
  # this will have to do.
1009
+
1010
  $this->_base = $item['link']; // Reset the base for resolving relative URIs
1011
  foreach ($this->uri_attrs as $pair):
1012
  list($tag,$attr) = $pair;
1048
  # --- cut here ---
1049
  $post['post_name'] = sanitize_title($post['post_title']);
1050
  # --- cut here ---
1051
+
1052
  # RSS is a fucking mess. Figure out whether we have a date in
1053
  # dc:date, <issued>, <pubDate>, etc., and get it into Unix epoch
1054
  # format for reformatting. If you can't find anything, use the
1075
  $post['post_modified'] = date('Y-m-d H:i:s', $post['epoch']['modified']);
1076
  $post['post_date_gmt'] = gmdate('Y-m-d H:i:s', $post['epoch']['issued']);
1077
  $post['post_modified_gmt'] = gmdate('Y-m-d H:i:s', $post['epoch']['modified']);
1078
+
1079
+ # Use feed-level preferences or the global default.
1080
+ $post['post_status'] = FeedWordPress::syndicated_status('post', $f, 'publish');
1081
+ $post['comment_status'] = FeedWordPress::syndicated_status('comment', $f, 'closed');
1082
+ $post['ping_status'] = FeedWordPress::syndicated_status('ping', $f, 'closed');
1083
+
1084
  // Unique ID (hopefully a unique tag: URI); failing that, the permalink
1085
  if (isset($item['id'])):
1086
  $post['guid'] = $wpdb->escape($item['id']);
1087
  else:
1088
  $post['guid'] = $wpdb->escape($item['link']);
1089
  endif;
1090
+
1091
+ // RSS 2.0 / Atom 0.6+ enclosure support
1092
+ if ( isset($item['enclosure']) and is_array($item['enclosure']) ) :
1093
+ foreach ( $item['enclosure'] as $enclosure ) :
1094
+ $post['meta']['enclosure'][] =
1095
+ $enclosure['url']."\n".
1096
+ $enclosure['length']."\n".
1097
+ $enclosure['type'];
1098
+ endforeach;
1099
+ endif;
1100
+
1101
+ // In case you want to point back to the blog this was syndicated from
1102
+ if (isset($channel['title'])) $post['meta']['syndication_source'] = $channel['title'];
1103
+ if (isset($channel['link'])) $post['meta']['syndication_source_uri'] = $channel['link'];
1104
+ $post['meta']['syndication_feed'] = $f['uri'];
1105
 
1106
  // In case you want to know the external permalink...
1107
+ $post['meta']['syndication_permalink'] = $item['link'];
1108
 
1109
  // Feed-by-feed options for author and category creation
1110
  $post['named']['unfamiliar']['author'] = $f['unfamiliar author'];
1291
  } // function FeedWordPress::add_to_category ()
1292
  # --- cut here ---
1293
 
1294
+ // FeedWordPress::add_rss_meta: adds interesting meta-data to each entry
1295
+ // using the space for custom keys. The set of keys and values to add is
1296
+ // specified by the keys and values of $post['meta']. This is used to
1297
+ // store anything that the WordPress user might want to access from a
1298
+ // template concerning the post's original source that isn't provided
1299
+ // for by standard WP meta-data (i.e., any interesting data about the
1300
+ // syndicated post other than author, title, timestamp, categories, and
1301
+ // guid). It's also used to hook into WordPress's support for
1302
+ // enclosures.
1303
  function add_rss_meta ($wpdb, $postId, $post) {
1304
+ if ( is_array($post) and isset($post['meta']) and is_array($post['meta']) ) :
1305
+ foreach ( $post['meta'] as $key => $values ) :
 
1306
 
1307
+ $key = $wpdb->escape($key);
1308
+
1309
+ // If this is an update, clear out the old
1310
+ // values to avoid duplication.
1311
  $result = $wpdb->query("
1312
  DELETE FROM $wpdb->postmeta
1313
  WHERE post_id='$postId' AND meta_key='$key'
1314
  ");
1315
 
1316
+ // Allow for either a single value or an array
1317
+ if (!is_array($values)) $values = array($values);
1318
+ foreach ( $values as $value ) :
1319
+ $value = $wpdb->escape($value);
1320
+ $result = $wpdb->query("
1321
+ INSERT INTO $wpdb->postmeta
1322
+ SET
1323
+ post_id='$postId',
1324
+ meta_key='$key',
1325
+ meta_value='$value'
1326
+ ");
1327
+ endforeach;
1328
+ endforeach;
1329
+ endif;
1330
  } /* FeedWordPress::add_rss_meta () */
1331
 
1332
  // FeedWordPress::author_to_id (): get the ID for an author name from
wp-content/update-feeds.php CHANGED
@@ -22,18 +22,18 @@
22
  #
23
  # cd <your-wordpress>/wp-content ; php update-feeds.php
24
  #
25
- # or to send an HTTP GET request to the appropriate URI:
26
  #
27
- # curl http://xyz.com/wp-content/update-feeds.php?shibboleth=foo
28
  #
29
  # 4. If you want to update *one* of the feeds rather than *all* of them, then
30
  # pass the URI and title as command-line arguments:
31
  #
32
  # $ php update-feeds.php http://www.radgeek.com "Geekery Today"
33
  #
34
- # or in the GET query:
35
  #
36
- # $ curl http://www.xyz.com/wp-content/update-feeds.php?uri=http://www.radgeek.com\&title=Geekery+Today\&shibboleth=yourshibboleth
37
  #
38
 
39
  require_once ('../wp-config.php');
22
  #
23
  # cd <your-wordpress>/wp-content ; php update-feeds.php
24
  #
25
+ # or to send an HTTP POST request to the appropriate URI:
26
  #
27
+ # curl http://xyz.com/wp-content/update-feeds.php -d shibboleth=foo
28
  #
29
  # 4. If you want to update *one* of the feeds rather than *all* of them, then
30
  # pass the URI and title as command-line arguments:
31
  #
32
  # $ php update-feeds.php http://www.radgeek.com "Geekery Today"
33
  #
34
+ # or in the POST request:
35
  #
36
+ # $ curl http://www.xyz.com/wp-content/update-feeds.php -d uri=http://www.radgeek.com\&title=Geekery+Today\&shibboleth=foo
37
  #
38
 
39
  require_once ('../wp-config.php');