Ejemplo n.º 1
0
 /**
  * Registers the BitPay autoloader to run before Magento's. This MUST be
  * called before using any bitpay classes.
  */
 public function registerAutoloader()
 {
     if ($this->useAutoloader() && true === empty($this->_autoloaderRegistered)) {
         $autoloader_filename = \Mage::getBaseDir('lib') . '/Bitpay/Autoloader.php';
         if (true === is_file($autoloader_filename) && true === is_readable($autoloader_filename)) {
             require_once $autoloader_filename;
             \Bitpay\Autoloader::register();
             $this->_autoloaderRegistered = true;
             $this->debugData('[INFO] In Bitpay_Core_Helper_Data::registerAutoloader(): autoloader file was found and has been registered.');
         } else {
             $this->_autoloaderRegistered = false;
             $this->debugData('[ERROR] In Bitpay_Core_Helper_Data::registerAutoloader(): autoloader file was not found or is not readable. Cannot continue!');
             throw new \Exception('In Bitpay_Core_Helper_Data::registerAutoloader(): autoloader file was not found or is not readable. Cannot continue!');
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * BitPay Library constructor
  * @param Registry $registry
  */
 public function __construct($registry)
 {
     $this->registry = $registry;
     // Load up the BitPay library
     $autoloader = __DIR__ . '/Bitpay/Autoloader.php';
     if (true === file_exists($autoloader) && true === is_readable($autoloader)) {
         require_once $autoloader;
         \Bitpay\Autoloader::register();
     } else {
         // OpenCart uses a custom error handler for reporting instead of using exceptions
         // Which is why an error is triggered instead of an exception being thrown
         trigger_error($this->language->get('log_error_install'), E_USER_ERROR);
     }
     // Setup logging
     $this->logger = new Log('bitpay.log');
     // Setup encryption
     $this->load->library('encryption');
     $fingerprint = substr(sha1(sha1(__DIR__)), 0, 24);
     $this->encryption = new Encryption($fingerprint);
 }
   Author URI:  https://bitpay.com

   Version:           2.2.7
   License:           Copyright 2011-2014 BitPay Inc., MIT License
   License URI:       https://github.com/bitpay/woocommerce-plugin/blob/master/LICENSE
   GitHub Plugin URI: https://github.com/bitpay/woocommerce-plugin
*/
// Exit if accessed directly
if (false === defined('ABSPATH')) {
    exit;
}
$autoloader_param = __DIR__ . '/lib/Bitpay/Autoloader.php';
// Load up the BitPay library
if (true === file_exists($autoloader_param) && true === is_readable($autoloader_param)) {
    require_once $autoloader_param;
    \Bitpay\Autoloader::register();
} else {
    throw new \Exception('The BitPay payment plugin was not installed correctly or the files are corrupt. Please reinstall the plugin. If this message persists after a reinstall, contact support@bitpay.com with this message.');
}
// Exist for quirks in object serialization...
if (false === class_exists('PrivateKey')) {
    include_once __DIR__ . '/lib/Bitpay/PrivateKey.php';
}
if (false === class_exists('PublicKey')) {
    include_once __DIR__ . '/lib/Bitpay/PublicKey.php';
}
if (false === class_exists('Token')) {
    include_once __DIR__ . '/lib/Bitpay/Token.php';
}
// Ensures WooCommerce is loaded before initializing the BitPay plugin
add_action('plugins_loaded', 'woocommerce_bitpay_init', 0);