flexible-shipping
/
vendor_prefixed
/
octolize
/
wp-shipping-extensions
/
src
/
ShippingExtensions
/
ShippingExtensions.php
flexible-shipping
/
vendor_prefixed
/
octolize
/
wp-shipping-extensions
/
src
/
ShippingExtensions
Last commit date
Plugin
1 week ago
Promo
1 week ago
Tracker
1 week ago
views
1 week ago
AdminPage.php
1 week ago
Assets.php
1 week ago
DateRange.php
1 week ago
Page.php
1 week ago
PageViewTracker.php
1 week ago
PluginLinks.php
1 week ago
ShippingExtensions.php
1 week ago
TimedUpdate.php
1 week ago
TimedUpdates.php
1 week ago
WooCommerceSuggestions.php
1 week ago
ShippingExtensions.php
66 lines
| 1 | <?php |
| 2 | |
| 3 | namespace FSVendor\Octolize\ShippingExtensions; |
| 4 | |
| 5 | use FSVendor\Octolize\ShippingExtensions\Plugin\PluginFactory; |
| 6 | use FSVendor\Octolize\ShippingExtensions\Promo\Summer2026Promo; |
| 7 | use FSVendor\Octolize\ShippingExtensions\Tracker\Tracker; |
| 8 | use FSVendor\Octolize\ShippingExtensions\Tracker\ViewPageTracker; |
| 9 | use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable; |
| 10 | use FSVendor\WPDesk\PluginBuilder\Plugin\HookableParent; |
| 11 | use FSVendor\WPDesk_Plugin_Info; |
| 12 | /** |
| 13 | * . |
| 14 | */ |
| 15 | class ShippingExtensions implements Hookable |
| 16 | { |
| 17 | use HookableParent; |
| 18 | private const VERSION = 20; |
| 19 | private const OCTOLIZE_WP_SHIPPING_EXTENSIONS_INITIATED_FILTER = 'octolize/shipping-extensions/initiated'; |
| 20 | /** |
| 21 | * @var WPDesk_Plugin_Info . |
| 22 | */ |
| 23 | private $plugin_info; |
| 24 | /** |
| 25 | * @var bool |
| 26 | */ |
| 27 | private $add_plugin_links; |
| 28 | /** |
| 29 | * @param WPDesk_Plugin_Info $plugin_info . |
| 30 | * @param bool $add_plugin_links . |
| 31 | */ |
| 32 | public function __construct(WPDesk_Plugin_Info $plugin_info, $add_plugin_links = \false) |
| 33 | { |
| 34 | $this->plugin_info = $plugin_info; |
| 35 | $this->add_plugin_links = $add_plugin_links; |
| 36 | } |
| 37 | /** |
| 38 | * @return void |
| 39 | */ |
| 40 | public function hooks(): void |
| 41 | { |
| 42 | if ($this->add_plugin_links) { |
| 43 | $this->add_hookable(new PluginLinks($this->plugin_info)); |
| 44 | } |
| 45 | if (apply_filters(self::OCTOLIZE_WP_SHIPPING_EXTENSIONS_INITIATED_FILTER, \false) === \false) { |
| 46 | add_filter(self::OCTOLIZE_WP_SHIPPING_EXTENSIONS_INITIATED_FILTER, '__return_true'); |
| 47 | $tracker = new ViewPageTracker(); |
| 48 | $this->add_hookable(new Page($this->get_assets_url(), $tracker)); |
| 49 | $this->add_hookable(new Assets($this->get_assets_url(), self::VERSION)); |
| 50 | $this->add_hookable(new Tracker($tracker)); |
| 51 | $this->add_hookable(new PageViewTracker($tracker)); |
| 52 | $this->add_hookable(new WooCommerceSuggestions()); |
| 53 | $this->add_hookable(new Summer2026Promo()); |
| 54 | $this->add_hookable(new TimedUpdates(array_merge([Summer2026Promo::get_timed_update()], PluginFactory::get_timed_updates()))); |
| 55 | } |
| 56 | $this->hooks_on_hookable_objects(); |
| 57 | } |
| 58 | /** |
| 59 | * @return string |
| 60 | */ |
| 61 | private function get_assets_url(): string |
| 62 | { |
| 63 | return plugin_dir_url(__DIR__ . '/../../../') . 'assets/'; |
| 64 | } |
| 65 | } |
| 66 |