Why write a plugin?

Modifying SPIP to your own needs

SPIP has implemented a formal structure to enable modification and extension of the system in a manner which remains harmonious with the core code. The principle followed is that of "grafting" all manner of improvements and modifications on top of it (and removing such grafts when we want to without touching any code in our original core SPIP system). The possibilities are then so wide that the question becomes one of how to facilitate the installation, both on an individual implementation as well as a public distribution point of view, of all these types of customisations.

Technically, the introduction of the plugin mechanism opens up the following possibilities:
-  all files in the kernel can be overloaded [1] and all functions are systematically callable [2],
-  an application interface (API) is maintained through the definition of a large number of entry points (pipelines) built into the code.

Plugins are typically required for four different scenarios:

-  Functions and options: creating your first plugin, migrating and making your functions and options portable for both your own use and that of others.

-  The pipelines: injecting, when you activate the plugin, some code into the SPIP kernel and significantly altering its default behaviour.

-  Modifying the native files: absent any suitable pipeline, you can modify sections of the SPIP code without actually having to interfere with the kernel files themselves.

-  Rewrite your own code: inventing your own scripts which you can "graft on to the side" of the standard SPIP engine.

If none of these goals is your current concern, then you probably need not bother with the pages that follow :) However, you might still be very interested in what is available to you from the myriad of freely distributed plugins.


[1Overloading a file consists of instituting repeated read attempts of a nominated file so that it takes the the one assigned the highest (and most recently changed) priority. Schematically speaking, if you overload a file which has a value of "Good morning" with another file that has a value of "Good evening", then the screen will display "Good evening" and not "Good morning".

[2You can call any previously existing function from any file, so long as you have included at the start of your file a reference to the file that contains the function that you wish to use. This is particularly powerful, since the SPIP designers have implemented a plethora of functions offering standardised processing that you have no need to reprogramme yourself. As examples, there are lire_fichier (which reads a file), ecrire_fichier (which writes to a file), preg_files (which searches for a file), all of the SQL query commands and dozens of other functions which are simplified as much as possible using procedures contained with the SPIP source code. See the documentation of the code to find out more about them.

There is a substantial list of available plugins now (which are completely open if you wish to review the constituent code)

Author Mark Published : Updated : 23/07/23

Translations : català, corsu, English, Español, français, italiano, Nederlands