Changeset 12554
- Timestamp:
- 04/21/2023 09:40:40 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/class-plugin.php
r12436 r12554 46 46 add_filter( 'pre_handle_404', array( $this, 'short_circuit_handle_404' ) ); 47 47 add_action( 'init', array( $this, 'bump_assets_versions' ), 20 ); 48 add_action( 'init', array( $this, 'add_cors_header' ) ); 48 49 add_action( 'after_setup_theme', array( $this, 'after_setup_theme' ) ); 49 50 add_filter( 'body_class', array( $this, 'wporg_add_make_site_body_class' ) ); … … 464 465 WP_CLI::add_command( 'wporg-translate show-stats', __NAMESPACE__ . '\CLI\Stats_Print' ); 465 466 467 } 468 469 /** 470 * Allow the Playground to access translate.wordpress.org. 471 */ 472 public static function add_cors_header() { 473 if ( headers_sent() ) { 474 return; 475 } 476 if ( isset( $_SERVER['HTTP_ORIGIN'] ) ) { 477 switch ( $_SERVER['HTTP_ORIGIN'] ) { 478 case 'https://playground.wordpress.net': 479 header( 'Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN'] ); 480 } 481 } 482 header( 'Vary: origin' ); 466 483 } 467 484
Note: See TracChangeset
for help on using the changeset viewer.