Actions

Make your plugin compatible with LS4/de: Difference between revisions

From LimeSurvey Manual

(Created page with "==Die neuen Plugin-Ereignisse==")
(Created page with "Einige Plugin-Ereignisse von LS3 waren veraltet. Verwenden Sie die in LS4 eingeführten neuen Plugin-Ereignisse, um die alten Plugin-Ereignisse zu ersetzen. Weitere Informati...")
Line 34: Line 34:




Some plugin events from LS3 were deprecated. Use the new plugin events introduced in LS4 to replace the old plugin events.  
Einige Plugin-Ereignisse von LS3 waren veraltet. Verwenden Sie die in LS4 eingeführten neuen Plugin-Ereignisse, um die alten Plugin-Ereignisse zu ersetzen.  
For more information check our development manual on [[Plugin_events|plugin events]].
Weitere Informationen finden Sie in unserem Entwicklungshandbuch zu [[Plugin_events|plugin events]].


==Deprecated functions and methods==
==Deprecated functions and methods==

Revision as of 14:18, 3 August 2023


Technische Änderungen

Die neue XML-Konfigurationsdatei

Seit LimeSurvey 4.0 benötigen Plugins eine XML-Konfigurationsdatei, um in der Anwendung ausgeführt zu werden.

Der Grund dafür ist die Möglichkeit, Metadateninformationen wie Plugin-Autor, Support-E-Mail-Adresse oder Updater-Informationen zu speichern.

Diese XML-Datei ist in LimeSurvey 4 obligatorisch. Sie sollte sich im Stammverzeichnis des Plugins befinden. Weitere Informationen finden Sie in der Plugin-Entwicklung plugins

Beispiel:

Das neue Plugin-Verzeichnis

Das Plugin-Verzeichnis wurde in LimeSurvey 4 geändert. Aus Sicherheitsgründen befindet sich das Plugin-Verzeichnis aufgrund des neuen Plugin-Managers (Plugin-Uploader) jetzt im Upload-Verzeichnis (/upload/plugins). Bei manuellen Uploads empfehlen wir, Ihre Dateien in das neue Verzeichnis hochzuladen, um Fehlfunktionen der Software zu vermeiden.

Stellen Sie sicher, dass Sie das neue Verzeichnis ändern oder hinzufügen, wenn es in Ihrem Plugin fest codiert ist.

Beispiel:



Die neuen Plugin-Ereignisse

Einige Plugin-Ereignisse von LS3 waren veraltet. Verwenden Sie die in LS4 eingeführten neuen Plugin-Ereignisse, um die alten Plugin-Ereignisse zu ersetzen. Weitere Informationen finden Sie in unserem Entwicklungshandbuch zu plugin events.

Deprecated functions and methods

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: