An Overview

T he MytTypo plugin is not object-oriented and instead
uses namespaces to reduce naming conflicts.
The settings framework uses namespace ‘MtyPhp’, but the plugin itself uses namespace ‘UserNS’. This is to make it easier to extract the framework and use it with another plugin – all the ‘cross-namespace’ issues have been resolved.

T he main file myt-typo.php has been reduced to a near-minimum. All the settings functionality has been exported to files named ‘tab-…’. Each such file defines the settings on a single tab, both the configuration of the admin controls, and the actual functionality.

T he framework is divided into two files. One, ‘backend.php’, contains the main guts of the framework. Of particular interest is the mechanism whereby the WP option for the plugin tracks the configuration specified by the plugin in the tab-… files. Items remove from the configuration are automatically removed from the option, and items added magically appear in the option. The other file, ‘controls.php’ contains the code that renders the controls on the WP settings page. This replaces WP’s built in rendering and allows you to add special custom controls.

T he plugin currently has two tabs. The ‘Dropcap’ tab is the primary reason for the plugin and is pretty self-explanatory. Filling out the fields is fussy and getting an optimized result is mostly trial and error.

A n assortment of things that are useful but don’t deserve a plugin of their own are grouped under the ‘Other’ tab. Additional space between sentences and enhanced-visibility punctuation add some refined typography.
The nuisance of linebreaks being filtered out of excerpts (if it is a nusiance) can be corrected.
A group of options allow removing various little-used items from the WordPress header, in the hope of reducing the site load time, or just a desire for cleanliness.
Finally a reset option is supplied, whcich simply deletes the option from the database, leaving it to be automatically reconstituted from the configuration. This is useful to restore the defaults when you have lost your way trying to optimize the dropcaps!

Leave a Reply

Your email address will not be published. Required fields are marked *