Version Description
- Update plugin header to avoid deprecated argument warnings
- Update class constructor to modern PHP
- Update readme to reflect new name for the standard (WebSub)
- Correct duplicate filter name
- Add disable_pushpress_send_ping filter to disable pings when needed
- Add X-Hub-Self headers
- Bump stable to 4.9
Download this release
Release Info
Developer | kraftbj |
Plugin | PuSHPress |
Version | 0.1.9 |
Comparing to | |
See all releases |
Code changes from version 0.1.8 to 0.1.9
- class-pushpress.php +5 -5
- pushpress.php +5 -5
- readme.txt +16 -7
- send-ping.php +19 -2
class-pushpress.php
CHANGED
@@ -3,12 +3,12 @@ class PuSHPress {
|
|
3 |
var $http_timeout;
|
4 |
var $http_user_agent;
|
5 |
|
6 |
-
function
|
7 |
|
8 |
function init( ) {
|
9 |
// Let other plugins modify various options
|
10 |
$this->http_timeout = apply_filters( 'pushpress_http_timeout', 5 );
|
11 |
-
$this->http_user_agent = apply_filters( '
|
12 |
|
13 |
// Make sure the hubs get listed in the RSS2 and Atom feeds
|
14 |
add_action( 'rss2_head', array( &$this, 'hub_link_rss2' ) );
|
@@ -73,10 +73,10 @@ class PuSHPress {
|
|
73 |
}
|
74 |
|
75 |
function feed_urls() {
|
76 |
-
return array(
|
77 |
get_bloginfo( 'rss2_url' ),
|
78 |
get_bloginfo( 'atom_url' ),
|
79 |
-
);
|
80 |
}
|
81 |
|
82 |
function check_topic( ) {
|
@@ -323,4 +323,4 @@ class PuSHPress {
|
|
323 |
$this->return_error( 'Error verifying callback URL, the challenge token did not match' );
|
324 |
}
|
325 |
} // function verify_request
|
326 |
-
} // class PuSHPress
|
3 |
var $http_timeout;
|
4 |
var $http_user_agent;
|
5 |
|
6 |
+
function __construct( ) { }
|
7 |
|
8 |
function init( ) {
|
9 |
// Let other plugins modify various options
|
10 |
$this->http_timeout = apply_filters( 'pushpress_http_timeout', 5 );
|
11 |
+
$this->http_user_agent = apply_filters( 'pushpress_http_user_agent', 'WordPress/PuSHPress ' . PUSHPRESS_VERSION );
|
12 |
|
13 |
// Make sure the hubs get listed in the RSS2 and Atom feeds
|
14 |
add_action( 'rss2_head', array( &$this, 'hub_link_rss2' ) );
|
73 |
}
|
74 |
|
75 |
function feed_urls() {
|
76 |
+
return apply_filters( 'pushpress_feed_urls', array(
|
77 |
get_bloginfo( 'rss2_url' ),
|
78 |
get_bloginfo( 'atom_url' ),
|
79 |
+
) );
|
80 |
}
|
81 |
|
82 |
function check_topic( ) {
|
323 |
$this->return_error( 'Error verifying callback URL, the challenge token did not match' );
|
324 |
}
|
325 |
} // function verify_request
|
326 |
+
} // class PuSHPress
|
pushpress.php
CHANGED
@@ -2,17 +2,17 @@
|
|
2 |
/*
|
3 |
Plugin Name: PuSHPress
|
4 |
Plugin URI:
|
5 |
-
Description: PubSubHubbub plugin for WordPress that includes the hub
|
6 |
-
Version: 0.1.
|
7 |
-
Author: Joseph Scott
|
8 |
Author URI:
|
9 |
License: GPLv2
|
10 |
-
|
11 |
*/
|
12 |
require_once dirname( __FILE__ ) . '/class-pushpress.php';
|
13 |
require_once dirname( __FILE__ ) . '/send-ping.php';
|
14 |
|
15 |
-
define( 'PUSHPRESS_VERSION', '0.1.
|
16 |
|
17 |
if ( !defined( 'PUSHPRESS_CLASS' ) )
|
18 |
define( 'PUSHPRESS_CLASS', 'PuSHPress' );
|
2 |
/*
|
3 |
Plugin Name: PuSHPress
|
4 |
Plugin URI:
|
5 |
+
Description: WebSub/PubSubHubbub plugin for WordPress that includes the hub
|
6 |
+
Version: 0.1.9
|
7 |
+
Author: Joseph Scott & Automattic
|
8 |
Author URI:
|
9 |
License: GPLv2
|
10 |
+
Network: true
|
11 |
*/
|
12 |
require_once dirname( __FILE__ ) . '/class-pushpress.php';
|
13 |
require_once dirname( __FILE__ ) . '/send-ping.php';
|
14 |
|
15 |
+
define( 'PUSHPRESS_VERSION', '0.1.9' );
|
16 |
|
17 |
if ( !defined( 'PUSHPRESS_CLASS' ) )
|
18 |
define( 'PUSHPRESS_CLASS', 'PuSHPress' );
|
readme.txt
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
-
===
|
2 |
-
Contributors: josephscott, automattic, westi
|
3 |
Plugin Name: PushPress
|
4 |
-
Tags: pubsubhubbub, push, WordPress.com
|
5 |
Requires at least: 2.9
|
6 |
-
Tested up to: 4.
|
7 |
License: GPLv2
|
8 |
-
Stable tag: 0.1.
|
9 |
|
10 |
-
Add PubSubHubbub support to your WordPress site, with a built in hub.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
This plugin adds PubSubHubbub ( PuSH ) support to your WordPress powered site. The main difference between this plugin and others is that it includes the hub features of PuSH, built right in. This means the updates will be sent directly from WordPress to your PuSH subscribers.
|
15 |
|
16 |
== Installation ==
|
17 |
|
@@ -31,6 +31,15 @@ No, once the plugin is activated it takes care of the rest.
|
|
31 |
|
32 |
== Changelog ==
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
= 0.1.8 =
|
35 |
* Use wp_safe_remote_*() instead of wp_remote_*()
|
36 |
|
1 |
+
=== PuSHPress ===
|
2 |
+
Contributors: josephscott, automattic, westi, kraftbj
|
3 |
Plugin Name: PushPress
|
4 |
+
Tags: websub, pubsubhubbub, push, WordPress.com
|
5 |
Requires at least: 2.9
|
6 |
+
Tested up to: 4.8
|
7 |
License: GPLv2
|
8 |
+
Stable tag: 0.1.9
|
9 |
|
10 |
+
Add WebSub (formerly known as PubSubHubbub) support to your WordPress site, with a built in hub.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
This plugin adds WebSub/PubSubHubbub ( PuSH ) support to your WordPress powered site. The main difference between this plugin and others is that it includes the hub features of PuSH, built right in. This means the updates will be sent directly from WordPress to your PuSH subscribers.
|
15 |
|
16 |
== Installation ==
|
17 |
|
31 |
|
32 |
== Changelog ==
|
33 |
|
34 |
+
= 0.1.9 =
|
35 |
+
* Update plugin header to avoid deprecated argument warnings
|
36 |
+
* Update class constructor to modern PHP
|
37 |
+
* Update readme to reflect new name for the standard (WebSub)
|
38 |
+
* Correct duplicate filter name
|
39 |
+
* Add disable_pushpress_send_ping filter to disable pings when needed
|
40 |
+
* Add X-Hub-Self headers
|
41 |
+
* Bump stable to 4.9
|
42 |
+
|
43 |
= 0.1.8 =
|
44 |
* Use wp_safe_remote_*() instead of wp_remote_*()
|
45 |
|
send-ping.php
CHANGED
@@ -4,6 +4,10 @@ if ( !function_exists( 'pushpress_send_ping' ) ) {
|
|
4 |
function pushpress_send_ping( $callback, $post_id, $feed_type, $secret ) {
|
5 |
global $pushpress, $current_user;
|
6 |
|
|
|
|
|
|
|
|
|
7 |
// Do all WP_Query calcs and send feeds as logged-out user.
|
8 |
$old_user_id = $current_user->ID;
|
9 |
wp_set_current_user( 0 );
|
@@ -42,7 +46,9 @@ if ( !function_exists( 'pushpress_send_ping' ) ) {
|
|
42 |
$feed_url = FALSE;
|
43 |
if ( $feed_type == 'rss2' ) {
|
44 |
do_action( 'pushpress_send_ping_rss2' );
|
45 |
-
$feed_url =
|
|
|
|
|
46 |
|
47 |
$remote_opt['headers']['Content-Type'] = 'application/rss+xml';
|
48 |
$remote_opt['headers']['Content-Type'] .= '; charset=' . get_option( 'blog_charset' );
|
@@ -50,7 +56,9 @@ if ( !function_exists( 'pushpress_send_ping' ) ) {
|
|
50 |
@load_template( ABSPATH . WPINC . '/feed-rss2.php' );
|
51 |
} elseif ( $feed_type == 'atom' ) {
|
52 |
do_action( 'pushpress_send_ping_atom' );
|
53 |
-
$feed_url =
|
|
|
|
|
54 |
|
55 |
$remote_opt['headers']['Content-Type'] = 'application/atom+xml';
|
56 |
$remote_opt['headers']['Content-Type'] .= '; charset=' . get_option( 'blog_charset' );
|
@@ -58,6 +66,7 @@ if ( !function_exists( 'pushpress_send_ping' ) ) {
|
|
58 |
@load_template( ABSPATH . WPINC . '/feed-atom.php' );
|
59 |
}
|
60 |
|
|
|
61 |
$remote_opt['body'] = ob_get_contents( );
|
62 |
ob_end_clean( );
|
63 |
|
@@ -95,3 +104,11 @@ if ( !function_exists( 'pushpress_send_ping' ) ) {
|
|
95 |
wp_set_current_user( $old_user_id );
|
96 |
} // function send_ping
|
97 |
} // if !function_exists
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
function pushpress_send_ping( $callback, $post_id, $feed_type, $secret ) {
|
5 |
global $pushpress, $current_user;
|
6 |
|
7 |
+
if ( apply_filters( 'disable_pushpress_send_ping', false ) ) {
|
8 |
+
return false;
|
9 |
+
}
|
10 |
+
|
11 |
// Do all WP_Query calcs and send feeds as logged-out user.
|
12 |
$old_user_id = $current_user->ID;
|
13 |
wp_set_current_user( 0 );
|
46 |
$feed_url = FALSE;
|
47 |
if ( $feed_type == 'rss2' ) {
|
48 |
do_action( 'pushpress_send_ping_rss2' );
|
49 |
+
$feed_url = get_feed_link( 'rss2' );
|
50 |
+
$pushpress->feed_url = $feed_url;
|
51 |
+
add_filter( 'self_link', 'pushpress_filter_self_link', 999 );
|
52 |
|
53 |
$remote_opt['headers']['Content-Type'] = 'application/rss+xml';
|
54 |
$remote_opt['headers']['Content-Type'] .= '; charset=' . get_option( 'blog_charset' );
|
56 |
@load_template( ABSPATH . WPINC . '/feed-rss2.php' );
|
57 |
} elseif ( $feed_type == 'atom' ) {
|
58 |
do_action( 'pushpress_send_ping_atom' );
|
59 |
+
$feed_url = get_feed_link( 'atom' );
|
60 |
+
$pushpress->feed_url = $feed_url;
|
61 |
+
add_filter( 'self_link', 'pushpress_filter_self_link', 999 );
|
62 |
|
63 |
$remote_opt['headers']['Content-Type'] = 'application/atom+xml';
|
64 |
$remote_opt['headers']['Content-Type'] .= '; charset=' . get_option( 'blog_charset' );
|
66 |
@load_template( ABSPATH . WPINC . '/feed-atom.php' );
|
67 |
}
|
68 |
|
69 |
+
$remote_opt['headers']['X-Hub-Self'] = $feed_url;
|
70 |
$remote_opt['body'] = ob_get_contents( );
|
71 |
ob_end_clean( );
|
72 |
|
104 |
wp_set_current_user( $old_user_id );
|
105 |
} // function send_ping
|
106 |
} // if !function_exists
|
107 |
+
|
108 |
+
function pushpress_filter_self_link( $orig_url ) {
|
109 |
+
global $pushpress;
|
110 |
+
|
111 |
+
// In some cases self_link could be non-feed URLs,
|
112 |
+
// from wp-admin or do_wp_cron, so make sure it uses the real feed URL.
|
113 |
+
return $pushpress->feed_url;
|
114 |
+
}
|