Actions

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

From LimeSurvey Manual

No edit summary
(Created page with "LimeSurvey 4のコードベースや構造が変わったため、使われなくなったメソッドや関数がたくさんあります。 この問題を解決するには...")
Line 39: Line 39:




Since the code base or structure of LimeSurvey 4 changed, there are a lot of methods or functions that are not used anymore.
LimeSurvey 4のコードベースや構造が変わったため、使われなくなったメソッドや関数がたくさんあります。
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.  
この問題を解決するには、まずconfig.phpファイルでデバッグモードを有効にしてからプラグインのページに移動する必要があります。存在しなくなったメソッドは、エラーページに表示されます。


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.  
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.  

Revision as of 02:57, 14 March 2021


技術的な変更

新しいXML構成ファイル

LimeSurvey 4.0以降、プラグインをアプリケーションで実行するにはXML構成ファイルが必要になります。

これは、プラグインの作成者、サポートの電子メール、アップデートなどのメタデータ情報を保存できるようにするためです。

このXMLファイルは、LimeSurvey 4では必須です。プラグインのルートディレクトリーに配置する必要があります。詳しくは、プラグイン開発のプラグインの項をご覧ください。

例:

新しいプラグインディレクトリ

LimeSurvey 4では、プラグインディレクトリーが変更されています。セキュリティ上の理由から、新しいプラグインマネージャー(Plugin uploader)により、プラグインディレクトリーはアップロードディレクトリ(/upload/plugins)に配置されるようになりました。 手動でアップロードする場合は、ソフトウェアの誤動作を避けるため、新しいディレクトリーにアップロードすることをお勧めします。

プラグインにハードコーディングされている場合は、必ず新しいディレクトリーを変更または追加してください。

例:



新しいプラグインイベント

LS3の一部のプラグインイベントが非推奨となりました。古いプラグインイベントの代わりに、LS4で導入された新しいプラグインイベントを使用してください。詳しくは、プラグインイベントに関する開発マニュアルをご覧ください。

非推奨の関数とメソッド

LimeSurvey 4のコードベースや構造が変わったため、使われなくなったメソッドや関数がたくさんあります。 この問題を解決するには、まずconfig.phpファイルでデバッグモードを有効にしてからプラグインのページに移動する必要があります。存在しなくなったメソッドは、エラーページに表示されます。

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.


例:



ベストプラクティス

SVGファイルを避ける

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 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.


例: