Example #1
0
function getOutputType()
{
    $acceptTypes = AcceptHeader::getAcceptTypes();
    $outputTypes = array('turtle', 'html', 'json');
    if (!empty($_GET['_output']) and in_array($_GET['_output'], $outputTypes)) {
        return $_GET['_output'];
    }
    $acceptTypes = AcceptHeader::getAcceptTypes();
    foreach ($acceptTypes as $mimetype) {
        switch ($mimetype) {
            case 'text/html':
            case 'application/xhtml+xml':
            case '*/*':
            case '':
                return 'html';
            case 'application/json':
            case 'application/x-rdf+json':
                return 'json';
            case 'text/turtle':
            case 'text/plain':
                return 'turtle';
        }
    }
}
Example #2
0
                $title = 'Related: ' . local($_GET['_related']);
                $data = $store->get(null, null, $_GET['_related']);
                //$data = $store->related($_GET['_related']);
            } else {
                if (isset($_GET['_uri'])) {
                    $requestUri = $_GET['_uri'];
                } else {
                    $requestUri = (isset($Config->{$dataset}->urispace) ? $Config->{$dataset}->urispace : 'http://' . $_SERVER['SERVER_NAME']) . $_SERVER['REQUEST_URI'];
                }
                $data = $store->get($requestUri);
                if (empty($data)) {
                    header("HTTP/1.0 404 Not Found");
                }
                $page = 1;
            }
        }
    }
}
$facets = $store->getFacetsForLastQuery();
$acceptTypes = AcceptHeader::getAcceptTypes();
foreach ($acceptTypes as $mimetype) {
    switch ($mimetype) {
        case 'text/html':
        case '*/*':
            require 'template.html';
            exit;
        case 'application/json':
            echo json_encode($data);
            exit;
    }
}