tldextract.php – Extract TLD, Domain And Subdomains From URLs

August 28th, 2012

tldextract.php is a PHP library that accurately extracts the effective top-level domain name, registered domain and subdomains from a URL. For example, you can use it to get the domain name “google” from “http://www.google.com”, or the TLD “co.uk” from “http://www.bbc.co.uk/”. Example: Introduction Most people try to do this by splitting the domain name on ‘.’ […]

Continue Reading...

Finding Related WordPress Plugins

August 15th, 2012

A few days ago, I happened upon an interesting post on the ManageWP blog discussing ways to improve the WordPress plugin repository. One of the suggestions was to add a “related plugins” feature: Both Lester Chan, with over 7 million plugin downloads to his name, and Duane Storey, a co-founder of Brave New Code, suggested […]

Continue Reading...

Automatic Versioning Of JS And CSS Files In WordPress

July 30th, 2012

If you’re a WordPress developer, this will probably sound familiar: you make a change to  one of your scripts or style sheets, reload the page you’re working on to see the result, and… everything stays the same. Of course, after a moment of confusion, you realise that you didn’t update the $version argument in your […]

Continue Reading...

Error Log Monitor

July 25th, 2012

Whether you’re using WordPress for development or simply as a blog or CMS, it is always a good idea to keep an eye on your PHP error log. As a developer, it helps you notice and fix errors in your code. As a normal user, it lets you discover plugin bugs, WordPress compatibility issues and […]

Continue Reading...

Formatting JSON With PHP

July 17th, 2012

The built-in json_encode() function in PHP puts everything on one line. For development and debugging, it can often be more useful to have properly indented, human-readable JSON that makes it easier to manually inspect the encoded data and check it for problems. Here’s a function that lets you format/pretty-print any JSON string to be more […]

Continue Reading...