PrivateBin\PrivateBin::_jsonld PHP Метод

_jsonld() приватный Метод

outputs requested JSON-LD context
private _jsonld ( string $type ) : void
$type string
Результат void
    private function _jsonld($type)
    {
        if ($type !== 'paste' && $type !== 'comment' && $type !== 'pastemeta' && $type !== 'commentmeta') {
            $type = '';
        }
        $content = '{}';
        $file = PUBLIC_PATH . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . $type . '.jsonld';
        if (is_readable($file)) {
            $content = str_replace('?jsonld=', $this->_urlBase . '?jsonld=', file_get_contents($file));
        }
        header('Content-type: application/ld+json');
        header('Access-Control-Allow-Origin: *');
        header('Access-Control-Allow-Methods: GET');
        echo $content;
    }