-
Notifications
You must be signed in to change notification settings - Fork 89
How to write Plugins for ARC2
ARC can be extended with third party plugins if those files follow certain conventions, as described on this page:
Name your extension MyPrefix_MyExtensionPlugin, save it as MyPrefix_MyExtensionPlugin.php, and place the file in the plugins directory. The prefix and the extension name must not contain underscores.
If you are using a prefix that differs from "ARC2" (e.g. "MyApp"), you can alternatively place the plugin in a sub-directory of plugins (e.g. plugins/myapp/MyApp_MyExtensionPlugin.php), for example as a bundle including additional files. The directory must have a lowercase name.
If you follow these conventions, ARC will be able to find and include your plugin:
...
$my_ext = ARC2::getComponent('MyPrefix_MyExtensionPlugin', $config);
...
In the class file itself, you should add your name, a basic description, and possibly a link to the ARC and/or Plugin website. You also have to define a parent Class (use Class if you don't extend a particular component).
Below, you can see a basic template for an ARC Plugin.
<?php
/*
homepage: ARC or plugin homepage
license: http://arc.semsol.org/license
class: ARC2 My Extension Plugin
author:
version: yyyy-mm-dd
*/
ARC2::inc('Class');
class ARC2_MyExtensionPlugin extends ARC2_Class {
function __construct($a = '', &$caller) {
parent::__construct($a, $caller);
}
function __init() {
parent::__init();
}
/* plugin code */
...
}