]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/index.php
Added minify plugin
[quix0rs-gnu-social.git] / plugins / Minify / extlib / minify / min_unit_tests / HTTP_ConditionalGet / index.php
1 <?php
2
3 set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../../min/lib'));
4 require 'HTTP/ConditionalGet.php';
5
6 // emulate regularly updating document
7 $every = 20;
8 $lastModified = round(time()/$every)*$every - $every;
9
10 $cg = new HTTP_ConditionalGet(array(
11     'lastModifiedTime' => $lastModified
12 ));
13 $cg->sendHeaders();
14 if ($cg->cacheIsValid) {
15     // we're done
16     exit();
17 }
18
19 $title = 'Last-Modified is known : simple usage';
20 $explain = '
21 <p>If your content has not changed since a certain timestamp, set this via the
22 the <code>lastModifiedTime</code> array key when instantiating HTTP_ConditionalGet.
23 You can immediately call the method <code>sendHeaders()</code> to set the
24 Last-Modified, ETag, and Cache-Control headers. The, if <code>cacheIsValid</code>
25 property is false, you echo the content.</p>
26 <p>This script emulates a document that changes every ' .$every. ' seconds.
27 <br>This is version: ' . date('r', $lastModified) . '</p>
28 ';
29
30 require '_include.php';
31
32 echo send_slowly(get_content(array(
33     'title' => $title
34     ,'explain' => $explain
35 )));
36 \r