Quoting Michael M Slusarz <slus...@horde.org>:
Again, there's no need to autoload. Just because we have an
autoloader doesn't mean that require can't be used. In this
particular case, it is a heck of a lot easier to simply require the
file directly instead of trying to manipulate autoloading to work.
Point taken, but in this case where would I require it _from_?
Assuming I can do all the work inside my child class (example below),
I wouldn't have a reason to edit any core files or add any others
myself.
To ensure a class is autoloadable, just directly include/require
the file at some point prior to the class being accessed.
Isn't that just manual loading?
Yes. Again, there's nothing wrong with this. Autoloading is
important when you are distributing code. When you are doing
something locally, there's no problem to include a single file when
necessary.
I guess I think like a distributor ;) I would be updating the horde
distro once in a while, and for those times it'd seem easier (to me)
if my own code additions were in the form of an "overlay" rather than
a patch-set. No distro files being touched seems better.
Think I will need to butcher Compose.php anyway though, since my class
won't have access to the headers within itself at invocation time ...
(Unless there is a way to retrieve them from its constructor?)
Not sure what you mean by this(?) Extending a mail transport
object, you have access to all the outgoing headers of the message.
You're quite right, sorry. I was focusing on the
IMP_Compose::sendMessage() method where the mailer's invoked, without
looking at the mailer's own send() method since that's where we end
up. Extending that method should be all I need to do then (uh, right?)
So to cover more fully the intended approach (yes, still abusing autoloading):
File [HORDEDIR]/lib/Ext/Smtpcustom.php
<?php
class Horde_Ext_Smtpcustom extends Horde_Mail_Transport_Smtphorde {
public function send($recipients, array $headers, $body) {
// Do my stuff, set $_params as needed
parent::send($recipients, $headers, $body);
}
}
?>
Testing this later today if I get time. Seems like it should be
adequate though, no?
Robin Bankhead
--
imp mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: imp-unsubscr...@lists.horde.org