|
Posted by Alan Little on 11/19/02 11:47
Carved in mystic runes upon the very living rock, the last words of Chung
Leong of comp.lang.php make plain:
> Alan Little wrote:
>> I'm not sure how this applies to plugins (then again, I'm not familiar
>> with your usual rant about using includes as functions :)
>
> As I understood it, your plugins are basically naked code sitting in
> files that get included.
Correct.
> That's why direct access through a web address is a problem. If the
> code is wrapped in a function or in a class, then you wouldn't have
> that problem, as nothing would happen when PHP processes the file.
OK. When you said, "using includes as functions", I took it to mean
having a bit of code that's called from various places in the main code,
and putting it in an included file, rather than a function. I once had a
date-selector generator that I did that with, but long ago converted it
to a function. I'm not trying to be a smart@$$, I just didn't see how
that applied to plugins.
But as far as wrapping the code in a function or class in order to
prevent it being executed directly, that's another way of doing it, but I
like the define() approach better; I just include the file and it's done,
rather than having to include it and then invoke the function.
--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
Navigation:
[Reply to this message]
|