Last active
May 19, 2017 15:51
-
-
Save Screenfeed/3a23348cd7162bdc8933 to your computer and use it in GitHub Desktop.
Some people think they can add external resources as they please in your site.
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 | |
/* !---------------------------------------------------------------------------- */ | |
/* ! ULTIMATE MAINTENANCE MODE */ | |
/* ----------------------------------------------------------------------------- */ | |
/** | |
* Make it local or die: | |
* Remove the image ad from the settings page (the link stays in place). | |
*/ | |
add_action( 'settings_page_seedprod_maintenance_mode', 'sf_ob_start', 9 ); | |
if ( ! function_exists( 'sf_ob_start' ) ): | |
/** | |
* Start `ob_`. | |
* | |
* @author Grégory Viguier | |
*/ | |
function sf_ob_start() { | |
ob_start(); | |
} | |
endif; | |
add_action( 'settings_page_seedprod_maintenance_mode', 'sf_remove_seedprod_external_ad', 11 ); | |
/** | |
* Close `ob_` and remove the image. | |
* | |
* @author Grégory Viguier | |
*/ | |
function sf_remove_seedprod_external_ad() { | |
$contents = ob_get_contents(); | |
ob_clean(); | |
echo str_replace( 'http://static.seedprod.com/ads/coming-soon-pro-sidebar.png', 'data:image/gif;base6'. 4 . ',R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7', $contents ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment