Seravo / seravo-plugin

Enhances WordPress with Seravo specific features and integrations
https://seravo.com/
GNU General Public License v2.0
38 stars 16 forks source link

Deprecate relative-urls from wp-palvelu-plugin (Make sure relative links are absolute if exported out from site) #11

Closed ottok closed 4 years ago

ottok commented 9 years ago

E.g. in http://foxland.fi/feed/ the image src attributes have relative url. That will not work when in a feed reader for example. When exporting $post->contents out from the site (feed, email) relative links need to be made absolute.

Check that implementation here and in https-domain-alias is in line with each other.

onnimonni commented 9 years ago

Feed readers are already handled in: https://github.com/Seravo/wp-palvelu-plugin/blob/master/modules/relative-urls.php#L42-L44 this was done in commit: 66d6bd271a2513978398e2cb8d5a26140df89a49

ottok commented 9 years ago

Cool! I guess it is then just a question of getting this into production. As a pilot, can you install this for Foxland and check if it solves customers issues?

onnimonni commented 9 years ago

This solves feed reader but I'm not sure if it solves other issues like jetpack integration.

onnimonni commented 9 years ago

I think otherwise this is working fine but when using xmlrcp or json-api we should make all of the links absolute.

onnimonni commented 9 years ago

Only way to be absolutely sure about absolute urls would be to only use relative urls in database and then return them with regex in this hook:

<?php add_filter( 'the_content', 'filter_function_name' ) ?>

Otherwise we can only achieve something like 95% of possible use cases.

On the otherhand this seems like a big overkill. But then again WordPress still parses all of the content anyhow because that's how shortcodes work. I don't think regex src="/" and href="/" would make a big difference.

opinions @anttiviljami, @ottok?

ottok commented 8 years ago

Once everybody has https we should remove relativize_content_all and use absolute URLs as way too many WordPress plugins are incompatible with relative URLs (links in MailPoet, RSS feeds etc).

ottok commented 8 years ago

Override filter available: add_filter( 'wpp_use_relative_urls', '__return_false' ); // disable relative url's feature

The file modules/relative-urls.php should perhaps not be part of this plugin, but instead a part of HTTPS Domain Alias plugin: https://github.com/Seravo/wp-https-domain-alias/issues/18

ottok commented 8 years ago

HTTP Domain Alias is now officially deprecated from new installs. The relative-urls.php should be moved to the HTTPS Domain Alias as it originally was, since it is not needed elsewhere.

anttiviljami commented 8 years ago

I don't agree we should move to remove relative-urls just yet. Relative URLs is used on sites without https domain alias too for development purposes.

Since HTTPS Domain Alias is now deprecated, let's gradually phase it out and see if we run into any issues, and later get rid of relative urls so we can better monitor if either of them cause any issues with our customer's sites.

ottok commented 8 years ago

If URLs are made absolute again (to avoid all regressions non-standard relative urls introduce), then we should also update the line https://github.com/Seravo/wordpress/blob/master/htdocs/wp-config.php#L45 to be absolute and not relative.