=')) { $this->includes(); // Hooks. add_filter('woocommerce_payment_gateways', array($this, 'add_gateway')); add_filter('plugin_action_links_' . plugin_basename(WC_FONEPAY_PLUGIN_FILE), array($this, 'plugin_action_links')); } else { add_action('admin_notices', array($this, 'woocommerce_missing_notice')); } } /** * Return an instance of this class. * * @return object A single instance of this class. */ public static function get_instance() { // If the single instance hasn't been set, set it now. if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; } /** * Load Localisation files. * * Note: the first-loaded translation file overrides any following ones if the same translation is present. * * Locales found in: * - WP_LANG_DIR/integrate-fonepay-in-woocommerce/woocommerce-fonepay-LOCALE.mo * - WP_LANG_DIR/plugins/woocommerce-fonepay-LOCALE.mo */ public function load_plugin_textdomain() { $locale = apply_filters('plugin_locale', get_locale(), 'woocommerce-fonepay'); load_textdomain('woocommerce-fonepay', WP_LANG_DIR . '/integrate-fonepay-in-woocommerce/woocommerce-fonepay-' . $locale . '.mo'); load_plugin_textdomain('woocommerce-fonepay', false, plugin_basename(dirname(WC_FONEPAY_PLUGIN_FILE)) . '/languages'); } /** * Includes. */ private function includes() { include_once dirname(WC_FONEPAY_PLUGIN_FILE) . '/includes/class-wc-gateway-fonepay.php'; } /** * Add the gateway to WooCommerce. * * @param array $methods WooCommerce payment methods. * @return array Payment methods with Fonepay. */ public function add_gateway($methods) { $methods[] = 'WC_Gateway_Fonepay'; return $methods; } /** * Display action links in the Plugins list table. * * @param array $actions Plugin Action links. * @return array */ public function plugin_action_links($actions) { $new_actions = array( 'settings' => '' . __('Settings', 'woocommerce-fonepay') . '', ); return array_merge($new_actions, $actions); } /** * WooCommerce fallback notice. */ public function woocommerce_missing_notice() { /* translators: %s: woocommerce version */ echo '
' . sprintf(esc_html__('WooCommerce Fonepay depends on the version of %s or later to work!', 'woocommerce-fonepay'), '' . esc_html__('WooCommerce 3.0', 'woocommerce-fonepay') . '') . '