Jump to content

Creating a plugin system


paddy_fields

Recommended Posts

I've tried Googling for advice on this but I keep seeing conflicting ideas... time to ask the experts!

 

I'm creating a CMS system. This is nearly completed and has all of the core functionality that my main client base will require. However over time I would like to develop and offer additional plugins/bolt-on features, (that can be purchased additionally from the basic system)

 

Could a 'plugin system' be as simple as just making a seperate folder called 'plugins', and having each script in there seperately as 'plugin1.php', 'plugin2.php' etc

 

I could then store in the database details of whether the user owns the plugin, and fetch this to a variable...

if($plugin2==true){
include('plugin/plugin2.php')
}

Is this really a good way of doing this?

 

Any advice would be great.

Edited by paddyfields
Link to comment
Share on other sites

I see no problem with that. It's a design decision, and simple approaches are almost always better than complicated ones. If you're confident that using that approach does not allow the user to bypass it in any way, then it's as good as any other solution. Maybe even better because it's nice and simple. It really depends on how everything else is built and if a simple include is enough to properly implement the extra modules.

Link to comment
Share on other sites

Thanks, thats good to know.

 

I'm going to design the plugins so that they can be implemented without any fuss.

 

I've been reading up on the security side and the method below seems good enough to stop people accessing the plugins directly.

//at the top of the plugin
<?php if (!defined('PLUGIN')) exit; ?>

//before the plugin include
<?php define('PLUGIN', true); ?>


Then an conditional statement such as my previous post should keep anyone from messing with the script. Of course I need to be careful with the form/script that updates the database with new plugin purchases. I'm thinking a moat and drawbridge should do it!

Edited by paddyfields
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.