Commit graph

44 commits

Author SHA1 Message Date
Wargo 7516707858 Display namespace name instead of its ID in checkboxes' labels
This fixes change 3bf7584c51 where after that, "nsN" is label for checkbox instead of human-readable name, as previous behaviour.

Bug: T362458
Change-Id: Iefa31ebf3759a9bf53d66c3b3c6f5e7dd76f4178
2024-09-01 11:37:35 +10:00
Jon Robson 3bf7584c51 Refactor logic for component rendering
Result is exactly same, but mediawiki ui markup is
centralized to a single function.

Bug: T353371
Change-Id: If021e39beb48246985edf40dc94e2442e9fc49ee
2024-04-05 12:26:53 +00:00
Umherirrender adbfb14047 Remove isset() from InputBox::mLabelText
The class property is declared and defined to be string,
the extra null check from isset() is not needed here.

Change-Id: Ia2815a2a5df897efde3ace3fac87a85c69ac46ba
2024-03-25 20:51:14 +01:00
Umherirrender 30b71be93c build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0
Change-Id: I4307bfb8b32e8bbca9565b255758f8e68941fc6c
2024-03-11 19:24:57 +01:00
Umherirrender 0dd9df7e32 build: Fix doc type on MediaWikiPerformActionHook
This requires 1.42 for the new type

Bug: T354216
Follow-Up: Ib70e4e67e4cb1b65ac218c095864fb6eb43d0929
Change-Id: Id3f5f31bcc6183e8a72b05bfe344a72285c7a8b2
2024-01-05 21:04:05 +01:00
Fomafix ee2bac90b5 Replace global variables by injected MainConfig and MainConfigNames
Change-Id: Ieb24c6bd93d60fc578c5842b2f623b1a6e5fb94b
2023-10-22 13:41:40 +00:00
Fomafix 0aa8b3f919 Use namespaced classes
Change-Id: I591edd4aca3b0c85bdcdb5c65e2b334519fff235
2023-10-22 12:24:40 +00:00
Umherirrender 2c52a051b3 Replace empty() with a string compare
empty() should only be used to suppress errors
Found by a new phan plugin (T234237)

Change-Id: Ie9e55442ea8238e917216a90d99c4ab7aa82581f
2023-10-21 20:59:24 +02:00
Bartosz Dziewoński b8f9af0af6 Add missing 'mediawiki.ui.button' module
Bug: T347233
Change-Id: I79dc8ee79a2f2f7a23e78903e332bdec5747c142
2023-10-06 03:03:59 +02:00
gerritbot 04aaa7a601 Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I9497c2d1bbacd1a939d1734ef5b3fcdf55d49528
2023-08-19 04:16:50 +00:00
Bartosz Dziewoński 9f823d72a8 Handle 'prefix' when 'action=edit', even if another extension overrides action
Bug: T337436
Change-Id: Idbd248ac9731fe2082e1557dfddbf39a112ceac7
2023-05-25 00:00:49 +02:00
Bartosz Dziewoński 48e6e170b6 Add support for 'usedt' parameter to set '&dtpreload=1'
Depends-On: I4ee024cc4760542790319f302f42b1b2389ac897
Bug: T285117
Change-Id: If5178f8d68eced334c2aaf2d13909a7aefe0d937
2023-03-15 17:05:07 +01:00
Fomafix 7c2d750a70 Use single type in @var declaration
Replace false by null.

Change-Id: Iebcd973d1cf6cf6d2393ef9bb9548c9a946712a7
2023-01-02 19:41:07 +00:00
jenkins-bot fdcf5a679d Merge "Improve Hooks::onMediaWikiPerformAction" 2022-11-11 11:23:16 +00:00
Umherirrender b197b9ffe7 Improve Hooks::onMediaWikiPerformAction
- Use IContextSource::getActionName directly and not
MediaWiki::getAction
- Use IContextSource::getConfig instead of MainConfig
- Use getRawVal to check against constant value
- Use local var to avoid repeatly calls

Change-Id: I592e4451035c37c35fe181fa69b080f3f7a31ec8
2022-11-11 11:58:02 +01:00
Fomafix 0203c16002 Remove phpcs exclude rules and update PHP code
Add a @phan-suppress-next-line PhanSuspiciousValueComparison because of
a false positive finding:

includes/InputBox.php:471 PhanSuspiciousValueComparison
Suspicious attempt to compare $this->mType of type 'comment'
to 'comment' of type 'comment' with operator '==='

Change-Id: Id14028d22c1d352a0886a7da0d94b0329a5418df
2022-11-11 06:52:26 +00:00
jenkins-bot 1f08bd8abc Merge "Simplify code that generates different error messages" 2022-02-05 23:41:30 +00:00
jenkins-bot d19b359312 Merge "De-obfuscate attempts to trick people into editing .js pages" 2022-02-05 23:41:28 +00:00
zoranzoki21 1a79401e7f Fix MediaWiki.Commenting.PropertyDocumentation.WrongStyle
Change-Id: I32e42828c4539efeb7aa211a8f76a68fae5a4f94
2022-01-09 09:51:04 +01:00
Thiemo Kreuz e9e9b8360d De-obfuscate attempts to trick people into editing .js pages
This is meant to tell the user "please don't do this", "this
combination of parameters is dangerous". But there are other ways
to make links with these parameters. Another patch that changes the
relevant code in EditPage that is responsible for this issue will
follow.

Bug: T297725
Change-Id: I75946e2fc73266802333a77086b7ff6a74f2f3e6
2021-12-15 13:44:03 +00:00
Thiemo Kreuz c0a2f53db1 Simplify code that generates different error messages
Giving the parameter to both messages even if one doesn't expect a
parameter is not a problem.

Change-Id: I123fb970731b9d9103d358007fd2185a7ab5d81b
2021-12-15 12:01:38 +01:00
C. Scott Ananian b808f7f559 Make InputBoxHooks::render() non-static
This matches modern practice a little better: the InputBoxHooks class
can (eventually) contain the service objects needed by this extension
and make them available to the hooks.   It also avoids the need to
explicitly name this class and its namespace.

Followup-To: Iaaff18b50619f490a4437be7f4d95845c8e0eedb
Change-Id: I07a574eca2d0012e3f7e6172d75cffd34392b1b4
2021-12-10 13:49:55 -05:00
Isabelle Hurbain-Palatin cbead9bfbb Introducing a namespace for InputBox
This is a pre-patch for I5144fd6c54 to add a namespace for InputBox and
making sure that this still works, independently of what we're doing
later.

Change-Id: Iaaff18b50619f490a4437be7f4d95845c8e0eedb
2021-12-10 19:15:56 +01:00
Fomafix 2e375a712d Use HookHandlers to inject services and replace global variables
This change requires MediaWiki 1.35+ which is already required in
extension.json.

Change-Id: Ieb636c9e96c534ed6dccd8cce5308fed160c3410
2021-11-12 16:41:59 +00:00
Umherirrender b234d79a45 Use services from Parser
getTargetLanguageConverter is 1.38
(I536543c516bf952967ada17cc781a9d125421b3e)

Change-Id: Ie0456734576cee770662622a03420b6ec76d932a
2021-11-04 20:09:34 +00:00
Umherirrender 1abc7abc43 Remove unneeded return from hook handlers
Change-Id: Ib38375909ee09e3d5342b6fd16194feeffbb8124
2021-11-04 18:50:42 +00:00
Umherirrender 4829d17708 build: Remove unneeded phan suppression
Change-Id: Iafff45a2693e201cbb81c59a6453f6bbea709f7a
2021-11-04 19:50:25 +01:00
Fomafix b1e2979b48 Update PHP coding style
* Use ' instead of ".
* Use === and !== instead of == and !=.

Change-Id: Ie4e405d4fd739d4af34010da3687d8a75d846a73
2021-10-16 20:10:22 +00:00
libraryupgrader b636ed5093 build: Updating composer dependencies
* mediawiki/mediawiki-phan-config: 0.10.6 → 0.11.0
* php-parallel-lint/php-parallel-lint: 1.3.0 → 1.3.1

Change-Id: I6d629585dfc24c34f6a0fc3760d354aba2e1f5b3
2021-09-09 10:58:03 +00:00
Timo Tijhof 93351fb7d9 Use native <input required> instead of JS-based disabled toggling
Remove the JavaScript module and its logic to toggle the disabled
state on the submit button. Instead, let the browser handle this
natively by setting the `required` attribute, which naturally prevents
early submissions.

Retain the current styling for 99% of cases by using the
:required:invalid selector to target the submit button to make it
appear disabled. This slight duplication of styles is needed because,
despite the form effectively being disabled natively, the core
mediawiki-ui styles only account for :disabled on the button directly
and not e.g. inherited via form:invalid. It is also unclear whether
we would want that, since there is some value to be had from having
the form give a consistent look with a progressive button that can
be submitted even at the wrong time to yield an assistive message to
the required field, so hence handling this locally for now instead of
with a generalised approach.

In order to use the required true/false idiom, I have switched the
generating of the HTML string from the old Xml::element method
to Html::element. This means there is no need to store it in an array
first and conditionally set it since true/false will result in absence
or required="" as needed.

As side-effect from this, redundant attributes like value="" and
type="text" are ommitted from the output, just as MediaWiki core does
more generally.

Bug: T283303
Change-Id: I2c75e09dd3f89fa11fca311b4e1f8133946b01b1
2021-05-21 21:04:02 +01:00
Daimona Eaytoy c52e9fe34b Stop using deprecated Language methods
Change-Id: Idd3a255c60bb0c615e819a56f86b3d36377a0469
2021-02-27 14:22:36 +00:00
Bartosz Dziewoński 943d505e2e Fix "PHP Notice: Array to string conversion" when handling prefix/title params
$params['title'] can be an array if someone has messed with the query
parameters.

Use WebRequest::getText(), which guarantees strings (and which is
already used for 'prefix' earlier in this method).

Change-Id: I7b974067fdee22fc42c07fad98af4619fa850269
2021-02-19 21:28:55 +01:00
libraryupgrader 9d4a98e655 build: Updating mediawiki/mediawiki-codesniffer to 33.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate
* MediaWiki.Commenting.PropertyDocumentation.WrongStyle

Additional changes:
* Dropped .inc files from .phpcs.xml (T200956).
* Added the `wikimedia/mediawiki` profile in .eslintrc.json (T262222).

Change-Id: Ic7e903cc97b3766fcff467b382caf2a5a6bc5089
2020-11-04 02:06:23 +00:00
Greg Rundlett 1e76fa3fc2 Adding CSS class to hook into SearchSuggest feature
Fixes Bug: T260437

This commit updates unit tests

Change-Id: I36c8c9837c4d1d0beff8ebdb5e86d55937a9e512
2020-08-18 12:40:03 -04:00
jenkins-bot d6d9e032c5 Merge "Provide an aria-label attribute option to the input textbox" 2020-04-24 23:37:49 +00:00
Akinwale Alagbe 0d6c2bfc6b Provide an aria-label attribute option to the input textbox
Provide an option to supply the aria-label attribute to the inputbox to 
allow generated markup be accessible to screen readers
<inputbox>
    type=search
    width=120
    buttonlabel=Search
    arialabel=Search this wiki
</inputbox>

Bug: T242354
Change-Id: I40c62bc9889a4912b43244ec65e628ec8bc8533f
2020-04-24 23:05:16 +00:00
DannyS712 13a0039996 Use lowercase for primitive type 'string'
Change-Id: I374868a5a83164c6f1f225b1daac56e58bb81679
2020-03-20 15:58:55 +00:00
Max Semenik ff039d713e Stop passing objects by reference
Bug: T193950
Change-Id: I1695035499c6e6a612cbf2ed8090bbe7bb04bfea
2019-11-14 23:34:06 -08:00
Derick Alangi aab9a97c96 Avoid usage of deprecated $wgContLang global (dep in 1.32)
Change-Id: I1c3d9b6d9de3c7ef24f24f45aad9510be3f8b588
2019-09-02 09:55:37 +01:00
Fomafix 025f373d8a Use \u{00A0} instead of &#160;
Directly use the UTF-8 encoding of the 'NO-BREAK SPACE' (U+00A0)
instead of the HTML/XML entitiy &#160;.

Bug: T154300
Change-Id: Ica1a16c7114ec2c5bea04b21f14cf083eb4e417b
2019-05-13 19:12:09 +02:00
Max Semenik 10cfa1cda5 Parser::getConverterLanguage() is deprecated
Change-Id: Id09eac3cd681471f26993885b2f3e752ba87694a
2019-03-15 14:58:48 -07:00
Brian Wolff 252fed5d27 Fix a phan-taint-check false positive
phan-taint-check gets confused when you escape a variable and
assign the escaped version to the same name as the unescaped
version.

Change-Id: I1bf4d64e68bff516b5f8b6266d85f67020008433
2018-05-04 21:02:10 +00:00
Kunal Mehta 6deecac4c2 Add phan configuration
Change-Id: I220a6da9d506a754d4e502bd4bd3178949b73f5f
2018-02-24 13:57:36 -08:00
Kunal Mehta 431f955a81 Move classes to includes/
Change-Id: Ia65adfc9d9d6a117d8d4fc711e97414328b42440
2018-02-24 13:57:32 -08:00