[wp-hackers] Plugin developer "toolbox"

Chris Taylor - stillbreathing.co.uk mrwiblog at gmail.com
Thu Mar 24 13:49:02 UTC 2011


Hi all,

I've just started on a new plugin called WP IDE which will provide
option for creating plugins within WordPress using a
syntax-highlighted editor, and other features associated with desktop
IDEs. The IDE will contain a form to generate the basic code for a
general-purpose plugin, including creating classes with custom
database tables and all the CRUD code, empty admin screens etc. As
part of that development I'm creating a "toolbox" of classes that will
help me to create plugins more easily. So far I've started work on:

1) A FormBuilder class: allows you to create forms with fieldsets and
form elements, then generate the HTML for those. This class will also
handle HTML5 form elements, and will warn about non-standard
attributes. [1]

2) A Pagination class: allows you to paginate items

3) A DataTable class: allows you to create tables of data easily [2]

4) A PluginOptions class: allows you to save options for a plugin
easily, enforcing rules about the data saved

I have a few questions. Firstly is there anything like this already
available. Secondly, while I'll no doubt think of other "tools" that
will make my plugin development easier in the future, what could you
add to this list? Thirdly, do any of you have other methods, code
libraries etc to help you stop writing boilerplate code?

WordPress provides a lot of functions to make a lot of writing a
plugin easier (user management, database access etc) but a set of
classes like this may be useful to many of us.

regards,

Chris

[1] Some example code:

$form = new FormBuilder("myform");
$fieldset1 = new FormGroup("fieldset1", "cssclass1");
$username = new FormItem("text", "username", "Enter your username");
$fieldset1->addItem($username);
$fieldset2 = new FormGroup("fieldset2", "cssclass2");
$password = new FormItem("password", "password", "Enter your password");
$fieldset2->addItem($password);
$form->addGroup($fieldset1);
$form->addGroup($fieldset2);
$form->paged = true;
echo $form->getHTML();

[2] I did something like this a long while ago:
http://www.stillbreathing.co.uk/experiments/datatable/


More information about the wp-hackers mailing list