Fudla! Plugin Core Code Changes [message #165009] |
Fri, 15 April 2011 19:13 |
|
Dayo
Messages: 101 Registered: April 2011
Karma:
|
Senior Member |
|
|
Right. I have managed to get a plugin (to be called Fudla) up and running to integrate Joomla! and FUDforum.
Still some work to do on the user integration but the visual integration is done and user stuff will just be behind the scene database calls.
A few code hacks were needed. Almost as many as my previous non-plugin approach which I abandoned but I suppose I got familiar with the working of FUDforum plugins.
Hopefully these can be rolled into the next release as they have been structured in a generic manner which should make them useful for other plugins.
The main items are:
- Two hooks have been added.
- INITCORE: This allows a plugin to run code before after the program has been loaded but before any output. including headers, have been sent.
It turned out that core.inc was not the right place for this as some things, such as the fud_theme constant (Why aren't constants in upper case as per convention? Really confusing) have not yet been defined by the end of this loading. So added to the bottom of index.php
- PROCESS_OUTPUT_DATA: This allows a plugin to run code on the output html before it is sent to the browser. Implementing this created some complications as it needed buffering the output to a variable.
- The program worked against implementing the "PROCESS_OUTPUT_DATA" hook as some files flush output to the browser and then run some housekeeping code in the background.
As the hook needed buffering to a variable, such pages could not be integrated since the buffer got flushed. So I have moved all the housekeeping code to the root index file to be run in the background after the processed output has been sent.
Basically, we still do the same thing as before but in a different and more flexible way. Hopefully the devs can optimise this if required.
The patch is attached and the plugin will follow in due course. I am a weekend warrior coder so further progress might be next weekend ... depending on how busy I am.
****EDIT 16 Apr 2011****
- Changed the attachment as one file was missed out of the changes.
- The database prefix was also hardcoded in one location
- Also, some headers will have been sent by the time the INITCORE hook is called. So INITCORE hook added back to original proposed location in core.inc (not used by this plugin but potentially for others - more hooks is good) and a replacement added to previous position. Main requirement here is that redirection headers have not been sent and all params initialised.
****EDIT 19 Apr 2011****
Attachment deleted as now out of date.
[Updated on: Tue, 19 April 2011 01:56] Report message to a moderator
|
|
|