Setting up WordPress in 2023

Here is my recipe for quickly spinning up a WordPress site with: Plugins and themes managed by PHP Composer, so they can be checked into version control. Several of my favourite plugins installed, including FooGallery and Advanced Custom Fields. A minimal theme combining Roots Sage 10 and Bootstrap 5.2 (at the time of writing this … Continued

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

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 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!

PHP vs Perl

Here's a simple program which calculates, to eight decimal places, the value of the Golden Ratio φ implemented in both PHP and Perl, to demonstrate their similarities. Perl #!/usr/bin/perl $a = 1; $b = 1; $c = undef; $psi_old = undef; print “Approximating psi…\n”; while (1) { $psi = sprintf(‘%.08f’, $b/$a); last if ($psi_old eq … Continued

How PHP programmers get things wrong

Firstly, three disclaimers: PHP is a great programming language, one of my favourites — this website is written in PHP; there are many great PHP programmers out there, some of whom probably never get things wrong; I probably get things wrong a lot of the time. The majority of the database-backed Open Source PHP projects … Continued

Hurrah! A Blog for Toby!

At last, my new CMS is at a stage when I’m able to actually start publishing with it. Now that I have an easy-ish tool to publish with, you can expect that this website will be updated more frequently and with more and better content. Updating this website in the past has been a major … Continued

Re: Building a “modular” PHP site

Tyno Gendo wrote: I have been pondering over building a “modular” site which accepts add-ons built by other people. I was wondering if anyone has any links to any reading material on how you build this kind of facility into your site? The basic technique is this: Firstly, provide a plugin registration function, which we’ll … Continued

PHP UTF-8 Validation Library

lawrence k wrote: What PHP code would give me this kind of 100% certainty? I was bored so wrote this. I’m quite proud of myself, as I wrote it and ran it and it worked first time! 🙂 It not only checks that the UTF-8 is valid, it forces it to be valid.