add readme to phar file
[phancap.git] / www / index.php
1 <?php
2 namespace phancap;
3 /**
4  * Check if everything is setup
5  */
6 header('HTTP/1.0 500 Internal Server Error');
7
8 if (file_exists(__DIR__ . '/../src/phancap/Autoloader.php')) {
9     include_once __DIR__ . '/../src/phancap/Autoloader.php';
10     Autoloader::register();
11 } else {
12     include_once 'phancap/Autoloader.php';
13 }
14 header('HTTP/1.0 200 OK');
15 ?>
16 <?xml version="1.0" encoding="utf-8"?>
17 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
18 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
19  <head>
20   <title>phancap</title>
21
22   <link rel="stylesheet" href="css/bootstrap.min.css"/>
23   <link rel="stylesheet" href="css/bootstrap-theme.min.css"/>
24   <link rel="stylesheet" href="css/phancap.css"/>
25   <meta name="viewport" content="width=device-width, initial-scale=1"/>
26  </head>
27  <body>
28   <div class="container">
29    <div class="row">
30     <div class="col-md-2"></div>
31     <div class="col-md-8">
32
33      <div class="page-header">
34       <h1>phancap</h1>
35      </div>
36
37      <div class="row">
38       <div class="col-md-6">
39        <p>
40         Web service to create website screenshots.
41        </p>
42
43       </div>
44       <div class="col-md-6">
45
46        <div class="panel panel-default">
47         <div class="panel-heading">Create screenshot</div>
48         <div class="panel-body">
49          <form method="get" action="./get.php" class="form-inline" role="form">
50           <div class="form-group">
51            <label for="url">URL:</label>
52            <input type="text" name="url" id="url" size="30" class="form-control"
53                   placeholder="http://example.org/" />
54           </div>
55           <button type="submit" class="btn btn-default">Go</button>
56          </form>
57         </div>
58        </div>
59
60       </div>
61      </div>
62
63
64      <h2 id="tools">Tools</h2>
65      <ul class="list-group">
66       <li class="list-group-item">
67        <a href="setup.php">Setup check</a> to test if everything is ok
68       </li>
69       <li class="list-group-item">
70        <a href="README.html">README</a>
71       </li>
72      </ul>
73
74
75      <h2 id="api">API</h2>
76      <p>
77       The API is accessible at <a href="get.php">get.php</a>.
78      </p>
79
80      <div class="panel panel-default">
81       <div class="panel-heading" style="text-align: center">Available URL parameters</div>
82       <table class="table table-striped table-bordered table-condensed">
83        <thead>
84         <tr>
85          <th>Name</th>
86          <th>Description</th>
87          <th>Type</th>
88          <th>Default</th>
89         </tr>
90        </thead>
91        <tbody>
92 <?php
93 $options = new Options();
94 $config = new Config();
95 try {
96     $config->load();
97     $options->setConfig($config);
98 } catch (\Exception $e) {}
99
100 foreach ($options->options as $name => $option) {
101     echo '<tr>'
102         . '<td><tt>' . $name . '</tt></td>'
103         . '<td>' . htmlspecialchars($option['title']) . '</td>'
104         . '<td>'
105         . (
106             is_array($option['type'])
107             ? ('One of: <tt>' . implode('</tt>, <tt>', $option['type']) . '</tt>')
108             : str_replace('skip', '&#160;', $option['type'])
109         )
110         . '</td>'
111         . '<td>&#160;<tt>' . $option['default'] . '</tt></td>'
112         . '</tr>';
113 }
114 ?>
115        </tbody>
116       </table>
117      </div>
118      <p>
119       Ages can be given as ISO 8601 duration specification, for example:
120      </p>
121      <dl class="dl-horizontal">
122       <dt><tt>P1Y</tt></dt><dd>1 year</dd>
123       <dt><tt>P2W</tt></dt><dd>2 weeks</dd>
124       <dt><tt>P1D</tt></dt><dd>1 day</dd>
125       <dt><tt>PT4H</tt></dt><dd>4 hours</dd>
126      </dl>
127
128     </div>
129    </div>
130   </div>
131  </body>
132 </html>