MediaWiki
REL1_35
ResourceLoaderMwUrlModule.php
Go to the documentation of this file.
1
<?php
25
class
ResourceLoaderMwUrlModule
{
31
public
static
function
makeJsFromExtendedRegExp
(
string
$content
) : string {
32
// Remove whitespace.
33
$content
= preg_replace(
'/\s+/'
,
''
,
$content
);
34
// Remove named capturing groups.
35
// This allows long regexes to be self-documenting, which we allow for
36
// developer convenience, but this syntax is invalid JavaScript ES5.
37
$content
= preg_replace(
'/\?<\w+?>/'
,
''
,
$content
);
38
// Format as a valid JavaScript import.
39
return
'module.exports = /'
. strtr(
$content
, [
'/'
=>
'\/'
] ) .
'/;'
;
40
}
41
}
ResourceLoaderMwUrlModule
Definition
ResourceLoaderMwUrlModule.php:25
ResourceLoaderMwUrlModule\makeJsFromExtendedRegExp
static makeJsFromExtendedRegExp(string $content)
Definition
ResourceLoaderMwUrlModule.php:31
$content
$content
Definition
router.php:76
includes
resourceloader
ResourceLoaderMwUrlModule.php
Generated on Sat Apr 6 2024 00:07:42 for MediaWiki by
1.9.8