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.

Link to comment
https://forums.phpfreaks.com/topic/286310-creating-a-plugin-system/
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.

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.