Last week-end I gave a talk at WordCamp Paris, about the exciting topic of Unit Tests for WordPress plugins (are you excited already?). I think I'll write a short blog post about it in the next few days ; I'll also write a series of post about unit testing, because that subject is so exciting :)

In the meantime, here are my slides (in French) :

Plain old downloadable PDF: WordPress Plugin Unit Tests, or Slideshare stuff below.

The demo plugin and all its tests are on Github: ozh/plugin-unit-test-demo.

Last night I was reading something interesting then stumbled, in the comments, on a WordPress smiley. Bleeeh. There's a reason one of the first things I do when I setup a new site is uncheck "Convert emoticons like :-) and :-P to graphics on display": 90's phpBB'esque blocky gifs are *ugly*.

In my opinion those smileys are super outdated (they haven't changed since the very beginning of WordPress which, in internet times, is the equivalent of Pleistocene) and they suck for three reasons:

  • they're ugly. Did I already mention that? :)
  • they're too old to live on retina screens
  • it's very inefficient to load one image for each and every emoticon, as Julio points out

Over the years a few people have proposed alternatives for core but this is unlikely to happen, as very nicely summed up by WP Tavern. You can find several alternative as plugins, like New Smileys, but they're just another batch of images.

In the short discussion my tweet sparked, Greg pointed me to his way of doing it and I thought it was wonderful: 100% CSS, no image loaded, ideally tuned and adapted for his theme.

https://twitter.com/ScreenFeedFr/status/546148719092314113

A coffee break later*, here is a sample plugin that replaces your smilies with pure and simple HTML markup that you can then easily style: Ozh' CSS Smilies. Hooo those super annoying cute animated little ghosts!

ghosts_smiley

The plugin is just meant to be a start for those who'll want to style their own smilies. Feel free to use and modify to match your theme!

* yeah right. I took me like 90 minutes just to get that half ugly CSS working :/

I recently felt like making a few banners for my plugins. First questions that came to mind: "what's the name of the file again? what dimensions?". And then, while making stuff: "will this be hidden by the plugin's title?"

So, I made this simple banner template as a Photoshop PSD file. Nothing genius but feel free to use. No excuse not to add some fancy eye candy to your best plugins!

banner-template

I released a number of WordPress plugins over the last 10 years ("24 plugins and 1,062,110 downloads", says my fun bookmarklet) and they all mostly fall in one of these three categories:

  1. Outdated stuff that are no longer maintained because I don't need them anymore
  2. Simple stuff that don't require any maintenance because they just work and will probably work forever
  3. Stuff that are still maintained because I still need them

That third group recently motivated me to move some plugins to Github so their dev will now happen there.

It was recently brought to my knowledge that my most popular plugin, Ozh' Admin Drop Down Menu, causes 404 on dumb dashicons requests. That shall be fixed.

So. Anyone fancying a pull request and fix that now? :)

Twitter is fun and catchy, but the thing is: once tweeted, gone forever. Found an awesome link last month, shared it with a relevant #hashtag? Good luck finding it now. Your data now lives and dies on Twitter and you have no hand on it.

Four years ago to address this problem I made yet-another-Twitter-to-WordPress plugin, creatively named Ozh' Tweet Archiver.

Two years ago Twitter broke my plugin with their new API, requiring OAuth for every request, including reading public tweets. Fixing it has been since on my todo list but, hey, you know.

Two weeks ago @EHER sent me preliminary code to fix things, just what I needed as a motivation to fix things.

Two days ago I published version 2.0 of my super cool Tweet Archiver plugin. Fixed, dramatically improved, with new features. w00t.

TL;DR: from @ozh to planetozh.com/tweets with WordPress, #yay.

Go get it, install it, you'll love it. Or, as usual, 120% refunded!

In: , , , On: 2014 / 01 / 22 Short URL: http://ozh.in/x2

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 till January 2011. This means that it's now considered an old release, rusty dusty code that's no longer improved, and should a new vulnerability be discovered in the 5.2 branch, it will remain unfixed.

In short: it's *old*. Any PHP library you'll find these days requires 5.3+.

Old but still everywhere ?

According to W3Techs, 33% of websites running PHP are on 5.2. That's a lot, but wait, there's worse.

According to WordPress, more than 50% of WordPress-powered sites are still on 5.2. Earlier this week @dd32 made a pretty graph showing that PHP 5.2's share is only slowly decreasing.

So what?

Dropping a platform running half of your user base would be crazy, right? For sure. Except I think the numbers are somewhat skewed.

As you may know, my pet project is a self-hosted URL shortener, YOURLS, which was released in its version 1.7 earlier this month. This new version comes with a phone-home feature to report the same kind of stats that WordPress is aggregating from its users, and particularly what PHP version YOURLS is installed on.

Of course, the YOURLS user base is nowhere near as important in volume as WordPress' market, but I think the average user is similar, so YOURLS figures should be relevant in some way.

What I've learned since the release of YOURLS 1.7 came as a surprise: I was expecting a similar share to what WordPress reports, but it turns out only 10% of YOURLS installs are running on PHP 5.2

yourls_php_version

What did I conclude from all this?

1. Old installs vs new installs

WordPress is old, it's been around for 10 years. The typical WordPress user installed WP 4 or 5 years ago, when 5.2 was still the standard.

YOURLS is much younger, it's been around for 4 years, but the project sort of picked up 3 years ago with YOURLS 1.5, released in November 2010. The typical YOURLS user installed YOURLS 1 year ago, when the default hosting setting on most host was PHP 5.3 or more.

I think that's the key of the skewed numbers : simply too many WordPress installs were around when PHP 5.2 was the default, and those users just did not upgrade their hosting. Well, why would they, it just works fine.

That would be exhibit A : newer users are on 5.3+, older are still on 5.2.

2. Deeper digging: who's running PHP 5.2?

Most host, if not all, still offer 5.2, even if you open an account today, but I could not find any which does not support 5.3+. All the major hosts (Dreamhost, Bluehost, Hostgator, etc…) have 5.3 by default.

And if there is a minor host where PHP 5.2 is the best you can have, then what's the point with signing with a smaller and lesser known company if they cannot provider better services than big ones?

Exhibit B: hosts can give you 5.3+

3. WordPress should lead

And that will be exhibit C: WordPress has the power.

WordPress runs on 20% of all websites in the world. That's huge. Moreover, it apparently has 60% of the CMS market, which is also very impressive.

Few organizations in the world have the power to say "we're moving to a newer version of PHP" and have a global impact ; WordPress is one of them.

With such an influence, WordPress should even go a step further and pro-actively announce end of support for PHP version and follow PHP's 3 year release process, instead of simply watching user adoption. PHP 5.3 will be maintained till July 2014, PHP 5.4 will be maintained till March 2015: I think WordPress should announce the same minimal requirement changes.

TL;DR

The day WordPress says "we require PHP 5.3", the whole web which is still running 5.2 switches to 5.3. Simple as that.

In: , , On: 2014 / 01 / 13 Short URL: http://ozh.in/wz

I've always had a fascination for Github timeline graphs since they released it. It's simple and pretty and potentially meaningful (and fits nicely on a geek tshirt). Yes, it may say things about you.

The following is an attempt at decrypting what a few actual Github timelines say, or might say, or don't say at all, after a thorough and thoughtful psychosocial analysis that guarantees an accuracy of roughly 2% in the best case ;)

I'm a student

audreyr

"I love this thing, but unfortunately I haven't got much time for it except during summer holiday and a couple days during holiday season. Also, I wish I could spend more time on this!"

I have too much time on my hands

contributions

"Oh my, I love that tool I love that site I love that timeline graph I have to make something witty with it. Also, I suck at pixel art."

I'm a reliable guy

nathanrice

"Github is not my primary dev platform. This said, I have a few projects hosted there, and they're all maintained. Also, count on me to monitor open issues and answer them in a timely manner."

I'm a nerd. No, wait. I'm THE nerd

sferik

"It's already 10am and I haven't committed anything, I'm starting to feel fuzzy inside, I should get back to work. Also, my command line Twitter client t is pretty neat"

I'm an annoying noob

noob

"Hi! I've just created an account here on Github to open an issue that's obvious but I can't be arsed to search or read the wiki first. Also, I need to install Facebook on my Mom's computer, how do I do that?"

I'm a professional. 9-17, Mon-Fri

weierophinney

"I use Github at work, but week-ends are not for work, they're family time. Also, Boss, please, I had only one week off during July and another for Halloween, I need holidays!"

I'm new and I'm hooked

julycoding

"Hi there! I'm new here and what can I say, I *love* it here! Woohoo! Also, I'm super enthusiastic!"

I'm handsome, sympathetic and smart

ozh

"During July I take a month away from computers, no need to bother opening issues here. Also, YOURLS 1.7 is just out, did you update?"

I really like how Github displays your yearly code contributions, in that 52×7 green dot matrix. It's cute, informative, and has become iconic enough that any nerd knows what it refers to.

contributions

I like it so I funcoded a script that will deliver a message after 365 days of running — fun, but kinda slow, right?

So, I made something more interactive and instantly fun, something you can play with: I'm delighted to introduce contribution, a site to "Generate Github-like contribution graph" and print them on a t-shirt (or just save them as a PNG for whatever use you'll like)

It's neat with short messages that fit the grid, works best with capital letters but hey, experiment:

at_ozh

hello-world

I've had great fun coding that site, especially the server side PHP script that generates the matrix from the letter input. It was also my first experiment using Bootstrap and I must say it's pretty neat for the design-impaired people like myself.

The t-shirt printing is powered by Zazzle: their API is decently documented and I've bought a couple of shirts from them in the past and have been pleased by the quality. I ordered myself a tshirt with "@ozh", can't wait to show it off at work :>

Go ahead, play with contribution and make some cool contrib graph. You'll be the coolest looking nerd on the beach this summer :)

As of writing, the 26 WordPress plugins I have hosted on wordpress.org have been downloaded one million times.

1M

Of course this is mostly due to my most popular plugin, Admin Drop Down Menu, which has been downloaded more than 700,000 times over the last 6 years, but this is a cool mark anyway.

Is there something like a millionaire club? :)

In: , , On: 2013 / 05 / 07 Short URL:

A quick ping today by Jeff Chandler reminded me that nine years ago this blog started running on WordPress. Time flies when you're worry-free :)

So, before everyone celebrates WordPress' 10 years birthday, I'll blow a few candles first: happy 9th birthday planetOzh :)