There's a recurring debate about WordPress and whether they should keep code compatible with PHP 5.2 or drop it and bump the requirements to a newer PHP version. Hey, I have an opinion on this. What's wrong with PHP 5.2? Nothing much, except PHP 5.2 was released in November 2006, and was maintained and developed […][...] → Read more
Archive for the "PHP" Tag
Here is a story about a guy who tried to speak a language he didn't know. Like Twilight, there are several chapters in that story, but don't worry, it's not about sissy hormone troubled teenagers trying to grasp the meaning of life.[...] → Read more
I've been speaking lately with folks from Spamhaus about anti spam measure in YOURLS and a YOURLS plugin for this. Currently the #1 result in Google for "spamhaus PHP" is a post on Lockergnome which gets it totally wrong and provides a script that does not work, so here is a PHP script that does […][...] → Read more
Ho haï, blog, long time no see! :) I was checking stuff on various URL shorteners and noticed is.gd has one interesting feature: you can generate short URLs that are "pronounceable" (no "vgfhgt"). This is a great little touch: a random but pronounceable word will be more memorable and the probability for typos is reduced, […][...] → Read more
Using PHP's HTTP Authentication is a simple way to protect scripts behind a login/password prompt. There's one little problem: it's supposed to work only on PHP as an Apache module, not the CGI version. It took me a while, hair pulling and some googling to get a basic HTTP Auth system working on Dreamhost's PHP […][...] → Read more
For my next stuff I needed the Javascript equivalents of PHP functions basename() and dirname(). Nothing genius: < View plain text > javascript function basename(path) { return path.replace(/\\/g,'/').replace( /.*\//, '' ); } function dirname(path) { return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');; } It obviously supports paths like /home/ozh/stuff.php, http://site.com/file.ext or double backslashed Win32 […][...] → Read more
WordPress 2.5 comes with a very handy API that plugin authors should love: shortcodes, ie. BBcode-like tags, that are parsed when found in post contents. The API is very easy to use, and well done enough that it's relatively foolproof. Shortcode types The API allows for all the possible combinations and forms you'd think of: […][...] → Read more
< View plain text > php query_posts($query_string.'posts_per_page=-1'); while(have_posts()) { the_post(); the_time(); the_title(); } This will display the time and title for all your posts. This could result in a very long page, and a more usable way of doing it would be to […][...] → Read more
Headbanging link of the day: MetalAd creates a skyscraper-like banner from your heavy metal tastes (as stored by Last.fm). (my metal ad for instance). The generating PHP script is even open-sourced.[...] → Read more
Parse error: syntax error, unexpected T_DEC, expecting T_PAAMAYIM_NEKUDOTAYIM (like here for instance) Seriously, what were PHP coders on, when they decided to implement this kind of error message?? For the record, it just means you're missing a :: somewhere.[...] → Read more