Commit graph

23 commits

Author SHA1 Message Date
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