author | Anthony Ly <anthonyly.com@gmail.com> |
Wed, 19 Dec 2012 17:46:52 -0800 | |
changeset 204 | 09a1c134465b |
parent 194 | 32102edaa81b |
permissions | -rw-r--r-- |
136 | 1 |
<?php |
2 |
/** |
|
3 |
* Disable error reporting |
|
4 |
* |
|
5 |
* Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging |
|
6 |
*/ |
|
7 |
error_reporting(0); |
|
8 |
||
9 |
$basepath = dirname(__FILE__); |
|
10 |
||
11 |
function get_file($path) { |
|
12 |
||
13 |
if ( function_exists('realpath') ) |
|
14 |
$path = realpath($path); |
|
15 |
||
16 |
if ( ! $path || ! @is_file($path) ) |
|
17 |
return false; |
|
18 |
||
19 |
return @file_get_contents($path); |
|
20 |
} |
|
21 |
||
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
22 |
$expires_offset = 31536000; // 1 year |
136 | 23 |
|
24 |
header('Content-Type: application/x-javascript; charset=UTF-8'); |
|
25 |
header('Vary: Accept-Encoding'); // Handle proxies |
|
26 |
header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT'); |
|
27 |
header("Cache-Control: public, max-age=$expires_offset"); |
|
28 |
||
29 |
if ( isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODING']) |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
30 |
&& false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) { |
136 | 31 |
|
32 |
header('Content-Encoding: gzip'); |
|
33 |
echo $file; |
|
34 |
} else { |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
35 |
echo get_file($basepath . '/tiny_mce.js'); |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
36 |
echo get_file($basepath . '/wp-tinymce-schema.js'); |
136 | 37 |
} |
38 |
exit; |