/** * Public function that creates a single instance */ public static function getInstance($parent) { if (!isset(self::$_instance)) { self::$_instance = new self($parent); } return self::$_instance; }
/** * Constructor */ protected function __construct() { global $section; parent::__construct(__FILE__); // load module style and scripts if (class_exists('head_tag')) { $head_tag = head_tag::getInstance(); $head_tag->addTag('script', array('src' => 'https://js.stripe.com/v2/', 'type' => 'text/javascript')); } // register backend if (class_exists('backend') && class_exists('shop')) { $backend = backend::getInstance(); $method_menu = $backend->getMenu('shop_payment_methods'); if (!is_null($method_menu)) { $method_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_stripe'), url_GetFromFilePath($this->path . 'images/icon.png'), window_Open('stripe', 350, $this->getLanguageConstant('title_settings'), true, true, backend_UrlMake($this->name, 'show_settings')), $level = 5)); } } // register payment method if (class_exists('shop')) { require_once "units/stripe_payment_method.php"; Stripe_PaymentMethod::getInstance($this); } }