ChessBrowser
Extension to create interactive chess boards
Loading...
Searching...
No Matches
MediaWiki\Extension\ChessBrowser\ChessBrowser Class Reference

Static Public Member Functions

static newGame ( $input, array $args, Parser $parser, PPFrame $frame)
 
static newPosition (string $input, array $args, Parser $parser, PPFrame $frame)
 
static parseArguments (array $args)
 Return associative array with argument defaults.
 
static generatePieces ( $fen, $swap=false)
 Create array of mustache arguments for chess-piece.mustache from a given FEN string.
 
static getLocalizedLabels (bool $swap=false)
 Retrieve the interface text for the correct locale.
 
static getMoveSet ( $gameObject, $annotationObject)
 Create array of mustache arguments for move-span.mustache from a given array of ply tokens.
 
static getVariationSet ( $variation, $index)
 Create template parameters for move variation strings.
 
static getMetadata ( $tagPairs)
 Create array of mustache arguments for ChessBoard.mustache from a given associative array of tag pairs.
 
static createPiece ( $symbol, $rank, $file)
 Create an array of arguments for chess-piece.mustache for a single piece at a given location on the board.
 

Member Function Documentation

◆ createPiece()

static MediaWiki\Extension\ChessBrowser\ChessBrowser::createPiece ( $symbol,
$rank,
$file )
static

Create an array of arguments for chess-piece.mustache for a single piece at a given location on the board.

Since
0.2.0
Parameters
string$symbolThe FEN symbol for the piece
string | int$rankPreserves input type on output
string | int$filePreserves input type on output
Returns
array

◆ generatePieces()

static MediaWiki\Extension\ChessBrowser\ChessBrowser::generatePieces ( $fen,
$swap = false )
static

Create array of mustache arguments for chess-piece.mustache from a given FEN string.

Since
0.2.0
Parameters
string$fen
bool$swapDisplay from black's perspective if true
Returns
array

◆ getLocalizedLabels()

static MediaWiki\Extension\ChessBrowser\ChessBrowser::getLocalizedLabels ( bool $swap = false)
static

Retrieve the interface text for the correct locale.

Since
0.2.0
Parameters
bool$swap
Returns
array

◆ getMetadata()

static MediaWiki\Extension\ChessBrowser\ChessBrowser::getMetadata ( $tagPairs)
static

Create array of mustache arguments for ChessBoard.mustache from a given associative array of tag pairs.

Since
0.2.0
Parameters
array$tagPairs
Returns
array

◆ getMoveSet()

static MediaWiki\Extension\ChessBrowser\ChessBrowser::getMoveSet ( $gameObject,
$annotationObject )
static

Create array of mustache arguments for move-span.mustache from a given array of ply tokens.

Since
0.2.0
Parameters
array$gameObjectGame representation loaded into data-chess and output from ChessParser::createOutputJson
array$annotationObjectrepresentation loaded into data-chess-annotations
Returns
array

◆ getVariationSet()

static MediaWiki\Extension\ChessBrowser\ChessBrowser::getVariationSet ( $variation,
$index )
static

Create template parameters for move variation strings.

Parameters
array$variationObject listing tokens, boards, and plys for the variation moves.
int$indexThe ply of the parent move
Returns
array

◆ newGame()

static MediaWiki\Extension\ChessBrowser\ChessBrowser::newGame ( $input,
array $args,
Parser $parser,
PPFrame $frame )
static
Since
0.1.0
Parameters
string$inputThe wikitext placed between pgn tags
array$argsArguments passed as xml attributes
Parser$parserThe MediaWiki parser object
PPFrame$frameParent frame, provides context of the tage placement
Returns
array

◆ newPosition()

static MediaWiki\Extension\ChessBrowser\ChessBrowser::newPosition ( string $input,
array $args,
Parser $parser,
PPFrame $frame )
static
Since
0.3.0
Parameters
string$inputThe wikitext placed between fen tags
array$argsArguments passed as xml attributes
Parser$parserThe MediaWiki parser object
PPFrame$frameParent frame, provides context of the tage placement
Returns
array

◆ parseArguments()

static MediaWiki\Extension\ChessBrowser\ChessBrowser::parseArguments ( array $args)
static

Return associative array with argument defaults.

Parameters
array$argsArguments passed as xml attributes through MediaWiki parser
Returns
array

The documentation for this class was generated from the following file: