Skip to content

Commit

Permalink
Forward port changes made to SVN repo - v1.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
solarissmoke committed Mar 30, 2018
1 parent 7e236a5 commit d86946e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
22 changes: 16 additions & 6 deletions disable-feeds.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php
/*
Plugin Name: Disable Feeds
Plugin URI: http://wordpress.org/extend/plugins/disable-feeds/
Plugin URI: https://wordpress.org/plugins/disable-feeds/
Description: Disable all RSS/Atom feeds on your WordPress site.
Version: 1.4.2
Version: 1.4.4
Author: Samir Shah, BBpress support by Matthew Sigley
Author URI: http://rayofsolaris.net/
License: GPLv2 or later
Text Domain: disable-feeds
*/

if( !defined( 'ABSPATH' ) )
Expand All @@ -32,6 +33,12 @@ private function __construct() {
add_action( 'template_redirect', array( $this, 'filter_feeds' ), 1 );
add_filter( 'bbp_request', array( $this, 'filter_bbp_feeds' ), 9 );
}

add_action( 'plugins_loaded', array( $this, 'register_text_domain' ) );
}

public function register_text_domain() {
load_plugin_textdomain( 'disable-feeds', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}

function admin_setup() {
Expand All @@ -42,9 +49,10 @@ function admin_setup() {

function settings_field() {
$redirect = $this->redirect_status();
echo '<p>The <em>Disable Feeds</em> plugin is active, By default, all feeds are disabled, and all requests for feeds are redirected to the corresponding HTML content. You can tweak this behaviour below.</p>';
echo '<p><input type="radio" name="disable_feeds_redirect" value="on" id="disable_feeds_redirect_yes" class="radio" ' . checked( $redirect, 'on', false ) . '/><label for="disable_feeds_redirect_yes"> Redirect feed requests to corresponding HTML content</label><br /><input type="radio" name="disable_feeds_redirect" value="off" id="disable_feeds_redirect_no" class="radio" ' . checked( $redirect, 'off', false ) . '/><label for="disable_feeds_redirect_no"> Issue a Page Not Found (404) error for feed requests</label></p>';
echo '<p><input type="checkbox" name="disable_feeds_allow_main" value="on" id="disable_feeds_allow_main" ' . checked( $this->allow_main(), true, false ) . '/><label for="disable_feeds_allow_main"> Do not disable the <strong>global post feed</strong> and <strong>global comment feed</strong></label></p>';
echo '<p>' . __('The <em>Disable Feeds</em> plugin is active, By default, all feeds are disabled, and all requests for feeds are redirected to the corresponding HTML content. You can tweak this behaviour below.', 'disable-feeds') . '</p>';
echo '<p><input type="radio" name="disable_feeds_redirect" value="on" id="disable_feeds_redirect_yes" class="radio" ' . checked( $redirect, 'on', false ) . '/><label for="disable_feeds_redirect_yes"> ' . __('Redirect feed requests to corresponding HTML content', 'disable-feeds') . '</label>';
echo '<br /><input type="radio" name="disable_feeds_redirect" value="off" id="disable_feeds_redirect_no" class="radio" ' . checked( $redirect, 'off', false ) . '/><label for="disable_feeds_redirect_no"> ' . __('Issue a Page Not Found (404) error for feed requests', 'disable-feeds') . '</label></p>';
echo '<p><input type="checkbox" name="disable_feeds_allow_main" value="on" id="disable_feeds_allow_main" ' . checked( $this->allow_main(), true, false ) . '/><label for="disable_feeds_allow_main"> ' . __('Do not disable the <strong>global post feed</strong> and <strong>global comment feed</strong>', 'disable-feeds') . '</label></p>';
}

function remove_links() {
Expand Down Expand Up @@ -135,6 +143,8 @@ private function redirect_feed() {
$wp_query->is_feed = false;
$wp_query->set_404();
status_header( 404 );
// Override the xml+rss header set by WP in send_headers
header( 'Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset') );
}
}

Expand All @@ -153,4 +163,4 @@ private function allow_main() {
}
}

Disable_Feeds::get_instance();
Disable_Feeds::get_instance();
10 changes: 8 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
=== Disable Feeds ===
Contributors: solarissmoke
Tags: disable, rss, atom, rdf, feeds
Requires at least: 3.6
Tested up to: 4.2
Requires at least: 4.0
Tested up to: 4.9
Stable tag: trunk

Disables all RSS/Atom/RDF feeds on your WordPress site.
Expand Down Expand Up @@ -37,6 +37,12 @@ In `Settings -> Reading` you will find an option to allow global feeds. All othe

== Changelog ==

= 1.4.4 =
* Add translation support.

= 1.4.3 =
* Compatiblity for for WP 3.6 when feed URLs are set to return a 404 response.

= 1.4.2 =
* Fix potential security issue when redirecting feeds.

Expand Down

0 comments on commit d86946e

Please sign in to comment.