Microdata

Joomla Platform class for interacting with Microdata semantics.

since

3.2

package

Joomla CMS

Methods

__construct

Initialize the class and setup the default $Type

__construct( type = '',  flag = true) : 
since

3.2

Arguments

type

stringOptional, fallback to 'Thing' Type

flag

boolEnable or disable the library output

Response

mixed

content

Setup a Human content or content for the Machines

content( content,  machineContent = null) : \Joomla\CMS\Microdata\Microdata
since

3.2

Arguments

content

stringThe human content or machine content to be used

machineContent

stringThe machine content

Response

MicrodataInstance of $this

display

This function handles the display logic.

display( displayType = '',  emptyOutput = false) : 

It checks if the Type, Property are available, if not check for a Fallback, then reset all params for the next use and return the HTML.

since

3.2

Arguments

displayType

stringOptional, 'inline', available options ['inline'|'span'|'div'|meta]

emptyOutput

boolReturn an empty string if the library output is disabled and there is a $content value

Response

string

displayScope

Return the HTML of the current Scope

displayScope() : 
since

3.2

Response

string

enable

Enable or Disable the library output

enable( flag = true) : \Joomla\CMS\Microdata\Microdata
since

3.2

Arguments

flag

boolEnable or disable the library output

Response

MicrodataInstance of $this

fallback

Setup a Fallback Type and Property

fallback( type,  property) : \Joomla\CMS\Microdata\Microdata
since

3.2

Arguments

type

stringThe Fallback Type

property

stringThe Fallback Property

Response

MicrodataInstance of $this

getAvailableTypes

Return an array with all available Types from the http://schema.org vocabulary

getAvailableTypes() : mixed||string|int
static
since

3.2

Response

array<string|int, mixed>

getContent

Return the current $content

getContent() : 
since

3.2

Response

string

getExpectedDisplayType

Return the expected display type: [normal|nested|meta] In which way to display the Property: normal -> itemprop="name" nested -> itemprop="director" itemscope itemtype="https://schema.org/Person" meta -> <meta itemprop="datePublished" content="1991-05-01">

getExpectedDisplayType( type,  property) : 
static
since

3.2

Arguments

type

stringThe Type where to find the Property

property

stringThe Property to process

Response

string

getExpectedTypes

Return the expected Types of the given Property

getExpectedTypes( type,  property) : mixed||string|int
static
since

3.2

Arguments

type

stringThe Type to process

property

stringThe Property to process

Response

array<string|int, mixed>

getFallbackProperty

Return the current $fallbackProperty

getFallbackProperty() : 
since

3.2

Response

string

getFallbackType

Return the current $fallbackType

getFallbackType() : 
since

3.2

Response

string

getMachineContent

Return the current $machineContent

getMachineContent() : 
since

3.3

Response

string

getProperty

Return the current $Property name

getProperty() : 
since

3.2

Response

string

getType

Return the current $Type name

getType() : 
since

3.2

Response

string

getTypes

Return an array with all available Types and Properties from the http://schema.org vocabulary

getTypes() : mixed||string|int
static
since

3.2

Response

array<string|int, mixed>

htmlDiv

Return Microdata semantics in a <div> tag.

htmlDiv( content,  property = '',  scope = '',  invert = false) : 
static
since

3.2

Arguments

content

stringThe human content

property

stringOptional, the human content to display

scope

stringOptional, the Type scope to display

invert

boolOptional, default = false, invert the $scope with the $property

Response

string

htmlMeta

Return Microdata semantics in a <meta> tag with content for machines.

htmlMeta( content,  property,  scope = '',  invert = false) : 
static
since

3.2

Arguments

content

stringThe machine content to display

property

stringThe Property

scope

stringOptional, the Type scope to display

invert

boolOptional, default = false, invert the $scope with the $property

Response

string

htmlProperty

Return the HTML Property

htmlProperty( property) : 
static
since

3.2

Arguments

property

stringThe Property to process

Response

string

htmlScope

Return the HTML Scope

htmlScope( scope) : 
static
since

3.2

Arguments

scope

stringThe Scope to process

Response

string

htmlSpan

Return Microdata semantics in a <span> tag.

htmlSpan( content,  property = '',  scope = '',  invert = false) : 
static
since

3.2

Arguments

content

stringThe human content

property

stringOptional, the human content to display

scope

stringOptional, the Type scope to display

invert

boolOptional, default = false, invert the $scope with the $property

Response

string

htmlTag

Return Microdata semantics in a specified tag.

htmlTag( tag,  content,  property = '',  scope = '',  invert = false) : 
static
since

3.3

Arguments

tag

stringThe HTML tag

content

stringThe human content

property

stringOptional, the human content to display

scope

stringOptional, the Type scope to display

invert

boolOptional, default = false, invert the $scope with the $property

Response

string

isEnabled

Return 'true' if the library output is enabled

isEnabled() : 
since

3.2

Response

bool

isPropertyInType

Recursive function, control if the given Type has the given Property

isPropertyInType( type,  property) : 
static
since

3.2

Arguments

type

stringThe Type where to check

property

stringThe Property to check

Response

bool

isTypeAvailable

Control if the given Type class is available

isTypeAvailable( type) : 
static
since

3.2

Arguments

type

stringThe Type to check

Response

bool

loadTypes

Load all available Types and Properties from the http://schema.org vocabulary contained in the types.json file

loadTypes() : 
static
since

3.2

Response

void

property

Setup a $Property

property( property) : \Joomla\CMS\Microdata\Microdata
since

3.2

Arguments

property

stringThe Property

Response

MicrodataInstance of $this

resetParams

Reset all params

resetParams() : 
since

3.2

Response

void

sanitizeProperty

Return the sanitized $Property

sanitizeProperty( property) : 
static
since

3.2

Arguments

property

stringThe Property to sanitize

Response

string

sanitizeType

Return the sanitized $Type

sanitizeType( type) : 
static
since

3.2

Arguments

type

stringThe Type to sanitize

Response

string

setType

Set a new http://schema.org Type

setType( type) : \Joomla\CMS\Microdata\Microdata
since

3.2

Arguments

type

stringThe $Type to be setup

Response

MicrodataInstance of $this

Properties

types

Array with all available Types and Properties from the http://schema.org vocabulary

static
since

3.2

Type(s)

array<string|int, mixed>

type

The Type

since

3.2

Type(s)

string

property

The Property

since

3.2

Type(s)

string

content

The Human content

since

3.2

Type(s)

string

machineContent

The Machine content

since

3.2

Type(s)

string

fallbackType

The Fallback Type

since

3.2

Type(s)

string

fallbackProperty

The Fallback Property

since

3.2

Type(s)

string

enabled

Used for checking if the library output is enabled or disabled

since

3.2

Type(s)

bool