X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderContext.php;h=d41198ae55380505067dc07aca1647d4992ed5ed;hb=28d17d2b10816e7f017dabde707f86761db04a05;hp=7478266e0cbbf46d0aeda863b868ee753eeb318e;hpb=0c2687f44eb0e8c7f480b7303f89056682ba0bfb;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoaderContext.php b/includes/resourceloader/ResourceLoaderContext.php index 7478266e0c..d41198ae55 100644 --- a/includes/resourceloader/ResourceLoaderContext.php +++ b/includes/resourceloader/ResourceLoaderContext.php @@ -63,12 +63,8 @@ class ResourceLoaderContext implements MessageLocalizer { $this->request = $request; $this->logger = $resourceLoader->getLogger(); - // Future developers: Avoid use of getVal() in this class, which performs - // expensive UTF normalisation by default. Use getRawVal() instead. - // Values here are either one of a finite number of internal IDs, - // or previously-stored user input (e.g. titles, user names) that were passed - // to this endpoint by ResourceLoader itself from the canonical value. - // Values do not come directly from user input and need not match. + // Future developers: Use WebRequest::getRawVal() instead getVal(). + // The getVal() method performs slow Language+UTF logic. (f303bb9360) // List of modules $modules = $request->getRawVal( 'modules' ); @@ -98,9 +94,12 @@ class ResourceLoaderContext implements MessageLocalizer { } /** - * Expand a string of the form jquery.foo,bar|jquery.ui.baz,quux to - * an array of module names like [ 'jquery.foo', 'jquery.bar', - * 'jquery.ui.baz', 'jquery.ui.quux' ] + * Expand a string of the form `jquery.foo,bar|jquery.ui.baz,quux` to + * an array of module names like `[ 'jquery.foo', 'jquery.bar', + * 'jquery.ui.baz', 'jquery.ui.quux' ]`. + * + * This process is reversed by ResourceLoader::makePackedModulesString(). + * * @param string $modules Packed module name list * @return array Array of module names */ @@ -342,6 +341,22 @@ class ResourceLoaderContext implements MessageLocalizer { return $this->imageObj; } + /** + * Return the replaced-content mapping callback + * + * When editing a page that's used to generate the scripts or styles of a + * ResourceLoaderWikiModule, a preview should use the to-be-saved version of + * the page rather than the current version in the database. A context + * supporting such previews should return a callback to return these + * mappings here. + * + * @since 1.32 + * @return callable|null Signature is `Content|null func( Title $t )` + */ + public function getContentOverrideCallback() { + return null; + } + /** * @return bool */