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.

Comments (4)

  • Joel says:

    Lets say I wanted to convert FEE to use the standalone plugin. What are the steps?

    Currently, I have the scb-framework activated as a plugin.

    I have also replaced this:

    // Load scbFramework
    //require dirname(__FILE__) . ‘/scb/load.php’;

    with this:

    // Check for scbFramework
    require_once dirname(__FILE__) . ‘/scb-check.php’;
    if ( ! scb_check(__FILE__) ) return;

    in plugins/front-end-editor/front-end-editor.php…

    But I get this error:

    Fatal error: Call to undefined method scbAdminPage::register() in C:\xampp\htdocs\example\wp-content\plugins\front-end-editor\front-end-editor.php on line 59

    • Joel says:

      Comparing AdminPage in scbFramework with AdminPage in FEE:

      I see that there is register() in FEE’s AdminPage and not in scbFramework’s AdminPage…

      Also, load.php in FEE is different than load.php in scbFramework. FEE has ‘class scbLoad3′ where scbFramework has ‘class scbLoad2′ and the code is different between scbLoad2 and scbLoad3.

      I want to use the scbFramework for my custom plugin as well as for FEE but I’m not seeing how to make it all come together :-/

    • scribu says:

      You’re getting that error because I haven’t had the chance to release a new stable version of the standalone plugin yet.

      Just install the development version of scbFramework.

      You don’t need to alter FEE at all.

  • Joel says:

    Awesome it works! You’re the best scribu :)