PluginProbe
FeedWordPress / 0.96
FeedWordPress v0.96
trunk 0.8 0.9 0.91 0.95 0.96 0.97 0.98 0.981 0.99 0.991 0.992 0.993 2008.1030 2008.1101 2008.1105 2008.1214 2009.0612 2009.0613 2009.0618 2009.0707 2009.1111 2009.1112 2010.0127 2010.0528 All 65 releases
feedwordpress / wp-content / update-feeds.php

update-feeds.php in FeedWordPress 0.96, at wp-content/update-feeds.php

108 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 # update-feeds.php: Instruct FeedWordPress to scan for fresh content
3 #
4 # Project: FeedWordPress
5 # URI: <http://projects.radgeek.com/feedwordpress>
6 # Author: Charles Johnson <technophilia@radgeek.com>
7 # License: GPL
8 # Version: 2005.04.09
9 #
10 # USAGE
11 # -----
12 # update-feeds.php is a useful script for instructing the FeedWordPress plugin
13 # to scan for fresh content on the feeds that it syndicates. This is handy if
14 # you want your syndication site to actually syndicate content, and you can't
15 # rely on all your contributors to send you an XML-RPC ping when they update.
16 #
17 # 1. Install FeedWordPress and activate the FeedWordPress plugin. (See
18 # <http://projects.radgeek.com/feedwordpress/install> if you need a guide
19 # for the perplexed.)
20 #
21 # 2. Set up a cron job to run update-feeds.php locally:
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');
40 require_once (ABSPATH . WPINC . '/class-IXR.php');
41
42 # -- Don't change these unless you know what you're doing...
43 define ('RPC_URI', NULL); // Change this setting to ping a URI of your own devising
44 define ('RPC_MAGIC', 'tag:radgeek.com/projects/feedwordpress/'); // update all
45
46 if (is_null(RPC_URI)):
47 $rpc_uri = get_settings('siteurl');
48 if (substr($rpc_uri,-1)!='/') $rpc_uri .= '/';
49 $rpc_uri .= 'xmlrpc.php';
50 else:
51 $rpc_uri = RPC_URI;
52 endif;
53
54 # -- Are we running from an HTTP GET or from the command line?
55 if (isset($_SERVER['REQUEST_URI'])) {
56 $rpc_secret = (isset($_REQUEST['shibboleth'])?$_REQUEST['shibboleth']:'');
57 $uri = (isset($_REQUEST['uri']) ? $_REQUEST['uri'] : RPC_MAGIC.$rpc_secret);
58 $blog = (isset($_REQUEST['title']) ? $_REQUEST['title'] : 'Refresh');
59
60 echo <<< EOHTML
61 <html>
62 <head>
63 <title>update-feeds :: FeedWordPress</title>
64 </head>
65
66 <body>
67 <h1>update-feeds: instruct FeedWordPress to look for new syndicated content</h1>
68
69 <p>Sending ping to &lt;$rpc_uri&gt;...</p>
70
71 <p>
72 EOHTML;
73 } else {
74 // Query secret word from database
75 $rpc_secret = get_settings('feedwordpress_rpc_secret');
76
77 $uri = (isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : RPC_MAGIC.$rpc_secret);
78 $blog = (isset($_SERVER['argv'][2]) ? $_SERVER['argv'][2] : 'Refresh');
79 }
80
81 $client =& new IXR_Client($rpc_uri);
82 $ret = $client->query('weblogUpdates.ping', $blog, $uri);
83
84 if (!$ret):
85 if (!isset($_SERVER['REQUEST_URI'])) echo "[".date('Y-m-d H:i:s')."][update-feeds] ";
86 echo "The XML-RPC ping failed (local): ".wp_specialchars($client->getErrorMessage())."\n";
87 else:
88 $response = $client->getResponse();
89 if ($response['flerror']):
90 if (!isset($_SERVER['REQUEST_URI'])) echo "[".date('Y-m-d H:i:s')."][update-feeds] ";
91 echo "The XML-RPC ping failed (remote): ".wp_specialchars($response['message'])."\n";
92 elseif (isset($_SERVER['REQUEST_URI'])):
93 if (!isset($_SERVER['REQUEST_URI'])) echo "[".date('Y-m-d H:i:s')."][update-feeds] ";
94 echo "The XML-RPC ping succeeded: ".wp_specialchars($response['message'])."\n";
95 endif;
96 endif;
97
98 if (isset($_SERVER['REQUEST_URI'])) {
99 echo <<<EOHTML
100 </p>
101
102 <p><a href="../wp-admin">&larr; Return to WordPress Dashboard</a></p>
103 </body>
104 </html>
105 EOHTML;
106 }
107 ?>
108