Microdata
Joomla Platform class for interacting with Microdata semantics.
since |
3.2 |
---|
Methods
__construct
Initialize the class and setup the default $Type
__construct(string $type = '', boolean $flag = true)
since |
3.2 |
---|
Arguments
- $type
string
Optional, fallback to 'Thing' Type- $flag
boolean
Enable or disable the library output
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
string
The human content or machine content to be used- $machineContent
string
The machine content
Response
\Joomla\CMS\Microdata\Microdata
Instance of $this
display
This function handles the display logic.
display(string $displayType = '', boolean $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
string
Optional, 'inline', available options ['inline'|'span'|'div'|meta]- $emptyOutput
boolean
Return 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(boolean $flag = true) : \Joomla\CMS\Microdata\Microdata
since |
3.2 |
---|
Arguments
- $flag
boolean
Enable or disable the library output
Response
\Joomla\CMS\Microdata\Microdata
Instance of $this
fallback
Setup a Fallback Type and Property
fallback(string $type, string $property) : \Joomla\CMS\Microdata\Microdata
since |
3.2 |
---|
Arguments
- $type
string
The Fallback Type- $property
string
The Fallback Property
Response
\Joomla\CMS\Microdata\Microdata
Instance 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
string
The Type where to find the Property- $property
string
The 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
string
The Type to process- $property
string
The 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 = '', boolean $invert = false) : string
since |
3.2 |
---|
Arguments
- $content
string
The human content- $property
string
Optional, the human content to display- $scope
string
Optional, the Type scope to display- $invert
boolean
Optional, 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 = '', boolean $invert = false) : string
since |
3.2 |
---|
Arguments
- $content
string
The machine content to display- $property
string
The Property- $scope
string
Optional, the Type scope to display- $invert
boolean
Optional, default = false, invert the $scope with the $property
Response
string
htmlProperty
Return the HTML Property
htmlProperty(string $property) : string
since |
3.2 |
---|
Arguments
- $property
string
The Property to process
Response
string
htmlScope
Return the HTML Scope
htmlScope(string $scope) : string
since |
3.2 |
---|
Arguments
- $scope
string
The Scope to process
Response
string
htmlSpan
Return Microdata semantics in a <span>
tag.
htmlSpan(string $content, string $property = '', string $scope = '', boolean $invert = false) : string
since |
3.2 |
---|
Arguments
- $content
string
The human content- $property
string
Optional, the human content to display- $scope
string
Optional, the Type scope to display- $invert
boolean
Optional, 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 = '', boolean $invert = false) : string
since |
3.3 |
---|
Arguments
- $tag
string
The HTML tag- $content
string
The human content- $property
string
Optional, the human content to display- $scope
string
Optional, the Type scope to display- $invert
boolean
Optional, default = false, invert the $scope with the $property
Response
string
isEnabled
Return 'true' if the library output is enabled
isEnabled() : boolean
since |
3.2 |
---|
Response
boolean
isPropertyInType
Recursive function, control if the given Type has the given Property
isPropertyInType(string $type, string $property) : boolean
since |
3.2 |
---|
Arguments
- $type
string
The Type where to check- $property
string
The Property to check
Response
boolean
isTypeAvailable
Control if the given Type class is available
isTypeAvailable(string $type) : boolean
since |
3.2 |
---|
Arguments
- $type
string
The Type to check
Response
boolean
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
string
The Property
Response
\Joomla\CMS\Microdata\Microdata
Instance 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
string
The Property to sanitize
Response
string
sanitizeType
Return the sanitized $Type
sanitizeType(string $type) : string
since |
3.2 |
---|
Arguments
- $type
string
The 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
string
The $Type to be setup
Response
\Joomla\CMS\Microdata\Microdata
Instance 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)
boolean