<?php
/*
Plugin Name: SpyderSpanker Pro
Plugin URI: http://spyderspanker.com/
Description: Blocks bad spiders and bots, throttles good ones.
Author: Todd Spears
Version: 5.4
Author URI: http://spyderspanker.com/
*/

if (!defined('SPYDERS_SPOOF_LIVE')) {
	define('SPYDERS_SPOOF_LIVE',FALSE);
}
if (!defined('SPYDERS_LINES_SMALL_SIZE')) {
	define('SPYDERS_LINES_SMALL_SIZE',8);
}
if (!defined('SPYDERS_LINES_MED_SIZE')) {
	define('SPYDERS_LINES_MED_SIZE',50);
}
if (!defined('SPYDERS_LINES_LARGE_SIZE')) {
	define('SPYDERS_LINES_LARGE_SIZE',200);
}

@ ini_set('session.cookie_lifetime',0); // until the browser is closed
@ ini_set('session.gc_maxlifetime',60*60*24*1); // one day

require_once('ss.php');
require_once('auto-update.php');

//Defining hooks that will call functions on this plugin activation/deactivation:
register_activation_hook(__FILE__,'SPYDERS::activatePlugin');
register_deactivation_hook(__FILE__,'SPYDERS::deactivatePlugin');

//Following 4 callback functions are related to scheduled calls:
add_action('check_ip_cache', 'SPYDERS::check_ip_cache_function');//ADDED FOR FINDING AND INSERT UNKNOWN IP COUNTRY
add_action('monthly_flush_blocks_reason', 'SPYDERS::flush_blocked_reasons_monthly');//ADDED FOR SSPRO BLOCKED REASONS
add_action('sent_stats_to_customer', 'SPYDERS::send_stats_to_customer_scheduled');//ADDED FOR SSPRO BLOCKED REASONS
add_action('mr_scheduled_stats', 'SPYDERS::mr_scheduled_stats_functionality');//ADDED FOR SENDING BLOCK STATISTICS TO MR
add_action('sspro_will_expire', 'SPYDERS::sspro_will_expire_function');//ADDED FOR SENDING BLOCK STATISTICS TO MR

//Following 2 callback functions are called only when we access admin dashboard pages:
add_action('admin_init','SPYDERS::initAdmin');
add_action('admin_menu', 'SPYDERS::drawAdminMenu');

// If current page is sspro page then add following actions

//Following 2 actions are always called on both admin as well as blog pages access:
add_action('wp','SPYDERS::collectLive');
add_action('plugins_loaded','SPYDERS::watchTraffic');
add_action('plugins_loaded','SPYDERS::checkRules',-1400000000);


//Following refers to and ajax call for action wpbb_get_block_stats:
add_action('wp_ajax_wpbb_get_block_stats','SPYDERS::wpbb_get_block_stats_ajax');

//Following callback function defines all the custom schedule durations:
add_filter('cron_schedules', 'SPYDERS::filter_cron_schedules_custom');//ADDED FOR SSPRO SCEDULE STATS EMAIL

add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));//ADDED FOR EMAIL TO SENT AS HTML

//die('URL=' . wp_nonce_url(admin_url('admin.php?page=w3tc_general&w3tc_flush_all'), 'w3tc'));

