@@ -18,8 +18,11 @@ class CloudflareFeaturesManager {
18
18
*/
19
19
public function __construct () {
20
20
add_action ( 'update_option_nfd_image_optimization ' , array ( $ this , 'on_image_optimization_change ' ), 10 , 2 );
21
+ add_action ( 'add_option_nfd_image_optimization ' , array ( $ this , 'on_image_optimization_change ' ), 10 , 2 );
21
22
add_action ( 'update_option_nfd_fonts_optimization ' , array ( $ this , 'on_fonts_optimization_change ' ), 10 , 2 );
23
+ add_action ( 'add_option_nfd_fonts_optimization ' , array ( $ this , 'on_fonts_optimization_change ' ), 10 , 2 );
22
24
add_action ( 'update_option_nfd_site_capabilities ' , array ( $ this , 'on_site_capabilities_change ' ), 10 , 2 );
25
+ add_action ( 'add_option_nfd_site_capabilities ' , array ( $ this , 'on_site_capabilities_change ' ), 10 , 2 );
23
26
}
24
27
25
28
/**
@@ -80,15 +83,15 @@ private function update_htaccess_header( $image_settings, $fonts_enabled ) {
80
83
$ rules = array (
81
84
'# BEGIN Newfold CF Optimization Header ' ,
82
85
'<IfModule mod_headers.c> ' ,
83
- "\tHeader set Set-Cookie \"nfd-enable-google-font-replace=true ; path=/; Max-Age=86400; HttpOnly \" env=nfd_cf_opt " ,
86
+ "\tHeader set Set-Cookie \"nfd-enable-cf-opt= { $ header_value } ; path=/; Max-Age=86400; HttpOnly \" env=nfd_cf_opt " ,
84
87
'</IfModule> ' ,
85
88
'# Exclude admin and API paths ' ,
86
89
'SetEnvIf Request_URI "^/wp-admin/" no_nfd_cf ' ,
87
90
'SetEnvIf Request_URI "^/wp-json/" no_nfd_cf ' ,
88
91
'SetEnvIf Request_URI "^/xmlrpc.php" no_nfd_cf ' ,
89
92
'SetEnvIf Request_URI "^/wp-login.php" no_nfd_cf ' ,
90
93
'SetEnvIf Request_URI "^/admin-ajax.php" no_nfd_cf ' ,
91
- '# Apply CF header on all non-admin, non-API requests ' ,
94
+ '# Apply CF cookie on all non-admin, non-API requests ' ,
92
95
'SetEnvIf Request_URI ".*" nfd_cf_opt=!no_nfd_cf ' ,
93
96
'# END Newfold CF Optimization Header ' ,
94
97
);
0 commit comments