-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.php
100 lines (84 loc) · 2.58 KB
/
app.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
<?php
use Directorist_WPML_Integration\Controller;
use Directorist_WPML_Integration\Helper;
final class Directorist_WPML_Integration {
private static $instance;
/**
* Constuctor
*
* @return void
*/
private function __construct() {
// Check Compatibility
if ( version_compare( ATBDP_VERSION, DIRECTORIST_WPML_INTEGRATION_MIN_DIRECTORIST_VERSION_REQUIRMENT, '<' ) ) {
add_action( 'admin_notices', [ $this, 'show_incompatibility_notice' ], 1, 1 );
return;
}
// Load Textdomain
add_action('plugins_loaded', [ $this, 'load_textdomain' ] );
// Register Controllers
$controllers = $this->get_controllers();
Helper\Serve::register_services( $controllers );
}
/**
* Get Instance
*
* @return Directorist_WPML_Integration
*/
public static function get_instance() {
if ( self::$instance === null ) {
self::$instance = new Directorist_WPML_Integration();
}
return self::$instance;
}
/**
* Get Controllers
*
* @return array $controllers
*/
protected function get_controllers() {
return [
Controller\Setup\Init::class,
Controller\Asset\Init::class,
Controller\Ajax\Init::class,
Controller\Hook\Init::class,
];
}
/**
* Show Incompatibility Notice
*
* @return void
*/
public function show_incompatibility_notice() {
?>
<div class="notice notice-error">
<h3><?php esc_html_e( 'Directorist Update is Incomplete', 'directorist-wpml-integration' ); ?></h3>
<p><?php echo wp_kses( __( '<b>Directorist WPML Integration</b> extension requires <b>Directorist '. DIRECTORIST_WPML_INTEGRATION_MIN_DIRECTORIST_VERSION_REQUIRMENT .'</b> or higher to work', 'directorist-wpml-integration' ), array( 'b' ) ); ?></p>
</div>
<?php
}
/**
* Load Text Domain
*
* @return void
*/
public function load_textdomain() {
load_plugin_textdomain( 'directorist-wpml-integration', false, DIRECTORIST_WPML_INTEGRATION_LANGUAGE_DIR );
}
/**
* Cloning instances of the class is forbidden.
*
* @return void
*/
public function __clone() {
_doing_it_wrong( __FUNCTION__, __('Cheatin’ huh?', 'directorist-wpml-integration'), '1.0' );
}
/**
* Unserializing instances of the class is forbidden.
*
* @return void
*/
public function __wakeup() {
_doing_it_wrong( __FUNCTION__, __('Cheatin’ huh?', 'directorist-wpml-integration'), '1.0' );
}
}