CKFinder functionality can be extended with server side plugins. Althought the full source code of CKFinder server connector is available and it can be changed in any way, a much better way of enhancing CKFinder connector is to create a plugin.
The main advantages of plugins are:
- Upgrades are much easier.
- The plugin code is in a single place.
- Plugins can be easily turned off when are not needed anymore.
Common use cases:
- Adding new server side command (i.e. fileditor and imageresize plugin).
- Working with uploaded file (i.e. watermark plugin).
- Extending the information returned by the Init command (i.e. imageresize plugin).
Contents
Creating a plugin
Step1: Create plugin folder
Create a directory for your plugin inside of the "plugins" directory (by default CKFinder comes with three plugins: dummy, fileeditor, imagreresize). Let's use "myplugin" as the plugin name and use the same name for our new folder.
Step2: Create plugin file
Inside of your plugin's folder ("myplugin") create an empty file named plugin.php.
Step3: Add plugin definition
// Let's create an empty PHP file for now
Step4: Enable plugin
Add an include_once/require_once statement in the PHP configuration file (config.php):
include_once "plugins/myplugin/plugin.php";