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(string type = '', bool flag = true) : mixed
| 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(string content, string 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
\Joomla\CMS\Microdata\MicrodataInstance of $this
display
This function handles the display logic.
display(string displayType = '', bool emptyOutput = false) : string
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() : string
| since |
3.2 |
|---|
Response
string
enable
Enable or Disable the library output
enable(bool flag = true) : \Joomla\CMS\Microdata\Microdata
| since |
3.2 |
|---|
Arguments
- flag
boolEnable or disable the library output
Response
\Joomla\CMS\Microdata\MicrodataInstance of $this
fallback
Setup a Fallback Type and Property
fallback(string type, string property) : \Joomla\CMS\Microdata\Microdata
| since |
3.2 |
|---|
Arguments
- type
stringThe Fallback Type- property
stringThe Fallback Property
Response
\Joomla\CMS\Microdata\MicrodataInstance of $this
getAvailableTypes
Return an array with all available Types from the http://schema.org vocabulary
getAvailableTypes() : array
| since |
3.2 |
|---|
Response
array
getContent
Return the current $content
getContent() : string
| 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(string type, string property) : string
| 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(string type, string property) : array
| since |
3.2 |
|---|
Arguments
- type
stringThe Type to process- property
stringThe Property to process
Response
array
getFallbackProperty
Return the current $fallbackProperty
getFallbackProperty() : string
| since |
3.2 |
|---|
Response
string
getFallbackType
Return the current $fallbackType
getFallbackType() : string
| since |
3.2 |
|---|
Response
string
getMachineContent
Return the current $machineContent
getMachineContent() : string
| since |
3.3 |
|---|
Response
string
getProperty
Return the current $Property name
getProperty() : string
| since |
3.2 |
|---|
Response
string
getType
Return the current $Type name
getType() : string
| since |
3.2 |
|---|
Response
string
getTypes
Return an array with all available Types and Properties from the http://schema.org vocabulary
getTypes() : array
| since |
3.2 |
|---|
Response
array
htmlDiv
Return Microdata semantics in a <div> tag.
htmlDiv(string content, string property = '', string scope = '', bool invert = false) : string
| 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(string content, string property, string scope = '', bool invert = false) : string
| 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(string property) : string
| since |
3.2 |
|---|
Arguments
- property
stringThe Property to process
Response
string
htmlScope
Return the HTML Scope
htmlScope(string scope) : string
| since |
3.2 |
|---|
Arguments
- scope
stringThe Scope to process
Response
string
htmlSpan
Return Microdata semantics in a <span> tag.
htmlSpan(string content, string property = '', string scope = '', bool invert = false) : string
| 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(string tag, string content, string property = '', string scope = '', bool invert = false) : string
| 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() : bool
| since |
3.2 |
|---|
Response
bool
isPropertyInType
Recursive function, control if the given Type has the given Property
isPropertyInType(string type, string property) : bool
| 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(string type) : bool
| 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() : void
| since |
3.2 |
|---|
property
Setup a $Property
property(string property) : \Joomla\CMS\Microdata\Microdata
| since |
3.2 |
|---|
Arguments
- property
stringThe Property
Response
\Joomla\CMS\Microdata\MicrodataInstance of $this
resetParams
Reset all params
resetParams() : void
| since |
3.2 |
|---|
sanitizeProperty
Return the sanitized $Property
sanitizeProperty(string property) : string
| since |
3.2 |
|---|
Arguments
- property
stringThe Property to sanitize
Response
string
sanitizeType
Return the sanitized $Type
sanitizeType(string type) : string
| since |
3.2 |
|---|
Arguments
- type
stringThe Type to sanitize
Response
string
setType
Set a new http://schema.org Type
setType(string type) : \Joomla\CMS\Microdata\Microdata
| since |
3.2 |
|---|
Arguments
- type
stringThe $Type to be setup
Response
\Joomla\CMS\Microdata\MicrodataInstance of $this
Properties
types
Array with all available Types and Properties from the http://schema.org vocabulary
| since |
3.2 |
|---|
Type(s)
array
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