@@ -17,39 +17,34 @@ public function _init() {
17
17
}
18
18
19
19
private function add_actions () {
20
- add_action ( 'fw_extension_settings_form_saved ' , array (
20
+ add_action ( 'fw_extension_settings_form_saved: ' . $ this -> get_parent ()-> get_name () , array (
21
21
$ this ,
22
22
'_action_fw_ext_social_facebook_save_options '
23
- ), 10 , 2 );
23
+ ), 10 );
24
24
}
25
25
26
26
private function add_filters () {
27
27
add_filter ( 'fw_ext_social_tabs ' , array ( $ this , '_filter_fw_ext_social_tabs ' ) );
28
28
}
29
29
30
30
/**
31
- * @param $extension_name
32
31
* @param $options_before_save
33
32
*/
34
- public function _action_fw_ext_social_facebook_save_options ( $ extension_name , $ options_before_save ) {
33
+ public function _action_fw_ext_social_facebook_save_options ( $ options_before_save ) {
35
34
$ parent = $ this ->get_parent ()->get_name ();
36
-
37
- if ( $ extension_name === $ parent ) {
38
-
39
- $ response = wp_remote_get (
40
- add_query_arg (
41
- array (
42
- 'grant_type ' => 'client_credentials ' ,
43
- 'client_id ' => fw_get_db_ext_settings_option ( $ parent , 'facebook-app-id ' ),
44
- 'client_secret ' => fw_get_db_ext_settings_option ( $ parent , 'facebook-app-secret ' )
45
- ), 'https://graph.facebook.com/oauth/access_token ' ) );
46
- $ body = wp_remote_retrieve_body ( $ response );
47
- if ( strpos ( $ body , 'access_token= ' ) !== false ) {
48
- $ token = substr ( $ body , 13 );
49
- fw_set_db_extension_data ( $ this ->get_name (), $ this ->access_token_name , $ token );
50
- } else {
51
- fw_set_db_extension_data ( $ this ->get_name (), $ this ->access_token_name , false );
52
- }
35
+ $ response = wp_remote_get (
36
+ add_query_arg (
37
+ array (
38
+ 'grant_type ' => 'client_credentials ' ,
39
+ 'client_id ' => fw_get_db_ext_settings_option ( $ parent , 'facebook-app-id ' ),
40
+ 'client_secret ' => fw_get_db_ext_settings_option ( $ parent , 'facebook-app-secret ' )
41
+ ), 'https://graph.facebook.com/oauth/access_token ' ) );
42
+ $ body = wp_remote_retrieve_body ( $ response );
43
+ if ( strpos ( $ body , 'access_token= ' ) !== false ) {
44
+ $ token = substr ( $ body , 13 );
45
+ fw_set_db_extension_data ( $ this ->get_name (), $ this ->access_token_name , $ token );
46
+ } else {
47
+ fw_set_db_extension_data ( $ this ->get_name (), $ this ->access_token_name , false );
53
48
}
54
49
}
55
50
0 commit comments