Actions

Spraw, aby Twoja wtyczka była kompatybilna z LS4

From LimeSurvey Manual

Revision as of 16:13, 12 September 2023 by Maren.fritz (talk | contribs) (Created page with "==Przestarzałe funkcje i metody==")


Zmiany techniczne

Nowy plik konfiguracyjny XML

Od wersji LimeSurvey 4.0 wtyczki wymagają pliku konfiguracyjnego XML, aby mogły zostać uruchomione w aplikacji.

Powodem tego jest możliwość przechowywania informacji o metadanych, takich jak autor wtyczki, adres e-mail pomocy technicznej lub informacje o aktualizatorach.

Ten plik XML jest obowiązkowy w LimeSurvey 4. Powinien znajdować się w katalogu głównym wtyczki. Aby uzyskać więcej informacji, sprawdź rozwój wtyczki plugins

Przykład:

Nowy katalog wtyczek

Katalog wtyczek został zmieniony w LimeSurvey 4. Ze względów bezpieczeństwa katalog wtyczek znajduje się teraz w katalogu przesyłania (/upload/plugins) ze względu na nowego menedżera wtyczek (Plugin uploader). W przypadku przesyłania ręcznego zalecamy przesłanie plików do nowego katalogu, aby uniknąć nieprawidłowego działania oprogramowania.

Pamiętaj, aby zmienić lub dodać nowy katalog, jeśli jest on zakodowany na stałe w Twojej wtyczce.

Przykład:



Nowe wydarzenia dotyczące wtyczek

Niektóre zdarzenia wtyczek z LS3 zostały uznane za przestarzałe. Użyj nowych zdarzeń wtyczek wprowadzonych w LS4, aby zastąpić stare zdarzenia wtyczek. Więcej informacji znajdziesz w naszym podręczniku programowania na wydarzenia wtyczek.

Przestarzałe funkcje i metody

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: