Getting started with plugins

Creating a plugin for ProofBuddy can be a relatively simple process, although it does take a basic knowledge of PHP.  It's pretty much the same idea that an oil change is relatively easy for someone with a little knowledge of how cars work but difficult if you've never opened your hood.  But don't worry if you've never looked at PHP before.  It's a fairly easy language to pick up.

PHP

ProofBuddy plugins are written in PHP.  In fact, ProofBuddy itself is written in PHP which is why most of the files you uploaded end with .php. So your first step is to brush up on you PHP skills, and the best place to start is the PHP website.

Don't get too bogged down right now if you're overwhelmed.  Depending on how complicated you want your plugin  to be you may be able to get by with just copying and pasting code from here.

JavaScript

We use JavaScript to make ProofBuddy more interactive on the admin side.  It's what allows you to drag the menu boxes around.

On the admin side, there are a set of JavaScript libraries already loaded and ready to use.  They are Prototype and Script.aculo.us.  Some pages also use the Yahoo UI 2 library and it is fairly trivial to load it if needed.  Of course you can load in any external JavaScript files you need or put the JavaScript directly into your plugin files.

ProofBuddy API

An API is an interface (it stands for Application Programming Interface) that lets you interact with a program without knowing, or caring, how it works.  ProofBuddy exposes a set of PHP classes that you can use to view pretty much any information in ProofBuddy - albums, orders, clients, and pretty much anything else.

Plugin Header

Your plugin file needs to start with the following header.  It's how ProofBuddy knows that it's a plugin.  Otherwise it won't show up in the list.

If your plugin is made up of multiple .php files then only include this in the main one.

<?php
/**
 * Plugin Name:
 * Plugin Version:
 * Plugin URL:
 * Plugin Author:
 * Author URL:
 * Plugin Description:
 */
?>

The only required line is Plugin Name: Everything else is optional, but recommended. At the very least you'll also want a description to explain what your plugin does. And you probably want to include at least one of the URLs so you can get a little traffic if you decide to share your plugin.

Subpages

Leave a Reply