Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
Helper class used to decode links back to their original form. More...
Public Member Functions | |
__construct (string $linkname, string $urltemplate, $mappings, bool $urlencoded=false) | |
Constructor. | |
decode ($content) | |
set_restoreid ($restoreid) | |
set_wwwroots ($sourcewwwroot, $targetwwwroot) | |
Protected Member Functions | |
apply_modifications ($toreplace, $mappingsok) | |
Apply other modifications, based in the result of $mappingsok before placeholder replacements. | |
get_calculated_regexp () | |
based on rule definition, build the regular expression to execute on decode | |
get_mapping ($itemname, $itemid) | |
Looks for mapping values in backup_ids table, simple wrapper over get_backup_ids_record. | |
validate_params ($linkname, $urltemplate, $mappings) | |
Perform all the validations and checks on the rule attributes. | |
Protected Attributes | |
$cregexp | |
$linkname | |
$mappings | |
$restoreid | |
$sourcewwwroot | |
$targetwwwroot | |
bool bool | $urlencoded |
$urlencoded Whether to use urlencode() on the final URL. | |
$urltemplate | |
Helper class used to decode links back to their original form.
This class allows each restore task to specify the changes that will be applied to any encoded (by backup) link to revert it back to its original form, recoding any parameter as needed.
TODO: Complete phpdocs
restore_decode_rule::__construct | ( | string | $linkname, |
string | $urltemplate, | ||
$mappings, | |||
bool | $urlencoded = false ) |
Constructor.
string | $linkname | How the link has been encoded in backup (CHOICEVIEWBYID, COURSEVIEWBYID...) |
string | $urltemplate | How the original URL looks like, with dollar placeholders |
array | string | $mappings | Which backup_ids mappings do we need to apply for replacing the placeholders |
bool | $urlencoded | Whether to use urlencode() on the final URL (defaults to false) |
|
protected |
Apply other modifications, based in the result of $mappingsok before placeholder replacements.
Right now, simply prefix with the proper wwwroot (source/target)