Tag Archives: WPDB

Helping WordPress make friends with the decorator pattern

In some plugin circles (also know as the “cool kids club”), the coolest kid on the block is the wpdb class. Plugins go out of their way to be his friend. Lucky guy (or class)!

One plugin that has to be friends with wpdb is HyperDB. If plugins could talk, it would sound a lot like a scene from kindergarden.

Continue reading Helping WordPress make friends with the decorator pattern

Spying on WordPress with the proxy pattern

In a not so distant future, you’ve grown to be quite the WordPress expert. You work for WSIS (WordPress Security Intelligence Service) as an analyst. You’re given your first field mission.

You have to get in deep with WordPress. You need to get intimate information about a WordPress object. Information even WordPress doesn’t want to give you. You need to gain access without detection. The last thing you need is WordPress to know you’re listening to things.

How would your future self do it? Well, he’d use the proxy pattern (good thing you’re reading this article). The proxy pattern is the equivalent of object-oriented tapping. It’s one way to solve the problem of interacting with a class without it being aware of it.

Let’s look at how it works.

Continue reading Spying on WordPress with the proxy pattern