\JkphlMicrometa

Micrometa main parser class

Summary

Methods
Properties
Constants
__construct()
focus()
parse()
items()
item()
rels()
alternates()
externalAuthor()
toObject()
toJSON()
instance()
$dom
$baseUrl
$xpath
No constants found
_getUrl()
$_url
$_source
$_focus
$_parsed
$_result
N/A
No private methods found
No private properties found
N/A

Properties

$dom

$dom : \DOMDocument

Resource document DOM

Type

\DOMDocument

$baseUrl

$baseUrl : \Jkphl\Utility\Url

Resource document base URL

Type

\Jkphl\Utility\Url

$xpath

$xpath : \DOMXPath

XPath operator

Type

\DOMXPath

$_source

$_source : \string

Resource document source code

Type

\string

$_focus

$_focus : \DOMElement

Focus node

Type

\DOMElement

$_parsed

$_parsed : \boolean

Document has been parsed

Type

\boolean

$_result

$_result : \stdClass

Extracted micro information

Type

\stdClass

Methods

__construct()

__construct(\string $url, \string $source) : \Jkphl\Micrometa

Constructor

Parameters

\string $url

Resource document URL

\string $source

Resource document source code

Returns

\Jkphl\Micrometa

Micrometa parser object

focus()

focus(\DOMElement $element) : \DOMElement

Restrict the parsing of Microformats2 markup to a specific element node of the resource document DOM (and it's descendants)

Parameters

\DOMElement $element

Focus element node (must be a descendant of the resource document DOM)

Returns

\DOMElement —

Focus element

parse()

parse() : \Jkphl\Micrometa

Parse the document for embedded micro information (all supported formats)

Returns

\Jkphl\Micrometa

Micrometa parser object

items()

items() : \array

Return a list of top level micro information items

Returns

\array —

Micro information item list

item()

item() : \Jkphl\Micrometa\Item

Return the first micro information item (of a specific type)

Returns

\Jkphl\Micrometa\Item

First micro information item of the resulting list

rels()

rels() : \array

Return all related resources

Returns

\array —

Related resources

alternates()

alternates() : \array

Return all alternative resources

Returns

\array —

Alternative resources

externalAuthor()

externalAuthor() : NULL|\Jkphl\Micrometa\Item

Load and extract an external author definition

Returns

NULL|\Jkphl\Micrometa\Item

Author micro information item

toObject()

toObject() : \stdClass

Return an object representation of the embedded micro information

Returns

\stdClass —

Object representation

toJSON()

toJSON(\boolean $beautify) : \string

Return a JSON representation of the embedded micro information

Parameters

\boolean $beautify

Beautify the JSON output (available since PHP 5.4)

Returns

\string —

JSON representation

instance()

instance(\string $url, \string $source) : \Jkphl\Micrometa

Instance constructor

Parameters

\string $url

Resource document URL

\string $source

Resource document source code

Returns

\Jkphl\Micrometa

Micrometa parser object

_getUrl()

_getUrl(\string $url) : \string

Request an URL via GET (HTTP 1.1)

Parameters

\string $url

Remote URL

Returns

\string —

Response content