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/SdMovie.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/movie
class SdMovie
{
    public static function get_output($data = array())
    {
        // Required: name, image
        
        $json = array(
            "@context" => "https://schema.org",
            "@type" => "Movie",
            "name" => $data['name'] ?? $data['title'],
            "dateCreated" => $data['dateCreated'],
        );

        $json["director"] = array(
	        "@type" => "Person",
            "name" => $data['director'],
	    );

        if (isset($data['image']) && $data['image'])
        {
            $json['image'] = Sd::add_image($data['image']);
        }

        // To Add: aggregateRating, review

        Sd::display_sd($json);
    }
}