ProPluginAdvertMetabox.php
59 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPDesk\FS\AdvertMetabox; |
| 4 | |
| 5 | use FSVendor\Octolize\Brand\Assets\AdminAssets; |
| 6 | use FSVendor\Octolize\Brand\UpsellingBox\SettingsSidebar; |
| 7 | use FSVendor\Octolize\Brand\UpsellingBox\ShippingMethodInstanceShouldShowStrategy; |
| 8 | use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable; |
| 9 | use FSVendor\WPDesk\PluginBuilder\Plugin\HookableCollection; |
| 10 | use FSVendor\WPDesk\PluginBuilder\Plugin\HookableParent; |
| 11 | use WPDesk\FS\TableRate\ShippingMethodSingle; |
| 12 | |
| 13 | |
| 14 | class ProPluginAdvertMetabox implements Hookable, HookableCollection { |
| 15 | |
| 16 | use HookableParent; |
| 17 | |
| 18 | private string $assets_url; |
| 19 | |
| 20 | public function __construct( string $assets_url ) { |
| 21 | $this->assets_url = $assets_url; |
| 22 | } |
| 23 | |
| 24 | public function hooks() { |
| 25 | if ( defined( 'FLEXIBLE_SHIPPING_PRO_VERSION' ) ) { |
| 26 | |
| 27 | return; |
| 28 | } |
| 29 | |
| 30 | $should_show_strategy = new ShippingMethodInstanceShouldShowStrategy( new \WC_Shipping_Zones(), ShippingMethodSingle::SHIPPING_METHOD_ID ); |
| 31 | $this->add_hookable( new AdminAssets( $this->assets_url, 'fs', $should_show_strategy ) ); |
| 32 | add_action( |
| 33 | 'admin_init', |
| 34 | function () use ( $should_show_strategy ) { |
| 35 | ( new SettingsSidebar( |
| 36 | 'woocommerce_settings_tabs_shipping', |
| 37 | $should_show_strategy, |
| 38 | __( 'Get Flexible Shipping PRO!', 'flexible-shipping' ), |
| 39 | [ |
| 40 | __( 'Shipping Classes support', 'flexible-shipping' ), |
| 41 | __( 'Products-based shipping', 'flexible-shipping' ), |
| 42 | __( 'Quantity-based shipping', 'flexible-shipping' ), |
| 43 | __( 'Additional Cost', 'flexible-shipping' ), |
| 44 | __( 'Conditional Logic', 'flexible-shipping' ), |
| 45 | __( 'Hide the shipping methods', 'flexible-shipping' ), |
| 46 | __( 'Premium 1-on-1 Support', 'flexible-shipping' ), |
| 47 | __( 'AI Assistant for shipping configuration', 'flexible-shipping' ), |
| 48 | ], |
| 49 | get_locale() === 'pl_PL' ? 'https://octol.io/fs-box-upgrade-pl' : 'https://octol.io/fs-box-upgrade', |
| 50 | __( 'Upgrade Now', 'flexible-shipping' ), |
| 51 | 1200 |
| 52 | ) )->hooks(); |
| 53 | } |
| 54 | ); |
| 55 | |
| 56 | $this->hooks_on_hookable_objects(); |
| 57 | } |
| 58 | } |
| 59 |