PHP File Handling Cheat Sheet

Accessing Directory Read Directory Files into Array $dir = ‘example’; $files = scandir($dir, ‘w’) or die(‘Cannot read directory: ‘.$dir); //implicitly creates file foreach ($files as $file) { //do something with $file } Open and Close Directory $dir = ‘example’; if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (substr($file, 0, 1) … Read more

Contact Form 7 Ticketing Plugin

The CF7 Ticketing Plugin is an incomplete plugin made for a client that needs a ticketing system for building maintenance. It utilizes the Contact Form 7 plugin for form validation and stores the input as a custom post type that can be searched and organized. CF7-Support-Ticket Plugin The plugin includes a custom backend menu, “Tickets”, … Read more

Simple Regex Reference

A simple regex reference sheet for all your regex needs. [abc]     A single character: a, b or c[^abc]     Any single character but a, b, or c[a-z]     Any single character in the range a-z[a-zA-Z]     Any single character in the range a-z or A-Z^     Start of line$     End of line\A     … Read more