aboutsummaryrefslogtreecommitdiffstats
path: root/includes/xml
Commit message (Collapse)AuthorAgeFilesLines
* Xml: Hard-deprecate four more deprecated methods unused in prodJames D. Forrester2025-03-111-4/+12
| | | | | Bug: T341775 Change-Id: I0f93cfa546580fe5544b781f0dd138877b5850b4
* Xml: Hard-deprecate encodeJsCall/encodeJsVar, no longer used in prodJames D. Forrester2025-03-111-2/+6
| | | | | Bug: T341779 Change-Id: I97f377db80be9ee840ad101436233b40205590ad
* Use explicit nullable type on parameter argumentsUmherirrender2024-10-161-1/+1
| | | | | | | | | | | Implicitly marking parameter $... as nullable is deprecated in php8.4, the explicit nullable type must be used instead Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a Break one long line in SpecialPage.php Bug: T376276 Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
* Add missing documentation to class properties (miscellaneous classes)Umherirrender2024-09-141-0/+4
| | | | | | | | | | Add doc-typehints to class properties found by the PropertyDocumentation sniff to improve the documentation. Once the sniff is enabled it avoids that new code is missing type declarations. This is focused on documentation and does not change code. Change-Id: I1da4b272a6b28c419cc8e860d142dae19ca0bbcf
* Make use of the ??= and ?? operators where it makes sensethiemowmde2024-08-261-3/+1
| | | | | | | | This touches various production classes and maintenance scripts. The code should do the exact same as before. The main benefit is that the syntax avoids any repetition. Change-Id: I5c552125469f4d7fb5b0fe494d198951b05eb35f
* Use namespaced classes (1)Umherirrender2024-06-161-1/+1
| | | | | | | Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: Ic4d4dd61de5ab896fb6173eb579c81f164a1e4a3
* Add namespace and deprecation alias to Xml and XmlSelectEbrahim Byagowi2024-05-162-1/+11
| | | | | | | | | | This patch introduces a new namespace declaration, MediaWiki\Xml and adds Xml and XmlSelect to it and establishes class aliases marked as deprecated since version 1.43. Bug: T353458 Change-Id: I45cccd540b6e15f267d3ab588a064fbeb719d921
* Xml: Deprecate more methods that are HTML-specificJames D. Forrester2024-04-091-5/+40
| | | | | | | | | | | | | | - Xml::buildTable and ::buildTableRow No direct replacement. - Xml::dateMenu, ::languageSelector, and ::monthSelector No direct replacement. No use in CodeSearch, so hard-deprecated immediately. - Xml::listDropdown, ::listDropdownOptions, and ::listDropdownOptionsOoui Replacements already available in Html, and migration underway. Change-Id: Idbed5016e0d5d518690dd2f02a41ad68bfdbab9a
* Rename dropdown-related methods to avoid random camel-caseBartosz Dziewoński2024-03-091-7/+7
| | | | | | | | | | | | | | | | It's a dropdown, not a drop down, therefore rename: * Html::listDropDownOptions → Html::listDropdownOptions * Xml::listDropDownOptions → Xml::listDropdownOptions * Html::listDropDownOptionsOoui → Html::listDropdownOptionsOoui * Xml::listDropDownOptionsOoui → Xml::listDropdownOptionsOoui * Xml::listDropDown → Xml::listDropdown In PHP, method names are case-insensitive, therefore we can do this without a breaking change or deprecation. This also matches the naming convention in OOUI. Change-Id: Ifda13ba9dee316709c424636ec3b285de8d0e9b1
* Soft deprecate many Xml methods that belong to Html, not Xmlthiemowmde2024-02-161-3/+18
| | | | | | | | While this doesn't do much, it makes it easier to find such code in the IDE. Bug: T341775 Change-Id: I4206b6185074851c58dbfa5e955fc0f0fb61b0a7
* Deprecate Xml::wrapClass, used in only one other repoJames D. Forrester2024-02-061-0/+3
| | | | Change-Id: I2b49625a8519371dd392d0ba6786e2831cc5f83b
* Remove uses of $wgUseMediaWikiUIEverywhereBartosz Dziewoński2024-02-041-32/+11
| | | | | | | | | Removing the config variable in a separate change: Ib9966bc6a4a94f771cb99a5aa52fb6a1dc826ca5 (just in case something depends on its existence). Bug: T182050 Change-Id: Ic3e038df16fc540ec7f6bcb9a54d73f8d596d305
* Add another batch of taint-check annotationsDaimona Eaytoy2023-09-231-0/+13
| | | | | | | | | | | | | | | | Copied from MediaWikiSecurityCheckPlugin.php. Duplicate annotations from Xml::encode* to the corresponding Html::encode* methods, given that these were moved recently but not hardcoded in taint-check. As the only difference, remove the HTML taintedness type from the return value of Message::rawParams. If the argument is unsafe, it's reported immediately thanks to exec_html. Else, it does not contribute to the taintedness of the return value. Bug: T321806 Change-Id: I5ed340e1d127fb3eab6d6f9b905693d05a393360
* Namespace Sanitizer under \MediaWiki\ParserJames D. Forrester2023-09-211-0/+1
| | | | | Bug: T166010 Change-Id: Id13dcbf7a0372017495958dbc4f601f40c122508
* Reorg: Move MWTimestamp to MediaWiki\UtilsAmir Sarabadani2023-08-191-0/+1
| | | | | Bug: T321882 Change-Id: I48c10343295c4eb3d9ef8037343b0070e928f040
* Html: Move encodeJsVar() + encodeJsCall() from XmlLucas Werkmeister2023-07-142-92/+5
| | | | | | | | | These methods really belong in the Html class, not Xml. Leave behind soft-deprecated Xml methods that forward to the Html ones, as well as a class alias for HtmlJsCode (renamed from XmlJsCode). Bug: T341779 Change-Id: I99a5f9de1411d4eb5ee30226b4e8ace3ea8b2c3b
* Replace some more usages of deprecated MWExceptionDaimona Eaytoy2023-06-091-10/+6
| | | | | Bug: T328220 Change-Id: I3c36835fbd90acc301731e2b33ae4815cd4b0cc5
* Reorg: Move HTML-related classes out of includes/ to Html/Amir Sarabadani2023-02-162-0/+3
| | | | | Bug: T321882 Change-Id: I5dc1f7e9c303cd3f5b9dd7010d6bb470d8400a18
* Make use of ?:, ?? and ??= operators in mostly trivial casesthiemowmde2022-12-051-4/+1
| | | | | | | | | | The motivation is to make the code less confusing. I hope this is the case. ?? is an older PHP 7.0 feature. ??= was added in PHP 7.4, which we can finally use. Change-Id: Id807affa52bd1151a74c064623b41d950a389560
* Respond to some messages from Phan on PHP 8.1Tim Starling2022-11-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ForkController, OrderedStreamingForkController: indeed pcntl_fork() can't return false. * RL\Image: Specify type instead of using suppression, since the issue name changes. * VueComponentParser: Accept complaint about nullable nodeValue. * Disable PHP 8.0 polyfill stubs when running on PHP 8.0+ to avoid duplicate interface errors. * Add Socket stub and use it in LegacyHandler instead of multiple existing suppressions. * MemcachedPeclBagOStuff: accept complaint recommending !$result over $result === false when the type is boolean. * MemcachedPeclBagOStuff: fix probable bug, ignoring errors from Memcached::getMulti(). Phan noticed that $res=false was unreachable, but it should probably be reachable. * DatabaseMysqli: accept complaint that $this->conn->errno is already known to be an int. It was probably a hack for some previous version of Phan. * BcryptPassword, MWOldPassword, MWSaltedPassword: accept complaint that the !is_string() checks are unnecessary, after code review of PHP. * Pbkdf2PasswordUsingHashExtension: note that contrary to Phan's suggestion, this check is necessary. * DefaultPreferencesFactory: remove an existing hack for array_diff_key(), no longer necessary on 7.4 and causes an error on 8.1. Use coalesce instead of cast for the remaining array_intersect_key() hack since it better shows that we are casting away null. * FullSearchResultWidget: fix likely bug involving strict comparison between a float and an int. * SpecialWatchlist: accept complaint that $selectedHours is unconditionally a float, being the return value of round(), and thus the cast is unnecessary. * Add stub for AllowDynamicProperties, resolving an error in User.php. * Xml: accept complaint that $encMonth is already known to be an int. Six errors remain. These need suppressions or otherwise conflict with PHP 7.4 support. Bug: T322278 Change-Id: Ie375bbc8ccf22330b9a169e8da98f2bbe26ec8b9
* Use short array destructuring instead of list()Tim Starling2022-10-212-2/+2
| | | | | | | | Introduced in PHP 7.1. Because it's shorter and looks nice. I used regex replacement. Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
* Fix many typos in commentsMatěj Suchánek2022-05-101-1/+1
| | | | | | Found using IntelliJ's "Typo" code inspection. Change-Id: I746220ebe6e1e39f6cb503390ec9053e6518cf16
* Remove access to config globals from more classesdaniel2022-04-281-8/+12
| | | | | | Bug: T294739 Depends-On: I84056024b0d3a9dcddb1ab4dc8596118bb3fe8ea Change-Id: If005958c76bbfabba74def4215c48fe94f297797
* phan: Disable scalar_implicit_cast settingUmherirrender2022-03-181-1/+1
| | | | | | | | | Make phan stricter about scalar types by setting scalar_implicit_cast to false (the default in mediawiki-phan-config) Bug: T242536 Bug: T301991 Change-Id: Ia2fe30b17804186571722e728578121c8b75d455
* Fix various real types related to scalar typesUmherirrender2022-03-101-1/+1
| | | | | | | | Swap null/false or use real strings if needed Found by phan strict checks Change-Id: Id82ea609f05a76c5cb8c661d5cf2b7922d6cfbc1
* Fix various documentation related to scalar typesUmherirrender2022-03-091-3/+3
| | | | | | Found by phan strict checks Change-Id: If41d16b473baddd92cc4261cdc2bfbe65fedcb19
* Fix type of value directly passed to php internal functionsUmherirrender2022-03-071-1/+1
| | | | | | Found by phan strict checks Change-Id: Icc44cd143f2e98fa3ca188e625a3289441de0f73
* Use LanguageNameUtils constants instead of stringsAlexander Vorwerk2021-12-051-1/+2
| | | | Change-Id: I8521d00675008da0d7c8c768ab75352212653c66
* Simplify else-branches after continue/breakUmherirrender2021-08-171-1/+2
| | | | | | | When the if branch continues the loop, than the next branch does not need to be an else branch Change-Id: Ia158709b7fd2ea811f1049cf8f53ed12c89719e3
* ProtectionForm: Use XmlSelect::parseOptionsMessage where appropriateBartosz Dziewoński2021-05-251-0/+1
| | | | | | | Previously done in 02db290c6406ebf1db5eadf308fcf4694b21929a, looks like it was accidentally undone in 1262ca1897ea9c3f4afea86cbc25f98e24d840da. Change-Id: I227ed9c6ba146fa249756f444f5c96ac2b5022b6
* Don't accept empty option group names for dropdown elementsThiemo Kreuz2021-02-191-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | When this code parses a string that looks like this: * ** A ** B It creates an option group with 2 options, but the name of the group is an empty string. This makes the OOUI DropdownInputWidget fail later. Since the empty group name is useless anyway, drop it. This makes the code behave as if the parsed string looked like this: * A * B Live example for the issue: https://el.wikipedia.org/wiki/MediaWiki:Protect-dropdown Bug: T275125 Change-Id: I780c1be27740b0ed3b35aa569b5a528112d7238f
* Use __CLASS__/::class to define callback for array_map/_filter/usortUmherirrender2021-01-221-1/+1
| | | | Change-Id: I3519dd5a1ce1ea688de602190cd74755c400c717
* build: Enable phan-taint-check-plugin and suppress issuesUmherirrender2020-12-302-2/+3
| | | | | | | | | | | | | | | | | | Taint check checks for possible security issues by tracking html escaping and more by using phan. This slows done the phan-job a bit and requires more ram Keep the DoubleEscaped issues out to make reviewer easier Adds suppression for false positives Adds taint-annotation to help taint-check Removes suppression for code phan now understand better by the tracking of keys in taint-check Fix some small issues by adding int cast or htmlspecialchars calls Bug: T216348 Bug: T268920 Change-Id: I849ac4f120fd15b483e8939d4db45c98dc351259
* build: Updating mediawiki/mediawiki-codesniffer to 34.0.0Umherirrender2020-12-071-0/+1
| | | | Change-Id: I2fb18ddd4c144655a665792901e59f88bcd906dc
* Improve docs for Xml classUmherirrender2020-11-281-15/+15
| | | | Change-Id: I856b9bc4b62ddb8f03ed8f9111fc0dc037ff1046
* Update a lot of unspecific "array" types in PHPDocsThiemo Kreuz2020-10-281-3/+2
| | | | | | | | | This includes fixing some mistakes, as well as removing redundant text that doesn't add new information, either because it literally repeats what the code already says, or is actually duplicated. Change-Id: I3a8dd8ce57192deda8916cc444c87d7ab1a36515
* Drop down lists: Do not use the value for 'other' as option groupUmherirrender2020-09-161-1/+4
| | | | | | | Instead use them as groupless reason list Bug: T251351 Change-Id: Id691d97e3e6f205615f639e051619f3d0f67c7ba
* includes: Use expression assignment operator += or |= where possibleUmherirrender2020-07-311-1/+1
| | | | | | It is easier to read. Change-Id: Ia3965b80153d64f95b415c6c30f526efa252f554
* xml: Move condition check of var before creating XmlSelect objectDerick A2020-04-271-2/+4
| | | | | | | | | | | | The `$selected` var could be null and in this case, return the default, an empty string. The null check was after creating the XmlSelect object which seemed out of place as after setting the variable to the default, it's not used anywhere below. Actually, the check should happen above and set it to it's default if need be before creating the object below. Change-Id: I6b69a7780c9f4a9ae283db8fa90b9cee76954d00
* Unify handling of options messagesSam Wilson2020-03-271-0/+23
| | | | | | | | | There are a few messages that use a custom format for select lists. This moves the parsing of these messages into a single method. Bug: T245565 Change-Id: I0a24d3458979d7cca2dc3cb38c1b0f700a88490a
* Move Xml* classes under /xmlAaron Schulz2020-03-193-0/+1073
Change-Id: I012648c9a860611a7cd809119073803e82429fc3