phpjs
Version:
102 lines (75 loc) • 3.44 kB
HTML
<!-- Generated by Rakefile:build -->
<strong>
<a href="http://brett-zamir.me" rel="nofollow">Brett Zamir</a>
</strong>
on 2012-06-16 07:50:50 <br />
@Patrick: Thanks for the feedback! Most of the credit goes to Steven Levithan: http://blog.stevenlevithan.com
<hr />
<strong>
<a href="http://www.netzaffin.de" rel="nofollow">Patrick</a>
</strong>
on 2012-05-11 14:29:17 <br />
Hey guys! parse url saved my day. That easy, that great. I will include phpjs in my projects <3 thank you
<hr />
<strong>
<a href="http://an3m1.com/" rel="nofollow">????? ???</a>
</strong>
on 2012-03-22 13:50:56 <br />
New and exclusive news on the gate Yes
<hr />
<strong>
<a href="http://brett-zamir.me" rel="nofollow">Brett Zamir</a>
</strong>
on 2011-03-27 13:46:34 <br />
@Aaron. Can you provide more details? I tried on Apache, and it works fine. Or did you mean you tried in SSJS? What regex and sample are you using? One thing you can try is replacing the various "()" marks used in the php mode regex with the equivalent but longer, "(.{0})". Maybe Firefox4's new regex parser doesn't properly handle "()" under some conditions. If that doesn't work, let me know if changing by default to "strict" or "loose" mode instead of "php" (see the code on line 25 with "|| 'php'").
<hr />
<strong>
<a href="ajgwin.com" rel="nofollow">Aaron</a>
</strong>
on 2011-03-25 22:30:19 <br />
I've been using this script for two years. I just switched to FF4 and it now fails. Error: "regular expression too complex" fails here in firebug "var m = parser[mode].exec(str)," only on a web server. Works fine locally.
<hr />
<strong>
<a href="http://brett-zamir.me" rel="nofollow">Brett Zamir</a>
</strong>
on 2011-03-12 01:09:31 <br />
@Tony & @Lorenzo Pisani: Also, I should mention, the fix is available in Git (raw js source URL).
<hr />
<strong>
<a href="http://brett-zamir.me" rel="nofollow">Brett Zamir</a>
</strong>
on 2011-03-12 01:08:11 <br />
@radekk: Can you clarify?
@Tony & @Lorenzo Pisani: Finally getting to this. The issue was simply that the loose mode had been chosen by default. This should probably work more like PHP now, and I also cleaned up the function a bit and allowed custom ini settings to change the parsing mode (e.g., "loose" mode (set by "phpjs.parse_url.mode") is more useful when trying to guess at a user's imperfect input, but faulty as you found out; "strict" follows the same as the default "php" mode, but offers more properties, including parsing the query string further).
<hr />
<strong>
Tony
</strong>
on 2011-03-11 13:37:52 <br />
This fails with a simple code like this :
var url = "page.html"
it shows that host is page.html
<hr />
<strong>
radekk
</strong>
on 2010-10-19 09:15:34 <br />
You didn't mentioned that it's doesn't work correctly when you use variables like (in GET):
- scheme
- host
- user
- path
... and so on.
I think that parameters should be separated and enclosed in an second object to not collide with each other. That's my opinion.
<hr />
<strong>
Lorenzo Pisani
</strong>
on 2010-03-30 17:07:35 <br />
this fails on some urls
in PHP I can do this:
<pre><code>
parse_url('hello/world', PHP_URL_PATH) // gives me back hello/world
</code></pre>
but I simply get /world back from php.js because it thinks hello is the host
<hr />