예제 #1
0
<?php

use earley\storage\FileSystemStorage;
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once __DIR__ . '/php/autoloader.php';
// Create path variable to the root of this project
// If URL ends in a slash followed by one or more digits (e.g. http://domain.com/abcde/1), returns a cleaned version of the URL, e.g. http://domain.com/
$path = preg_replace("/\\w+\\/\\d+\\/?\$/", '', $_SERVER['REQUEST_URI']);
#todo: move to config file
$configurationBaseDirectory = __DIR__ . '/../earley-interface-data';
$conf = isset($_GET['conf']) ? $_GET['conf'] : '';
$version = isset($_GET['v']) ? $_GET['v'] : 1;
$storage = new FileSystemStorage($configurationBaseDirectory);
$config = $storage->getConfiguration($conf, $version);
$sentence = isset($config['sentence']) ? $config['sentence'] : 'i like the bananas';
?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="robots" content="noindex">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Earley interface + Early build</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
    <link href="<?php 
echo $path;
?>