Make WordPress Core

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#18017 closed enhancement (fixed)

set_url_scheme() function

Reported by: jkudish's profile jkudish Owned by: jkudish's profile jkudish
Milestone: 3.4 Priority: normal
Severity: minor Version:
Component: General Keywords: has-patch needs-testing
Focuses: Cc:

Description

After seeing the idea suggested on ticket #14835 and discussing it in #18005, I thought I'd add in this function which filters a url to return the url with correct protocol (http/https).

Next step would be to implement the function throughout wherever there already is such filtering (or where there should be).

What do you think? Good minor addition to 3.2.x or 3.3?

Attachments (5)

18017.diff (639 bytes) - added by jkudish 13 years ago.
18017b.diff (1.1 KB) - added by jkudish 13 years ago.
18017-3.diff (1.1 KB) - added by jkudish 13 years ago.
as Nacin pointed out, I had a little tabbing issue in the diff, here's the update - also following a better naming convention (-# instead of -b)
18017.2.diff (1.4 KB) - added by ryan 12 years ago.
Refresh, add relative support
18017-ut.diff (2.6 KB) - added by ryan 12 years ago.
unit tests

Download all attachments as: .zip

Change History (18)

@jkudish
13 years ago

#1 @ryan
13 years ago

  • Milestone changed from Awaiting Review to Future Release

That's a good start. I think it should have an optional $scheme argument that is handled in the same manner as is done get_site_url(). That way you could pass http, https, admin, login, or login_post if you need to force a particular scheme or context. The default would check is_ssl().

#2 @jkudish
13 years ago

I'll take a look a bit later at get_site_url() and I can send in a new patch shortly.

Thanks!

Last edited 13 years ago by jkudish (previous) (diff)

@jkudish
13 years ago

#3 @jkudish
13 years ago

Here's the updated function with an apply_filters too

#4 @jkudish
13 years ago

How do we go about now adding this function when needed in other places within core?

@jkudish
13 years ago

as Nacin pointed out, I had a little tabbing issue in the diff, here's the update - also following a better naming convention (-# instead of -b)

#5 @jkudish
13 years ago

  • Keywords needs-testing added

#7 @marfarma
13 years ago

  • Cc pauli.price@… added

#9 @marfarma
13 years ago

Related: #19037

See wp-hacker's thread titled: "Fixing some SSL cases for 3.4" to follow the evolving discussion.

#10 @holizz
13 years ago

  • Cc tom@… added

@ryan
12 years ago

Refresh, add relative support

@ryan
12 years ago

unit tests

#11 @ryan
12 years ago

  • Milestone changed from Future Release to 3.4

#12 @ryan
12 years ago

  • Resolution set to fixed
  • Status changed from new to closed

In [20828]:

Introduce set_url_scheme(). Includes get_site_url() logic for determining when to use http vs. https. Use this to rerite urls to obey is_ssl(). Props jkudish. fixes #18017

Note: See TracTickets for help on using tickets.