Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/wp-rocket/inc/3rd-party/plugins/ecommerce/give.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 +
3 + defined( 'ABSPATH' ) || exit;
4 +
5 + /**
6 + * Exclude pages of Give plugin from cache.
7 + *
8 + * @since 2.7
9 + */
10 + if ( defined( 'GIVE_VERSION' ) && function_exists( 'give_get_settings' ) ) {
11 + add_filter( 'rocket_cache_reject_uri', 'rocket_add_give_exclude_pages' );
12 +
13 + if ( is_admin() ) {
14 + add_action( 'update_option_give_settings', 'rocket_after_update_single_options', 10, 2 );
15 + }
16 + }
17 +
18 + /**
19 + * Add give pages to the excluded pages
20 + *
21 + * @since 2.7
22 + *
23 + * @param Array $urls Array of excluded pages.
24 + * @return Array Updated array of excluded pages
25 + */
26 + function rocket_add_give_exclude_pages( $urls ) {
27 + $give_options = give_get_settings();
28 + $urls = array_merge( $urls, get_rocket_i18n_translated_post_urls( $give_options['success_page'], 'page' ) );
29 + $urls = array_merge( $urls, get_rocket_i18n_translated_post_urls( $give_options['history_page'], 'page' ) );
30 + $urls = array_merge( $urls, get_rocket_i18n_translated_post_urls( $give_options['failure_page'], 'page' ) );
31 +
32 + return $urls;
33 + }
34 +
35 + /**
36 + * Add give pages to the excluded pages when activating the plugin
37 + *
38 + * @since 2.7
39 + */
40 + function rocket_activate_give() {
41 + add_filter( 'rocket_cache_reject_uri', 'rocket_add_give_exclude_pages' );
42 +
43 + // Update the WP Rocket rules on the .htaccess.
44 + flush_rocket_htaccess();
45 +
46 + // Regenerate the config file.
47 + rocket_generate_config_file();
48 + }
49 + add_action( 'activate_give/give.php', 'rocket_activate_give', 11 );
50 +
51 + /**
52 + * Remove give pages from the excluded pages when activating the plugin
53 + *
54 + * @since 2.7
55 + */
56 + function rocket_remove_give_exclude_pages() {
57 + remove_filter( 'rocket_cache_reject_uri', 'rocket_add_give_exclude_pages' );
58 +
59 + // Update the WP Rocket rules on the .htaccess.
60 + flush_rocket_htaccess();
61 +
62 + // Regenerate the config file.
63 + rocket_generate_config_file();
64 + }
65 + add_action( 'deactivate_give/give.php', 'rocket_remove_give_exclude_pages', 11 );
66 +