Dummy’s Guide to Roots Sage Theme in WordPress

Recently I’ve mostly been using Understrap as a theme for WordPress, however the Understrap GitHub repository has shown a disturbing lack of maintenance for the last year or so. With Bootstrap 5 on the horizon, and WordPress and PHP constantly moving forward, I don’t want to be stuck in a potential development dead-end using Understrap. … Continued

WordPress wp-ctrl-semicolon Plugin

I’ve previously blogged about creating keyboard shortcuts in WordPress. Now I’ve bundled that up into a plugin. It’s available on GitHub. https://github.com/tobyink/php-wp-ctrl-semicolon

WP Tempus Dominus Auto

Usually when I blog about programming, it’s Perl stuff, but here’s something that’s mostly Javascript (with a little PHP to act as a shim for WordPress). It’s a script to use Tempus Dominus as a date/time picker for HTML 5 date and time form inputs on Bootstrap/jQuery-based sites. It lets you do stuff like this: … Continued

Looking Ahead to PHP 6

This is my look at what’s planned for the forthcoming revision to the PHP language. Removal of Deprecated Features PHP 6 includes a lot of tidying up, removing features of the language that have caused annoyance, confusion and security headaches. Although these changes are too numerous to list here, and the list will probably change … Continued

TrivialEncoder/0.2

An update to my PHP encryption class. Despite the name, it's becoming a pretty sophisticated encyption machine. New encryption algorithms added: Vigenerè cypher One-Time Pad Bruce Schneier's Superencyption Various other methods using the MCrypt library The TrivialEncoderManager class has been obsoleted by TE_Machine, an abstract class with several different child classes for encoding, decoding and … Continued

PHP Debugging with Style -OR- How I Learned to Stop Worrying and Love the Bug

PHP lets you define your own error handler, so I decided to get a bit fancy. MegaErrorHandler (MEH) outputs its errors as specially-formatted HTML comments, with the details of the error encoded using JSON. A small client-side script, with an associated stylesheet then pulls this data out of the comments and formats it as a … Continued

PHP Encryption Class

Here’s a simple PHP library for encoding and decoding text. Examples: TrivialEncoder.class.php (Highlighted source code.)

Parsing an HTML Table with PEAR’s XML_HTMLSax3

Here’s an example of how to parse an HTML table into an array using the PEAR module XML_HTMLSax3. It supports the , and elements and the rowspan and colspan attributes. It’s worth noting that this code will raise a bunch of notices if you run it displaying all errors. This is pretty difficult to avoid, … Continued

PHP Domain Class

On Usenet an often-asked question is how to programmatically determine the “domain” of a particular hostname. That is, excluding the components traditionally thought of as subdomains. As an example, groups.google.com and www.google.com both have a domain of google.com. Invariably, one answer comes back stating that you just need to chop off everything from the front, … Continued

PHP Linkifier

Here’s a nifty bit of code I wrote a while back (utilising a function from PHP SmartyPants) that takes a bunch of HTML, searches it for some word or phrase that you specify, and turns all occurances of it into a link, unless it’s already a link!