PluginProbe
Polylang / 2.7.3
Polylang v2.7.3
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | include/functions.php +38 -13 2.92.7.3 View file →
@@ -1,8 +1,5 @@
1 1 <?php
2 -/**
3 - * @package Polylang
4 - */
5 2
6 3 /**
7 4 * Define wordpress.com VIP equivalent of uncached functions
8 5 * WordPress backward compatibility functions
@@ -24,22 +21,50 @@
24 21 return get_page_by_title( $page_title, $output, $post_type ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.get_page_by_title_get_page_by_title
25 22 }
26 23 }
27 24
28 -if ( ! function_exists( 'wpcom_vip_get_page_by_path' ) ) {
25 +if ( ! function_exists( 'wp_doing_ajax' ) ) {
29 26 /**
30 - * Retrieves a page given its path.
27 + * Determines whether the current request is a WordPress Ajax request.
28 + * Backward compatibility function for WP < 4.7
31 29 *
32 - * @since 2.8.3
30 + * @since 2.2
33 31 *
34 - * @param string $page_path Page path.
35 - * @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
36 - * a WP_Post object, an associative array, or a numeric array, respectively. Default OBJECT.
37 - * @param string|array $post_type Optional. Post type or array of post types. Default 'page'.
38 - * @return WP_Post|array|null WP_Post (or array) on success, or null on failure.
32 + * @return bool True if it's a WordPress Ajax request, false otherwise.
39 33 */
40 - function wpcom_vip_get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
41 - return get_page_by_path( $page_path, $output, $post_type ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.get_page_by_path_get_page_by_path
34 + function wp_doing_ajax() {
35 + /** This filter is documented in wp-includes/load.php */
36 + return apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX );
37 + }
38 +}
39 +
40 +if ( ! function_exists( 'wp_doing_cron' ) ) {
41 + /**
42 + * Determines whether the current request is a WordPress cron request.
43 + * Backward compatibility function for WP < 4.8
44 + *
45 + * @since 2.6
46 + *
47 + * @return bool True if it's a WordPress cron request, false otherwise.
48 + */
49 + function wp_doing_cron() {
50 + /** This filter is documented in wp-includes/load.php */
51 + return apply_filters( 'wp_doing_cron', defined( 'DOING_CRON' ) && DOING_CRON );
52 + }
53 +}
54 +
55 +if ( ! function_exists( 'wp_using_themes' ) ) {
56 + /**
57 + * Determines whether the current request should use themes.
58 + * Backward compatibility function for WP < 5.1
59 + *
60 + * @since 2.6
61 + *
62 + * @return bool True if themes should be used, false otherwise.
63 + */
64 + function wp_using_themes() {
65 + /** This filter is documented in wp-includes/load.php */
66 + return apply_filters( 'wp_using_themes', defined( 'WP_USE_THEMES' ) && WP_USE_THEMES );
42 67 }
43 68 }
44 69
45 70 /**