public
|
#
__construct( string $type = '', boolean $flag = true )
Initialize the class and setup the default $Type
Initialize the class and setup the default $Type
Parameters
- $type
string - $type Optional, fallback to 'Thing' Type
- $flag
boolean - $flag Enable or disable the library output
Since
3.2
|
protected static
|
#
loadTypes( )
Load all available Types and Properties from the http://schema.org vocabulary contained in the
types.json file
Load all available Types and Properties from the http://schema.org vocabulary contained in the
types.json file
Since
3.2
|
protected
|
|
public
JMicrodata
|
#
enable( boolean $flag = true )
Enable or Disable the library output
Enable or Disable the library output
Parameters
- $flag
boolean - $flag Enable or disable the library output
Returns
Since
3.2
|
public
boolean
|
#
isEnabled( )
Return 'true' if the library output is enabled
Return 'true' if the library output is enabled
Returns
boolean
Since
3.2
|
public
JMicrodata
|
#
setType( string $type )
Set a new http://schema.org Type
Parameters
- $type
string - $type The $Type to be setup
Returns
Since
3.2
|
public
string
|
#
getType( )
Return the current $Type name
Return the current $Type name
Returns
string
Since
3.2
|
public
JMicrodata
|
#
property( string $property )
Setup a $Property
Parameters
- $property
string - $property The Property
Returns
Since
3.2
|
public
string
|
#
getProperty( )
Return the current $Property name
Return the current $Property name
Returns
string
Since
3.2
|
public
JMicrodata
|
#
content( string $content, string $machineContent = null )
Setup a Human content or content for the Machines
Setup a Human content or content for the Machines
Parameters
- $content
string - $content The human content or machine content to be used
- $machineContent
string - $machineContent The machine content
Returns
Since
3.2
|
public
string
|
#
getContent( )
Return the current $content
Return the current $content
Returns
string
Since
3.2
|
public
string
|
#
getMachineContent( )
Return the current $machineContent
Return the current $machineContent
Returns
string
Since
3.3
|
public
JMicrodata
|
#
fallback( string $type, string $property )
Setup a Fallback Type and Property
Setup a Fallback Type and Property
Parameters
- $type
string - $type The Fallback Type
- $property
string - $property The Fallback Property
Returns
Since
3.2
|
public
string
|
#
getFallbackType( )
Return the current $fallbackType
Return the current $fallbackType
Returns
string
Since
3.2
|
public
string
|
#
getFallbackProperty( )
Return the current $fallbackProperty
Return the current $fallbackProperty
Returns
string
Since
3.2
|
public
string
|
#
display( string $displayType = '', boolean $emptyOutput = false )
This function handles the display logic. 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.
This function handles the display logic. 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.
Parameters
- $displayType
string - $displayType Optional, 'inline', available options ['inline'|'span'|'div'|meta]
- $emptyOutput
boolean - $emptyOutput Return an empty string if the library output is disabled and there
is a $content value
Returns
string
Since
3.2
|
public
string
|
#
displayScope( )
Return the HTML of the current Scope
Return the HTML of the current Scope
Returns
string
Since
3.2
|
public static
string
|
#
sanitizeType( string $type )
Return the sanitized $Type
Return the sanitized $Type
Parameters
- $type
string - $type The Type to sanitize
Returns
string
Since
3.2
|
public static
string
|
#
sanitizeProperty( string $property )
Return the sanitized $Property
Return the sanitized $Property
Parameters
- $property
string - $property The Property to sanitize
Returns
string
Since
3.2
|
public static
array
|
#
getTypes( )
Return an array with all available Types and Properties from the http://schema.org vocabulary
Return an array with all available Types and Properties from the http://schema.org vocabulary
Returns
array
Since
3.2
|
public static
array
|
|
public static
array
|
#
getExpectedTypes( string $type, string $property )
Return the expected Types of the given Property
Return the expected Types of the given Property
Parameters
- $type
string - $type The Type to process
- $property
string - $property The Property to process
Returns
array
Since
3.2
|
protected static
string
|
#
getExpectedDisplayType( string $type, string $property )
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">
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">
Parameters
- $type
string - $type The Type where to find the Property
- $property
string - $property The Property to process
Returns
string
Since
3.2
|
public static
boolean
|
#
isPropertyInType( string $type, string $property )
Recursive function, control if the given Type has the given Property
Recursive function, control if the given Type has the given Property
Parameters
- $type
string - $type The Type where to check
- $property
string - $property The Property to check
Returns
boolean
Since
3.2
|
public static
boolean
|
#
isTypeAvailable( string $type )
Control if the given Type class is available
Control if the given Type class is available
Parameters
- $type
string - $type The Type to check
Returns
boolean
Since
3.2
|
public static
string
|
#
htmlMeta( string $content, string $property, string $scope = '', boolean $invert = false )
Return Microdata semantics in a <meta> tag with content
for machines.
Return Microdata semantics in a <meta> tag with content
for machines.
Parameters
- $content
string - $content The machine content to display
- $property
string - $property The Property
- $scope
string - $scope Optional, the Type scope to display
- $invert
boolean - $invert Optional, default = false, invert the $scope with the $property
Returns
string
Since
3.2
|
public static
string
|
#
htmlSpan( string $content, string $property = '', string $scope = '', boolean $invert = false )
Return Microdata semantics in a <span> tag.
Return Microdata semantics in a <span> tag.
Parameters
- $content
string - $content The human content
- $property
string - $property Optional, the human content to display
- $scope
string - $scope Optional, the Type scope to display
- $invert
boolean - $invert Optional, default = false, invert the $scope with the $property
Returns
string
Since
3.2
|
public static
string
|
#
htmlDiv( string $content, string $property = '', string $scope = '', boolean $invert = false )
Return Microdata semantics in a <div> tag.
Return Microdata semantics in a <div> tag.
Parameters
- $content
string - $content The human content
- $property
string - $property Optional, the human content to display
- $scope
string - $scope Optional, the Type scope to display
- $invert
boolean - $invert Optional, default = false, invert the $scope with the $property
Returns
string
Since
3.2
|
public static
string
|
#
htmlTag( string $tag, string $content, string $property = '', string $scope = '', boolean $invert = false )
Return Microdata semantics in a specified tag.
Return Microdata semantics in a specified tag.
Parameters
- $tag
string - $tag The HTML tag
- $content
string - $content The human content
- $property
string - $property Optional, the human content to display
- $scope
string - $scope Optional, the Type scope to display
- $invert
boolean - $invert Optional, default = false, invert the $scope with the $property
Returns
string
Since
3.3
|
public static
string
|
#
htmlScope( string $scope )
Return the HTML Scope
Parameters
- $scope
string - $scope The Scope to process
Returns
string
Since
3.2
|
public static
string
|
#
htmlProperty( string $property )
Return the HTML Property
Parameters
- $property
string - $property The Property to process
Returns
string
Since
3.2
|