Your IP : 216.73.216.240


Current Path : /home/juvelize/saulnois/tmp/install_695d2cf0b4957/src/View/Sd/
Upload File :
Current File : /home/juvelize/saulnois/tmp/install_695d2cf0b4957/src/View/Sd/SdDataset.php

<?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\Uri\Uri;

// https://developers.google.com/search/docs/appearance/structured-data/dataset
class SdDataset
{
    public static function get_output($data = array())
    {
        $uri = Uri::getInstance();

        $description = $data['description'] ?? $data['introtext'];
        
        $json = array(
            "@context" => "https://schema.org",
            "@type" => "Dataset",
            "name" => $data['title'] ?? $data['name'],
            "description" => strip_tags($description),
        );

        // The summary must be between 50 and 5000 characters long.

        $json["isAccessibleForFree"] = isset($data['free']) && !$data['free'] ? false : true;

        Sd::display_sd($json);
    }
}