HEX
Server: nginx
System: Linux pool64-304-45.dca.atomicsites.net 5.10.0-31-amd64 #1 SMP Debian 5.10.221-1 (2024-07-14) x86_64
User: (0)
PHP: 8.4.18
Disabled: pcntl_fork
Upload Files
File: /wordpress/mu-plugins/debug-bar-loader.php
<?php

if ( ! defined( 'AT_PROXIED_REQUEST' ) || ! AT_PROXIED_REQUEST )
	return;

// Use negative priority to give debug-bar a chance
// to add plugins_loaded hooks that will be run 
add_action( 'plugins_loaded', 'atomic_load_debug_bar', -1 );
function atomic_load_debug_bar() {
	$should_load_debug_bar = apply_filters( 'atomic_enable_debug_bar', true );
	if ( ! $should_load_debug_bar ) {
		return;
	}
	
	add_filter( 'show_admin_bar', '__return_true', 1e9 );
	load_atomic_mu_plugin( 'debug-bar/debug-bar.php' );

	// We don't want upstream proxies (including our own) to cache these responses
	if( ! headers_sent() ) {
		nocache_headers();
	}
}

// Alert proxied visitors that they are proxied
add_action( 'wp_head', 'atomic_load_proxy_bar' );
add_action( 'admin_head', 'atomic_load_proxy_bar' );
function atomic_load_proxy_bar() {
	if ( ! defined( 'IFRAME_REQUEST' ) || ! IFRAME_REQUEST ) {
		add_action( 'wp_footer', 'atomic_proxy_bar', 100 );
		add_action( 'admin_footer', 'atomic_proxy_bar', 100 );
	}
}
function atomic_proxy_bar() {
	if ( isset( $_SERVER['ATOMIC_CLIENT_ID'] ) ) {
		$atomic_client_id = $_SERVER['ATOMIC_CLIENT_ID'];
	} else if ( defined( 'ATOMIC_CLIENT_ID' ) ) {
		$atomic_client_id = ATOMIC_CLIENT_ID;
	}

	if ( isset( $atomic_client_id ) ) {
		switch( $atomic_client_id ) {
			case '1': // WordPress.com on Atomic
				$message = 'PROXIED INTERNAL';
				break;
			case '2': // WordPress.com on Atomic
				$message = 'PROXIED V2';
				if ( defined( 'AT_SITE_SUSPENDED' ) && AT_SITE_SUSPENDED ) {
					$message .= ' (SUSPENDED ' . AT_SITE_SUSPENDED . ')';
				}
				break;
			case '3': // Pressable on Atomic
				$message = '(PROD)';
				if ( defined( 'AT_SITE_SUSPENDED' ) && AT_SITE_SUSPENDED ) {
					$message = '(SUSPENDED ' . AT_SITE_SUSPENDED . ')';
				} else if ( defined( 'AT_DEVELOPMENT_MODE' ) && 'on' == AT_DEVELOPMENT_MODE ) {
					$message = '(DEV)';
				}
				break;
			case '6': // Newspack on Atomic
				$message = 'PROXIED NEWSPACK';
				if ( defined( 'AT_SITE_SUSPENDED' ) && AT_SITE_SUSPENDED ) {
					$message = '(SUSPENDED ' . AT_SITE_SUSPENDED . ')';
				}
				break;
			case '8': // HappyP2 on Atomic
				$message = 'PROXIED HAPPYP2';
				if ( defined( 'AT_SITE_SUSPENDED' ) && AT_SITE_SUSPENDED ) {
					$message = '(SUSPENDED ' . AT_SITE_SUSPENDED . ')';
				}
				break;
			default :
				$message = 'PROXIED V2';
				break;
		}
	}
	?>
	<div id="atomic-proxy-bar"><?php echo $message ?></div>
	<style>
	#atomic-proxy-bar {
		background: #3858E9;
    	border-bottom-left-radius: 2px;
    	border-bottom-right-radius: 2px;
    	color: #fff;
    	font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;
    	font-size: 10px;
    	font-weight: bold;
    	height: 1.4em;
    	left: 50%;
    	letter-spacing: 0.2em;
    	line-height: 1.4em;
    	padding: 2px 8px;
    	position: fixed;
    	text-align: center;
    	text-shadow: none;
    	transform: translateX(-50%);
    	top: 0;
    	z-index: 100001;
	}
	</style>
	<?php
}