I’m not add the code, I just replaced it.
function tptn_parse_request( $wp ) {
global $wpdb, $tptn_settings;
if ( empty( $wp ) ) {
global $wp;
}
$table_name = $wpdb->base_prefix . "top_ten";
$top_ten_daily = $wpdb->base_prefix . "top_ten_daily";
$str = '';
if ( array_key_exists( 'top_ten_id', $wp->query_vars ) && array_key_exists( 'activate_counter', $wp->query_vars ) && $wp->query_vars['top_ten_id'] != '' ) {
$id = intval( $wp->query_vars['top_ten_id'] );
$blog_id = intval( $wp->query_vars['top_ten_blog_id'] );
$activate_counter = intval( $wp->query_vars['activate_counter'] );
if ( $id > 0 ) {
if ( ( 1 == $activate_counter ) || ( 11 == $activate_counter ) ) {
$tt = $wpdb->query( $wpdb->prepare( "INSERT INTO {$table_name} (postnumber, cntaccess, blog_id) VALUES('%d', '1', '%d') ON DUPLICATE KEY UPDATE cntaccess= cntaccess+1 ", $id, $blog_id ) );
$str .= ( FALSE === $tt ) ? 'tte' : 'tt' . $tt;
}
if ( ( 10 == $activate_counter ) || ( 11 == $activate_counter ) ) {
$current_date = gmdate( 'Y-m-d H', current_time( 'timestamp', 0 ) );
$ttd = $wpdb->query( $wpdb->prepare( "INSERT INTO {$top_ten_daily} (postnumber, cntaccess, dp_date, blog_id) VALUES('%d', '1', '%s', '%d' ) ON DUPLICATE KEY UPDATE cntaccess= cntaccess+1 ", $id, $current_date, $blog_id ) );
$str .= ( FALSE === $ttd ) ? ' ttde' : ' ttd' . $ttd;
}
}
Header( "content-type: application/x-javascript" );
echo '<!-- ' . $str . ' -->';
//stop anything else from loading as it is not needed.
exit;
} elseif ( array_key_exists( 'top_ten_id', $wp->query_vars ) && array_key_exists( 'view_counter', $wp->query_vars ) && $wp->query_vars['top_ten_id'] != '' ) {
$id = intval( $wp->query_vars['top_ten_id'] );
if ( $id > 0 ) {
$output = get_tptn_post_count( $id );
Header( "content-type: application/x-javascript" );
echo 'document.write("' . $output . '")';
//stop anything else from loading as it is not needed.
exit;
}
} else {
return;
}
}
add_action( 'wp', 'tptn_parse_request' );
PHP Warning: array_key_exists() expects parameter 2 to be array, null given in /wp-content/plugins/top-10/top-10.php on line 234
PHP Warning: array_key_exists() expects parameter 2 to be array, null given in /wp-content/plugins/top-10/top-10.php on line 264