Changeset 1215910
- Timestamp:
- 08/08/2015 04:33:51 PM (11 years ago)
- Location:
- ad-blocking-detector/trunk
- Files:
-
- 2 added
- 1 deleted
- 18 edited
-
ad-blocking-detector.php (modified) (4 diffs)
-
assets/anti-adblock/jolly-drink-manual.zip (deleted)
-
assets/anti-adblock/ok-things-manual.zip (added)
-
assets/anti-adblock/plugin-files/ad-blocking-detector-block-list-countermeasure.php (modified) (2 diffs)
-
assets/anti-adblock/zip-name.txt (modified) (1 diff)
-
assets/css/admin.css (modified) (4 diffs)
-
assets/js/adblock-detector.js (modified) (3 diffs)
-
assets/js/admin-view.js (modified) (1 diff)
-
assets/js/public-view.js (added)
-
includes/ajax-actions.php (modified) (1 diff)
-
includes/anti-adblock.php (modified) (1 diff)
-
includes/click-handler.php (modified) (1 diff)
-
includes/database.php (modified) (6 diffs)
-
includes/log.php (modified) (5 diffs)
-
includes/multisite.php (modified) (1 diff)
-
includes/perf-tools.php (modified) (3 diffs)
-
includes/setup.php (modified) (14 diffs)
-
includes/widget.php (modified) (1 diff)
-
includes/wpsm/field.php (modified) (5 diffs)
-
readme.txt (modified) (3 diffs)
-
views/admin-views.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ad-blocking-detector/trunk/ad-blocking-detector.php
r1208754 r1215910 4 4 * Plugin URI: http://adblockingdetector.jtmorris.net 5 5 * Description: A plugin for detecting ad blocking browser extensions, plugins, and add-ons. It allows you to display alternative content to site visitors who block your ads. 6 * Version: 3. 2.06 * Version: 3.3.0 7 7 * Author: John Morris 8 8 * Author URI: http://cs.johnmorris.me … … 41 41 * \/ \/ \/ \/ */ 42 42 43 define( 'ABD_VERSION', '3. 2.0' );43 define( 'ABD_VERSION', '3.3.0' ); 44 44 45 45 /* /\ /\ /\ /\ … … 53 53 $start_time = microtime( true ); 54 54 $start_mem = memory_get_usage( true ); 55 $start_peak_mem = memory_get_peak_usage( true );56 55 57 56 define ( 'ABD_ROOT_PATH', plugin_dir_path( __FILE__ ) ); … … 65 64 ABD_Setup::initialize(); 66 65 67 68 69 // Start SESSION to facilitate data transfers70 // Don't Forget Error Prevention: http://goo.gl/Acm9oY71 // Don't Forget PHP 5.4.0+ changes: http://www.php.net/manual/en/function.session-status.php72 function abd_my_session_start()73 {74 if(abd_is_session_started() || !isset($_SESSION)) {75 if (isset($_COOKIE['PHPSESSID'])) {76 $sessid = $_COOKIE['PHPSESSID'];77 }78 else if (isset($_GET['PHPSESSID'])) {79 $sessid = $_GET['PHPSESSID'];80 }81 else {82 session_start();83 return false;84 }85 if (!preg_match('/^[a-z0-9]{32}$/', $sessid)) {86 return false;87 }88 session_start();89 return true;90 }91 }92 function abd_is_session_started()93 {94 if ( php_sapi_name() !== 'cli' ) {95 if ( version_compare(phpversion(), '5.4.0', '>=') ) {96 return session_status() === PHP_SESSION_ACTIVE ? TRUE : FALSE;97 } else {98 return session_id() === '' ? FALSE : TRUE;99 }100 }101 return FALSE;102 }103 abd_my_session_start();104 105 66 ABD_Log::perf_summary( 'Entire Plugin Init', $start_time, $start_mem ); 106 ABD_Log::perf( 'Entire Plugin Init -- Peak Memory = ' . ( memory_get_peak_usage( true ) - $start_peak_mem )/1048576 . 'MB' ); -
ad-blocking-detector/trunk/assets/anti-adblock/plugin-files/ad-blocking-detector-block-list-countermeasure.php
r1208754 r1215910 4 4 * Plugin URI: http://adblockingdetector.johnmorris.me 5 5 * Description: Provides fallback files in the event the main Ad Blocking Detector's assets are blocked. 6 * Version: 3. 2.06 * Version: 3.3.0 7 7 * Author: John Morris 8 8 * Author URI: http://cs.johnmorris.me … … 39 39 * \/ \/ \/ \/ */ 40 40 41 define( 'ABDBLC_VERSION', '3. 2.0' );41 define( 'ABDBLC_VERSION', '3.3.0' ); 42 42 43 43 /* /\ /\ /\ /\ -
ad-blocking-detector/trunk/assets/anti-adblock/zip-name.txt
r1208754 r1215910 1 jolly-drink-manual1 ok-things-manual -
ad-blocking-detector/trunk/assets/css/admin.css
r1206074 r1215910 107 107 border-bottom: 3px solid #CCC; 108 108 } 109 #abdwpsm_tab-manage-shortcodes form .abd-shortcode-get-button { 109 .abdwpsm_tab_wrapper .abd-shortcode-get-button, 110 .abdwpsm_tab_wrapper .abd-shortcode-get-button:hover { 110 111 background-color: #78d639; 111 112 font-size: 1.2em; … … 115 116 color: #222; 116 117 } 117 #abdwpsm_tab-manage-shortcodes form.abd-shortcode-get-button:before {118 .abdwpsm_tab_wrapper .abd-shortcode-get-button:before { 118 119 content:'\2713 \0020'; 119 120 } 120 #abdwpsm_tab-manage-shortcodes form .abd-shortcode-delete-button { 121 .abdwpsm_tab_wrapper .abd-delete-button, 122 .abdwpsm_tab_wrapper .abd-delete-button:hover { 121 123 background-color: #FF7F7F; 122 124 font-size: 1.2em; … … 126 128 color: #222; 127 129 } 128 #abdwpsm_tab-manage-shortcodes form .abd-shortcode-delete-button:before {130 .abdwpsm_tab_wrapper .abd-delete-button:before { 129 131 content:'\2717 \0020'; 130 132 } … … 255 257 256 258 259 div.abd-stats-chart { 260 width: 650px; 261 height: 500px; 262 } 263 p.abd-stats-chart-caption { 264 width: 650px; 265 font-size: 1.1em; 266 267 padding-bottom: 20px; 268 border-bottom: 3px solid #999; 269 } 270 271 257 272 /******************** 258 273 * jQuery UI Fixes -
ad-blocking-detector/trunk/assets/js/adblock-detector.js
r1206106 r1215910 93 93 // Ad blockers can hide things in numerous ways. Check every way I 94 94 // can think of. 95 if(ABDSettings.enableIframe == 'yes' || ABDSettings.enableIframe == '') {95 if(ABDSettings.enableIframe != 'no') { 96 96 // Check for the appended frame 97 97 // … … 110 110 111 111 112 if( ABDSettings.enableDiv == 'yes' || ABDSettings.enableDiv == '' ) {112 if( ABDSettings.enableDiv != 'no' ) { 113 113 retVal = self.checkAdStatusDivHelper(div, divNoJq, retVal); 114 114 } … … 118 118 119 119 120 if( ABDSettings.enableJsFile == 'yes' || ABDSettings.enableJsFile == '') {120 if(ABDSettings.enableJsFile != 'no') { 121 121 // Check for bait javascript file (assets/js/advertisement.js) flags 122 122 if (window.abd_script_load_flag !== true) { -
ad-blocking-detector/trunk/assets/js/admin-view.js
r1208754 r1215910 382 382 383 383 384 384 ////////////////////////////////// 385 // Statistics Charts & Buttons // 386 ////////////////////////////////// 387 // Load Google Charts 388 // We only need to do this on the statistics page... if the chart containers are 389 // present. Let's check if the chart containers are present by picking one and 390 // seeing what we get. 391 if( $('#abd-stats-chart-page-load').length ) { 392 // Yay! We're on stats page and containers are present. 393 google.load('visualization', '1.0', { 394 'packages':['corechart'], 395 callback: function() { 396 // This is here to keep page from being blank 397 // http://stackoverflow.com/a/24980290 398 } 399 }); 400 google.setOnLoadCallback(drawCharts); 401 } 402 403 // Reset Statistics Button Handling 404 $('#abd-statistics-reset-button').click(function(e) { 405 e.preventDefault(); 406 var targetUrl = $(this).attr("href"); 407 408 var warning = '<p>' + objectL10n.resetStatisticsWarning + '</p>'; 409 410 var dsDialog = $("<div/>").html(warning).dialog( { 411 modal: true, 412 title: objectL10n.resetStatisticsTitle, 413 width: 400, 414 position: {my: 'right bottom', at: 'middle'}, 415 buttons: [ 416 { 417 text: objectL10n.affirmative, 418 icons: {primary: 'ui-icon-check'}, 419 click: function() { 420 window.location.href = targetUrl; 421 } 422 }, 423 { 424 text: objectL10n.nevermind, 425 icons: {primary: 'ui-icon-closethick'}, 426 click: function() { 427 $(this).dialog("destroy"); 428 } 429 } 430 ], 431 open: function() { 432 // Fix Random jQuery UI CSS Scoping Issues // 433 $('div.ui-widget-overlay, div.ui-dialog').wrap('<div class="ffs abd-jqui" />'); 434 } 435 }); 436 dsDialog.parent('.ui-dialog').addClass('abd-jqui'); // jQuery UI theme scope 437 }); 438 439 function drawCharts() { 440 drawPageLoadChart('#336699', '#a93912'); 441 drawUserChart('#336699', '#a93912'); 442 drawDisableChart('#33CC33', '#990099'); 443 drawEnableChart('#33CC33', '#990099'); 444 } 445 446 function drawPageLoadChart(goodColor, badColor, neutralColor) { 447 var data = new google.visualization.DataTable(); 448 data.addColumn( 'string', 'Category' ); 449 data.addColumn( 'number', 'The Number' ); 450 data.addRows([ 451 ['Ad Blockers Enabled (' + ABDStats.pageLoadAdblocker + ')', ABDStats.pageLoadAdblocker], 452 ['Ad Blockers Disabled (' + ABDStats.pageLoadNoAdblocker + ')', ABDStats.pageLoadNoAdblocker], 453 ['Other (' + ABDStats.pageLoadOther + ')', ABDStats.pageLoadOther] 454 ]); 455 456 var options = { 457 'title': 'Ad Blockers By Page Loads', 458 'colors': [badColor, goodColor, neutralColor], 459 'backgroundColor': '#f1f1f1', 460 'fontSize': 18, 461 'fontName': 'sans-serif', 462 'legend': {position: 'bottom', textStyle: {fontSize: 15}} 463 }; 464 465 var chart = new google.visualization.PieChart(document.getElementById('abd-stats-chart-page-load')); 466 chart.draw(data, options); 467 } 468 469 function drawUserChart(goodColor, badColor, neutralColor) { 470 var data = new google.visualization.DataTable(); 471 data.addColumn( 'string', 'Category' ); 472 data.addColumn( 'number', 'The Number' ); 473 data.addRows([ 474 ['Ad Blockers Enabled (' + ABDStats.uniqueUsersAdBlocker + ')', ABDStats.uniqueUsersAdBlocker], 475 ['Ad Blockers Disabled (' + ABDStats.uniqueUsersNoAdBlocker + ')', ABDStats.uniqueUsersNoAdBlocker], 476 ['Other (' + ABDStats.uniqueUsersOther + ')', ABDStats.uniqueUsersOther] 477 ]); 478 479 var options = { 480 'title': 'Ad Blockers By Unique User', 481 'colors': [badColor, goodColor, neutralColor], 482 'backgroundColor': '#f1f1f1', 483 'fontSize': 18, 484 'fontName': 'sans-serif', 485 'legend': {position: 'bottom', textStyle: {fontSize: 15}} 486 }; 487 488 var chart = new google.visualization.PieChart(document.getElementById('abd-stats-chart-unique-user')); 489 chart.draw(data, options); 490 } 491 492 function drawDisableChart(goodColor, badColor) { 493 if( ABDStats.numUsersToDisable > 0 ) { 494 var to = ABDStats.numUsersToDisable; 495 var lo = ABDStats.uniqueUsersAdBlocker - ABDStats.numUsersToDisable; 496 } 497 else { 498 var to = 0; 499 var lo = 0; 500 } 501 502 var data = new google.visualization.DataTable(); 503 data.addColumn( 'string', 'Category' ); 504 data.addColumn( 'number', 'The Number' ); 505 data.addRows([ 506 ['Turned Off Ad Blockers (' + to + ')', to], 507 ['Left On Ad Blockers (' + lo + ')', lo] 508 ]); 509 510 var options = { 511 'title': 'Users Who Toggled Off Ad Blocker', 512 'colors': [goodColor, badColor], 513 'backgroundColor': '#f1f1f1', 514 'fontSize': 18, 515 'fontName': 'sans-serif', 516 'legend': {position: 'bottom', textStyle: {fontSize: 15}} 517 }; 518 519 var chart = new google.visualization.PieChart(document.getElementById('abd-stats-chart-change-disable')); 520 chart.draw(data, options); 521 } 522 523 function drawEnableChart(goodColor, badColor) { 524 if( ABDStats.numUsersToEnable > 0 ) { 525 var to = ABDStats.numUsersToEnable; 526 var lo = ABDStats.uniqueUsersNoAdBlocker - ABDStats.numUsersToEnable; 527 } 528 else { 529 var to = 0; 530 var lo = 0; 531 } 532 533 var data = new google.visualization.DataTable(); 534 data.addColumn( 'string', 'Category' ); 535 data.addColumn( 'number', 'The Number' ); 536 data.addRows([ 537 ['Turned On Ad Blockers (' + to + ')', to], 538 ['Left Off Ad Blockers (' + lo + ')', lo] 539 ]); 540 541 var options = { 542 'title': 'Users Who Toggled On Ad Blocker', 543 'colors': [goodColor, badColor], 544 'backgroundColor': '#f1f1f1', 545 'fontSize': 18, 546 'fontName': 'sans-serif', 547 'legend': {position: 'bottom', textStyle: {fontSize: 15}} 548 }; 549 550 var chart = new google.visualization.PieChart(document.getElementById('abd-stats-chart-change-enable')); 551 chart.draw(data, options); 552 } 385 553 386 554 -
ad-blocking-detector/trunk/includes/ajax-actions.php
r1203582 r1215910 8 8 class ABD_Ajax_Actions { 9 9 10 public static function submit_stats() { 11 check_ajax_referer( 'ad blocking detector stats ajax nonce', '_wpnonce' ); 12 13 // First, check ignore cases 14 $enabled = ABD_Database::get_specific_setting( 'enable_statistics' ); 15 $ignore_registered = ABD_Database::get_specific_setting( 'stats_ignore_registered' ); 16 $ignore_ips = ABD_Database::get_specific_setting( 'stats_ignore_ips' ); 17 18 if( $enabled == 'no' ) { 19 echo 'Statistics recording disabled.'; 20 wp_die(); 21 } 22 23 if( $ignore_registered == 'yes' ) { 24 if( is_user_logged_in() ) { 25 echo 'Skipping stastics update for logged in user.'; 26 wp_die(); // terminate immediately for proper AJAX response 27 } 28 } 29 30 if( !empty( $ignore_ips ) ) { 31 // This is results from textarea... one IP on each line... split it into array 32 $ignore_ips = trim( $ignore_ips ); 33 $ips = explode( '\n', $ignore_ips ); 34 $ips = array_filter( $ips, 'trim' ); // remove any \r characters 35 36 $cur_user_ip = $_SERVER['REMOTE_ADDR']; 37 38 foreach( $ips as $ip ) { 39 if( ABD_Perf_Tools::ip_in_range( $cur_user_ip, $ip ) ) { 40 echo 'Skipping statistics update for user\'s IP address: ' . $cur_user_ip; 41 wp_die(); // terminate immediately for proper AJAX response 42 } 43 } 44 } 45 46 47 // If we're here, then we really are supposed to record this 48 if( array_key_exists( 'adblocker', $_POST ) ) { 49 $adblocker = intval( $_POST['adblocker'] ); 50 $blog_id = ABD_Multisite::get_current_blog_id(); 51 $user_ip = $_SERVER['REMOTE_ADDR']; 52 53 // Check validity of value 54 if( $adblocker != 1 && $adblocker != 0 && $adblocker != -1 ) { 55 echo 'Invalid adblocker status code submitted. (' . $adblocker . ')'; 56 wp_die(); // terminate immediately for proper AJAX response 57 } 58 59 // Add it to database 60 $res = ABD_Database::insert_stat( $adblocker, $blog_id, $user_ip ); 61 62 if( $res ) { 63 echo 'Statistics database updated.'; 64 } 65 else { 66 echo 'Failed to update statistics database.'; 67 } 68 69 wp_die(); // terminate immediately for proper AJAX response 70 } 71 } 72 10 73 } // end class 11 74 } // end if ( !class_exists( ... -
ad-blocking-detector/trunk/includes/anti-adblock.php
r1208754 r1215910 182 182 183 183 return $retval; 184 185 186 187 188 189 190 191 192 // $status = array( 'auto_plugin_exists' => 0, 'auto_plugin_activated' => 0, 'manual_plugin_exists' => -1, 'manual_plugin_activated' => 0 );193 194 // $dir_name = get_site_option( 'abd_blc_dir' );195 // $plugin_type = get_site_option( 'abd_blc_plugin_type' );196 197 // if( $dir_name ) {// Plugin should exist198 // // Let's make sure199 // $plugin_path = ABD_ROOT_PATH . '../' . $dir_name;200 201 // if( !is_dir( $plugin_path ) ) {202 // ABD_Log::error( 'Block List Countermeasure plugin does not exist at the location it is expected to: ' . $plugin_path );203 204 // // The directory option is obviously out of sync...205 // delete_site_option( 'abd_blc_dir' );206 207 // // The plugin does not exist... therefore it isn't activated either... so, return our vanilla $status208 // return $status;209 // }210 211 // // If we're here, the plugin exists. Now we just need to know whether it's automatic or manual212 // if( $plugin_type == 'auto' ) {213 // // It's automatic214 // $status['auto_plugin_exists'] = 1;215 // $status['manual_plugin_exists'] = 0;216 // }217 // else {218 // // It's manual219 // $status['manual_plugin_exists'] = 1;220 // $status['auto_plugin_exists'] = 0;221 // }222 223 // // Let's check if the plugin is activated. The simplest way to do that is check whether224 // // one of it's crucial constants is defined.225 // if( defined( 'ABDBLC_ROOT_PATH' ) ) {226 // // Yes, it is activated227 // if( $plugin_type == 'auto' ) {228 // $status['auto_plugin_activated'] = 1;229 // $status['manual_plugin_activated'] = 0;230 // }231 // else {232 // $status['manual_plugin_activated'] = 1;233 // $status['auto_plugin_activated'] = 0;234 // }235 // }236 // }237 // else { // Plugin does not exist238 // $status['manual_plugin_exists'] = 0;239 // $status['auto_plugin_exists'] = 0;240 // }241 242 243 // ABD_Log::perf_summary( 'ABD_Anti_Adblock::bcc_plugin_status()', $start_time, $start_mem );244 245 // return $status;246 184 } 247 185 -
ad-blocking-detector/trunk/includes/click-handler.php
r1208754 r1215910 111 111 112 112 113 public static function delete_all_statistics() { 114 $start_time = microtime( true ); 115 $start_mem = memory_get_usage( true ); 116 117 check_admin_referer( 'user instructed deletion of all statistics table rows' ); 118 119 $res = ABD_Database::delete_all_stats(); 120 121 ABD_Log::perf_summary( 'ABD_Click_Handler::send_usage_info()', $start_time, $start_mem ); 122 123 self::redirect( 'delete_all_stats_success' ); 124 } 125 126 113 127 114 128 -
ad-blocking-detector/trunk/includes/database.php
r1208754 r1215910 8 8 protected static $our_shortcode_cache_option = 'abd_sc_cache'; 9 9 protected static $our_shortcode_cache = null; 10 protected static $our_stats_table = 'abd_adblocker_stats'; 11 12 protected static $our_list_of_options = array( 13 'abd_event_log', 14 'abd_blc_dir', 15 'abd_blc_plugin_type', 16 'abd_user_settings', 17 'abd_list_of_shortcodes', 18 'abd_feedback_nag_time', 19 'abd_current_version' 20 ); 21 protected static $our_list_of_transients = array( 22 'abd_sc_cache', 23 'abd_next_shortcode_id' 24 ); 10 25 11 26 /** … … 77 92 $options = self::$our_shortcode_cache; 78 93 $cache_status = true; 94 $update_list_flag = false; 79 95 } 80 96 else { … … 286 302 public static function get_settings( $json_array = false ) { 287 303 $abd_settings = get_option( 'abd_user_settings', array( 288 'user_defined_selectors' => '', 289 'enable_iframe' => 'yes', 290 'enable_div' => 'yes', 291 'enable_js_file' => 'yes', 292 'enable_perf_logging' => 'yes' 293 ) 294 ); 295 296 if( $json_array ) { 304 // Load in some default values that will throw dreadful errors in the middle 305 // of JavaScript code if somebody (*cough* John *cough*) forgets to run an 306 // array_key_exists(), or it is really ugly and inelegant to do so, when 307 // debug errors are enabled. 308 // 309 // See includes/setup.php > ABD_Setup::enqueue_helper_footer() for a really 310 // rough area for these errors at the time of this writing. 311 'enable_iframe' => 'yes', 312 'enable_div' => 'yes', 313 'enable_js_file' => 'yes', 314 'user_defined_selectors' => '', 315 'enable_statistics' => 'yes', 316 'stats_ignore_registered'=> 'no', 317 'stats_ignore_ips' => '' 318 ) ); 319 320 if( $json_array && array_key_exists( 'user_defined_selectors', $abd_settings ) ) { 297 321 // Turn user defined selectors into JSON array 298 322 $abd_settings['user_defined_selectors'] = json_encode( … … 300 324 ); 301 325 } 302 303 326 return $abd_settings; 304 327 } 305 328 329 public static function get_specific_setting( $setting_name, $json_array = false ) { 330 $abd_settings = self::get_settings( $json_array ); 331 332 if( array_key_exists( $setting_name, $abd_settings ) ) { 333 return $abd_settings[$setting_name]; 334 } 335 336 return null; 337 } 338 306 339 307 340 public static function nuke_all_options() { 308 // Collect start state for performance logging 309 $start_time = microtime( true ); 310 $start_mem = memory_get_usage( true ); 311 312 $options = wp_load_alloptions(); // Get all WP options 313 314 foreach( $options as $key=>$o ) { 315 if( stristr( $key, 'abd_' ) ) { 316 delete_site_option( $key ); 317 } 318 } 319 320 // Make sure we update the cache when we retrieve shortcodes next 321 self::nuke_shortcode_cache(); 322 323 // Performance log 324 ABD_Log::perf_summary( 'ABD_Database::nuke_all_options()', $start_time, $start_mem ); 341 // Do not collect start state for performance logging 342 // Performance logging gets put in database, and we're trying to delete that! 343 344 345 $sc_options = self::get_all_shortcodes(); 346 347 foreach( $sc_options as $id=>$val ) { 348 $oname = self::$our_shortcode_prefix . $id; 349 350 delete_option( $oname ); 351 } 352 foreach( self::$our_list_of_options as $o ) { 353 delete_option( $o ); 354 } 355 foreach( self::$our_list_of_transients as $t ) { 356 delete_transient( $t ); 357 } 358 359 // Do not log performance! 360 // Performance logging gets put in database, and we're trying to delete that! 325 361 } 326 362 … … 336 372 ABD_Log::perf_summary( 'ABD_Database::nuke_shortcode_cache()', $start_time, $start_mem ); 337 373 } 374 375 public static function drop_tables() { 376 // Collect start state for performance logging 377 $start_time = microtime( true ); 378 $start_mem = memory_get_usage( true ); 379 380 global $wpdb; 381 382 383 $prefix = $wpdb->base_prefix; 384 $table1 = $prefix . 'abd_shortcodes'; 385 386 $sql = "DROP TABLE IF EXISTS $table1;"; 387 $wpdb->query( $sql ); 388 389 ABD_Log::info( 'Dropped version 2 table, abd_shortcodes, from the database.' ); 390 391 $table2 = $prefix . 'abd_adblocker_stats'; 392 393 $sql = "DROP TABLE IF EXISTS $table2;"; 394 $wpdb->query( $sql ); 395 396 ABD_Log::info( 'Dropped version 3 table, abd_adblocker_stats, from the database.' ); 397 398 // Performance log 399 ABD_Log::perf_summary( 'ABD_Database::drop_tables()', $start_time, $start_mem ); 400 } 401 402 403 404 405 406 //////////////////////////// 407 // Ad Blocker Statistics // 408 //////////////////////////// 409 /** 410 * Unlike shortcodes, statistics are collected into their own database table. 411 * This is because the Settings API, which makes certain tasks easier and faster, 412 * is not suited for an every page load kind of interaction. To use the Settings API, 413 * we'd need to have a new option for every page load, or build an array, which needs 414 * to be retrieved, updated, and put back in the database. This is way too much 415 * database traffic! 416 * 417 * However, we're only doing a handful of specific jobs for these stats, so a CRUD 418 * setup for the custom table isn't too hard. 419 */ 420 public static function update_stats_table_structure() { 421 global $wpdb; 422 $charset = $wpdb->get_charset_collate(); 423 $table = $wpdb->prefix . self::$our_stats_table; 424 425 $sql = "CREATE TABLE $table ( 426 id mediumint(9) NOT NULL AUTO_INCREMENT, 427 blog_id mediumint(9) NOT NULL DEFAULT 1, 428 adblocker tinyint(1) NOT NULL, 429 date_time datetime NOT NULL, 430 label text DEFAULT '', 431 ip varchar(39), 432 PRIMARY KEY (id), 433 KEY adblocker (adblocker), 434 KEY blog_id (blog_id), 435 KEY ip (ip) 436 ) $charset;"; 437 438 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 439 dbDelta( $sql ); 440 } 441 442 /** 443 * Insert a row in the statistics database table. 444 * 445 * @param int $adblocker_code The codified integer adblocker status (-1 = unknown, 0 = no adblocker, 1 = adblocker) 446 * @param int $blog_id The ID of the multisite blog this statistic is collected for. Defaults to 1. Non-multisite is always 1. 447 * @param int $user_ip The IP address of the user. 448 * @param string $date The date and time this statistic is for. Ommitted = now. Should be a UNIX timestamp. 449 * @param string $label Some descriptive text for the entry. 450 */ 451 public static function insert_stat( $adblocker_code, $blog_id = 1, $user_ip = '', $date = 'now', $label = '' ) { 452 global $wpdb; 453 454 $table = $wpdb->prefix . self::$our_stats_table; 455 456 // Get date in right format 457 if( is_string( $date ) ) { 458 if( $date == 'now' ) { 459 $date = date( 'Y-m-d H:i:s' ); 460 } 461 else { 462 $date = date( 'Y-m-d H:i:s', $date ); 463 } 464 } 465 else { 466 ABD_Log::error( 'Invalid date/time value provided when inserting adblocker statistic. Using current date/time.' ); 467 $date = date( 'Y-m-d H:i:s' ); 468 } 469 470 // Insert row 471 $res = $wpdb->insert( $table, 472 array( 'adblocker'=>$adblocker_code, 'ip'=> $user_ip, 'date_time'=>$date, 'label'=>$label, 'blog_id' => $blog_id ) 473 ); 474 475 if( !$res ) { // no updated rows or fail 476 ABD_Log::error( 'Unknown failure inserting adblocker statistic.' ); 477 self::log_last_query_debug_info(); 478 } 479 480 return $res; 481 } 482 483 /** 484 * Deletes rows from statistics database. 485 */ 486 public static function delete_all_stats() { 487 global $wpdb; 488 489 $table = $wpdb->prefix . self::$our_stats_table; 490 491 $sql = "DELETE FROM $table WHERE blog_id=" . ABD_Multisite::get_current_blog_id(); 492 493 $res = $wpdb->query( $sql ); 494 495 if( $res === false ) { 496 ABD_Log::error( 'Unknown failure deleting adblocker statistics.' ); 497 self::log_last_query_debug_info(); 498 } 499 else { 500 ABD_Log::info( 'Deleted ' . $rows . ' rows from statistics table in database.' ); 501 } 502 } 503 504 /** 505 * Returns all rows from statistics database that match provided WHERE and LIMIT clauses 506 * 507 * @param string/array $where WHERE clause string, or named array of WHERE clauses (in column -> value pairs). Defaults to empty WHERE clause thus not limiting SELECT query. 508 * @param integer $limit A limit on rows returned. 0 or negative number will not limit rows. Defaults to -1. 509 * 510 * @return array Associative array containing query results. Array will be empty if query fails or no rows match query. 511 */ 512 public static function select_all_stats( $where = '', $limit = -1 ) { 513 global $wpdb; 514 515 $table = $wpdb->prefix . self::$our_stats_table; 516 517 // Construct WHERE clause 518 if( is_array( $where ) ) { 519 if( !array_key_exists( 'blog_id', $where ) ) { 520 $where['blog_id'] = ABD_Multisite::get_current_blog_id(); 521 } 522 523 $where = self::where_from_array( $where ); 524 } 525 else if( !is_string( $where ) ) { 526 ABD_Log::error( 'Invalid $where parameter fed to ABD_Database::select_all_stats(). Defaulting to empty clause.' ); 527 ABD_Log::debug( '$where parameter data dump = ' . print_r( $where, true ), true ); 528 $where = ' WHERE blog_id=' . ABD_Multisite::get_current_blog_id(); 529 } 530 else { 531 if( empty( $where ) ) { 532 $where = ' WHERE blog_id=' . ABD_Multisite::get_current_blog_id(); 533 } 534 else { 535 $where .= ' AND blog_id=' . ABD_Multisite::get_current_blog_id(); 536 } 537 } 538 539 // Construct LIMIT clause 540 if( is_numeric( $limit) && $limit > 0 ) { 541 $limit = ' LIMIT ' . $limit; 542 } 543 else { 544 $limit = ''; 545 } 546 547 // Run query 548 $res = $wpdb->get_results( 'SELECT * FROM ' . $table . $where . $limit, ARRAY_A ); 549 550 if( !is_array( $res ) || count( $res ) < 1 ) { 551 ABD_Log::info( 'SELECT query on statistics database returned empty set.' ); 552 ABD_Log::debug( 'Empty set query = ' . $wpdb->last_query ); 553 554 return array(); 555 } 556 557 return $res; 558 } 559 560 /** 561 * Returns all rows from statisitics database that fall in the date/time range specified. This is basically 562 * a wrapper around ABD_Database::select_all_stats() which will add appropriate date range to WHERE clause 563 * automatically. 564 * 565 * @param string $start_date English textual datetime description of start date filter parsable by PHP's DateTime constructor. 566 * @param string $end_date English textual datetime description fo end date filter parsable by PHP's DateTime constructor. 567 * @param string/array $where WHERE clause string, or named array of WHERE clauses (in column -> value pairs). Defaults to empty WHERE clause thus not limiting SELECT query. 568 * @param integer $limit A limit on rows returned. 0 or negative number will not limit rows. Defaults to -1. 569 * 570 * @return array Associative array containing query results. Array will be empty if query fails or no rows match query. 571 */ 572 public static function select_stats_by_date( $start_date, $end_date = 'now', $where = null, $limit = -1 ) { 573 // Get start and end dates in MySQL acceptable forms 574 try { 575 $start_date = new DateTime( $start_date ); 576 $end_date = new DateTime( $end_date ); 577 578 $s = $start_date->format( 'Y-m-d H:i:s' ); 579 $e = $end_date->format( 'Y-m-d H:i:s' ); 580 } 581 catch( Exception $e ) { 582 ABD_Log::error( 'Invalid $start_date or $end_date parameter provided in ABD_Database::select_stats_by_date().' ); 583 ABD_Log::debug( 'DateTime exception = ' . $e->getMessage(), true ); 584 585 return array(); 586 } 587 588 589 // Construct WHERE clause without start and end dates 590 if( is_array( $where ) ) { 591 if( !array_key_exists( 'blog_id', $where ) ) { 592 $where['blog_id'] = ABD_Multisite::get_current_blog_id(); 593 } 594 595 $where = self::where_from_array( $where ); 596 } 597 else if( !is_string( $where ) ) { 598 ABD_Log::error( 'Invalid $where parameter fed to ABD_Database::select_stats_by_date(). Defaulting to empty clause.' ); 599 ABD_Log::debug( '$where parameter data dump = ' . print_r( $where, true ), true ); 600 $where = ' WHERE blog_id=' . ABD_Multisite::get_current_blog_id(); 601 } 602 else { 603 if( empty( $where ) ) { 604 $where = ' WHERE blog_id=' . ABD_Multisite::get_current_blog_id(); 605 } 606 else { 607 $where .= ' AND blog_id=' . ABD_Multisite::get_current_blog_id(); 608 } 609 } 610 611 612 // Add start and end dates 613 if( empty( $where ) ) { 614 $where = ' WHERE '; 615 } 616 else { 617 $where .= ' AND '; 618 } 619 620 $where .= 'date > "' . $s . '" AND date < "' . $e . '"'; 621 622 return self::select_all_stats( $where, $limit ); 623 } 624 625 /** 626 * Returns a count of rows in statistics database where the adblocker column contains the given $status_code. 627 * 628 * @param integer $status_code adblocker column status code (adblocker=1, no adblocker=0, other=-1) 629 * @param string $custom_query A custom SQL query to run. The last clause must be a WHERE clause! If no WHERE clause, use "WHERE 1=1". Use template tag {{table}} in place of table name. 630 * 631 * @return integer A count of matching rows. 632 */ 633 public static function stats_status_count( $status_code = 1, $custom_query = "SELECT adblocker FROM {{table}} WHERE 1=1" ) { 634 global $wpdb; 635 636 $table = $wpdb->prefix . self::$our_stats_table; 637 638 $custom_query = str_replace( '{{table}}', $table, $custom_query ); 639 640 $sql = $custom_query . " AND adblocker = $status_code AND blog_id=" . ABD_Multisite::get_current_blog_id(); 641 $wpdb->get_results( $sql ); 642 643 return intval( $wpdb->num_rows ); 644 } 645 public static function stats_status_count_blocker_change( $change_type = 'disable' ) { 646 global $wpdb; 647 648 $table = $wpdb->prefix . self::$our_stats_table; 649 650 $count = 0; 651 652 // Where multiple rows for distinct ip and multiple values in adblocker for some of those rows 653 // Row returned is first occurrence... meaning starting ad blocker state... 654 $sql = "SELECT DISTINCT adblocker, date_time FROM $table WHERE blog_id=" . ABD_Multisite::get_current_blog_id() . " GROUP BY ip HAVING COUNT(DISTINCT adblocker) > 1"; 655 $res = $wpdb->get_results( $sql, ARRAY_A ); 656 657 if( !is_array( $res ) ) { 658 ABD_Log::error( 'Unknown query failure in ABD_Database::stats_status_count_blocker_change(). Returning 0.' ); 659 self::log_last_query_debug_info(); 660 return 0; 661 } 662 663 foreach( $res as $r ) { 664 // Rows contain beginning adblocker state. If we want disabled type, we want 665 // enabled ad blocker in row. Otherwise, we want disabled type 666 if( $change_type == 'disable' && $r['adblocker'] == 1 ) { 667 $count++; 668 } 669 else if( $change_type == 'enable' && $r['adblocker'] == 0 ) { 670 $count++; 671 } 672 } 673 674 return $count; 675 } 676 677 678 protected static function log_last_query_debug_info( $indented = true ) { 679 global $wpdb; 680 681 ABD_Log::debug( 'Failed MYSQL Query = ' . $wpdb->last_query, $indented ); 682 ABD_Log::debug( 'Failed MYSQL Error = ' . $wpdb->last_error, $indented ); 683 } 684 685 protected static function where_from_array( $named_array_of_where_clauses ) { 686 if( !is_array( $named_array_of_where_clauses ) ) { 687 return false; 688 } 689 690 $first = true; 691 $wc = ''; 692 foreach( $named_array_of_where_clauses as $field=>$value ) { 693 if( $first ) { 694 $wc .= ' WHERE '; 695 $first = false; 696 } 697 else { 698 $wc .= ' AND '; 699 } 700 701 $wc .= $field . '="' . $value . '"'; 702 } 703 704 ABD_Log::debug( 'Constructed WHERE clause = ' . $wc ); 705 706 return $wc; 707 } 708 709 710 711 712 713 714 715 338 716 339 717 /** … … 554 932 } 555 933 556 public static function drop_v2_table() { 557 // Collect start state for performance logging 558 $start_time = microtime( true ); 559 $start_mem = memory_get_usage( true ); 560 561 global $wpdb; 562 563 564 $prefix = $wpdb->base_prefix; 565 $table = $prefix . 'abd_shortcodes'; 566 567 $sql = "DROP TABLE IF EXISTS abd_shortcodes;"; 568 $wpdb->query( $sql ); 569 570 ABD_Log::info( 'Dropped version 2 table, abd_shortcodes, from the database.' ); 571 572 // Performance log 573 ABD_Log::perf_summary( 'ABD_Database::drop_v2_table()', $start_time, $start_mem ); 574 } 934 575 935 576 936 } // end class ABD_Database -
ad-blocking-detector/trunk/includes/log.php
r1208754 r1215910 10 10 11 11 public static function error( $msg, $indented = false ) { 12 self::generic_log_entry( 'ERROR', $msg, $indented ); 12 $enable_errors = ABD_Database::get_specific_setting( 'enable_error_logging' ); 13 14 if( $enable_errors != 'no' ) { 15 self::generic_log_entry( 'ERROR', $msg, $indented ); 16 } 13 17 } 14 18 15 19 public static function info( $msg, $indented = false ) { 16 self::generic_log_entry( 'INFO', $msg, $indented ); 20 $enable_info = ABD_Database::get_specific_setting( 'enable_info_logging' ); 21 22 if( $enable_info != 'no' ) { 23 self::generic_log_entry( 'INFO', $msg, $indented ); 24 } 17 25 } 18 26 19 27 public static function debug( $msg, $indented = false ) { 20 self::generic_log_entry( 'DEBUG', $msg, $indented ); 28 $enable_debug = ABD_Database::get_specific_setting( 'enable_debug_logging' ); 29 30 if( $enable_debug != 'no' ) { 31 self::generic_log_entry( 'DEBUG', $msg, $indented ); 32 } 21 33 } 22 34 23 35 public static function perf( $msg, $indented = false ) { 24 $ settings = ABD_Database::get_settings();25 26 if( $ settings['enable_perf_logging'] == 'yes' ) {36 $enable_perf_logging = ABD_Database::get_specific_setting( 'enable_perf_logging' ); 37 38 if( $enable_perf_logging != 'no' ) { 27 39 self::generic_log_entry( 'PERF', $msg, $indented ); 28 40 } … … 48 60 49 61 public static function get_readable_log( $num_entries = 0, $indentation = ' >> ', $line_endings = ' ' ) { 62 $enabled = ABD_Database::get_specific_setting( 'enable_logging' ); 63 64 if( $enabled === 'no' ) { 65 return ABD_L::__( '* Logging has been disabled in Advanced Settings.' ); 66 } 67 50 68 $readable = ''; 51 69 $es = self::get_all_log_entries(); … … 90 108 } 91 109 110 if( empty( $readable ) ) { 111 $readable = ABD_L::__( '* No log entries at this time.' ); 112 } 113 92 114 return $readable; 93 115 } … … 99 121 100 122 protected static function generic_log_entry( $type, $msg, $indented = false ) { 101 $e = self::get_all_log_entries(); 102 103 $e[] = array( 104 'type' => $type, 105 'message' => $msg, 106 'time' => date( 'm/d/y @ H:i:s (P' ) . ' GMT)', 107 'indented' => $indented 108 ); 109 110 update_site_option( self::get_option_name(), $e ); 111 112 self::prune_log(); 113 } 114 115 protected static function prune_log( $max_entries = 500 ) { 116 $es = self::get_all_log_entries(); 117 118 if( count( $es ) > $max_entries ) { 119 $es = array_slice( $es, -1*$max_entries ); 120 } 121 122 update_option( self::$our_option_name, $es ); 123 $enable = ABD_Database::get_specific_setting( 'enable_logging' ); 124 125 if( $enable != 'no' ) { 126 $e = self::get_all_log_entries(); 127 128 $e[] = array( 129 'type' => $type, 130 'message' => $msg, 131 'time' => date( 'm/d/y @ H:i:s (P' ) . ' GMT)', 132 'indented' => $indented 133 ); 134 135 $e = self::prune_log( $e ); 136 137 update_site_option( self::get_option_name(), $e ); 138 } 139 } 140 141 protected static function prune_log( $value = null, $max_entries = 500 ) { 142 if( $value == null ) { 143 $value = self::get_all_log_entries(); 144 } 145 146 147 if( count( $value ) > $max_entries ) { 148 $value = array_slice( $value, -1*$max_entries ); 149 } 150 151 return $value; 123 152 } 124 153 … … 199 228 // Check for settings thresholds and filtration 200 229 $settings = ABD_Database::get_settings(); 201 if( isset( $settings['perf_logging_time_limit'] ) ) { 202 $time_alert_threshold = $settings['perf_logging_time_limit']; 203 } 204 if( isset( $settings['perf_logging_mem_limit'] ) ) { 205 $mem_alert_threshold = $settings['perf_logging_mem_limit']; 206 } 207 if( isset( $settings['perf_logging_only_above_limits'] ) && $settings['perf_logging_only_above_limits'] == 'yes' ) { 230 $time_limit = ABD_Database::get_specific_setting( 'perf_logging_time_limit' ); 231 $mem_limit = ABD_Database::get_specific_setting( 'perf_logging_mem_limit' ); 232 $only_above_threshold = ABD_Database::get_specific_setting( 'perf_logging_only_above_limits' ); 233 234 if( !is_null( $time_limit ) ) { 235 $time_alert_threshold = $time_limit; 236 } 237 if( !is_null( $mem_limit ) ) { 238 $mem_alert_threshold = $mem_limit; 239 } 240 if( $only_above_threshold != 'no' ) { 208 241 $only_above_threshold = true; 209 242 } -
ad-blocking-detector/trunk/includes/multisite.php
r1203582 r1215910 4 4 * class... because multisite is a pain-in-the-ass 5 5 */ 6 7 abd_my_session_start(); // Make sure we have a $_SESSION. It's absolutely necessary for parts of this.8 9 10 6 11 7 -
ad-blocking-detector/trunk/includes/perf-tools.php
r1208754 r1215910 54 54 // Gather Data 55 55 $blcp_status = array( 56 'auto_plugin_activated' => ABD_Anti_Adblock::bcc_plugin_status( 'auto_plugin_activated' ),57 'manual_plugin_activated' => ABD_Anti_Adblock::bcc_plugin_status( 'manual_plugin_activated' ),58 'auto_plugin_exists' => ABD_Anti_Adblock::bcc_plugin_status( 'auto_plugin_exists' ),59 'manual_plugin_exists' => ABD_Anti_Adblock::bcc_plugin_status( 'manual_plugin_exists' ),60 56 'plugin_activated' => ABD_Anti_Adblock::bcc_plugin_status( 'plugin_activated' ), 61 57 'plugin_exists' => ABD_Anti_Adblock::bcc_plugin_status( 'plugin_exists' ) … … 65 61 if( !$blcdir ) { $blcdir = 'No BLC Plugin Directory'; } 66 62 67 $mem_usage = memory_get_ usage( true );63 $mem_usage = memory_get_peak_usage( true ); 68 64 if( $mem_usage < 1024 ) { $mem_usage = $mem_usage . ' bytes'; } 69 65 else if( $mem_usage < 1048576 ) { $mem_usage = round( $mem_usage/1024, 2 ) . ' KB'; } 70 66 else { $mem_usage = round( $mem_usage/1048576, 2 ) . ' MB'; } 67 68 $aa2d_mem = memory_get_usage(); 69 $aa2d = array( 70 'perftestentry1' => array( 'abcdefg', 'hijklmn' ), 71 'perftestentry2' => array( 'opqrstu', 'vwxyz12' ), 72 'perftestentry3' => array( '3456789', '0abcdef' ), 73 'perftestentry4' => array( 'ghijklm', 'nopqrst' ), 74 'perftestentry5' => array( 'uvwxyz1', '2345678' ), 75 'perftestentry6' => array( '90abcde', 'fghijkl' ), 76 'perftestentry7' => array( 'mnopqrs', 'tuvwxyz' ), 77 'perftestentry8' => array( '1234567', '890abcd' ), 78 'perftestentry9' => array( 'efghijk', 'lmnopqr' ) 79 ); 80 $aa2d_mem = ABD_Log::mem_diff( $aa2d_mem ); 81 unset( $aa2d ); 82 83 $aa1d_mem = memory_get_usage(); 84 $aa1d = array( 85 'perftestentry1' => 'abcdefg', 86 'perftestentry2' => 'opqrstu', 87 'perftestentry3' => '3456789', 88 'perftestentry4' => '1234567', 89 'perftestentry5' => 'hijklmn', 90 'perftestentry6' => 'vwxyz12', 91 'perftestentry7' => '4567890', 92 'perftestentry8' => 'bcdefgh', 93 'perftestentry9' => 'ijklmno' 94 ); 95 $aa1d_mem = ABD_Log::mem_diff( $aa1d_mem ); 96 unset( $aa1d ); 97 71 98 72 99 ob_start(); … … 83 110 Plugin Version: <?php echo ABD_VERSION; ?><?php echo $line_endings; ?> 84 111 Total # of shortcodes: <?php echo ABD_Database::count_shortcodes(); ?><?php echo $line_endings; ?> 85 BLC Plugin Exists?: <?php echo $blcp_status['plugin_exists'] ; ?><?php echo $line_endings; ?>86 BLC Plugin Active?: <?php echo $blcp_statu c['plugin_activated']; ?><?php echo $line_endings; ?>112 BLC Plugin Exists?: <?php echo $blcp_status['plugin_exists'] ? 'true' : 'false'; ?><?php echo $line_endings; ?> 113 BLC Plugin Active?: <?php echo $blcp_status['plugin_activated'] ? 'true' : 'false'; ?><?php echo $line_endings; ?> 87 114 BLC Plugin Type?: <?php echo get_option( 'abd_blc_plugin_type' ); ?><?php echo $line_endings; ?> 88 BLC Plugin Dir: <?php echo $blcdir; ?><?php echo $line_endings; ?> 115 BLC Plugin Dir: <?php echo $blcdir; ?><?php echo $line_endings . $line_endings; ?> 116 9 entry 1D Assoc. Array Used Memory: <?php echo $aa1d_mem; ?><?php echo $line_endings; ?> 117 9 entry 2D Assoc. Array Used Memory: <?php echo $aa2d_mem; ?><?php echo $line_endings; ?> 89 118 <?php 90 119 91 120 return ob_get_clean(); 92 121 } 122 123 124 125 /** 126 * Determines whether the given IP address is within the given range. 127 * 128 * @param string $ip IPV4 address to check in standard dot notation (e.g. 192.168.0.1) 129 * @param string $range IPV4 address with CIDR netmask. If no CIDR netmask given, /32 is assumed (exact match). (e.g. 182.168.0.0/16) 130 * 131 * @return boolean true if $ip is in $range. false if not. 132 */ 133 public static function ip_in_range( $ip, $range ) { 134 if ( strpos( $range, '/' ) == false ) { 135 $range .= '/32'; 136 } 137 // $range is in IP/CIDR format eg 127.0.0.1/24 138 list( $range, $netmask ) = explode( '/', $range, 2 ); 139 $range_decimal = ip2long( $range ); 140 $ip_decimal = ip2long( $ip ); 141 $wildcard_decimal = pow( 2, ( 32 - $netmask ) ) - 1; 142 $netmask_decimal = ~ $wildcard_decimal; 143 return ( ( $ip_decimal & $netmask_decimal ) == ( $range_decimal & $netmask_decimal ) ); 144 } 93 145 } // end class 94 146 } // end if( !class_exists( ... -
ad-blocking-detector/trunk/includes/setup.php
r1208754 r1215910 5 5 */ 6 6 7 require_once( ABD_ROOT_PATH . 'includes/log.php' ); 8 require_once( ABD_ROOT_PATH . 'includes/wpsm/settings-manager.php' ); 9 require_once( ABD_ROOT_PATH . 'includes/anti-adblock.php' ); 10 require_once( ABD_ROOT_PATH . 'views/admin-views.php' ); 11 require_once( ABD_ROOT_PATH . 'views/public-views.php' ); 12 require_once( ABD_ROOT_PATH . "includes/widget.php" ); 13 require_once( ABD_ROOT_PATH . "includes/click-handler.php" ); 14 require_once( ABD_ROOT_PATH . "includes/perf-tools.php" ); 7 $start_time = microtime( true ); 8 $start_mem = memory_get_usage( true ); 9 10 require( ABD_ROOT_PATH . 'includes/database.php' ); 11 require( ABD_ROOT_PATH . 'includes/log.php' ); 12 require( ABD_ROOT_PATH . 'includes/wpsm/settings-manager.php' ); 13 require( ABD_ROOT_PATH . 'includes/anti-adblock.php' ); 14 require( ABD_ROOT_PATH . 'views/admin-views.php' ); 15 require( ABD_ROOT_PATH . 'views/public-views.php' ); 16 require( ABD_ROOT_PATH . "includes/widget.php" ); 17 require( ABD_ROOT_PATH . "includes/click-handler.php" ); 18 require( ABD_ROOT_PATH . "includes/perf-tools.php" ); 19 require( ABD_ROOT_PATH . "includes/multisite.php" ); 20 require( ABD_ROOT_PATH . "includes/localization.php" ); 21 require( ABD_ROOT_PATH . "includes/ajax-actions.php" ); 22 23 ABD_Log::perf_summary( 'setup.php // require plugin files', $start_time, $start_mem ); 24 15 25 16 26 if ( !class_exists( 'ABD_Setup' ) ) { … … 118 128 'jquery' ); 119 129 130 131 // Google Charts 132 wp_enqueue_script( 'google-jsapi', 'https://www.google.com/jsapi' ); 133 134 120 135 wp_enqueue_script( 'abd-admin-view', 121 136 $prefix . 'assets/js/admin-view.js', array('jquery') ); … … 141 156 wp_enqueue_script( 'abd-fake-ad', 142 157 $prefix . 'assets/js/advertisement.min.js' ); 158 wp_enqueue_script( 'abd-public-view', 159 $prefix . 'assets/js/public-view.js' ); 143 160 } 144 161 public static function enqueue_helper_footer() { … … 173 190 // it will come back as an JSON encoded array with one empty string... [""] 174 191 // We don't want this... this should mean utterly blank 175 if( $abd_settings['user_defined_selectors'] == '[""]' ) {192 if( !array_key_exists( 'user_defined_selectors', $abd_settings ) || $abd_settings['user_defined_selectors'] == '[""]' ) { 176 193 $abd_settings['user_defined_selectors'] = ''; 177 194 } … … 180 197 <script type="text/javascript"> 181 198 <?php 182 if( $abd_settings['enable_iframe'] == 'yes' || $abd_settings['enable_iframe'] == '' ) {199 if( !array_key_exists( 'enable_iframe', $abd_settings ) || $abd_settings['enable_iframe'] != 'no' ) { 183 200 ?> 184 201 (function() { … … 208 225 enableIframe: "<?php echo $abd_settings['enable_iframe']; ?>", 209 226 enableDiv: "<?php echo $abd_settings['enable_div']; ?>", 210 enableJsFile: "<?php echo $abd_settings['enable_js_file']; ?>" 211 } 227 enableJsFile: "<?php echo $abd_settings['enable_js_file']; ?>", 228 statsAjaxNonce: "<?php echo wp_create_nonce( 'ad blocking detector stats ajax nonce' ); ?>", 229 ajaxUrl: "<?php echo admin_url( 'admin-ajax.php' ); ?>" 230 } 231 232 <?php 233 if( is_admin() ) { 234 ?> 235 var ABDStats = { 236 pageLoadAdblocker: parseInt('<?php echo ABD_Database::stats_status_count( 1 ); ?>'), 237 pageLoadNoAdblocker: parseInt('<?php echo ABD_Database::stats_status_count( 0 ); ?>'), 238 pageLoadOther: parseInt('<?php echo ABD_Database::stats_status_count( -1 ); ?>'), 239 240 uniqueUsersAdBlocker: parseInt('<?php echo ABD_Database::stats_status_count( 1, "SELECT DISTINCT ip FROM {{table}} WHERE 1=1" ); ?>'), 241 uniqueUsersNoAdBlocker: parseInt('<?php echo ABD_Database::stats_status_count( 0, "SELECT DISTINCT ip FROM {{table}} WHERE 1=1" ); ?>'), 242 uniqueUsersOther: parseInt('<?php echo ABD_Database::stats_status_count( -1, "SELECT DISTINCT ip FROM {{table}} WHERE 1=1" ); ?>'), 243 244 numUsersToDisable: parseInt( '<?php echo ABD_Database::stats_status_count_blocker_change( "disable" ); ?>' ), 245 numUsersToEnable: parseInt( '<?php echo ABD_Database::stats_status_count_blocker_change( "enable" ); ?>' ) 246 } 247 <?php 248 } 249 ?> 212 250 213 251 // Make sure ABDSettings.cssSelectors is an array... might be a string … … 218 256 219 257 <?php 220 if( $abd_settings['enable_div'] == 'yes' || $abd_settings['enable_div'] == '' ) {258 if( !array_key_exists( 'enable_div', $abd_settings ) || $abd_settings['enable_div'] != 'no' ) { 221 259 ?> 222 260 <div … … 357 395 add_action( 'admin_post_abd_send_usage_info', 358 396 array( 'ABD_Click_Handler', 'send_usage_info' ) ); 397 add_action( 'admin_post_abd_delete_stats', 398 array( 'ABD_Click_Handler', 'delete_all_statistics' ) ); 399 400 401 // AJAX Handlers 402 add_action( 'wp_ajax_submit_stats', 403 array( 'ABD_Ajax_Actions', 'submit_stats' ) ); 359 404 360 405 // Admin notices … … 377 422 } 378 423 protected static function nuke_plugin() { 424 ABD_Database::drop_tables(); 379 425 ABD_Database::nuke_all_options(); 380 ABD_Database::drop_v2_table(); // Compatibility for upgraded v2 installs 381 426 382 427 ABD_Anti_Adblock::delete_bcc_plugin(); 383 428 ABD_Anti_Adblock::delete_bcc_manual_plugin(); … … 419 464 public static function menus_helper() { 420 465 // We need the ABD_Admin_Views class 421 require _once(ABD_ROOT_PATH . 'views/admin-views.php');466 require (ABD_ROOT_PATH . 'views/admin-views.php'); 422 467 423 468 add_menu_page( … … 556 601 */ 557 602 558 /**559 * An associative array where the key is a plugin version, and the value is560 * a function callback, passed to admin_notices WordPress action that outputs the content561 * of an upgrade message for that version. This will be checked later on,562 * and if we are upgrading, and there is a mapped function, it will be tied563 * to an admin_notices action.564 */565 $notification_map = array(566 '3.0.0' => array( 'ABD_Admin_Views', 'v2_to_v3_migration_notice' )567 ); // Maps a version number to a function to call with an upgrade notice.568 569 570 603 // Does the stored plugin version equal the current version? 571 604 // If so, then we shouldn't need to do anything. … … 576 609 $upgrading_version = '2.2.8'; 577 610 } 578 579 $upgrading_major_version = $upgrading_version[0];580 611 $new_version = ABD_VERSION; 581 $new_major_version = $new_version[0];582 612 583 613 if ( $upgrading_version != $new_version ) { 584 614 ABD_Log::info( 'Running plugin update. Old version: ' . $upgrading_version . ', new version: ' . $new_version ); 615 616 $upgrading_major_version = $upgrading_version[0]; 617 $new_major_version = $new_version[0]; 618 585 619 /////////////////////////////// 586 620 // Do our updating here!!! /// … … 647 681 } 648 682 } 683 684 // Update Stats table structure 685 ABD_Database::update_stats_table_structure(); 649 686 650 687 … … 674 711 * site the first time somebody goes to that site's dashboard after the update. 675 712 */ 713 714 /** 715 * An associative array where the key is a plugin version, and the value is 716 * a function callback, passed to admin_notices WordPress action that outputs the content 717 * of an upgrade message for that version. This will be checked later on, 718 * and if we are upgrading, and there is a mapped function, it will be tied 719 * to an admin_notices action. 720 */ 721 $notification_map = array( 722 '3.0.0' => array( 'ABD_Admin_Views', 'v2_to_v3_migration_notice' ) 723 ); // Maps a version number to a function to call with an upgrade notice. 676 724 $last_notice_version = get_option( 'abd_last_upgrade_notice_seen', '0.0.0' ); 677 725 -
ad-blocking-detector/trunk/includes/widget.php
r1203582 r1215910 3 3 * This file contains the ABD widget declaration and handler functions. 4 4 */ 5 6 require_once ( ABD_ROOT_PATH . 'views/public-views.php' );7 5 8 6 if( !class_exists( 'ABD_Widget' ) ) { -
ad-blocking-detector/trunk/includes/wpsm/field.php
r1206074 r1215910 167 167 foreach( ABDWPSM_Settings_Manager::$fields as $Field ) { 168 168 if( $Field->get_field_name() == $my_fn && 169 $Field->get_section()->get_options_group()->get_db_option_name == $my_fn &&169 $Field->get_section()->get_options_group()->get_db_option_name() == $my_fn && 170 170 $Field != $this ) { 171 171 … … 311 311 // Start with read only. 312 312 ( array_key_exists( 'readonly', $fopt ) && $fopt['readonly'] ) ? 313 $readonly = 'readonly="readonly"' : '';313 $readonly = 'readonly="readonly"' : $readonly = ''; 314 314 // Now disabled 315 315 ( array_key_exists( 'disabled', $fopt ) && $fopt['disabled'] ) ? 316 $disabled = 'disabled="disabled"' : '';316 $disabled = 'disabled="disabled"' : $disabled = ''; 317 317 // Required 318 318 ( array_key_exists( 'required', $fopt ) && $fopt['required'] ) ? 319 $required = 'required="required"' : '';319 $required = 'required="required"' : $required = ''; 320 320 // Now default value 321 321 array_key_exists('default', $fopt) ? … … 344 344 // Unfortunately, there are several possibilities. 345 345 // Possibility #1: Data persistence from a previous failed submission attempt. 346 if( !is_null( $this->data_persistence_value ) ) {346 if( isset( $this->data_persistence_value ) && !is_null( $this->data_persistence_value ) ) { 347 347 $value = $this->data_persistence_value; 348 348 … … 412 412 } 413 413 414 $fid = str_replace('[', '--', $f id);415 $fid = str_replace(']', ' --', $fid);414 $fid = str_replace('[', '--', $fname); 415 $fid = str_replace(']', '', $fid); 416 416 417 417 // Let's parse the field options a little to make life simpler 418 418 // Start with read only. 419 419 ( array_key_exists( 'readonly', $fopt ) && $fopt['readonly'] ) ? 420 $readonly = 'readonly="readonly"' : '';420 $readonly = 'readonly="readonly"' : $readonly = ''; 421 421 // Now disabled 422 422 ( array_key_exists( 'disabled', $fopt ) && $fopt['disabled'] ) ? 423 $disabled = 'disabled="disabled"' : '';423 $disabled = 'disabled="disabled"' : $disabled = ''; 424 424 // Required 425 425 // Now disabled 426 426 ( array_key_exists( 'required', $fopt ) && $fopt['required'] ) ? 427 $required = 'required="required"' : '';427 $required = 'required="required"' : $required = ''; 428 428 // Now default value 429 429 array_key_exists('default', $fopt) ? … … 445 445 // Unfortunately, there are several possibilities. 446 446 // Possibility #1: Data persistence from a previous failed submission attempt. 447 if( !is_null( $this->data_persistence_value ) ) {447 if( isset( $this->data_persistence_value ) && !is_null( $this->data_persistence_value ) ) { 448 448 $cur_val = $this->data_persistence_value; 449 449 -
ad-blocking-detector/trunk/readme.txt
r1208754 r1215910 4 4 Tags: adblock, adblocker, ad blocker, adblock plus, detector, advertisement, ads, ad blocking 5 5 Requires at least: 4.2 6 Tested up to: 4.2. 37 Stable tag: 3. 2.06 Tested up to: 4.2.4 7 Stable tag: 3.3.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 124 124 125 125 == Changelog == 126 = 3.3.0 = 127 * NEW FEATURE: Statistics - Now includes ability to collect ad blocker statuses of your site visitors and view the aggregated data. 128 * Performance Improvement: Remove dependence on PHP sessions. 129 * Performance Improvement: Decrease memory usage in several functions by eliminating needless arrays and defining on demand only. 130 * Performance Improvement: Correct log pruning behavior, and reduce database access required for pruning. 131 * Performance Improvement: Replace PHP require_once() with require(). 132 * Increased performance logging detail. 133 * Added more log customization settings. 134 * Minor bug fixes. 135 * Source code tidying. 126 136 = 3.2.0 = 127 137 * Performance Improvement: Counting shortcodes no longer retrieves all shortcodes and data from database (lower load times, less memory usage). … … 267 277 268 278 == Upgrade Notice == 279 = 3.3.0 = 280 * This update includes a new feature: statistics! Now see the ad blocker usage trends for your website by visiting the Ad Blocking Detector dashboard. 269 281 = 3.1.2 = 270 282 Dramatic performance improvements! If versions 3.0.0 through 3.0.2 were displaying errors, or was not functioning correctly, install this update! -
ad-blocking-detector/trunk/views/admin-views.php
r1208754 r1215910 4 4 * plugin. 5 5 */ 6 7 require_once ( ABD_ROOT_PATH . 'includes/multisite.php' );8 require_once ( ABD_ROOT_PATH . 'includes/database.php' );9 require_once ( ABD_ROOT_PATH . 'includes/localization.php' );10 11 6 12 7 if ( !class_exists( 'ABD_Admin_Views' ) ) { … … 133 128 'send_usage_info_success' => array( 134 129 'msg' => ABD_L::__( 'Usage info submitted. Thanks for helping improve Ad Blocking Detector!' ), 130 'class' => 'updated' 131 ), 132 133 // Delete All Statistics Table Rows 134 'delete_all_stats_success' => array( 135 'msg' => ABD_L::__( 'Statistics table cleared successfully.' ), 135 136 'class' => 'updated' 136 137 ) … … 389 390 $AS_Iframe_URL->add_to_section( $AS_Iframe_Section ); 390 391 392 393 $AS_Stats_Section = new ABDWPSM_Section( array( 394 'id' => 'as_uds-stats_management', 395 'display_name' => ABD_L::__( 'Statistics Collection Options' ), 396 'display_description' => ABD_L::__( 'This plugin can collect basic statistics on how many of your visitors utilize ad blockers. The statistics collection behavior can be modified below.' ) 397 ) ); 398 $AS_Stats_Section->add_to_options_group( $AS_OG ); 399 400 $AS_Stats_enable_statistics = new ABDWPSM_Field( array( 401 'field_name' => 'enable_statistics', 402 'type' => 'radio', 403 'display_name' => ABD_L::__( 'Enable Statistics Collection' ), 404 'display_description' => ABD_L::__( 'Whether to enable ad blocker detection statistics. Statistics results are viewable in the "Statistics" tab at the top of this page.' ), 405 'field_options_array' => array( 406 'choices' => array( 'Enabled'=>'yes', 'Disbaled'=>'no' ), 407 'default' => 'yes' 408 ) 409 ) ); 410 411 $AS_Stats_ignore_ips = new ABDWPSM_Field( array( 412 'field_name' => 'stats_ignore_ips', 413 'type' => 'textarea', 414 'display_name' => ABD_L::__( 'Ignored IP Addresses' ), 415 'display_description' => ABD_L::__( 'List of IP addresses for which statistics will not be collected. CIDR netmask ranges are acceptable. One IP address, or CIDR netmask, per line. Your detected IP address is: ' ) . $_SERVER['REMOTE_ADDR'], 416 'example_entry' => '<br />' . $_SERVER['REMOTE_ADDR'] . '<br />192.168.0.0/16' 417 ) ); 418 419 $AS_Stats_ignore_registered = new ABDWPSM_Field( array( 420 'field_name' => 'stats_ignore_registered', 421 'type' => 'radio', 422 'display_name' => ABD_L::__( 'Ignore Logged In Users' ), 423 'display_description' => ABD_L::__( 'If enabled, statistics will not be collected for logged in users.' ), 424 'field_options_array' => array( 425 'choices' => array( 'Enabled'=>'yes', 'Disbaled'=>'no' ), 426 'default' => 'no' 427 ) 428 ) ); 429 430 $AS_Stats_enable_statistics->add_to_section( $AS_Stats_Section ); 431 $AS_Stats_ignore_ips->add_to_section( $AS_Stats_Section ); 432 $AS_Stats_ignore_registered->add_to_section( $AS_Stats_Section ); 433 434 391 435 $AS_Log_Section = new ABDWPSM_Section( array( 392 436 'id' => 'as_uds-log_management', … … 396 440 $AS_Log_Section->add_to_options_group( $AS_OG ); 397 441 442 $AS_Log_enable_all = new ABDWPSM_Field( array( 443 'field_name' => 'enable_logging', 444 'type' => 'radio', 445 'display_name' => ABD_L::__( 'Allow Logging' ), 446 'display_description' => ABD_L::__( 'Whether to log any events in the "Session Log." If this is disabled, no logging will occur.' ), 447 'field_options_array' => array( 448 'choices' => array( 'Enabled'=>'yes', 'Disbaled'=>'no' ), 449 'default' => 'yes' 450 ) 451 ) ); 452 453 $AS_Log_enable_info = new ABDWPSM_Field( array( 454 'field_name' => 'enable_info_logging', 455 'type' => 'radio', 456 'display_name' => ABD_L::__( 'Information Logging' ), 457 'display_description' => ABD_L::__( 'Whether to log noteworthy plugin actions in the "Session Log." Most Ad Blocking Detector Dashboard activities generates one or more of these log entries. Disabling this will improve plugin performance, but will drastically reduce the effectiveness of logging.' ), 458 'field_options_array' => array( 459 'choices' => array( 'Enabled'=>'yes', 'Disbaled'=>'no' ), 460 'default' => 'yes' 461 ) 462 ) ); 463 464 $AS_Log_enable_debug = new ABDWPSM_Field( array( 465 'field_name' => 'enable_debug_logging', 466 'type' => 'radio', 467 'display_name' => ABD_L::__( 'Debugging Data Logging' ), 468 'display_description' => ABD_L::__( 'Whether to log debugging data in the "Session Log." These entries are rarely generated outside of plugin updates and activation. They often accompany error log entries with contextual information. It is recommended to match this with error logging. If error logging is on, debug logging should also be on.' ), 469 'field_options_array' => array( 470 'choices' => array( 'Enabled'=>'yes', 'Disbaled'=>'no' ), 471 'default' => 'yes' 472 ) 473 ) ); 474 475 $AS_Log_enable_error = new ABDWPSM_Field( array( 476 'field_name' => 'enable_error_logging', 477 'type' => 'radio', 478 'display_name' => ABD_L::__( 'Error Report Logging' ), 479 'display_description' => ABD_L::__( 'Whether to log encountered errors in the "Session Log." These are very rarely generated outside of plugin updates and activation.' ), 480 'field_options_array' => array( 481 'choices' => array( 'Enabled'=>'yes', 'Disbaled'=>'no' ), 482 'default' => 'yes' 483 ) 484 ) ); 485 398 486 $AS_Log_enable_perf = new ABDWPSM_Field( array( 399 487 'field_name' => 'enable_perf_logging', 400 488 'type' => 'radio', 401 489 'display_name' => ABD_L::__( 'Performance Statistics Logging' ), 402 'display_description' => ABD_L::__( 'Whether to record execution times and memory usage in the Session Log. This helps tracking down performance related plugin bugs, but generates a lot of log entries and uses slightly more overhead anddatabase traffic.' ),490 'display_description' => ABD_L::__( 'Whether to record execution times and memory usage in the Session Log. This helps tracking down performance related plugin bugs, but generates a lot of log entries and generates significant database traffic.' ), 403 491 'field_options_array' => array( 404 492 'choices' => array( 'Enabled'=>'yes', 'Disabled'=>'no' ), … … 413 501 'field_options_array' => array( 414 502 'choices' => array( 'Enabled'=>'yes', 'Disabled'=>'no' ), 415 'default' => ' no'503 'default' => 'yes' 416 504 ) 417 505 ) ); … … 434 522 ) 435 523 ) ); 524 $AS_Log_enable_all->add_to_section( $AS_Log_Section ); 525 $AS_Log_enable_info->add_to_section( $AS_Log_Section ); 526 $AS_Log_enable_debug->add_to_section( $AS_Log_Section ); 527 $AS_Log_enable_error->add_to_section( $AS_Log_Section ); 436 528 $AS_Log_enable_perf->add_to_section( $AS_Log_Section ); 437 529 $AS_Log_perf_filtering->add_to_section( $AS_Log_Section ); … … 440 532 441 533 // Free memory 534 unset( $AS_Log_enable_all ); 535 unset( $AS_Log_enable_info ); 536 unset( $AS_Log_enable_debug ); 537 unset( $AS_Log_enable_error ); 442 538 unset( $AS_Log_enable_perf ); 443 539 unset( $AS_Log_perf_filtering ); … … 456 552 unset( $Settings_Tab ); 457 553 554 555 $stats_enabled = ABD_Database::get_specific_setting( 'enable_statistics' ); 556 if( $stats_enabled != 'no' ) { 557 new ABDWPSM_Tab( array( 558 'display_name' => ABD_L::__( 'Statistics (Beta)' ), 559 'display_description' => self::statistics_tab_header(), 560 'url_slug' => 'statistics', 561 'page' => 'ad-blocking-detector' 562 ) ); 563 } 458 564 459 565 new ABDWPSM_Tab( array( … … 610 716 'plugin_exists' => ABD_Anti_Adblock::bcc_plugin_status( 'plugin_exists' ) 611 717 ); 612 ABD_Log::perf_summary( 'ABD_Admin_Views::getting_started_tab_content // before $blcp_status = ABD_Anti_Adblock::bcc_plugin_status();', $bfs_time, $bfs_mem, true ); 613 614 $abd_settings = ABD_Database::get_settings(); 718 ABD_Log::perf_summary( 'ABD_Admin_Views::getting_started_tab_content // before $blcp_status = ABD_Anti_Adblock::bcc_plugin_status();', $bfs_time, $bfs_mem, true ); 615 719 616 720 ob_start(); … … 857 961 858 962 963 <?php 964 return ob_get_clean(); 965 } 966 967 protected static function statistics_tab_header() { 968 ob_start(); 969 ?> 970 971 <h2><?php ABD_L::_e( 'Ad Blocker Statistics' ); ?></h2> 972 973 <?php 974 echo self::statistics_tab_description(); 975 976 return ob_get_clean(); 977 } 978 979 protected static function statistics_tab_description() { 980 ob_start(); 981 ?> 982 <p><?php ABD_L::_e( 'The charts below aggregate ad blocker status statistics collected during visits to your website. The collected statistics are subject to any filtering and recording rules defined on the Advanced Settings tab, and accuracy is not guaranteed. Charts with no relevant data will be blank until data is collected.' ); ?></p> 983 <p style="color: #990000;"><strong><em><?php ABD_L::_e( 'The statistics feature of this plugin is currently in beta testing. The aggregated data below may be inaccurate and is subject to change. If flaws are discovered, all collected statistics during this beta may be reset without warning or prompting. Feedback on this feature is welcome.' ); ?></em></strong></p> 984 <a href="<?php echo wp_nonce_url( admin_url( 'admin-post.php?action=abd_delete_stats' ), 'user instructed deletion of all statistics table rows' ); ?>" id="abd-statistics-reset-button" class="button abd-delete-button"><?php ABD_L::_e( 'Reset Statistics' ); ?></a> 985 986 987 <div id='abd-stats-chart-page-load' class='abd-stats-chart'></div> 988 <p class='abd-stats-chart-caption'><?php echo sprintf( ABD_L::__( 'This chart shows ad blocker status on every recorded page load. This metric is useful for assessing %simpressions%s. It can be skewed by multiple page loads per visitor, or visitors who toggled on or off their ad blocker while on your website. ' ), '<a href="https://en.wikipedia.org/wiki/Impression_(online_media)" target="_blank">', '</a>' ); ?></p> 989 990 <div id='abd-stats-chart-unique-user' class='abd-stats-chart'></div> 991 <p class='abd-stats-chart-caption'><?php ABD_L::_e( 'This chart shows the ad blocker status for unique viewers. This filters out the previous chart\'s skew, caused by page reloads, multiple page visits, and return views of your site. Viewers are counted a maximum of once in each category. Uniqueness is determined by IP address. This metric is useful for assessing the ad blocker usage proclivity of your audience. It can be skewed by users who toggle their ad blocker on or off during their visit to your site, and by users whose IP address changes between page loads or site visits.' ); ?></p> 992 993 <div id="abd-stats-chart-change-disable" class="abd-stats-chart"></div> 994 <p class='abd-stats-chart-caption'><?php ABD_L::_e( 'This chart shows how many users first visited your site with an ad blocker enabled, and who later disabled it. This metric can be a rough estimation of the effectiveness of disable ad blocker pleas. It can be skewed by returning visitors, who toggled ad blockers off on other websites, between visits to yours. It does not take into account multiple ad blocker state toggles per visitor. If the visitor ever had an ad blocker on, and turned it off on a later page load, they are counted.' ); ?></p> 995 996 <div id="abd-stats-chart-change-enable" class="abd-stats-chart"></div> 997 <p class='abd-stats-chart-caption'><?php ABD_L::_e( 'This chart shows how many users first visited your site with an ad blocker disabled, and who later enabled it. This metric can be a rough estimation of how many users felt the need to turn on an ad blocker on your site for some reason. It can be skewed by returning visitors, who toggled on ad blockers on other websites, between visits to yours. It does not take into account multiple ad blocker state toggles per visitor. If the visitor ever had an ad blocker off, and turned it on, on a later page load, they are counted.' ); ?></p> 859 998 <?php 860 999 return ob_get_clean(); … … 1647 1786 </a> 1648 1787 1649 <a href="<?php echo wp_nonce_url( admin_url( 'admin-post.php?action=abd_delete_shortcode&id=' . $sc_id ), 'user instructed shortcode delete id equals ' . $sc_id ); ?>" class="abd-shortcode-delete-button button">1788 <a href="<?php echo wp_nonce_url( admin_url( 'admin-post.php?action=abd_delete_shortcode&id=' . $sc_id ), 'user instructed shortcode delete id equals ' . $sc_id ); ?>" class="abd-shortcode-delete-button abd-delete-button button"> 1650 1789 <?php ABD_L::_e( 'Delete This Shortcode' ); ?> 1651 1790 </a> … … 1855 1994 1856 1995 'submitLogToDevWarning' => ABD_L::__( 'Ad Blocking Detector is about to send the contents of the Session Log and Plugin, WordPress, and Server Configuration Data boxes to the developer. If you wish to check the contents before sending, close this dialog box, and review the content in the appropriate boxes. No contact information is submitted with the log entries, so you will not be responded to. If you require or desire feedback, you will need to contact the developer personally as well.' ), 1857 'submitLogToDevTitle' => ABD_L::__( 'Are you sure?' ) 1996 'submitLogToDevTitle' => ABD_L::__( 'Are you sure?' ), 1997 1998 'resetStatisticsTitle' => ABD_L::__( 'Are you sure?' ), 1999 'resetStatisticsWarning' => ABD_L::__( 'This will delete all recorded statistical information, and can not be undone!' ) 1858 2000 ); 1859 2001
Note: See TracChangeset
for help on using the changeset viewer.