A plugin development framework with a lot of reusable code and a nice settings page builder.
Hikari Tools Framework isn't a plugin with features for the end user. It's a development framework with tools to be used by other plugins, so that they don't need to duplicate the same code over and over again.
It deeply decreases plugins development time, specially in building options pages. For that, instead of building the whole HTML for each plugin, we can just prepare an array and it's used to build the whole page.
Another great feature this framework offers is options detection and reset. With the use of another simple array, in the bottom of options page it prints a table showing to plugin's users all kinds of options the plugins creates, being it wp_options, comment meta, post meta, and even network-wide options and user specific options (usermeta).
Every kind of data your plugin stores in database is shown in a clear way, with its key so that users can easly search for them in database. But they don't need to, because together with each option it informs if there's any data of that type stored, and provides user-friendly command to reset them all, totally cleaning the user's database from any data created by the plugin. Very easy and practical to use, and instantly available to any plugin that consumes Hikari Tools Framework!
There are really a bunch of features available, here are the most used ones.
construct()method during 'plugins_loaded' action, and its
startup()method during 'init' action
HkTools::dump()method to pass any kind of data and have it dumped, with a title above it, anywhere you want! And there's also the
HkTools::formatCode()that receives a string and prints it using formatting plugins if available, or pre HTML element if needed.
hasNeedleInsensitive($haystack,$needle)methods to search inside strings. They use PHP's
stripos()to do the search, but instead of returning numbers that are rarely used it returns ready-to-use boolean values to say if
$needlewas or wasn't found, and
$needlecan even be an array if you wanna search many strings at once!
Full featured options page builder: This one deserves its own features list, so many they are! The HkToolsOptions class handles all your options data and options page building, including reseting data to default:
HkTools::debugthat's set to false by default. In your plugin you can develop debugging code that will only be run if
$this->debugis set to true. Then, it's just a matter of setting it in your extended class and all of a sudden all debug will be available to you! BTW, options pages have "hidden" debug code, and when
HkToolsOptions::debugis set to true they are automatically shown without you having to worry with anything!
HkTools::loadAllOptions()method automatically loads your options and stores them in
HkTools::optionsDBValue, regardless if it was indeed loaded from database or was built from options defaults. The class by default handles a single wp_options variable, but you can create more objects and overwrite
loadAllOptions()to load and provide them all.
HkToolsOptionsmethod, instead of having to throw the whole class away and go back building full pages again.
HkToolsOptions extends HkTools: of course, all features available in HkTools are also available in HkToolsOptions to be used for handling your options.
I dedicate Hikari Tools Framework to Ju, my beloved frient ^-^