Recent Topics

1 Jul 01, 2006 14:26    

With the latest cvs build (1st July, 2006), can plugins do the following:

Enable and Disable their own events?
The user can manually do this via the plugin's settings page.

Customize their Settings Page?
So in the settings i can just have a button saying 'Go to here to customize this plugin' which redirects the user to a custom made page in the Tools section of b2evolution or whatever.

Save settings themselves?
Can plugins say $this->savesettings($name,$value), and save the setting
If So, Do settings need to be specified in DefaultSettings in order to be used in the save settings function.

Plugin's filename need to end with '.plugin.php' ?

Plugin's directory need to end with '_plugin' ?

Plugin's Class Name need to end with '_plugin' ?

And also another question, say i have a group of plugins, lets say panels.
so i have the 'panels_plugin' folder, now inside this folder i have several plugins: _panels.plugin.php, _categories.plugin.php, _welcome.plugin.php etc.
Will b2evolution automaticly handle the loading? When _panels.plugin.php NEEDS to be loaded first as the others are dependent on it.

And yeh with the above example say i have the panels inside '/panels_plugin/panels/', will b2evolution handle this? Or will it have to be done manually?

So what i would really like is the following layout:
/lightality_plugin/
_lightality.plugin.php
/lightality_plugin/panels/
_panels.plugin.php
/lightality_plugin/panels/includes/
_welcome.panel.php
_categories.panel.php
[ etc ]

So what are your thoughts on making this possible / easy to do / etc?

Cheers if all these questions get answered i'll be one happy man. :D

2 Jul 01, 2006 18:53

balupton wrote:

Enable and Disable their own events?
The user can manually do this via the plugin's settings page.

Just look at the Plugin class: enable_event() and disable_event() are there. So, yes.

Customize their Settings Page?
So in the settings i can just have a button saying 'Go to here to customize this plugin' which redirects the user to a custom made page in the Tools section of b2evolution or whatever.

PluginSettingsEditDisplayAfter() gets called after the settings form. So, yes.

Save settings themselves?
Can plugins say $this->savesettings($name,$value), and save the setting
If So, Do settings need to be specified in DefaultSettings in order to be used in the save settings function.

Yes, of course can plugins save settings themselves. They have a PluginSettings object and can just do $this->Settings->set( 'foo', 'bar' ) - but to make them permanent they must call the Settings's dbupdate() method (we had this before, haven't we?).

Settings that are not defined in GetDefaultSettings() can be used, but won't show up anywhere automatically.

Plugin's filename need to end with '.plugin.php' ?

Plugin's directory need to end with '_plugin' ?

Plugin's Class Name need to end with '_plugin' ?

3x yes.

And also another question, say i have a group of plugins, lets say panels.
so i have the 'panels_plugin' folder, now inside this folder i have several plugins: _panels.plugin.php, _categories.plugin.php, _welcome.plugin.php etc.
Will b2evolution automaticly handle the loading? When _panels.plugin.php NEEDS to be loaded first as the others are dependent on it.

You could say that the panel plugins "require the plugin" panels_plugin (GetDependencies method) and then require_once() the file in each of the panel plugin's source files.

And yeh with the above example say i have the panels inside '/panels_plugin/panels/', will b2evolution handle this? Or will it have to be done manually?

That's not supported yet. Currently b2evo only scans the plugins/ folder and *_plugin subfolders thereof for available plugins (in the Plugins admin section). When loading, it first tries the *_plugin folder and than the general plugins/ folder.
This would require to store the path of the plugin's classfile in T_plugins and use this, when loading the plugin.

I've just implemented this locally, but no promise that it gets committed.

Cheers if all these questions get answered i'll be one happy man. :D

So you are.. :)

3 Jul 02, 2006 01:50

Towards:

Plugin's filename need to end with '.plugin.php' ?
Plugin's directory need to end with '_plugin' ?
Plugin's Class Name need to end with '_plugin' ?
Answer: 3x yes.

Couldn't say _panels.plugin.php do the following:

FOR each file in 'panels' dir
// Panels will be like: '_name.panel.php'
CALL Panels->register <-- name.'_panel', 0, -1, NULL, filename
END FOR

That would work wouldn't it?

Oh but then the panels would be loaded up before the panels plugin...
But that should not be a problem for the time being.

4 Jul 02, 2006 14:26

yes, something like that should work. BUT there are places where the "_".classname."_plugin.php" scheme gets used hardcoded, that would need to get checked for this.


Form is loading...