[ Index ]

PHP Cross Reference of WordPress 3.0 beta 1

[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/wp-admin/ -> load-scripts.php (source)

   1  <?php
   2  
   3  /**
   4   * Disable error reporting
   5   *
   6   * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging
   7   */
   8  error_reporting(0);
   9  
  10  /** Set ABSPATH for execution */
  11  define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' );
  12  define( 'WPINC', 'wp-includes' );
  13  
  14  /**
  15   * @ignore
  16   */
  17  function __() {}
  18  
  19  /**
  20   * @ignore
  21   */
  22  function _x() {}
  23  
  24  
  25  /**
  26   * @ignore
  27   */
  28  function add_filter() {}
  29  
  30  /**
  31   * @ignore
  32   */
  33  function esc_attr() {}
  34  
  35  /**
  36   * @ignore
  37   */
  38  function apply_filters() {}
  39  
  40  /**
  41   * @ignore
  42   */
  43  function get_option() {}
  44  
  45  /**
  46   * @ignore
  47   */
  48  function is_lighttpd_before_150() {}
  49  
  50  /**
  51   * @ignore
  52   */
  53  function add_action() {}
  54  
  55  /**
  56   * @ignore
  57   */
  58  function do_action_ref_array() {}
  59  
  60  /**
  61   * @ignore
  62   */
  63  function get_bloginfo() {}
  64  
  65  /**
  66   * @ignore
  67   */
  68  function is_admin() {return true;}
  69  
  70  /**
  71   * @ignore
  72   */
  73  function site_url() {}
  74  
  75  /**
  76   * @ignore
  77   */
  78  function admin_url() {}
  79  
  80  /**
  81   * @ignore
  82   */
  83  function wp_guess_url() {}
  84  
  85  function get_file($path) {
  86  
  87      if ( function_exists('realpath') )
  88          $path = realpath($path);
  89  
  90      if ( ! $path || ! @is_file($path) )
  91          return '';
  92  
  93      return @file_get_contents($path);
  94  }
  95  
  96  $load = preg_replace( '/[^a-z0-9,_-]+/i', '', $_GET['load'] );
  97  $load = explode(',', $load);
  98  
  99  if ( empty($load) )
 100      exit;
 101  
 102  require(ABSPATH . WPINC . '/script-loader.php');
 103  require(ABSPATH . WPINC . '/version.php');
 104  
 105  $compress = ( isset($_GET['c']) && $_GET['c'] );
 106  $force_gzip = ( $compress && 'gzip' == $_GET['c'] );
 107  $expires_offset = 31536000;
 108  $out = '';
 109  
 110  $wp_scripts = new WP_Scripts();
 111  wp_default_scripts($wp_scripts);
 112  
 113  foreach( $load as $handle ) {
 114      if ( !array_key_exists($handle, $wp_scripts->registered) )
 115          continue;
 116  
 117      $path = ABSPATH . $wp_scripts->registered[$handle]->src;
 118      $out .= get_file($path) . "\n";
 119  }
 120  
 121  header('Content-Type: application/x-javascript; charset=UTF-8');
 122  header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
 123  header("Cache-Control: public, max-age=$expires_offset");
 124  
 125  if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
 126      header('Vary: Accept-Encoding'); // Handle proxies
 127      if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
 128          header('Content-Encoding: deflate');
 129          $out = gzdeflate( $out, 3 );
 130      } elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) {
 131          header('Content-Encoding: gzip');
 132          $out = gzencode( $out, 3 );
 133      }
 134  }
 135  
 136  echo $out;
 137  exit;


Generated: Mon Apr 5 14:26:09 2010 Cross-referenced by PHPXref 0.7