2012-04-30 19:50:35 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* WooCommerce Integrations class
|
2012-08-15 18:15:06 +00:00
|
|
|
*
|
2012-04-30 19:50:35 +00:00
|
|
|
* Loads Integrations into WooCommerce.
|
|
|
|
*
|
2018-03-21 03:07:37 +00:00
|
|
|
* @version 2.3.0
|
|
|
|
* @package WooCommerce/Classes/Integrations
|
|
|
|
*/
|
|
|
|
|
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Integrations class.
|
2012-04-30 19:50:35 +00:00
|
|
|
*/
|
|
|
|
class WC_Integrations {
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2016-01-06 15:24:47 +00:00
|
|
|
/**
|
|
|
|
* Array of integrations.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
2014-12-16 11:36:26 +00:00
|
|
|
public $integrations = array();
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2016-07-11 14:56:35 +00:00
|
|
|
/**
|
|
|
|
* Initialize integrations.
|
|
|
|
*/
|
|
|
|
public function __construct() {
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2012-12-31 18:25:09 +00:00
|
|
|
do_action( 'woocommerce_integrations_init' );
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2020-01-09 23:46:01 +00:00
|
|
|
$load_integrations = array(
|
|
|
|
'WC_Integration_MaxMind_Geolocation',
|
|
|
|
);
|
|
|
|
|
|
|
|
$load_integrations = apply_filters( 'woocommerce_integrations', $load_integrations );
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2018-03-21 03:07:37 +00:00
|
|
|
// Load integration classes.
|
2012-04-30 19:50:35 +00:00
|
|
|
foreach ( $load_integrations as $integration ) {
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2012-04-30 19:50:35 +00:00
|
|
|
$load_integration = new $integration();
|
2012-08-15 18:15:06 +00:00
|
|
|
|
2013-09-26 16:01:29 +00:00
|
|
|
$this->integrations[ $load_integration->id ] = $load_integration;
|
2012-04-30 19:50:35 +00:00
|
|
|
}
|
|
|
|
}
|
2012-08-15 18:15:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return loaded integrations.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
2012-12-31 18:25:09 +00:00
|
|
|
public function get_integrations() {
|
2012-04-30 19:50:35 +00:00
|
|
|
return $this->integrations;
|
|
|
|
}
|
2020-01-10 10:09:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a desired integration.
|
|
|
|
*
|
|
|
|
* @param string $id The id of the integration to get.
|
|
|
|
*
|
|
|
|
* @return mixed|null The integration if one is found, otherwise null.
|
|
|
|
*/
|
|
|
|
public function get_integration( $id ) {
|
|
|
|
if ( isset( $this->integrations[ $id ] ) ) {
|
|
|
|
return $this->integrations[ $id ];
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
2013-11-01 16:39:33 +00:00
|
|
|
}
|