Repository URL to install this package:
<?php
/**
* Plugin.
*
* @package Flexible Shipping PRO
*/
use FSProVendor\WPDesk\Beacon\BeaconGetShouldShowStrategy;
use FSProVendor\WPDesk\PluginBuilder\Plugin\AbstractPlugin;
use FSProVendor\WPDesk\PluginBuilder\Plugin\HookableCollection;
use FSProVendor\WPDesk\PluginBuilder\Plugin\HookableParent;
use FSProVendor\WPDesk\PluginBuilder\Plugin\TemplateLoad;
use FSProVendor\WPDesk\Beacon\BeaconPro;
/**
* Plugin.
*/
class WPDesk_Flexible_Shipping_Pro_Plugin
extends AbstractPlugin
implements HookableCollection {
use HookableParent;
use TemplateLoad;
const HOOK_PRIORITY_AFTER_DEFAULT = 11;
/**
* WPDesk_Flexible_Shipping_Pro_Plugin constructor.
*
* @param FSProVendor\WPDesk_Plugin_Info $plugin_info Plugin info.
*/
public function __construct( FSProVendor\WPDesk_Plugin_Info $plugin_info ) {
$this->plugin_info = $plugin_info;
parent::__construct( $this->plugin_info );
}
/**
* Hooks.
*/
public function hooks() {
parent::hooks();
add_action( 'plugins_loaded', array( $this, 'init_flexible_shipping' ), self::HOOK_PRIORITY_AFTER_DEFAULT );
}
/**
* Init base variables for plugin
*/
public function init_base_variables() {
$this->plugin_url = $this->plugin_info->get_plugin_url();
$this->plugin_path = $this->plugin_info->get_plugin_dir();
$this->template_path = $this->plugin_info->get_text_domain();
$this->plugin_text_domain = $this->plugin_info->get_text_domain();
$this->plugin_namespace = $this->plugin_info->get_text_domain();
}
/**
* .
*/
public function init_flexible_shipping() {
$fs = new WPDesk_Flexible_Shipping_Pro_FS_Hooks();
$woocommerce_form_fields = new WPDesk_Flexible_Shipping_Pro_Woocommerce_Form_Field();
$woocommerce_form_fields->hooks();
$costs_calculation = new WPDesk_Flexible_Shipping_Pro_Costs_Calculation();
$costs_calculation->hooks();
if ( 'pl_PL' !== get_locale() ) {
$beacon = new BeaconPro(
'2321116f-e474-45a7-b04d-0950420ff894',
new WPDesk_Flexible_Shipping_Pro_Plugin_Beacon_Should_Show_Strategy(),
$this->get_plugin_url() . 'vendor_prefixed/wpdesk/wp-helpscout-beacon/assets/'
);
$beacon->hooks();
}
}
/**
* .
*
* @param mixed $links .
*
* @return array
*/
public function links_filter( $links ) {
$docs_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/docs/flexible-shipping-pro-woocommerce-docs/' : 'https://docs.flexibleshipping.com/collection/20-fs-table-rate/';
$support_link = get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/support/' : 'https://flexibleshipping.com/support/';
$plugin_links = array(
'<a href="' . admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=flexible_shipping_info' ) . '">' . __( 'Settings', 'flexible-shipping-pro' ) . '</a>',
'<a target="_blank" href="' . $docs_link . '">' . __( 'Docs', 'flexible-shipping-pro' ) . '</a>',
'<a target="_blank" href="' . $support_link . '">' . __( 'Support', 'flexible-shipping-pro' ) . '</a>',
);
return array_merge( $plugin_links, $links );
}
}