UNPKG

phpjs

Version:

php.js offers community built php functions in javascript

179 lines (131 loc) 3.96 kB
<!-- Generated by Rakefile:build --> <strong> <a href="http://www.boredgames.name/" rel="nofollow">Bored</a> </strong> on 2012-08-03 10:13:42 <br /> Nice share info.Thanks you..! <hr /> <strong> <a href="http://www.gamegazo.com/" rel="nofollow">Game gazo</a> </strong> on 2012-07-22 10:42:15 <br /> thanks for share this code <hr /> <strong> <a href="http://www.huz.name/" rel="nofollow">Huz</a> </strong> on 2012-07-20 03:01:46 <br /> thanks a lot, this code i was found. <hr /> <strong> <a href="http://www.frivteen.com/" rel="nofollow">Friv</a> </strong> on 2012-07-20 02:58:47 <br /> Thanks for share code <hr /> <strong> <a href="http://www.gazogames.in/" rel="nofollow">Gazo games</a> </strong> on 2012-07-19 05:02:13 <br /> JavaScript is very important in making situation it helps programmers create web pages to help users easily share .. thank you ...! <hr /> <strong> <a href="http://www.friv.name" rel="nofollow">Friv</a> </strong> on 2012-07-05 05:49:50 <br /> Thanks for sharing. I was found this coding. <hr /> <strong> <a href="http://kizi.5ire.com/" rel="nofollow">Kizi</a> </strong> on 2012-06-14 04:12:05 <br /> Thank your share info! <hr /> <strong> <a href="http://www.kizi.5ire.com/" rel="nofollow">cutegirl</a> </strong> on 2012-06-12 05:43:22 <br /> Nice share info &lt;a href=&quot;http://www.kizi.5ire.com/&gt;Kizi&lt;/a&gt; <hr /> <strong> <a href="http://www.friv4.us/" rel="nofollow">friv 4 school</a> </strong> on 2012-02-22 03:12:03 <br /> Nice share. Thanks a lots. <hr /> <strong> <a href="http://www.halospain.com" rel="nofollow">SoutlinK</a> </strong> on 2010-07-27 01:12:30 <br /> Ups I made a Mistake in fix <pre><code> if (r.indexOf('#') != -1) { r = r.substring(0,r.indexOf('#')); } </code></pre> <hr /> <strong> <a href="http://www.halospain.com" rel="nofollow">SoutlinK</a> </strong> on 2010-07-27 01:03:00 <br /> This funcion contains an error. If you are using hash, with slash '/' it will brokes Example <pre><code> window.location.href = 'http://localhost/phpbb3/foros/index.php#/phpbb3/foros/viewforum.php?f=2' var relativepath = './viewforum.php?f=2'; console.log(realpath(href)); </code></pre> Will output http://localhost/phpbb3/foros/index.php#/phpbb3/foros/viewforum.php?f=2 I thinks its a big error ;) FIX <pre><code> var r = this.window.location.href; if (r.indexOf('#') != -1) { r.substring(0,r.indexOf('#')); } </code></pre> <hr /> <strong> <a href="http://kevin.vanzonneveld.net" rel="nofollow">Kevin van Zonneveld</a> </strong> on 2009-10-25 14:01:50 <br /> @ cuisdy: We only port actual PHP functions, but given the amount of visitors coming here, I'm sure someone will run into your function and find it useful. So thanks for the code! <hr /> <strong> cuisdy </strong> on 2009-10-19 00:52:43 <br /> No laughing at me, please... Where it said &quot;letsGo&quot; it should say &quot;letsStart&quot;. It's just the most silly variable name I could come up with, I know. <hr /> <strong> cuisdy </strong> on 2009-10-19 00:49:14 <br /> Hi there, thanks for that script. However, I was looking for a path resolver that would return a relative path resolved, not an absolute path resolved. I decided to do one myself and it works for me (though I haven't tested über weird inputs, so it's up for testing and improvements). Just in case someone wants it, here it is: (hope it posts the code nicely formatted hehe) <pre><code> function resolvePath( sPath ){ sPath = sPath.replace(/\\/g,'/'); // Linux compatible sPath = sPath.replace(/\/\//g,'/'); // Fix double bars var aPathParts = sPath.split('/'); // Get parts of the path for( var i=0, letsStart, sPart ; sPart = aPathParts[i] ; i++ ){ if( sPart != '..' ){ letsGo = true; continue; }; if( letsStart &amp;&amp; sPart == '..' ){ aPathParts.splice((i-1),2); i=i-2; } }; return aPathParts.join('/'); }; </code></pre> Does PHP have a function like this, by the way? <hr />