[wp-hackers] Class conflicts with plugin frameworks

John Blackbourn johnbillion+wp at gmail.com
Thu Apr 28 02:06:07 UTC 2011


On 28 April 2011 03:00, Dion Hulse (dd32) <wordpress at dd32.id.au> wrote:
> The best way is to just do a
> if ( ! class_exists('myclass') ) include framework.php.
>
> of course, if you only want to include the latest version, i'd do something
> such as :(ie. this copy of hte plugin includes version 31 of the framework)
> in global scope upon plugin inclusion:
> $GLOALS[mvcversion] = max (   $GLOALS[mvcversion], 31 )
> add_action plugins_loaded:
>    if ( 31 ==   $GLOALS[mvcversion] &&  ! class_exists('myclass')  ) //This
> plugin has the latest version, and it's not already included
>         include framework.php.

That is a pretty nifty method right there. Consider it borrowed. Thanks Dion.


More information about the wp-hackers mailing list