/** * Constructor for your shipping class. */ public function __construct() { // flagship app $this->ctx = \FS\Context\ApplicationContext::getInstance(); $this->id = $this->ctx->getComponent('\\FS\\Components\\Settings')['FLAGSHIP_SHIPPING_PLUGIN_ID']; // Id for your shipping method. Should be uunique. $this->method_title = __('FlagShip Shipping', FLAGSHIP_SHIPPING_TEXT_DOMAIN); // Title shown in admin $this->method_description = __('Obtains real time shipping rates via FlagShip Shipping API', FLAGSHIP_SHIPPING_TEXT_DOMAIN); // Description shown in admin $this->title = __('FlagShip Shipping', FLAGSHIP_SHIPPING_TEXT_DOMAIN); // This can be added as an setting but for this example its forced. // flagship options $this->enabled = $this->get_option('enabled'); $this->token = $this->get_option('token'); $this->required_address = $this->get_option('shipping_cost_requires_address', 'no'); // providers $this->ctx->getComponent('\\FS\\Components\\Shipping\\Command'); $this->ctx->getComponent('\\FS\\Components\\Url'); $this->init(); }
/** * Constructor for your shipping class. */ public function __construct($instance_id = 0) { parent::__construct($instance_id); // FlagShip application context $this->ctx = \FS\Context\ApplicationContext::getInstance(); $this->id = $this->ctx->getComponent('\\FS\\Components\\Settings')['FLAGSHIP_SHIPPING_PLUGIN_ID']; $this->method_title = __('FlagShip Shipping', FLAGSHIP_SHIPPING_TEXT_DOMAIN); $this->method_description = __('Obtains real time shipping rates via FlagShip Shipping API', FLAGSHIP_SHIPPING_TEXT_DOMAIN); $this->supports = array('shipping-zones', 'instance-settings', 'instance-settings-modal', 'settings'); $this->title = __('FlagShip Shipping', FLAGSHIP_SHIPPING_TEXT_DOMAIN); // flagship options $this->enabled = $this->get_instance_option('enabled'); // load components // $this->ctx // ->getComponent('\\FS\\Components\\Hook\\HookManager') // ->registerHook('\\FS\\Components\\Hook\\SettingsFilters'); $this->ctx->getComponent('\\FS\\Components\\Shipping\\Command'); $this->ctx->getComponent('\\FS\\Components\\Url'); $this->ctx->getComponent('\\FS\\Components\\Options')->sync($this->instance_id); $this->isLegacy = \version_compare(WC()->version, '2.6', '<'); $this->init_instance_settings(); $this->init(); }
/** * Setup the test. */ public function setUp() { parent::setUp(); $settings = (include __DIR__ . '/../Fixture/FlagshipApplicationSettings.php'); $this->ctx = \FS\Context\ApplicationContext::initialize(new \FS\Container(), new \FS\Configurations\WordPress\Configuration()); }
* Version: 1.0.3 * Author: FlagShip Courier Solution * Author URI: https://github.com/flagshipcompany/flagship-for-woocommerce * Requires at least: 4.4 * Tested up to: 4.5.x * * Text Domain: flagship-for-woocommerce * Domain Path: /languages/ * * Copyright: © 2016 FlagShip Courier Solution. * License: GNU General Public License v3.0 * License URI: http://www.gnu.org/licenses/gpl-3.0.html */ // prevent data leak if (!defined('ABSPATH')) { exit; // Exit if accessed directly } define('FLAGSHIP_SHIPPING_PLUGIN_VERSION', '1.0.3'); define('FLAGSHIP_SHIPPING_PLUGIN_DIR', plugin_dir_path(__FILE__)); define('FLAGSHIP_SHIPPING_PLUGIN_BASENAME', plugin_basename(__FILE__)); define('FLAGSHIP_SHIPPING_TEXT_DOMAIN', 'flagship-for-woocommerce'); require_once FLAGSHIP_SHIPPING_PLUGIN_DIR . 'includes/update/class.flagship-autoupdate.php'; if (is_admin()) { $update = new Flagship_Autoupdate(__FILE__, 'flagshipcompany', 'flagship-for-woocommerce'); } // Check if WooCommerce is active if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) { require __DIR__ . '/vendor/autoload.php'; \FS\Context\ApplicationContext::initialize(new \FS\Container(), new \FS\Configurations\WordPress\Configuration()); }