Title: Hikari Tools Framework
Author: shidouhikari
Published: <strong>Ọ̀wàrà 22, 2010</strong>
Last modified: Ọ̀wàrà 22, 2010

---

Ṣàwárí àwọn plugin

Plugin yìí **kò tíì ṣe àyẹ̀wò pẹ̀lú àwọn ìtújáde mẹ́ta pàtàkì tó kẹ́yìn ti WordPress**.
Ó lè jẹ́ pé a kò tọ́jú tàbí ṣe àtìlẹ́yìn fún un mọ́, ó sì lè ní àwọn ọ̀ràn ìbámu
nígbà tí a bá lò ó pẹ̀lú àwọn ẹ̀yà WordPress tuntun.

![](https://s.w.org/plugins/geopattern-icon/hikari-tools.svg)

# Hikari Tools Framework

 Láti ọwọ́ [shidouhikari](https://profiles.wordpress.org/shidouhikari/)

[Ṣe ìgbàsílẹ̀](https://downloads.wordpress.org/plugin/hikari-tools.1.07.05.zip)

 * [Àwọn àlàyé](https://yor.wordpress.org/plugins/hikari-tools/#description)
 * [Àwọn àgbéyẹ̀wò](https://yor.wordpress.org/plugins/hikari-tools/#reviews)
 *  [Ìgbéwọlẹ̀](https://yor.wordpress.org/plugins/hikari-tools/#installation)
 * [Ìdàgbàsókè](https://yor.wordpress.org/plugins/hikari-tools/#developers)

 [Ìrànlọ́wọ́](https://wordpress.org/support/plugin/hikari-tools/)

## Àpèjúwe

**[Hikari Tools Framework](http://hikari.ws/tools/)** isnÌtumọ̀ Yorùbá: ’t a plugin
with features for the end user. ItÌtumọ̀ Yorùbá: ’s a development framework with
tools to be used by other plugins, so that they donÌtumọ̀ Yorùbá: ’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Ìtumọ̀ Yorùbá: ’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Ìtumọ̀ Yorùbá: ’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Ìtumọ̀ 
Yorùbá: ’t need to, because together with each option it informs if thereÌtumọ̀ 
Yorùbá: ’s any data of that type stored, and provides user-friendly command to reset
them all, totally cleaning the userÌtumọ̀ Yorùbá: ’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!

#### Features

There are really a bunch of features available, here are the most used ones.

 * _DRY_: Using the DonÌtumọ̀ Yorùbá: ’t Repeat Yourself principle, features are
   developed only once in the framework and are used anywhere you want! And once
   the framework is updated, the update is automatically replicated to all plugins
   that use it!
 * _Object Oriented_: it provides 2 classes, which you can expand to implement your
   code, and then call parent methods anywhere to use FrameworkÌtumọ̀ Yorùbá: ’s
   features. Also, if you wanna add special features to a specific method, just 
   overwrite it in your class!
 * _Automatic ‘plugins\_loaded’ and ‘init’ actions_: follows WordPress standards
   and runs the least code possible during plugins load time. Each object is instantiated
   and runs its `construct()` method during ‘plugins_loaded’ action, and its `startup()`
   method during ‘init’ action
 * _Data dump_: great for debugging, you can use the `HkTools::dump()` method to
   pass any kind of data and have it dumped, with a title above it, anywhere you
   want! And thereÌtumọ̀ Yorùbá: ’s also the `HkTools::formatCode()` that receives
   a string and prints it using formatting plugins if available, or _pre_ HTML element
   if needed.
 * _Strings search_: use `hasNeedle($haystack,$needle)` and `hasNeedleInsensitive(
   $haystack,$needle)` methods to search inside strings. They use PHPÌtumọ̀ Yorùbá:’
   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 `$needle` was or wasnÌtumọ̀
   Yorùbá: ’t found, and `$needle` can even be an array if you wanna search many
   strings at once!
 * _Version checks_: the Framework tests PHP and WordPress versions and doesnÌtumọ̀
   Yorùbá: ’t load itself if requirements arenÌtumọ̀ Yorùbá: ’t fit, and plugins
   that consume it follow a standard of testing the Framework version too.
 * _Paths to plugin files_: it provides 2 variables for local path and URL for plugins
   root folder, for each plugin that consumes the Framework!

**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:

 * Instead of having in each of your plugins a complete HTML page to allow your 
   users to setup configs, just create an array with your options data and everything
   will be handled by the Framework, **including handling default values and registering
   the options page and its menu item**!
 * _Many types of data are supported_: text, textarea, select, radiobox, checkbox,
   and if neither of those are enough you can also specify custom areas where your
   special options (ex: complex data that requires custom HTML, JavaScript, etc)
   can be placed!
 * _Store multiple settings in a single option using arrays_: forget those dumb 
   plugins that add dozens of wp_options rows, now you can use a single array to
   store all those settings, and place them all in a single options variable. And
   you donÌtumọ̀ Yorùbá: ’t have to deal with the complexity of setting them to 
   use array, because the Framework handles it to you!
 * **Use multiple sections**: Does your plugin use so many settings that it becomes
   messy? DonÌtumọ̀ Yorùbá: ’t worry, create visually separated sections to organize
   your settings, each of them having a title and help text to explain what the 
   section refers to. And multiple sections are still stored in a unique arrayÌtumọ̀
   Yorùbá: ’ed wp_options row!
 * _Store your options in multiple places_: aside from the most known wp_options(
   which is specific for each site), you can also store Multisite / network-wide
   options (that are shared by all sites in a MultiSite network) and user specific
   options (which are stored together to current user and are valid only to him).
 * Too many storage places make it hard for plugins users to delete them all when
   they are uninstalling the plugin? No! _Hikari Tools Framework easily resets them!_:
   it provides an **uninstall form** which is added in the bottom of default options
   page, listing all kinds of options (wp_options, sitemeta, usermeta, postmeta,
   commentmeta, …) your plugin uses, informs for each of them if thereÌtumọ̀ Yorùbá:’
   s any data stored ATM, and provides a command to delete them all from database,
   followed by a command to directly uninstall the plugin! This feature can also
   be used to reset options to default.
 * _Default options arenÌtumọ̀ Yorùbá: ’t stored_: many plugins use to add default
   options to database when they find none, therefore storing data that didnÌtumọ̀
   Yorùbá: ’t need to be there and blocking users from deleting those data before
   deactivating the plugin. With **Hikari Tools Framework** plugins that doesnÌtumọ̀
   Yorùbá: ’t happen, because it doesnÌtumọ̀ Yorùbá: ’t save data automatically 
   and uses default settings when options data isnÌtumọ̀ Yorùbá: ’t found in database.
   _And thatÌtumọ̀ Yorùbá: ’s totally transparent for you while handling options
   in your code!_
 * _Special debug feature_: ThereÌtumọ̀ Yorùbá: ’s a property named `HkTools::debug`
   thatÌtumọ̀ Yorùbá: ’s set to false by default. In your plugin you can develop
   debugging code that will only be run if `$this->debug` is set to true. Then, 
   itÌtumọ̀ Yorùbá: ’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::debug` is set to true they are automatically
   shown without you having to worry with anything!
 * _Automatic options loading_: Always load your options object first, because its`
   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.
 * _Options page customization_: if some part of default page doesnÌtumọ̀ Yorùbá:’
   t fit your needs, you can change it by overwriting a `HkToolsOptions` method,
   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.
 * Reset and uninstall commands use JavaScript to alert user about data lost and
   ask confirmation before deleting

I dedicate Hikari Tools Framework to Ju, my beloved frient ^-^

## Àwọn àwòrán ìbòjú

[⌊A section area named Settings, with 2 settings of type textarea and another of
type combo⌉⌊A section area named Settings, with 2 settings of type textarea and 
another of type combo⌉[

A section area named Settings, with 2 settings of type _textarea_ and another of
type _combo_

[⌊Options page has a sidebar, with links about the plugins and a RSS feed. These
links can be changed⌉⌊Options page has a sidebar, with links about the plugins and
a RSS feed. These links can be changed⌉[

Options page has a sidebar, with links about the plugins and a RSS feed. These links
can be changed

[⌊A combo option and a checkbox, with button to save options and another button 
to reset them⌉⌊A combo option and a checkbox, with button to save options and another
button to reset them⌉[

A _combo_ option and a _checkbox_, with button to save options and another button
to reset them

[⌊The uninstall form⌉⌊The uninstall form⌉[

The uninstall form

[⌊Message from a plugin that requires Hikari Tools Framework to work, asking for
it to be updated⌉⌊Message from a plugin that requires Hikari Tools Framework to 
work, asking for it to be updated⌉[

Message from a plugin that requires Hikari Tools Framework to work, asking for it
to be updated

## Ìgbéwọlẹ̀

**Hikari Tools Framework** requires at least _WordPress 2.8_ and _PHP5_ to work.

You can use the built in installer and upgrader, or you can install the plugin manually.

 1. Download the zip file, upload it to your server and extract all its content to 
    your `/wp-content/plugins` folder. Make sure the plugin has its own folder (for
    exemple `/wp-content/plugins/hikari-tools/`).
 2. Activate the plugin through the ‘Plugins’ menu in WordPress admin page.

As already said, Hikari Tools Framework alone provides nothing for end user, therefore
youÌtumọ̀ Yorùbá: ’ll notice no change by just installing it. ATM it doesnÌtumọ̀
Yorùbá: ’t even have its own options page.

But now youÌtumọ̀ Yorùbá: ’re ready to install and use plugins that require this
Framework, and if youÌtumọ̀ Yorùbá: ’ve already installed any of those (IÌtumọ̀ 
Yorùbá: ’m sure many users will come to this page after installing any other of 
my plugins and notice it wonÌtumọ̀ Yorùbá: ’t work before this one is installed 
🙂 ) you were seeing a message requesting to install the Framework. In this case,
the message will now vanish and you can use your desired plugin normally.

#### Upgrading

If you have to upgrade manually, simply delete `hikari-tools` folder and follow 
installation steps again.

While deleted, all plugins that require it will stop working, but no data will be
lost and as soon as the new version is extracted to its folder everything will go
back to normal.

Always update **Hikari Tools Framework** first, to only then update other plugins.

#### Uninstalling

If you uninstall **Hikari Tools Framework** while another plugin that requires it
is activated, that plugin will stop working and youÌtumọ̀ Yorùbá: ’ll se a message
requesting to install the Framework.

Hikari Tools Framework itself currently stores no data in database and doesnÌtumọ̀
Yorùbá: ’t require special actions to be uninstalled, but you must first uninstall
all plugins that require it. Those plugins donÌtumọ̀ Yorùbá: ’t work without it 
and wonÌtumọ̀ Yorùbá: ’t be able to delete data they store in database until you
install it back.

Since WordPress doesnÌtumọ̀ Yorùbá: ’t support plugins depandancy to handle it properly,
just make sure thereÌtumọ̀ Yorùbá: ’s no plugin that uses the Framework before uninstalling
it. In future versions IÌtumọ̀ Yorùbá: ’m gonna develop something to control which
plugins are using it and see what can be done to make it more user friendly.

## FAQ

  IÌtumọ̀ Yorùbá: ’ve installed one of your plugins and now itÌtumọ̀ Yorùbá: ’s 
forcing me to install this one too. Why did you build incomplete plugins?! Is that
allowed at all??

Chill, donÌtumọ̀ Yorùbá: ’t panic.

My plugins that require **Hikari Tools Framework** arenÌtumọ̀ Yorùbá: ’t incomplete,
they just use the Framework to do some stuff and canÌtumọ̀ Yorùbá: ’t work without
it.

In the past I used to add the framework in each of my plugins, but that consumes
extra RAM and makes maintenance very hard to be done. ItÌtumọ̀ Yorùbá: ’s much easier
to have the Framework in its own plugin and just make others require it. And that
message you see is just trying to help you, explaining why the plugin isnÌtumọ̀ 
Yorùbá: ’t working and how to complete its installation.

A plugin requiring aother isnÌtumọ̀ Yorùbá: ’t illegal. Drupal CMS for exemple uses
it a lot, and WordPress should incentive it too 🙂

  But I had your Framework plugin installed, then I updated another plugin and the“
error” message is back!

ThatÌtumọ̀ Yorùbá: ’s also not a bad thing. In the same way a plugin requires a 
minimum WordPress version to work (because it uses a function that was introduced
in that version), a plugin may require a minimum version of the framework.

My plugins are in constant development (as IÌtumọ̀ Yorùbá: ’m able to do it for 
free, of course), and new features are introduced in every new version.

I suggest always keeping my plugins updated to the last version, I know how boring
it is when a new version of a software is worse than older ones and I do my best
to make the last version the best of them all. If for some reason you prefere an
older version, just talk to me saying what was changed that you didnÌtumọ̀ Yorùbá:’
t like and IÌtumọ̀ Yorùbá: ’ll try to solve it.

That being said, always update **Hikari Tools Framework** first, to only then update
other plugins.

  Incredible! Can I use your framework for developing my own plugins?

Sure. Just open its file and read its source, what each method does and what parameters
they receive. Get one of my plugin and see how they consume the framework, and do
the same.

YouÌtumọ̀ Yorùbá: ’ll notice the options page builder is very flexible and you can
change parts of it leaving the rest untouched, and there are many methods that can
be overwritten to add new sections or change existing ones.

When you publish your plugin, just inform your users that they need to install this
Framework to use it. And of course, please link **[Hikari Tools Framework](http://hikari.ws/tools/)**
original page.

  And what about themes? Can I use the framework in them?

Yes, I didnÌtumọ̀ Yorùbá: ’t add it to my theme yet, but it can be used for side
features (always keep modularity in mind: themes are meant to offer visual markup
and not software features, but small features are ok), and for building theme options
page.

Just be careful that, while plugins can block themselves and lay sleeping when the
framework isnÌtumọ̀ Yorùbá: ’t available, themes must always be fully available.
For that reason, in a big exception, you must check the existence of the framework
as a plugin and if not found you may need to have a backup copy in the theme folder
to be loaded. ThatÌtumọ̀ Yorùbá: ’s _deepy_ discourage (IÌtumọ̀ Yorùbá: ’ve done
that for 1 year and know the problems that it creates) and should be used only on
extreme situations. And when doing so, make sure to add a bright message in backend
requesting user to install the framework plugin.

## Àwọn àgbéyẹ̀wò

Kò sí àwọn àgbéyẹ̀wò fún plugin yìí.

## Àwọn Olùkópa & Olùgbéejáde

“Hikari Tools Framework” jẹ́ ètò ìṣàmúlò orísun ṣíṣí sílẹ̀. Àwọn ènìyàn wọ̀nyí ti
ṣe ìkópa sí plugin yìí.

Àwọn Olùkópa

 *   [ shidouhikari ](https://profiles.wordpress.org/shidouhikari/)

[Túmọ̀ “Hikari Tools Framework” sí èdè rẹ.](https://translate.wordpress.org/projects/wp-plugins/hikari-tools)

### Ṣe o nífẹ̀ẹ́ sí ìdàgbàsókè?

[Ṣàwárí koodu](https://plugins.trac.wordpress.org/browser/hikari-tools/), ṣàyẹ̀wò
[ibi ìpamọ́ SVN](https://plugins.svn.wordpress.org/hikari-tools/), tàbí ṣe àgbékalẹ̀
sí [àkọsílẹ̀ ìdàgbàsókè](https://plugins.trac.wordpress.org/log/hikari-tools/) nípasẹ̀
[RSS](https://plugins.trac.wordpress.org/log/hikari-tools/?limit=100&mode=stop_on_copy&format=rss).

## Àkọsílẹ̀ àwọn àyípadà

#### 1.07

 * First public release.

## Àkójọpọ̀ Meta

 *  Ẹ̀yà **1.07.05**
 *  Ìgbàgbọ́hùn tó kẹ́yìn **ọdún 16 sẹ́yìn**
 *  Àwọn ìgbéwọlẹ̀ tó ṣiṣẹ́ **10+**
 *  Ẹ̀yà WordPress ** 2.8.0 tàbí ju bẹ́ẹ̀ lọ **
 *  Dánwò dé **3.0.5**
 *  Èdè
 * [English (US)](https://wordpress.org/plugins/hikari-tools/)
 * Àwọn àmì
 * [dependancy](https://yor.wordpress.org/plugins/tags/dependancy/)[framework](https://yor.wordpress.org/plugins/tags/framework/)
   [tool](https://yor.wordpress.org/plugins/tags/tool/)
 *  [Ìwòye Tó Péye](https://yor.wordpress.org/plugins/hikari-tools/advanced/)

## Àwọn ìbò

Kò tíì sí ohun táwọn èèyàn sọ nípa ẹ̀.

[Your review](https://wordpress.org/support/plugin/hikari-tools/reviews/#new-post)

[Wo gbogbo àwọn àgbéyẹ̀wò](https://wordpress.org/support/plugin/hikari-tools/reviews/)

## Àwọn Olùkópa

 *   [ shidouhikari ](https://profiles.wordpress.org/shidouhikari/)

## Ìrànlọ́wọ́

Nǹkan wà tí o fẹ́ sọ? Ṣé o nílò ìrànlọ́wọ́?

 [Wo àpéjọ ìrànlọ́wọ́](https://wordpress.org/support/plugin/hikari-tools/)

## Ṣe ìtọrẹ

Ṣé o fẹ́ ṣe àtìlẹ́yìn fún ìlọsíwájú plugin yìí?

 [ Ṣe ìtọrẹ sí plugin yìí ](http://Hikari.ws/wordpress/#donate)