Go to the FreeLists Home Page Home Signup Help Login
 



[dokuwiki] || [Date Prev] [02-2007 Date Index] [Date Next] || [Thread Prev] [02-2007 Thread Index] [Thread Next]

[dokuwiki] Re: language files in action plugins

  • From: Ben Coburn <btcoburn@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sun, 4 Feb 2007 21:34:45 -0800

On Feb 4, 2007, at 20:07, Chris Smith wrote:

Ben Coburn wrote:


Does anyone see any major issues I've overlooked?
Currently a plugin can include multiple "components" of the same type, "plugins/<plugin name>/<plugin type>/<component name>.php". This is particularly important for syntax plugins, less so for other plugin types.


I think using a real space in the effective plugin name to separate the plugin from the component part will work. Real spaces would still be banned from plugin folder names. So for example:

inc/pluginutils.php line 44 (plugin_list) goes from
$plugins[] = $plugin.'_'.substr($component, 0, -4);
to
$plugins[] = $plugin.' '.substr($component, 0, -4);

and

inc/pluginutils.php line 79 (plugin_load) goes from
list($plugin, $component) = preg_split("/_/",$name, 2);
to
list($plugin, $component) = explode(' ', $name);


To utilise generalised localisation and configuration functions you'll need to store the directory name along with the class name.


Isn't it the other way around? It looks like the class name is only needed to instantiate the class instance. The getPluginType, getPluginName, and getPluginCommponent methods could be rewritten to pull their values from member variables that would be set when the instance was created.

So getPluginName would look something like this:
function getPluginName() {
        if (is_null($this->pname)) {
                list($t, $p, $n) = explode('_', get_class($this), 4);
                return $n;
        } else {
                return $this->pname;
        }
}

And the plugin loading code would gain some lines like:
$DOKU_PLUGINS[$type][$name]->pname = $name;


If it is, it may be worthwhile working out something to handle versioning at the same time. Users of helper plugins should be able to ensure they get the version they need.


The idea here is to get away from "magic" or restrictive naming conventions. How do you see this helping with versioning? Would adding a well documented getPluginVersion method to the plugin base class help? Maybe have it return a simple int to avoid version name parsing issues?


Regards, Ben Coburn


-------------------
  silicodon.net
-------------------

--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist




[ Home | Signup | Help | Login | Archives | Lists ]

All trademarks and copyrights within the FreeLists archives are owned by their respective owners.
Everything else ©2007 Avenir Technologies, LLC.