Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best place to define plugins' constants?
#2
Carlos Wrote:Some plugins allow inserting constant definitions (define('WHATEVER','something');) to set custom values, usually near the beginning of the plugin file.

IMO the problem with this is, if the developer releases a new version, you have to remember to edit those lines in the new file before updating.

A simple alternative could be telling the user to insert those definitions in the root gsconfig.php

Another could be that e.g. MyPlugin did what GetSimple does: check if a myplugin/mypluginconfig.php file exists, if not it renames the (bundled) myplugin/temp.mypluginconfig.php. However I don't like this for small plugins...

What do you think about this? Other ideas?

Another idea is: use only constants for default settings and every setting is changeable using an administration page for the plugin and the settings are stored in a file in data/other. If there is no settings file, the defaults are used.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply


Messages In This Thread
Best place to define plugins' constants? - by mvlcek - 2011-07-15, 01:14:11



Users browsing this thread: 2 Guest(s)