MediaWiki  1.28.0
SVGReader Class Reference

Public Member Functions

 __construct ($source)
 Constructor. More...
 
 getMetadata ()
 

Static Public Member Functions

static scaleSVGUnit ($length, $viewportSize=512)
 Return a rounded pixel equivalent for a labeled CSS/SVG length. More...
 

Public Attributes

const DEFAULT_HEIGHT = 512
 
const DEFAULT_WIDTH = 512
 
const LANG_FULL_MATCH = 2
 
const LANG_PREFIX_MATCH = 1
 
const NS_SVG = 'http://www.w3.org/2000/svg'
 

Protected Member Functions

 read ()
 Read the SVG. More...
 

Private Member Functions

 animateFilterAndLang ($name)
 Filter all children, looking for animated elements. More...
 
 debug ($data)
 
 handleSVGAttribs ()
 Parse the attributes of an SVG element. More...
 
 readField ($name, $metafield=null)
 Read a textelement from an element. More...
 
 readXml ($metafield=null)
 Read an XML snippet from an element. More...
 
 throwXmlError ($err)
 

Private Attributes

 $languagePrefixes = []
 
 $languages = []
 
bool $mDebug = false
 
array $metadata = []
 
null XMLReader $reader = null
 

Detailed Description

Definition at line 42 of file SVGMetadataExtractor.php.

Constructor & Destructor Documentation

SVGReader::__construct (   $source)

Constructor.

Creates an SVGReader drawing from the source provided

Parameters
string$sourceURI from which to read
Exceptions
MWException|Exception

Definition at line 67 of file SVGMetadataExtractor.php.

References $e, $source, $wgSVGMetadataCutoff, debug(), global, and read().

Member Function Documentation

SVGReader::animateFilterAndLang (   $name)
private

Filter all children, looking for animated elements.

Also get a list of languages that can be targeted.

Parameters
string$nameName of the element that we are reading from

Definition at line 247 of file SVGMetadataExtractor.php.

References $name, as, debug(), and Language\isWellFormedLanguageTag().

Referenced by read().

SVGReader::debug (   $data)
private
SVGReader::getMetadata ( )
Returns
array Array with the known metadata

Definition at line 128 of file SVGMetadataExtractor.php.

References $metadata.

SVGReader::handleSVGAttribs ( )
private

Parse the attributes of an SVG element.

The parser has to be in the start element of "<svg>"

Definition at line 327 of file SVGMetadataExtractor.php.

References scaleSVGUnit().

Referenced by read().

SVGReader::read ( )
protected

Read the SVG.

Exceptions
MWException
Returns
bool

Definition at line 137 of file SVGMetadataExtractor.php.

References $languagePrefixes, $tag, $type, animateFilterAndLang(), debug(), handleSVGAttribs(), readField(), and readXml().

Referenced by __construct().

SVGReader::readField (   $name,
  $metafield = null 
)
private

Read a textelement from an element.

Parameters
string$nameName of the element that we are reading from
string$metafieldField that we will fill with the result

Definition at line 200 of file SVGMetadataExtractor.php.

References $name, and debug().

Referenced by read().

SVGReader::readXml (   $metafield = null)
private

Read an XML snippet from an element.

Parameters
string$metafieldField that we will fill with the result
Exceptions
MWException

Definition at line 225 of file SVGMetadataExtractor.php.

References debug().

Referenced by read().

static SVGReader::scaleSVGUnit (   $length,
  $viewportSize = 512 
)
static

Return a rounded pixel equivalent for a labeled CSS/SVG length.

http://www.w3.org/TR/SVG11/coords.html#UnitIdentifiers

Parameters
string$lengthCSS/SVG length.
float | int$viewportSizeOptional scale for percentage units...
Returns
float Length in pixels

Definition at line 378 of file SVGMetadataExtractor.php.

References $matches.

Referenced by handleSVGAttribs().

SVGReader::throwXmlError (   $err)
private

Definition at line 311 of file SVGMetadataExtractor.php.

References debug(), and wfDebug().

Member Data Documentation

SVGReader::$languagePrefixes = []
private

Definition at line 58 of file SVGMetadataExtractor.php.

Referenced by read().

SVGReader::$languages = []
private

Definition at line 57 of file SVGMetadataExtractor.php.

bool SVGReader::$mDebug = false
private

Definition at line 53 of file SVGMetadataExtractor.php.

array SVGReader::$metadata = []
private

Definition at line 56 of file SVGMetadataExtractor.php.

Referenced by getMetadata().

null XMLReader SVGReader::$reader = null
private

Definition at line 50 of file SVGMetadataExtractor.php.

const SVGReader::DEFAULT_HEIGHT = 512

Definition at line 44 of file SVGMetadataExtractor.php.

const SVGReader::DEFAULT_WIDTH = 512

Definition at line 43 of file SVGMetadataExtractor.php.

const SVGReader::LANG_FULL_MATCH = 2
const SVGReader::LANG_PREFIX_MATCH = 1

Definition at line 46 of file SVGMetadataExtractor.php.

Referenced by SVGMetadataExtractorTest\provideSvgFiles().

const SVGReader::NS_SVG = 'http://www.w3.org/2000/svg'

Definition at line 45 of file SVGMetadataExtractor.php.


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