(Added draft of Writing Java Plugins article) |
(Article contents proof-read) |
||
Line 1: | Line 1: | ||
__TOC__{{CKFinder 2.x Writing Plugins Introduction}} | __TOC__{{CKFinder 2.x Writing Plugins Introduction}} | ||
− | == Creating a | + | == Creating a Plugin == |
− | ==== | + | ==== Step 1: Create plugin folder ==== |
− | ==== | + | ==== Step 2: Add plugin definition ==== |
− | ==== | + | ==== Step 3: Enable plugin ==== |
− | == Java | + | == Java Plugin System == |
=== Events === | === Events === | ||
− | CKFinder provides several events that can be used to extend the functionality of | + | CKFinder provides several events that can be used to extend the functionality of a CKFinder application. Assigning a class (also known as an ''event handler'') to an event will cause that function to be called at an appropriate point in the main CKFinder code to perform whatever additional task(s) the developer considers useful at that point. Each event can have multiple event listeners assigned to it. |
− | ==== Available | + | ==== Available Events ==== |
{{CKFinder_2.x hooks table}} | {{CKFinder_2.x hooks table}} | ||
{{#CUSTOMTITLE:Writing Java Plugins}} | {{#CUSTOMTITLE:Writing Java Plugins}} |
Revision as of 21:38, 16 May 2011
Contents
The main advantages of plugins are:
- Upgrades are much easier.
- The plugin code is stored in a single place.
- Plugins can be easily disabled when they are not needed anymore.
Common use cases:
- Adding a new server-side command (i.e.
fileditor
andimageresize
plugin). - Working with uploaded files (i.e.
watermark
plugin). - Extending information returned by the
Init
command (i.e.imageresize
plugin).
Creating a Plugin
Step 1: Create plugin folder
Step 2: Add plugin definition
Step 3: Enable plugin
Java Plugin System
Events
CKFinder provides several events that can be used to extend the functionality of a CKFinder application. Assigning a class (also known as an event handler) to an event will cause that function to be called at an appropriate point in the main CKFinder code to perform whatever additional task(s) the developer considers useful at that point. Each event can have multiple event listeners assigned to it.
Available Events
Hook | Since | Description |
---|---|---|
AfterFileUpload | 2.0 | Executed after successful file upload. |
BeforeExecuteCommand | 2.0 | Executed before a server side command is executed. |
InitCommand | 2.0 | Executed straight before sending the result of the Init command. |