File: //wordpress/mu-plugins/photon-subsizes-loader.php
<?php
function photon_subsizes_loader() {
$should_load = false;
if ( defined( 'PHOTON_SUBSIZES' ) ) {
// Enabled by user-defined constant
$should_load = !! PHOTON_SUBSIZES;
} else if ( '' !== AT_PHOTON_SUBSIZES ) {
// Respect platform setting but allow user to override in case it causes issues
$should_load = apply_filters( 'photon_subsizes_enable', !! AT_PHOTON_SUBSIZES );
} else {
// Default loading policy
$is_newspack = 6 == constant( 'ATOMIC_CLIENT_ID' );
$is_wpcom_and_should_load = (
'wp_uploads' !== constant( 'AT_PRIVACY_MODEL' ) &&
2 == constant( 'ATOMIC_CLIENT_ID' )
);
// Allow filtering default loading behavior so sites that
// urgently need to disable the feature can do so with ease
$should_load = apply_filters(
'photon_subsizes_enable',
$is_newspack || $is_wpcom_and_should_load
);
}
if ( $should_load ) {
require_once __DIR__ . '/photon-subsizes/photon-subsizes.php';
}
}
add_action( 'muplugins_loaded', 'photon_subsizes_loader' );