Go to the documentation of this file.
86 return get_called_class();
152 $fields = array_filter( $this->
getFieldInfo(),
function ( $info ) {
153 return $info[
'type'] !==
'null';
159 foreach ( $fields
as $field => $info ) {
164 if ( $info[
'type'] ===
'checkbox' || $info[
'type'] ===
'button' ) {
165 $this->$field = isset( $data[$field] ) && $data[$field] !==
false
166 || isset( $data[
"{$field}_x"] ) && $data[
"{$field}_x"] !==
false;
167 if ( !$this->$field && empty( $info[
'optional'] ) ) {
174 if ( !isset( $data[$field] ) && $info[
'type'] ===
'multiselect' ) {
178 if ( !isset( $data[$field] ) ) {
181 if ( $data[$field] ===
'' || $data[$field] === [] ) {
182 if ( empty( $info[
'optional'] ) ) {
186 switch ( $info[
'type'] ) {
188 if ( !isset( $info[
'options'][$data[$field]] ) ) {
194 $data[$field] = (
array)$data[$field];
195 $allowed = array_keys( $info[
'options'] );
196 if ( array_diff( $data[$field], $allowed ) !== [] ) {
203 $this->$field = $data[$field];
227 'provider' => new \RawMessage(
'$1', [ get_called_class() ] ),
228 'account' => new \RawMessage(
'$1', [ $this->
getUniqueId() ] ),
239 return array_values( array_filter( $reqs,
function (
$req )
use ( $data ) {
240 return $req->loadFromSubmission( $data );
254 $requests = array_filter( $reqs,
function (
$req )
use ( $class, $allowSubclasses ) {
255 if ( $allowSubclasses ) {
256 return is_a(
$req, $class,
false );
258 return get_class(
$req ) === $class;
276 foreach ( $reqs
as $req ) {
277 $info =
$req->getFieldInfo();
278 if ( $info && array_key_exists(
'username', $info ) &&
$req->username !==
null ) {
281 $otherClass = get_class(
$req );
283 $requestClass = get_class(
$req );
284 throw new \UnexpectedValueException(
"Conflicting username fields: \"{$req->username}\" from "
285 .
"$requestClass::\$username vs. \"$username\" from $otherClass::\$username" );
302 $primaryRequests = array_filter( $reqs,
function (
$req ) {
305 $sharedRequiredPrimaryFields = array_reduce( $primaryRequests,
function ( $shared,
$req ) {
307 return empty(
$options[
'optional'] );
309 if ( $shared ===
null ) {
312 return array_intersect( $shared,
$required );
316 foreach ( $reqs
as $req ) {
317 $info =
$req->getFieldInfo();
325 $req->required === self::OPTIONAL
328 ||
$req->required === self::PRIMARY_REQUIRED
329 && !in_array(
$name, $sharedRequiredPrimaryFields,
true )
338 if ( !array_key_exists(
$name, $merged ) ) {
341 throw new \UnexpectedValueException(
"Field type conflict for \"$name\", " .
342 "\"{$merged[$name]['type']}\" vs \"{$options['type']}\""
345 if ( isset(
$options[
'options'] ) ) {
346 if ( isset( $merged[
$name][
'options'] ) ) {
374 foreach ( $data
as $k => $v ) {
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
this hook is for auditing only $req
Allows to change the fields on the form that will be generated $name
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Allows to change the fields on the form that will be generated are created Can be used to omit specific feeds from being outputted You must not use this hook to add use OutputPage::addFeedLink() instead. & $feedLinks hooks can tweak the array to change how login etc forms should look $requests
the array() calling protocol came about after MediaWiki 1.4rc1.