7
7
* @package Cbx\Taxonomy
8
8
* @since 1.0.0
9
9
*/
10
- class CBXTaxonomy {
10
+ class CBXTaxonomy
11
+ {
11
12
12
13
/**
13
14
* @var null
@@ -32,13 +33,15 @@ class CBXTaxonomy {
32
33
*
33
34
* @since 1.0.0
34
35
*/
35
- public function __construct () {
36
- $ this ->version = CBXTAXONOMY_PLUGIN_VERSION ;
36
+ public function __construct ()
37
+ {
38
+ $ this ->version = CBXTAXONOMY_PLUGIN_VERSION ;
37
39
$ this ->plugin_name = CBXTAXONOMY_PLUGIN_NAME ;
38
40
39
41
//$this->unit_testing();
40
42
$ this ->load_orm ();
41
43
$ this ->load_plugin_textdomain ();
44
+ $ this ->hooks = new Hooks ();
42
45
}//end of method constructor
43
46
44
47
/**
@@ -47,8 +50,9 @@ public function __construct() {
47
50
* @return CBXTaxonomy
48
51
* @since 1.0.0
49
52
*/
50
- public static function instance () {
51
- if ( is_null ( self ::$ instance ) ) {
53
+ public static function instance ()
54
+ {
55
+ if (is_null (self ::$ instance )) {
52
56
self ::$ instance = new self ();
53
57
}
54
58
@@ -60,53 +64,56 @@ public static function instance() {
60
64
*
61
65
* @since 1.0.0
62
66
*/
63
- public function load_plugin_textdomain () {
64
- load_plugin_textdomain ( 'cbxtaxonomy ' , false , CBXTAXONOMY_ROOT_PATH . 'languages/ ' );
67
+ public function load_plugin_textdomain ()
68
+ {
69
+ load_plugin_textdomain ('cbxtaxonomy ' , false , CBXTAXONOMY_ROOT_PATH . 'languages/ ' );
65
70
}//end method load_plugin_textdomain
66
71
67
72
/**
68
73
* Load ORM using helper class
69
74
*
70
75
* @since 1.0.0
71
76
*/
72
- public function load_orm () {
77
+ public function load_orm ()
78
+ {
73
79
$ taxonomy_helper = new CBXTaxonomyHelper ();
74
- add_action ( 'init ' , [ $ taxonomy_helper , 'load_orm ' ] );
80
+ add_action ('init ' , [$ taxonomy_helper , 'load_orm ' ] );
75
81
} // end of load_orm
76
82
77
83
/**
78
84
* Run test hooks
79
85
*
80
86
* @since 1.0.0
81
87
*/
82
- public function unit_testing () {
83
- if ( CBXTAXONOMY_DEV_MODE ) {
84
- add_action ( 'cbxtaxonomy_taxable_delete_before ' , [
88
+ public function unit_testing ()
89
+ {
90
+ if (CBXTAXONOMY_DEV_MODE ) {
91
+ add_action ('cbxtaxonomy_taxable_delete_before ' , [
85
92
$ this ,
86
93
'cbxtaxonomy_taxable_delete_before_test '
87
- ], 10 , 3 );
88
- add_action ( 'cbxtaxonomy_taxable_delete_after ' , [ $ this , 'cbxtaxonomy_taxable_delete_after_test ' ], 10 , 3 );
89
- add_action ( 'cbxtaxonomy_taxable_delete_failed ' , [
94
+ ], 10 , 3 );
95
+ add_action ('cbxtaxonomy_taxable_delete_after ' , [$ this , 'cbxtaxonomy_taxable_delete_after_test ' ], 10 , 3 );
96
+ add_action ('cbxtaxonomy_taxable_delete_failed ' , [
90
97
$ this ,
91
98
'cbxtaxonomy_taxable_delete_failed_test '
92
- ], 10 , 3 );
99
+ ], 10 , 3 );
93
100
94
- add_action ( 'cbxtaxonomy_taxonomy_delete_before ' , [
101
+ add_action ('cbxtaxonomy_taxonomy_delete_before ' , [
95
102
$ this ,
96
103
'cbxtaxonomy_taxonomy_delete_before_test '
97
- ], 10 , 3 );
98
- add_action ( 'cbxtaxonomy_taxonomy_delete_after ' , [
104
+ ], 10 , 3 );
105
+ add_action ('cbxtaxonomy_taxonomy_delete_after ' , [
99
106
$ this ,
100
107
'cbxtaxonomy_taxonomy_delete_after_test '
101
- ], 10 , 3 );
102
- add_action ( 'cbxtaxonomy_taxonomy_delete_failed ' , [
108
+ ], 10 , 3 );
109
+ add_action ('cbxtaxonomy_taxonomy_delete_failed ' , [
103
110
$ this ,
104
111
'cbxtaxonomy_taxonomy_delete_failed_test '
105
- ], 10 , 3 );
112
+ ], 10 , 3 );
106
113
107
- add_action ( 'cbxtaxonomy_taxonomy_save_before ' , [ $ this , 'cbxtaxonomy_taxonomy_save_before_test ' ], 10 , 2 );
108
- add_action ( 'cbxtaxonomy_taxonomy_save_after ' , [ $ this , 'cbxtaxonomy_taxonomy_save_after_test ' ], 10 , 2 );
109
- add_action ( 'cbxtaxonomy_taxonomy_save_failed ' , [ $ this , 'cbxtaxonomy_taxonomy_save_failed_test ' ], 10 , 2 );
114
+ add_action ('cbxtaxonomy_taxonomy_save_before ' , [$ this , 'cbxtaxonomy_taxonomy_save_before_test ' ], 10 , 2 );
115
+ add_action ('cbxtaxonomy_taxonomy_save_after ' , [$ this , 'cbxtaxonomy_taxonomy_save_after_test ' ], 10 , 2 );
116
+ add_action ('cbxtaxonomy_taxonomy_save_failed ' , [$ this , 'cbxtaxonomy_taxonomy_save_failed_test ' ], 10 , 2 );
110
117
}
111
118
} // end of unit_testing
112
119
@@ -119,9 +126,10 @@ public function unit_testing() {
119
126
*
120
127
* @since 1.0.0
121
128
*/
122
- public function cbxtaxonomy_taxable_delete_before_test ( $ taxonomy_id , $ type , $ data ) {
123
- if ( function_exists ( 'write_log ' ) ) {
124
- write_log ( 'before taxable delete hook $taxonomy_id= ' . $ taxonomy_id . ' $type= ' . $ type );
129
+ public function cbxtaxonomy_taxable_delete_before_test ($ taxonomy_id , $ type , $ data )
130
+ {
131
+ if (function_exists ('write_log ' )) {
132
+ write_log ('before taxable delete hook $taxonomy_id= ' . $ taxonomy_id . ' $type= ' . $ type );
125
133
}
126
134
}//end of cbxtaxonomy_taxable_delete_before_test
127
135
@@ -134,9 +142,10 @@ public function cbxtaxonomy_taxable_delete_before_test( $taxonomy_id, $type, $da
134
142
*
135
143
* @since 1.0.0
136
144
*/
137
- public function cbxtaxonomy_taxable_delete_after_test ( $ taxonomy_id , $ type , $ data ) {
138
- if ( function_exists ( 'write_log ' ) ) {
139
- write_log ( 'before taxable delete hook $taxonomy_id= ' . $ taxonomy_id . ' $type= ' . $ type );
145
+ public function cbxtaxonomy_taxable_delete_after_test ($ taxonomy_id , $ type , $ data )
146
+ {
147
+ if (function_exists ('write_log ' )) {
148
+ write_log ('before taxable delete hook $taxonomy_id= ' . $ taxonomy_id . ' $type= ' . $ type );
140
149
}
141
150
142
151
}//end of cbxtaxonomy_taxable_delete_after_test
@@ -150,9 +159,10 @@ public function cbxtaxonomy_taxable_delete_after_test( $taxonomy_id, $type, $dat
150
159
*
151
160
* @since 1.0.0
152
161
*/
153
- public function cbxtaxonomy_taxable_delete_failed_test ( $ taxonomy_id , $ type , $ data ) {
154
- if ( function_exists ( 'write_log ' ) ) {
155
- write_log ( 'before taxable delete hook $taxonomy_id= ' . $ taxonomy_id . ' $type= ' . $ type );
162
+ public function cbxtaxonomy_taxable_delete_failed_test ($ taxonomy_id , $ type , $ data )
163
+ {
164
+ if (function_exists ('write_log ' )) {
165
+ write_log ('before taxable delete hook $taxonomy_id= ' . $ taxonomy_id . ' $type= ' . $ type );
156
166
}
157
167
158
168
}//end of cbxtaxonomy_taxable_delete_failed_test
@@ -166,9 +176,10 @@ public function cbxtaxonomy_taxable_delete_failed_test( $taxonomy_id, $type, $da
166
176
*
167
177
* @since 1.0.0
168
178
*/
169
- public function cbxtaxonomy_taxonomy_delete_before_test ( $ id , $ type , $ data ) {
170
- if ( function_exists ( 'write_log ' ) ) {
171
- write_log ( $ id . " here is the id => " . $ type );
179
+ public function cbxtaxonomy_taxonomy_delete_before_test ($ id , $ type , $ data )
180
+ {
181
+ if (function_exists ('write_log ' )) {
182
+ write_log ($ id . " here is the id => " . $ type );
172
183
}
173
184
}//end of cbxtaxonomy_taxonomy_delete_before_test
174
185
@@ -181,9 +192,10 @@ public function cbxtaxonomy_taxonomy_delete_before_test( $id, $type, $data ) {
181
192
*
182
193
* @since 1.0.0
183
194
*/
184
- public function cbxtaxonomy_taxonomy_delete_after_test ( $ id , $ type , $ data ) {
185
- if ( function_exists ( 'write_log ' ) ) {
186
- write_log ( $ id . " here is the id => " . $ type );
195
+ public function cbxtaxonomy_taxonomy_delete_after_test ($ id , $ type , $ data )
196
+ {
197
+ if (function_exists ('write_log ' )) {
198
+ write_log ($ id . " here is the id => " . $ type );
187
199
}
188
200
}//end of cbxtaxonomy_taxonomy_delete_after_test
189
201
@@ -196,9 +208,10 @@ public function cbxtaxonomy_taxonomy_delete_after_test( $id, $type, $data ) {
196
208
*
197
209
* @since 1.0.0
198
210
*/
199
- public function cbxtaxonomy_taxonomy_delete_failed_test ( $ id , $ type , $ data ) {
200
- if ( function_exists ( 'write_log ' ) ) {
201
- write_log ( $ id . " here is the id => " . $ type );
211
+ public function cbxtaxonomy_taxonomy_delete_failed_test ($ id , $ type , $ data )
212
+ {
213
+ if (function_exists ('write_log ' )) {
214
+ write_log ($ id . " here is the id => " . $ type );
202
215
}
203
216
}//end of cbxtaxonomy_taxonomy_delete_failed_test
204
217
@@ -210,11 +223,12 @@ public function cbxtaxonomy_taxonomy_delete_failed_test( $id, $type, $data ) {
210
223
*
211
224
* @since 1.0.0
212
225
*/
213
- public function cbxtaxonomy_taxonomy_save_before_test ( $ type , $ data ) {
214
- if ( function_exists ( 'write_log ' ) ) {
215
- write_log ( "taxonomy save here is the id => " . $ type );
226
+ public function cbxtaxonomy_taxonomy_save_before_test ($ type , $ data )
227
+ {
228
+ if (function_exists ('write_log ' )) {
229
+ write_log ("taxonomy save here is the id => " . $ type );
216
230
} else {
217
- error_log ( "taxonomy save here is the id => " . $ type );
231
+ error_log ("taxonomy save here is the id => " . $ type );
218
232
}
219
233
}//end of cbxtaxonomy_taxonomy_save_before_test
220
234
@@ -226,9 +240,10 @@ public function cbxtaxonomy_taxonomy_save_before_test( $type, $data ) {
226
240
*
227
241
* @since 1.0.0
228
242
*/
229
- public function cbxtaxonomy_taxonomy_save_after_test ( $ type , $ data ) {
230
- if ( function_exists ( 'write_log ' ) ) {
231
- write_log ( "taxonomy save here is the id => " . $ type );
243
+ public function cbxtaxonomy_taxonomy_save_after_test ($ type , $ data )
244
+ {
245
+ if (function_exists ('write_log ' )) {
246
+ write_log ("taxonomy save here is the id => " . $ type );
232
247
}
233
248
}//end of cbxtaxonomy_taxonomy_save_after_test
234
249
@@ -240,9 +255,10 @@ public function cbxtaxonomy_taxonomy_save_after_test( $type, $data ) {
240
255
*
241
256
* @since 1.0.0
242
257
*/
243
- public function cbxtaxonomy_taxonomy_save_failed_test ( $ type , $ data ) {
244
- if ( function_exists ( 'write_log ' ) ) {
245
- write_log ( "taxonomy save here is the id => " . $ type );
258
+ public function cbxtaxonomy_taxonomy_save_failed_test ($ type , $ data )
259
+ {
260
+ if (function_exists ('write_log ' )) {
261
+ write_log ("taxonomy save here is the id => " . $ type );
246
262
}
247
263
}//end of cbxtaxonomy_taxonomy_save_failed_test
248
264
0 commit comments