Fix PHP notice in Jetpack_PostImages::from_attachment method#418
Conversation
Add a logic to cope with images in posts with protocol independent and root relative urls
|
Originally mentioned on this thread: http://wordpress.org/support/topic/notice-undefined-index-scheme-in-classjetpack-post-imagesphp?replies=8 |
There was a problem hiding this comment.
We probably shouldn't use the constant here, it would likely be better to use something derived from either site_url() or home_url() -- as this will cause issues if WordPress is installed in a subdirectory, you'll need to strip off any path component to them. Or potentially just pull from the $_SERVER superglobal to find out the host?
|
@rowatt Have you had the chance to review George's comments above? |
|
Sorry - I missed the comments originally. I'm afraid I'm not in a position to work on this now, sorry. |
|
There were just a couple minor changes needed, so I went ahead and took care of them for you, @rowatt -- it'll be in 3.4! |
|
That's great - thank you! |
Add logic to cope with images in posts with protocol independent and root relative urls. The URLs returned are always absolute, using WP_HOME if the image src in the post was a root relative URL. This method is used by the Jetpack OpenGraph functions, and the og:image property should be absolute (apparently... though the documentation does not seem to explicitly state this).