Monthly Archives: June 2012

Adding conditions to relationships in Laravel

Currently playing with the Laravel php framework. It’s been said by many already, it’s a really cool framework. Well designed and documented. Coming from a CodeIgniter background, it’s easy to jump in and refreshing to get all the new cool features. The Eloquent ORM has a nice minimalist approach to writing database abstraction. If you’re coming from Propel or Doctrine it’s crazy how little you actually need to get Eloquent going. Eloquent supports relationships between…

Read More

Show custom image sizes in the WordPress’ Add Media popup

Not entirely sure when this appeared in WordPress, I remember searching through the source code a while back to find a way to do this and it wasn’t available then. Anyway, WordPress now has a image_size_names_choose filter that allow you to show your custom image sizes in the Add Media popup. It is very handy if you’re building a website which requires additional sizes. Here’s how it’s done (put that in your functions.php file or…

Read More

Extended ASCII characters are valid php variable names

A curiosity… I was looking on the php.net website for what qualifies as a valid PHP class name, which they qualify as: A valid class name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. came across this statement Source PHP reference page But they then add the following: As a regular expression, it would be expressed thus: [a-zA-Z\x7f-\xff][a-zA-Z0-9\x7f-\xff]* \x7f-\xff … really? (\x7f-\xff is the extended ascii character set)…

Read More

New WordPress plugin – Post In Post

So I wrote a WordPress plugin, called Post In Post. It’s basically a simple plugin to provide admins with a way to browse and insert post content inside other posts. The main aim was to try to integrate into WordPress as best as possible. It extends the editor interface and provides a browsing tool. Content can be inserted inline (i.e. copied into the post content) or as a shortcode (i.e. the content will be inserted…

Read More