| 1 |
<?php |
| 2 |
|
| 3 |
namespace Sellkit\Contact_Segmentation; |
| 4 |
|
| 5 |
use Sellkit\Contact_Segmentation\Conditions; |
| 6 |
|
| 7 |
defined( 'ABSPATH' ) || die(); |
| 8 |
|
| 9 |
/** |
| 10 |
* Class Contact_Segmentation |
| 11 |
* |
| 12 |
* @package Sellkit\Contact_Segmentation |
| 13 |
* @since 1.1.0 |
| 14 |
*/ |
| 15 |
class Contact_Segmentation { |
| 16 |
|
| 17 |
/** |
| 18 |
* Conditions object. |
| 19 |
* |
| 20 |
* @var array |
| 21 |
* @since 1.1.0 |
| 22 |
*/ |
| 23 |
public $conditions; |
| 24 |
|
| 25 |
/** |
| 26 |
* Contact_Segmentation constructor. |
| 27 |
*/ |
| 28 |
public function __construct() { |
| 29 |
if ( strpos($_SERVER[ 'REQUEST_URI' ], '/wp-json/' ) !== false ) { // phpcs:ignore |
| 30 |
return; |
| 31 |
} |
| 32 |
|
| 33 |
// Base files loading. |
| 34 |
add_action( 'wp_loaded', [ $this, 'load_contact_segmentation_files' ] ); |
| 35 |
|
| 36 |
add_action( 'wp', [ $this, 'load_contact_segmentation_files' ] ); |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Load contact segmentation files. |
| 41 |
* |
| 42 |
* @since 1.1.0 |
| 43 |
*/ |
| 44 |
public function load_contact_segmentation_files() { |
| 45 |
sellkit()->load_files( [ |
| 46 |
'contact-segmentation/libraries/mobile-detect', |
| 47 |
'contact-segmentation/conditions', |
| 48 |
'contact-segmentation/operators', |
| 49 |
'contact-segmentation/functions', |
| 50 |
'contact-segmentation/contact-data', |
| 51 |
'contact-segmentation/contact-data-updater', |
| 52 |
] ); |
| 53 |
|
| 54 |
$this->conditions = new Conditions(); |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
new Contact_Segmentation(); |
| 59 |
|