wpml-tf-module.php
1.42 KB
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
<?php
/**
* Class WPML_TF_Module
*
* @author OnTheGoSystems
*/
class WPML_TF_Module {
/** @var WPML_Action_Filter_Loader $action_filter_loader */
private $action_filter_loader;
/** @var WPML_TF_Settings $settings */
private $settings;
/**
* WPML_TF_Module constructor.
*
* @param WPML_Action_Filter_Loader $action_filter_loader
* @param IWPML_TF_Settings $settings
*/
public function __construct( WPML_Action_Filter_Loader $action_filter_loader, IWPML_TF_Settings $settings ) {
$this->action_filter_loader = $action_filter_loader;
$this->settings = $settings;
}
public function run() {
$this->action_filter_loader->load( $this->get_actions_to_load_always() );
if ( $this->settings->is_enabled() ) {
$this->action_filter_loader->load( $this->get_actions_to_load_when_module_enabled() );
}
}
/**
* @return array
*/
private function get_actions_to_load_always() {
return array(
'WPML_TF_Backend_Options_Hooks_Factory',
'WPML_TF_Backend_Options_AJAX_Hooks_Factory',
'WPML_TF_Backend_Promote_Hooks_Factory',
);
}
/**
* @return array
*/
private function get_actions_to_load_when_module_enabled() {
return array(
'WPML_TF_Common_Hooks_Factory',
'WPML_TF_Backend_Hooks_Factory',
'WPML_TF_Frontend_Hooks_Factory',
'WPML_TF_Frontend_AJAX_Hooks_Factory',
'WPML_TF_Backend_AJAX_Feedback_Edit_Hooks_Factory',
'WPML_TF_Backend_Post_List_Hooks_Factory',
);
}
}