1736 Commits

Author SHA1 Message Date
Andrew Nicols
613f933442
Merge branch 'MDL-80820' of https://github.com/marinaglancy/moodle 2024-04-15 10:42:22 +08:00
Marina Glancy
ef1759da74 MDL-80820 various: fix incorrect phpdocs 2024-04-08 10:13:10 +01:00
Andrew Nicols
f9404ba6c1
MDL-81316 core: Encode anchor fragments properly to RFC 3986 2024-04-04 16:05:18 +08:00
Jake Dallimore
0255500247
MDL-81313 core: Revert "Merge branch 'MDL-80338'
This reverts commit 40f501fb4e8ccad7eaacde873bf8fa809df192c5, reversing
changes made to 3061024726abdd5581d90e3a589c38b01eb533a2.
2024-03-21 11:03:25 +08:00
Huong Nguyen
d3e4821bc7 Merge branch 'MDL-80206-main' of https://github.com/andrewnicols/moodle 2024-03-18 09:42:06 +07:00
Jun Pataleta
a0e333fb7c
Merge branch 'MDL-80896-main' of https://github.com/andrewnicols/moodle 2024-03-12 11:38:26 +08:00
Andrew Nicols
d5ec9d695f
MDL-80206 core: Allow debugging to be treated as an error 2024-03-11 22:35:47 +08:00
Eloy Lafuente (stronk7)
ba1f804ffa
MDL-65292 style: Fix all function declarations white space
This has been generated running the following Sniffs, all
them part of the Moodle's CodeSniffer standard:
- PSR12.Functions.ReturnTypeDeclaration
- PSR12.Functions.NullableTypeDeclaration
- moodle.Methods.MethodDeclarationSpacing
- Squiz.Whitespace.ScopeKeywordSpacing

All them are, exclusively, about correct spacing, so the changes
are, all them, only white space changes.

Only exceptions to the above are 3 changes what were setting the
return type in a new line, and, when that happens, the closing
parenthesis (bracket) has to go to the same line than the colon.
2024-02-28 23:33:26 +01:00
Andrew Nicols
18c81e0580
MDL-80896 core: Generate a moodle_url from a UriInterface 2024-02-26 21:04:41 +08:00
Huong Nguyen
40f501fb4e
Merge branch 'MDL-80338' of https://github.com/paulholden/moodle 2024-02-22 11:17:52 +07:00
Andrew Nicols
3e6437e67c
MDL-80072 core: Mark nocache option to format_text as deprecated
This was actually deprecated back in MDL-34347 but never actually
emitted.
2024-02-12 11:11:19 +08:00
Andrew Nicols
85c1dd0077
MDL-80072 core: Deprecate format_text smiley option
This was actually deprecated in Moodle 2.0 but did not emit.
2024-02-12 11:11:18 +08:00
Andrew Nicols
d56303aa54
MDL-80072 core: Promote all formatting options to parameters
Now that PHP has support for named parameters, and we can use them in
Moodle, we should ditch `$options` arrays and use first-class,
documented, parameters.

Whilst this may seem scary, dumb, overwhelming, please note that you do
not need to supply all args, for example, to change the last parameter
of `format_text` you no longer need to do this:

    return \core\container::get(\core\formatting::class)->format_text(
       $text,
       FORMAT_MOODLE,
       $context,
       false,
       null,
       true,
       true,
       true,
       false,
       false,
       true,
    );

Instead you can do:

    return \core\container::get(\core\formatting::class)->format_text(
       $text,
       FORMAT_MOODLE,
       $context,
       allowid: true,
    );

Or better still:

    return \core\container::get(\core\formatting::class)->format_text(
       text: $text,
       format: FORMAT_MOODLE,
       context: $context,
       allowid: true,
    );

This means that we can get defaults in the function signature, improves
our typing, and allows for deprecation and changes to options. It also
sets us up for success in the future.
2024-02-12 11:11:18 +08:00
Andrew Nicols
b353c8e1e2
MDL-80072 core: Improve format_* APIs to improve clarity 2024-02-12 11:11:18 +08:00
Andrew Nicols
6bb0c91a73
MDL-80072 core: Move format_text to core\formatting 2024-02-12 11:11:16 +08:00
Andrew Nicols
37ec9ee8ee
MDL-80072 core: Move format_string to core\formatting 2024-02-12 11:11:16 +08:00
Paul Holden
6f60461220
MDL-80338 core: encode moodle_url instance anchor properties. 2024-02-07 12:21:26 +00:00
Jun Pataleta
030def7a46
Merge branch 'MDL-80079-master' of https://github.com/andrewnicols/moodle 2023-12-06 21:59:47 +08:00
Paul Holden
4be39296d6
MDL-80185 lang: use iso6391 language code for HTML lang attributes.
This resolves accessibility issues where Moodle language pack codes
didn't always map to correspondingly named iso6391 codes.

Where this value is defined in the language configuration, it will
now be used.
2023-11-21 21:37:12 +00:00
Andrew Nicols
dde3333eaa
MDL-80079 core: Correct incorrect arg to format_text::$options 2023-11-14 22:28:55 +08:00
Andrew Nicols
dab4a2b66f
MDL-80079 core: Correct incorrect arg to format_string::$options 2023-11-14 22:28:55 +08:00
Jun Pataleta
1310401056
MDL-77651 core: Hide left/right arrow characters for link_arrow_xx()
* The arrow characters in link_arrow_right() and link_arrow_left()
functions get announced by screen readers. This causes confusion
and is unnecessary.
2023-10-17 23:51:23 +08:00
Sara Arjona
cc9430929d
MDL-77708 docs: Update references from docs.moodle.org/dev 2023-09-26 10:30:19 +02:00
Jun Pataleta
1eb8ee32bb
MDL-78806 core: Remove redundant site name
MDL-78806 core: Remove redundant site name on page titles

* With the site name now being appended to the page titles, there
is no need to manually append the page titles.
2023-09-09 08:58:54 +08:00
Paul Holden
b30245b3e2
MDL-76974 javascript: convert remaining uses of old preferences API.
Implement component preference definition callbacks, update JS code
to use the `core_user/repository` module instead of the now deprecated
API.
2023-08-22 14:43:34 +01:00
Petr Skoda
989636b0de MDL-78505 core: stop mangling existing Mardown in text editors
The problem is that HTML Purifier is not compatible with Markdown,
that means we cannot sanitise Markdown texts before editing.

Luckily Markdown has to use plain text editor which does not have
XSS problems.

The only tiny downside is that Markdown cannot be allowed
in "trust text" areas any more.
2023-08-15 14:26:59 +02:00
Petr Skoda
a50c2d4746 MDL-78505 Revert "MDL-32114 form: markdown must be preserved on saving post"
This partially reverts commit 4a31dd69d6d89818f676ece916e573aa894d49d6.
2023-08-15 14:26:59 +02:00
Lior Gil
e464bf3c7d MDL-76203 weblib: Add BDI support to the HTML purifier 2023-07-02 09:05:27 +03:00
Ilya Tregubov
346548e21a
Merge branch 'MDL-78259-htmlpurify-media-tags' of https://github.com/DSI-Universite-Rennes2/moodle 2023-06-20 14:35:21 +08:00
Petr Skoda
de9c69cf3c MDL-77525 filter: add filtering stages 2023-06-17 16:43:58 +02:00
Julien Boulen
ea1253efa7 MDL-78259 weblib: purify audio/video tags as inline elements 2023-05-15 17:21:19 +02:00
Sara Arjona
440edc5e42 MDL-77735 core: Check $CFG->lang isset
In some cases, $CFG->lang might not be set, and this is causing a
Notice to be displayed when, for instance, database connection fails.
This patch should fix this case.
2023-04-14 13:46:18 +02:00
Sara Arjona
9ce4fb65fd Merge branch 'MDL-77164-master' of https://github.com/marinaglancy/moodle 2023-04-13 14:00:18 +02:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Anupama Sarjoshi
e6a3295fba MDL-77148 core: Fix to export params for templates in correct format
When questions are filtered by tags in the question bank, the qtagids
params are passed in the array format. Though moodle_url handles this,
single_button::export_for_template cannot. Hence changes done in
weblib.php to provide params for export_for_template in the
suitable format.
Thanks Huong. I have added the Behat test you provided in the patch.
2023-04-06 13:22:01 +01:00
Eloy Lafuente (stronk7)
3faf1c1989 MDL-77714 general: Remove mentions to Travis CI in a few places
Not critical to have, but better don't mention it. Note that all
the cases need to stay because there may be other environments
where the same problems are reproducible.

Only exception is the CURL_SSLVERSION_TLSv1_2 constant, that
can be safely removed because it's available since PHP 5.5.19.
2023-03-22 19:17:14 +01:00
Andrew Nicols
5d3cb79f30 MDL-76362 core: Short circuit s() on empty values 2023-01-23 09:15:55 +08:00
Andrew Nicols
19bedb8eba MDL-76362 core: Short-circuit strip_querystring on empty values 2023-01-23 09:15:55 +08:00
Marina Glancy
b0a83aa7bd MDL-76362 various: Avoid passing nulls to functions that don't allow nulls
PHP 8.1 is more strict on the parameter type. Functions such as trim(), strlen(), str_replace(), etc
show notice when null is passed as an argument
2023-01-23 09:15:54 +08:00
Stephan Robotta
4a31dd69d6 MDL-32114 form: markdown must be preserved on saving post
- Markdown is saved to the DB, no conversion to HTML to keep
  ability to reedit the content without beaking it.
- Blockquote element is styled that it's distingishable from
  normal text.
2023-01-05 18:34:44 +01:00
Matteo Scaramuccia
71883c2add MDL-72461 core: Required JS files in $PAGE served by the Moodle handler 2022-12-09 13:47:19 +01:00
Jun Pataleta
5935cd22c1 Merge branch 'MDL-76559-master' of https://github.com/andrewnicols/moodle 2022-12-07 22:41:20 +08:00
Andrew Nicols
7ce68020b8 MDL-76559 core: validate_email does not take false either 2022-12-07 21:40:18 +08:00
Jun Pataleta
5bc72f5176 Merge branch 'MDL-76559-master' of https://github.com/andrewnicols/moodle 2022-12-06 23:19:53 +08:00
Andrew Nicols
f375cac31a MDL-76559 core: validate_email should not accept empty values 2022-12-06 20:53:30 +08:00
Andrew Nicols
8ddbc7b055 Merge branch 'MDL-76493-master' of https://github.com/marinaglancy/moodle 2022-12-02 12:15:20 +08:00
Marina Glancy
a800e7e62f MDL-74853 various: add second parameter to htmlentities functions
Default value of the $flag argument changed in PHP 8.1 from ENT_COMPAT to ENT_QUOTES | ENT_SUBSTITUTE
To ensure consistent behavior across different PHP version the second parameter is now required for the functions:
htmlspecialchars(), htmlentities(), htmlspecialchars_decode(), html_entity_decode() and get_html_translation_table()
2022-11-28 16:12:20 +01:00
Marina Glancy
e5f862d0b1 MDL-76493 core: make sure format_string(null) works on PHP 8.1 2022-11-26 14:02:32 +01:00
Jun Pataleta
03f298a71c MDL-72882 core: Use default site lang when user lang no longer available
* Check that the lang attribute for the output HTML exists. If not,
use the default site language.
* Also fix the current language for the user.
2022-11-03 13:27:11 +08:00
Jun Pataleta
d4ba0359cf MDL-72885 core: Use get_html_lang_attribute_value()
Use get_html_lang_attribute_value() for formatting language codes
for the HTML lang attribute.
2022-05-27 19:38:54 +08:00