Skip to content

Commit

Permalink
Merge pull request #2 from mitchelldmiller/version_102
Browse files Browse the repository at this point in the history
Check for empty Web server variables.
  • Loading branch information
mitchelldmiller authored May 31, 2022
2 parents 920d065 + b6a1123 commit a5a46c3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
13 changes: 8 additions & 5 deletions BlockWpSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
/**
* Plugin Name: Block WP Search
* Description: Block all WordPress Searches.
* Version: 1.00
* Version: 1.02
* Author: Mitchell D. Miller
* Author URI: https://mitchelldmiller.com/
* Plugin URI: https://mitchelldmiller.github.io/block-wp-search/
* Plugin URI: https://github.com/mitchelldmiller/block-wp-search
* GitHub Plugin URI: https://github.com/mitchelldmiller/block-wp-search
* License: MIT
* License URI: https://github.com/mitchelldmiller/block-wp-search/blob/main/LICENSE
Expand Down Expand Up @@ -37,7 +37,7 @@
class BlockWpSearch {

/**
* Add init hook to block search requests.
* Add init hook to intercept search requests.
* @see https://developer.wordpress.org/reference/hooks/init/
* @return BlockWpSearch
*/
Expand All @@ -55,11 +55,14 @@ public function block_searches() {
if (defined( 'WP_CLI' ) && WP_CLI) {
return;
}
if (empty($_SERVER['REQUEST_URI']) || strstr($_SERVER['REQUEST_URI'], '/wp-admin/') || $_SERVER['REQUEST_METHOD'] == 'HEAD') {
if (empty($_SERVER['REQUEST_URI']) || empty($_SERVER['REQUEST_METHOD'])) {
return;
}
if (strstr($_SERVER['REQUEST_URI'], '/wp-admin/') || $_SERVER['REQUEST_METHOD'] != 'GET') {
return;
} // end if

if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['s'])) {
if (isset($_GET['s'])) {
wp_safe_redirect('/not_found/', 307);
exit;
}
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ block-wp-search
====================
* Requires: [WordPress 2.3](https://wordpress.org/support/wordpress-version/version-2-3/)
* Tested with: [WordPress 6.0](https://wordpress.org/support/wordpress-version/version-6-0/)
* Stable version: [1.00](https://github.com/mitchelldmiller/block-wp-search/releases/latest)
* Stable version: [1.02](https://github.com/mitchelldmiller/block-wp-search/releases/latest)

Description
-----------
Expand All @@ -11,7 +11,6 @@ Description
WordPress search is not always helpful: especially for small sites.
Use Block WordPress Search plugin to redirect search requests.


Features
-----------
* Redirects search requests to `/not_found/`
Expand All @@ -38,7 +37,7 @@ Configuration

Updates
-----------
* Install [GitHub Updater](https://github.com/afragen/github-updater/releases/latest) plugin to update Quick Mail from Github.
* Install [GitHub Updater](https://github.com/afragen/github-updater/releases/latest) plugin to update Block WP Search from Github.

Translators / Translations
-----------
Expand Down
12 changes: 8 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
Requires at least: 2.3
Tested up to: 6.0.0
Requires PHP: 5.3
Stable tag: 1.00
Stable tag: 1.02
License: MIT
License URI: https://github.com/mitchelldmiller/block-wp-search/blob/main/LICENSE

Expand All @@ -18,11 +18,9 @@ WordPress search is not always helpful: especially for small sites.
Use Block WordPress Search plugin to redirect search requests.

== Features ==

* Redirects search requests to `/not_found/`

= Learn More =

* [Follow development on Github](https://github.com/mitchelldmiller/block-wp-search/).

== Installation ==
Expand All @@ -35,7 +33,7 @@ Use Block WordPress Search plugin to redirect search requests.
2. Activate the plugin through the WordPress _Plugins_ menu.

= WP-CLI
* How to install and activate the latest version of Quick Mail with [WP-CLI](https://wp-cli.org/) :
* How to install and activate the latest version of Block WP Search with [WP-CLI](https://wp-cli.org/) :

`wp plugin install https://github.com/mitchelldmiller/block-wp-search/archive/main.zip --activate`

Expand All @@ -57,11 +55,17 @@ Use Block WordPress Search plugin to redirect search requests.
* First public release.
* Tested with WordPress 6.0.0

= 1.02
* Check for empty server variables.

== Upgrade Notice ==

= 1.00 =
* First public release.

= 1.02 =
* Upgrade recommeneded.


== License ==
Block Wp Search is free for personal or commercial use. Please support future development with a [donation](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4AAGBFXRAPFJY).

0 comments on commit a5a46c3

Please sign in to comment.