Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/tinymce/wp-tinymce.php

    r31029 r42343  
    55 * Set this to error_reporting( -1 ) for debugging.
    66 */
    7 error_reporting(0);
     7error_reporting( 0 );
    88
    9 $basepath = dirname(__FILE__);
     9$basepath = dirname( __FILE__ );
    1010
    11 function get_file($path) {
     11function get_file( $path ) {
    1212
    13     if ( function_exists('realpath') )
    14         $path = realpath($path);
     13    if ( function_exists( 'realpath' ) ) {
     14        $path = realpath( $path );
     15    }
    1516
    16     if ( ! $path || ! @is_file($path) )
     17    if ( ! $path || ! @is_file( $path ) ) {
    1718        return false;
     19    }
    1820
    19     return @file_get_contents($path);
     21    return @file_get_contents( $path );
    2022}
    2123
    2224$expires_offset = 31536000; // 1 year
    2325
    24 header('Content-Type: application/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");
     26header( 'Content-Type: application/javascript; charset=UTF-8' );
     27header( 'Vary: Accept-Encoding' ); // Handle proxies
     28header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expires_offset ) . ' GMT' );
     29header( "Cache-Control: public, max-age=$expires_offset" );
    2830
    29 if ( 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') ) ) {
     31if ( isset( $_GET['c'] ) && 1 == $_GET['c'] && isset( $_SERVER['HTTP_ACCEPT_ENCODING'] )
     32    && false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && ( $file = get_file( $basepath . '/wp-tinymce.js.gz' ) ) ) {
    3133
    32     header('Content-Encoding: gzip');
     34    header( 'Content-Encoding: gzip' );
    3335    echo $file;
    3436} else {
Note: See TracChangeset for help on using the changeset viewer.