forked from laukstein/ajax-seo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanifest.appcache
61 lines (43 loc) · 1.72 KB
/
manifest.appcache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
// --------------------------------------------------
// Offline Web applications http://dev.w3.org/html5/spec/offline.html
// Cache Manifest Validator http://manifest-validator.com/
// --------------------------------------------------
// http://appcachefacts.info/peterlubbers-owc4/index.html#18
// http://html5-demos.appspot.com/static/html5storage/index.html#slide40
include 'content/config.php'; // Configuration
include 'content/connect.php'; // Connect to MySQL
header('Content-Type: text/cache-manifest; charset=utf-8');
echo 'CACHE MANIFEST';
// Recent version
// --------------------------------------------------
$directory = new RecursiveDirectoryIterator('.');
$iterator = new RecursiveIteratorIterator($directory);
$regex = new RegexIterator($iterator, '/.+\.(appcache|css|js|php|txt|xml)/');
$array = array();
foreach ($regex as $key) {
$array[] = $key -> getMTime();
}
$modfile = max($array);
$query = mysql_query("SELECT UNIX_TIMESTAMP(GREATEST(updated, created)) AS date FROM `" . table . "`");
while ($row = @mysql_fetch_array($query, MYSQL_ASSOC)) {
$moddate = $row['date'];
}
$modmax = max($modfile, $moddate);
echo "\n# Version $modmax\n";
// Explicitly cached entries
if (connection) {
$result = mysql_query('SELECT url FROM `' . table . '`');
if (mysql_num_rows($result)) {
while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)) {
$row[] = array('row' => array_map('htmlspecialchars', $row));
echo "\n$path{$row['url']}";
}
}
}
echo "\n{$assets}assets/$css";
echo "\n{$assets}assets/$js";
echo "\nhttp://code.jquery.com/jquery-1.8.3.min.js";
// Resources that requires user to be online
echo "\n\nNETWORK:\n//www.google-analytics.com/ga.js";
// FALLBACK: