diff --git a/manifest.php b/manifest.php index 446e74f..4ea70c4 100644 --- a/manifest.php +++ b/manifest.php @@ -4,15 +4,14 @@ * * The dynamic manifest file is constructed here */ - -/* Load WordPress */ -include_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' ); +$session = session_id(); +if ( empty( $session ) ) session_start(); header( 'Content-Type: text/cache-manifest' ); echo 'CACHE MANIFEST -# version ' . get_option( '_wp_appcache_manifest_timestamp' ) . ' v1 +# version ' . $_SESSION['wp_appcache_manifest_timestamp'] . ' v1 CACHE: diff --git a/wp-appcache.php b/wp-appcache.php index 3b50d53..4a39060 100644 --- a/wp-appcache.php +++ b/wp-appcache.php @@ -29,6 +29,11 @@ function wp_appcache_add_manifest() { if ( ! is_user_logged_in() ) { add_filter( 'language_attributes', 'wp_appcache_add_manifest_to_language_attributes' ); + // Set the timestamp as a session variable + $session = session_id(); + if ( empty( $session ) ) session_start(); + $_SESSION['wp_appcache_manifest_timestamp'] = get_option( '_wp_appcache_manifest_timestamp' ); + function wp_appcache_add_manifest_to_language_attributes( $output ) { return $output . ' manifest="' . plugins_url( 'manifest.php', __FILE__ ) . '"'; }