public static string
htmlTag
(mixed $tag, mixed $content, mixed $property = '', mixed $scope = '', mixed $invert = false)
/**
* Return Microdata semantics in a specified tag.
*
* @param string $tag The HTML tag
* @param string $content The human content
* @param string $property Optional, the human content to display
* @param string $scope Optional, the Type scope to display
* @param boolean $invert Optional, default = false, invert the $scope with the $property
*
* @return string
*
* @since 3.3
*/
public static function htmlTag($tag, $content, $property = '', $scope = '', $invert = false)
{
// Control if the $Property has already the 'itemprop' prefix
if (!empty($property) && stripos($property, 'itemprop') !== 0) {
$property = static::htmlProperty($property);
}
// Control if the $Scope have already the 'itemscope' prefix
if (!empty($scope) && stripos($scope, 'itemscope') !== 0) {
$scope = static::htmlScope($scope);
}
// Depending on the case, the $scope must precede the $property, or otherwise
if ($invert) {
$tmp = implode(' ', array($property, $scope));
} else {
$tmp = implode(' ', array($scope, $property));
}
$tmp = trim($tmp);
$tmp = $tmp ? ' ' . $tmp : '';
// Control if it is an empty element without a closing tag
if ($tag === 'meta') {
return "<meta{$tmp} content='{$content}'>";
}
return '<' . $tag . $tmp . '>' . $content . '</' . $tag . '>';
}