Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Load ad-busters from the theme if the REQUEST_URI matches one of the whitelisted requests.
<?php
add_action( 'init', 'x_maybe_load_ad_busters' );
function x_maybe_load_ad_busters() {
$ad_busters = array(
'/adcentric/ifr_b.html',
'/atlas/atlas_rm.htm',
'/doubleclick/DARTIframe.html',
'/eyereturn/eyereturn.html',
'/flashtalking/ftlocal.html',
'/pointroll/PointRollAds.htm',
'/unicast/unicastIFD.html',
);
$request = $_SERVER['REQUEST_URI'];
$request_path = parse_url( $request, PHP_URL_PATH );
$index = array_search( $request_path, $ad_busters );
if ( false === $index )
return;
$output = '';
$file = locate_template( array( 'static/iframe-busters' . $ad_busters[ $index ] ) );
if ( $file )
$output = file_get_contents( $file );
echo $output;
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.