// (#3) if ( null === $wp_rewrite ) { $wp_rewrite = new \WP_Rewrite(); //phpcs:ignore } // (#4) $rest_url = wp_parse_url( trailingslashit( rest_url() ) ); $current_url = wp_parse_url( add_query_arg( [] ) ); if ( ! isset( $current_url['path'] ) || ! isset( $rest_url['path'] ) ) { return false; } return 0 === strpos( $current_url['path'], $rest_url['path'], 0 ); } /** * Check if the request is heartbeat. * * @return bool */ public static function is_heartbeat() { return 'heartbeat' === Param::post( 'action' ); } /** * Check if the request is from frontend. * * @codeCoverageIgnore * * @return bool */ public function is_frontend() { return ! is_admin(); } /** * Is WooCommerce Installed * * @return bool */ public static function is_woocommerce_active() { // @codeCoverageIgnoreStart if ( ! function_exists( 'is_plugin_active' ) ) { include_once ABSPATH . 'wp-admin/includes/plugin.php'; // @phpstan-ignore-line } // @codeCoverageIgnoreEnd return is_plugin_active( 'woocommerce/woocommerce.php' ) && function_exists( 'is_woocommerce' ); } /** * Is EDD Installed * * @return bool */ public static function is_edd_active() { return class_exists( 'Easy_Digital_Downloads' ); } }