public function ajax_checkclicks() { if (!isset($_REQUEST['nonce']) || !wp_verify_nonce($_REQUEST['nonce'], 'ajax_checkclicks_nonce')) { die('Invalid Nonce'); } $clickmonitor = new clickfraudmonitor(); $result['result'] = $clickmonitor->checkclient(); $result['message'] = $result['result'] ? '' : 'Error'; header("Content-Type: application/json"); echo json_encode(array('clicks' => $result['result'], 'message' => 'checkclick')); exit; }
function cfmonitor_load_js_and_css() { global $hook_suffix; if ($hook_suffix == 'plugins_page_cfmonitor-config') { wp_register_style('cfmonitor.css', CFMONITOR_PLUGIN_URL . 'cfmonitor.css', array(), '1.0.0.1'); wp_enqueue_style('cfmonitor.css'); wp_enqueue_script('jquery'); wp_enqueue_script('cfmonitor-validate', CFMONITOR_PLUGIN_URL . 'js/jquery.validate_min.js'); wp_enqueue_script('cfmonitor-form', CFMONITOR_PLUGIN_URL . 'js/form_validate_script_min.js'); $clickmonitor = new clickfraudmonitor(); $myip = $clickmonitor->getclientip(); wp_localize_script('cfmonitor-validate', 'cfclientip', $myip); } }
function cfenqueue_plugin_scripts() { global $wpdb; wp_enqueue_script('jquery'); //$clickmonitor = new clickfraudmonitor($wpdb); $clickmonitor = new clickfraudmonitor(); if (!is_admin()) { wp_enqueue_script('cfmonitorcheck', CFMONITOR_PLUGIN_URL . 'js/check_min.js'); $path = CFMONITOR_PLUGIN_URL . 'clickupdate.php'; //echo "tester" .$path; $clientdata = $clickmonitor->clientdetail($path); if ($clientdata['isblockedcount'] >= $clientdata['clickcount'] || get_option('cfmonitor_noads') === 'true' || cf_should_block_for_myip_option($clientdata['client_ip'])) { wp_enqueue_script('click-bomb-hidediv', CFMONITOR_PLUGIN_URL . 'js/hideads.js'); } //echo "VisitcountA" . $clientdata['isblockedcount'] . "clickcount" . $clientdata['clickcount']; } else { //echo "VisitcountB" . $clientdata['isblockedcount'] . "clickcount" . $clientdata['clickcount']; } wp_localize_script('cfmonitorcheck', 'clientcfmonitor', $clientdata); //$thisarray = $clickmonitor->checkclient(); //echo "CheckClient: " . $thisarray[0] . "Day diff are:" . $thisarray[1] . "Day span is " . $thisarray[2]; //for testing }