Creating plugins for ClipBucket is pretty easy, all you have to do is write down your code, register your anchors and tada !! your plugin is ready to use
Introduction
ClipBucket’s new Plugin system works in following manner,
- Checks available Plugins
- Load Installed and active Plugins
- Instructs ClipBucket to what and where to load
Now we will start creating plugin
Setting up plugin File
Naming File
- Plugin Folder
- ./plugins
- Plugin File Placement
- ./plugins/your_plugin_file.php
- ./plugins/some_folder/your_plugin_file.php
- Plugin Installatin and Uninstalling *optional*
- ./plugins/some_folder/install_your_plugin_file.php
- ./plugins/some_folder/uninstall_your_plugin_file.php
Adding Plugin Details
<?php /* Plugin Name: Your Plugin Name Description: Your Plugin Description Author: Author Name Author Website: http://clip-bucket.com/ ClipBucket Version: 2 Version: 1.0 Website: http://clip-bucket.com/plugin-page */ . . . . code goes here... . . ?>
Writing Sample Code
After setting file, we can use it in our ClipBucket but as there is nothing much to do in the file so we will write some code
here I am creating a test global announcement
<?php /* Plugin Name: Your Plugin Name Description: Your Plugin Description Author: Author Name Author Website: http://clip-bucket.com/ ClipBucket Version: 2 Version: 1.0 Website: http://clip-bucket.com/plugin-page */ if(!function_exists('test_plugin')) { function test_plugin() { echo '<div style="background-color:#F7F7F7; border:1px solid #999; padding:5px; margin:5px; text-align:center">'; echo "My Test Announcement Goes here..."; echo '</div>'; } //Load this on every page register_anchor_function(array('test_plugin'=>'global')); }
Registering Anchors
The most important part of ClipBucket is ANCHORS, here is little tip on how to use anchors
regiser_anchor_function(‘anchor_name’,’function_name’);
function_name will be called whereever anchor_name is loaded in template ie
{ANCHOR place=’anchor_name’}
Adding More Anchors
<?php /* Plugin Name: Your Plugin Name Description: Your Plugin Description Author: Author Name Author Website: http://clip-bucket.com/ ClipBucket Version: 2 Version: 1.0 Website: http://clip-bucket.com/plugin-page */ if(!function_exists('test_plugin')) { function test_plugin() { echo '<div style="background-color:#F7F7F7; border:1px solid #999; padding:5px; margin:5px; text-align:center">'; echo "My Test Announcement Goes here..."; echo '</div>'; } //Load this on every page register_anchor_function('test_plugin','global'); register_anchor_function('test_plugin','my_sample_anchor'); }
Now Open ./styles/{TEMPLATE}/layout/index.html and paste this where you want to display your announcement
{ANCHOR place='my_sample_anchor'}
Installing Plugin
now what you have to is goto admin panel >> Plugin Manager >> and click on INSTALL so you can use your plugin, once you click it , Installed plugin will be displayed on very top of the page while available plugins are displayed belowed them
Testing Plugin
After Successful installation, you will be able to see your anncoument on two places that we defined. this is very basic tutorial for how ClipBucket plugins work.