Back to Joomla project (class list)

Class Microdata - list of methods

Joomla Platform class for interacting with Microdata semantics.
Package: Joomla\CMS\Microdata
Copyright: (C) 2013 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/Microdata/Microdata.php
Project: Joomla

Method Summary

public
(mixed $type = '', mixed $flag = true)

Initialize the class and setup the default $Type
Parameters
  • string $type Optional, fallback to 'Thing' Type
  • bool $flag Enable or disable the library output
Since
  • 3.2
Show source code of this method: __construct Source Code

protected static void
()

Load all available Types and Properties from the http://schema.org vocabulary contained in the types.json file
Returns
  • void
Since
  • 3.2
Show source code of this method: loadTypes Source Code

protected void
()

Reset all params
Returns
  • void
Since
  • 3.2
Show source code of this method: resetParams Source Code

public \Joomla\CMS\Microdata\Microdata
(mixed $flag = true)

Enable or Disable the library output
Parameters
  • bool $flag Enable or disable the library output
Returns
  • \Joomla\CMS\Microdata\Microdata Instance of $this
Since
  • 3.2
Show source code of this method: enable Source Code

public bool
()

Return 'true' if the library output is enabled
Returns
  • bool
Since
  • 3.2
Show source code of this method: isEnabled Source Code

public \Joomla\CMS\Microdata\Microdata
(mixed $type)

Set a new http://schema.org Type
Parameters
  • string $type The $Type to be setup
Returns
  • \Joomla\CMS\Microdata\Microdata Instance of $this
Since
  • 3.2
Show source code of this method: setType Source Code

public string
()

Return the current $Type name
Returns
  • string
Since
  • 3.2
Show source code of this method: getType Source Code

public \Joomla\CMS\Microdata\Microdata
(mixed $property)

Setup a $Property
Parameters
  • string $property The Property
Returns
  • \Joomla\CMS\Microdata\Microdata Instance of $this
Since
  • 3.2
Show source code of this method: property Source Code

public string
()

Return the current $Property name
Returns
  • string
Since
  • 3.2
Show source code of this method: getProperty Source Code

public \Joomla\CMS\Microdata\Microdata
(mixed $content, mixed $machineContent = null)

Setup a Human content or content for the Machines
Parameters
  • string $content The human content or machine content to be used
  • string $machineContent The machine content
Returns
  • \Joomla\CMS\Microdata\Microdata Instance of $this
Since
  • 3.2
Show source code of this method: content Source Code

public string
()

Return the current $content
Returns
  • string
Since
  • 3.2
Show source code of this method: getContent Source Code

public string
()

Return the current $machineContent
Returns
  • string
Since
  • 3.3
Show source code of this method: getMachineContent Source Code

public \Joomla\CMS\Microdata\Microdata
(mixed $type, mixed $property)

Setup a Fallback Type and Property
Parameters
  • string $type The Fallback Type
  • string $property The Fallback Property
Returns
  • \Joomla\CMS\Microdata\Microdata Instance of $this
Since
  • 3.2
Show source code of this method: fallback Source Code

public string
()

Return the current $fallbackType
Returns
  • string
Since
  • 3.2
Show source code of this method: getFallbackType Source Code

public string
()

Return the current $fallbackProperty
Returns
  • string
Since
  • 3.2
Show source code of this method: getFallbackProperty Source Code

public string
(mixed $displayType = '', mixed $emptyOutput = false)

This function handles the display logic.
Parameters
  • string $displayType Optional, 'inline', available options ['inline'|'span'|'div'|meta]
  • bool $emptyOutput Return an empty string if the library output is disabled and there is a $content value
Returns
  • string
Since
  • 3.2
Show source code of this method: display Source Code

public string
()

Return the HTML of the current Scope
Returns
  • string
Since
  • 3.2
Show source code of this method: displayScope Source Code

public static string
(mixed $type)

Return the sanitized $Type
Parameters
  • string $type The Type to sanitize
Returns
  • string
Since
  • 3.2
Show source code of this method: sanitizeType Source Code

public static string
(mixed $property)

Return the sanitized $Property
Parameters
  • string $property The Property to sanitize
Returns
  • string
Since
  • 3.2
Show source code of this method: sanitizeProperty Source Code

public static array
()

Return an array with all available Types and Properties from the http://schema.org vocabulary
Returns
  • array
Since
  • 3.2
Show source code of this method: getTypes Source Code

public static array
()

Return an array with all available Types from the http://schema.org vocabulary
Returns
  • array
Since
  • 3.2
Show source code of this method: getAvailableTypes Source Code

public static array
(mixed $type, mixed $property)

Return the expected Types of the given Property
Parameters
  • string $type The Type to process
  • string $property The Property to process
Returns
  • array
Since
  • 3.2
Show source code of this method: getExpectedTypes Source Code

protected static string
(mixed $type, mixed $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">`
Parameters
  • string $type The Type where to find the Property
  • string $property The Property to process
Returns
  • string
Since
  • 3.2
Show source code of this method: getExpectedDisplayType Source Code

public static bool
(mixed $type, mixed $property)

Recursive function, control if the given Type has the given Property
Parameters
  • string $type The Type where to check
  • string $property The Property to check
Returns
  • bool
Since
  • 3.2
Show source code of this method: isPropertyInType Source Code

public static bool
(mixed $type)

Control if the given Type class is available
Parameters
  • string $type The Type to check
Returns
  • bool
Since
  • 3.2
Show source code of this method: isTypeAvailable Source Code

public static string
(mixed $content, mixed $property, mixed $scope = '', mixed $invert = false)

Return Microdata semantics in a `<meta>` tag with content for machines.
Parameters
  • string $content The machine content to display
  • string $property The Property
  • string $scope Optional, the Type scope to display
  • bool $invert Optional, default = false, invert the $scope with the $property
Returns
  • string
Since
  • 3.2
Show source code of this method: htmlMeta Source Code

public static string
(mixed $content, mixed $property = '', mixed $scope = '', mixed $invert = false)

Return Microdata semantics in a `<span>` tag.
Parameters
  • string $content The human content
  • string $property Optional, the human content to display
  • string $scope Optional, the Type scope to display
  • bool $invert Optional, default = false, invert the $scope with the $property
Returns
  • string
Since
  • 3.2
Show source code of this method: htmlSpan Source Code

public static string
(mixed $content, mixed $property = '', mixed $scope = '', mixed $invert = false)

Return Microdata semantics in a `<div>` tag.
Parameters
  • string $content The human content
  • string $property Optional, the human content to display
  • string $scope Optional, the Type scope to display
  • bool $invert Optional, default = false, invert the $scope with the $property
Returns
  • string
Since
  • 3.2
Show source code of this method: htmlDiv Source Code

public static string
(mixed $tag, mixed $content, mixed $property = '', mixed $scope = '', mixed $invert = false)

Return Microdata semantics in a specified tag.
Parameters
  • string $tag The HTML tag
  • string $content The human content
  • string $property Optional, the human content to display
  • string $scope Optional, the Type scope to display
  • bool $invert Optional, default = false, invert the $scope with the $property
Returns
  • string
Since
  • 3.3
Show source code of this method: htmlTag Source Code

public static string
(mixed $scope)

Return the HTML Scope
Parameters
  • string $scope The Scope to process
Returns
  • string
Since
  • 3.2
Show source code of this method: htmlScope Source Code

public static string
(mixed $property)

Return the HTML Property
Parameters
  • string $property The Property to process
Returns
  • string
Since
  • 3.2
Show source code of this method: htmlProperty Source Code

Properties Summary

protected static array
$types
Array with all available Types and Properties from the http://schema.org vocabulary
Since
  • 3.2
protected string
$type
The Type
Since
  • 3.2
protected string
$property
The Property
Since
  • 3.2
protected string
$content
The Human content
Since
  • 3.2
protected string
$machineContent
The Machine content
Since
  • 3.2
protected string
$fallbackType
The Fallback Type
Since
  • 3.2
protected string
$fallbackProperty
The Fallback Property
Since
  • 3.2
protected bool
$enabled
Used for checking if the library output is enabled or disabled
Since
  • 3.2

Tags Summary

Since
3.2