[wp-hackers] Plugin main file name
Stephen Rider
wp-hackers at striderweb.com
Tue Aug 26 04:52:49 GMT 2008
On Aug 25, 2008, at 11:38 PM, Andrew Ozz wrote:
> I was actually thinking more along these lines:
>
> 1. Activating a plugin:
> - get_option('my_main_file'); This option contains the path to the
> file and the version number.
> - if true -> check the version
> - if current main.php is newer -> update the option
> - else -> add the option
>
> 2. When loading a plugin check if class is defined/functions exist,
> etc. If not:
> - get_option('my_main_file');
> - include main.php at the path from the option and define the class/
> add constant etc.
>
> Can also look at get_option('active_plugins') to figure out when
> more than one plugin will need main.php.
The problem with loading the shared code as you go is that functions
and classes cannot be re-defined. So if an older version of the
shared code loads first, then a later (and newer) plugin trying to use
it might not work.
Or... What? Each plugin compares its shared file version against one
recorded in the settings table? I don't see how that avoids the
double-load problem.
Stephen
Good night All...
More information about the wp-hackers
mailing list