I needed a number of diagnostic tools as I developed this plugin. Here is a description of each:
- Notification Tool:
- This is the most powerful tool of the bunch. It allows me to:
- Display current contents of diagnostic log
- Clear contents from diagnostic log
- Show notifications of each type
- Demonstrate difference between sticky and non-sticky notifications
- Show how to create notifications in either PHP (on the server) or in JavaScript (in the browser)
- Shortcode Error Detection:
- This tool shows examples of poorly formed shortcodes and how the plugin detects and reports them.
- Argument Tester:
- Parsing shortcodes turned out to be a bit hairy. I didn’t have any formal tools for language parsing at my fingertips, so I created my own. This tool tests various forms of shortcodes to make sure they are handled correctly.
- Show Site Options:
- This tool searches the options table for a match on the filter value (e.g. for options that begin with “mkp”) and displays them. This was extremely difficult to build and getting it working was a royal pain that took me way longer than it should have because WordPress is very strange about how it handles options on a single site versus a multisite network like we have for mkpusa.org.
- Base Options Tester:
- I ran into a nasty problem with options not being updated properly. After several days of testing, I got this tool working and it now tests creating and reading options from a single boolean field like ‘true’ to a complex nested associative array.
- Multisite Information:
- This tool shows shows how to use four simple shortcodes to display information about the current site. It does not have any use outside a multisite network.
- Configuration:
- This tool is a convenient place to put all of the shortcodes needed to configure a site in the multisite network. Just edit the codes as necessary and then run it to setup the site.