MediaWiki
REL1_39
MwUrlModule.php
Go to the documentation of this file.
1
<?php
21
namespace
MediaWiki\ResourceLoader
;
22
27
class
MwUrlModule
{
33
public
static
function
makeJsFromExtendedRegExp
(
string
$content
): string {
34
// Remove whitespace.
35
$content
= preg_replace(
'/\s+/'
,
''
,
$content
);
36
// Remove named capturing groups.
37
// This allows long regexes to be self-documenting, which we allow for
38
// developer convenience, but this syntax is invalid JavaScript ES5.
39
$content
= preg_replace(
'/\?<\w+?>/'
,
''
,
$content
);
40
// Format as a valid JavaScript import.
41
return
'module.exports = /'
. strtr(
$content
, [
'/'
=>
'\/'
] ) .
'/;'
;
42
}
43
}
44
46
class_alias( MwUrlModule::class,
'ResourceLoaderMwUrlModule'
);
MediaWiki\ResourceLoader\MwUrlModule
Definition
MwUrlModule.php:27
MediaWiki\ResourceLoader\MwUrlModule\makeJsFromExtendedRegExp
static makeJsFromExtendedRegExp(string $content)
Definition
MwUrlModule.php:33
MediaWiki\ResourceLoader
Definition
CircularDependencyError.php:21
$content
$content
Definition
router.php:76
includes
ResourceLoader
MwUrlModule.php
Generated on Fri Dec 20 2024 15:35:04 for MediaWiki by
1.10.0