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,

  1. Checks available Plugins
  2. Load Installed and active Plugins
  3. Instructs ClipBucket to what and where to load
ClipBucket Plugin Chart

ClipBucket Plugin Chart

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'));

}
Test Plugin Preview

Test Plugin Preview

Registering Anchors

The most important part of ClipBucket is ANCHORS, here is little tip on how to use anchors

Anchors are used to call functions that are registered for specified anchor name for example

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'}
Adding Custom Anchor

Adding Custom 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

Installing Test Plugin

Installing Test Plugin

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.

Test Plugin Preview

Test Plugin Preview

Custom Anchor Preview

Custom Anchor Preview

1 Comments

Comments are closed.

1 Star2 Stars3 Stars4 Stars5 Stars (8 votes, average: 4.13 out of 5)
Loading...