Archive for the "Code" Tag

Filed in: , ,
Posted On: 2009 / 04 / 29

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

Filed in: , , , ,
Posted On: 2008 / 11 / 16

Working with SVN on Windows is pretty much synonym to using TortoiseSVN I guess. If you are running a trunk version of WordPress, maintaining plugins or doing anything else collaboratively, chances are you're using this nice piece of software. When you log to you computer to get some coding work done, what is your first […][...] → Read more

Filed in: , ,
Posted On: 2008 / 09 / 07

I ran into an interesting problem, facing what is certainly an HTML limitation that had somehow never really occurred to me. The thing is: when you submit a form with empty fields, empty values are POSTed, except for checkboxes and radio buttons which are not posted at all, just as if they were no such […][...] → Read more

Filed in: , , ,
Posted On: 2008 / 08 / 15

The plugin quick reviews I recently did (Plugin Competition roundup, part 1, part 2) got two consequences so far. First, they generated some feedback from readers asking for insights or advices, and second, they quite left me in perplex astonishment regarding how many coders ship plugin with messy code. About the second point, I threw […][...] → Read more

Filed in: , , ,
Posted On: 2008 / 07 / 02

A WordPress install is a bunch of directories and files, but two of them are particular: the file wp-config.php and the directory wp-content/ are personal and don't get overwritten when you upgrade your blog. In WordPress 2.6, they get so personal that you can even move them out of the WordPress root. This must bring […][...] → Read more

Filed in: , , ,
Posted On: 2008 / 06 / 30

Stephen, on his geek blog Nerdaphernalia, is running a series of excellent posts giving advices to plugin authors for neat subtle effects: adding a "Configure" link right next to the "Activate" link on the Plugins page, or how to give credit to your plugin without cluttering the page (I'm a big fan of the "Configure" […][...] → Read more

Filed in: , ,
Posted On: 2008 / 05 / 16

I've updated my Projects page, which was missing quite some works. It should now be up to date with all the stuff I've coded in the past few years. Hey, this page is starting to give me a little warm feeling of pride ;)[...] → Read more

Filed in: , ,
Posted On: 2008 / 04 / 27

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, or double backslashed Win32 […][...] → Read more

Filed in: , , ,
Posted On: 2008 / 03 / 28

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