-
-
Notifications
You must be signed in to change notification settings - Fork 179
Conversation
* Switched from `$_SERVER['SERVER_NAME']` to `WP_SITEURL` * Fixed `Undefined Index` warning in `wp-cli export` * Fixed bug where ports aren't correctly matched * Added handling of scheme-less urls * Simplified logic * Improved readability by spreading long conditional across several lines
This was supposed to be a small refactor, but I found a bit more than just rearranging the conditional and making an exception for wp-cli. Was there a specific reason to pull Running with that, @aaronhuisinga basically gave us a perfect solution in #91 with That also fixes the problem with Switching to Scheme matching also now handles the unlikely case of a scheme-less local url. Whenever #93 is merged, I have a handful of unit tests ready to go as well. |
This is pro: your conditionals are so much better than that awful if statement lol |
This is great. What are people's though on aligning the conditionals? I think it makes it easier to follow. $hosts_match = $site_url['host'] === $url['host'];
$schemes_match = $site_url['scheme'] === $url['scheme'];
$ports_exist = isset($site_url['port']) && isset($url['port']);
$ports_match = ($ports_exist) ? $site_url['port'] === $url['port'] : true; |
No problem, I forgot "hacker spacing" is a project preference. 😉 Gonna go look for a Sublime Text package to do that for me |
I favour not aligning things these days. Just makes it harder to maintain in the long run and things break down with longer variable names. |
@swalkinshaw that's my preference as well. So can we just leave it? |
@joemaller it's only hacker spacing if I do it |
meh on alignment. i agree it looks better. i agree it's not necessary. |
We should keep it consistent throughout the project... and wouldn't that discussion be better on an issue if it's not consistent? |
Good point @kalenjohnson - looks like we're using "hacker spacing" here, but that's it. Personally, I prefer it, but that doesn't matter. It's more of what we're doing now. If we don't want to do it, there should make a separate PR IMO. Would take 10 seconds. |
http://en.m.wikipedia.org/wiki/Bikeshedding This PR looks fine to me. |
👍 Looks like everyone agrees spacing is non-issue. I can't merge from my phone (app I'm using doesn't have that option), so I'll let someone else handle that. |
$_SERVER['SERVER_NAME']
toWP_SITEURL
Undefined Index
warning inwp-cli export