Skip to content

Commit b9e1dfd

Browse files
authored
Add wpsc_cookies and wpsc_plugins related actions to modify those settings (#582)
This PR adds four actions to modify wpsc_cookies and wpsc_plugins: * wpsc_add_plugin * wpsc_delete_plugin * wpsc_add_cookie * wpsc_delete_cookie These actions will allow WordPress plugins to modify the cookies and plugins lists used by WP Super Cache instead of the add/delete functions introduced in #574 and #580. Duplicate entries are removed. Example code: For example, to add a cookie name called 'euCookie': `do_action( 'wpsc_add_cookie', 'euCookie' );` To remove that cookie: `do_action( 'wpsc_delete_cookie', 'euCookie' );`
1 parent b3e4857 commit b9e1dfd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

wp-cache.php

+10
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,11 @@ function wpsc_init() {
8383
}
8484

8585
functionwp_super_cache_init_action() {
86+
8687
load_plugin_textdomain( 'wp-super-cache', false, basename( dirname( __FILE__ ) ) . '/languages' );
8788

8889
wpsc_register_post_hooks();
90+
8991
}
9092
add_action( 'init', 'wp_super_cache_init_action' );
9193

@@ -4075,7 +4077,9 @@ function wpsc_add_plugin( $file ) {
40754077
$wpsc_plugins[] = $file;
40764078
wp_cache_setting( 'wpsc_plugins', $wpsc_plugins );
40774079
}
4080+
return$file;
40784081
}
4082+
add_action( 'wpsc_add_plugin', 'wpsc_add_plugin' );
40794083

40804084
functionwpsc_delete_plugin( $file ) {
40814085
global$wpsc_plugins;
@@ -4090,7 +4094,9 @@ function wpsc_delete_plugin( $file ) {
40904094
unset( $wpsc_plugins[ array_search( $file, $wpsc_plugins ) ] );
40914095
wp_cache_setting( 'wpsc_plugins', $wpsc_plugins );
40924096
}
4097+
return$file;
40934098
}
4099+
add_action( 'wpsc_delete_plugin', 'wpsc_delete_plugin' );
40944100

40954101
functionwpsc_get_plugins() {
40964102
global$wpsc_plugins;
@@ -4107,7 +4113,9 @@ function wpsc_add_cookie( $name ) {
41074113
$wpsc_cookies[] = $name;
41084114
wp_cache_setting( 'wpsc_cookies', $wpsc_cookies );
41094115
}
4116+
return$name;
41104117
}
4118+
add_action( 'wpsc_add_cookie', 'wpsc_add_cookie' );
41114119

41124120
functionwpsc_delete_cookie( $name ) {
41134121
global$wpsc_cookies;
@@ -4119,7 +4127,9 @@ function wpsc_delete_cookie( $name ) {
41194127
unset( $wpsc_cookies[ array_search( $name, $wpsc_cookies ) ] );
41204128
wp_cache_setting( 'wpsc_cookies', $wpsc_cookies );
41214129
}
4130+
return$name;
41224131
}
4132+
add_action( 'wpsc_delete_cookie', 'wpsc_delete_cookie' );
41234133

41244134
functionwpsc_get_cookies() {
41254135
global$wpsc_cookies;

0 commit comments

Comments
 (0)
close