PageRenderTime 17ms CodeModel.GetById 15ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Web/wp-includes/js/tinymce/wp-tinymce.php

https://bitbucket.org/jimjenkins5/blog
PHP | 37 lines | 23 code | 9 blank | 5 comment | 10 complexity | cb5d42d344a636470233d306c7bbb958 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, AGPL-1.0, LGPL-2.1
 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 */
 7error_reporting(0);
 8
 9$basepath = dirname(__FILE__);
10
11function 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
22$expires_offset = 31536000;
23
24header('Content-Type: application/x-javascript; charset=UTF-8');
25header('Vary: Accept-Encoding'); // Handle proxies
26header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
27header("Cache-Control: public, max-age=$expires_offset");
28
29if ( isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
30	&& false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {
31
32	header('Content-Encoding: gzip');
33	echo $file;
34} else {
35	echo get_file($basepath . '/tiny_mce.js');
36}
37exit;