author | Anthony Ly <anthonyly.com@gmail.com> |
Mon, 19 Nov 2012 18:26:13 +0100 | |
changeset 194 | 32102edaa81b |
parent 136 | bde1974c263b |
permissions | -rw-r--r-- |
136 | 1 |
<?php |
2 |
/** |
|
3 |
* Defines the Gears manifest file for Google Gears offline storage. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
||
9 |
/** |
|
10 |
* Disable error reporting |
|
11 |
* |
|
12 |
* Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging |
|
13 |
*/ |
|
14 |
error_reporting(0); |
|
15 |
||
16 |
/** Set ABSPATH for execution */ |
|
17 |
define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' ); |
|
18 |
||
19 |
require(ABSPATH . '/wp-admin/includes/manifest.php'); |
|
20 |
||
21 |
$files = get_manifest(); |
|
22 |
||
23 |
header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); |
|
24 |
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); |
|
25 |
header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); |
|
26 |
header( 'Pragma: no-cache' ); |
|
27 |
header( 'Content-Type: application/x-javascript; charset=UTF-8' ); |
|
28 |
?> |
|
29 |
{ |
|
30 |
"betaManifestVersion" : 1, |
|
31 |
"version" : "<?php echo $man_version; ?>", |
|
32 |
"entries" : [ |
|
33 |
<?php |
|
34 |
$entries = ''; |
|
35 |
||
36 |
foreach ( $files as $file ) { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
37 |
// Set ignoreQuery, defaulting to true |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
38 |
$ignore_query = ( isset($file[2]) && !$file[2] ) ? '' : ', "ignoreQuery" : true '; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
39 |
|
136 | 40 |
// If version is not set, just output the file |
41 |
if ( !isset($file[1]) ) |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
42 |
$entries .= '{ "url" : "' . $file[0] . '"' . $ignore_query . ' }' . "\n"; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
43 |
// Output url and src |
136 | 44 |
else |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
45 |
$entries .= '{ "url" : "' . $file[0] . '", "src" : "' . $file[0] . '?' . $file[1] . '"' . $ignore_query . ' },' . "\n"; |
136 | 46 |
} |
47 |
||
48 |
echo trim( trim($entries), ',' ); |
|
49 |
?> |
|
50 |
||
51 |
]} |