Kartographer
Extensionthataddsmapstowikipages
Kartographer\SimpleStyleParser Class Reference

Parses and sanitizes text properties of GeoJSON/simplestyle by putting them through parser. More...

+ Inheritance diagram for Kartographer\SimpleStyleParser:

Public Member Functions

 __construct (Parser $parser, PPFrame $frame=null, array $options=[])
 Constructor. More...
 
 parse ( $input)
 Parses string into JSON and performs validation/sanitization. More...
 
 parseObject (&$data)
 Validate and sanitize a parsed GeoJSON data object. More...
 
 normalizeAndSanitize (&$data)
 Normalize an object. More...
 

Static Public Member Functions

static doCountersRecursive (array &$values, &$counters)
 

Protected Member Functions

 validateContent ( $json)
 
 sanitize (&$json)
 Performs recursive sanitizaton. More...
 
 normalize (array &$json)
 Normalizes JSON. More...
 

Detailed Description

Parses and sanitizes text properties of GeoJSON/simplestyle by putting them through parser.

Constructor & Destructor Documentation

◆ __construct()

Kartographer\SimpleStyleParser::__construct ( Parser  $parser,
PPFrame  $frame = null,
array  $options = [] 
)

Constructor.

Parameters
Parser$parserParser used for wikitext processing
PPFrame | null$frame
array$optionsSet ['saveUnparsed' => true] to back up the original values of title and descrition in _origtitle and _origdescription

Member Function Documentation

◆ doCountersRecursive()

static Kartographer\SimpleStyleParser::doCountersRecursive ( array &  $values,
$counters 
)
static
Parameters
stdClass[]&$values
stdClass&$counterscounter-name -> integer
Returns
bool|array [ marker, marker properties ]

◆ normalize()

Kartographer\SimpleStyleParser::normalize ( array &  $json)
protected

Normalizes JSON.

Parameters
array&$json
Returns
Status

Reimplemented in Kartographer\Tests\MockSimpleStyleParser.

◆ normalizeAndSanitize()

Kartographer\SimpleStyleParser::normalizeAndSanitize ( $data)

Normalize an object.

Parameters
stdClass[]&$data
Returns
Status

◆ parse()

Kartographer\SimpleStyleParser::parse (   $input)

Parses string into JSON and performs validation/sanitization.

Parameters
string | null$input
Returns
Status

◆ parseObject()

Kartographer\SimpleStyleParser::parseObject ( $data)

Validate and sanitize a parsed GeoJSON data object.

Parameters
array | object&$data
Returns
Status

◆ sanitize()

Kartographer\SimpleStyleParser::sanitize ( $json)
protected

Performs recursive sanitizaton.

Does not attempt to be smart, just recurses through everything that can be dangerous even if not a valid GeoJSON.

Parameters
object | array&$json

Reimplemented in Kartographer\Tests\MockSimpleStyleParser.

◆ validateContent()

Kartographer\SimpleStyleParser::validateContent (   $json)
protected
Parameters
mixed$json
Returns
Status

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