Actions

Faceți pluginul compatibil cu LS4

From LimeSurvey Manual

Revision as of 10:22, 31 October 2023 by Maren.fritz (talk | contribs) (Created page with "Directorul de pluginuri este modificat în LimeSurvey 4. Din motive de securitate, directorul de pluginuri se află acum în directorul de încărcare (/upload/plugins) datori...")


Modificări tehnice

Noul fișier de configurare XML

Începând cu LimeSurvey 4.0, pluginurile au nevoie de un fișier de configurare XML pentru a fi rulat în aplicație.

Motivul pentru aceasta este posibilitatea de a stoca informații despre metadate, cum ar fi autorul pluginului, e-mailul de asistență sau informațiile de actualizare.

Acest fișier XML este obligatoriu în LimeSurvey 4. Ar trebui să fie localizat în directorul rădăcină al pluginului. Pentru mai multe informații, verificați dezvoltarea pluginurilor plugins

Exemplu:

Noul director de pluginuri

Directorul de pluginuri este modificat în LimeSurvey 4. Din motive de securitate, directorul de pluginuri se află acum în directorul de încărcare (/upload/plugins) datorită noului manager de plugin (Plugin uploader). Pentru încărcările manuale, vă recomandăm să încărcați fișierele în noul director pentru a evita funcționarea defectuoasă a software-ului.

Asigurați-vă că modificați sau adăugați noul director dacă acesta este codificat în plugin-ul dvs.

Example:



The new plugin events

Some plugin events from LS3 were deprecated. Use the new plugin events introduced in LS4 to replace the old plugin events. For more information check our development manual on 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: