scbFramework: How to use scbFramework in your plugins

Before making this framework public, I used to include the files with each plugin. As the number of plugins increased, I had to update each one every time I modified the framework.

After a while, I found a way to make all plugins on an instalation use the most recent framework version installed. This didn’t help much.

Finally, I made it a standalone plugin which you only need to install once.

So, currently, there are two possibilities:

Standalone plugin

As long as the scbFramework plugin is activated, your plugin will work perfectly. If you want to spare users from ugly error messages, you can include a small file, called scb-check.php. It will check that scbFramework is installed and if not, it will deactivate your plugin and display a friendly notice with an install link.

Including class files

If you don’t want to require users to install the standalone plugin, you can include all the class files with your plugin. You will also want to include another file, called load.php that takes care of autoloading classes as needed. (It will have to be placed in the same directory as the class files)

You can see a usage example by looking at the Front-end Editor plugin.

scbFramework: Introducing scbFramework

While developing plugins for WordPress, I found that one of the most time-consuming and error prone tasks was creating user-friendly settings pages.

That is how this framework was born. It’s basically a set of extensible classes that make plugin development faster. I already use it in most of my plugins.

It requires PHP5 and WordPress 2.5 or newer.

scbForms

This by far the most useful class. With it, you can create any type of form element without writing a single line of HTML.

scbOptions

This is a class that handles storing and updating plugin settings in a single field in the wp_options table.

scbAdminPage

This class extends scbForms to provide an easy way to create custom admin pages.

scbBoxesPage

This is an extension to the scbOptionsPage class that lets you easily create dashboard-like pages with collapsible boxes.

scbCron

This is a class that lets you create wp-cron schedules easier.

scbWidget

This class makes scbForms work with the new WP_widget class in WP 2.8.