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/SdFaq.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/faqpage
class SdFaq
{
    public static function get_output($data = array())
    {
        $json = array(
            "@context" => "https://schema.org",
            "@type" => "FAQPage",
        );

        $json["mainEntity"] = array();

        foreach ($data as $faq_item)
        {
            $item = array_values($faq_item);
            
            $json["mainEntity"][] = array(
                "@type" => "Question",
                "name" => $item[0],
                "acceptedAnswer" => array(
                    "@type" => "Answer",
                    "text" => $item[1],
                ),
            );
        }

        Sd::display_sd($json);
    }
}