/Web/wp-admin/gears-manifest.php

https://bitbucket.org/jimjenkins5/blog · PHP · 51 lines · 27 code · 9 blank · 15 comment · 2 complexity · 8df3142ba09cf18bb70141e431ef53d1 MD5 · raw file

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