Created
June 13, 2013 05:01
-
-
Save mjangda/5771347 to your computer and use it in GitHub Desktop.
Load ad-busters from the theme if the REQUEST_URI matches one of the whitelisted requests.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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