Version Description
- Complete rewrite
- Support WebSub
Download this release
Release Info
Developer | pfefferle |
Plugin | WebSub/PubSubHubbub |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.7.2 to 2.0.0
- includes/deprecated.php +35 -0
- includes/functions.php +112 -0
- includes/pubsubhubbub-publisher.php +97 -0
- languages/pubsubhubbub.pot +17 -35
- pubsubhubbub.php +152 -271
- readme.txt +20 -70
- templates/settings-page.php +27 -0
includes/deprecated.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Beeing backwards compatible
|
4 |
+
* based on a fix by Stephen Paul Weber (http://singpolyma.net)
|
5 |
+
*
|
6 |
+
* @deprecated
|
7 |
+
*/
|
8 |
+
function publish_to_hub( $deprecated = null, $feed_urls ) {
|
9 |
+
pubsubhubbub_publish_to_hub( $feed_urls );
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* The ability for other plugins to hook into the PuSH code
|
14 |
+
*
|
15 |
+
* @param array $feed_urls a list of feed urls you want to publish
|
16 |
+
*
|
17 |
+
* @deprecated
|
18 |
+
*/
|
19 |
+
function pshb_publish_to_hub( $feed_urls ) {
|
20 |
+
pubsubhubbub_publish_to_hub( $feed_urls );
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Map old filter to new filter
|
25 |
+
*
|
26 |
+
* @param array $feed_urls the list of feed urls
|
27 |
+
*
|
28 |
+
* @return array filtered list
|
29 |
+
*
|
30 |
+
* @deprecated
|
31 |
+
*/
|
32 |
+
function pshb_feed_urls( $feed_urls ) {
|
33 |
+
return apply_filters( 'pshb_feed_urls', $feed_urls );
|
34 |
+
}
|
35 |
+
add_filter( 'pubsubhubbub_feed_urls', 'pshb_feed_urls' );
|
includes/functions.php
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The ability for other plugins to hook into the PuSH code
|
4 |
+
*
|
5 |
+
* @param array $feed_urls a list of feed urls you want to publish
|
6 |
+
*/
|
7 |
+
function pubsubhubbub_publish_to_hub( $feed_urls ) {
|
8 |
+
require_once( dirname( __FILE__ ) . '/pubsubhubbub-publisher.php' );
|
9 |
+
|
10 |
+
// remove dups (ie. they all point to feedburner)
|
11 |
+
$feed_urls = array_unique( $feed_urls );
|
12 |
+
|
13 |
+
pubsubhubbub_update_pinged_urls( $feed_urls );
|
14 |
+
|
15 |
+
// get the list of hubs
|
16 |
+
$hub_urls = pubsubhubbub_get_hubs();
|
17 |
+
|
18 |
+
// loop through each hub
|
19 |
+
foreach ( $hub_urls as $hub_url ) {
|
20 |
+
$p = new PubSubHubbub_Publisher( $hub_url );
|
21 |
+
// publish the update to each hub
|
22 |
+
$response = $p->publish_update( $feed_urls );
|
23 |
+
|
24 |
+
do_action( 'pubsubhubbub_publish_update_response', $response );
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* get the endpoints from the wordpress options table
|
30 |
+
* valid parameters are "publish" or "subscribe"
|
31 |
+
*
|
32 |
+
* @uses apply_filters() Calls 'pubsubhubbub_hub_urls' filter
|
33 |
+
*/
|
34 |
+
function pubsubhubbub_get_hubs() {
|
35 |
+
$endpoints = get_option( 'pubsubhubbub_endpoints' );
|
36 |
+
$hub_urls = explode( PHP_EOL, $endpoints );
|
37 |
+
|
38 |
+
// if no values have been set, revert to the defaults (websub on app engine & superfeedr)
|
39 |
+
if ( ! $endpoints || ! is_array( $endpoints ) ) {
|
40 |
+
$hub_urls[] = 'https://pubsubhubbub.appspot.com';
|
41 |
+
$hub_urls[] = 'https://pubsubhubbub.superfeedr.com';
|
42 |
+
}
|
43 |
+
|
44 |
+
// clean out any blank values
|
45 |
+
foreach ( $hub_urls as $key => $value ) {
|
46 |
+
if ( is_null( $value ) || '' == $value ) {
|
47 |
+
unset( $hub_urls[ $key ] );
|
48 |
+
} else {
|
49 |
+
$hub_urls[ $key ] = trim( $hub_urls[ $key ] );
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
return apply_filters( 'pubsubhubbub_hub_urls', $hub_urls );
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Add new pinged urls
|
58 |
+
*
|
59 |
+
* @param array $urls list of urls
|
60 |
+
*/
|
61 |
+
function pubsubhubbub_update_pinged_urls( $urls ) {
|
62 |
+
if ( ! is_array( $urls ) ) {
|
63 |
+
return;
|
64 |
+
}
|
65 |
+
|
66 |
+
$pinged_urls = pubsubhubbub_get_pinged_urls();
|
67 |
+
$pinged_urls = array_merge( $pinged_urls, $urls );
|
68 |
+
|
69 |
+
update_option( 'pubsubhubbub_pinged_urls', array_unique( $pinged_urls ) );
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Return already pinged urls
|
74 |
+
*
|
75 |
+
* @return array list of urls
|
76 |
+
*/
|
77 |
+
function pubsubhubbub_get_pinged_urls() {
|
78 |
+
$default_feeds = array(
|
79 |
+
get_bloginfo( 'atom_url' ),
|
80 |
+
get_bloginfo( 'rdf_url' ),
|
81 |
+
get_bloginfo( 'rss2_url' ),
|
82 |
+
get_bloginfo( 'comments_atom_url' ),
|
83 |
+
get_bloginfo( 'comments_rss2_url' ),
|
84 |
+
);
|
85 |
+
|
86 |
+
$feeds = get_option( 'pubsubhubbub_pinged_urls', $default_feeds );
|
87 |
+
|
88 |
+
if ( is_array( $feeds ) ) {
|
89 |
+
return $feeds;
|
90 |
+
}
|
91 |
+
|
92 |
+
return $default_feeds;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Check if link supports PubSubHubbub or WebSub
|
97 |
+
*
|
98 |
+
* @return boolean
|
99 |
+
*/
|
100 |
+
function pubsubhubbub_show_discovery() {
|
101 |
+
// get current url
|
102 |
+
$urls = pubsubhubbub_get_pinged_urls();
|
103 |
+
|
104 |
+
$current_url = home_url( add_query_arg( null, null ) );
|
105 |
+
|
106 |
+
// check if current url is one of the feed urls
|
107 |
+
if ( in_array( $current_url, $urls ) ) {
|
108 |
+
return true;
|
109 |
+
}
|
110 |
+
|
111 |
+
return false;
|
112 |
+
}
|
includes/pubsubhubbub-publisher.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// a PHP client library for pubsubhubbub
|
3 |
+
// as defined at http://code.google.com/p/pubsubhubbub/
|
4 |
+
// written by Josh Fraser | joshfraser.com | josh@eventvue.com
|
5 |
+
// modified by Matthias Pfefferle | notizblog.org | matthias@pfefferle.org
|
6 |
+
// Released under Apache License 2.0
|
7 |
+
|
8 |
+
/**
|
9 |
+
* A pubsubhubbub publisher
|
10 |
+
*
|
11 |
+
* @author Josh Fraser
|
12 |
+
* @author Matthias Pfefferle
|
13 |
+
*/
|
14 |
+
class PubSubHubbub_Publisher {
|
15 |
+
protected $hub_url;
|
16 |
+
protected $last_response;
|
17 |
+
|
18 |
+
// create a new Publisher
|
19 |
+
public function __construct( $hub_url ) {
|
20 |
+
|
21 |
+
if ( ! isset( $hub_url ) ) {
|
22 |
+
throw new Exception( 'Please specify a hub url' );
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( ! preg_match( '|^https?://|i', $hub_url ) ) {
|
26 |
+
throw new Exception( 'The specified hub url does not appear to be valid: ' . $hub_url );
|
27 |
+
}
|
28 |
+
|
29 |
+
$this->hub_url = $hub_url;
|
30 |
+
}
|
31 |
+
|
32 |
+
// accepts either a single url or an array of urls
|
33 |
+
public function publish_update( $topic_urls, $http_function = false ) {
|
34 |
+
if ( ! isset( $topic_urls ) ) {
|
35 |
+
throw new Exception( 'Please specify a topic url' );
|
36 |
+
}
|
37 |
+
|
38 |
+
// check that we're working with an array
|
39 |
+
if ( ! is_array( $topic_urls ) ) {
|
40 |
+
$topic_urls = array( $topic_urls );
|
41 |
+
}
|
42 |
+
|
43 |
+
// set the mode to publish
|
44 |
+
$post_string = 'hub.mode=publish';
|
45 |
+
// loop through each topic url
|
46 |
+
foreach ( $topic_urls as $topic_url ) {
|
47 |
+
// lightweight check that we're actually working w/ a valid url
|
48 |
+
if ( ! preg_match( '|^https?://|i', $topic_url ) ) {
|
49 |
+
throw new Exception( 'The specified topic url does not appear to be valid: ' . $topic_url );
|
50 |
+
}
|
51 |
+
|
52 |
+
// append the topic url parameters
|
53 |
+
$post_string .= '&hub.url=' . urlencode( $topic_url );
|
54 |
+
}
|
55 |
+
|
56 |
+
// make the http post request and return true/false
|
57 |
+
// easy to over-write to use your own http function
|
58 |
+
if ( $http_function ) {
|
59 |
+
return $http_function( $this->hub_url, $post_string );
|
60 |
+
} else {
|
61 |
+
return $this->http_post( $this->hub_url, $post_string );
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
// returns any error message from the latest request
|
66 |
+
public function last_response() {
|
67 |
+
return $this->last_response;
|
68 |
+
}
|
69 |
+
|
70 |
+
// default http function that uses curl to post to the hub endpoint
|
71 |
+
private function http_post( $url, $post_string ) {
|
72 |
+
// add any additional curl options here
|
73 |
+
$options = array(
|
74 |
+
CURLOPT_URL => $url,
|
75 |
+
CURLOPT_POST => true,
|
76 |
+
CURLOPT_POSTFIELDS => $post_string,
|
77 |
+
CURLOPT_RETURNTRANSFER => true,
|
78 |
+
CURLOPT_USERAGENT => 'PubSubHubbub-Publisher-PHP/1.0',
|
79 |
+
);
|
80 |
+
|
81 |
+
$ch = curl_init();
|
82 |
+
curl_setopt_array( $ch, $options );
|
83 |
+
|
84 |
+
$response = curl_exec( $ch );
|
85 |
+
$this->last_response = $response;
|
86 |
+
$info = curl_getinfo( $ch );
|
87 |
+
|
88 |
+
curl_close( $ch );
|
89 |
+
|
90 |
+
// all good
|
91 |
+
if ( 204 == $info['http_code'] ) {
|
92 |
+
return true;
|
93 |
+
}
|
94 |
+
|
95 |
+
return false;
|
96 |
+
}
|
97 |
+
}
|
languages/pubsubhubbub.pot
CHANGED
@@ -1,58 +1,40 @@
|
|
1 |
-
# Copyright (C)
|
2 |
-
# This file is distributed under the same license as the PubSubHubbub package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: PubSubHubbub 1.7.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/pubsubhubbub\n"
|
7 |
-
"POT-Creation-Date:
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"PO-Revision-Date:
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
-
"X-Generator: grunt-wp-i18n 0.5.
|
15 |
|
16 |
-
#: pubsubhubbub.php:
|
17 |
-
msgid "
|
18 |
-
msgstr ""
|
19 |
-
|
20 |
-
#: pubsubhubbub.php:214
|
21 |
-
msgid "Hubs (one per line)"
|
22 |
-
msgstr ""
|
23 |
-
|
24 |
-
#: pubsubhubbub.php:223
|
25 |
-
msgid "Thanks for using PubSubHubbub!"
|
26 |
-
msgstr ""
|
27 |
-
|
28 |
-
#: pubsubhubbub.php:225
|
29 |
-
msgid ""
|
30 |
-
"Visit these links to learn more about PubSubHubbub and the author of this "
|
31 |
-
"plugin:"
|
32 |
-
msgstr ""
|
33 |
-
|
34 |
-
#: pubsubhubbub.php:227
|
35 |
-
msgid "Subscribe to %s or %s (german)"
|
36 |
msgstr ""
|
37 |
|
38 |
-
#:
|
39 |
-
msgid "
|
40 |
msgstr ""
|
41 |
|
42 |
-
#:
|
43 |
-
msgid "
|
44 |
msgstr ""
|
45 |
|
46 |
-
#:
|
47 |
-
msgid "
|
48 |
msgstr ""
|
49 |
|
50 |
#. Plugin Name of the plugin/theme
|
51 |
-
msgid "PubSubHubbub"
|
52 |
msgstr ""
|
53 |
|
54 |
#. Plugin URI of the plugin/theme
|
55 |
-
msgid "https://github.com/pubsubhubbub/"
|
56 |
msgstr ""
|
57 |
|
58 |
#. Description of the plugin/theme
|
@@ -60,7 +42,7 @@ msgid "A better way to tell the world when your blog is updated."
|
|
60 |
msgstr ""
|
61 |
|
62 |
#. Author of the plugin/theme
|
63 |
-
msgid "
|
64 |
msgstr ""
|
65 |
|
66 |
#. Author URI of the plugin/theme
|
1 |
+
# Copyright (C) 2017 Matthias Pfefferle
|
2 |
+
# This file is distributed under the same license as the WebSub/PubSubHubbub package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WebSub/PubSubHubbub 1.7.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/pubsubhubbub\n"
|
7 |
+
"POT-Creation-Date: 2017-05-01 20:24:15+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
+
"X-Generator: grunt-wp-i18n 0.5.4\n"
|
15 |
|
16 |
+
#: pubsubhubbub.php:152
|
17 |
+
msgid "Settings"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
msgstr ""
|
19 |
|
20 |
+
#: templates/settings-page.php:2
|
21 |
+
msgid "Define custom hubs"
|
22 |
msgstr ""
|
23 |
|
24 |
+
#: templates/settings-page.php:17
|
25 |
+
msgid "Hubs (one per line)"
|
26 |
msgstr ""
|
27 |
|
28 |
+
#: templates/settings-page.php:26
|
29 |
+
msgid "Thanks for using WebSub/PubSubHubbub!"
|
30 |
msgstr ""
|
31 |
|
32 |
#. Plugin Name of the plugin/theme
|
33 |
+
msgid "WebSub/PubSubHubbub"
|
34 |
msgstr ""
|
35 |
|
36 |
#. Plugin URI of the plugin/theme
|
37 |
+
msgid "https://github.com/pubsubhubbub/wordpress-pubsubhubbub/"
|
38 |
msgstr ""
|
39 |
|
40 |
#. Description of the plugin/theme
|
42 |
msgstr ""
|
43 |
|
44 |
#. Author of the plugin/theme
|
45 |
+
msgid "Matthias Pfefferle"
|
46 |
msgstr ""
|
47 |
|
48 |
#. Author URI of the plugin/theme
|
pubsubhubbub.php
CHANGED
@@ -1,312 +1,193 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Plugin Name: PubSubHubbub
|
4 |
-
* Plugin URI: https://github.com/pubsubhubbub/
|
5 |
* Description: A better way to tell the world when your blog is updated.
|
6 |
-
* Version:
|
7 |
-
* Author:
|
8 |
-
* Author
|
9 |
-
*
|
|
|
|
|
10 |
* Domain Path: /languages
|
11 |
*/
|
12 |
|
13 |
-
|
|
|
14 |
|
15 |
-
|
16 |
-
* the ability for other plugins to hook into the PuSH code
|
17 |
-
*
|
18 |
-
* @param array $feed_urls a list of feed urls you want to publish
|
19 |
-
*/
|
20 |
-
function pshb_publish_to_hub( $feed_urls ) {
|
21 |
-
// remove dups (ie. they all point to feedburner)
|
22 |
-
$feed_urls = array_unique( $feed_urls );
|
23 |
-
// get the list of hubs
|
24 |
-
$hub_urls = pshb_get_pubsub_endpoints();
|
25 |
-
// loop through each hub
|
26 |
-
foreach ( $hub_urls as $hub_url ) {
|
27 |
-
$p = new PshbPublisher( $hub_url );
|
28 |
-
// publish the update to each hub
|
29 |
-
if ( ! $p->publish_update( $feed_urls ) ) {
|
30 |
-
// TODO: add better error handling here
|
31 |
-
}
|
32 |
-
}
|
33 |
-
}
|
34 |
|
35 |
-
/**
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
*/
|
41 |
-
function pshb_publish_post( $post_id ) {
|
42 |
-
// get default feeds
|
43 |
-
$feed_urls = pshb_get_feed_urls();
|
44 |
|
45 |
-
|
46 |
-
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
add_action( 'publish_post', 'pshb_publish_post' );
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
* @param int $comment_id the comment-id
|
56 |
-
* @return int the comment-id
|
57 |
-
*/
|
58 |
-
function pshb_publish_comment( $comment_id ) {
|
59 |
-
// get default comment-feeds
|
60 |
-
$feed_urls = pshb_get_comment_feed_urls();
|
61 |
|
62 |
-
|
63 |
-
pshb_publish_to_hub( $feed_urls );
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
add_action( 'comment_post', 'pshb_publish_comment' );
|
68 |
|
69 |
-
|
70 |
-
* add hub-<link> to the atom feed
|
71 |
-
*/
|
72 |
-
function pshb_add_atom_link_tag() {
|
73 |
-
$hub_urls = pshb_get_pubsub_endpoints();
|
74 |
-
foreach ( $hub_urls as $hub_url ) {
|
75 |
-
echo '<link rel="hub" href="'.$hub_url.'" />';
|
76 |
-
}
|
77 |
-
}
|
78 |
-
add_action( 'atom_head', 'pshb_add_atom_link_tag' );
|
79 |
-
add_action( 'comments_atom_head', 'pshb_add_atom_link_tag' );
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
function pshb_add_rss_link_tag() {
|
85 |
-
$hub_urls = pshb_get_pubsub_endpoints();
|
86 |
-
foreach ( $hub_urls as $hub_url ) {
|
87 |
-
echo '<atom:link rel="hub" href="'.$hub_url.'"/>';
|
88 |
}
|
89 |
-
}
|
90 |
-
add_action( 'rss_head', 'pshb_add_rss_link_tag' );
|
91 |
-
add_action( 'rdf_header', 'pshb_add_rss_link_tag' );
|
92 |
-
add_action( 'rss2_head', 'pshb_add_rss_link_tag' );
|
93 |
-
add_action( 'commentsrss2_head', 'pshb_add_rss_link_tag' );
|
94 |
|
95 |
-
/**
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
-
/**
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
-
/**
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
// change <rss version="X.XX"> to <rss version="X.XX" xmlns:atom="http://www.w3.org/2005/Atom">
|
121 |
-
echo preg_replace( $pattern, $replacement, $feed );
|
122 |
-
}
|
123 |
-
add_action( 'do_feed_rss', 'pshb_end_rss_link_tag', 11 ); // run after output
|
124 |
|
125 |
-
|
126 |
-
* add a link to our settings page in the WP menu
|
127 |
-
*/
|
128 |
-
function pshb_add_plugin_menu() {
|
129 |
-
add_options_page( 'PubSubHubbub Settings', 'PubSubHubbub', 'administrator', 'pubsubhubbub', 'pshb_add_settings_page' );
|
130 |
-
}
|
131 |
-
add_action( 'admin_menu', 'pshb_add_plugin_menu' );
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
*
|
137 |
-
* @uses apply_filters() Calls 'pshb_hub_urls' filter
|
138 |
-
*/
|
139 |
-
function pshb_get_pubsub_endpoints() {
|
140 |
-
$endpoints = get_option( 'pubsub_endpoints' );
|
141 |
-
$hub_urls = explode( PHP_EOL, $endpoints );
|
142 |
-
|
143 |
-
// if no values have been set, revert to the defaults (pubsubhubbub on app engine & superfeedr)
|
144 |
-
if ( ! $endpoints ) {
|
145 |
-
$hub_urls[] = 'https://pubsubhubbub.appspot.com';
|
146 |
-
$hub_urls[] = 'https://pubsubhubbub.superfeedr.com';
|
147 |
}
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
|
|
155 |
}
|
156 |
-
}
|
157 |
|
158 |
-
|
159 |
-
}
|
160 |
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
*/
|
166 |
-
function pshb_get_feed_urls() {
|
167 |
-
// we want to notify the hub for every feed
|
168 |
-
$feed_urls = array();
|
169 |
-
$feed_urls[] = get_bloginfo( 'atom_url' );
|
170 |
-
$feed_urls[] = get_bloginfo( 'rss_url' );
|
171 |
-
$feed_urls[] = get_bloginfo( 'rdf_url' );
|
172 |
-
$feed_urls[] = get_bloginfo( 'rss2_url' );
|
173 |
-
|
174 |
-
return apply_filters( 'pshb_feed_urls', $feed_urls );
|
175 |
-
}
|
176 |
|
177 |
-
/**
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
// we want to notify the hub for every feed
|
184 |
-
$feed_urls = array();
|
185 |
-
$feed_urls[] = get_bloginfo( 'comments_atom_url' );
|
186 |
-
$feed_urls[] = get_bloginfo( 'comments_rss2_url' );
|
187 |
|
188 |
-
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
191 |
-
/**
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
function
|
196 |
-
|
197 |
-
|
198 |
-
<h2><?php _e( 'Define custom hubs', 'pubsubhubbub' ); ?></h2>
|
199 |
-
|
200 |
-
<form method="post" action="options.php">
|
201 |
-
<?php //wp_nonce_field('update-options'); ?>
|
202 |
-
<!-- starting -->
|
203 |
-
<?php settings_fields( 'pubsubhubbub_options' ); ?>
|
204 |
-
<?php do_settings_sections( 'pubsubhubbub_options' ); ?>
|
205 |
-
<!-- ending -->
|
206 |
-
|
207 |
-
<?php
|
208 |
-
// load the existing pubsub endpoint list from the wordpress options table
|
209 |
-
$pubsub_endpoints = trim( implode( PHP_EOL, pshb_get_pubsub_endpoints() ), PHP_EOL );
|
210 |
-
?>
|
211 |
-
|
212 |
-
<table class="form-table">
|
213 |
-
<tr valign="top">
|
214 |
-
<th scope="row"><?php _e( 'Hubs (one per line)', 'pubsubhubbub' ); ?></th>
|
215 |
-
<td><textarea name="pubsub_endpoints" rows="10" cols="50" class="large-text"><?php echo $pubsub_endpoints; ?></textarea></td>
|
216 |
-
</tr>
|
217 |
-
</table>
|
218 |
-
|
219 |
-
<?php submit_button(); ?>
|
220 |
-
|
221 |
-
</form>
|
222 |
-
|
223 |
-
<p><strong><?php _e( 'Thanks for using PubSubHubbub!', 'pubsubhubbub' ); ?></strong></p>
|
224 |
-
|
225 |
-
<p><?php _e( 'Visit these links to learn more about PubSubHubbub and the author of this plugin:', 'pubsubhubbub' ); ?></p>
|
226 |
-
<ul>
|
227 |
-
<li><?php printf( __( 'Subscribe to %s or %s (german)' ), '<a href="http://www.onlineaspect.com">Online Aspect</a>', '<a href="http://notizblog.org/">notizBlog</a>' ) ?></li>
|
228 |
-
<li><?php printf( __( 'Follow %s or %s on twitter' ), '<a href="http://twitter.com/joshfraser">Josh Fraser</a>', '<a href="http://twitter.com/pfefferle">Matthias Pfefferle</a>' ) ?></li>
|
229 |
-
<li><a href="http://code.google.com/p/pubsubhubbub/"><?php _e( 'Learn more about the PubSubHubbub protocol', 'pubsubhubbub' ); ?></a></li>
|
230 |
-
</ul>
|
231 |
-
</div>
|
232 |
-
|
233 |
-
<?php }
|
234 |
|
235 |
-
/**
|
236 |
-
|
237 |
-
|
238 |
-
function
|
239 |
-
|
240 |
-
|
241 |
-
|
|
|
|
|
242 |
}
|
243 |
-
return $links;
|
244 |
-
}
|
245 |
-
add_filter( 'plugin_action_links', 'pshb_add_settings_link', 10, 2 );
|
246 |
|
247 |
-
/**
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
$vars[] = 'hub_challenge';
|
256 |
-
$vars[] = 'hub_topic';
|
257 |
-
$vars[] = 'hub_url';
|
258 |
-
$vars[] = 'pubsubhubbub';
|
259 |
-
return $vars;
|
260 |
-
}
|
261 |
-
add_filter( 'query_vars', 'pshb_query_var' );
|
262 |
|
263 |
-
|
264 |
-
* adds link headers as defined in the current v0.4 draft
|
265 |
-
*
|
266 |
-
* @link https://github.com/pubsubhubbub/PubSubHubbub/issues/2
|
267 |
-
*/
|
268 |
-
function pshb_template_redirect() {
|
269 |
-
// get all feeds
|
270 |
-
$feed_urls = pshb_get_feed_urls();
|
271 |
-
$comment_feed_urls = pshb_get_comment_feed_urls();
|
272 |
-
|
273 |
-
// get current url
|
274 |
-
$urls = array_unique( array_merge( $feed_urls, $comment_feed_urls ) );
|
275 |
-
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
276 |
-
|
277 |
-
// check if current url is one of the feed urls
|
278 |
-
if ( in_array( $current_url, $urls ) ) {
|
279 |
-
$hub_urls = pshb_get_pubsub_endpoints();
|
280 |
// add all "hub" headers
|
281 |
foreach ( $hub_urls as $hub_url ) {
|
282 |
-
header( 'Link:
|
283 |
}
|
|
|
|
|
|
|
284 |
// add the "self" header
|
285 |
-
header( 'Link:
|
286 |
}
|
287 |
-
}
|
288 |
-
add_action( 'template_redirect', 'pshb_template_redirect' );
|
289 |
|
290 |
-
/**
|
291 |
-
|
292 |
-
|
293 |
-
function
|
294 |
-
|
295 |
-
}
|
296 |
-
add_action( 'admin_init', 'pshb_register_settings' );
|
297 |
-
|
298 |
-
// Load the plugin textdomain.
|
299 |
-
function pshb_load_textdomain() {
|
300 |
-
load_plugin_textdomain( 'pubsubhubbub', false, basename( dirname( plugin_dir_path( __FILE__ ) ) ) . '/languages' );
|
301 |
-
}
|
302 |
-
add_action( 'init', 'pshb_load_textdomain' );
|
303 |
|
304 |
-
/**
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
function publish_to_hub( $deprecated = null, $feed_urls ) {
|
311 |
-
pshb_publish_to_hub( $feed_urls );
|
312 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Plugin Name: WebSub/PubSubHubbub
|
4 |
+
* Plugin URI: https://github.com/pubsubhubbub/wordpress-pubsubhubbub/
|
5 |
* Description: A better way to tell the world when your blog is updated.
|
6 |
+
* Version: 2.0.0
|
7 |
+
* Author: Matthias Pfefferle
|
8 |
+
* Author URI: https://notiz.blog/
|
9 |
+
* License: MIT
|
10 |
+
* License URI: http://opensource.org/licenses/MIT
|
11 |
+
* Text Domain: pubsubhubbub
|
12 |
* Domain Path: /languages
|
13 |
*/
|
14 |
|
15 |
+
add_action( 'init', array( 'PubSubHubbub_Plugin', 'load_textdomain' ) );
|
16 |
+
add_action( 'plugins_loaded', array( 'PubSubHubbub_Plugin', 'init' ) );
|
17 |
|
18 |
+
class PubSubHubbub_Plugin {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
+
/**
|
21 |
+
* Initialize plugin
|
22 |
+
*/
|
23 |
+
public static function init() {
|
24 |
+
require_once( dirname( __FILE__ ) . '/includes/functions.php' );
|
|
|
|
|
|
|
|
|
25 |
|
26 |
+
add_action( 'publish_post', array( 'PubSubHubbub_Plugin', 'publish_post' ) );
|
27 |
+
add_action( 'comment_post', array( 'PubSubHubbub_Plugin', 'publish_comment' ) );
|
28 |
|
29 |
+
add_action( 'atom_head', array( 'PubSubHubbub_Plugin', 'add_atom_link_tag' ) );
|
30 |
+
add_action( 'comments_atom_head', array( 'PubSubHubbub_Plugin', 'add_atom_link_tag' ) );
|
|
|
31 |
|
32 |
+
add_action( 'rdf_header', array( 'PubSubHubbub_Plugin', 'add_rss_link_tag' ) );
|
33 |
+
add_action( 'rss2_head', array( 'PubSubHubbub_Plugin', 'add_rss_link_tag' ) );
|
34 |
+
add_action( 'commentsrss2_head', array( 'PubSubHubbub_Plugin', 'add_rss_link_tag' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
+
add_action( 'rdf_ns', array( 'PubSubHubbub_Plugin', 'add_rss_ns_link' ) );
|
|
|
37 |
|
38 |
+
add_action( 'admin_menu', array( 'PubSubHubbub_Plugin', 'add_plugin_menu' ) );
|
39 |
+
add_action( 'admin_init', array( 'PubSubHubbub_Plugin', 'register_settings' ) );
|
|
|
40 |
|
41 |
+
add_filter( 'plugin_action_links', array( 'PubSubHubbub_Plugin', 'add_settings_link' ), 10, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
+
add_action( 'template_redirect', array( 'PubSubHubbub_Plugin', 'template_redirect' ) );
|
44 |
+
|
45 |
+
require_once( dirname( __FILE__ ) . '/includes/deprecated.php' );
|
|
|
|
|
|
|
|
|
46 |
}
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
/**
|
49 |
+
* Function that is called whenever a new post is published
|
50 |
+
*
|
51 |
+
* @param int $post_id the post-id
|
52 |
+
* @return int the post-id
|
53 |
+
*/
|
54 |
+
public static function publish_post( $post_id ) {
|
55 |
+
// we want to notify the hub for every feed
|
56 |
+
$feed_urls = array();
|
57 |
+
$feed_urls[] = get_bloginfo( 'atom_url' );
|
58 |
+
$feed_urls[] = get_bloginfo( 'rdf_url' );
|
59 |
+
$feed_urls[] = get_bloginfo( 'rss2_url' );
|
60 |
+
|
61 |
+
$feed_urls = apply_filters( 'pubsubhubbub_feed_urls', $feed_urls, $post_id );
|
62 |
+
|
63 |
+
// publish them
|
64 |
+
pubsubhubbub_publish_to_hub( $feed_urls );
|
65 |
+
}
|
66 |
|
67 |
+
/**
|
68 |
+
* Function that is called whenever a new comment is published
|
69 |
+
*
|
70 |
+
* @param int $comment_id the comment-id
|
71 |
+
* @return int the comment-id
|
72 |
+
*/
|
73 |
+
public static function publish_comment( $comment_id ) {
|
74 |
+
// get default comment-feeds
|
75 |
+
$feed_urls = array();
|
76 |
+
$feed_urls[] = get_bloginfo( 'comments_atom_url' );
|
77 |
+
$feed_urls[] = get_bloginfo( 'comments_rss2_url' );
|
78 |
+
|
79 |
+
$feed_urls = apply_filters( 'pubsubhubbub_comment_feed_urls', $feed_urls, $comment_id );
|
80 |
+
|
81 |
+
// publish them
|
82 |
+
pubsubhubbub_publish_to_hub( $feed_urls );
|
83 |
+
}
|
84 |
|
85 |
+
/**
|
86 |
+
* Add hub-<link> to the atom feed
|
87 |
+
*/
|
88 |
+
public static function add_atom_link_tag() {
|
89 |
+
// check if current url is one of the feed urls
|
90 |
+
if ( ! pubsubhubbub_show_discovery() ) {
|
91 |
+
return;
|
92 |
+
}
|
|
|
|
|
|
|
|
|
93 |
|
94 |
+
$hub_urls = pubsubhubbub_get_hubs();
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
+
foreach ( $hub_urls as $hub_url ) {
|
97 |
+
printf( '<link rel="hub" href="%s" />', $hub_url ) . PHP_EOL;
|
98 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
|
101 |
+
/**
|
102 |
+
* Add hub-<link> to the rss/rdf feed
|
103 |
+
*/
|
104 |
+
public static function add_rss_link_tag() {
|
105 |
+
// check if current url is one of the feed urls
|
106 |
+
if ( ! pubsubhubbub_show_discovery() ) {
|
107 |
+
return;
|
108 |
}
|
|
|
109 |
|
110 |
+
$hub_urls = pubsubhubbub_get_hubs();
|
|
|
111 |
|
112 |
+
foreach ( $hub_urls as $hub_url ) {
|
113 |
+
printf( '<atom:link rel="hub" href="%s"/>', $hub_url ) . PHP_EOL;
|
114 |
+
}
|
115 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
+
/**
|
118 |
+
* Add atom namespace to rdf-feed
|
119 |
+
*/
|
120 |
+
public static function add_rss_ns_link() {
|
121 |
+
echo ' xmlns:atom="http://www.w3.org/2005/Atom" ' . PHP_EOL;
|
122 |
+
}
|
|
|
|
|
|
|
|
|
123 |
|
124 |
+
/**
|
125 |
+
* Add a link to our settings page in the WP menu
|
126 |
+
*/
|
127 |
+
public static function add_plugin_menu() {
|
128 |
+
add_options_page(
|
129 |
+
'WebSub/PubSubHubbub Settings',
|
130 |
+
'WebSub/PubSubHubbub',
|
131 |
+
'administrator',
|
132 |
+
'pubsubhubbub',
|
133 |
+
array(
|
134 |
+
'PubSubHubbub_Plugin',
|
135 |
+
'add_settings_page',
|
136 |
+
)
|
137 |
+
);
|
138 |
+
}
|
139 |
|
140 |
+
/**
|
141 |
+
* Write the content for our settings page that allows you to
|
142 |
+
* define your endpoints
|
143 |
+
*/
|
144 |
+
public static function add_settings_page() {
|
145 |
+
load_template( plugin_dir_path( __FILE__ ) . 'templates/settings-page.php' );
|
146 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
+
/**
|
149 |
+
* Add a settings link next to deactive / edit
|
150 |
+
*/
|
151 |
+
public static function add_settings_link( $links, $file ) {
|
152 |
+
if ( 'pubsubhubbub/pubsubhubbub.php' == $file && function_exists( 'admin_url' ) ) {
|
153 |
+
$settings_link = '<a href="' . admin_url( 'options-general.php?page=pubsubhubbub' ) . '">' . __( 'Settings' ) . '</a>';
|
154 |
+
array_unshift( $links, $settings_link ); // before other links
|
155 |
+
}
|
156 |
+
return $links;
|
157 |
}
|
|
|
|
|
|
|
158 |
|
159 |
+
/**
|
160 |
+
* Adds link headers as defined in the current v0.4 draft
|
161 |
+
*/
|
162 |
+
public static function template_redirect() {
|
163 |
+
// check if current url is one of the feed urls
|
164 |
+
if ( ! pubsubhubbub_show_discovery() ) {
|
165 |
+
return;
|
166 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
|
168 |
+
$hub_urls = pubsubhubbub_get_hubs();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
// add all "hub" headers
|
170 |
foreach ( $hub_urls as $hub_url ) {
|
171 |
+
header( sprintf( 'Link: <%s>; rel="hub"', $hub_url ), false );
|
172 |
}
|
173 |
+
|
174 |
+
$current_url = home_url( add_query_arg( null, null ) );
|
175 |
+
|
176 |
// add the "self" header
|
177 |
+
header( sprintf( 'Link: <%s>; rel="self"', $current_url ), false );
|
178 |
}
|
|
|
|
|
179 |
|
180 |
+
/**
|
181 |
+
* Register PubSubHubbub settings
|
182 |
+
*/
|
183 |
+
public static function register_settings() {
|
184 |
+
register_setting( 'pubsubhubbub_options', 'pubsubhubbub_endpoints' );
|
185 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
|
187 |
+
/**
|
188 |
+
* Load the plugin textdomain.
|
189 |
+
*/
|
190 |
+
public static function load_textdomain() {
|
191 |
+
load_plugin_textdomain( 'pubsubhubbub', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
192 |
+
}
|
|
|
|
|
193 |
}
|
readme.txt
CHANGED
@@ -1,15 +1,16 @@
|
|
1 |
-
=== PubSubHubbub ===
|
2 |
-
Contributors:
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
7 |
|
8 |
A better way to tell the world when your blog is updated.
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
-
This
|
13 |
|
14 |
This plugin:
|
15 |
|
@@ -30,84 +31,33 @@ Please contact me if you operate a hub that you would like to be included as a d
|
|
30 |
|
31 |
== Installation ==
|
32 |
|
33 |
-
1. Upload the `
|
34 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
35 |
-
3. Select custom hubs under your PubSubHubbub Settings (optional)
|
36 |
|
37 |
== Frequently Asked Questions ==
|
38 |
|
39 |
-
= Where can I learn more about the
|
40 |
|
41 |
-
You can visit [
|
42 |
|
43 |
-
= Where can I learn more about the
|
44 |
|
45 |
-
You can
|
46 |
-
and [Matthias Pfefferle](http://pfefferle.org "Matthias Pfefferle") at [Notizblog](http://notizblog.org/ "Notizblog")
|
47 |
|
48 |
== Screenshots ==
|
49 |
|
50 |
-
1. The
|
51 |
|
52 |
== Changelog ==
|
53 |
|
54 |
-
Project
|
55 |
|
56 |
-
=
|
57 |
-
*
|
58 |
-
*
|
59 |
-
* updated some documentation URLs to use HTTPS
|
60 |
-
* added workaround for invalid screenshot URL generated by grunt-wp-readme-to-markdown
|
61 |
|
62 |
-
= 1.
|
63 |
-
* fixed some links
|
64 |
-
* finished language support
|
65 |
-
|
66 |
-
= 1.7.0 =
|
67 |
-
* fixed "plugin name"
|
68 |
-
* nicer docs
|
69 |
-
* WordPress coding standard
|
70 |
-
|
71 |
-
= 1.6.5 =
|
72 |
-
* hotfix
|
73 |
-
|
74 |
-
= 1.6.4 =
|
75 |
-
* removed pubsubhubbub client
|
76 |
-
* improvements for a better PuSH v0.4 support
|
77 |
-
* fixed small bugs
|
78 |
-
|
79 |
-
= 1.6.3 =
|
80 |
-
* Update hub URL for SuperFeedr (now pubsubhubbub.superfeedr.com)
|
81 |
-
* Update credits and documentation
|
82 |
-
|
83 |
-
= 1.6.1 =
|
84 |
-
* Bug fixes
|
85 |
-
|
86 |
-
= 1.6 =
|
87 |
-
* Added comment-feed support
|
88 |
-
* Added simple subscriber functions
|
89 |
-
* Added link header
|
90 |
-
|
91 |
-
= 1.5 =
|
92 |
-
* Added filter to modify $feed_urls
|
93 |
-
* Re-Added Stephen Paul Webers changes
|
94 |
-
|
95 |
-
= 1.4 =
|
96 |
-
* Added name spacing to avoid conflicts with other plugins & added patch from pfefferle
|
97 |
-
|
98 |
-
= 1.3 =
|
99 |
-
* Added multi-user support and now tested up to 2.9.1
|
100 |
-
|
101 |
-
= 1.2 =
|
102 |
-
* Added support for multiple hubs
|
103 |
-
|
104 |
-
= 1.1 =
|
105 |
-
* Added RSS support
|
106 |
-
|
107 |
-
= 1.0 =
|
108 |
* First attempt
|
109 |
|
110 |
== Upgrade Notice ==
|
111 |
-
|
112 |
-
= 1.4 =
|
113 |
-
Upgrade eliminates conflicts with other Wordpress plugins
|
1 |
+
=== WebSub/PubSubHubbub ===
|
2 |
+
Contributors: pfefferle, joshfraz
|
3 |
+
Donate link: http://14101978.de
|
4 |
+
Tags: webhooks, websub, puhsubhubbub, pubsub, ping, push, indieweb, openweb, ostatus
|
5 |
+
Requires at least: 4.5
|
6 |
+
Tested up to: 4.7.4
|
7 |
+
Stable tag: 2.0.0
|
8 |
|
9 |
A better way to tell the world when your blog is updated.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
This plugin is a simple way to let people know in real-time when your blog is updated. PubSubHubbub is widely adopted and is used by Google Reader, Google Alerts and many other services. WebSub provides a common mechanism for communication between publishers of any kind of Web content and their subscribers, based on HTTP web hooks. Subscription requests are relayed through hubs, which validate and verify the request. Hubs then distribute new and updated content to subscribers when it becomes available. WebSub was previously known as PubSubHubbub.
|
14 |
|
15 |
This plugin:
|
16 |
|
31 |
|
32 |
== Installation ==
|
33 |
|
34 |
+
1. Upload the `pubsubhubub` directory to your `/wp-content/plugins/` directory
|
35 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
36 |
+
3. Select custom hubs under your WebSub/PubSubHubbub Settings (optional)
|
37 |
|
38 |
== Frequently Asked Questions ==
|
39 |
|
40 |
+
= Where can I learn more about the WebSub protocol? =
|
41 |
|
42 |
+
You can visit [WebSub on Github](https://github.com/w3c/websub "WebSub on Github")
|
43 |
|
44 |
+
= Where can I learn more about the PubsSubHubbub protocol? =
|
45 |
|
46 |
+
You can visit [PubsSubHubbub on Github](https://github.com/pubsubhubbub "PubsSubHubbub on Github")
|
|
|
47 |
|
48 |
== Screenshots ==
|
49 |
|
50 |
+
1. The WebSub Settings page allows you to define which hubs you want to use
|
51 |
|
52 |
== Changelog ==
|
53 |
|
54 |
+
Project maintained on github at [pubsubhubbub/wordpress-pubsubhubbub](https://github.com/pubsubhubbub/wordpress-pubsubhubbub).
|
55 |
|
56 |
+
= 2.0.0 =
|
57 |
+
* Complete rewrite
|
58 |
+
* Support WebSub
|
|
|
|
|
59 |
|
60 |
+
= 1.0.0 =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
* First attempt
|
62 |
|
63 |
== Upgrade Notice ==
|
|
|
|
|
|
templates/settings-page.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<h2><?php _e( 'Define custom hubs', 'pubsubhubbub' ); ?></h2>
|
3 |
+
|
4 |
+
<form method="post" action="options.php">
|
5 |
+
<!-- starting -->
|
6 |
+
<?php settings_fields( 'pubsubhubbub_options' ); ?>
|
7 |
+
<?php do_settings_sections( 'pubsubhubbub_options' ); ?>
|
8 |
+
<!-- ending -->
|
9 |
+
|
10 |
+
<?php
|
11 |
+
// load the existing pubsub endpoint list from the wordpress options table
|
12 |
+
$pubsubhubbub_endpoints = trim( implode( PHP_EOL, pubsubhubbub_get_hubs() ), PHP_EOL );
|
13 |
+
?>
|
14 |
+
|
15 |
+
<table class="form-table">
|
16 |
+
<tr valign="top">
|
17 |
+
<th scope="row"><?php _e( 'Hubs (one per line)', 'pubsubhubbub' ); ?></th>
|
18 |
+
<td><textarea name="pubsubhubbub_endpoints" rows="10" cols="50" class="large-text"><?php echo $pubsubhubbub_endpoints; ?></textarea></td>
|
19 |
+
</tr>
|
20 |
+
</table>
|
21 |
+
|
22 |
+
<?php submit_button(); ?>
|
23 |
+
|
24 |
+
</form>
|
25 |
+
|
26 |
+
<p><strong><?php _e( 'Thanks for using WebSub/PubSubHubbub!', 'pubsubhubbub' ); ?></strong></p>
|
27 |
+
</div>
|