File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ mu-plugins/*
1818! mu-plugins /mu-autoloader.php
1919! mu-plugins /osi-event-list
2020! mu-plugins /osi-sponsors-list
21+ ! websub-compat.php
2122
2223themes /*
2324! themes /osi
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Plugin Name: WebSub Backwards Compatibility
4+ * Version: 1.0.0
5+ * Author: WordPress.com Special Projects
6+ * Author URI: https://wpspecialprojects.wordpress.com/
7+ */
8+
9+ if ( ! defined ( 'ABSPATH ' ) ) {
10+ return ;
11+ }
12+
13+ /**
14+ * Filter `pubsubhubbub_feed_urls` and `pubsubhubbub_comment_feed_urls`.
15+ *
16+ * Still send pings for the old `blog.opensource.org` Feed-URLs.
17+ *
18+ * @param array $links Array of Feed URLs.
19+ *
20+ * @return array $links Array of filtered Feed URLs.
21+ */
22+ function websub_compat ( $ links ) {
23+ if ( ! $ links || ! is_array ( $ links ) ) {
24+ return $ links ;
25+ }
26+
27+ $ host = wp_parse_url ( get_home_url (), PHP_URL_HOST );
28+ $ compat_links = array ();
29+
30+ foreach ( $ links as $ link ) {
31+ $ compat_links [] = str_replace ( $ host , 'blog. ' . $ host , $ link );
32+ }
33+
34+ return array_unique ( array_merge ( $ links , $ compat_links ) );
35+ }
36+ add_filter ( 'pubsubhubbub_feed_urls ' , 'websub_compat ' );
37+ add_filter ( 'pubsubhubbub_comment_feed_urls ' , 'websub_compat ' );
You can’t perform that action at this time.
0 commit comments