Re: New hierarchy for payment processors?
| From: | Chuck Hagenbuch | Date: | Mon, 24 Jul 2000 14:57:32 +0000 |
| Subject: | Re: New hierarchy for payment processors? | ||
| References: | 1 2 | Groups: | php.pear |
| Request: | Send a blank email to php-pear+get-164@lists.php.net to get a copy of this message | ||
Quoting Stig Sæther Bakken <ssb@fast.no>:
> if (!extension_loaded('pfpro')) {
> // XXX we need to abstract away the ".so" here because
> // some OS'es use other suffixes (.dll on Windows, possibly .sl on
> HP-UX?)
> if (!dl('pfpro.so')) {
> die('Payment/Verisign.php: requires the "pfpro" PHP extension to
> be installed');
> }
> }
How about adding a method to the PEAR class so that PEAR authors can either
copy/customize it, or just include the PEAR class and use it as-is. Like:
// PEAR::checkExtension()
function checkExtension ($extension, $class = 'A class that you are using') {
if (!extension_loaded($extension)) {
if (!dl($extension . get_library_suffix())) {
die($class . ' requires the ' . $extension . ' extention, which you do not
have installed.');
}
}
// make it possible to check the return value, if we don't die...
return true;
}
... assuming that we can get something added to php/zend to find out what the
extension for shared libraries is on the current platform. Otherwise a nasty if
will have to do.
Or, having just taken a look at the PEAR class, maybe we should start a
seperate, static PEAR_util class for this...
-chuck
--
Babies have self esteem. They are born loving their toes and finding them
fascinating and delicious.