Actions

Maak uw plug-in compatibel met LimeSurvey4

From LimeSurvey Manual

Revision as of 21:23, 12 March 2021 by Han (talk | contribs) (Created page with "==Verouderde functies en methoden==")


Technische wijzigingen

Het nieuwe XML-configuratiebestand

Sinds LimeSurvey 4.0 hebben plug-ins een XML-configuratiebestand nodig om in de applicatie gebruikt te kunnen worden.

De reden hiervoor is de mogelijkheid om metadata-informatie op te slaan, zoals plugin Author, e-mail te ondersteunen en voor updatersinformatie.

Dit XML-bestand is verplicht in LimeSurvey 4. Het moet in de hoofdmap van de plug-in staan. Meer informatie voor het ontwikkelen van plugins

Voorbeeld:


De nieuwe map plugin

De map plug-in is gewijzigd in LimeSurvey 4. Om veiligheidsredenen bevindt de plug-in-map zich nu in de upload-map (/upload/plug-ins) vanwege de nieuwe plug-inbeheerder (Plug-in-uploader). Voor handmatige uploads raden we aan om uw bestanden naar de nieuwe map te uploaden om softwarestoringen te voorkomen.

Zorg ervoor dat u de nieuwe map wijzigt of toevoegt als deze hard gecodeerd is in uw plug-in.

Voorbeeld:



De nieuwe plugin events

Sommige plug-in-events van LS3 zijn verouderd. Gebruik de nieuwe plug-in-events die in LS4 zijn geïntroduceerd om de oude plug-in-events te vervangen. Raadpleeg voor meer informatie onze ontwikkelingshandleiding over plug-in-events op https://manual.limesurvey.org/Plugin_events


Verouderde functies en methoden

Since the code base or structure of LimeSurvey 4 changed, there are a lot of methods or functions that are not used anymore. To fix this problem, you need to enable the debug mode on the config.php file first and then go to the plugin page. Any method that does not exit anymore will be shown on the error page.

Some of the methods are renamed in LS4 or are not used anymore. To be sure that your plugin works for both LS3 & LS4, check the version of LS before calling the method you need.


Example:



Best Practice

Avoid SVG files

For security (XSS) reasons, the upload of SVG Files is not possible. The Plugin uploader will ignore SVG files. Replace them by PNG or JPEG files. The upload of SVG files is possible only if you have access to the installation directory via ftp or other server tools (Upload any files at your own risks).


Avoid global constants

Avoid the use of global constants that can collapse with variables of the core application or other plugins like „ROOT_PATH“. Don‘t use global constant in general for plugin development.

Use Namespaces

Use namespace for better organization by grouping classes that work together to perform a task in your plugin. In that way you avoid using classes that are being used already in the core application.


Example: