From c8ef7e92d627c9c96ba9b258d7a515654f4464ea Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 22 Aug 2006 17:31:53 +0000 Subject: [PATCH] cache_javascript_headers() from masquerade. fixes #3059 #2799 git-svn-id: http://svn.automattic.com/wordpress/trunk@4109 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/cat-js.php | 2 +- wp-admin/dbx-admin-key-js.php | 2 +- wp-admin/list-manipulation-js.php | 2 +- wp-includes/functions.php | 7 +++++++ wp-includes/js/autosave.js.php | 8 +------- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/wp-admin/cat-js.php b/wp-admin/cat-js.php index 08393b7d1b..c286168c72 100644 --- a/wp-admin/cat-js.php +++ b/wp-admin/cat-js.php @@ -1,6 +1,6 @@ addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.topAdder=1;catList.alt=0;catList.showLink=0;}); addLoadEvent(newCatAddIn); diff --git a/wp-admin/dbx-admin-key-js.php b/wp-admin/dbx-admin-key-js.php index bca04cec80..f47e53b90a 100644 --- a/wp-admin/dbx-admin-key-js.php +++ b/wp-admin/dbx-admin-key-js.php @@ -1,6 +1,6 @@ addLoadEvent(function(){theList=new listMan();}); diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 544427fca3..050f3469ad 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -737,6 +737,13 @@ function nocache_headers() { @ header('Pragma: no-cache'); } +function cache_javascript_headers() { + $expiresOffset = 864000; // 10 days + header("Content-type: text/javascript; charset=" . get_bloginfo('charset')); + header("Vary: Accept-Encoding"); // Handle proxies + header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT"); +} + function get_num_queries() { global $wpdb; return $wpdb->num_queries; diff --git a/wp-includes/js/autosave.js.php b/wp-includes/js/autosave.js.php index 811ec6c79f..4db6ff9ead 100644 --- a/wp-includes/js/autosave.js.php +++ b/wp-includes/js/autosave.js.php @@ -1,11 +1,5 @@ var autosaveLast = ''; function autosave_timer() {