Plugin.php Hints and Tips
From e107 Wiki
e107 Wiki: English | Русский | Deutsch | Français | Magyar | Português | Български | Česky | Nederlands | Ελληνικά | Italiano | Norske | Polska | Slovenščina | Español | Svenska | Translate: Wiki | Page
This article aims to provide some hints and tips that can be employed in a plugins
Normally, these variables are set directly in the
Using the code outlined below, the values required can be obtained from the
Determining current action
This applies 2.0 release only
Whenever plugin.php is called from one of the core tasks (installer/upgrader/uninstaller/plugin scanner) the array variable $plug is set. Fields which are present depend on the circumstances. In most cases the relevant entries from the plugin_table database entry are included if the plugin has been installed.
In many cases $plug['plug_action'] is set to indicate the current action:
This information is sometimes relevant to assist plugin.php in determining the values to return.
Determining if a plugin is installed
To check whether a plugin is installed, call:
where $plugname is the plugin name (directory name).
The function returns TRUE if installed, FALSE otherwise.
0.7.9 to 1.0.x Versions
This applies to 0.7.9 and above
All installed plugins are entered into the $pref['plug_installed'] array - the array index is the path of the plugin (as a directory name) and the data is the current version.
So, the contents of a typical array might be:
This information can be used in two ways:
Writing safe plugins
Read Wiki article integrate with e107 for safety tips.