MediaWiki  master
MediaWiki\Preferences\SignatureValidator Class Reference
Collaboration diagram for MediaWiki\Preferences\SignatureValidator:

Public Member Functions

 __construct (UserIdentity $user, ?MessageLocalizer $localizer, ParserOptions $popts)
 
 validateSignature (string $signature)
 

Protected Member Functions

 applyPreSaveTransform (string $signature)
 
 checkLineBreaks (string $signature)
 
 checkLintErrors (string $signature)
 
 checkUserLinks (string $signature)
 

Private Member Functions

 getLintErrorDetails (array $lintError)
 
 getLintErrorLocation (array $lintError)
 

Private Attributes

MessageLocalizer null $localizer
 
Parser $parser
 
ParserOptions $popts
 
ServiceOptions $serviceOptions
 
SpecialPageFactory $specialPageFactory
 
TitleFactory $titleFactory
 
UserIdentity $user
 

Detailed Description

Since
1.35

Definition at line 40 of file SignatureValidator.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Preferences\SignatureValidator::__construct ( UserIdentity  $user,
?MessageLocalizer  $localizer,
ParserOptions  $popts 
)

Member Function Documentation

◆ applyPreSaveTransform()

MediaWiki\Preferences\SignatureValidator::applyPreSaveTransform ( string  $signature)
protected
Parameters
string$signatureSignature before PST
Returns
string|bool Signature with PST applied, or false if applying PST yields wikitext that would change if PST was applied again

Definition at line 205 of file SignatureValidator.php.

References MediaWiki\Preferences\SignatureValidator\$parser, Parser\getFreshParser(), Parser\getOutput(), SpecialPage\getTitleFor(), and Parser\preSaveTransform().

Referenced by MediaWiki\Preferences\SignatureValidator\validateSignature().

◆ checkLineBreaks()

MediaWiki\Preferences\SignatureValidator::checkLineBreaks ( string  $signature)
protected
Parameters
string$signatureSignature after PST
Returns
bool Whether signature contains no line breaks

Definition at line 329 of file SignatureValidator.php.

Referenced by MediaWiki\Preferences\SignatureValidator\validateSignature().

◆ checkLintErrors()

MediaWiki\Preferences\SignatureValidator::checkLintErrors ( string  $signature)
protected
Parameters
string$signatureSignature after PST
Returns
array Array of error objects returned by Parsoid's lint API (empty array for no errors)

Definition at line 239 of file SignatureValidator.php.

References MW_VERSION.

Referenced by MediaWiki\Preferences\SignatureValidator\validateSignature().

◆ checkUserLinks()

MediaWiki\Preferences\SignatureValidator::checkUserLinks ( string  $signature)
protected
Parameters
string$signatureSignature after PST
Returns
bool Whether signature contains required links

Definition at line 288 of file SignatureValidator.php.

References MediaWiki\Preferences\SignatureValidator\$parser, Parser\getFreshParser(), SpecialPage\getTitleFor(), NS_USER, NS_USER_TALK, and Parser\parse().

Referenced by MediaWiki\Preferences\SignatureValidator\validateSignature().

◆ getLintErrorDetails()

MediaWiki\Preferences\SignatureValidator::getLintErrorDetails ( array  $lintError)
private

◆ getLintErrorLocation()

MediaWiki\Preferences\SignatureValidator::getLintErrorLocation ( array  $lintError)
private

◆ validateSignature()

MediaWiki\Preferences\SignatureValidator::validateSignature ( string  $signature)
Parameters
string$signatureSignature before PST
Returns
string[]|bool If localizer is defined: List of errors, as HTML (empty array for no errors) If localizer is not defined: True if there are errors, false if there are no errors

Definition at line 95 of file SignatureValidator.php.

References MediaWiki\Preferences\SignatureValidator\applyPreSaveTransform(), MediaWiki\Preferences\SignatureValidator\checkLineBreaks(), MediaWiki\Preferences\SignatureValidator\checkLintErrors(), MediaWiki\Preferences\SignatureValidator\checkUserLinks(), MediaWiki\Preferences\SignatureValidator\getLintErrorDetails(), MediaWiki\Preferences\SignatureValidator\getLintErrorLocation(), Html\rawElement(), and wfEscapeWikiText().

Member Data Documentation

◆ $localizer

MessageLocalizer null MediaWiki\Preferences\SignatureValidator::$localizer
private

◆ $parser

Parser MediaWiki\Preferences\SignatureValidator::$parser
private

◆ $popts

ParserOptions MediaWiki\Preferences\SignatureValidator::$popts
private

◆ $serviceOptions

ServiceOptions MediaWiki\Preferences\SignatureValidator::$serviceOptions
private

Definition at line 57 of file SignatureValidator.php.

◆ $specialPageFactory

SpecialPageFactory MediaWiki\Preferences\SignatureValidator::$specialPageFactory
private

Definition at line 59 of file SignatureValidator.php.

◆ $titleFactory

TitleFactory MediaWiki\Preferences\SignatureValidator::$titleFactory
private

Definition at line 61 of file SignatureValidator.php.

◆ $user

UserIdentity MediaWiki\Preferences\SignatureValidator::$user
private
Initial value:
=[,,]
private const CONSTRUCTOR_OPTIONS
'SignatureAllowedLintErrors'
'VirtualRestConfig'

Definition at line 49 of file SignatureValidator.php.

Referenced by MediaWiki\Preferences\SignatureValidator\__construct().


The documentation for this class was generated from the following file: