Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/wp-rocket/inc/deprecated/3.12.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
3
+
defined( 'ABSPATH' ) || exit;
4
+
5
+
/**
6
+
* Add All in One SEO Sitemap option to WP Rocket options
7
+
*
8
+
* @since 3.12 deprecated
9
+
* @since 2.8
10
+
* @author Remy Perona
11
+
*
12
+
* @param Array $options Array of WP Rocket options.
13
+
* @return Array Updated array of WP Rocket options
14
+
*/
15
+
function rocket_add_all_in_one_seo_sitemap_option( $options ) {
16
+
_deprecated_function( __FUNCTION__, '3.12' );
17
+
$options['all_in_one_seo_xml_sitemap'] = 0;
18
+
19
+
return $options;
20
+
}
21
+
22
+
/**
23
+
* Sanitize the AIO SEO option value
24
+
*
25
+
* @since 3.12 deprecated
26
+
* @since 2.8
27
+
* @author Remy Perona
28
+
*
29
+
* @param Array $inputs Array of inputs values.
30
+
* @return Array Updated array of inputs $values
31
+
*/
32
+
function rocket_all_in_one_seo_sitemap_option_sanitize( $inputs ) {
33
+
_deprecated_function( __FUNCTION__, '3.12' );
34
+
$inputs['all_in_one_seo_xml_sitemap'] = ! empty( $inputs['all_in_one_seo_xml_sitemap'] ) ? 1 : 0;
35
+
36
+
return $inputs;
37
+
}
38
+
39
+
/**
40
+
* Add All in One SEO Sitemap sub-option on WP Rocket settings page
41
+
*
42
+
* @since 3.12 deprecated
43
+
* @since 2.8
44
+
* @author Remy Perona
45
+
*
46
+
* @param Array $options Array of WP Rocket options.
47
+
* @return Array Updated array of WP Rocket options
48
+
*/
49
+
function rocket_sitemap_preload_all_in_one_seo_option( $options ) {
50
+
_deprecated_function( __FUNCTION__, '3.12' );
51
+
$options['all_in_one_seo_xml_sitemap'] = [
52
+
'type' => 'checkbox',
53
+
'container_class' => [
54
+
'wpr-field--children',
55
+
],
56
+
'label' => __( 'All in One SEO XML sitemap', 'rocket' ),
57
+
// translators: %s = Name of the plugin.
58
+
'description' => sprintf( __( 'We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rocket' ), 'All in One SEO' ),
59
+
'parent' => 'sitemap_preload',
60
+
'section' => 'preload_section',
61
+
'page' => 'preload',
62
+
'default' => 0,
63
+
'sanitize_callback' => 'sanitize_checkbox',
64
+
];
65
+
66
+
return $options;
67
+
}
68
+
69
+
/**
70
+
* Add sitemap option to WP Rocket settings
71
+
*
72
+
* @since 3.12 deprecated
73
+
* @since 3.2.3
74
+
*
75
+
* @param array $options WP Rocket settings array.
76
+
* @return array Updated WP Rocket settings array
77
+
*/
78
+
function rank_math_rocket_sitemap_preload_option( $options ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals
79
+
_deprecated_function( __FUNCTION__, '3.12' );
80
+
$options['rank_math_xml_sitemap'] = [
81
+
'type' => 'checkbox',
82
+
'container_class' => [
83
+
'wpr-field--children',
84
+
],
85
+
'label' => __( 'Rank Math XML sitemap', 'rocket' ),
86
+
// translators: %s = Name of the plugin.
87
+
'description' => sprintf( __( 'We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rocket' ), 'Rank Math SEO' ),
88
+
'parent' => 'sitemap_preload',
89
+
'section' => 'preload_section',
90
+
'page' => 'preload',
91
+
'default' => 0,
92
+
'sanitize_callback' => 'sanitize_checkbox',
93
+
];
94
+
95
+
return $options;
96
+
}
97
+
98
+
/**
99
+
* Add sitemap option to WP Rocket default options
100
+
*
101
+
* @since 3.12 deprecated
102
+
* @since 3.2.3
103
+
*
104
+
* @param array $options WP Rocket options array.
105
+
* @return array Updated WP Rocket options array
106
+
*/
107
+
function rank_math_rocket_add_sitemap_option( $options ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals
108
+
_deprecated_function( __FUNCTION__, '3.12' );
109
+
$options['rank_math_xml_sitemap'] = 0;
110
+
111
+
return $options;
112
+
}
113
+
114
+
/**
115
+
* Sanitize SEO sitemap option value
116
+
*
117
+
* @since 3.12 deprecated
118
+
* @since 3.2.3
119
+
*
120
+
* @param array $inputs WP Rocket inputs array.
121
+
* @return array Sanitized WP Rocket inputs array
122
+
*/
123
+
function rank_math_rocket_sitemap_option_sanitize( $inputs ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals
124
+
_deprecated_function( __FUNCTION__, '3.12' );
125
+
$inputs['rank_math_xml_sitemap'] = ! empty( $inputs['rank_math_xml_sitemap'] ) ? 1 : 0;
126
+
127
+
return $inputs;
128
+
}
129
+
130
+
/**
131
+
* Add SEOPress sitemap option to WP Rocket default options
132
+
*
133
+
* @since 3.12 deprecated
134
+
* @since 3.3.6
135
+
* @author Benjamin Denis
136
+
* @source ./yoast-seo.php (Remy Perona)
137
+
*
138
+
* @param array $options WP Rocket options array.
139
+
* @return array Updated WP Rocket options array
140
+
*/
141
+
function rocket_add_seopress_sitemap_option( $options ) {
142
+
_deprecated_function( __FUNCTION__, '3.12' );
143
+
$options['seopress_xml_sitemap'] = 0;
144
+
145
+
return $options;
146
+
}
147
+
148
+
/**
149
+
* Sanitize SEOPress sitemap option value
150
+
*
151
+
* @since 3.12 deprecated
152
+
* @since 3.3.6
153
+
* @author Benjamin Denis
154
+
* @source ./yoast-seo.php (Remy Perona)
155
+
*
156
+
* @param array $inputs WP Rocket inputs array.
157
+
* @return array Sanitized WP Rocket inputs array
158
+
*/
159
+
function rocket_seopress_sitemap_option_sanitize( $inputs ) {
160
+
_deprecated_function( __FUNCTION__, '3.12' );
161
+
$inputs['seopress_xml_sitemap'] = ! empty( $inputs['seopress_xml_sitemap'] ) ? 1 : 0;
162
+
163
+
return $inputs;
164
+
}
165
+
166
+
/**
167
+
* Add SEOPress option to WP Rocket settings
168
+
*
169
+
* @since 3.12 deprecated
170
+
* @since 3.3.6
171
+
* @author Benjamin Denis
172
+
* @source ./yoast-seo.php (Remy Perona)
173
+
*
174
+
* @param array $options WP Rocket settings array.
175
+
* @return array Updated WP Rocket settings array
176
+
*/
177
+
function rocket_sitemap_preload_seopress_option( $options ) {
178
+
_deprecated_function( __FUNCTION__, '3.12' );
179
+
$options['seopress_xml_sitemap'] = [
180
+
'type' => 'checkbox',
181
+
'container_class' => [
182
+
'wpr-field--children',
183
+
],
184
+
'label' => __( 'SEOPress XML sitemap', 'rocket' ),
185
+
// translators: %s = Name of the plugin.
186
+
'description' => sprintf( __( 'We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rocket' ), 'SEOPress' ),
187
+
'parent' => 'sitemap_preload',
188
+
'section' => 'preload_section',
189
+
'page' => 'preload',
190
+
'default' => 0,
191
+
'sanitize_callback' => 'sanitize_checkbox',
192
+
];
193
+
194
+
return $options;
195
+
}
196
+
197
+
/**
198
+
* Adds a sitemap option in WP Rocket for The SEO Framework.
199
+
*
200
+
* @since 3.12 deprecated
201
+
* @since 3.2.1
202
+
* @author Sybre Waaijer
203
+
* @source ./yoast-seo.php (Remy Perona)
204
+
*
205
+
* @param array $options WP Rocket options array.
206
+
* @return array Updated WP Rocket options array
207
+
*/
208
+
function rocket_add_tsf_seo_sitemap_option( $options ) {
209
+
_deprecated_function( __FUNCTION__, '3.12' );
210
+
$options['tsf_xml_sitemap'] = 0;
211
+
212
+
return $options;
213
+
}
214
+
215
+
/**
216
+
* Sanitizes the added sitemap option for The SEO Framework.
217
+
*
218
+
* @since 3.12 deprecated
219
+
* @since 3.2.1
220
+
* @author Sybre Waaijer
221
+
* @source ./yoast-seo.php (Remy Perona)
222
+
*
223
+
* @param array $inputs WP Rocket inputs array.
224
+
* @return array Sanitized WP Rocket inputs array
225
+
*/
226
+
function rocket_tsf_seo_sitemap_option_sanitize( $inputs ) {
227
+
_deprecated_function( __FUNCTION__, '3.12' );
228
+
$inputs['tsf_xml_sitemap'] = ! empty( $inputs['tsf_xml_sitemap'] ) ? 1 : 0;
229
+
230
+
return $inputs;
231
+
}
232
+
233
+
/**
234
+
* Add The SEO Framework SEO option to WP Rocket settings
235
+
*
236
+
* @since 3.12 deprecated
237
+
* @since 3.2.1
238
+
* @author Sybre Waaijer
239
+
* @source ./yoast-seo.php (Remy Perona)
240
+
*
241
+
* @param array $options WP Rocket settings array.
242
+
* @return array Updated WP Rocket settings array
243
+
*/
244
+
function rocket_sitemap_add_tsf_sitemap_to_preload_option( $options ) {
245
+
_deprecated_function( __FUNCTION__, '3.12' );
246
+
$options['tsf_xml_sitemap'] = [
247
+
'type' => 'checkbox',
248
+
'container_class' => [
249
+
'wpr-field--children',
250
+
],
251
+
'label' => __( 'The SEO Framework XML sitemap', 'rocket' ),
252
+
// translators: %s = Name of the plugin.
253
+
'description' => sprintf( __( 'We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rocket' ), 'The SEO Framework' ),
254
+
'parent' => 'sitemap_preload',
255
+
'section' => 'preload_section',
256
+
'page' => 'preload',
257
+
'default' => 0,
258
+
'sanitize_callback' => 'sanitize_checkbox',
259
+
];
260
+
261
+
return $options;
262
+
}
263
+
264
+
/**
265
+
* Add Jetpack option to WP Rocket options
266
+
*
267
+
* @param Array $options WP Rocket options array.
268
+
* @return Array Updated WP Rocket options array
269
+
* @since 2.8
270
+
* @author Remy Perona
271
+
*
272
+
*/
273
+
function rocket_add_jetpack_sitemap_option($options)
274
+
{
275
+
_deprecated_function( __FUNCTION__, '3.12' );
276
+
$options['jetpack_xml_sitemap'] = 0;
277
+
278
+
return $options;
279
+
}
280
+
281
+
/**
282
+
* Sanitize jetpack option value
283
+
*
284
+
* @param Array $inputs Array of inputs values.
285
+
* @return Array Array of inputs values
286
+
* @since 2.8
287
+
* @author Remy Perona
288
+
*
289
+
*/
290
+
function rocket_jetpack_sitemap_option_sanitize($inputs)
291
+
{
292
+
_deprecated_function( __FUNCTION__, '3.12' );
293
+
$inputs['jetpack_xml_sitemap'] = !empty($inputs['jetpack_xml_sitemap']) ? 1 : 0;
294
+
295
+
return $inputs;
296
+
}
297
+
298
+
/**
299
+
* Add Jetpack sitemap to preload list
300
+
*
301
+
* @param Array $sitemaps Array of sitemaps to preload.
302
+
* @return Array Updated Array of sitemaps to preload
303
+
* @since 2.8
304
+
* @author Remy Perona
305
+
*
306
+
*/
307
+
function rocket_add_jetpack_sitemap($sitemaps)
308
+
{
309
+
_deprecated_function( __FUNCTION__, '3.12' );
310
+
if (get_rocket_option('jetpack_xml_sitemap', false)) {
311
+
$sitemaps['jetpack'] = jetpack_sitemap_uri();
312
+
}
313
+
314
+
return $sitemaps;
315
+
}
316
+
317
+
/**
318
+
* Add Jetpack sub-option to WP Rocket settings page
319
+
*
320
+
* @param Array $options WP Rocket options array.
321
+
* @return Array Updated WP Rocket options array
322
+
* @since 2.8
323
+
* @author Remy Perona
324
+
*
325
+
*/
326
+
function rocket_sitemap_preload_jetpack_option($options)
327
+
{
328
+
_deprecated_function( __FUNCTION__, '3.12' );
329
+
$options[] = [
330
+
'parent' => 'sitemap_preload',
331
+
'type' => 'checkbox',
332
+
'label' => __('Jetpack XML Sitemaps', 'rocket'),
333
+
'label_for' => 'jetpack_xml_sitemap',
334
+
'label_screen' => sprintf(__('Preload the sitemap from the Jetpack plugin', 'rocket'), 'Jetpack'),
335
+
'default' => 0,
336
+
];
337
+
$options[] = [
338
+
'parent' => 'sitemap_preload',
339
+
'type' => 'helper_description',
340
+
'name' => 'jetpack_xml_sitemap_desc',
341
+
// translators: %s = plugin name, e.g. Yoast SEO.
342
+
'description' => sprintf(__('We automatically detected the sitemap generated by the %s plugin. You can check the option to preload it.', 'rocket'), 'Jetpack'),
343
+
];
344
+
345
+
return $options;
346
+
}
347
+
348
+
349
+
/**
350
+
* Add the EU Cookie Law to the list of mandatory cookies before generating caching files.
351
+
*
352
+
* @param array $cookies List of mandatory cookies.
353
+
* @author Jeremy Herve
354
+
*
355
+
* @since 2.10.1
356
+
*/
357
+
function rocket_add_jetpack_cookie_law_mandatory_cookie($cookies)
358
+
{
359
+
_deprecated_function( __FUNCTION__, '3.12' );
360
+
$cookies['jetpack-eu-cookie-law'] = 'eucookielaw';
361
+
362
+
return $cookies;
363
+
}
364
+
365
+
/**
366
+
* Add Jetpack cookie when:
367
+
* - Jetpack is active.
368
+
* - Jetpack's Extra Sidebar Widgets module is active.
369
+
* - The widget is active.
370
+
* - the rocket_jetpack_eu_cookie_widget option is empty or not set.
371
+
*
372
+
* @since 2.10.1
373
+
* @author Jeremy Herve
374
+
*/
375
+
function rocket_activate_jetpack_cookie_law()
376
+
{
377
+
_deprecated_function( __FUNCTION__, '3.12' );
378
+
$rocket_jp_eu_cookie_widget = get_option('rocket_jetpack_eu_cookie_widget');
379
+
380
+
if (
381
+
is_active_widget(false, false, 'eu_cookie_law_widget')
382
+
&& empty($rocket_jp_eu_cookie_widget)
383
+
) {
384
+
add_filter('rocket_htaccess_mod_rewrite', '__return_false', 76);
385
+
add_filter('rocket_cache_mandatory_cookies', 'rocket_add_jetpack_cookie_law_mandatory_cookie');
386
+
387
+
// Update the WP Rocket rules on the .htaccess file.
388
+
flush_rocket_htaccess();
389
+
390
+
// Regenerate the config file.
391
+
rocket_generate_config_file();
392
+
393
+
// Set the option, so this is not triggered again.
394
+
update_option('rocket_jetpack_eu_cookie_widget', 1, true);
395
+
}
396
+
}
397
+
398
+
/**
399
+
* Remove cookies if Jetpack gets deactivated.
400
+
*
401
+
* @since 2.10.1
402
+
* @author Jeremy Herve
403
+
*/
404
+
function rocket_remove_jetpack_cookie_law_mandatory_cookie()
405
+
{
406
+
_deprecated_function( __FUNCTION__, '3.12' );
407
+
remove_filter('rocket_htaccess_mod_rewrite', '__return_false', 76);
408
+
remove_filter('rocket_cache_mandatory_cookies', '_rocket_add_eu_cookie_law_mandatory_cookie');
409
+
410
+
// Update the WP Rocket rules on the .htaccess file.
411
+
flush_rocket_htaccess();
412
+
413
+
// Regenerate the config file.
414
+
rocket_generate_config_file();
415
+
416
+
// Delete our option.
417
+
delete_option('rocket_jetpack_eu_cookie_widget');
418
+
}
419
+
420
+
/**
421
+
* Add SEO sitemap URL to the sitemaps to preload
422
+
*
423
+
* @since 3.2.3
424
+
*
425
+
* @param array $sitemaps Sitemaps to preload.
426
+
* @return array Updated Sitemaps to preload
427
+
*/
428
+
function rank_math_rocket_sitemap( $sitemaps ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals
429
+
_deprecated_function( __FUNCTION__, '3.12' );
430
+
if ( get_rocket_option( 'rank_math_xml_sitemap', false ) ) {
431
+
$sitemaps[] = \RankMath\Sitemap\Router::get_base_url( 'sitemap_index.xml' );
432
+
}
433
+
434
+
return $sitemaps;
435
+
}
436
+
437
+
/**
438
+
* Add All in One SEO Sitemap to the preload list
439
+
*
440
+
* @since 2.8
441
+
* @author Remy Perona
442
+
*
443
+
* @param Array $sitemaps Array of sitemaps to preload.
444
+
* @return Array Updated array of sitemaps to preload
445
+
*/
446
+
function rocket_add_all_in_one_seo_sitemap( $sitemaps ) {
447
+
_deprecated_function( __FUNCTION__, '3.12' );
448
+
if ( ! get_rocket_option( 'all_in_one_seo_xml_sitemap', false ) ) {
449
+
return $sitemaps;
450
+
}
451
+
452
+
$aioseo_v3 = defined( 'AIOSEOP_VERSION' );
453
+
$aioseo_v4 = defined( 'AIOSEO_VERSION' ) && function_exists( 'aioseo' );
454
+
455
+
if ( ! $aioseo_v3 && ! $aioseo_v4 ) {
456
+
return $sitemaps;
457
+
}
458
+
459
+
$sitemap_enabled = false;
460
+
if ( $aioseo_v3 ) {
461
+
$aioseop_options = get_option( 'aioseop_options' );
462
+
$sitemap_enabled = ( isset( $aioseop_options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_sitemap'] ) && 'on' === $aioseop_options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_sitemap'] ) || ( ! isset( $aioseop_options['modules']['aiosp_feature_manager_options'] ) && isset( $aioseop_options['modules']['aiosp_sitemap_options'] ) );
463
+
}
464
+
465
+
if (
466
+
( $aioseo_v3 && ! $sitemap_enabled ) ||
467
+
( $aioseo_v4 && ! aioseo()->options->sitemap->general->enable )
468
+
) {
469
+
return $sitemaps;
470
+
}
471
+
472
+
if ( $aioseo_v3 ) {
473
+
$sitemaps[] = trailingslashit( home_url() ) . apply_filters( 'aiosp_sitemap_filename', 'sitemap' ) . '.xml'; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals
474
+
} elseif ( $aioseo_v4 ) {
475
+
$sitemaps[] = trailingslashit( home_url() ) . apply_filters( 'aioseo_sitemap_filename', 'sitemap' ) . '.xml'; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals
476
+
}
477
+
478
+
return $sitemaps;
479
+
}
480
+
481
+
/**
482
+
* Add SEOPress sitemap URL to the sitemaps to preload
483
+
*
484
+
* @since 3.3.6
485
+
* @author Benjamin Denis
486
+
* @source ./yoast-seo.php (Remy Perona)
487
+
*
488
+
* @param array $sitemaps Sitemaps to preload.
489
+
* @return array Updated Sitemaps to preload
490
+
*/
491
+
function rocket_add_seopress_sitemap( $sitemaps ) {
492
+
_deprecated_function( __FUNCTION__, '3.12' );
493
+
if ( get_rocket_option( 'seopress_xml_sitemap', false ) ) {
494
+
$sitemaps[] = get_home_url() . '/sitemaps.xml';
495
+
}
496
+
497
+
return $sitemaps;
498
+
}
499
+
500
+
/**
501
+
* Runs detection and adds extra compatibility for The SEO Framework plugin.
502
+
*
503
+
* @since 3.2.1
504
+
* @since TODO Removed "conflicting sitemap detection" (detect_sitemap_plugin) call.
505
+
* TSF always tries to output it now while trying to give WP Rewrite priority for display.
506
+
* @author Sybre Waaijer
507
+
*/
508
+
function rocket_add_tsf_compat() {
509
+
_deprecated_function( __FUNCTION__, '3.12' );
510
+
511
+
$tsf = the_seo_framework();
512
+
513
+
// Either TSF < 3.1, or the plugin's silenced (soft-disabled) via a drop-in.
514
+
if ( empty( $tsf->loaded ) ) {
515
+
return;
516
+
}
517
+
518
+
/**
519
+
* 1. Performs option & other checks.
520
+
* 2. Checks for conflicting sitemap plugins that might prevent loading.
521
+
*
522
+
* These methods cache their output at runtime.
523
+
*
524
+
* @link https://github.com/wp-media/wp-rocket/issues/899
525
+
*/
526
+
if ( $tsf->can_run_sitemap() ) {
527
+
rocket_add_tsf_sitemap_compat();
528
+
}
529
+
}
530
+
531
+
/**
532
+
* Adds compatibility for the sitemap functionality in The SEO Framework plugin.
533
+
*
534
+
* @since 3.2.1
535
+
* @author Sybre Waaijer
536
+
*/
537
+
function rocket_add_tsf_sitemap_compat() {
538
+
_deprecated_function( __FUNCTION__, '3.12' );
539
+
540
+
add_filter( 'rocket_sitemap_preload_list', 'rocket_add_tsf_sitemap_to_preload' );
541
+
}
542
+
543
+
/**
544
+
* Adds TSF sitemap URLs to preload.
545
+
*
546
+
* @since 3.2.1
547
+
* @since TODO Added compatibility support for The SEO Framework v4.0+
548
+
* @author Sybre Waaijer
549
+
* @source ./yoast-seo.php (Remy Perona)
550
+
*
551
+
* @param array $sitemaps Sitemaps to preload.
552
+
* @return array Updated Sitemaps to preload
553
+
*/
554
+
function rocket_add_tsf_sitemap_to_preload( $sitemaps ) {
555
+
_deprecated_function( __FUNCTION__, '3.12' );
556
+
557
+
if ( get_rocket_option( 'tsf_xml_sitemap', false ) ) {
558
+
// The autoloader in TSF doesn't check for file_exists(). So, use version compare instead to prevent fatal errors.
559
+
if ( version_compare( THE_SEO_FRAMEWORK_VERSION, '4.0', '>=' ) ) {
560
+
// TSF 4.0+. Expect the class to exist indefinitely.
561
+
562
+
$sitemap_bridge = The_SEO_Framework\Bridges\Sitemap::get_instance();
563
+
564
+
foreach ( $sitemap_bridge->get_sitemap_endpoint_list() as $id => $data ) {
565
+
// When the sitemap is good enough for a robots display, we determine it as valid for precaching.
566
+
// Non-robots display types are among the stylesheet endpoint, or the Yoast SEO-compatible endpoint.
567
+
// In other words, this enables support for ALL current and future public sitemap endpoints.
568
+
if ( ! empty( $data['robots'] ) ) {
569
+
$sitemaps[] = $sitemap_bridge->get_expected_sitemap_endpoint_url( $id );
570
+
}
571
+
}
572
+
} else {
573
+
// Deprecated. TSF <4.0.
574
+
$sitemaps[] = the_seo_framework()->get_sitemap_xml_url();
575
+
}
576
+
}
577
+
578
+
return $sitemaps;
579
+
}
580
+
581
+
/**
582
+
* Launches the Homepage preload (helper function for backward compatibility)
583
+
*
584
+
* @since 2.6.4 Don't preload localhost & .dev domains
585
+
* @since 1.0
586
+
*
587
+
* @param string $spider (default: 'cache-preload') The spider name: cache-preload or cache-json.
588
+
* @param string $lang (default: '') The language code to preload.
589
+
*
590
+
* @return bool Status of preload.
591
+
*/
592
+
function run_rocket_bot( $spider = 'cache-preload', $lang = '' ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals
593
+
_deprecated_function( __FUNCTION__, '3.12' );
594
+
if ( ! get_rocket_option( 'manual_preload' ) ) {
595
+
return false;
596
+
}
597
+
598
+
$urls = [];
599
+
600
+
if ( ! $lang ) {
601
+
$urls = get_rocket_i18n_uri();
602
+
} else {
603
+
$urls[] = get_rocket_i18n_home_url( $lang );
604
+
}
605
+
606
+
$container = apply_filters( 'rocket_container', null );
607
+
608
+
if ( ! $container ) {
609
+
return false;
610
+
}
611
+
612
+
$controller = $container->get( 'preload_clean_controller' );
613
+
614
+
$controller->partial_clean( $urls );
615
+
616
+
return true;
617
+
}
618
+
619
+
/**
620
+
* Launches the sitemap preload (helper function for backward compatibility)
621
+
*
622
+
* @since 2.8
623
+
* @author Remy Perona
624
+
*
625
+
* @return void
626
+
*/
627
+
function run_rocket_sitemap_preload() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals
628
+
_deprecated_function( __FUNCTION__, '3.12' );
629
+
if ( ! get_rocket_option( 'manual_preload' ) ) {
630
+
return;
631
+
}
632
+
633
+
$container = apply_filters( 'rocket_container', null );
634
+
635
+
if ( ! $container ) {
636
+
return;
637
+
}
638
+
639
+
$controller = $container->get( 'load_initial_sitemap_controller' );
640
+
641
+
$controller->load_initial_sitemap();
642
+
}
643
+
644
+
/**
645
+
* Excludes Uncode init and ai-uncode JS files from minification/combine
646
+
*
647
+
* @since 3.12.3 deprecated
648
+
* @since 3.1
649
+
* @author Remy Perona
650
+
*
651
+
* @param array $excluded_js Array of JS filepaths to be excluded.
652
+
* @return array
653
+
*/
654
+
function rocket_exclude_js_uncode( $excluded_js ) {
655
+
_deprecated_function( __FUNCTION__, '3.12.3' );
656
+
$excluded_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/init.js' );
657
+
$excluded_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/min/init.min.js' );
658
+
$excluded_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/init.min.js' );
659
+
$excluded_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/ai-uncode.js' );
660
+
$excluded_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/min/ai-uncode.min.js' );
661
+
$excluded_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/ai-uncode.min.js' );
662
+
663
+
return $excluded_js;
664
+
}
665
+
666
+
/**
667
+
* Excludes some Uncode inline scripts from combine JS
668
+
*
669
+
* @since 3.12.3 deprecated
670
+
* @since 3.1
671
+
* @author Remy Perona
672
+
*
673
+
* @param array $inline_js Array of patterns to match for exclusion.
674
+
* @return array
675
+
*/
676
+
function rocket_exclude_inline_js_uncode( $inline_js ) {
677
+
_deprecated_function( __FUNCTION__, '3.12.3' );
678
+
$inline_js[] = 'SiteParameters';
679
+
$inline_js[] = 'script-';
680
+
$inline_js[] = 'initBox';
681
+
$inline_js[] = 'initHeader';
682
+
$inline_js[] = 'fixMenuHeight';
683
+
684
+
return $inline_js;
685
+
}
686
+
687
+
/**
688
+
* Excludes Uncode JS files from defer JS
689
+
*
690
+
* @since 3.12.3 deprecated
691
+
* @since 3.2.5
692
+
* @author Remy Perona
693
+
*
694
+
* @param array $exclude_defer_js Array of JS filepaths to be excluded.
695
+
* @return array
696
+
*/
697
+
function rocket_exclude_defer_js_uncode( $exclude_defer_js ) {
698
+
_deprecated_function( __FUNCTION__, '3.12.3' );
699
+
$exclude_defer_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/init.js' );
700
+
$exclude_defer_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/min/init.min.js' );
701
+
$exclude_defer_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/init.min.js' );
702
+
$exclude_defer_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/min/ai-uncode.min.js' );
703
+
$exclude_defer_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/ai-uncode.min.js' );
704
+
$exclude_defer_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/ai-uncode.js' );
705
+
return $exclude_defer_js;
706
+
}
707
+
708
+
/**
709
+
* Excludes Uncode JS files from delay JS
710
+
*
711
+
* @since 3.12.3 deprecated
712
+
* @since 3.10.5
713
+
*
714
+
* @param array $exclude_delay_js Array of JS to be excluded.
715
+
* @return array
716
+
*/
717
+
function rocket_exclude_delay_js_uncode( $exclude_delay_js ) {
718
+
_deprecated_function( __FUNCTION__, '3.12.3' );
719
+
$exclude_delay_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/init.js' );
720
+
$exclude_delay_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/min/init.min.js' );
721
+
$exclude_delay_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/init.min.js' );
722
+
$exclude_delay_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/min/ai-uncode.min.js' );
723
+
$exclude_delay_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/ai-uncode.min.js' );
724
+
$exclude_delay_js[] = rocket_clean_exclude_file( get_template_directory_uri() . '/library/js/ai-uncode.js' );
725
+
$exclude_delay_js[] = 'UNCODE\.';
726
+
return $exclude_delay_js;
727
+
}
728
+