I have completed the first phase of code resructuring. Remember the goal here is to load the minimum of code in all places – not just forum or forum admin pages. I have made some major strides but there is a still a lot that could and should be done in the area of big code files (like sf-database and sf-support) where it might be loaded becase just a single function is required.
A brief explanation on structure: sf-control is ALWAYS loaded. It's the core plugin file. ANY page load within WP back or front ends will load sf-control. 'Remote' files (like all the AHAH files for example) will load sf-control, as soon as the sf-config file is included.
In turn, sf-control attempts to determine if (a) we are loading a forum admin page or not or (b) we are loading the forum page or not. It attempts to redirect processing as apropriate and to only include the code files, hooks and constants that are required to satisfy that view. If a forum back end or front end is being loaded it then hands off processing as appropriate.
This has caused many new files to be defined – may be too many but we can possibly consolidate those later if we choose. In the process I have also renamed most code files to make them more readable. I have also defined new folders notable 'feeds', 'linking', 'library' and 'tags'.
As I say – we could take this a whole lot further by performing analysis on some of the bigger code files and breaking them down. It is worth doing but is a tedious task. In the meantime the real imperative is to understand the structure and to choose with care where new functions are placed.
To see what files are included at any time, the sf-debug routine 'show_includes()' can be used and a good place to pout it is in the footer.