Created
August 25, 2020 17:40
-
-
Save rhyswynne/08f00869ad576082a5c76385b6c4b5e9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: WP eBay Product Feeds - Extra Spam Checker | |
Plugin URI: | |
Description: A stronger spam checker for WP eBay Product Feeds | |
Version: 0.1 | |
Author: Winwar Media | |
Author URI: https://www.winwar.co.uk/?utm_source=author-link&utm_medium=plugin&utm_campaign=ebayfeedsforwordpress | |
Text Domain: ebay-feeds-for-wordpress | |
*/ | |
/** | |
* Throttle the Spam Checker | |
* | |
* @param boolean $canview If the user can or cannot view the feed | |
* | |
* @return mixed $canview (or void if die) | |
*/ | |
function throttle_spam_checker( $canview ) { | |
$userip = $_SERVER['REMOTE_ADDR']; | |
if ( !empty($userip) ) { | |
$reverse_ip = implode(".", array_reverse(explode(".", $UserIP))); | |
if ( checkdnsrr($reverse_ip.".sbl.spamhaus.org.", "A") || checkdnsrr($reverse_ip.".xbl.spamhaus.org.", "A") || checkdnsrr($reverse_ip.".zen.spamhaus.org.", "A") ) { | |
die; // Can also be return false | |
} | |
} | |
return $canview; | |
} add_filter( 'wp_ebay_product_feed_bot_blocker', 'throttle_spam_checker', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment