Version Description
- Bugfix: Redirect/404 setting in
Settings -> Reading
did not update properly.
Download this release
Release Info
Developer | solarissmoke |
Plugin | Disable Feeds |
Version | 1.1.1 |
Comparing to | |
See all releases |
Code changes from version 1.1 to 1.1.1
- disable-feeds.php +15 -8
- readme.txt +3 -0
disable-feeds.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Disable Feeds
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/disable-feeds/
|
5 |
Description: Disable all RSS/Atom feeds on your WordPress site.
|
6 |
-
Version: 1.1
|
7 |
Author: Samir Shah
|
8 |
Author URI: http://rayofsolaris.net/
|
9 |
License: GPLv2 or later
|
@@ -25,15 +25,12 @@ class Disable_Feeds {
|
|
25 |
|
26 |
function admin_setup() {
|
27 |
add_settings_field( 'disable_feeds_redirect', 'Disable Feeds Plugin', array( $this, 'settings_field' ), 'reading' );
|
28 |
-
register_setting( 'reading', 'disable_feeds_redirect'
|
29 |
-
}
|
30 |
-
|
31 |
-
function sanitize_settings( $val ) {
|
32 |
-
return (bool) $val;
|
33 |
}
|
34 |
|
35 |
function settings_field() {
|
36 |
-
|
|
|
37 |
}
|
38 |
|
39 |
function remove_links() {
|
@@ -45,7 +42,7 @@ class Disable_Feeds {
|
|
45 |
if( !is_feed() )
|
46 |
return;
|
47 |
|
48 |
-
if(
|
49 |
if( isset( $_GET['feed'] ) ) {
|
50 |
wp_redirect( remove_query_arg( 'feed' ), 301 );
|
51 |
exit;
|
@@ -60,6 +57,16 @@ class Disable_Feeds {
|
|
60 |
status_header( 404 );
|
61 |
}
|
62 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
}
|
64 |
|
65 |
new Disable_Feeds();
|
3 |
Plugin Name: Disable Feeds
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/disable-feeds/
|
5 |
Description: Disable all RSS/Atom feeds on your WordPress site.
|
6 |
+
Version: 1.1.1
|
7 |
Author: Samir Shah
|
8 |
Author URI: http://rayofsolaris.net/
|
9 |
License: GPLv2 or later
|
25 |
|
26 |
function admin_setup() {
|
27 |
add_settings_field( 'disable_feeds_redirect', 'Disable Feeds Plugin', array( $this, 'settings_field' ), 'reading' );
|
28 |
+
register_setting( 'reading', 'disable_feeds_redirect' );
|
|
|
|
|
|
|
|
|
29 |
}
|
30 |
|
31 |
function settings_field() {
|
32 |
+
$redirect = $this->redirect_status();
|
33 |
+
echo '<p>The <em>Disable Feeds</em> plugin is active, and all feed are disabled. By default, all requests for feeds are redirected to the corresponding HTML content. If you want to issue a 404 (page not found) response instead, select the second option below.</p><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 404 (page not found) error for feed requests</label></p>';
|
34 |
}
|
35 |
|
36 |
function remove_links() {
|
42 |
if( !is_feed() )
|
43 |
return;
|
44 |
|
45 |
+
if( $this->redirect_status() == 'on' ) {
|
46 |
if( isset( $_GET['feed'] ) ) {
|
47 |
wp_redirect( remove_query_arg( 'feed' ), 301 );
|
48 |
exit;
|
57 |
status_header( 404 );
|
58 |
}
|
59 |
}
|
60 |
+
|
61 |
+
private function redirect_status() {
|
62 |
+
$r = get_option( 'disable_feeds_redirect', 'on' );
|
63 |
+
// back compat
|
64 |
+
if( is_bool( $r ) ) {
|
65 |
+
$r = $r ? 'on' : 'off';
|
66 |
+
update_option( 'disable_feeds_redirect', $r );
|
67 |
+
}
|
68 |
+
return $r;
|
69 |
+
}
|
70 |
}
|
71 |
|
72 |
new Disable_Feeds();
|
readme.txt
CHANGED
@@ -29,6 +29,9 @@ In `Settings -> Reading` you will find an option to turn off redirection and iss
|
|
29 |
|
30 |
== Changelog ==
|
31 |
|
|
|
|
|
|
|
32 |
= 1.1 =
|
33 |
* Added the option to disable redirection of feed requests (and issue a 404 instead)
|
34 |
|
29 |
|
30 |
== Changelog ==
|
31 |
|
32 |
+
= 1.1.1 =
|
33 |
+
* Bugfix: Redirect/404 setting in `Settings -> Reading` did not update properly.
|
34 |
+
|
35 |
= 1.1 =
|
36 |
* Added the option to disable redirection of feed requests (and issue a 404 instead)
|
37 |
|