Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- sb_root_relative_urls.php
- +++ sb_root_relative_urls.php
- @@ -116,6 +116,9 @@
- //This method is used for urls that can be acceptably reformatted into root-relative urls without causing issues
- //related to other deficiencies in the wp core.
- + if (MP_WP_Root_Relative_URLS::check_blacklist($url, 'http'))
- + return $url;
- +
- if (self::$massage) {
- //massage back to absolute because we're rendering a feed and the platform mixes url procurment methods between the delivery methods
- //despite offering _rss specific filters
- @@ -180,6 +183,22 @@
- return $o;
- }
- + static function check_blacklist($url, $str_prefix = false) {
- + $emc2_blacklist_urls = get_option('emc2_blacklist_urls');
- + if ($emc2_blacklist_urls != '') {
- + $emc2_blacklist_urls = explode("\n", $emc2_blacklist_urls);
- +
- + foreach ($emc2_blacklist_urls as &$blacklist_url) {
- + if ($str_prefix && substr($blacklist_url, 0, strlen($str_prefix)) !== $str_prefix)
- + continue;
- +
- + if (stripos($url, trim($blacklist_url)) !== false)
- + return true;
- + }
- + }
- + return false;
- + }
- +
- static function init() {
- add_action('admin_init', array( 'MP_WP_Root_Relative_URLS', 'admin_settings_init' ));
- @@ -187,7 +206,7 @@
- //Here we check the url blacklist to disable proper root relative urls, this helps with certain 3rd party
- //plugins / certain clients for rss feeds
- $cur_url = MP_WP_Root_Relative_URLS::dynamic_absolute_url(@$_SERVER['REQUEST_URI']);
- - if (stripos(get_option('emc2_blacklist_urls'), $cur_url) !== false) {
- + if (MP_WP_Root_Relative_URLS::check_blacklist($cur_url, '/')) {
- //for blacklists, create a dynamic but full absolute url instead
- self::$massage = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment