User:松/Drafts/Extension:AbuseFilter/Rules format: Difference between revisions

Content added Content deleted
(Translation code removal)
(Translation code removal)
Line 158: Line 158:
* <code>&lt;</code>{{int|comma-separator}}<code>&gt;</code> &mdash; Return true if the left-hand [[w:Operand|operand]] is ''less than/greater than'' the right-hand operand respectively. Watch out: operands are casted to strings and, like it happens in PHP, <code>null < any number === true</code> and <code>null > any number === false</code>.
* <code>&lt;</code>{{int|comma-separator}}<code>&gt;</code> &mdash; Return true if the left-hand [[w:Operand|operand]] is ''less than/greater than'' the right-hand operand respectively. Watch out: operands are casted to strings and, like it happens in PHP, <code>null < any number === true</code> and <code>null > any number === false</code>.
* <code>&lt;=</code>{{int|comma-separator}}<code>&gt;=</code> &mdash; Return true if the left-hand operand is ''less than or equal to/greater than or equal to'' the right-hand operand respectively.Watch out: operands are casted to strings and, like it happens in PHP, <code>null <= any number === true</code> and <code>null >= any number === false</code>.
* <code>&lt;=</code>{{int|comma-separator}}<code>&gt;=</code> &mdash; Return true if the left-hand operand is ''less than or equal to/greater than or equal to'' the right-hand operand respectively.Watch out: operands are casted to strings and, like it happens in PHP, <code>null <= any number === true</code> and <code>null >= any number === false</code>.
* <code>==</code> (or<code>=</code>), <code>!=</code> &mdash; Return true if the left-hand operand is ''equal to/not equal to'' the right-hand operand respectively.
<translate>
* <code>===</code>{{int|comma-separator}}<code>!==</code> &mdash; Return true if the left-hand operand is ''equal to/not equal to'' the right-hand operand AND the left-hand operand is ''the same/not the same'' data type to the right-hand operand respectively.
<!--T:50-->
* <tvar|1><code>==</code></> (or <tvar|2><code>=</code></>), <tvar|3><code>!=</code></> &mdash; Return true if the left-hand operand is ''equal to/not equal to'' the right-hand operand respectively.</translate>
<translate>
<!--T:51-->
* <tvar|1><code>===</code>{{int|comma-separator}}<code>!==</code></> &mdash; Return true if the left-hand operand is ''equal to/not equal to'' the right-hand operand AND the left-hand operand is ''the same/not the same'' data type to the right-hand operand respectively.</translate>
<!--Note: these examples are also used in https://phabricator.wikimedia.org/diffusion/EABF/browse/master/tests/parserTests/mwexamples-comparisons.t -->
<!--Note: these examples are also used in https://phabricator.wikimedia.org/diffusion/EABF/browse/master/tests/parserTests/mwexamples-comparisons.t -->


{| class="wikitable"
{| class="wikitable"
! style="width: 50%;"| <translate><!--T:52--> Example</translate>
! style="width: 50%;"| Example
! Result
! <translate><!--T:53--> Result</translate>
|-
|-
|<code>1 == 2</code>|| false
|<code>1 == 2</code>|| false
Line 215: Line 211:
|-
|-
|<code>['1'] == '1'</code>
|<code>['1'] == '1'</code>
|false<ref><translate><!--T:54--> Comparing arrays to other types will always return false, except for the example above</translate></ref>
|false<ref>Comparing arrays to other types will always return false, except for the example above</ref>
|}
|}


== Built-in variables ==
<translate>
== Built-in variables == <!--T:55-->


The abuse filter passes various variables by name into the parser.These variables can be accessed by typing their name in, in a place where a literal would work.You can view the variables associated with each request in the abuse log.
<!--T:56-->
The abuse filter passes various variables by name into the parser.</translate>
<translate>
<!--T:57-->
These variables can be accessed by typing their name in, in a place where a literal would work.</translate>
<translate>
<!--T:58-->
You can view the variables associated with each request in the abuse log.


===Variables from AbuseFilter=== <!--T:59-->
===Variables from AbuseFilter===

====Variables always available====


====Variables always available==== <!--T:60-->
</translate>
{{Caution|1=<translate><!--T:414--> User-related variables are always available, except for one case: account creation when the creator is not logged in.</translate> <translate><!--T:415--> All variables starting with <tvar|1><code>user_</code></> are affected.</translate>}}
{{Caution|1=<translate><!--T:414--> User-related variables are always available, except for one case: account creation when the creator is not logged in.</translate> <translate><!--T:415--> All variables starting with <tvar|1><code>user_</code></> are affected.</translate>}}