"contain", "content" => "bwfan-action", "type" => "page" ], [ "prefix" => "contain", "content" => "bwfan-track-id", "type" => "page" ], [ "prefix" => "contain", "content" => "bwfan-link-trigger", "type" => "page" ], [ "prefix" => "contain", "content" => "bwfan-track-action", "type" => "page" ], [ "prefix" => "contain", "content" => "wp-json/woofunnels/", "type" => "page" ], [ "prefix" => "contain", "content" => "wp-json/autonami/", "type" => "page" ], [ "prefix" => "contain", "content" => "wp-json/funnelkit-automations", "type" => "page" ], [ "prefix" => "contain", "content" => "wp-json/funnelkit-app", "type" => "page" ], [ "prefix" => "contain", "content" => "wp-json/woofunnel_customer/", "type" => "page" ], [ "prefix" => "contain", "content" => "wp-json/autonami-app", "type" => "page" ], [ "prefix" => "contain", "content" => "wp-json/autonami-webhook", "type" => "page" ] ]; $new_rules = array_filter( $new_rules_array, function ( $new_rule ) use ( $existing_rules ) { return ! in_array( $new_rule, $existing_rules, true ); } ); if ( empty( $new_rules ) ) { return; } $updated_array = array_merge( $existing_rules, $new_rules ); $updated_json = wp_json_encode( $updated_array ); update_option( 'WpFastestCacheExclude', $updated_json ); } /** * Convert string/ json to array * * @param $value * * @return array */ public static function make_array( $value ) { $value = self::is_json( $value ) ? json_decode( $value, true ) : $value; return empty( $value ) || ! is_array( $value ) ? [] : $value; } /** * Check if string is a json * * @param $string * * @return bool */ public static function is_json( $string ) { if ( ! is_string( $string ) ) { return false; } json_decode( $string ); return ( json_last_error() === JSON_ERROR_NONE ); } /** * Array unique and sort * * @param $value * * @return array|mixed */ public static function unique( $value ) { if ( ! is_array( $value ) ) { return $value; } $value = array_unique( $value ); sort( $value ); return $value; } /** * @param $endpoints * @param $plugin_slug * * @return array|mixed */ public static function maybe_clear_fb_endpoints( $endpoints, $plugin_slug = 'litespeed' ) { if ( ! class_exists( 'WFFN_Core' ) ) { return $endpoints; } $endpoints = ( ! is_array( $endpoints ) ) ? [] : $endpoints; $db_options = get_option( 'bwf_gen_config', [] ); $cl_slug = is_array( $db_options ) && isset( $db_options['checkout_page_base'] ) ? $db_options['checkout_page_base'] : ''; $of_slug = is_array( $db_options ) && isset( $db_options['wfocu_page_base'] ) ? $db_options['wfocu_page_base'] : ''; if ( 'api-auth' === $plugin_slug ) { $endpoints[] = "/funnelkit-app/"; if ( ! empty( $cl_slug ) ) { $endpoints[] = '/' . $cl_slug . '/'; } if ( ! empty( $of_slug ) ) { $endpoints[] = '/' . $of_slug . '/'; } return $endpoints; } if ( 'litespeed' === $plugin_slug ) { $endpoints[] = "^/wp-json/funnelkit-app/"; if ( ! empty( $cl_slug ) ) { $endpoints[] = '^/' . $cl_slug . '/'; } if ( ! empty( $of_slug ) ) { $endpoints[] = '^/' . $of_slug . '/'; } return $endpoints; } if ( 'wp_rocket' === $plugin_slug ) { $endpoints[] = "^/wp-json/funnelkit-app/(.*)"; if ( ! empty( $cl_slug ) ) { $endpoints[] = '^/' . $cl_slug . '/(.*)'; } if ( ! empty( $of_slug ) ) { $endpoints[] = '^/' . $of_slug . '/(.*)'; } return $endpoints; } return $endpoints; } } }