MediaWiki REL1_40
UnicodeConstraint.php
Go to the documentation of this file.
1<?php
22
23use StatusValue;
24
32
37 public const VALID_UNICODE = 'ℳ𝒲β™₯π“Šπ“ƒπ’Ύπ’Έβ„΄π’Ήβ„―';
38
43 private $input;
44
48 public function __construct( string $inputUnicode ) {
49 $this->input = $inputUnicode;
50 }
51
52 public function checkConstraint(): string {
53 if ( $this->input === self::VALID_UNICODE ) {
54 return self::CONSTRAINT_PASSED;
55 }
56 return self::CONSTRAINT_FAILED;
57 }
58
59 public function getLegacyStatus(): StatusValue {
60 $statusValue = StatusValue::newGood();
61 if ( $this->input !== self::VALID_UNICODE ) {
62 $statusValue->fatal( 'unicode-support-fail' );
63 $statusValue->value = self::AS_UNICODE_NOT_SUPPORTED;
64 }
65 return $statusValue;
66 }
67
68}
if(!defined('MW_SETUP_CALLBACK'))
The persistent session ID (if any) loaded at startup.
Definition WebStart.php:88
getLegacyStatus()
Get the legacy status for failure (or success)
Generic operation result class Has warning/error list, boolean status and arbitrary value.
fatal( $message,... $parameters)
Add an error and set OK to false, indicating that the operation as a whole was fatal.
Interface for all constraints that can prevent edits.