Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7420865
Mode.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
Mode.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Wikimedia\Parsoid\Ext\Gallery
;
use
Wikimedia\Parsoid\DOM\DocumentFragment
;
use
Wikimedia\Parsoid\Ext\ParsoidExtensionAPI
;
abstract
class
Mode
{
/**
* The name of this mode.
* @var string
*/
protected
$mode
;
/**
* Construct a (singleton) mode.
* @param string $name The name of this mode, all lowercase.
*/
protected
function
__construct
(
string
$name
)
{
$this
->
mode
=
$name
;
}
public
function
getModules
():
array
{
return
[];
}
public
function
getModuleStyles
():
array
{
return
[];
}
/**
* Format the dimensions as a string.
*/
abstract
public
function
dimensions
(
Opts
$opts
):
string
;
/**
* Render HTML for the given lines in this mode.
* @param ParsoidExtensionAPI $extApi
* @param Opts $opts
* @param ?DocumentFragment $caption
* @param ParsedLine[] $lines
* @return DocumentFragment
*/
abstract
public
function
render
(
ParsoidExtensionAPI
$extApi
,
Opts
$opts
,
?
DocumentFragment
$caption
,
array
$lines
):
DocumentFragment
;
/**
* Return the Mode object with the given name,
* or null if the name is invalid.
* @param string $name
* @return Mode|null
*/
public
static
function
byName
(
string
$name
):
?
Mode
{
static
$modesByName
=
null
;
if
(
$modesByName
===
null
)
{
$modesByName
=
[
'traditional'
=>
new
TraditionalMode
(),
'nolines'
=>
new
NoLinesMode
(),
'slideshow'
=>
new
SlideshowMode
(),
'packed'
=>
new
PackedMode
(),
'packed-hover'
=>
new
PackedHoverMode
(),
'packed-overlay'
=>
new
PackedOverlayMode
()
];
}
return
$modesByName
[
$name
]
??
null
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 05:10 (1 d, 3 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
3a/96/f4fdb68d5d205f7974730ba5ae08
Default Alt Text
Mode.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment