Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/wp-rocket/inc/deprecated/3.11.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
3
+
/**
4
+
* Add Yoast SEO sitemap option to WP Rocket default options
5
+
*
6
+
* @since 2.8
7
+
* @since 3.11.1 deprecated
8
+
*
9
+
* @author Remy Perona
10
+
*
11
+
* @param array $options WP Rocket options array.
12
+
* @return array Updated WP Rocket options array
13
+
*/
14
+
function rocket_add_yoast_seo_sitemap_option( $options ) {
15
+
_deprecated_function( __FUNCTION__ . '()', '3.11.1' );
16
+
17
+
$options['yoast_xml_sitemap'] = 0;
18
+
19
+
return $options;
20
+
}
21
+
22
+
/**
23
+
* Sanitize Yoast SEO sitemap option value
24
+
*
25
+
* @since 2.8
26
+
* @since 3.11.1 deprecated
27
+
*
28
+
* @author Remy Perona
29
+
*
30
+
* @param array $inputs WP Rocket inputs array.
31
+
* @return array Sanitized WP Rocket inputs array
32
+
*/
33
+
function rocket_yoast_seo_sitemap_option_sanitize( $inputs ) {
34
+
_deprecated_function( __FUNCTION__ . '()', '3.11.1' );
35
+
36
+
$inputs['yoast_xml_sitemap'] = ! empty( $inputs['yoast_xml_sitemap'] ) ? 1 : 0;
37
+
38
+
return $inputs;
39
+
}
40
+
41
+
/**
42
+
* Add Yoast SEO sitemap URL to the sitemaps to preload
43
+
*
44
+
* @since 2.8
45
+
* @since 3.11.1 deprecated
46
+
*
47
+
* @author Remy Perona
48
+
*
49
+
* @param array $sitemaps Sitemaps to preload.
50
+
* @return array Updated Sitemaps to preload
51
+
*/
52
+
function rocket_add_yoast_seo_sitemap( $sitemaps ) {
53
+
_deprecated_function( __FUNCTION__ . '()', '3.11.1' );
54
+
55
+
if ( get_rocket_option( 'yoast_xml_sitemap', false ) ) {
56
+
$sitemaps[] = WPSEO_Sitemaps_Router::get_base_url( 'sitemap_index.xml' );
57
+
}
58
+
59
+
return $sitemaps;
60
+
}
61
+
62
+
/**
63
+
* Add Yoast SEO option to WP Rocket settings
64
+
*
65
+
* @since 2.8
66
+
* @since 3.11.1 deprecated
67
+
*
68
+
* @author Remy Perona
69
+
*
70
+
* @param array $options WP Rocket settings array.
71
+
* @return array Updated WP Rocket settings array
72
+
*/
73
+
function rocket_sitemap_preload_yoast_seo_option( $options ) {
74
+
_deprecated_function( __FUNCTION__ . '()', '3.11.1' );
75
+
76
+
$options['yoast_xml_sitemap'] = [
77
+
'type' => 'checkbox',
78
+
'container_class' => [
79
+
'wpr-field--children',
80
+
],
81
+
'label' => __( 'Yoast SEO XML sitemap', 'rocket' ),
82
+
// translators: %s = Name of the plugin.
83
+
'description' => sprintf( __( 'We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rocket' ), 'Yoast SEO' ),
84
+
'parent' => 'sitemap_preload',
85
+
'section' => 'preload_section',
86
+
'page' => 'preload',
87
+
'default' => 0,
88
+
'sanitize_callback' => 'sanitize_checkbox',
89
+
];
90
+
91
+
return $options;
92
+
}
93
+
94
+
/**
95
+
* Clear Kinsta cache when clearing WP Rocket cache
96
+
*
97
+
* @since 3.0
98
+
* @author Remy Perona
99
+
*
100
+
* @return void
101
+
*/
102
+
function rocket_clean_kinsta_cache() {
103
+
global $kinsta_cache;
104
+
_deprecated_function( __FUNCTION__ . '()', '3.11.1' );
105
+
106
+
if ( ! empty( $kinsta_cache->kinsta_cache_purge ) ) {
107
+
$kinsta_cache->kinsta_cache_purge->purge_complete_caches();
108
+
}
109
+
}
110
+
111
+
/**
112
+
* Partially clear Kinsta cache when partially clearing WP Rocket cache
113
+
*
114
+
* @since 3.0
115
+
* @author Remy Perona
116
+
*
117
+
* @param object $post Post object.
118
+
* @return void
119
+
*/
120
+
function rocket_clean_kinsta_post_cache( $post ) {
121
+
_deprecated_function( __FUNCTION__ . '()', '3.11.1' );
122
+
global $kinsta_cache;
123
+
$kinsta_cache->kinsta_cache_purge->initiate_purge( $post->ID, 'post' );
124
+
}
125
+
126
+
127
+
/**
128
+
* Clears Kinsta cache for the homepage URL when using "Purge this URL" from the admin bar on the front end
129
+
*
130
+
* @since 3.0.4
131
+
* @author Remy Perona
132
+
*
133
+
* @param string $root WP Rocket root cache path.
134
+
* @param string $lang Current language.
135
+
* @return void
136
+
*/
137
+
function rocket_clean_kinsta_cache_home( $root = '', $lang = '' ) {
138
+
_deprecated_function( __FUNCTION__ . '()', '3.11.1' );
139
+
$url = get_rocket_i18n_home_url( $lang );
140
+
$url = trailingslashit( $url ) . 'kinsta-clear-cache/';
141
+
142
+
wp_remote_get(
143
+
$url,
144
+
[
145
+
'blocking' => false,
146
+
'timeout' => 0.01,
147
+
]
148
+
);
149
+
}
150
+
151
+
/**
152
+
* Clears Kinsta cache for a specific URL when using "Purge this URL" from the admin bar on the front end
153
+
*
154
+
* @since 3.0.4
155
+
* @author Remy Perona
156
+
*
157
+
* @param string $url URL to purge.
158
+
* @return void
159
+
*/
160
+
function rocket_clean_kinsta_cache_url( $url ) {
161
+
_deprecated_function( __FUNCTION__ . '()', '3.11.1' );
162
+
$url = trailingslashit( $url ) . 'kinsta-clear-cache/';
163
+
164
+
wp_remote_get(
165
+
$url,
166
+
[
167
+
'blocking' => false,
168
+
'timeout' => 0.01,
169
+
]
170
+
);
171
+
}
172
+
173
+
/**
174
+
* Remove WP Rocket functions on WP core action hooks to prevent triggering a double cache clear.
175
+
*
176
+
* @since 3.0
177
+
* @author Remy Perona
178
+
*
179
+
* @return void
180
+
*/
181
+
function rocket_remove_partial_purge_hooks() {
182
+
_deprecated_function( __FUNCTION__ . '()', '3.11.1' );
183
+
// WP core action hooks rocket_clean_post() gets hooked into.
184
+
$clean_post_hooks = [
185
+
// Disables the refreshing of partial cache when content is edited.
186
+
'wp_trash_post',
187
+
'delete_post',
188
+
'clean_post_cache',
189
+
'wp_update_comment_count',
190
+
];
191
+
192
+
// Remove rocket_clean_post() from core action hooks.
193
+
array_map(
194
+
function( $hook ) {
195
+
remove_action( $hook, 'rocket_clean_post' );
196
+
},
197
+
$clean_post_hooks
198
+
);
199
+
200
+
remove_filter( 'rocket_clean_files', 'rocket_clean_files_users' );
201
+
}
202
+
203
+
/**
204
+
* Do the rollback
205
+
*
206
+
* @since 3.11.5 deprecated
207
+
* @since 2.4
208
+
*/
209
+
function rocket_rollback() {
210
+
_deprecated_function( __FUNCTION__ . '()', '3.11.5' );
211
+
if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_GET['_wpnonce'] ), 'rocket_rollback' ) ) {
212
+
wp_nonce_ays( '' );
213
+
}
214
+
215
+
/**
216
+
* Fires before doing the rollback
217
+
*/
218
+
do_action( 'rocket_before_rollback' );
219
+
220
+
$plugin_transient = get_site_transient( 'update_plugins' );
221
+
$plugin_folder = plugin_basename( dirname( WP_ROCKET_FILE ) );
222
+
$plugin = $plugin_folder . '/' . basename( WP_ROCKET_FILE );
223
+
224
+
$plugin_transient->response[ $plugin ] = (object) [
225
+
'slug' => $plugin_folder,
226
+
'new_version' => WP_ROCKET_LASTVERSION,
227
+
'url' => 'https://wp-rocket.me',
228
+
'package' => sprintf( 'https://wp-rocket.me/%s/wp-rocket_%s.zip', get_rocket_option( 'consumer_key' ), WP_ROCKET_LASTVERSION ),
229
+
];
230
+
231
+
set_site_transient( 'update_plugins', $plugin_transient );
232
+
233
+
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
234
+
235
+
// translators: %s is the plugin name.
236
+
$title = sprintf( __( '%s Update Rollback', 'rocket' ), WP_ROCKET_PLUGIN_NAME );
237
+
$nonce = 'upgrade-plugin_' . $plugin;
238
+
$url = 'update.php?action=upgrade-plugin&plugin=' . rawurlencode( $plugin );
239
+
$upgrader_skin = new Plugin_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'plugin' ) );
240
+
$upgrader = new Plugin_Upgrader( $upgrader_skin );
241
+
242
+
remove_filter( 'site_transient_update_plugins', 'rocket_check_update', 1 );
243
+
add_filter( 'update_plugin_complete_actions', 'rocket_rollback_add_return_link' );
244
+
rocket_put_content( WP_CONTENT_DIR . '/advanced-cache.php', '' );
245
+
246
+
$upgrader->upgrade( $plugin );
247
+
248
+
wp_die(
249
+
'',
250
+
// translators: %s is the plugin name.
251
+
esc_html( sprintf( __( '%s Update Rollback', 'rocket' ), WP_ROCKET_PLUGIN_NAME ) ),
252
+
[
253
+
'response' => 200,
254
+
]
255
+
);
256
+
}
257
+
258
+
/**
259
+
* After a rollback has been done, replace the "return to" link by a link pointing to WP Rocket's tools page.
260
+
* A link to the plugins page is kept in case the plugin is not reactivated correctly.
261
+
*
262
+
* @since 3.11.5 deprecated
263
+
* @since 3.2.4
264
+
* @author Grégory Viguier
265
+
* @author Arun Basil Lal
266
+
*
267
+
* @param array $update_actions Array of plugin action links.
268
+
* @return array The array of links where the "return to" link has been replaced.
269
+
*/
270
+
function rocket_rollback_add_return_link( $update_actions ) {
271
+
_deprecated_function( __FUNCTION__ . '()', '3.11.5' );
272
+
273
+
if ( ! isset( $update_actions['plugins_page'] ) ) {
274
+
return $update_actions;
275
+
}
276
+
277
+
$update_actions['plugins_page'] = sprintf(
278
+
/* translators: 1 and 3 are link openings, 2 is a link closing. */
279
+
__( '%1$sReturn to WP Rocket%2$s or %3$sgo to Plugins page%2$s', 'rocket' ),
280
+
'<a href="' . esc_url( admin_url( 'options-general.php?page=' . WP_ROCKET_PLUGIN_SLUG ) . '#tools' ) . '" target="_parent">',
281
+
'</a>',
282
+
'<a href="' . esc_url( admin_url( 'plugins.php' ) ) . '" target="_parent">'
283
+
);
284
+
285
+
return $update_actions;
286
+
}
287
+