WordPress Plugin – an example of bad programming

When you have to break out a debugger to try and figure out why an obvious modification to a piece of third party code isn’t working it’s usually down to bad code. Here’s the problem:

I was trying to add a submenu page to an existing WordPress menu.

Unfortunately, the developer had decided to write a convenience wrapper around some of the existing WordPress Add Menu functionality. Whilst a neat idea (you simply used a render function to that would parse the page name to call the function that rendered the content), they had managed to shoot themselves in the foot by hard-coding the page names in this render function.  E.g. in this render function you had:

What it meant was you had to basically step through the code to find out why things weren’t working.

Open Source web frameworks for 2016, 2017, 2018 and beyond

As an Open Source developer specializing in PHP frameworks like WordPress, Drupal, CodeIgniter and Symfony I’m always keen to know where to focus my efforts on new technologies.

But how can you predict where a web technology is going?

This is where Google Trends comes to the rescue. Here are some graphs of interest (in terms of searches for the technology) of new and existing Open Source web frameworks.

One caveat – a search for a term covers a lot of potential use cases such as end users wanting to find out more or developers searching for more information. A higher search number does not mean higher pay rates but it does mean there is a global interest in the technology.

Firstly, some CMSs: Drupal, WordPress, Joomla, TYPO3

WordPress is clearly more popular (which is understandable given its dominance). However, interestingly, Drupal is clearly on a downward trend. Anyone care to explain why?

I did have a look at other CMS’s such as OctoberCMS and PageKit but these did not even feature on the graph hence the omission. If anyone wanted a graph of up-coming systems perhaps I could do a separate chart.

Then, some frameworks: Yii, Symfony, Laravel, Zend, CodeIgniter

Some key takeaways – Laravel is going through the roof!
And Zend, which hit a peak in 2009, is clearly dropping off the radar. CodeIgniter, which had a peak in 2013, still has a strong interest and is in second place.

It would be interesting to expand on these graphs. Any suggestions on other frameworks or time periods to focus on?

WordPress – crap code

I’ve just been digging through query.php trying to fix a WordPress problem.

And the code I see is staggeringly bad. Yet this is core code.

e.g. take a look at get_posts(), pages upon pages of if statements. Utterly unreadable and there is no way to figure out how a change might cascade down the code.

I ran the code through a debugger. After staggering through the hundreds of lines of if statements I found WordPress was calling the function a 2nd time. So, not only is it incredibly long and incomprehensible. It gets called multiple times.

 

MarsEdit

Testing out MarsEdit.

MarsEdit

This has some great reviews and a free-to-try model. Anything has got to be better than using the web admin panel so I thought I’d give it a go.

First thing I got asked was whether I wanted to use HTML or Rich Text. Which puzzled me.

I’m publishing to the web so I chose HTML.

Uploading images gives you two options – upload Now or With Post. With Post seems to be less blocking to your workflow.