Hello everyone,
Can you please point me how to tell robots that this plugin is not for them?I found this code to identify them,
if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider/i', $_SERVER['HTTP_USER_AGENT'])) {
but i dont know how to disable verification if condition is met.
Here is the code from plugin
<?php
/*
Plugin Name: Age warning
Plugin URI: http://www.osclass.org/
Description: Display a warning message about adult content
Version: 1.0.2
Author: OSClass
Author URI: http://www.osclass.org/
Short Name: agewarning
Plugin update URI: age-warning
*/
function agewarning_install() {
}
function agewarning_uninstall() {
}
function agewarning_splash() {
error_log('agewarning_splash');
if (Session::newInstance()->_get("agewarning_accepted") != '1' &&
Cookie::newInstance()->get_value('agewarning_accepted') != '1'&&
!osc_is_web_user_logged_in() &&
Params::getParam('action')!='renderplugin') {
error_log(Params::getParam('file'));
if(Params::getParam('file')==osc_plugin_folder(__FILE__) . 'confirm.php') {
$url = Session::newInstance()->_get('agew_backto');
Session::newInstance()->_set("agewarning_accepted", "1");
Cookie::newInstance()->push("agewarning_accepted", "1");
Cookie::newInstance()->set();
Session::newInstance()->_drop('agew_backto');
header("Location: ".$url);
exit;
}
if(Params::getParam('file')!=osc_plugin_folder(__FILE__) . 'warning.php' && Params::getParam('file')!=osc_plugin_folder(__FILE__) . 'confirm.php') {
Session::newInstance()->_set('agew_backto', $_SERVER['REQUEST_URI']);
header("Location: ".osc_render_file_url(osc_plugin_folder(__FILE__) . 'warning.php'));
exit;
}
}
}
/**
* ADD HOOKS
*/
osc_register_plugin(osc_plugin_path(__FILE__), 'agewarning_install');
osc_add_hook(osc_plugin_path(__FILE__)."_uninstall", 'agewarning_uninstall');
osc_add_hook('before_html', 'agewarning_splash');
?>
Thank you!