-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwp-marketing-automations-connector-smsru.php
104 lines (90 loc) · 3.42 KB
/
wp-marketing-automations-connector-smsru.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/**
* Plugin Name: Autonami Marketing Automations Connectors - SMSC.ru
* Plugin URI: https://my.mamatov.club
* Description: Now create SMSC.ru based automations with Autonami Marketing Automations for WordPress
* Version: 2.1.0-alpha
* Author: Evgenii Rezanov, Claude.ai
* Author URI: https://evgrezanov.github.io
* License: GPLv3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: autonami-automations-connectors
*
* Requires at least: 4.9
* Tested up to: 6.1.1
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
final class WFCO_SMSCRU {
/**
* @var WFCO_SMSCRU
*/
public static $_instance = null;
private function __construct() {
// Загрузка важных переменных и констант
$this->define_plugin_properties();
// Загрузка общих файлов
$this->load_commons();
}
// Определение констант
public function define_plugin_properties() {
define( 'WFCO_SMSCRU_VERSION', '2.1.0-alpha' );
define( 'WFCO_SMSCRU_FULL_NAME', 'Autonami Marketing Automations Connectors : SMSC.ru' );
define( 'WFCO_SMSCRU_PLUGIN_FILE', __FILE__ );
define( 'WFCO_SMSCRU_PLUGIN_DIR', __DIR__ );
define( 'WFCO_SMSCRU_PLUGIN_URL', untrailingslashit( plugin_dir_url( WFCO_SMSCRU_PLUGIN_FILE ) ) );
define( 'WFCO_SMSCRU_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
define( 'WFCO_SMSCRU_MAIN', 'autonami-automations-connectors' );
}
// Загрузка общих хуков
public function load_commons() {
add_action( 'wfco_load_connectors', [ $this, 'load_connector_classes' ] );
add_action( 'bwfan_automations_loaded', [ $this, 'load_autonami_classes' ] );
add_action( 'bwfan_loaded', [ $this, 'init_smscru' ] );
}
/**
* Returns the instance of the class.
*
* @return WFCO_SMSCRU|null
* @since 1.0.0
*/
public static function get_instance() {
if ( null === self::$_instance ) {
self::$_instance = new self();
}
return self::$_instance;
}
/**
* Initialization of the connector.
*
* Includes the main connector class and the class of the action.
*
* @since 2.0.0
*/
public function init_smscru() {
require WFCO_SMSCRU_PLUGIN_DIR . '/includes/class-wfco-smscru-common.php';
require WFCO_SMSCRU_PLUGIN_DIR . '/includes/class-wfco-smscru-call.php';
}
// Загрузка классов коннектора
public function load_connector_classes() {
require_once( WFCO_SMSCRU_PLUGIN_DIR . '/includes/class-wfco-smscru-common.php' );
require_once( WFCO_SMSCRU_PLUGIN_DIR . '/includes/class-wfco-smscru-call.php' );
require_once( WFCO_SMSCRU_PLUGIN_DIR . '/connector.php' );
do_action( 'wfco_smscru_connector_loaded', $this );
}
// Загрузка классов интеграции Autonami
public function load_autonami_classes() {
$integration_dir = WFCO_SMSCRU_PLUGIN_DIR . '/autonami';
foreach ( glob( $integration_dir . '/class-*.php' ) as $_field_filename ) {
require_once( $_field_filename );
}
do_action( 'wfco_smscru_integrations_loaded', $this );
}
}
if ( ! function_exists( 'WFCO_SMSCRU_Core' ) ) {
function WFCO_SMSCRU_Core() {
return WFCO_SMSCRU::get_instance();
}
}
WFCO_SMSCRU_Core();