The only required file to build a plugin is the Addon.ini file. Within this file, you indicate a number of things that gpEasy uses to make everything work properly.

  • The name of your plugin
  • Which php scripts in your plugin should be executed and when
  • Which versions of gpEasy your plugin is compatible with
  • Which gadgets, special pages or admin pages your plugin creates
  • Which hooks (filters and actions) your plugin interacts with

Example

Here's an example of an Addon.ini file for a simple plugin. The first few lines of code just tell us a little about the plugin.

The plugins actions begin with the line that reads [Gallery_Style]. This line tells gpEasy that this plugin would like to interact with the Gallery_Style hook. Everything after that line and before the next hook declaration will be interpreted as part of the Gallery_Style hook.

Addon_Name = 'Tall Gallery Style'
Addon_Version = 1.0

;The Gallery_Style hook
[Gallery_Style]
value = '{$addonRelativeCode}/gallery.css'

There are a number of options for passing information to the Gallery_Style hook, but we use the simplest: value. By assigning the value {$addonRelativeCode}/gallery.css, we're telling gpEasy to use the gallery.css file in the plugin's folder for the gallery style.

Note: the value option for hooks is only available as of gpEasy 2.0b3.

Variables

You probably notice in the previous example the use of {$addonRelativeCode}. This is one of a few variables that are replaced in the Addon.ini file before parsed to help developers create plugins that work on systems regardless of where they're installed. Here's a list of available variables.

{$addon}
This will be the name of the folder the plugin is actually installed in.
{$dataDir}
This will contain the value of the root folder for the installation. Note, to access the /data folder with $dataDir, you would use {$dataDir}/data. Available since 2.0b3.
{$dirPrefix}
If your installation is at http://example.com, $dirPrefix would be empty. However, if your installation is at http://example.com/gpEasy, then $dirPrefix would /gpEasy.
{$addonRelativeData}
Each plugin is allocated a folder within the /data folder. The equivalent path is {$dirPrefix}/data/_addondata/{$addon}/
{$addonRelativeCode}
This is the relative path for the code of your addon. This is equivalent to {$dirPrefix}/data/_addoncode/{$addon}/

News

Typesetter 5.1
8/12/2017

Typesetter 5.0.1 is now available for download. 5.1 includes bug fixes, UI/UX improvements, ... Read More

Over 8 Times Faster Than Wordpress
5/3/2016

We've known for a long time that Typesetter is fast. It's something we take pride ... Read More

More News

creisi productions

Dienstleistungen von creisi productions, Luzern (Schweiz): * Konzeption, Planung und Erstellung Ihres Internet-Auftritts * Betreuung und Aktualisierung/Pflege Ihrer Website * ...

Find out more about our Provider Spotlight

Log In

  Register