Your IP : 216.73.216.240
<?php
/*
* @package Tech Fry Library
* @license https://www.gnu.org/licenses/gpl-3.0.en.html
*/
namespace TechFry\Library\View\Sd;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
// https://developers.google.com/search/docs/appearance/structured-data/book
class SdBook
{
public static function get_output($data = array())
{
$uri = Uri::getInstance();
$json = array(
"@context" => "https://schema.org",
"@type" => "DataFeed",
"dataFeedElement" => array(
"@context" => "https://schema.org",
"@type" => "Book",
"@id" => $uri->current(),
"url" => $uri->current(),
"name" => $data['name'] ?? $data['title'],
),
);
$config = Factory::getConfig();
$tz = $config->get('offset');
// Dates should be in ISO 8601 format: YYYY-MM-DDThh:mm:ss+05:30
if (isset($data['modified']) && $data['modified'])
{
$json['dateModified'] = Factory::getDate($data['modified'], $tz)->toISO8601(true);
}
Sd::display_sd($json);
}
}