Integrations.php
69 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved |
| 4 | * |
| 5 | * This source code is licensed under the license found in the |
| 6 | * LICENSE file in the root directory of this source tree. |
| 7 | * |
| 8 | * @package FacebookCommerce |
| 9 | */ |
| 10 | |
| 11 | namespace SkyVerge\WooCommerce\Facebook\Integrations; |
| 12 | |
| 13 | defined( 'ABSPATH' ) or exit; |
| 14 | |
| 15 | use SkyVerge\WooCommerce\PluginFramework\v5_5_4 as Framework; |
| 16 | |
| 17 | /** |
| 18 | * The integrations handler. |
| 19 | * |
| 20 | * @since 1.11.1 |
| 21 | */ |
| 22 | class Integrations { |
| 23 | |
| 24 | |
| 25 | /** @var Framework\SV_WC_Plugin plugin instance */ |
| 26 | private $plugin; |
| 27 | |
| 28 | /** @var object[] integration instances */ |
| 29 | private $integrations; |
| 30 | |
| 31 | |
| 32 | /** |
| 33 | * Integrations constructor. |
| 34 | * |
| 35 | * @since 1.11.1 |
| 36 | * |
| 37 | * @param Framework\SV_WC_Plugin $plugin plugin instance |
| 38 | */ |
| 39 | public function __construct( $plugin ) { |
| 40 | |
| 41 | $this->plugin = $plugin; |
| 42 | |
| 43 | $this->load_integrations(); |
| 44 | } |
| 45 | |
| 46 | |
| 47 | /** |
| 48 | * Loads integration classes. |
| 49 | * |
| 50 | * @since 1.11.1 |
| 51 | */ |
| 52 | private function load_integrations() { |
| 53 | |
| 54 | $registered_integrations = [ |
| 55 | 'WC_Facebook_WPML_Injector' => '/includes/fbwpml.php', |
| 56 | ]; |
| 57 | |
| 58 | foreach ( $registered_integrations as $class_name => $path ) { |
| 59 | |
| 60 | if ( ! class_exists( $class_name ) && ! is_readable( $path ) ) { |
| 61 | |
| 62 | $this->integrations[ $class_name ] = $this->plugin->load_class( $path, $class_name ); |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | |
| 68 | } |
| 69 |